@designcrowd/library.brand-page 6.0.11 → 6.0.13
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-DopPc6g2.js → CreatedOnBrandCrowd-de-de-CBjFFeBP.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-CSHmaAWm.js → CreatedOnBrandCrowd-en-us-NuNXF81K.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-C4vM0p2e.js → CreatedOnBrandCrowd-es-es-BJG8nfug.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-ArpBbnxm.js → CreatedOnBrandCrowd-fr-ca-uX-nL53e.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-ArpBbnxm.js → CreatedOnBrandCrowd-fr-fr-uX-nL53e.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-CGAQLXiX.js → CreatedOnBrandCrowd-pt-br-DTrgFGQV.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-CGAQLXiX.js → CreatedOnBrandCrowd-pt-pt-DTrgFGQV.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-3WVSgB6t.js → CreatedOnDcom-de-de-DSfpxioT.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-Dx-RHXrH.js → CreatedOnDcom-en-us-C7G4gKem.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-CfnEYFMA.js → CreatedOnDcom-es-es-DVckCaji.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-BSHZTiUO.js → CreatedOnDcom-fr-ca-C5GDrm_C.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-DtHssrQb.js → CreatedOnDcom-fr-fr-v5eMm-j2.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-CdX1aRI8.js → CreatedOnDcom-pt-br-Dq3-fPUc.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-jy044FNL.js → CreatedOnDcom-pt-pt-DFsncYax.js} +1 -1
- package/lib/src/brand-page/components/image-gallery/ImageGallery.stories.js +3 -0
- package/lib/src/brand-page/components/image-gallery/masonry/MasonryGallery.mixin.d.ts +1 -1
- package/lib/src/brand-page/components/images-section/ImagesSection.stories.js +2 -1
- package/lib/src/brand-page/components/social-links/SocialLinks.stories.js +3 -0
- package/lib/src/brand-page/components/testimonial-section/__fixtures__/data.js +3 -0
- package/lib/src/brand-page/components/text/Text.stories.js +2 -0
- package/lib/src/brand-page/models/index.d.ts +13 -0
- package/lib/src/brand-page/models/index.js +4 -0
- package/lib/src/brand-page/utils/migration/migration-01.js +2 -0
- package/lib/src/brand-page/utils/migration/migration-18.d.ts +14 -0
- package/lib/src/brand-page/utils/migration/migration-18.js +17 -0
- package/lib/src/brand-page/utils/migration.util.js +6 -0
- package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.stories.js +1 -0
- package/lib/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-page-examples.js +1 -0
- package/lib/src/brand-page-maker/composables/ai-chat/useAiWebsiteBuilderChat.js +5 -0
- package/lib/src/brand-page-maker/constants/config-settings-constant.js +4 -0
- package/lib/src/brand-page-maker/models/content-settings.js +4 -0
- package/lib/src/brand-page-maker/stores/ai-checkpoint/ai-checkpoint-store.d.ts +18 -0
- package/lib/src/index.mjs +84 -83
- package/lib/src/{lib-Bx7xK4dn.js → lib-BG-pyXi9.js} +19585 -19807
- package/lib/src/metadata-builder/ai-metadata-executor.js +24 -1
- package/lib/src/metadata-builder/builders/footer-builder.js +32 -41
- package/lib/src/metadata-builder/builders/item-id-utils.d.ts +54 -0
- package/lib/src/metadata-builder/builders/item-id-utils.js +96 -0
- package/lib/src/metadata-builder/builders/move-page-builder.d.ts +32 -0
- package/lib/src/metadata-builder/builders/move-page-builder.js +137 -0
- package/lib/src/metadata-builder/builders/nav-utils.d.ts +26 -0
- package/lib/src/metadata-builder/builders/nav-utils.js +95 -0
- package/lib/src/metadata-builder/builders/section-builders/image-gallery-builder.js +57 -68
- package/lib/src/metadata-builder/builders/section-builders/images-section-builder.js +58 -93
- package/lib/src/metadata-builder/builders/section-builders/move-section-builder.d.ts +13 -1
- package/lib/src/metadata-builder/builders/section-builders/move-section-builder.js +40 -30
- package/lib/src/metadata-builder/builders/section-builders/shapes-section-builder.js +66 -99
- package/lib/src/metadata-builder/builders/section-builders/social-links-builder.js +57 -17
- package/lib/src/metadata-builder/builders/section-builders/testimonial-section-builder.js +51 -85
- package/lib/src/metadata-builder/builders/section-builders/text-section-builder.js +50 -74
- package/lib/src/metadata-builder/builders/section-field-maps.js +17 -0
- package/lib/src/metadata-builder/builders/set-page-visibility-builder.d.ts +23 -0
- package/lib/src/metadata-builder/builders/set-page-visibility-builder.js +83 -0
- 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 +31 -7
- package/lib/src/metadata-builder/parsers/ai-toolcall-parser.js +2 -0
- package/lib/src/metadata-builder/parsers/section-tool-arguments.d.ts +84 -48
- package/lib/src/shared/content-settings/components/links-field/LinksField.mixin.js +2 -0
- package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.d.ts +2 -0
- package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.d.ts +2 -0
- package/lib/src/tracker.d.ts +2 -0
- package/lib/src/tracker.js +12 -0
- package/lib/src/tracker.mjs +12 -0
- package/lib/src/useEventTracker-DmQ6AkNn.js +356 -0
- package/lib/src/utils/minify-brand-page-metadata.d.ts +2 -0
- package/lib/src/utils/minify-brand-page-metadata.js +8 -1
- package/package.json +16 -1
- package/src/brand-page/components/image-gallery/ImageGallery.stories.ts +3 -0
- package/src/brand-page/components/image-gallery/ImageGallery.test.ts +1 -0
- package/src/brand-page/components/image-gallery/masonry/MasonryGallery.mixin.ts +2 -1
- package/src/brand-page/components/images-section/ImagesSection.stories.ts +2 -1
- package/src/brand-page/components/social-links/SocialLinks.stories.ts +3 -0
- package/src/brand-page/components/social-links/SocialLinks.vue.test.ts +5 -0
- package/src/brand-page/components/testimonial-section/__fixtures__/data.ts +3 -0
- package/src/brand-page/components/text/Text.stories.ts +2 -0
- package/src/brand-page/models/index.ts +17 -0
- package/src/brand-page/utils/__snapshots__/migration.util.test.ts.snap +23 -3
- package/src/brand-page/utils/__snapshots__/migration2.util.test.ts.snap +6 -0
- package/src/brand-page/utils/__snapshots__/model.util.test.ts.snap +12 -0
- package/src/brand-page/utils/migration/migration-01.ts +2 -0
- package/src/brand-page/utils/migration/migration-18.test.ts +131 -0
- package/src/brand-page/utils/migration/migration-18.ts +22 -0
- package/src/brand-page/utils/migration.util.ts +7 -0
- package/src/brand-page/utils/personalisation.util.test.ts +4 -0
- package/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.stories.ts +1 -0
- package/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-page-examples.ts +1 -0
- package/src/brand-page-maker/composables/ai-chat/useAiWebsiteBuilderChat.ts +6 -0
- package/src/brand-page-maker/constants/config-settings-constant.ts +4 -0
- package/src/brand-page-maker/models/content-settings.ts +4 -0
- package/src/metadata-builder/ai-metadata-executor.ts +31 -1
- package/src/metadata-builder/builders/footer-builder.test.ts +335 -28
- package/src/metadata-builder/builders/footer-builder.ts +40 -57
- package/src/metadata-builder/builders/item-id-utils.test.ts +184 -0
- package/src/metadata-builder/builders/item-id-utils.ts +117 -0
- package/src/metadata-builder/builders/move-page-builder.ts +227 -0
- package/src/metadata-builder/builders/nav-utils.ts +141 -0
- package/src/metadata-builder/builders/section-builders/image-gallery-builder.ts +62 -88
- package/src/metadata-builder/builders/section-builders/images-section-builder.ts +66 -129
- package/src/metadata-builder/builders/section-builders/move-section-builder.ts +58 -35
- package/src/metadata-builder/builders/section-builders/shapes-section-builder.ts +105 -160
- package/src/metadata-builder/builders/section-builders/social-links-builder.ts +65 -20
- package/src/metadata-builder/builders/section-builders/testimonial-section-builder.ts +83 -146
- package/src/metadata-builder/builders/section-builders/text-section-builder.ts +71 -122
- package/src/metadata-builder/builders/section-field-maps.ts +18 -0
- package/src/metadata-builder/builders/set-page-visibility-builder.ts +122 -0
- package/src/metadata-builder/metadata-executor.ts +4 -0
- package/src/metadata-builder/models.ts +2 -0
- package/src/metadata-builder/parsers/ai-toolcall-parser.ts +32 -7
- package/src/metadata-builder/parsers/section-tool-arguments.ts +84 -48
- package/src/shared/content-settings/components/links-field/LinksField.mixin.ts +2 -0
- package/src/tracker.ts +28 -0
- package/src/utils/minify-brand-page-metadata.ts +14 -2
- package/lib/src/metadata-builder/builders/reorder-pages-builder.d.ts +0 -13
- package/lib/src/metadata-builder/builders/reorder-pages-builder.js +0 -49
- package/src/metadata-builder/builders/reorder-pages-builder.ts +0 -80
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { describe, test, expect } from 'vitest';
|
|
2
|
+
import { migration18 } from './migration-18';
|
|
3
|
+
import type { MigrationData } from '../migration.util';
|
|
4
|
+
|
|
5
|
+
const createMigrationData = (brandPageModel: any): MigrationData => ({
|
|
6
|
+
brandPageModel,
|
|
7
|
+
useOldLogoRenderSize: false,
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
const createModel = (overrides: any = {}) => ({
|
|
11
|
+
v: 17,
|
|
12
|
+
pages: [
|
|
13
|
+
{
|
|
14
|
+
title: 'Home',
|
|
15
|
+
slug: 'home',
|
|
16
|
+
contents: [
|
|
17
|
+
{
|
|
18
|
+
id: 'gallery-1',
|
|
19
|
+
type: 'image-gallery',
|
|
20
|
+
images: [
|
|
21
|
+
{ imageUrl: 'a.jpg', imageTitle: 'A' },
|
|
22
|
+
{ imageUrl: 'b.jpg', imageTitle: 'B' },
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: 'testimonials-1',
|
|
27
|
+
type: 'testimonial-section',
|
|
28
|
+
items: [
|
|
29
|
+
{ name: 'Ada', testimonials: 'Great' },
|
|
30
|
+
{ name: 'Grace', testimonials: 'Superb' },
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: 'text-1',
|
|
35
|
+
type: 'text',
|
|
36
|
+
textItems: [{ text: 'Hello' }, { text: 'World' }],
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: 'social-1',
|
|
40
|
+
type: 'social-links',
|
|
41
|
+
links: [
|
|
42
|
+
{ imageUrl: 'facebook', url: 'https://facebook.com' },
|
|
43
|
+
{ imageUrl: 'x', url: 'https://x.com' },
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
pageFooterDesktop: {
|
|
50
|
+
socialLinks: [
|
|
51
|
+
{ imageUrl: 'facebook', url: 'https://facebook.com' },
|
|
52
|
+
{ imageUrl: 'instagram', url: 'https://instagram.com' },
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
pageFooterMobile: {
|
|
56
|
+
socialLinks: [{ imageUrl: 'x', url: 'https://x.com' }],
|
|
57
|
+
},
|
|
58
|
+
...overrides,
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const allNestedItems = (model: any): any[] => {
|
|
62
|
+
const [gallery, testimonials, text, social] = model.pages[0].contents;
|
|
63
|
+
|
|
64
|
+
return [
|
|
65
|
+
...gallery.images,
|
|
66
|
+
...testimonials.items,
|
|
67
|
+
...text.textItems,
|
|
68
|
+
...social.links,
|
|
69
|
+
...model.pageFooterDesktop.socialLinks,
|
|
70
|
+
...model.pageFooterMobile.socialLinks,
|
|
71
|
+
];
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
describe('migration18', () => {
|
|
75
|
+
test('backfills a stable id onto every nested item that lacks one', async () => {
|
|
76
|
+
const model = createModel();
|
|
77
|
+
|
|
78
|
+
const result = await migration18(createMigrationData(model));
|
|
79
|
+
|
|
80
|
+
const items = allNestedItems(result.brandPageModel);
|
|
81
|
+
|
|
82
|
+
expect(items).toHaveLength(11);
|
|
83
|
+
items.forEach((item) => expect(item.id).toBeTruthy());
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
test('generates unique ids across all nested items', async () => {
|
|
87
|
+
const model = createModel();
|
|
88
|
+
|
|
89
|
+
const result = await migration18(createMigrationData(model));
|
|
90
|
+
|
|
91
|
+
const ids = allNestedItems(result.brandPageModel).map((i) => i.id);
|
|
92
|
+
|
|
93
|
+
expect(new Set(ids).size).toBe(ids.length);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
test('preserves ids that already exist', async () => {
|
|
97
|
+
const model = createModel();
|
|
98
|
+
|
|
99
|
+
model.pages[0].contents[0].images[0].id = 'keep-me';
|
|
100
|
+
model.pageFooterMobile.socialLinks[0].id = 'keep-footer';
|
|
101
|
+
|
|
102
|
+
// migration mutates in place, so assert against the same (any-typed) model.
|
|
103
|
+
await migration18(createMigrationData(model));
|
|
104
|
+
|
|
105
|
+
expect(model.pages[0].contents[0].images[0].id).toBe('keep-me');
|
|
106
|
+
expect(model.pageFooterMobile.socialLinks[0].id).toBe('keep-footer');
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
test('is idempotent — a second run does not change any id', async () => {
|
|
110
|
+
const model = createModel();
|
|
111
|
+
|
|
112
|
+
await migration18(createMigrationData(model));
|
|
113
|
+
const firstPass = allNestedItems(model).map((i) => i.id);
|
|
114
|
+
|
|
115
|
+
await migration18(createMigrationData(model));
|
|
116
|
+
const secondPass = allNestedItems(model).map((i) => i.id);
|
|
117
|
+
|
|
118
|
+
expect(secondPass).toEqual(firstPass);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
test('handles a model with no footers and empty pages without throwing', async () => {
|
|
122
|
+
const model = {
|
|
123
|
+
v: 17,
|
|
124
|
+
pages: [{ title: 'Home', slug: 'home', contents: [] }],
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const result = await migration18(createMigrationData(model));
|
|
128
|
+
|
|
129
|
+
expect(result.brandPageModel).toBe(model);
|
|
130
|
+
});
|
|
131
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { MigrationData } from '../migration.util';
|
|
2
|
+
import { ensureBrandPageItemIds } from '../../../metadata-builder/builders/item-id-utils';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* BP-5603: backfill a stable uuid `id` onto every nested item (gallery images,
|
|
6
|
+
* images/shapes/testimonial items, text items, section + footer social links)
|
|
7
|
+
* that predates the id-based edit model.
|
|
8
|
+
*
|
|
9
|
+
* The item `id` field is now non-nullable in the model, so every load path must
|
|
10
|
+
* guarantee it — not just the AI chat flow, which already stamps ids before
|
|
11
|
+
* minifying (see ensureBrandPageItemIds in useAiWebsiteBuilderChat). This
|
|
12
|
+
* migration is that guarantee for persisted data. Idempotent — existing ids are
|
|
13
|
+
* preserved, so re-running (e.g. render-only sites that never re-save) is a
|
|
14
|
+
* no-op beyond generating ids for items that still lack one.
|
|
15
|
+
*/
|
|
16
|
+
export const migration18 = async (
|
|
17
|
+
migrationResult: MigrationData,
|
|
18
|
+
): Promise<MigrationData> => {
|
|
19
|
+
ensureBrandPageItemIds(migrationResult.brandPageModel);
|
|
20
|
+
|
|
21
|
+
return migrationResult;
|
|
22
|
+
};
|
|
@@ -20,6 +20,7 @@ import { migration14 } from './migration/migration-14';
|
|
|
20
20
|
import { migration15 } from './migration/migration-15';
|
|
21
21
|
import { migration16 } from './migration/migration-16';
|
|
22
22
|
import { migration17 } from './migration/migration-17';
|
|
23
|
+
import { migration18 } from './migration/migration-18';
|
|
23
24
|
|
|
24
25
|
export interface MigrationData {
|
|
25
26
|
brandPageModel: BrandPageModel;
|
|
@@ -160,6 +161,12 @@ const MIGRATION_TABLE = [
|
|
|
160
161
|
description:
|
|
161
162
|
'Padding Control backfill (BP-5699 Tier 2 + BP-5700 Store): backfill existing top/bottom spacing as explicit padding for text (12px), images/social links/shapes/booking (32px), store (16px), contact form (per layout), banner and about (per display style)',
|
|
162
163
|
},
|
|
164
|
+
{
|
|
165
|
+
version: 18,
|
|
166
|
+
migrateFn: migration18,
|
|
167
|
+
description:
|
|
168
|
+
'BP-5603: backfill stable item ids on all nested items (gallery/section/testimonial/text items, section + footer social links) — the item id is now non-nullable',
|
|
169
|
+
},
|
|
163
170
|
] as MigrationTableItem[];
|
|
164
171
|
|
|
165
172
|
export const GetLatestModelVersion = () =>
|
|
@@ -432,6 +432,7 @@ describe('personalisation.util', async () => {
|
|
|
432
432
|
personalisationRole: 'profile',
|
|
433
433
|
items: [
|
|
434
434
|
{
|
|
435
|
+
id: 'shapes-item-1',
|
|
435
436
|
colorReplacements: [],
|
|
436
437
|
height: -1,
|
|
437
438
|
imageUrl: 'shape-1.svg',
|
|
@@ -986,6 +987,7 @@ describe('personalisation.util', async () => {
|
|
|
986
987
|
personalisationRole: 'media',
|
|
987
988
|
items: [
|
|
988
989
|
{
|
|
990
|
+
id: 'shapes-item-1',
|
|
989
991
|
colorReplacements: [],
|
|
990
992
|
height: -1,
|
|
991
993
|
imageUrl: 'shape-1.svg',
|
|
@@ -1052,6 +1054,7 @@ describe('personalisation.util', async () => {
|
|
|
1052
1054
|
personalisationRole: 'media',
|
|
1053
1055
|
items: [
|
|
1054
1056
|
{
|
|
1057
|
+
id: 'shapes-item-1',
|
|
1055
1058
|
colorReplacements: [],
|
|
1056
1059
|
height: -1,
|
|
1057
1060
|
imageUrl: 'https://bcassetcdn.com/shapes/prod/original-shape.svg',
|
|
@@ -1141,6 +1144,7 @@ describe('personalisation.util', async () => {
|
|
|
1141
1144
|
personalisationRole: 'media',
|
|
1142
1145
|
items: [
|
|
1143
1146
|
{
|
|
1147
|
+
id: 'shapes-item-1',
|
|
1144
1148
|
colorReplacements: [],
|
|
1145
1149
|
height: -1,
|
|
1146
1150
|
imageUrl: 'https://bcassetcdn.com/shapes/prod/original-shape.svg',
|
|
@@ -1498,6 +1498,7 @@ export const SampleImageGallery = (): any => {
|
|
|
1498
1498
|
const width = 300;
|
|
1499
1499
|
const height = 300;
|
|
1500
1500
|
imageGalleryContent.images!.push({
|
|
1501
|
+
id: `gallery-item-${i}`,
|
|
1501
1502
|
width,
|
|
1502
1503
|
height,
|
|
1503
1504
|
imageUrl: `https://images.unsplash.com/photo-1659535915214-e7cbac112038?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwxMjQzOTV8MXwxfHNlYXJjaHw4fHxnYW1pbmd8ZW58MHx8fHwxNjY5MDc4ODE1&ixlib=rb-4.0.3&q=80&w=1080`,
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
type PlanItem,
|
|
19
19
|
} from '../../../clients/websocket-gateway-client';
|
|
20
20
|
import { minifyBrandPageMetadata } from '../../../utils/minify-brand-page-metadata';
|
|
21
|
+
import { ensureBrandPageItemIds } from '../../../metadata-builder/builders/item-id-utils';
|
|
21
22
|
import { buildAssetManifest } from '../../../utils/build-asset-manifest';
|
|
22
23
|
import cloneDeep from 'lodash.clonedeep';
|
|
23
24
|
import { usePageNavigationStore } from '../../../shared/page-navigation/store/page-navigation-store';
|
|
@@ -259,6 +260,11 @@ export function useAiWebsiteBuilderChat(): UseAiChatResult {
|
|
|
259
260
|
|
|
260
261
|
const buildMessagePayload = async (userPrompt: string) => {
|
|
261
262
|
const brandPageData = brandPageMakerStore.brandPageData;
|
|
263
|
+
|
|
264
|
+
// BP-5603: stamp stable uuid ids onto every nested item BEFORE minifying,
|
|
265
|
+
// so the id the AI is shown (and returns as `item_id`) is the exact id the
|
|
266
|
+
// executor matches when applying tool calls to this same live model.
|
|
267
|
+
ensureBrandPageItemIds(brandPageData);
|
|
262
268
|
const headerLogoDraftToken =
|
|
263
269
|
brandPageData.pageHeaderDesktop?.logoImage?.logoDraftToken ??
|
|
264
270
|
uiStore.logoDraftToken;
|
|
@@ -85,6 +85,7 @@ import {
|
|
|
85
85
|
createInitialShopContent,
|
|
86
86
|
createInitialBookingSectionContent,
|
|
87
87
|
} from '../models';
|
|
88
|
+
import * as uuid from 'uuid';
|
|
88
89
|
import type {
|
|
89
90
|
ContentReplaceImageSettings,
|
|
90
91
|
SetContentMediaPayload,
|
|
@@ -353,6 +354,7 @@ const imageGalleryReplaceImageSettings =
|
|
|
353
354
|
}
|
|
354
355
|
|
|
355
356
|
content.images.push({
|
|
357
|
+
id: uuid.v4(),
|
|
356
358
|
imageUrl: value.imageUrl,
|
|
357
359
|
imageTitle: value.imageTitle,
|
|
358
360
|
height: value.height!,
|
|
@@ -614,6 +616,7 @@ const shapesImageReplaceImageSettings =
|
|
|
614
616
|
) => {
|
|
615
617
|
if (index === undefined || index === null) {
|
|
616
618
|
content.items?.push({
|
|
619
|
+
id: uuid.v4(),
|
|
617
620
|
imageUrl: value.imageUrl,
|
|
618
621
|
imageTitle: '',
|
|
619
622
|
paragraph: '',
|
|
@@ -652,6 +655,7 @@ const textImageReplaceImageSettings =
|
|
|
652
655
|
) => {
|
|
653
656
|
if (index === undefined || index === null) {
|
|
654
657
|
content.items?.push({
|
|
658
|
+
id: uuid.v4(),
|
|
655
659
|
imageUrl: value.imageUrl,
|
|
656
660
|
imageTitle: value.imageTitle,
|
|
657
661
|
paragraph: '',
|
|
@@ -233,6 +233,7 @@ export const createInitialTextContent = (
|
|
|
233
233
|
options?.brandPageType === 'brandSite'
|
|
234
234
|
? [
|
|
235
235
|
{
|
|
236
|
+
id: uuid.v4(),
|
|
236
237
|
text: contentSettingsTr(`defaultTextValue`),
|
|
237
238
|
textStyle: {
|
|
238
239
|
applyAutoScale:
|
|
@@ -835,6 +836,7 @@ export const createInitialSocialLinksContent = (
|
|
|
835
836
|
title: contentSettingsTr(`followUsOnTitle`),
|
|
836
837
|
links: [
|
|
837
838
|
{
|
|
839
|
+
id: uuid.v4(),
|
|
838
840
|
imageUrl: 'facebook',
|
|
839
841
|
url: 'https://www.facebook.com',
|
|
840
842
|
imageTitle: '',
|
|
@@ -845,6 +847,7 @@ export const createInitialSocialLinksContent = (
|
|
|
845
847
|
imageLink: '',
|
|
846
848
|
},
|
|
847
849
|
{
|
|
850
|
+
id: uuid.v4(),
|
|
848
851
|
imageUrl: 'instagram',
|
|
849
852
|
url: 'https://www.instagram.com',
|
|
850
853
|
imageTitle: '',
|
|
@@ -855,6 +858,7 @@ export const createInitialSocialLinksContent = (
|
|
|
855
858
|
imageLink: '',
|
|
856
859
|
},
|
|
857
860
|
{
|
|
861
|
+
id: uuid.v4(),
|
|
858
862
|
imageUrl: 'x',
|
|
859
863
|
url: 'https://www.x.com',
|
|
860
864
|
imageTitle: '',
|
|
@@ -22,6 +22,8 @@ import {
|
|
|
22
22
|
type AddPageArguments,
|
|
23
23
|
type RemovePageArguments,
|
|
24
24
|
type RenamePageArguments,
|
|
25
|
+
type MovePageArguments,
|
|
26
|
+
type SetPageVisibilityArguments,
|
|
25
27
|
type UpdateFooterArguments,
|
|
26
28
|
type UpdateGlobalStylesArguments,
|
|
27
29
|
type UpdateHeaderArguments,
|
|
@@ -101,7 +103,7 @@ export const executeToolCallsAsync = async (
|
|
|
101
103
|
type: BUILDER_TYPES.MOVE_SECTION as BuilderType,
|
|
102
104
|
payload: {
|
|
103
105
|
contentId: arg.content_id,
|
|
104
|
-
|
|
106
|
+
moveBeforeContentId: arg.move_before_content_id,
|
|
105
107
|
targetPageId: arg.target_page_id,
|
|
106
108
|
},
|
|
107
109
|
};
|
|
@@ -145,6 +147,34 @@ export const executeToolCallsAsync = async (
|
|
|
145
147
|
};
|
|
146
148
|
}
|
|
147
149
|
|
|
150
|
+
case AI_ASSISTANT_TOOL_NAMES.MOVE_PAGE: {
|
|
151
|
+
const arg = toolcall.arguments as unknown as MovePageArguments;
|
|
152
|
+
|
|
153
|
+
return {
|
|
154
|
+
id: toolcall.toolId,
|
|
155
|
+
type: BUILDER_TYPES.MOVE_PAGE as BuilderType,
|
|
156
|
+
payload: {
|
|
157
|
+
pageId: arg.page_id,
|
|
158
|
+
parentPageId: arg.parent_page_id,
|
|
159
|
+
moveBeforePageId: arg.move_before_page_id,
|
|
160
|
+
},
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
case AI_ASSISTANT_TOOL_NAMES.SET_PAGE_VISIBILITY: {
|
|
165
|
+
const arg =
|
|
166
|
+
toolcall.arguments as unknown as SetPageVisibilityArguments;
|
|
167
|
+
|
|
168
|
+
return {
|
|
169
|
+
id: toolcall.toolId,
|
|
170
|
+
type: BUILDER_TYPES.SET_PAGE_VISIBILITY as BuilderType,
|
|
171
|
+
payload: {
|
|
172
|
+
pageId: arg.page_id,
|
|
173
|
+
isHidden: arg.is_hidden,
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
|
|
148
178
|
case AI_ASSISTANT_TOOL_NAMES.UPDATE_FOOTER: {
|
|
149
179
|
const arg = toolcall.arguments as unknown as UpdateFooterArguments;
|
|
150
180
|
|