@designcrowd/library.brand-page 6.2.3-ast-faq → 6.2.3
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-BRisMzFY.js → CreatedOnBrandCrowd-de-de-Cn0M-eZ1.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-CDDsL9GX.js → CreatedOnBrandCrowd-en-us-DRLMSDZr.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-BkZrEo4j.js → CreatedOnBrandCrowd-es-es-BglTu73U.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-sx_ury7R.js → CreatedOnBrandCrowd-fr-ca-Bj6YZ_el.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-sx_ury7R.js → CreatedOnBrandCrowd-fr-fr-Bj6YZ_el.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-DCWiAfkU.js → CreatedOnBrandCrowd-pt-br-DEoOmQ1F.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-DCWiAfkU.js → CreatedOnBrandCrowd-pt-pt-DEoOmQ1F.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-C1S7f22L.js → CreatedOnDcom-de-de-BZ7gTt4Z.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-DgTlWaXE.js → CreatedOnDcom-en-us-CD6Km5sH.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-CxSQJe_V.js → CreatedOnDcom-es-es-CNpZHvEl.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-Bbam2tt6.js → CreatedOnDcom-fr-ca-URS-ydJ1.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-Cb0XDRPL.js → CreatedOnDcom-fr-fr-D2AVeA3H.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-BjdX3-E3.js → CreatedOnDcom-pt-br-C32frnFs.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-BXpbfopB.js → CreatedOnDcom-pt-pt-TDYGjRXS.js} +1 -1
- package/lib/src/brand-page/constants/misc.constants.d.ts +0 -8
- package/lib/src/brand-page/constants/misc.constants.js +0 -7
- package/lib/src/brand-page/constants/styles.constants.d.ts +0 -2
- package/lib/src/brand-page/constants/styles.constants.js +0 -2
- package/lib/src/brand-page/models/content.model.d.ts +0 -1
- package/lib/src/brand-page/models/content.model.js +0 -1
- package/lib/src/brand-page/models/index.d.ts +0 -19
- package/lib/src/brand-page/utils/content-callback-util.d.ts +1 -2
- package/lib/src/brand-page/utils/content-callback-util.js +0 -3
- package/lib/src/brand-page/utils/model.util.d.ts +1 -2
- package/lib/src/brand-page/utils/model.util.js +0 -3
- package/lib/src/brand-page/utils/view-model.util.d.ts +0 -2
- package/lib/src/brand-page/utils/view-model.util.js +0 -24
- package/lib/src/brand-page/view-models.d.ts +2 -9
- package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.d.ts +0 -10
- package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.d.ts +0 -10
- package/lib/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.d.ts +0 -13
- package/lib/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.js +30 -64
- package/lib/src/brand-page-maker/constants/config-settings-constant.d.ts +1 -2
- package/lib/src/brand-page-maker/constants/config-settings-constant.js +2 -101
- package/lib/src/brand-page-maker/models/content-settings-configs.d.ts +1 -22
- package/lib/src/brand-page-maker/models/content-settings-configs.js +0 -1
- package/lib/src/brand-page-maker/models/content-settings.d.ts +1 -4
- package/lib/src/brand-page-maker/models/content-settings.js +1 -45
- package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.js +0 -1
- package/lib/src/brand-page-maker/utils/apply-color-strategy.js +17 -47
- package/lib/src/brand-page-maker/utils/rich-text-editor.util.d.ts +0 -6
- package/lib/src/brand-page-maker/utils/rich-text-editor.util.js +1 -24
- package/lib/src/brand-page-maker/validators/field.validator.js +0 -2
- package/lib/src/bundled-translations-BYUfWBT3.js +179 -0
- package/lib/src/bundles/bundled-translations.json +2 -20
- package/lib/src/composables/useTranslate.d.ts +1 -1
- package/lib/src/composables/useTranslate.js +1 -1
- package/lib/src/css/library.brand-page-brandCrowd.min.css +36 -143
- package/lib/src/css/library.brand-page-brandPage.min.css +36 -143
- package/lib/src/css/library.brand-page-designCom.min.css +36 -143
- package/lib/src/css/library.brand-page-preview.min.css +36 -143
- package/lib/src/index.mjs +158 -159
- package/lib/src/{lib-DwpSAbLZ.js → lib-Dm9AuOJL.js} +26180 -26906
- package/lib/src/metadata-builder/parsers/section-tool-arguments.d.ts +1 -1
- package/lib/src/shared/color-strategies/color-strategies.js +0 -4
- package/lib/src/shared/color-strategies/rte-field-pairs.d.ts +0 -12
- package/lib/src/shared/color-strategies/rte-field-pairs.js +0 -10
- package/lib/src/shared/content-settings/components/content-settings/ContentSettings.mixin.d.ts +0 -10
- package/lib/src/shared/content-settings/components/content-settings/ReplaceImageSettingsForContent.mixin.d.ts +1 -11
- package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItem.mixin.d.ts +0 -10
- package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.d.ts +0 -10
- package/lib/src/shared/content-settings/components/focused-content-item-settings/FocusedContentItemSettings.mixin.d.ts +0 -10
- package/lib/src/shared/content-settings/components/items-field/ItemsField.mixin.d.ts +1 -14
- package/lib/src/shared/content-settings/components/items-field/ItemsField.mixin.js +1 -11
- package/lib/src/shared/content-settings/components/textarea-field/TextareaField.mixin.d.ts +0 -12
- package/lib/src/shared/content-settings/components/textarea-field/TextareaField.mixin.js +0 -5
- package/lib/src/shared/content-settings/models.d.ts +0 -6
- package/lib/src/shared/content-settings/store/content-settings-store.d.ts +1 -14
- package/lib/src/shared/content-settings/store/content-settings-store.js +2 -24
- package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.d.ts +0 -10
- package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.d.ts +0 -10
- package/package.json +2 -2
- package/src/brand-page/components/page/PageComponent.vue +0 -2
- package/src/brand-page/constants/misc.constants.ts +0 -12
- package/src/brand-page/constants/styles.constants.ts +0 -2
- package/src/brand-page/models/content.model.ts +0 -1
- package/src/brand-page/models/index.ts +0 -21
- package/src/brand-page/utils/content-callback-util.ts +0 -5
- package/src/brand-page/utils/model.util.ts +0 -7
- package/src/brand-page/utils/view-model.util.test.ts +0 -96
- package/src/brand-page/utils/view-model.util.ts +0 -49
- package/src/brand-page/view-models.ts +1 -12
- package/src/brand-page-maker/components/rich-text-editor/RichTextEditor.vue +49 -37
- package/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.ts +30 -87
- package/src/brand-page-maker/constants/config-settings-constant.ts +0 -108
- package/src/brand-page-maker/convertors/i18n/converter.json +1 -4
- package/src/brand-page-maker/models/content-settings-configs.ts +0 -24
- package/src/brand-page-maker/models/content-settings.ts +0 -57
- package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.ts +0 -2
- package/src/brand-page-maker/utils/__snapshots__/apply-color-strategy.golden.test.ts.snap +389 -3557
- package/src/brand-page-maker/utils/apply-color-strategy.test.ts +2 -104
- package/src/brand-page-maker/utils/apply-color-strategy.ts +19 -77
- package/src/brand-page-maker/utils/rich-text-editor.util.test.ts +0 -110
- package/src/brand-page-maker/utils/rich-text-editor.util.ts +0 -66
- package/src/brand-page-maker/validators/field.validator.ts +0 -2
- package/src/bundles/bundled-translations.json +2 -20
- package/src/composables/useTranslate.ts +1 -2
- package/src/metadata-builder/builders/item-id-utils.test.ts +0 -24
- package/src/metadata-builder/parsers/section-tool-arguments.ts +1 -2
- package/src/shared/color-strategies/color-strategies.ts +0 -4
- package/src/shared/color-strategies/rte-field-pairs.ts +0 -23
- package/src/shared/content-settings/components/content-settings/i18n/content-settings.json +1 -17
- package/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.vue +0 -3
- package/src/shared/content-settings/components/items-field/ItemsField.mixin.ts +1 -11
- package/src/shared/content-settings/components/items-field/ItemsField.vue +2 -8
- package/src/shared/content-settings/components/textarea-field/TextareaField.mixin.ts +0 -6
- package/src/shared/content-settings/components/textarea-field/TextareaField.vue +0 -1
- package/src/shared/content-settings/models.ts +0 -7
- package/src/shared/content-settings/store/content-settings-store.test.ts +0 -70
- package/src/shared/content-settings/store/content-settings-store.ts +3 -37
- package/src/shared/ecommerce-settings/util/refreshDuplicatedMetadata.test.ts +0 -19
- package/src/utils/minify-brand-page-metadata.test.ts +0 -35
- package/lib/src/brand-page-maker/convertors/faq-display-style.convertor.d.ts +0 -3
- package/lib/src/brand-page-maker/convertors/faq-display-style.convertor.js +0 -47
- package/lib/src/bundled-translations-DY9YvuL-.js +0 -179
- package/src/brand-page/components/faq-section/FaqSection.test.ts +0 -292
- package/src/brand-page/components/faq-section/FaqSection.vue +0 -299
- package/src/brand-page/components/section-heading/SectionHeading.vue +0 -52
- package/src/brand-page/components/text-wrapper/TextWrapper.test.ts +0 -33
- package/src/brand-page-maker/components/rich-text-editor/RichTextEditor.test.ts +0 -165
- package/src/brand-page-maker/constants/faq-section-config.test.ts +0 -151
- package/src/brand-page-maker/convertors/faq-display-style.convertor.ts +0 -59
- package/src/metadata-builder/parsers/section-tool-map.test.ts +0 -12
- package/src/shared/content-settings/components/list-items-field/ListItemsField.test.ts +0 -429
- package/src/shared/content-settings/components/list-items-field/ListItemsField.vue +0 -262
|
@@ -39,13 +39,8 @@ export default defineComponent({
|
|
|
39
39
|
required: false,
|
|
40
40
|
default: true,
|
|
41
41
|
},
|
|
42
|
-
deleteLabel: {
|
|
43
|
-
type: String,
|
|
44
|
-
required: false,
|
|
45
|
-
default: 'Delete payment option',
|
|
46
|
-
},
|
|
47
42
|
},
|
|
48
|
-
emits: ['items-change', 'items-delete', 'itemsEdit'
|
|
43
|
+
emits: ['items-change', 'items-delete', 'itemsEdit'],
|
|
49
44
|
data: () => ({
|
|
50
45
|
itemStates: {} as Record<number, ItemFieldState>,
|
|
51
46
|
}),
|
|
@@ -93,11 +88,6 @@ export default defineComponent({
|
|
|
93
88
|
methods: {
|
|
94
89
|
toggleCollapsed(index: number) {
|
|
95
90
|
this.itemStates[index].isCollapsed = !this.itemStates[index].isCollapsed;
|
|
96
|
-
this.$emit('item-toggle', index, this.itemStates[index].isCollapsed);
|
|
97
|
-
},
|
|
98
|
-
expand(index: number): void {
|
|
99
|
-
this.itemStates[index] = { index, isCollapsed: false };
|
|
100
|
-
this.$emit('item-toggle', index, false);
|
|
101
91
|
},
|
|
102
92
|
onDelete(index: number): void {
|
|
103
93
|
this.$emit('items-delete', index);
|
|
@@ -7,10 +7,7 @@
|
|
|
7
7
|
:disabled="!isDraggable"
|
|
8
8
|
>
|
|
9
9
|
<template #item="{ element, index }">
|
|
10
|
-
<li
|
|
11
|
-
:key="`items-${element.item.id}-${index}`"
|
|
12
|
-
data-test-items-field-row
|
|
13
|
-
>
|
|
10
|
+
<li :key="`items-${element.item.id}-${index}`">
|
|
14
11
|
<div
|
|
15
12
|
class="tw-mb-2 tw-bg-grayscale-200 tw-p-4 tw-rounded-md tw-border tw-border-grayscale-400 tw-border-solid"
|
|
16
13
|
>
|
|
@@ -52,17 +49,14 @@
|
|
|
52
49
|
</div>
|
|
53
50
|
<button
|
|
54
51
|
class="tw-bg-transparent tw-border-none tw-cursor-pointer tw-object-center tw-p-0 tw-text-grayscale-600 hover:tw-text-primary-500 tw-transition-colors tw-duration-300 tw-ease-out"
|
|
55
|
-
data-test-items-field-delete
|
|
56
52
|
@click="onDelete(index)"
|
|
57
53
|
>
|
|
58
|
-
<span class="tw-sr-only">
|
|
54
|
+
<span class="tw-sr-only">Delete payment option</span>
|
|
59
55
|
<Icon name="delete" size="sm" />
|
|
60
56
|
</button>
|
|
61
57
|
<div
|
|
62
58
|
v-if="canCollapse"
|
|
63
59
|
class="tw-bg-transparent tw-border-none tw-text-grayscale-600 tw-cursor-pointer tw-ml-2"
|
|
64
|
-
data-test-items-field-toggle
|
|
65
|
-
:data-test-collapsed="element.state.isCollapsed"
|
|
66
60
|
@click="toggleCollapsed(index)"
|
|
67
61
|
>
|
|
68
62
|
<Icon
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { defineComponent, type PropType } from 'vue';
|
|
2
2
|
import GenericTextInputMixin from '../GenericTextInput.mixin';
|
|
3
3
|
import type { TextItem } from '@brand-page';
|
|
4
|
-
import type { RteItemStyleTarget } from '../../models';
|
|
5
4
|
|
|
6
5
|
export default defineComponent({
|
|
7
6
|
mixins: [GenericTextInputMixin],
|
|
@@ -15,11 +14,6 @@ export default defineComponent({
|
|
|
15
14
|
type: Object as PropType<TextItem>,
|
|
16
15
|
required: true,
|
|
17
16
|
},
|
|
18
|
-
itemStyleTarget: {
|
|
19
|
-
type: Object as PropType<RteItemStyleTarget>,
|
|
20
|
-
required: false,
|
|
21
|
-
default: undefined,
|
|
22
|
-
},
|
|
23
17
|
},
|
|
24
18
|
methods: {
|
|
25
19
|
onForceUpdate() {
|
|
@@ -144,13 +144,6 @@ export interface UpdateMultipleItemValuesPayload<T extends object> {
|
|
|
144
144
|
isHydrationWrite?: boolean;
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
/** The list item whose style an item-level RTE writes (e.g. `items[2].questionStyle`). */
|
|
148
|
-
export interface RteItemStyleTarget {
|
|
149
|
-
itemsField: string;
|
|
150
|
-
index: number;
|
|
151
|
-
styleField: string;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
147
|
export interface ValidateItemPayload {
|
|
155
148
|
id: string;
|
|
156
149
|
name: string;
|
|
@@ -528,74 +528,4 @@ describe('re-linking a text style clears the element colour override', () => {
|
|
|
528
528
|
expect(textStyle.textStyleType).toBe('titles');
|
|
529
529
|
expect(textStyle.color).toBeUndefined();
|
|
530
530
|
});
|
|
531
|
-
|
|
532
|
-
test("updateListItemTextStyles merges into one list item's own style only", () => {
|
|
533
|
-
const store = setupStore({
|
|
534
|
-
items: [
|
|
535
|
-
{
|
|
536
|
-
id: 'q1',
|
|
537
|
-
questionStyle: { textStyleType: 'headings', fontSize: '2em' },
|
|
538
|
-
},
|
|
539
|
-
{
|
|
540
|
-
id: 'q2',
|
|
541
|
-
questionStyle: { textStyleType: 'headings', color: '#ff0000' },
|
|
542
|
-
},
|
|
543
|
-
],
|
|
544
|
-
});
|
|
545
|
-
|
|
546
|
-
store.updateListItemTextStyles({
|
|
547
|
-
id: 'item-1',
|
|
548
|
-
name: 'question',
|
|
549
|
-
value: { textStyleType: undefined, color: undefined, fontWeight: 'bold' },
|
|
550
|
-
target: { itemsField: 'items', index: 1, styleField: 'questionStyle' },
|
|
551
|
-
});
|
|
552
|
-
|
|
553
|
-
const items = (
|
|
554
|
-
store.items[0].settings.content as unknown as {
|
|
555
|
-
items: { questionStyle: Record<string, unknown> }[];
|
|
556
|
-
}
|
|
557
|
-
).items;
|
|
558
|
-
|
|
559
|
-
expect(items[1].questionStyle).toMatchObject({ fontWeight: 'bold' });
|
|
560
|
-
expect(items[1].questionStyle.textStyleType).toBeUndefined();
|
|
561
|
-
expect(items[1].questionStyle.color).toBeUndefined();
|
|
562
|
-
expect(items[0].questionStyle).toEqual({
|
|
563
|
-
textStyleType: 'headings',
|
|
564
|
-
fontSize: '2em',
|
|
565
|
-
});
|
|
566
|
-
});
|
|
567
|
-
|
|
568
|
-
test('updateListItemTextStyles on a missing item is a no-op', () => {
|
|
569
|
-
const store = setupStore({ items: [] });
|
|
570
|
-
|
|
571
|
-
store.updateListItemTextStyles({
|
|
572
|
-
id: 'item-1',
|
|
573
|
-
name: 'question',
|
|
574
|
-
value: { fontWeight: 'bold' },
|
|
575
|
-
target: { itemsField: 'items', index: 3, styleField: 'questionStyle' },
|
|
576
|
-
});
|
|
577
|
-
|
|
578
|
-
expect(store.onContentChanged).not.toHaveBeenCalled();
|
|
579
|
-
});
|
|
580
|
-
});
|
|
581
|
-
|
|
582
|
-
describe('content settings store — active list item', () => {
|
|
583
|
-
beforeEach(() => {
|
|
584
|
-
setActivePinia(createPinia());
|
|
585
|
-
});
|
|
586
|
-
|
|
587
|
-
test('setActiveItem records the open item per content without touching content items', () => {
|
|
588
|
-
const store = useUiContentSettingsStore();
|
|
589
|
-
const itemsBefore = store.items;
|
|
590
|
-
|
|
591
|
-
store.setActiveItem('faq-1', 'q2');
|
|
592
|
-
store.setActiveItem('faq-2', 'q9');
|
|
593
|
-
store.setActiveItem('faq-1', 'q3');
|
|
594
|
-
|
|
595
|
-
expect(store.activeItemIdByContentId).toEqual({
|
|
596
|
-
'faq-1': 'q3',
|
|
597
|
-
'faq-2': 'q9',
|
|
598
|
-
});
|
|
599
|
-
expect(store.items).toBe(itemsBefore);
|
|
600
|
-
});
|
|
601
531
|
});
|
|
@@ -9,7 +9,6 @@ import type {
|
|
|
9
9
|
SetItemSettingsFieldErrorMessagePayload,
|
|
10
10
|
UpdateItemValuePayload,
|
|
11
11
|
UpdateMultipleItemValuesPayload,
|
|
12
|
-
RteItemStyleTarget,
|
|
13
12
|
ValidateItemPayload,
|
|
14
13
|
} from '../models';
|
|
15
14
|
import type { ColorReplacement, Content } from '@brand-page';
|
|
@@ -114,8 +113,6 @@ export interface ContentSettingsState {
|
|
|
114
113
|
selectedItemValue: string | null;
|
|
115
114
|
selectedItemIndex: number | null;
|
|
116
115
|
activeCategoryTab: ItemCategory;
|
|
117
|
-
/** Content id → the list item its settings panel has open; the maker canvas opens it too. UI-only, never saved. */
|
|
118
|
-
activeItemIdByContentId: Record<string, string | undefined>;
|
|
119
116
|
}
|
|
120
117
|
|
|
121
118
|
export const useUiContentSettingsStore = defineStore('uiContentSettings', {
|
|
@@ -130,15 +127,8 @@ export const useUiContentSettingsStore = defineStore('uiContentSettings', {
|
|
|
130
127
|
selectedItemIndex: null,
|
|
131
128
|
selectedItemValue: null,
|
|
132
129
|
activeCategoryTab: 'all',
|
|
133
|
-
activeItemIdByContentId: {},
|
|
134
130
|
}),
|
|
135
131
|
actions: {
|
|
136
|
-
setActiveItem(contentId: string, itemId: string | undefined): void {
|
|
137
|
-
this.activeItemIdByContentId = {
|
|
138
|
-
...this.activeItemIdByContentId,
|
|
139
|
-
[contentId]: itemId,
|
|
140
|
-
};
|
|
141
|
-
},
|
|
142
132
|
onContentChanged() {
|
|
143
133
|
const uiStore = useUiStore();
|
|
144
134
|
|
|
@@ -576,40 +566,16 @@ export const useUiContentSettingsStore = defineStore('uiContentSettings', {
|
|
|
576
566
|
index,
|
|
577
567
|
isHydrationWrite,
|
|
578
568
|
}: UpdateMultipleItemValuesPayload<any>): void {
|
|
579
|
-
this.updateListItemTextStyles({
|
|
580
|
-
id,
|
|
581
|
-
name,
|
|
582
|
-
value,
|
|
583
|
-
isHydrationWrite,
|
|
584
|
-
target: {
|
|
585
|
-
itemsField: 'textItems',
|
|
586
|
-
index: index!,
|
|
587
|
-
styleField: 'textStyle',
|
|
588
|
-
},
|
|
589
|
-
});
|
|
590
|
-
},
|
|
591
|
-
/** Merge into the style of one list item, e.g. `items[2].questionStyle`. */
|
|
592
|
-
updateListItemTextStyles({
|
|
593
|
-
id,
|
|
594
|
-
name,
|
|
595
|
-
value,
|
|
596
|
-
target,
|
|
597
|
-
isHydrationWrite,
|
|
598
|
-
}: Omit<UpdateMultipleItemValuesPayload<any>, 'index'> & {
|
|
599
|
-
target: RteItemStyleTarget;
|
|
600
|
-
}): void {
|
|
601
569
|
const item = this.items.find((i) => i.id === id);
|
|
602
|
-
const listItem =
|
|
603
|
-
item?.settings.content[target.itemsField]?.[target.index];
|
|
604
570
|
|
|
605
|
-
if (!item
|
|
571
|
+
if (!item) {
|
|
606
572
|
return;
|
|
607
573
|
}
|
|
608
574
|
|
|
609
575
|
armHistoryMergeForHydrationWrite(isHydrationWrite);
|
|
610
576
|
|
|
611
|
-
|
|
612
|
-
|
|
577
|
+
item.settings.content.textItems[index!].textStyle = vueDeepMerge(
|
|
578
|
+
item.settings.content.textItems[index!].textStyle,
|
|
613
579
|
value,
|
|
614
580
|
);
|
|
615
581
|
this.validateItem({ id, name });
|
|
@@ -397,22 +397,3 @@ describe('refreshDuplicatedMetadata — payment connection reset', () => {
|
|
|
397
397
|
expect(model.paymentConfig).toBeUndefined();
|
|
398
398
|
});
|
|
399
399
|
});
|
|
400
|
-
|
|
401
|
-
describe('refreshDuplicatedMetadata — FAQ section', () => {
|
|
402
|
-
it('copies an FAQ section unchanged (it holds no external ids)', () => {
|
|
403
|
-
const faq = {
|
|
404
|
-
id: 'faq-1',
|
|
405
|
-
type: 'faq-section',
|
|
406
|
-
title: 'FAQ',
|
|
407
|
-
items: [
|
|
408
|
-
{ id: 'q1', question: 'Q1', answer: 'A1' },
|
|
409
|
-
{ id: 'q2', question: 'Q2', answer: 'A2' },
|
|
410
|
-
],
|
|
411
|
-
questionStyle: { textStyleType: 'headings' },
|
|
412
|
-
};
|
|
413
|
-
|
|
414
|
-
const out = refreshDuplicatedMetadata(modelWith([structuredClone(faq)]));
|
|
415
|
-
|
|
416
|
-
expect(out.pages[0].contents[0]).toEqual(faq);
|
|
417
|
-
});
|
|
418
|
-
});
|
|
@@ -169,38 +169,3 @@ describe('minifyBrandPageMetadata — palette resolution', () => {
|
|
|
169
169
|
expect(sut.styles.colors).toHaveLength(3);
|
|
170
170
|
});
|
|
171
171
|
});
|
|
172
|
-
|
|
173
|
-
describe('minifyBrandPageMetadata — FAQ is not AI-editable', () => {
|
|
174
|
-
test('an FAQ section reaches the AI as id + type + padding only', () => {
|
|
175
|
-
const model = new BrandPageModel({
|
|
176
|
-
...BRAND_SITE,
|
|
177
|
-
pages: [
|
|
178
|
-
{
|
|
179
|
-
id: 'p1',
|
|
180
|
-
title: 'Home',
|
|
181
|
-
contents: [
|
|
182
|
-
{
|
|
183
|
-
id: 'faq-1',
|
|
184
|
-
type: 'faq-section',
|
|
185
|
-
title: 'FAQ',
|
|
186
|
-
description: 'Answers',
|
|
187
|
-
displayStyle: 'faq-centered',
|
|
188
|
-
items: [{ id: 'q1', question: 'Q1', answer: 'A1' }],
|
|
189
|
-
topPadding: 32,
|
|
190
|
-
bottomPadding: 32,
|
|
191
|
-
},
|
|
192
|
-
],
|
|
193
|
-
} as any,
|
|
194
|
-
],
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
const [faq] = (minifyBrandPageMetadata(model).pages[0] as any).contents;
|
|
198
|
-
|
|
199
|
-
expect(faq).toEqual({
|
|
200
|
-
id: 'faq-1',
|
|
201
|
-
type: 'faq-section',
|
|
202
|
-
topPadding: 32,
|
|
203
|
-
bottomPadding: 32,
|
|
204
|
-
});
|
|
205
|
-
});
|
|
206
|
-
});
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { FAQ_DISPLAY_STYLES } from '@brand-page/constants';
|
|
2
|
-
import { converterTr } from '@src/composables/useTranslate';
|
|
3
|
-
const ICON_VIEW_BOX = '0 0 96 56';
|
|
4
|
-
export const faqDisplayStyleConvertor = {
|
|
5
|
-
convertBackToMultipleValues: true,
|
|
6
|
-
convert(value) {
|
|
7
|
-
return {
|
|
8
|
-
options: [
|
|
9
|
-
{
|
|
10
|
-
title: converterTr(`faqCenteredAccordion`),
|
|
11
|
-
value: FAQ_DISPLAY_STYLES.centered,
|
|
12
|
-
isSelected: value === FAQ_DISPLAY_STYLES.centered,
|
|
13
|
-
iconName: 'display-style-faq-1',
|
|
14
|
-
iconViewBox: ICON_VIEW_BOX,
|
|
15
|
-
dataAttribute: 'data-test-btn-faq-centered',
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
title: converterTr(`faqSplitAccordion`),
|
|
19
|
-
value: FAQ_DISPLAY_STYLES.split,
|
|
20
|
-
isSelected: value === FAQ_DISPLAY_STYLES.split,
|
|
21
|
-
iconName: 'display-style-faq-2',
|
|
22
|
-
iconViewBox: ICON_VIEW_BOX,
|
|
23
|
-
dataAttribute: 'data-test-btn-faq-split',
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
title: converterTr(`faqGrid`),
|
|
27
|
-
value: FAQ_DISPLAY_STYLES.grid,
|
|
28
|
-
isSelected: value === FAQ_DISPLAY_STYLES.grid,
|
|
29
|
-
iconName: 'display-style-faq-3',
|
|
30
|
-
iconViewBox: ICON_VIEW_BOX,
|
|
31
|
-
dataAttribute: 'data-test-btn-faq-grid',
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
};
|
|
35
|
-
},
|
|
36
|
-
// The heading sits left beside the accordion in split, centred above it otherwise.
|
|
37
|
-
convertBack(config) {
|
|
38
|
-
const displayStyle = config.options.find((v) => v.isSelected)?.value ??
|
|
39
|
-
FAQ_DISPLAY_STYLES.centered;
|
|
40
|
-
const textAlign = displayStyle === FAQ_DISPLAY_STYLES.split ? 'left' : 'center';
|
|
41
|
-
return {
|
|
42
|
-
displayStyle,
|
|
43
|
-
titleStyle: { textAlign },
|
|
44
|
-
descriptionStyle: { textAlign },
|
|
45
|
-
};
|
|
46
|
-
},
|
|
47
|
-
};
|