@designcrowd/library.brand-page 6.0.26-json-prereq-2 → 6.0.26
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-CKBqjDH3.js → CreatedOnBrandCrowd-de-de-DU6YEVcW.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-CRXiimvT.js → CreatedOnBrandCrowd-en-us-DNWWK6Tj.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-DCYdY6sj.js → CreatedOnBrandCrowd-es-es-DVFvV9Qp.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-Dk7LOhxE.js → CreatedOnBrandCrowd-fr-ca-B4ZkjNdw.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-Dk7LOhxE.js → CreatedOnBrandCrowd-fr-fr-B4ZkjNdw.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-Cp4ufHJP.js → CreatedOnBrandCrowd-pt-br-DP7AQGgW.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-Cp4ufHJP.js → CreatedOnBrandCrowd-pt-pt-DP7AQGgW.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-ZSLkWMwM.js → CreatedOnDcom-de-de-CaC3GtG9.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-BgdIGfT3.js → CreatedOnDcom-en-us-D16yT0-P.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-D0KemkCZ.js → CreatedOnDcom-es-es-DA5sHgD_.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-BuwNjNbC.js → CreatedOnDcom-fr-ca-CDv2SG1-.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-DCQcsFPf.js → CreatedOnDcom-fr-fr-Cygc7c5d.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-DD-oLAS1.js → CreatedOnDcom-pt-br-B_3RIzgF.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-D8qLq2wW.js → CreatedOnDcom-pt-pt-Bz5w-rrD.js} +1 -1
- package/lib/src/brand-page/components/contact-form/ContactForm.mixin.js +2 -5
- package/lib/src/brand-page/models/index.d.ts +26 -34
- package/lib/src/brand-page/utils/migration.util.js +0 -11
- package/lib/src/brand-page/utils/text.util.d.ts +1 -1
- package/lib/src/brand-page/utils/text.util.js +0 -32
- package/lib/src/brand-page/utils/vcard.util.js +4 -4
- package/lib/src/brand-page/utils/view-model.util.d.ts +0 -1
- package/lib/src/brand-page/utils/view-model.util.js +20 -68
- package/lib/src/brand-page/view-models.d.ts +3 -3
- package/lib/src/brand-page-maker/composables/ai-chat/useAiMetadataBuilder.d.ts +1 -0
- package/lib/src/brand-page-maker/composables/rich-text-editor/bubbleMenu.d.ts +9 -2
- package/lib/src/brand-page-maker/composables/rich-text-editor/bubbleMenu.js +10 -6
- package/lib/src/brand-page-maker/composables/rich-text-editor/extensions/FontSize.d.ts +20 -0
- package/lib/src/brand-page-maker/composables/rich-text-editor/extensions/FontSize.js +44 -0
- package/lib/src/brand-page-maker/composables/rich-text-editor/extensions/LineHeight.d.ts +27 -0
- package/lib/src/brand-page-maker/composables/rich-text-editor/extensions/LineHeight.js +44 -0
- package/lib/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.d.ts +1 -1
- package/lib/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.js +103 -24
- package/lib/src/brand-page-maker/utils/index.d.ts +0 -2
- package/lib/src/brand-page-maker/utils/index.js +0 -2
- package/lib/src/brand-page-maker/utils/rich-text-editor.util.d.ts +5 -28
- package/lib/src/brand-page-maker/utils/rich-text-editor.util.js +5 -48
- package/lib/src/brand-page-maker/validators/field.validator.js +2 -10
- package/lib/src/css/library.brand-page-brandCrowd.min.css +39 -39
- package/lib/src/css/library.brand-page-brandPage.min.css +39 -39
- package/lib/src/css/library.brand-page-designCom.min.css +39 -39
- package/lib/src/css/library.brand-page-preview.min.css +39 -39
- package/lib/src/index.d.ts +0 -1
- package/lib/src/index.mjs +138 -143
- package/lib/src/{lib-Db6j9fQZ.js → lib-6_P6kXPu.js} +51709 -55194
- package/lib/src/lib.js +0 -2
- package/lib/src/metadata-builder/ai-metadata-executor.d.ts +1 -0
- package/lib/src/metadata-builder/ai-metadata-executor.js +19 -0
- package/lib/src/metadata-builder/builders/section-builders/about-section-builder.js +3 -2
- package/lib/src/metadata-builder/builders/section-builders/banner-section-builder.js +3 -2
- package/lib/src/metadata-builder/builders/section-builders/booking-section-builder.js +3 -2
- package/lib/src/metadata-builder/builders/section-builders/contact-form-builder.js +4 -3
- package/lib/src/metadata-builder/builders/section-builders/images-section-builder.js +3 -2
- package/lib/src/metadata-builder/builders/section-builders/mailing-list-builder.js +2 -1
- package/lib/src/metadata-builder/builders/section-builders/mailing-list-section-builder.js +2 -1
- package/lib/src/metadata-builder/builders/section-builders/profile-section-builder.js +4 -3
- package/lib/src/metadata-builder/builders/section-builders/shapes-section-builder.js +3 -2
- package/lib/src/metadata-builder/builders/section-builders/testimonial-section-builder.js +2 -1
- package/lib/src/metadata-builder/builders/section-builders/text-section-builder.js +11 -15
- package/lib/src/metadata-builder/builders/update-content-text-builder.d.ts +17 -0
- package/lib/src/metadata-builder/builders/update-content-text-builder.js +103 -0
- package/lib/src/metadata-builder/builders/update-content-text-style-builder.d.ts +16 -0
- package/lib/src/metadata-builder/builders/update-content-text-style-builder.js +216 -0
- package/lib/src/metadata-builder/helpers/rte.helpers.d.ts +13 -11
- package/lib/src/metadata-builder/helpers/rte.helpers.js +73 -14
- package/lib/src/metadata-builder/metadata-executor.js +4 -0
- package/lib/src/metadata-builder/models.d.ts +2 -0
- package/lib/src/metadata-builder/models.js +2 -0
- package/lib/src/metadata-builder/parsers/ai-toolcall-parser.d.ts +19 -0
- package/lib/src/metadata-builder/parsers/ai-toolcall-parser.js +4 -0
- package/lib/src/metadata-builder/sanitizers/rte-schema-check.d.ts +8 -7
- package/lib/src/metadata-builder/sanitizers/rte-schema-check.js +52 -21
- package/lib/src/shared/content-settings/components/GenericTextInput.mixin.js +1 -14
- package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.js +3 -12
- package/lib/src/shared/content-settings/components/testimonial-items-field/TestimonialItemsField.mixin.d.ts +2 -3
- package/lib/src/shared/content-settings/components/testimonial-items-field/TestimonialItemsField.mixin.js +3 -10
- package/lib/src/shared/content-settings/components/text-items-field/TextItemsField.mixin.d.ts +1 -2
- package/lib/src/shared/content-settings/components/text-items-field/TextItemsField.mixin.js +1 -4
- package/lib/src/utils/minify-brand-page-metadata.js +1 -4
- package/package.json +15 -17
- package/src/brand-page/components/contact-form/ContactForm.mixin.ts +2 -5
- package/src/brand-page/components/text-wrapper/TextWrapper.vue +6 -17
- package/src/brand-page/models/index.ts +26 -35
- package/src/brand-page/utils/__snapshots__/migration.util.test.ts.snap +3 -3
- package/src/brand-page/utils/migration.util.ts +0 -12
- package/src/brand-page/utils/style.util.test.ts +0 -51
- package/src/brand-page/utils/text.util.ts +4 -43
- package/src/brand-page/utils/vcard.util.ts +4 -6
- package/src/brand-page/utils/view-model.util.ts +26 -94
- package/src/brand-page/view-models.ts +2 -3
- package/src/brand-page-maker/components/rich-text-editor/RichTextEditor.vue +3 -4
- package/src/brand-page-maker/composables/ai-chat/useAiMetadataBuilder.ts +1 -0
- package/src/brand-page-maker/composables/rich-text-editor/bubbleMenu.ts +10 -6
- package/src/brand-page-maker/composables/rich-text-editor/extensions/FontSize.ts +73 -0
- package/src/brand-page-maker/composables/rich-text-editor/extensions/LineHeight.ts +85 -0
- package/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.ts +111 -27
- package/src/brand-page-maker/utils/index.ts +0 -2
- package/src/brand-page-maker/utils/rich-text-editor.util.test.ts +3 -37
- package/src/brand-page-maker/utils/rich-text-editor.util.ts +11 -66
- package/src/brand-page-maker/validators/field.validator.ts +2 -10
- package/src/lib.ts +0 -9
- package/src/metadata-builder/ai-metadata-executor.ts +26 -0
- package/src/metadata-builder/builders/section-builders/about-section-builder.ts +3 -2
- package/src/metadata-builder/builders/section-builders/banner-section-builder.ts +3 -2
- package/src/metadata-builder/builders/section-builders/booking-section-builder.ts +5 -2
- package/src/metadata-builder/builders/section-builders/contact-form-builder.ts +4 -3
- package/src/metadata-builder/builders/section-builders/images-section-builder.ts +3 -2
- package/src/metadata-builder/builders/section-builders/mailing-list-builder.ts +2 -1
- package/src/metadata-builder/builders/section-builders/mailing-list-section-builder.ts +2 -1
- package/src/metadata-builder/builders/section-builders/profile-section-builder.ts +6 -3
- package/src/metadata-builder/builders/section-builders/shapes-section-builder.ts +3 -2
- package/src/metadata-builder/builders/section-builders/testimonial-section-builder.ts +2 -1
- package/src/metadata-builder/builders/section-builders/text-section-builder.ts +13 -19
- package/src/metadata-builder/builders/update-content-text-builder.ts +148 -0
- package/src/metadata-builder/builders/update-content-text-style-builder.ts +352 -0
- package/src/metadata-builder/helpers/rte.helpers.ts +101 -15
- package/src/metadata-builder/metadata-executor.ts +5 -0
- package/src/metadata-builder/models.ts +3 -0
- package/src/metadata-builder/parsers/ai-toolcall-parser.ts +27 -0
- package/src/metadata-builder/sanitizers/rte-schema-check.ts +53 -24
- package/src/shared/content-settings/components/GenericTextInput.mixin.ts +1 -17
- package/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.ts +3 -16
- package/src/shared/content-settings/components/testimonial-items-field/TestimonialItemsField.mixin.ts +4 -13
- package/src/shared/content-settings/components/testimonial-items-field/TestimonialItemsField.vue +4 -6
- package/src/shared/content-settings/components/text-image-field/TextImageField.vue +3 -6
- package/src/shared/content-settings/components/text-items-field/TextItemsField.mixin.ts +1 -6
- package/src/shared/content-settings/components/text-items-field/TextItemsField.vue +1 -1
- package/src/utils/minify-brand-page-metadata.ts +1 -4
- package/lib/src/brand-page/utils/migration/migration-20.d.ts +0 -2
- package/lib/src/brand-page/utils/migration/migration-20.js +0 -66
- package/lib/src/brand-page-maker/__fixtures__/complex-rte.fixture.d.ts +0 -22
- package/lib/src/brand-page-maker/__fixtures__/complex-rte.fixture.js +0 -22
- package/lib/src/brand-page-maker/composables/rich-text-editor/extensions/FontFamily.d.ts +0 -14
- package/lib/src/brand-page-maker/composables/rich-text-editor/extensions/FontFamily.js +0 -39
- package/lib/src/brand-page-maker/composables/rich-text-editor/getRteExtensions.d.ts +0 -28
- package/lib/src/brand-page-maker/composables/rich-text-editor/getRteExtensions.js +0 -90
- package/lib/src/brand-page-maker/utils/rte-render.util.d.ts +0 -63
- package/lib/src/brand-page-maker/utils/rte-render.util.js +0 -95
- package/lib/src/brand-page-maker/utils/rte-sanitize.util.d.ts +0 -6
- package/lib/src/brand-page-maker/utils/rte-sanitize.util.js +0 -158
- package/src/brand-page/utils/migration/migration-20.server.test.ts +0 -125
- package/src/brand-page/utils/migration/migration-20.test.ts +0 -72
- package/src/brand-page/utils/migration/migration-20.ts +0 -87
- package/src/brand-page/utils/text.util.test.ts +0 -47
- package/src/brand-page/utils/view-model.pageid-rte.test.ts +0 -104
- package/src/brand-page-maker/__fixtures__/complex-rte.fixture.ts +0 -23
- package/src/brand-page-maker/composables/rich-text-editor/extensions/FontFamily.test.ts +0 -52
- package/src/brand-page-maker/composables/rich-text-editor/extensions/FontFamily.ts +0 -42
- package/src/brand-page-maker/composables/rich-text-editor/getRteExtensions.ts +0 -137
- package/src/brand-page-maker/utils/__snapshots__/rte-render-parity.test.ts.snap +0 -202
- package/src/brand-page-maker/utils/rte-features.test.ts +0 -351
- package/src/brand-page-maker/utils/rte-render-parity.test.ts +0 -157
- package/src/brand-page-maker/utils/rte-render.util.ts +0 -165
- package/src/brand-page-maker/utils/rte-sanitize-json.test.ts +0 -158
- package/src/brand-page-maker/utils/rte-sanitize.util.ts +0 -195
- package/src/brand-page-maker/validators/field.validator.test.ts +0 -55
|
@@ -3,7 +3,7 @@ import { EMPTY_TESTIMONIAL, MAX_DESCRIPTION_LENGTH, MAX_LENGTH_ERROR_MESSAGE, MA
|
|
|
3
3
|
import debounce from 'lodash.debounce';
|
|
4
4
|
import cloneDeep from 'lodash.clonedeep';
|
|
5
5
|
import { useSnapshotStore } from '@brand-page-maker/stores';
|
|
6
|
-
import { getPlainTextFromRTE
|
|
6
|
+
import { getPlainTextFromRTE } from '@brand-page-maker/utils';
|
|
7
7
|
import { isDefaultContentText } from '../../utils';
|
|
8
8
|
import { decodeHtmlEntities } from '@brand-page/utils';
|
|
9
9
|
import { ESCAPED_NEWLINE_CHARACTER } from '../../../../constants/ui';
|
|
@@ -73,9 +73,7 @@ export default defineComponent({
|
|
|
73
73
|
},
|
|
74
74
|
created() {
|
|
75
75
|
this.options = cloneDeep(this.value);
|
|
76
|
-
|
|
77
|
-
// read visible text via getPlainTextFromRTE rather than `.trim()` on a doc.
|
|
78
|
-
this.isEmpty = this.options.map((option) => getPlainTextFromRTE(option.testimonials).length === 0);
|
|
76
|
+
this.isEmpty = this.options.map((option) => option.testimonials.trim().length === 0);
|
|
79
77
|
if (!this.changeDebounce) {
|
|
80
78
|
this.changeDebounce = debounce(this.emitChange, DEBOUNCE_IN_MS);
|
|
81
79
|
}
|
|
@@ -162,12 +160,7 @@ export default defineComponent({
|
|
|
162
160
|
this.emitChange();
|
|
163
161
|
},
|
|
164
162
|
getItemTextPreview(text) {
|
|
165
|
-
|
|
166
|
-
const value = typeof text === 'string' ? text : getPlainTextFromRTE(text);
|
|
167
|
-
return decodeHtmlEntities(value.replace(new RegExp(ESCAPED_NEWLINE_CHARACTER, 'g'), ' '));
|
|
168
|
-
},
|
|
169
|
-
rteTextLength(value) {
|
|
170
|
-
return getRteTextLength(value);
|
|
163
|
+
return decodeHtmlEntities(text.replace(new RegExp(ESCAPED_NEWLINE_CHARACTER, 'g'), ' '));
|
|
171
164
|
},
|
|
172
165
|
getPlainTextValue(index) {
|
|
173
166
|
const text = this.options[index]?.testimonials || '';
|
package/lib/src/shared/content-settings/components/text-items-field/TextItemsField.mixin.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PropType } from 'vue';
|
|
2
|
-
import type { Content, LogoTheme,
|
|
2
|
+
import type { Content, LogoTheme, TextItem, TextStyleDeclaration } from '@brand-page/models';
|
|
3
3
|
import type { DebounceHandle } from 'lodash.debounce';
|
|
4
4
|
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
5
5
|
id: {
|
|
@@ -79,7 +79,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
79
79
|
name: string;
|
|
80
80
|
value: string;
|
|
81
81
|
}, index: number): void;
|
|
82
|
-
rteTextLength(value: RichTextValue): number;
|
|
83
82
|
getPlainTextValue(index: number): string;
|
|
84
83
|
onCaptureSnapshot(): void;
|
|
85
84
|
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("capture-preview-snapshot" | "update:model-value")[], "capture-preview-snapshot" | "update:model-value", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -4,7 +4,7 @@ import debounce from 'lodash.debounce';
|
|
|
4
4
|
import cloneDeep from 'lodash.clonedeep';
|
|
5
5
|
import { decodeHtmlEntities, escapeContentText } from '@brand-page/utils';
|
|
6
6
|
import { useSnapshotStore } from '@brand-page-maker/stores';
|
|
7
|
-
import { getPlainTextFromRTE
|
|
7
|
+
import { getPlainTextFromRTE } from '@brand-page-maker/utils';
|
|
8
8
|
import { isDefaultContentText } from '../../utils';
|
|
9
9
|
const DEBOUNCE_IN_MS = 250;
|
|
10
10
|
export default defineComponent({
|
|
@@ -172,9 +172,6 @@ export default defineComponent({
|
|
|
172
172
|
this.options[index][payload.name] = payload.value;
|
|
173
173
|
this.emitChange();
|
|
174
174
|
},
|
|
175
|
-
rteTextLength(value) {
|
|
176
|
-
return getRteTextLength(value);
|
|
177
|
-
},
|
|
178
175
|
getPlainTextValue(index) {
|
|
179
176
|
const text = this.options[index]?.text || '';
|
|
180
177
|
const plainText = getPlainTextFromRTE(text);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BRAND_PAGE_TYPES, } from '../brand-page/models';
|
|
2
|
-
import { hasRTEContent
|
|
2
|
+
import { hasRTEContent } from '../brand-page-maker/utils';
|
|
3
3
|
import { useExternalRichTextEditor } from '../brand-page-maker/composables/rich-text-editor/useRichTextEditor';
|
|
4
4
|
import { findAssetKey, resolveLogoData, } from './build-asset-manifest';
|
|
5
5
|
const BUTTON_TYPES = [
|
|
@@ -17,9 +17,6 @@ const BUTTON_TYPES = [
|
|
|
17
17
|
'tiktok',
|
|
18
18
|
];
|
|
19
19
|
const convertText = (value, editor) => {
|
|
20
|
-
// Already Tiptap JSON (BP-5787 storage) — keep as-is.
|
|
21
|
-
if (isTiptapDocument(value))
|
|
22
|
-
return value;
|
|
23
20
|
if (typeof value !== 'string' || !value)
|
|
24
21
|
return undefined;
|
|
25
22
|
if (hasRTEContent(value)) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@designcrowd/library.brand-page",
|
|
3
3
|
"description": "A collection of Maker/Designer applications",
|
|
4
|
-
"version": "6.0.26
|
|
4
|
+
"version": "6.0.26",
|
|
5
5
|
"author": "Design.com Eng",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"type": "module",
|
|
@@ -74,20 +74,19 @@
|
|
|
74
74
|
"@designcrowd/fe-shared-lib": "2.0.7",
|
|
75
75
|
"@pinia/nuxt": "0.11.3",
|
|
76
76
|
"@storybook/react": "9.0.4",
|
|
77
|
-
"@tiptap/extension-bubble-menu": "
|
|
78
|
-
"@tiptap/extension-character-count": "
|
|
79
|
-
"@tiptap/extension-color": "
|
|
80
|
-
"@tiptap/extension-font-family": "
|
|
81
|
-
"@tiptap/extension-hard-break": "
|
|
82
|
-
"@tiptap/extension-highlight": "
|
|
83
|
-
"@tiptap/extension-link": "
|
|
84
|
-
"@tiptap/extension-placeholder": "
|
|
85
|
-
"@tiptap/extension-text-align": "
|
|
86
|
-
"@tiptap/extension-text-style": "
|
|
87
|
-
"@tiptap/extension-underline": "
|
|
88
|
-
"@tiptap/starter-kit": "
|
|
89
|
-
"@tiptap/
|
|
90
|
-
"@tiptap/vue-3": "3.28.0",
|
|
77
|
+
"@tiptap/extension-bubble-menu": "^2.14.0",
|
|
78
|
+
"@tiptap/extension-character-count": "2.11.7",
|
|
79
|
+
"@tiptap/extension-color": "2.11.5",
|
|
80
|
+
"@tiptap/extension-font-family": "2.11.5",
|
|
81
|
+
"@tiptap/extension-hard-break": "2.12.0",
|
|
82
|
+
"@tiptap/extension-highlight": "2.11.5",
|
|
83
|
+
"@tiptap/extension-link": "2.11.5",
|
|
84
|
+
"@tiptap/extension-placeholder": "2.11.5",
|
|
85
|
+
"@tiptap/extension-text-align": "2.11.5",
|
|
86
|
+
"@tiptap/extension-text-style": "2.11.5",
|
|
87
|
+
"@tiptap/extension-underline": "2.11.5",
|
|
88
|
+
"@tiptap/starter-kit": "2.11.5",
|
|
89
|
+
"@tiptap/vue-3": "2.11.5",
|
|
91
90
|
"axios": "1.13.5",
|
|
92
91
|
"chroma-js": "2.4.2",
|
|
93
92
|
"click-outside-vue3": "4.0.1",
|
|
@@ -105,7 +104,6 @@
|
|
|
105
104
|
"http-proxy-middleware": "2.0.6",
|
|
106
105
|
"i18next": "25.8.5",
|
|
107
106
|
"jquery": "3.7.1",
|
|
108
|
-
"jsdom": "27.4.0",
|
|
109
107
|
"lodash.clonedeep": "4.5.0",
|
|
110
108
|
"lodash.debounce": "4.0.8",
|
|
111
109
|
"lodash.throttle": "4.1.1",
|
|
@@ -162,7 +160,6 @@
|
|
|
162
160
|
"@types/google.maps": "3.65.1",
|
|
163
161
|
"@types/istanbul-lib-report": "3.0.3",
|
|
164
162
|
"@types/jquery": "3.5.33",
|
|
165
|
-
"@types/jsdom": "21.1.6",
|
|
166
163
|
"@types/lodash.clonedeep": "4.5.9",
|
|
167
164
|
"@types/mssql": "9.1.9",
|
|
168
165
|
"@types/multer": "1.4.11",
|
|
@@ -201,6 +198,7 @@
|
|
|
201
198
|
"imports-loader": "5.0.0",
|
|
202
199
|
"jest-image-snapshot": "6.5.1",
|
|
203
200
|
"js-base64": "3.7.8",
|
|
201
|
+
"jsdom": "27.4.0",
|
|
204
202
|
"jsdom-global": "3.0.2",
|
|
205
203
|
"lint-staged": "15.2.0",
|
|
206
204
|
"mini-css-extract-plugin": "2.10.0",
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
mutedTextForBackground,
|
|
33
33
|
backgroundColorFromStyle,
|
|
34
34
|
} from '@brand-page/utils';
|
|
35
|
-
import { hasRTEContent
|
|
35
|
+
import { hasRTEContent } from '@brand-page-maker/utils';
|
|
36
36
|
import { useReCaptcha } from '../../composables/recaptcha.composable';
|
|
37
37
|
|
|
38
38
|
export interface FieldValue {
|
|
@@ -180,10 +180,7 @@ export default defineComponent({
|
|
|
180
180
|
},
|
|
181
181
|
|
|
182
182
|
title(): string {
|
|
183
|
-
|
|
184
|
-
// throw — read the visible text via getPlainTextFromRTE to decide
|
|
185
|
-
// whether to fall back to the default.
|
|
186
|
-
return getPlainTextFromRTE(this.viewModel.title)
|
|
183
|
+
return this.viewModel.title && this.viewModel.title.trim() !== ''
|
|
187
184
|
? this.viewModel.title
|
|
188
185
|
: 'Contact Us';
|
|
189
186
|
},
|
|
@@ -21,13 +21,7 @@
|
|
|
21
21
|
</div>
|
|
22
22
|
</template>
|
|
23
23
|
<script setup lang="ts">
|
|
24
|
-
import {
|
|
25
|
-
hasRTEContent,
|
|
26
|
-
getPlainTextFromRTE,
|
|
27
|
-
renderRteToHtml,
|
|
28
|
-
isTiptapDocument,
|
|
29
|
-
type RichTextValue,
|
|
30
|
-
} from '@brand-page-maker/utils';
|
|
24
|
+
import { hasRTEContent, getPlainTextFromRTE } from '@brand-page-maker/utils';
|
|
31
25
|
import {
|
|
32
26
|
type FluidTextData,
|
|
33
27
|
type TextStyleDeclaration,
|
|
@@ -43,8 +37,7 @@ import {
|
|
|
43
37
|
|
|
44
38
|
interface Props {
|
|
45
39
|
textStyle: TextStyleDeclaration | undefined;
|
|
46
|
-
|
|
47
|
-
text: RichTextValue;
|
|
40
|
+
text: string;
|
|
48
41
|
element?: string;
|
|
49
42
|
slug?: string;
|
|
50
43
|
}
|
|
@@ -86,20 +79,16 @@ const textStyleRTE = computed(() => {
|
|
|
86
79
|
};
|
|
87
80
|
});
|
|
88
81
|
|
|
89
|
-
// Render either form (legacy HTML string or Tiptap JSON) to final HTML.
|
|
90
|
-
// For a string this returns it unchanged, so the legacy path is unaffected.
|
|
91
|
-
const renderedHtml = computed(() => renderRteToHtml(props.text));
|
|
92
|
-
|
|
93
82
|
const isRTEContent = computed(() => {
|
|
94
|
-
return
|
|
83
|
+
return hasRTEContent(props.text);
|
|
95
84
|
});
|
|
96
85
|
|
|
97
86
|
const sanitizeText = computed(() => {
|
|
98
|
-
if (isRTEContent.value && !getPlainTextFromRTE(
|
|
87
|
+
if (isRTEContent.value && !getPlainTextFromRTE(props.text)) {
|
|
99
88
|
return '';
|
|
100
89
|
}
|
|
101
90
|
|
|
102
|
-
return
|
|
91
|
+
return props.text;
|
|
103
92
|
});
|
|
104
93
|
|
|
105
94
|
const fontSize = computed<any>(() => props.textStyle.fontSize);
|
|
@@ -171,7 +160,7 @@ const applyScale = () => {
|
|
|
171
160
|
}
|
|
172
161
|
|
|
173
162
|
const fontSizeMatchInRTEText = [
|
|
174
|
-
...
|
|
163
|
+
...props.text.matchAll(
|
|
175
164
|
/style="(?:[^"]*?)\bfont-size\s*:\s*(?<fontSize>[^;"']+)[^"]*?"/gm,
|
|
176
165
|
),
|
|
177
166
|
].map((x) => parseFloat(x.groups?.fontSize || '1em'));
|
|
@@ -30,15 +30,6 @@ import type { LogoImageModel, LogoTemplateImageModel } from './logo.model';
|
|
|
30
30
|
import cloneDeep from 'lodash.clonedeep';
|
|
31
31
|
import * as uuid from 'uuid';
|
|
32
32
|
import type { BrandPagePaymentConfig } from './payment.model';
|
|
33
|
-
import type { JSONContent } from '@tiptap/vue-3';
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* BP-5787 — a rich-text field is either a legacy inline-HTML string or a
|
|
37
|
-
* Tiptap JSON document. Typing RTE content fields as RichTextValue (instead of
|
|
38
|
-
* `string`) forces every consumer to handle both forms — surfacing at compile
|
|
39
|
-
* time any code that assumes a plain string (e.g. `.replace`, `.length`).
|
|
40
|
-
*/
|
|
41
|
-
export type RichTextValue = string | JSONContent;
|
|
42
33
|
|
|
43
34
|
export * from './brand-page-context.model';
|
|
44
35
|
export * from './payment.model';
|
|
@@ -289,7 +280,7 @@ export interface TextContent extends Content {
|
|
|
289
280
|
/**
|
|
290
281
|
* For BrandPage/BrandContact only
|
|
291
282
|
*/
|
|
292
|
-
text:
|
|
283
|
+
text: string;
|
|
293
284
|
/**
|
|
294
285
|
* For BrandSite
|
|
295
286
|
*/
|
|
@@ -313,9 +304,9 @@ export interface TextContent extends Content {
|
|
|
313
304
|
|
|
314
305
|
export interface ProfileContent extends Content {
|
|
315
306
|
avatarImageUrl: string;
|
|
316
|
-
name:
|
|
317
|
-
title:
|
|
318
|
-
description:
|
|
307
|
+
name: string;
|
|
308
|
+
title: string;
|
|
309
|
+
description: string;
|
|
319
310
|
backgroundColor: BrandPageCssStyle;
|
|
320
311
|
colorReplacements: ColorReplacement[];
|
|
321
312
|
mediaType?: string;
|
|
@@ -336,7 +327,7 @@ export interface MapContent extends Content {
|
|
|
336
327
|
|
|
337
328
|
export interface MailingListContent extends Content {
|
|
338
329
|
acceptedFields?: 'emailOnly' | 'nameAndEmail';
|
|
339
|
-
title:
|
|
330
|
+
title: string;
|
|
340
331
|
buttonText: string;
|
|
341
332
|
titleStyle: TextStyleDeclaration;
|
|
342
333
|
buttonTextStyle: TextStyleDeclaration;
|
|
@@ -396,10 +387,10 @@ export interface FormField {
|
|
|
396
387
|
export interface ContactFormContent extends Content {
|
|
397
388
|
type: 'contact-form';
|
|
398
389
|
displayStyle: string;
|
|
399
|
-
title:
|
|
400
|
-
description:
|
|
390
|
+
title: string;
|
|
391
|
+
description: string;
|
|
401
392
|
buttonText: string;
|
|
402
|
-
successMessage:
|
|
393
|
+
successMessage: string;
|
|
403
394
|
fields: FormField[];
|
|
404
395
|
responseEmail: string;
|
|
405
396
|
imageUrl?: string;
|
|
@@ -419,8 +410,8 @@ export interface ContactFormContent extends Content {
|
|
|
419
410
|
export interface BannerSectionContent extends Content {
|
|
420
411
|
type: 'banner-section';
|
|
421
412
|
imageUrl: string;
|
|
422
|
-
title:
|
|
423
|
-
description:
|
|
413
|
+
title: string;
|
|
414
|
+
description: string;
|
|
424
415
|
buttonText: string | false;
|
|
425
416
|
url: string;
|
|
426
417
|
email?: string;
|
|
@@ -450,8 +441,8 @@ export const MEDIA_TYPES = {
|
|
|
450
441
|
export type MediaType = keyof typeof MEDIA_TYPES;
|
|
451
442
|
|
|
452
443
|
export interface TextMediaItem extends ImageItem {
|
|
453
|
-
title:
|
|
454
|
-
paragraph:
|
|
444
|
+
title: string;
|
|
445
|
+
paragraph: string;
|
|
455
446
|
itemsId: number;
|
|
456
447
|
|
|
457
448
|
buttonText?: string | false;
|
|
@@ -475,8 +466,8 @@ export interface TextShapeItem extends TextMediaItem {
|
|
|
475
466
|
export interface ShapeItem extends ImageItem {
|
|
476
467
|
colorReplacements: ColorReplacement[];
|
|
477
468
|
mediaType: MediaType;
|
|
478
|
-
title?:
|
|
479
|
-
paragraph?:
|
|
469
|
+
title?: string;
|
|
470
|
+
paragraph?: string;
|
|
480
471
|
|
|
481
472
|
// overrides for personalisation
|
|
482
473
|
titleOverride?: string;
|
|
@@ -487,9 +478,9 @@ export interface TestimonialItems {
|
|
|
487
478
|
/** Stable per-item identifier. See ImageItem.id. */
|
|
488
479
|
id: string;
|
|
489
480
|
imageUrl: string;
|
|
490
|
-
name:
|
|
491
|
-
position:
|
|
492
|
-
testimonials:
|
|
481
|
+
name: string;
|
|
482
|
+
position: string;
|
|
483
|
+
testimonials: string;
|
|
493
484
|
colorReplacements: ColorReplacement[];
|
|
494
485
|
mediaType: string;
|
|
495
486
|
size?: string;
|
|
@@ -505,7 +496,7 @@ export interface TestimonialItems {
|
|
|
505
496
|
export interface TextItem {
|
|
506
497
|
/** Stable per-item identifier. See ImageItem.id. */
|
|
507
498
|
id: string;
|
|
508
|
-
text:
|
|
499
|
+
text: string;
|
|
509
500
|
textStyle: TextStyleDeclaration;
|
|
510
501
|
|
|
511
502
|
// overrides for personalisation
|
|
@@ -527,8 +518,8 @@ export interface ImagesSectionContent extends Content, MediaSection {
|
|
|
527
518
|
}
|
|
528
519
|
|
|
529
520
|
export interface MediaSection extends Content {
|
|
530
|
-
title:
|
|
531
|
-
description:
|
|
521
|
+
title: string;
|
|
522
|
+
description: string;
|
|
532
523
|
displayStyle: ImagesSectionContentDisplayStyle;
|
|
533
524
|
items: TextShapeItem[] | TextMediaItem[];
|
|
534
525
|
titleStyle: TextStyleDeclaration;
|
|
@@ -547,7 +538,7 @@ export interface ColorReplacement {
|
|
|
547
538
|
|
|
548
539
|
export interface TestimonialSectionContent extends Content {
|
|
549
540
|
type: 'testimonial-section';
|
|
550
|
-
title:
|
|
541
|
+
title: string;
|
|
551
542
|
displayStyle: string;
|
|
552
543
|
items: TestimonialItems[];
|
|
553
544
|
titleStyle: TextStyleDeclaration;
|
|
@@ -562,8 +553,8 @@ export interface TestimonialSectionContent extends Content {
|
|
|
562
553
|
export interface AboutSectionContent extends Content {
|
|
563
554
|
type: 'about-section';
|
|
564
555
|
imageUrl: string;
|
|
565
|
-
title:
|
|
566
|
-
paragraph:
|
|
556
|
+
title: string;
|
|
557
|
+
paragraph: string;
|
|
567
558
|
displayStyle: string;
|
|
568
559
|
titleStyle: TextStyleDeclaration;
|
|
569
560
|
paragraphStyle: TextStyleDeclaration;
|
|
@@ -592,7 +583,7 @@ export type SocialLinksIconDisplayStyle =
|
|
|
592
583
|
|
|
593
584
|
export interface SocialLinksContent extends Content {
|
|
594
585
|
type: 'social-links';
|
|
595
|
-
title:
|
|
586
|
+
title: string;
|
|
596
587
|
links: LinksItem[];
|
|
597
588
|
iconDisplayStyle: SocialLinksIconDisplayStyle;
|
|
598
589
|
iconFillStyles: BrandPageCssStyle;
|
|
@@ -619,8 +610,8 @@ export interface DividerSectionContent extends Content {
|
|
|
619
610
|
|
|
620
611
|
export interface BookingSectionContent extends Content {
|
|
621
612
|
type: 'booking-section';
|
|
622
|
-
title:
|
|
623
|
-
description:
|
|
613
|
+
title: string;
|
|
614
|
+
description: string;
|
|
624
615
|
buttonText: string;
|
|
625
616
|
url: string;
|
|
626
617
|
email?: string;
|
|
@@ -462,7 +462,7 @@ exports[`migration.util > Banner Contents - text Align and Font Family should no
|
|
|
462
462
|
},
|
|
463
463
|
},
|
|
464
464
|
},
|
|
465
|
-
"v":
|
|
465
|
+
"v": 19,
|
|
466
466
|
},
|
|
467
467
|
"useOldLogoRenderSize": true,
|
|
468
468
|
}
|
|
@@ -914,7 +914,7 @@ exports[`migration.util > migrateBrandPageModel should return brand page model w
|
|
|
914
914
|
},
|
|
915
915
|
},
|
|
916
916
|
},
|
|
917
|
-
"v":
|
|
917
|
+
"v": 19,
|
|
918
918
|
},
|
|
919
919
|
"useOldLogoRenderSize": true,
|
|
920
920
|
}
|
|
@@ -1373,7 +1373,7 @@ exports[`migration.util > migrateBrandPageModel should return brand page model w
|
|
|
1373
1373
|
},
|
|
1374
1374
|
},
|
|
1375
1375
|
},
|
|
1376
|
-
"v":
|
|
1376
|
+
"v": 19,
|
|
1377
1377
|
},
|
|
1378
1378
|
"useOldLogoRenderSize": true,
|
|
1379
1379
|
}
|
|
@@ -22,7 +22,6 @@ import { migration16 } from './migration/migration-16';
|
|
|
22
22
|
import { migration17 } from './migration/migration-17';
|
|
23
23
|
import { migration18 } from './migration/migration-18';
|
|
24
24
|
import { migration19 } from './migration/migration-19';
|
|
25
|
-
import { migration20 } from './migration/migration-20';
|
|
26
25
|
|
|
27
26
|
export interface MigrationData {
|
|
28
27
|
brandPageModel: BrandPageModel;
|
|
@@ -180,17 +179,6 @@ const MIGRATION_TABLE = [
|
|
|
180
179
|
description:
|
|
181
180
|
'BP-5800: seed the button fill colour as each block’s own container colour so it is independent of the site button (existing sites render unchanged) — backgroundStyle for mailing-list, request-payment and support-me (all types); cardStyle for the BP/BC contact form (skipped on brand-site)',
|
|
182
181
|
},
|
|
183
|
-
{
|
|
184
|
-
version: 20,
|
|
185
|
-
migrateFn: migration20,
|
|
186
|
-
// One-time versioned migration (NOT runAlways): legacy sites (v < 20)
|
|
187
|
-
// convert on their first load in any environment — the maker (browser DOM)
|
|
188
|
-
// and web-renderer SSR (migration-20 installs a jsdom window). It no longer
|
|
189
|
-
// needs to re-run every load because the AI section builders now emit Tiptap
|
|
190
|
-
// JSON directly, so there is no recurring post-load source of HTML to catch.
|
|
191
|
-
description:
|
|
192
|
-
'BP-5787: convert inline-HTML RTE content to Tiptap JSON on first load (client or server); AI builders emit JSON directly, so this runs once per site',
|
|
193
|
-
},
|
|
194
182
|
] as MigrationTableItem[];
|
|
195
183
|
|
|
196
184
|
export const GetLatestModelVersion = () =>
|
|
@@ -87,57 +87,6 @@ describe('style.util', () => {
|
|
|
87
87
|
);
|
|
88
88
|
});
|
|
89
89
|
|
|
90
|
-
test('applyLogoThemeToBrandPageModel preserves var() token refs in JSON RTE content (BP-5787)', () => {
|
|
91
|
-
// Arrange — title stored as Tiptap JSON with a theme-token colour mark.
|
|
92
|
-
const logoTheme = logoWithFlatColorsTheme;
|
|
93
|
-
const titleDoc = {
|
|
94
|
-
type: 'doc',
|
|
95
|
-
content: [
|
|
96
|
-
{
|
|
97
|
-
type: 'heading',
|
|
98
|
-
attrs: { level: 2, textAlign: 'center' },
|
|
99
|
-
content: [
|
|
100
|
-
{
|
|
101
|
-
type: 'text',
|
|
102
|
-
marks: [
|
|
103
|
-
{
|
|
104
|
-
type: 'textStyle',
|
|
105
|
-
attrs: { color: `var(--${STYLE_THEME_KEYS.LogoTextColor})` },
|
|
106
|
-
},
|
|
107
|
-
],
|
|
108
|
-
text: 'Themed',
|
|
109
|
-
},
|
|
110
|
-
],
|
|
111
|
-
},
|
|
112
|
-
],
|
|
113
|
-
};
|
|
114
|
-
const brandPageModel = new BrandPageModel({
|
|
115
|
-
...BRAND_SITE,
|
|
116
|
-
pages: [
|
|
117
|
-
{
|
|
118
|
-
title: '1',
|
|
119
|
-
slug: '1',
|
|
120
|
-
contents: [
|
|
121
|
-
{
|
|
122
|
-
...createInitialBannerSectionContent(),
|
|
123
|
-
title: titleDoc,
|
|
124
|
-
} as any,
|
|
125
|
-
],
|
|
126
|
-
},
|
|
127
|
-
],
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
// Act
|
|
131
|
-
const { model } = applyLogoThemeToBrandPageModel(logoTheme, brandPageModel);
|
|
132
|
-
|
|
133
|
-
// Assert — JSON RTE content is an object, so the var() token is NOT
|
|
134
|
-
// flattened to rgb(); it survives so a new theme can still propagate.
|
|
135
|
-
const title = JSON.stringify((model.pages[0].contents[0] as any).title);
|
|
136
|
-
|
|
137
|
-
expect(title).toContain(`var(--${STYLE_THEME_KEYS.LogoTextColor})`);
|
|
138
|
-
expect(title).not.toContain(logoTheme.logoTextColor.rgb);
|
|
139
|
-
});
|
|
140
|
-
|
|
141
90
|
test('applyLogoThemeToBrandPageModel should apply logo theme color to content color when content color has a color matched theme key', () => {
|
|
142
91
|
// Arrange
|
|
143
92
|
const logoTheme = logoWithFlatColorsTheme;
|
|
@@ -1,56 +1,17 @@
|
|
|
1
1
|
import { ESCAPED_NEWLINE_CHARACTER } from '../../constants/ui';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* BP-5787 — a Tiptap JSON document is an object with `type: 'doc'`.
|
|
5
|
-
* Inlined here (rather than importing from brand-page-maker) to avoid a
|
|
6
|
-
* circular import: rich-text-editor.util imports getRenderText from this file.
|
|
7
|
-
*/
|
|
8
|
-
const isTiptapDoc = (value: unknown): value is { type: 'doc' } =>
|
|
9
|
-
typeof value === 'object' &&
|
|
10
|
-
value !== null &&
|
|
11
|
-
(value as { type?: string }).type === 'doc';
|
|
12
|
-
|
|
13
|
-
const jsonDocPlainText = (doc: unknown): string => {
|
|
14
|
-
const parts: string[] = [];
|
|
15
|
-
|
|
16
|
-
const walk = (node: any): void => {
|
|
17
|
-
if (typeof node?.text === 'string') parts.push(node.text);
|
|
18
|
-
|
|
19
|
-
node?.content?.forEach(walk);
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
walk(doc);
|
|
23
|
-
|
|
24
|
-
return parts.join(' ').replace(/\s+/g, ' ').trim();
|
|
25
|
-
};
|
|
26
|
-
|
|
27
3
|
export const getRenderText = (text: string): string => {
|
|
28
|
-
// BP-5787: RTE fields may now be Tiptap JSON objects. Non-strings pass
|
|
29
|
-
// through untouched so the renderer (TextWrapper) handles them via its
|
|
30
|
-
// JSON-aware path, instead of throwing on `.replace`.
|
|
31
|
-
if (typeof text !== 'string') {
|
|
32
|
-
return text as unknown as string;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
4
|
return text.replace(
|
|
36
5
|
new RegExp(`(${ESCAPED_NEWLINE_CHARACTER}|\\n)`, 'g'),
|
|
37
6
|
'<br/>',
|
|
38
7
|
);
|
|
39
8
|
};
|
|
40
9
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
10
|
+
export const escapeContentText = (
|
|
11
|
+
text: string | undefined,
|
|
12
|
+
): string | undefined => {
|
|
44
13
|
if (!text) {
|
|
45
|
-
return text
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (isTiptapDoc(text)) {
|
|
49
|
-
return jsonDocPlainText(text);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (typeof text !== 'string') {
|
|
53
|
-
return undefined;
|
|
14
|
+
return text;
|
|
54
15
|
}
|
|
55
16
|
|
|
56
17
|
return text
|
|
@@ -235,11 +235,9 @@ const addProfileInfo = (
|
|
|
235
235
|
profile: ProfileViewModel,
|
|
236
236
|
vcardLines: string[],
|
|
237
237
|
): void => {
|
|
238
|
-
const name = sanitizeForVCard(
|
|
239
|
-
const title = sanitizeForVCard(
|
|
240
|
-
const description = sanitizeForVCard(
|
|
241
|
-
getPlainTextFromRTE(profile.description) || '',
|
|
242
|
-
);
|
|
238
|
+
const name = sanitizeForVCard(profile.name || '');
|
|
239
|
+
const title = sanitizeForVCard(profile.title || '');
|
|
240
|
+
const description = sanitizeForVCard(profile.description || '');
|
|
243
241
|
|
|
244
242
|
if (name) {
|
|
245
243
|
const nameParts = name.trim().split(/\s+/);
|
|
@@ -318,7 +316,7 @@ export const saveContact = (brandPageData: {
|
|
|
318
316
|
}): void => {
|
|
319
317
|
const vcard = generateVCard(brandPageData);
|
|
320
318
|
const profile = findProfileContent(brandPageData);
|
|
321
|
-
const filename = generateVCardFilename(
|
|
319
|
+
const filename = generateVCardFilename(profile?.name);
|
|
322
320
|
|
|
323
321
|
downloadVCard(vcard, filename);
|
|
324
322
|
};
|