@designcrowd/library.brand-page 5.17.28 → 5.18.0
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-CJZpKPNH.js → CreatedOnBrandCrowd-de-de-xmkupPus.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-DkIa7iEb.js → CreatedOnBrandCrowd-en-us-Ck7EdTtb.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-CE2p6XHz.js → CreatedOnBrandCrowd-es-es-BC8sJuDH.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-BBjOZS3M.js → CreatedOnBrandCrowd-fr-ca-CN-UBe1q.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-BBjOZS3M.js → CreatedOnBrandCrowd-fr-fr-CN-UBe1q.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-Dayzl4BZ.js → CreatedOnBrandCrowd-pt-br-CajQyNkx.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-Dayzl4BZ.js → CreatedOnBrandCrowd-pt-pt-CajQyNkx.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-CFzDqfCb.js → CreatedOnDcom-de-de-BRCNMmDq.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-C2jIPBDY.js → CreatedOnDcom-en-us-BzQDtZhc.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-qejpzqho.js → CreatedOnDcom-es-es-D-qAM4Cd.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-DMO9Ld7K.js → CreatedOnDcom-fr-ca-CZ1irFOc.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-BFWN9qTP.js → CreatedOnDcom-fr-fr-Gb5BCF0N.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-CneD3ghF.js → CreatedOnDcom-pt-br-CAQV0q6o.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-Cg1B7s0o.js → CreatedOnDcom-pt-pt-D6tQdQFh.js} +1 -1
- package/lib/src/brand-page/components/image-gallery/ImageGalleryModal.mixin.js +2 -2
- package/lib/src/brand-page/models/brand-page-context.model.d.ts +0 -2
- package/lib/src/brand-page/models/brand-page-context.model.js +1 -11
- package/lib/src/brand-page/models/index.d.ts +1 -0
- package/lib/src/brand-page/models/index.js +1 -0
- package/lib/src/brand-page/utils/color.util.js +23 -3
- package/lib/src/brand-page/utils/raygun.util.d.ts +5 -1
- package/lib/src/brand-page/utils/raygun.util.js +7 -2
- package/lib/src/brand-page/utils/svg-color.util.js +1 -2
- package/lib/src/brand-page/utils/view-model.util.js +1 -1
- package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.d.ts +1 -31
- package/lib/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-page-examples.js +0 -2
- package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.d.ts +2 -31
- package/lib/src/brand-page-maker/components/preview/Preview.mixin.d.ts +0 -14
- package/lib/src/brand-page-maker/components/quick-link-bar/QuickLinkBar.mixin.d.ts +0 -28
- package/lib/src/brand-page-maker/components/seo-settings/SeoPageSettings.mixin.d.ts +0 -28
- package/lib/src/brand-page-maker/components/seo-settings/UrlSettings.mixin.d.ts +0 -28
- package/lib/src/brand-page-maker/components/seo-settings/UseExistingDomainModal.mixin.d.ts +0 -28
- package/lib/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.d.ts +0 -28
- package/lib/src/brand-page-maker/components/upgrade-to-premium-button/UpgradeToPremiumButton.mixin.d.ts +0 -28
- package/lib/src/brand-page-maker/composables/ai-chat/aiErrorCopy.d.ts +35 -0
- package/lib/src/brand-page-maker/composables/ai-chat/aiErrorCopy.js +108 -0
- package/lib/src/brand-page-maker/composables/ai-chat/{useAiChat.d.ts → types.d.ts} +5 -13
- package/lib/src/brand-page-maker/composables/ai-chat/types.js +1 -0
- package/lib/src/brand-page-maker/composables/ai-chat/useAiMetadataBuilder.d.ts +19 -0
- package/lib/src/brand-page-maker/composables/ai-chat/useAiMetadataBuilder.js +1 -0
- package/lib/src/brand-page-maker/composables/ai-chat/useAiWebsiteBuilderChat.d.ts +1 -1
- package/lib/src/brand-page-maker/composables/ai-chat/useAiWebsiteBuilderChat.js +488 -82
- package/lib/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.js +5 -5
- package/lib/src/brand-page-maker/composables/useEventTracker.d.ts +6 -16
- package/lib/src/brand-page-maker/composables/useEventTracker.js +19 -21
- package/lib/src/brand-page-maker/constants/sidebar-constant.d.ts +0 -1
- package/lib/src/brand-page-maker/constants/sidebar-constant.js +7 -15
- package/lib/src/brand-page-maker/convertors/image-aspect-ratio.convertor.js +2 -2
- package/lib/src/brand-page-maker/convertors/text-size-value.convertor.js +3 -1
- package/lib/src/brand-page-maker/stores/ai-checkpoint/ai-checkpoint-store.d.ts +30660 -0
- package/lib/src/brand-page-maker/stores/ai-checkpoint/ai-checkpoint-store.js +34 -0
- package/lib/src/brand-page-maker/stores/ai-thread/ai-website-builder-thread-store.d.ts +1 -1
- package/lib/src/brand-page-maker/stores/brandpage-container/brand-page-container-store.d.ts +0 -28
- package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.js +42 -2
- package/lib/src/brand-page-maker/stores/index.d.ts +1 -1
- package/lib/src/brand-page-maker/stores/index.js +1 -1
- package/lib/src/brand-page-maker/stores/user/user-store.js +0 -1
- package/lib/src/bundled-translations-CnareLWC.js +175 -0
- package/lib/src/bundled-translations.de-DE-2Ys7epLO.js +175 -0
- package/lib/src/bundled-translations.es-ES-Cjp-G8rT.js +175 -0
- package/lib/src/bundled-translations.fr-CA-CsaW4Oae.js +175 -0
- package/lib/src/bundled-translations.fr-FR-DIT2dd8J.js +175 -0
- package/lib/src/bundled-translations.pt-BR-BamoBpDW.js +175 -0
- package/lib/src/bundled-translations.pt-PT-C9A4hY_e.js +175 -0
- package/lib/src/bundles/bundled-translations.de-DE.json +1 -20
- package/lib/src/bundles/bundled-translations.es-ES.json +1 -20
- package/lib/src/bundles/bundled-translations.fr-CA.json +1 -20
- package/lib/src/bundles/bundled-translations.fr-FR.json +1 -20
- package/lib/src/bundles/bundled-translations.json +1 -20
- package/lib/src/bundles/bundled-translations.pt-BR.json +1 -20
- package/lib/src/bundles/bundled-translations.pt-PT.json +1 -20
- package/lib/src/clients/ai-assistant-client.d.ts +30 -29
- package/lib/src/clients/ai-assistant-client.js +16 -16
- package/lib/src/clients/design-template-client.d.ts +0 -2
- package/lib/src/clients/design-template-client.js +0 -38
- package/lib/src/clients/websocket-gateway-client.d.ts +9 -1
- package/lib/src/composables/useTranslate.d.ts +2 -1
- package/lib/src/composables/useTranslate.js +2 -1
- package/lib/src/constants/ui.d.ts +0 -1
- package/lib/src/css/library.brand-page-brandCrowd.min.css +225 -134
- package/lib/src/css/library.brand-page-brandPage.min.css +227 -121
- package/lib/src/css/library.brand-page-designCom.min.css +225 -134
- package/lib/src/css/library.brand-page-preview.min.css +225 -118
- package/lib/src/index.d.ts +1 -1
- package/lib/src/index.mjs +1 -1
- package/lib/src/{lib-33w_DBny.js → lib-CSRUPpSo.js} +30887 -29395
- package/lib/src/metadata-builder/ai-metadata-executor.d.ts +21 -0
- package/lib/src/metadata-builder/ai-metadata-executor.js +56 -3
- package/lib/src/metadata-builder/builders/add-page-builder.d.ts +2 -4
- package/lib/src/metadata-builder/builders/add-page-builder.js +5 -8
- package/lib/src/metadata-builder/builders/footer-builder.d.ts +11 -0
- package/lib/src/metadata-builder/builders/footer-builder.js +151 -0
- package/lib/src/metadata-builder/builders/global-styles-builder.d.ts +15 -0
- package/lib/src/metadata-builder/builders/global-styles-builder.js +129 -0
- package/lib/src/metadata-builder/builders/header-builder.d.ts +11 -0
- package/lib/src/metadata-builder/builders/header-builder.js +167 -0
- package/lib/src/metadata-builder/builders/rename-page-builder.d.ts +12 -0
- package/lib/src/metadata-builder/builders/rename-page-builder.js +49 -0
- package/lib/src/metadata-builder/builders/section-builders/about-section-builder.d.ts +2 -0
- package/lib/src/metadata-builder/builders/section-builders/about-section-builder.js +44 -4
- package/lib/src/metadata-builder/builders/section-builders/banner-section-builder.d.ts +2 -0
- package/lib/src/metadata-builder/builders/section-builders/banner-section-builder.js +70 -6
- package/lib/src/metadata-builder/builders/section-builders/base-section-builder.d.ts +36 -4
- package/lib/src/metadata-builder/builders/section-builders/base-section-builder.js +102 -12
- package/lib/src/metadata-builder/builders/section-builders/booking-section-builder.d.ts +8 -0
- package/lib/src/metadata-builder/builders/section-builders/booking-section-builder.js +50 -0
- package/lib/src/metadata-builder/builders/section-builders/button-section-builder.d.ts +2 -0
- package/lib/src/metadata-builder/builders/section-builders/button-section-builder.js +5 -1
- package/lib/src/metadata-builder/builders/section-builders/contact-form-builder.d.ts +2 -0
- package/lib/src/metadata-builder/builders/section-builders/contact-form-builder.js +47 -3
- package/lib/src/metadata-builder/builders/section-builders/delete-section-builder.d.ts +2 -1
- package/lib/src/metadata-builder/builders/section-builders/delete-section-builder.js +5 -2
- package/lib/src/metadata-builder/builders/section-builders/divider-section-builder.d.ts +2 -0
- package/lib/src/metadata-builder/builders/section-builders/divider-section-builder.js +11 -1
- package/lib/src/metadata-builder/builders/section-builders/image-gallery-builder.d.ts +2 -0
- package/lib/src/metadata-builder/builders/section-builders/image-gallery-builder.js +52 -13
- package/lib/src/metadata-builder/builders/section-builders/images-section-builder.d.ts +2 -0
- package/lib/src/metadata-builder/builders/section-builders/images-section-builder.js +47 -17
- package/lib/src/metadata-builder/builders/section-builders/index.d.ts +1 -0
- package/lib/src/metadata-builder/builders/section-builders/index.js +1 -0
- package/lib/src/metadata-builder/builders/section-builders/mailing-list-builder.d.ts +2 -0
- package/lib/src/metadata-builder/builders/section-builders/mailing-list-builder.js +20 -2
- package/lib/src/metadata-builder/builders/section-builders/mailing-list-section-builder.d.ts +2 -0
- package/lib/src/metadata-builder/builders/section-builders/mailing-list-section-builder.js +20 -2
- package/lib/src/metadata-builder/builders/section-builders/profile-section-builder.d.ts +2 -0
- package/lib/src/metadata-builder/builders/section-builders/profile-section-builder.js +36 -2
- package/lib/src/metadata-builder/builders/section-builders/shapes-section-builder.d.ts +2 -0
- package/lib/src/metadata-builder/builders/section-builders/shapes-section-builder.js +70 -27
- package/lib/src/metadata-builder/builders/section-builders/social-links-builder.d.ts +2 -0
- package/lib/src/metadata-builder/builders/section-builders/social-links-builder.js +7 -2
- package/lib/src/metadata-builder/builders/section-builders/testimonial-section-builder.d.ts +2 -0
- package/lib/src/metadata-builder/builders/section-builders/testimonial-section-builder.js +91 -26
- package/lib/src/metadata-builder/builders/section-builders/text-section-builder.d.ts +2 -0
- package/lib/src/metadata-builder/builders/section-builders/text-section-builder.js +69 -31
- package/lib/src/metadata-builder/builders/section-content-factory.d.ts +2 -2
- package/lib/src/metadata-builder/builders/section-content-factory.js +8 -2
- package/lib/src/metadata-builder/builders/section-field-maps.js +30 -2
- package/lib/src/metadata-builder/builders/section-field-utils.d.ts +46 -7
- package/lib/src/metadata-builder/builders/section-field-utils.js +86 -62
- package/lib/src/metadata-builder/builders/section-rules/about-section.rules.d.ts +2 -0
- package/lib/src/metadata-builder/builders/section-rules/about-section.rules.js +20 -0
- package/lib/src/metadata-builder/builders/section-rules/add-page.rules.d.ts +7 -0
- package/lib/src/metadata-builder/builders/section-rules/add-page.rules.js +8 -0
- package/lib/src/metadata-builder/builders/section-rules/banner-section.rules.d.ts +2 -0
- package/lib/src/metadata-builder/builders/section-rules/banner-section.rules.js +27 -0
- package/lib/src/metadata-builder/builders/section-rules/booking-section.rules.d.ts +2 -0
- package/lib/src/metadata-builder/builders/section-rules/booking-section.rules.js +16 -0
- package/lib/src/metadata-builder/builders/section-rules/button-section.rules.d.ts +2 -0
- package/lib/src/metadata-builder/builders/section-rules/button-section.rules.js +13 -0
- package/lib/src/metadata-builder/builders/section-rules/contact-form.rules.d.ts +2 -0
- package/lib/src/metadata-builder/builders/section-rules/contact-form.rules.js +16 -0
- package/lib/src/metadata-builder/builders/section-rules/divider-section.rules.d.ts +2 -0
- package/lib/src/metadata-builder/builders/section-rules/divider-section.rules.js +7 -0
- package/lib/src/metadata-builder/builders/section-rules/footer.rules.d.ts +4 -0
- package/lib/src/metadata-builder/builders/section-rules/footer.rules.js +5 -0
- package/lib/src/metadata-builder/builders/section-rules/global-styles.rules.d.ts +6 -0
- package/lib/src/metadata-builder/builders/section-rules/global-styles.rules.js +26 -0
- package/lib/src/metadata-builder/builders/section-rules/header.rules.d.ts +4 -0
- package/lib/src/metadata-builder/builders/section-rules/header.rules.js +41 -0
- package/lib/src/metadata-builder/builders/section-rules/image-gallery.rules.d.ts +2 -0
- package/lib/src/metadata-builder/builders/section-rules/image-gallery.rules.js +10 -0
- package/lib/src/metadata-builder/builders/section-rules/images-section.rules.d.ts +2 -0
- package/lib/src/metadata-builder/builders/section-rules/images-section.rules.js +31 -0
- package/lib/src/metadata-builder/builders/section-rules/mailing-list.rules.d.ts +2 -0
- package/lib/src/metadata-builder/builders/section-rules/mailing-list.rules.js +11 -0
- package/lib/src/metadata-builder/builders/section-rules/profile.rules.d.ts +2 -0
- package/lib/src/metadata-builder/builders/section-rules/profile.rules.js +14 -0
- package/lib/src/metadata-builder/builders/section-rules/rename-page.rules.d.ts +7 -0
- package/lib/src/metadata-builder/builders/section-rules/rename-page.rules.js +8 -0
- package/lib/src/metadata-builder/builders/section-rules/shapes-section.rules.d.ts +2 -0
- package/lib/src/metadata-builder/builders/section-rules/shapes-section.rules.js +27 -0
- package/lib/src/metadata-builder/builders/section-rules/social-links.rules.d.ts +2 -0
- package/lib/src/metadata-builder/builders/section-rules/social-links.rules.js +9 -0
- package/lib/src/metadata-builder/builders/section-rules/testimonial-section.rules.d.ts +7 -0
- package/lib/src/metadata-builder/builders/section-rules/testimonial-section.rules.js +26 -0
- package/lib/src/metadata-builder/builders/section-rules/text-section.rules.d.ts +2 -0
- package/lib/src/metadata-builder/builders/section-rules/text-section.rules.js +14 -0
- package/lib/src/metadata-builder/builders/shape-color-utils.d.ts +26 -0
- package/lib/src/metadata-builder/builders/shape-color-utils.js +52 -0
- package/lib/src/metadata-builder/builders/undo-builder.d.ts +48 -0
- package/lib/src/metadata-builder/builders/undo-builder.js +58 -0
- package/lib/src/metadata-builder/builders/update-content-text-style-builder.js +5 -1
- package/lib/src/metadata-builder/helpers/rte.helpers.d.ts +15 -4
- package/lib/src/metadata-builder/helpers/rte.helpers.js +24 -10
- package/lib/src/metadata-builder/metadata-executor.d.ts +2 -1
- package/lib/src/metadata-builder/metadata-executor.js +32 -5
- package/lib/src/metadata-builder/models.d.ts +26 -1
- package/lib/src/metadata-builder/models.js +14 -1
- package/lib/src/metadata-builder/parsers/ai-toolcall-parser.d.ts +144 -0
- package/lib/src/metadata-builder/parsers/ai-toolcall-parser.js +17 -0
- package/lib/src/metadata-builder/parsers/section-tool-arguments.d.ts +113 -24
- package/lib/src/metadata-builder/parsers/section-tool-arguments.js +5 -1
- package/lib/src/metadata-builder/sanitizers/rte-schema-check.d.ts +22 -0
- package/lib/src/metadata-builder/sanitizers/rte-schema-check.js +84 -0
- package/lib/src/metadata-builder/sanitizers/sanitizer-rules.d.ts +47 -0
- package/lib/src/metadata-builder/sanitizers/sanitizer-rules.js +60 -0
- package/lib/src/metadata-builder/sanitizers/section-args-validator.d.ts +41 -0
- package/lib/src/metadata-builder/sanitizers/section-args-validator.js +274 -0
- package/lib/src/shared/content-settings/components/content-settings/ContentSettings.mixin.d.ts +2 -1
- package/lib/src/shared/content-settings/components/content-settings/ContentSettings.mixin.js +2 -16
- package/lib/src/shared/content-settings/components/content-settings/ContentSettings.stories.js +0 -1
- package/lib/src/shared/content-settings/components/content-settings/ReplaceImageSettingsForContent.mixin.d.ts +2 -1
- package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItem.mixin.d.ts +2 -3
- package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.d.ts +0 -4
- package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.js +6 -8
- package/lib/src/shared/content-settings/components/payment-config-field/PaymentConfigField.mixin.d.ts +0 -28
- package/lib/src/shared/logo-settings/components/EditLogoSettings.mixin.d.ts +2 -1
- package/lib/src/shared/logo-settings/components/LogoSettings.mixin.d.ts +0 -28
- package/lib/src/shared/navigation-style-settings/store/index.js +1 -0
- package/lib/src/shared/page-navigation/store/page-navigation-store.js +1 -20
- package/lib/src/shared/page-navigation/utils/nav-order-utils.d.ts +3 -0
- package/lib/src/shared/page-navigation/utils/nav-order-utils.js +20 -0
- package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.d.ts +2 -30
- package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.d.ts +0 -28
- package/lib/src/shared/publish-brand-page-with-state/PublishBrandPageModalWithState.mixin.d.ts +2 -43
- package/lib/src/shared/side-bar/components/SideBar.mixin.d.ts +0 -30
- package/lib/src/shared/side-bar/components/SideBarTabButton.mixin.d.ts +2 -3
- package/lib/src/shared/side-bar/store/side-bar-store.d.ts +0 -12
- package/lib/src/shared/side-bar/store/side-bar-store.js +0 -7
- package/lib/src/shared/style-settings/components/StyleSettings.mixin.d.ts +2 -29
- package/lib/src/shared/template-settings/components/TemplatesSettings.mixin.d.ts +2 -1
- package/lib/src/utils/build-asset-manifest.d.ts +26 -0
- package/lib/src/utils/build-asset-manifest.js +114 -0
- package/lib/src/utils/minify-brand-page-metadata.d.ts +49 -1
- package/lib/src/utils/minify-brand-page-metadata.js +216 -129
- package/package.json +1 -1
- package/src/brand-page/components/banner-section/BannerSection.vue +1 -1
- package/src/brand-page/components/contact-form/ContactForm.vue +29 -26
- package/src/brand-page/components/image-gallery/ImageGalleryModal.mixin.ts +6 -2
- package/src/brand-page/components/text-media-section/TextMediaSection.vue +1 -5
- package/src/brand-page/models/brand-page-context.model.ts +1 -25
- package/src/brand-page/models/index.ts +1 -0
- package/src/brand-page/utils/color.util.test.ts +48 -0
- package/src/brand-page/utils/color.util.ts +29 -4
- package/src/brand-page/utils/raygun.util.ts +11 -2
- package/src/brand-page/utils/svg-color.util.ts +1 -3
- package/src/brand-page/utils/view-model.util.ts +1 -4
- package/src/brand-page-maker/components/ai-text-edit/AiChatbox.vue +2 -2
- package/src/brand-page-maker/components/ai-text-edit/AiProgressFeed.vue +162 -0
- package/src/brand-page-maker/components/ai-text-edit/TextBubble.vue +57 -5
- package/src/brand-page-maker/components/ai-text-edit/i18n/generate-ai.de-DE.json +0 -20
- package/src/brand-page-maker/components/ai-text-edit/i18n/generate-ai.es-ES.json +0 -20
- package/src/brand-page-maker/components/ai-text-edit/i18n/generate-ai.fr-CA.json +0 -20
- package/src/brand-page-maker/components/ai-text-edit/i18n/generate-ai.fr-FR.json +0 -20
- package/src/brand-page-maker/components/ai-text-edit/i18n/generate-ai.json +0 -20
- package/src/brand-page-maker/components/ai-text-edit/i18n/generate-ai.pt-BR.json +0 -20
- package/src/brand-page-maker/components/ai-text-edit/i18n/generate-ai.pt-PT.json +0 -20
- package/src/brand-page-maker/components/ai-website-builder/AiWebsiteBuilder.vue +1 -2
- package/src/brand-page-maker/components/ai-website-builder/i18n/ai-website-builder.de-DE.json +3 -0
- package/src/brand-page-maker/components/ai-website-builder/i18n/ai-website-builder.es-ES.json +3 -0
- package/src/brand-page-maker/components/ai-website-builder/i18n/ai-website-builder.fr-CA.json +3 -0
- package/src/brand-page-maker/components/ai-website-builder/i18n/ai-website-builder.fr-FR.json +3 -0
- package/src/brand-page-maker/components/ai-website-builder/i18n/ai-website-builder.json +3 -0
- package/src/brand-page-maker/components/ai-website-builder/i18n/ai-website-builder.pt-BR.json +3 -0
- package/src/brand-page-maker/components/ai-website-builder/i18n/ai-website-builder.pt-PT.json +3 -0
- package/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.vue +3 -28
- package/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-page-examples.ts +0 -2
- package/src/brand-page-maker/composables/ai-chat/aiErrorCopy.test.ts +229 -0
- package/src/brand-page-maker/composables/ai-chat/aiErrorCopy.ts +164 -0
- package/src/brand-page-maker/composables/ai-chat/types.ts +49 -0
- package/src/brand-page-maker/composables/ai-chat/useAiMetadataBuilder.ts +20 -0
- package/src/brand-page-maker/composables/ai-chat/useAiWebsiteBuilderChat.ts +651 -94
- package/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.ts +9 -9
- package/src/brand-page-maker/composables/useEventTracker.ts +31 -25
- package/src/brand-page-maker/constants/sidebar-constant.ts +7 -15
- package/src/brand-page-maker/convertors/image-aspect-ratio.convertor.ts +2 -2
- package/src/brand-page-maker/convertors/text-size-value.convertor.ts +3 -3
- package/src/brand-page-maker/stores/ai-checkpoint/ai-checkpoint-store.ts +54 -0
- package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.ts +76 -0
- package/src/brand-page-maker/stores/index.ts +1 -1
- package/src/brand-page-maker/stores/user/user-store.ts +0 -1
- package/src/bundles/bundled-translations.de-DE.json +1 -20
- package/src/bundles/bundled-translations.es-ES.json +1 -20
- package/src/bundles/bundled-translations.fr-CA.json +1 -20
- package/src/bundles/bundled-translations.fr-FR.json +1 -20
- package/src/bundles/bundled-translations.json +1 -20
- package/src/bundles/bundled-translations.pt-BR.json +1 -20
- package/src/bundles/bundled-translations.pt-PT.json +1 -20
- package/src/clients/ai-assistant-client.ts +59 -46
- package/src/clients/design-template-client.ts +0 -66
- package/src/clients/websocket-gateway-client.ts +17 -1
- package/src/composables/useTranslate.ts +3 -0
- package/src/constants/ui.ts +0 -1
- package/src/lib.ts +1 -0
- package/src/metadata-builder/ai-metadata-executor.ts +94 -1
- package/src/metadata-builder/builders/add-page-builder.ts +9 -13
- package/src/metadata-builder/builders/footer-builder.test.ts +76 -0
- package/src/metadata-builder/builders/footer-builder.ts +226 -0
- package/src/metadata-builder/builders/global-styles-builder.ts +187 -0
- package/src/metadata-builder/builders/header-builder.test.ts +106 -0
- package/src/metadata-builder/builders/header-builder.ts +254 -0
- package/src/metadata-builder/builders/rename-page-builder.ts +79 -0
- package/src/metadata-builder/builders/section-builders/about-section-builder.ts +73 -5
- package/src/metadata-builder/builders/section-builders/banner-section-builder.ts +112 -7
- package/src/metadata-builder/builders/section-builders/base-section-builder.ts +149 -11
- package/src/metadata-builder/builders/section-builders/booking-section-builder.ts +87 -0
- package/src/metadata-builder/builders/section-builders/button-section-builder.ts +6 -1
- package/src/metadata-builder/builders/section-builders/contact-form-builder.ts +74 -4
- package/src/metadata-builder/builders/section-builders/delete-section-builder.ts +15 -1
- package/src/metadata-builder/builders/section-builders/divider-section-builder.ts +13 -1
- package/src/metadata-builder/builders/section-builders/image-gallery-builder.ts +91 -31
- package/src/metadata-builder/builders/section-builders/images-section-builder.ts +102 -48
- package/src/metadata-builder/builders/section-builders/index.ts +1 -0
- package/src/metadata-builder/builders/section-builders/mailing-list-builder.ts +38 -2
- package/src/metadata-builder/builders/section-builders/mailing-list-section-builder.ts +38 -2
- package/src/metadata-builder/builders/section-builders/profile-section-builder.ts +55 -3
- package/src/metadata-builder/builders/section-builders/shapes-section-builder.ts +170 -77
- package/src/metadata-builder/builders/section-builders/social-links-builder.test.ts +119 -0
- package/src/metadata-builder/builders/section-builders/social-links-builder.ts +13 -2
- package/src/metadata-builder/builders/section-builders/testimonial-section-builder.ts +178 -57
- package/src/metadata-builder/builders/section-builders/text-section-builder.ts +130 -30
- package/src/metadata-builder/builders/section-content-factory.ts +15 -2
- package/src/metadata-builder/builders/section-field-maps.ts +34 -1
- package/src/metadata-builder/builders/section-field-utils.ts +131 -72
- package/src/metadata-builder/builders/section-rules/about-section.rules.ts +38 -0
- package/src/metadata-builder/builders/section-rules/add-page.rules.ts +17 -0
- package/src/metadata-builder/builders/section-rules/banner-section.rules.ts +49 -0
- package/src/metadata-builder/builders/section-rules/booking-section.rules.ts +34 -0
- package/src/metadata-builder/builders/section-rules/button-section.rules.ts +22 -0
- package/src/metadata-builder/builders/section-rules/contact-form.rules.ts +30 -0
- package/src/metadata-builder/builders/section-rules/divider-section.rules.ts +17 -0
- package/src/metadata-builder/builders/section-rules/footer.rules.ts +21 -0
- package/src/metadata-builder/builders/section-rules/global-styles.rules.ts +44 -0
- package/src/metadata-builder/builders/section-rules/header.rules.ts +75 -0
- package/src/metadata-builder/builders/section-rules/image-gallery.rules.ts +22 -0
- package/src/metadata-builder/builders/section-rules/images-section.rules.ts +55 -0
- package/src/metadata-builder/builders/section-rules/mailing-list.rules.ts +21 -0
- package/src/metadata-builder/builders/section-rules/profile.rules.ts +27 -0
- package/src/metadata-builder/builders/section-rules/rename-page.rules.ts +17 -0
- package/src/metadata-builder/builders/section-rules/shapes-section.rules.ts +51 -0
- package/src/metadata-builder/builders/section-rules/social-links.rules.ts +27 -0
- package/src/metadata-builder/builders/section-rules/testimonial-section.rules.ts +48 -0
- package/src/metadata-builder/builders/section-rules/text-section.rules.ts +28 -0
- package/src/metadata-builder/builders/shape-color-utils.test.ts +115 -0
- package/src/metadata-builder/builders/shape-color-utils.ts +75 -0
- package/src/metadata-builder/builders/undo-builder.ts +105 -0
- package/src/metadata-builder/builders/update-content-text-style-builder.ts +4 -1
- package/src/metadata-builder/helpers/rte.helpers.ts +27 -13
- package/src/metadata-builder/metadata-executor.ts +42 -2
- package/src/metadata-builder/models.ts +39 -1
- package/src/metadata-builder/parsers/ai-toolcall-parser.ts +152 -0
- package/src/metadata-builder/parsers/section-tool-arguments.ts +138 -24
- package/src/metadata-builder/sanitizers/__tests__/section-args-validator.test.ts +659 -0
- package/src/metadata-builder/sanitizers/rte-schema-check.ts +99 -0
- package/src/metadata-builder/sanitizers/sanitizer-rules.ts +97 -0
- package/src/metadata-builder/sanitizers/section-args-validator.ts +445 -0
- package/src/shared/content-settings/components/content-settings/ContentSettings.mixin.ts +10 -16
- package/src/shared/content-settings/components/content-settings/ContentSettings.stories.ts +0 -1
- package/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.ts +6 -10
- package/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.vue +1 -23
- package/src/shared/content-settings/components/testimonial-items-field/TestimonialItemsField.vue +0 -15
- package/src/shared/content-settings/components/text-items-field/TextItemsField.vue +0 -15
- package/src/shared/navigation-style-settings/store/index.ts +5 -0
- package/src/shared/page-navigation/store/page-navigation-store.ts +4 -31
- package/src/shared/page-navigation/utils/nav-order-utils.ts +32 -0
- package/src/shared/side-bar/components/SideBar.vue +14 -1
- package/src/shared/side-bar/store/side-bar-store.ts +0 -20
- package/src/utils/build-asset-manifest.ts +153 -0
- package/src/utils/minify-brand-page-metadata.ts +362 -130
- package/lib/src/brand-page-maker/composables/ai-chat/useAiChat.js +0 -368
- package/lib/src/brand-page-maker/composables/ai-chat/useAiTextEditPrompts.d.ts +0 -18
- package/lib/src/brand-page-maker/composables/ai-chat/useAiTextEditPrompts.js +0 -144
- package/lib/src/brand-page-maker/stores/ai-thread/ai-thread-store.d.ts +0 -155
- package/lib/src/brand-page-maker/stores/ai-thread/ai-thread-store.js +0 -25
- package/lib/src/brand-page-maker/utils/mixpanel.util.d.ts +0 -1
- package/lib/src/brand-page-maker/utils/mixpanel.util.js +0 -29
- package/lib/src/bundled-translations-CNK7l6_v.js +0 -173
- package/lib/src/bundled-translations.de-DE-BLE4_y0H.js +0 -173
- package/lib/src/bundled-translations.es-ES-thO9osbg.js +0 -173
- package/lib/src/bundled-translations.fr-CA-BZkhiNgU.js +0 -173
- package/lib/src/bundled-translations.fr-FR-bhDLPKgZ.js +0 -173
- package/lib/src/bundled-translations.pt-BR-CI9a5Bq1.js +0 -173
- package/lib/src/bundled-translations.pt-PT-DBoErBaq.js +0 -173
- package/src/brand-page-maker/components/ai-text-edit/AiTextEdit.vue +0 -154
- package/src/brand-page-maker/composables/ai-chat/useAiChat.ts +0 -562
- package/src/brand-page-maker/composables/ai-chat/useAiTextEditPrompts.ts +0 -196
- package/src/brand-page-maker/stores/ai-thread/ai-thread-store.ts +0 -31
- package/src/brand-page-maker/utils/mixpanel.util.ts +0 -42
- package/src/shared/content-settings/components/generate-ai-button/GenerateAiButton.vue +0 -114
- package/src/shared/content-settings/components/generate-ai-modal/GenerateAiModal.vue +0 -761
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
import axios, { type AxiosError } from 'axios';
|
|
2
2
|
import { useBrandPageContainerStore } from '../brand-page-maker/stores/brandpage-container/brand-page-container-store';
|
|
3
3
|
import type { MinifiedBrandPageMetadata } from '../utils/minify-brand-page-metadata';
|
|
4
|
+
import type { AssetEntry } from '../utils/build-asset-manifest';
|
|
5
|
+
|
|
6
|
+
export interface ActiveContext {
|
|
7
|
+
currentPageId: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface LogoContext {
|
|
11
|
+
logoTextColor?: string;
|
|
12
|
+
logoBackgroundColor?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface WebsiteContext {
|
|
16
|
+
metadata: MinifiedBrandPageMetadata;
|
|
17
|
+
assets?: AssetEntry[];
|
|
18
|
+
activeContext?: ActiveContext;
|
|
19
|
+
businessName?: string;
|
|
20
|
+
logoContext?: LogoContext;
|
|
21
|
+
}
|
|
4
22
|
|
|
5
23
|
// Agent types
|
|
6
24
|
export const AI_ASSISTANT_AGENT_TYPES = {
|
|
7
|
-
WEBSITE_TEXT_ELEMENT: 'website_text_element',
|
|
8
25
|
WEBSITE_BUILDER: 'website_builder',
|
|
9
26
|
} as const;
|
|
10
27
|
|
|
11
28
|
export type AiAssistantAgentType =
|
|
12
29
|
(typeof AI_ASSISTANT_AGENT_TYPES)[keyof typeof AI_ASSISTANT_AGENT_TYPES];
|
|
13
30
|
|
|
31
|
+
// User plan
|
|
32
|
+
export type UserPlan = 'free' | 'premium';
|
|
33
|
+
|
|
14
34
|
// Response types
|
|
15
35
|
export type AiAssistantResponseType =
|
|
16
36
|
| 'message'
|
|
17
37
|
| 'tool_calls'
|
|
18
38
|
| 'tool_calls_with_message';
|
|
19
39
|
|
|
20
|
-
// Text element metadata (sent to AI)
|
|
21
|
-
export interface TextElementMetadata {
|
|
22
|
-
text: string;
|
|
23
|
-
style?: BrandPageCssStyle;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// Website text element request content (JSON stringified in message)
|
|
27
|
-
export interface WebsiteTextElementRequestContent {
|
|
28
|
-
pageId: string;
|
|
29
|
-
contentType: string;
|
|
30
|
-
fieldName: string;
|
|
31
|
-
contentId: string;
|
|
32
|
-
businessName?: string;
|
|
33
|
-
industry?: string;
|
|
34
|
-
locale: string;
|
|
35
|
-
maxChars?: number;
|
|
36
|
-
userPrompt: string;
|
|
37
|
-
metadata: TextElementMetadata;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
40
|
// Tool call from AI response
|
|
41
41
|
export interface AiAssistantToolCall {
|
|
42
42
|
toolId: string;
|
|
@@ -49,41 +49,52 @@ export interface AiAssistantToolCall {
|
|
|
49
49
|
export interface AiAssistantToolResult {
|
|
50
50
|
toolId: string;
|
|
51
51
|
success: string; // "success" or error message
|
|
52
|
+
name?: string; // tool function name
|
|
53
|
+
errorMessage?: string; // detailed error from builder
|
|
52
54
|
}
|
|
53
55
|
|
|
54
56
|
// Website AI Assistant Request types
|
|
55
57
|
export interface WebsiteCreateThreadRequest {
|
|
56
58
|
message: string;
|
|
59
|
+
websiteContext?: WebsiteContext;
|
|
57
60
|
websiteSnapshot?: string;
|
|
58
61
|
agentType: AiAssistantAgentType;
|
|
59
62
|
}
|
|
60
63
|
|
|
61
64
|
export interface WebsiteSendMessageRequest {
|
|
62
65
|
message: string;
|
|
66
|
+
websiteContext?: WebsiteContext;
|
|
63
67
|
websiteSnapshot?: string;
|
|
64
68
|
agentType: AiAssistantAgentType;
|
|
65
69
|
}
|
|
66
70
|
|
|
67
71
|
export interface WebsiteToolSubmissionRequest {
|
|
68
|
-
|
|
72
|
+
agentType: AiAssistantAgentType;
|
|
69
73
|
toolCalls: AiAssistantToolResult[];
|
|
74
|
+
runId?: string | null;
|
|
70
75
|
message?: string;
|
|
71
76
|
websiteSnapshot?: string;
|
|
72
|
-
|
|
77
|
+
connectionId?: string;
|
|
78
|
+
retryCount?: number;
|
|
79
|
+
userPlan?: UserPlan;
|
|
73
80
|
}
|
|
74
81
|
|
|
75
82
|
// Async build request/response types
|
|
76
83
|
export interface WebsiteCreateThreadBuildRequest {
|
|
77
84
|
message: string;
|
|
85
|
+
websiteContext?: WebsiteContext;
|
|
78
86
|
websiteSnapshot?: string;
|
|
79
87
|
agentType: AiAssistantAgentType;
|
|
88
|
+
userPlan?: UserPlan;
|
|
80
89
|
connectionId: string;
|
|
81
90
|
}
|
|
82
91
|
|
|
83
92
|
export interface WebsiteSendMessageBuildRequest {
|
|
84
93
|
message: string;
|
|
94
|
+
websiteContext?: WebsiteContext;
|
|
85
95
|
websiteSnapshot?: string;
|
|
86
96
|
agentType: AiAssistantAgentType;
|
|
97
|
+
userPlan?: UserPlan;
|
|
87
98
|
connectionId: string;
|
|
88
99
|
}
|
|
89
100
|
|
|
@@ -299,6 +310,31 @@ export class AiAssistantClient {
|
|
|
299
310
|
}
|
|
300
311
|
}
|
|
301
312
|
|
|
313
|
+
async submitToolResultsBuildAsync(
|
|
314
|
+
threadId: string,
|
|
315
|
+
request: WebsiteToolSubmissionRequest,
|
|
316
|
+
): Promise<AiAssistantBuildResponse> {
|
|
317
|
+
if (!threadId) {
|
|
318
|
+
throw new Error('threadId is required');
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
try {
|
|
322
|
+
const response = await axios.post<AiAssistantBuildResponse>(
|
|
323
|
+
getWebsiteToolSubmissionEndpoint(threadId),
|
|
324
|
+
request,
|
|
325
|
+
{
|
|
326
|
+
withCredentials: true,
|
|
327
|
+
headers: this.getRequestHeaders(),
|
|
328
|
+
},
|
|
329
|
+
);
|
|
330
|
+
|
|
331
|
+
return response.data;
|
|
332
|
+
} catch (error) {
|
|
333
|
+
this.handleError(error as AxiosError<AiAssistantErrorResponse>);
|
|
334
|
+
throw error;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
302
338
|
private handleError(error: AxiosError<AiAssistantErrorResponse>): void {
|
|
303
339
|
if (process.env.NODE_ENV !== 'production') {
|
|
304
340
|
const errorData = error.response?.data;
|
|
@@ -318,29 +354,6 @@ export class AiAssistantClient {
|
|
|
318
354
|
}
|
|
319
355
|
}
|
|
320
356
|
|
|
321
|
-
/**
|
|
322
|
-
* Build the JSON message content for website text element agent
|
|
323
|
-
*/
|
|
324
|
-
export const buildWebsiteTextElementMessage = (
|
|
325
|
-
content: WebsiteTextElementRequestContent,
|
|
326
|
-
): string => {
|
|
327
|
-
return JSON.stringify(content);
|
|
328
|
-
};
|
|
329
|
-
|
|
330
|
-
/**
|
|
331
|
-
* Build the message content for website builder agent.
|
|
332
|
-
* Embeds minified metadata as a JSON code fence in the message text
|
|
333
|
-
* so the ai-pipeline's _extract_context_from_request() can parse it.
|
|
334
|
-
*/
|
|
335
|
-
export const buildWebsiteBuilderMessage = (
|
|
336
|
-
userPrompt: string,
|
|
337
|
-
minifiedMetadata: MinifiedBrandPageMetadata,
|
|
338
|
-
): string => {
|
|
339
|
-
const metadataJson = JSON.stringify(minifiedMetadata);
|
|
340
|
-
|
|
341
|
-
return `${userPrompt}\n\nmetadata:\n\`\`\`json\n${metadataJson}\n\`\`\``;
|
|
342
|
-
};
|
|
343
|
-
|
|
344
357
|
let _instance: AiAssistantClient | undefined;
|
|
345
358
|
|
|
346
359
|
export const getInstance = (): AiAssistantClient =>
|
|
@@ -30,8 +30,6 @@ export const getTemplatesEndpoint = (templateTypeName: string) =>
|
|
|
30
30
|
export const getTemplateEndpoint = (templateToken) =>
|
|
31
31
|
`/maker/api/template/${templateToken}`;
|
|
32
32
|
|
|
33
|
-
export const getGenerateTextEndpoint = () => `/api/ai/websites/generate-text`;
|
|
34
|
-
|
|
35
33
|
/**
|
|
36
34
|
* This class is a partial clone of template-client.js with typing
|
|
37
35
|
*/
|
|
@@ -101,70 +99,6 @@ export class DesignTemplateClient {
|
|
|
101
99
|
|
|
102
100
|
return null;
|
|
103
101
|
}
|
|
104
|
-
|
|
105
|
-
async generateText(
|
|
106
|
-
prompt: string,
|
|
107
|
-
existingText?: string,
|
|
108
|
-
snapshotBase64?: string,
|
|
109
|
-
businessName?: string,
|
|
110
|
-
industry?: string,
|
|
111
|
-
contentType?: string,
|
|
112
|
-
contentId?: string,
|
|
113
|
-
fieldName?: string,
|
|
114
|
-
): Promise<string | null> {
|
|
115
|
-
try {
|
|
116
|
-
// Get CSRF token from meta tag
|
|
117
|
-
const csrfToken = document.head
|
|
118
|
-
?.querySelector('meta[name=csrf-token]')
|
|
119
|
-
?.getAttribute('content');
|
|
120
|
-
|
|
121
|
-
const response = await axios.post<{
|
|
122
|
-
generatedText: string;
|
|
123
|
-
usage: {
|
|
124
|
-
inputTokens: number;
|
|
125
|
-
outputTokens: number;
|
|
126
|
-
totalTokens: number;
|
|
127
|
-
};
|
|
128
|
-
}>(
|
|
129
|
-
getGenerateTextEndpoint(),
|
|
130
|
-
{
|
|
131
|
-
prompt,
|
|
132
|
-
existingText: existingText || '',
|
|
133
|
-
snapshotBase64: snapshotBase64 || '',
|
|
134
|
-
businessName: businessName || '',
|
|
135
|
-
industry: industry || '',
|
|
136
|
-
contentType: contentType || '',
|
|
137
|
-
contentId: contentId || '',
|
|
138
|
-
fieldName: fieldName || '',
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
withCredentials: true,
|
|
142
|
-
headers: {
|
|
143
|
-
'Content-Type': 'application/json',
|
|
144
|
-
'csrf-token': csrfToken || '',
|
|
145
|
-
},
|
|
146
|
-
},
|
|
147
|
-
);
|
|
148
|
-
|
|
149
|
-
if (response.status !== 200) {
|
|
150
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
151
|
-
console.error(
|
|
152
|
-
`generateText got response status '${response.status}'`,
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
return null;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
return response.data.generatedText;
|
|
160
|
-
} catch (e: any) {
|
|
161
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
162
|
-
console.error('Failed to generate text:', e);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
throw e;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
102
|
}
|
|
169
103
|
|
|
170
104
|
let _instance: DesignTemplateClient | undefined;
|
|
@@ -5,8 +5,22 @@ export interface WebSocketConnectResponse {
|
|
|
5
5
|
connectionUrl: string;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
+
export interface PlanItem {
|
|
9
|
+
id: string;
|
|
10
|
+
pendingLabel: string;
|
|
11
|
+
completeLabel: string;
|
|
12
|
+
subIds?: string[]; // present for grouped items; individual item_complete IDs within the group
|
|
13
|
+
}
|
|
14
|
+
|
|
8
15
|
export interface WebSocketMessage {
|
|
9
|
-
type:
|
|
16
|
+
type:
|
|
17
|
+
| 'connected'
|
|
18
|
+
| 'server_response'
|
|
19
|
+
| 'server_error'
|
|
20
|
+
| 'build_error'
|
|
21
|
+
| 'chat_started'
|
|
22
|
+
| 'plan_announced'
|
|
23
|
+
| 'item_complete';
|
|
10
24
|
buildId?: string;
|
|
11
25
|
connectionId?: string;
|
|
12
26
|
pageId?: string;
|
|
@@ -16,6 +30,8 @@ export interface WebSocketMessage {
|
|
|
16
30
|
toolCalls?: unknown[];
|
|
17
31
|
message?: string;
|
|
18
32
|
error?: string;
|
|
33
|
+
items?: PlanItem[];
|
|
34
|
+
itemId?: string;
|
|
19
35
|
}
|
|
20
36
|
|
|
21
37
|
type MessageHandler = (msg: WebSocketMessage) => void;
|
|
@@ -219,6 +219,8 @@ const saveContactWidgetTr = (key, valuesToInterpolate = {}) =>
|
|
|
219
219
|
tr(`saveContactWidget.${key}`, valuesToInterpolate);
|
|
220
220
|
const paymentShippingAddressTr = (key, valuesToInterpolate = {}) =>
|
|
221
221
|
tr(`paymentShippingAddress.${key}`, valuesToInterpolate);
|
|
222
|
+
const aiWebsiteBuilderTr = (key, valuesToInterpolate = {}) =>
|
|
223
|
+
tr(`aiWebsiteBuilder.${key}`, valuesToInterpolate);
|
|
222
224
|
|
|
223
225
|
const countriesTr = (): Country[] => {
|
|
224
226
|
const instance = getI18NextInstance();
|
|
@@ -330,5 +332,6 @@ export {
|
|
|
330
332
|
generateAiModalTr,
|
|
331
333
|
saveContactWidgetTr,
|
|
332
334
|
paymentShippingAddressTr,
|
|
335
|
+
aiWebsiteBuilderTr,
|
|
333
336
|
countriesTr,
|
|
334
337
|
};
|
package/src/constants/ui.ts
CHANGED
package/src/lib.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { type BrandPageModel } from '../brand-page/models';
|
|
2
|
+
import type { EventTracker } from '../brand-page-maker/composables/useEventTracker';
|
|
2
3
|
import { buildUpdateTextRequest } from './builders/update-content-text-builder';
|
|
3
4
|
import { buildUpdateTextStyleRequest } from './builders/update-content-text-style-builder';
|
|
5
|
+
import type { UndoHandler } from './builders/undo-builder';
|
|
4
6
|
import type { Logger } from './logger';
|
|
5
7
|
import { MetadataExecutor } from './metadata-executor';
|
|
6
8
|
import {
|
|
@@ -19,6 +21,12 @@ import {
|
|
|
19
21
|
type MoveSectionArguments,
|
|
20
22
|
type AddPageArguments,
|
|
21
23
|
type RemovePageArguments,
|
|
24
|
+
type RenamePageArguments,
|
|
25
|
+
type UpdateFooterArguments,
|
|
26
|
+
type UpdateGlobalStylesArguments,
|
|
27
|
+
type UpdateHeaderArguments,
|
|
28
|
+
// UndoArguments intentionally not destructured here — the undo tool call has
|
|
29
|
+
// no fields. Its presence is the entire signal.
|
|
22
30
|
} from './parsers/ai-toolcall-parser';
|
|
23
31
|
import type { SectionToolCallShape } from './parsers/section-tool-arguments';
|
|
24
32
|
|
|
@@ -28,6 +36,25 @@ export const executeToolCallsAsync = async (
|
|
|
28
36
|
options: {
|
|
29
37
|
logger?: Logger;
|
|
30
38
|
maxCharacters?: number;
|
|
39
|
+
/**
|
|
40
|
+
* Callback invoked by the UndoBuilder at execution time to resolve the
|
|
41
|
+
* pre-prompt snapshot to restore to. The library is agnostic about where
|
|
42
|
+
* the snapshot lives — the caller decides (e.g. read from a Pinia store,
|
|
43
|
+
* IndexedDB, remote API). Return `null` when no snapshot is available;
|
|
44
|
+
* the UndoBuilder will surface a clear error.
|
|
45
|
+
*
|
|
46
|
+
* Required when the toolcalls include an `undo` call. If omitted, the
|
|
47
|
+
* library substitutes a `() => null` handler so undo produces a
|
|
48
|
+
* well-defined error rather than a cryptic failure.
|
|
49
|
+
*/
|
|
50
|
+
undoHandler?: UndoHandler;
|
|
51
|
+
/**
|
|
52
|
+
* Optional AI-prompt-originated event tracker. When provided, builders
|
|
53
|
+
* that add or remove sections invoke the tracker at the mutation point.
|
|
54
|
+
* Passed by reference so thread/build IDs and user plan can be resolved
|
|
55
|
+
* fresh at fire time by the composable layer.
|
|
56
|
+
*/
|
|
57
|
+
eventTracker?: EventTracker;
|
|
31
58
|
},
|
|
32
59
|
): Promise<MetadataExecutorResult> => {
|
|
33
60
|
const requests: MetadataBuilderRequest[] = toolcalls
|
|
@@ -105,6 +132,65 @@ export const executeToolCallsAsync = async (
|
|
|
105
132
|
};
|
|
106
133
|
}
|
|
107
134
|
|
|
135
|
+
case AI_ASSISTANT_TOOL_NAMES.RENAME_PAGE: {
|
|
136
|
+
const arg = toolcall.arguments as unknown as RenamePageArguments;
|
|
137
|
+
|
|
138
|
+
return {
|
|
139
|
+
id: toolcall.toolId,
|
|
140
|
+
type: BUILDER_TYPES.RENAME_PAGE as BuilderType,
|
|
141
|
+
payload: {
|
|
142
|
+
pageId: arg.page_id,
|
|
143
|
+
pageName: arg.page_name,
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
case AI_ASSISTANT_TOOL_NAMES.UPDATE_FOOTER: {
|
|
149
|
+
const arg = toolcall.arguments as unknown as UpdateFooterArguments;
|
|
150
|
+
|
|
151
|
+
return {
|
|
152
|
+
id: toolcall.toolId,
|
|
153
|
+
type: BUILDER_TYPES.UPDATE_FOOTER as BuilderType,
|
|
154
|
+
payload: arg,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
case AI_ASSISTANT_TOOL_NAMES.UPDATE_GLOBAL_STYLES: {
|
|
159
|
+
const arg =
|
|
160
|
+
toolcall.arguments as unknown as UpdateGlobalStylesArguments;
|
|
161
|
+
|
|
162
|
+
return {
|
|
163
|
+
id: toolcall.toolId,
|
|
164
|
+
type: BUILDER_TYPES.UPDATE_GLOBAL_STYLES as BuilderType,
|
|
165
|
+
payload: arg,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
case AI_ASSISTANT_TOOL_NAMES.UPDATE_HEADER: {
|
|
170
|
+
const arg = toolcall.arguments as unknown as UpdateHeaderArguments;
|
|
171
|
+
|
|
172
|
+
return {
|
|
173
|
+
id: toolcall.toolId,
|
|
174
|
+
type: BUILDER_TYPES.UPDATE_HEADER as BuilderType,
|
|
175
|
+
payload: arg,
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
case AI_ASSISTANT_TOOL_NAMES.UNDO: {
|
|
180
|
+
// The undo tool has no wire arguments — the builder resolves the
|
|
181
|
+
// snapshot by invoking the caller-supplied undoHandler at execute
|
|
182
|
+
// time. If the caller didn't supply one, substitute a null-returning
|
|
183
|
+
// handler so the builder surfaces a clear "nothing to restore"
|
|
184
|
+
// error rather than a vaguer validation failure.
|
|
185
|
+
return {
|
|
186
|
+
id: toolcall.toolId,
|
|
187
|
+
type: BUILDER_TYPES.UNDO_WEBSITE as BuilderType,
|
|
188
|
+
payload: {
|
|
189
|
+
undoHandler: options.undoHandler ?? (() => null),
|
|
190
|
+
},
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
|
|
108
194
|
default: {
|
|
109
195
|
const sectionTool = SECTION_TOOL_MAP[toolcall.function];
|
|
110
196
|
|
|
@@ -120,6 +206,7 @@ export const executeToolCallsAsync = async (
|
|
|
120
206
|
mode,
|
|
121
207
|
content_id: contentId,
|
|
122
208
|
page_id: pageId,
|
|
209
|
+
move_before_content_id: moveBeforeContentId,
|
|
123
210
|
arguments: sectionArgs,
|
|
124
211
|
} = toolcall.arguments as unknown as SectionToolCallShape;
|
|
125
212
|
|
|
@@ -134,6 +221,7 @@ export const executeToolCallsAsync = async (
|
|
|
134
221
|
contentId: contentId as string,
|
|
135
222
|
arguments: sectionArgs,
|
|
136
223
|
pageId: pageId as string,
|
|
224
|
+
moveBeforeContentId: moveBeforeContentId,
|
|
137
225
|
},
|
|
138
226
|
};
|
|
139
227
|
}
|
|
@@ -145,5 +233,10 @@ export const executeToolCallsAsync = async (
|
|
|
145
233
|
|
|
146
234
|
const executor = new MetadataExecutor();
|
|
147
235
|
|
|
148
|
-
return await executor.executeAsync(
|
|
236
|
+
return await executor.executeAsync(
|
|
237
|
+
metadata,
|
|
238
|
+
requests,
|
|
239
|
+
options.logger,
|
|
240
|
+
options.eventTracker,
|
|
241
|
+
);
|
|
149
242
|
};
|
|
@@ -6,11 +6,12 @@ import {
|
|
|
6
6
|
type MetadataBuilderRequest,
|
|
7
7
|
} from '../models';
|
|
8
8
|
import type { Logger } from '../logger';
|
|
9
|
+
import {
|
|
10
|
+
ADD_PAGE_CHECKS,
|
|
11
|
+
type AddPagePayload,
|
|
12
|
+
} from './section-rules/add-page.rules';
|
|
9
13
|
|
|
10
|
-
export
|
|
11
|
-
pageId: string;
|
|
12
|
-
pageName: string;
|
|
13
|
-
}
|
|
14
|
+
export type { AddPagePayload };
|
|
14
15
|
|
|
15
16
|
export class AddPageBuilder extends BaseMetadataBuilder<AddPagePayload> {
|
|
16
17
|
constructor(
|
|
@@ -21,16 +22,11 @@ export class AddPageBuilder extends BaseMetadataBuilder<AddPagePayload> {
|
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
async validateAsync(): Promise<{ errors: string[] }> {
|
|
24
|
-
const errors
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
if (!payload?.pageId) {
|
|
28
|
-
errors.push('page_id is required for add_page');
|
|
29
|
-
}
|
|
25
|
+
const errors = ADD_PAGE_CHECKS.flatMap((check) => {
|
|
26
|
+
const err = check(this.request.payload);
|
|
30
27
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
28
|
+
return err ? [err] : [];
|
|
29
|
+
});
|
|
34
30
|
|
|
35
31
|
return { errors };
|
|
36
32
|
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import type { BrandPageModel } from '../../brand-page/models';
|
|
3
|
+
import type { TextStyleOptions } from '../../brand-page/models/styles.model';
|
|
4
|
+
import type { UpdateFooterArguments } from '../parsers/ai-toolcall-parser';
|
|
5
|
+
import { BUILDER_TYPES } from '../models';
|
|
6
|
+
import { FooterBuilder } from './footer-builder';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* BP-5420: changing the footer copyright font had no effect when a global text
|
|
10
|
+
* style was applied. New footers default `copyrightStyle.textStyleType` to
|
|
11
|
+
* `paragraphs`, so the renderer (`getCopyrightTextStyle`) replaced the whole
|
|
12
|
+
* style with the global preset and discarded the font the builder wrote.
|
|
13
|
+
*
|
|
14
|
+
* The fix routes copyright style writes through `applyDetachedStyleOverride`,
|
|
15
|
+
* which resolves the preset in and clears `textStyleType` so the per-element
|
|
16
|
+
* override sticks.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const textStyleOptions = {
|
|
20
|
+
titles: { type: 'titles', title: 'Titles', style: { fontFamily: 'Poppins' } },
|
|
21
|
+
headings: {
|
|
22
|
+
type: 'headings',
|
|
23
|
+
title: 'Headings',
|
|
24
|
+
style: { fontFamily: 'Poppins' },
|
|
25
|
+
},
|
|
26
|
+
paragraphs: {
|
|
27
|
+
type: 'paragraphs',
|
|
28
|
+
title: 'Paragraphs',
|
|
29
|
+
style: { fontFamily: 'Inter', fontSize: '1em', color: '#2d0b3f' },
|
|
30
|
+
},
|
|
31
|
+
buttons: {
|
|
32
|
+
type: 'buttons',
|
|
33
|
+
title: 'Buttons',
|
|
34
|
+
style: { fontFamily: 'Poppins' },
|
|
35
|
+
},
|
|
36
|
+
} as unknown as TextStyleOptions;
|
|
37
|
+
|
|
38
|
+
const makeModel = (copyrightStyle: Record<string, unknown>): BrandPageModel =>
|
|
39
|
+
({
|
|
40
|
+
styles: { textStyles: { textStyleOptions } },
|
|
41
|
+
pageFooterDesktop: { copyrightStyle: { ...copyrightStyle } },
|
|
42
|
+
pageFooterMobile: { copyrightStyle: { ...copyrightStyle } },
|
|
43
|
+
}) as unknown as BrandPageModel;
|
|
44
|
+
|
|
45
|
+
const run = (args: UpdateFooterArguments, model: BrandPageModel) =>
|
|
46
|
+
new FooterBuilder({
|
|
47
|
+
id: 'f1',
|
|
48
|
+
type: BUILDER_TYPES.UPDATE_FOOTER,
|
|
49
|
+
payload: args,
|
|
50
|
+
}).buildAsync(model);
|
|
51
|
+
|
|
52
|
+
describe('FooterBuilder — copyright font vs global style', () => {
|
|
53
|
+
it('detaches from the global preset: applies the font, clears textStyleType, retains preset values', async () => {
|
|
54
|
+
const model = makeModel({
|
|
55
|
+
textStyleType: 'paragraphs',
|
|
56
|
+
textAlign: 'center',
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const { model: out } = await run(
|
|
60
|
+
{ copyright_text_font_family: 'Anton' },
|
|
61
|
+
model,
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
const style = out.pageFooterDesktop!.copyrightStyle as Record<
|
|
65
|
+
string,
|
|
66
|
+
unknown
|
|
67
|
+
>;
|
|
68
|
+
|
|
69
|
+
expect(style.fontFamily).toBe('Anton');
|
|
70
|
+
expect(style.textStyleType).toBeUndefined();
|
|
71
|
+
// unchanged preset properties are retained, not reset to defaults
|
|
72
|
+
expect(style.fontSize).toBe('1em');
|
|
73
|
+
expect(style.color).toBe('#2d0b3f');
|
|
74
|
+
expect(style.textAlign).toBe('center');
|
|
75
|
+
});
|
|
76
|
+
});
|