@designcrowd/library.brand-page 5.18.3 → 5.18.4-ast-ai-tab-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/lib/src/{CreatedOnBrandCrowd-de-de-CkuAAwKQ.js → CreatedOnBrandCrowd-de-de-CV6k3V69.js} +1 -1
  2. package/lib/src/{CreatedOnBrandCrowd-en-us-Coln5kSU.js → CreatedOnBrandCrowd-en-us-DEA_Ztd6.js} +1 -1
  3. package/lib/src/{CreatedOnBrandCrowd-es-es-raGyXChm.js → CreatedOnBrandCrowd-es-es-WZxoi95g.js} +1 -1
  4. package/lib/src/{CreatedOnBrandCrowd-fr-fr-BT_WYYxW.js → CreatedOnBrandCrowd-fr-ca-BCK-Vc76.js} +1 -1
  5. package/lib/src/{CreatedOnBrandCrowd-fr-ca-BT_WYYxW.js → CreatedOnBrandCrowd-fr-fr-BCK-Vc76.js} +1 -1
  6. package/lib/src/{CreatedOnBrandCrowd-pt-pt-BRbD_kiI.js → CreatedOnBrandCrowd-pt-br-4T1moa-7.js} +1 -1
  7. package/lib/src/{CreatedOnBrandCrowd-pt-br-BRbD_kiI.js → CreatedOnBrandCrowd-pt-pt-4T1moa-7.js} +1 -1
  8. package/lib/src/{CreatedOnDcom-de-de-DetCIFxa.js → CreatedOnDcom-de-de-B4r4wmi3.js} +1 -1
  9. package/lib/src/{CreatedOnDcom-en-us-D0LeF_V2.js → CreatedOnDcom-en-us-CK3bt1WC.js} +1 -1
  10. package/lib/src/{CreatedOnDcom-es-es-CHa4stWS.js → CreatedOnDcom-es-es-pujNCmOB.js} +1 -1
  11. package/lib/src/{CreatedOnDcom-fr-ca-ntW7A335.js → CreatedOnDcom-fr-ca-Ch5a9cLg.js} +1 -1
  12. package/lib/src/{CreatedOnDcom-fr-fr-C6rQcclc.js → CreatedOnDcom-fr-fr-CsM_6d0N.js} +1 -1
  13. package/lib/src/{CreatedOnDcom-pt-br-Cn07ZK_m.js → CreatedOnDcom-pt-br-VASGTLyG.js} +1 -1
  14. package/lib/src/{CreatedOnDcom-pt-pt-CewmqYVY.js → CreatedOnDcom-pt-pt-BWnMajwo.js} +1 -1
  15. package/lib/src/brand-page/models/index.d.ts +1 -0
  16. package/lib/src/brand-page/models/index.js +4 -0
  17. package/lib/src/brand-page/models/navigation-styles.model.d.ts +7 -0
  18. package/lib/src/brand-page/models/navigation-styles.model.js +25 -2
  19. package/lib/src/brand-page/utils/migration/migration-16.d.ts +2 -0
  20. package/lib/src/brand-page/utils/migration/migration-16.js +47 -0
  21. package/lib/src/brand-page/utils/migration.util.js +7 -0
  22. package/lib/src/brand-page/utils/personalisation.util.js +76 -14
  23. package/lib/src/brand-page-maker/components/action-bar/ActionBar.mixin.d.ts +1 -1
  24. package/lib/src/brand-page-maker/components/admin-background-settings/AdminBackgroundSettings.mixin.d.ts +6 -0
  25. package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.d.ts +12 -1
  26. package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.js +2 -0
  27. package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.stories.js +1 -0
  28. package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMakerTemplateSettings.mixin.d.ts +1 -1
  29. package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.d.ts +1 -1
  30. package/lib/src/brand-page-maker/components/brandpage-settings/ReplaceImageSettingsForBrandPageSettings.mixin.d.ts +1 -1
  31. package/lib/src/brand-page-maker/components/seo-settings/SeoPageSettings.mixin.d.ts +1 -1
  32. package/lib/src/brand-page-maker/components/seo-settings/UrlSettings.mixin.d.ts +1 -1
  33. package/lib/src/brand-page-maker/components/social-share/SocialShare.mixin.d.ts +1 -1
  34. package/lib/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.d.ts +2 -3
  35. package/lib/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.js +16 -4
  36. package/lib/src/brand-page-maker/stores/ai-checkpoint/ai-checkpoint-store.d.ts +6 -0
  37. package/lib/src/brand-page-maker/stores/brandpage-container/brand-page-container-store.d.ts +1 -0
  38. package/lib/src/brand-page-maker/stores/brandpage-container/brand-page-container-store.js +3 -0
  39. package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.d.ts +3 -1
  40. package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.js +6 -10
  41. package/lib/src/brand-page-maker/stores/ui/ui-store.d.ts +6 -0
  42. package/lib/src/brand-page-maker/stores/ui/ui-store.js +8 -0
  43. package/lib/src/clients/design-template-client.d.ts +3 -0
  44. package/lib/src/clients/models.d.ts +2 -0
  45. package/lib/src/css/library.brand-page-brandCrowd.min.css +46 -35
  46. package/lib/src/css/library.brand-page-brandPage.min.css +46 -35
  47. package/lib/src/css/library.brand-page-designCom.min.css +46 -35
  48. package/lib/src/css/library.brand-page-preview.min.css +46 -35
  49. package/lib/src/index.mjs +62 -60
  50. package/lib/src/{lib-CGfmcIBb.js → lib-D8jC8i6U.js} +17839 -17708
  51. package/lib/src/shared/content-settings/components/content-settings/ContentSettings.mixin.d.ts +1 -1
  52. package/lib/src/shared/content-settings/components/content-settings/ReplaceImageSettingsForContent.mixin.d.ts +1 -1
  53. package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.d.ts +7 -1
  54. package/lib/src/shared/logo-settings/components/EditLogoSettings.mixin.d.ts +9 -0
  55. package/lib/src/shared/logo-settings/components/LogoSettings.mixin.d.ts +1 -1
  56. package/lib/src/shared/logo-versions/LogoVersions.mixin.d.ts +6 -0
  57. package/lib/src/shared/models.d.ts +2 -0
  58. package/lib/src/shared/my-designs/MyDesigns.mixin.d.ts +6 -0
  59. package/lib/src/shared/my-uploads/MyMedia.mixin.d.ts +6 -0
  60. package/lib/src/shared/my-uploads/MyUploads.mixin.d.ts +6 -0
  61. package/lib/src/shared/navigation-style-settings/components/navigation-style-settings/NavigationStyleSettings.mixin.js +10 -8
  62. package/lib/src/shared/navigation-style-settings/store/index.js +1 -12
  63. package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.d.ts +7 -1
  64. package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.d.ts +7 -1
  65. package/lib/src/shared/publish-brand-page-with-state/PublishBrandPageModalWithState.mixin.d.ts +1 -1
  66. package/lib/src/shared/style-settings/components/StyleSettings.mixin.d.ts +7 -1
  67. package/lib/src/shared/template-settings/components/TemplatesSettings.mixin.d.ts +10 -439
  68. package/lib/src/shared/template-settings/components/TemplatesSettings.mixin.js +2 -2
  69. package/lib/src/shared/template-settings/store/template-settings-store.d.ts +4 -0
  70. package/lib/src/shared/template-settings/store/template-settings-store.js +84 -11
  71. package/lib/src/shared/unsplash-library/UnsplashLibrary.mixin.d.ts +6 -0
  72. package/package.json +1 -1
  73. package/src/brand-page/components/navigation/navigation-side-menu/NavigationSideMenu.vue +4 -1
  74. package/src/brand-page/models/index.ts +5 -0
  75. package/src/brand-page/models/navigation-styles.model.ts +39 -1
  76. package/src/brand-page/utils/__snapshots__/migration.util.test.ts.snap +6 -3
  77. package/src/brand-page/utils/__snapshots__/migration2.util.test.ts.snap +1 -0
  78. package/src/brand-page/utils/__snapshots__/model.util.test.ts.snap +2 -0
  79. package/src/brand-page/utils/migration/migration-16.test.ts +319 -0
  80. package/src/brand-page/utils/migration/migration-16.ts +75 -0
  81. package/src/brand-page/utils/migration.util.ts +8 -0
  82. package/src/brand-page/utils/personalisation.util.test.ts +35 -0
  83. package/src/brand-page/utils/personalisation.util.ts +123 -23
  84. package/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.ts +4 -0
  85. package/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.stories.ts +1 -0
  86. package/src/brand-page-maker/components/color-palette/BpColorPalette.vue +9 -7
  87. package/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.ts +22 -7
  88. package/src/brand-page-maker/components/template-preview/TemplatePreview.vue +5 -10
  89. package/src/brand-page-maker/components/template-preview/TemplatePreviewAiBadge.vue +12 -0
  90. package/src/brand-page-maker/stores/brandpage-container/brand-page-container-store.ts +5 -0
  91. package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.test.ts +43 -0
  92. package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.ts +10 -14
  93. package/src/brand-page-maker/stores/ui/ui-store.ts +16 -0
  94. package/src/clients/design-template-client.ts +3 -0
  95. package/src/clients/models.ts +2 -0
  96. package/src/shared/content-settings/components/color-field/ColorField.vue +10 -5
  97. package/src/shared/models.ts +6 -0
  98. package/src/shared/navigation-style-settings/components/navigation-style-settings/NavigationStyleSettings.mixin.ts +17 -11
  99. package/src/shared/navigation-style-settings/components/navigation-style-settings/NavigationStyleSettings.vue +4 -1
  100. package/src/shared/navigation-style-settings/store/index.ts +1 -21
  101. package/src/shared/template-settings/components/TemplatesSettings.mixin.ts +2 -2
  102. package/src/shared/template-settings/store/template-settings-store.ts +110 -18
@@ -1,5 +1,5 @@
1
1
  import { openBlock as e, createElementBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-CGfmcIBb.js";
2
+ import { _ as t } from "./lib-D8jC8i6U.js";
3
3
  const i = {}, h = {
4
4
  width: "275",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { openBlock as e, createElementBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-CGfmcIBb.js";
2
+ import { _ as t } from "./lib-D8jC8i6U.js";
3
3
  const i = {}, h = {
4
4
  width: "251",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { openBlock as e, createElementBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-CGfmcIBb.js";
2
+ import { _ as t } from "./lib-D8jC8i6U.js";
3
3
  const i = {}, h = {
4
4
  width: "250",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { openBlock as e, createElementBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-CGfmcIBb.js";
2
+ import { _ as t } from "./lib-D8jC8i6U.js";
3
3
  const i = {}, h = {
4
4
  width: "237",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { openBlock as e, createElementBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-CGfmcIBb.js";
2
+ import { _ as t } from "./lib-D8jC8i6U.js";
3
3
  const i = {}, h = {
4
4
  width: "237",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { openBlock as e, createElementBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-CGfmcIBb.js";
2
+ import { _ as t } from "./lib-D8jC8i6U.js";
3
3
  const i = {}, h = {
4
4
  width: "263",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { openBlock as e, createElementBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-CGfmcIBb.js";
2
+ import { _ as t } from "./lib-D8jC8i6U.js";
3
3
  const i = {}, h = {
4
4
  width: "263",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { openBlock as H, createElementBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as e } from "./lib-CGfmcIBb.js";
2
+ import { _ as e } from "./lib-D8jC8i6U.js";
3
3
  const M = {}, Z = {
4
4
  width: "242",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { openBlock as H, createElementBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as e } from "./lib-CGfmcIBb.js";
2
+ import { _ as e } from "./lib-D8jC8i6U.js";
3
3
  const i = {}, M = {
4
4
  width: "231",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { openBlock as H, createElementBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as e } from "./lib-CGfmcIBb.js";
2
+ import { _ as e } from "./lib-D8jC8i6U.js";
3
3
  const M = {}, Z = {
4
4
  width: "230",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { openBlock as H, createElementBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as e } from "./lib-CGfmcIBb.js";
2
+ import { _ as e } from "./lib-D8jC8i6U.js";
3
3
  const i = {}, l = {
4
4
  width: "216",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { openBlock as H, createElementBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as e } from "./lib-CGfmcIBb.js";
2
+ import { _ as e } from "./lib-D8jC8i6U.js";
3
3
  const i = {}, l = {
4
4
  width: "216",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { openBlock as H, createElementBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as M } from "./lib-CGfmcIBb.js";
2
+ import { _ as M } from "./lib-D8jC8i6U.js";
3
3
  const Z = {}, e = {
4
4
  width: "232",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { openBlock as H, createElementBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as M } from "./lib-CGfmcIBb.js";
2
+ import { _ as M } from "./lib-D8jC8i6U.js";
3
3
  const Z = {}, e = {
4
4
  width: "232",
5
5
  height: "36",
@@ -547,6 +547,7 @@ export interface SaveContactOptions {
547
547
  }
548
548
  export declare class BrandPageModel {
549
549
  v: number;
550
+ userPromptContentKey?: string;
550
551
  styles: PageStyles;
551
552
  /** @deprecated */
552
553
  headerStyles?: AbstractPageHeaderStyles;
@@ -400,6 +400,10 @@ export class PageFooterMobile extends AbstractPageFooterStyles {
400
400
  export class BrandPageModel {
401
401
  // Model version
402
402
  v;
403
+ // Pre-purchase AI personalisation content key, persisted with the draft so the
404
+ // personalised AI template previews survive login / checkout-back / refresh - the
405
+ // content is retrieved by this token (user-agnostic), not regenerated (bp-5742).
406
+ userPromptContentKey;
403
407
  styles;
404
408
  /** @deprecated */
405
409
  headerStyles;
@@ -8,6 +8,13 @@ export declare class NavigationMenuStyles {
8
8
  subNavBackgroundColor?: string;
9
9
  constructor(options: Partial<NavigationMenuStyles>, defaultOptions: Partial<NavigationMenuStyles>);
10
10
  }
11
+ export declare const getDefaultSubNavBackgroundColor: (defaultTextColor: string | undefined) => string | undefined;
12
+ /**
13
+ * The hamburger sub nav background colour is auto color-matched only when the
14
+ * user has not deliberately set it - i.e. it has no value or is transparent.
15
+ * Any explicit colour (a hex) or an already color-matched key is preserved.
16
+ */
17
+ export declare const isUnsetOrTransparentColor: (color: string | undefined | null) => boolean;
11
18
  type NavigationStylesOptionType = Partial<Omit<NavigationDesktop | NavigationMobile, 'hamburgerMenuStyle'>> & {
12
19
  hamburgerMenuStyle?: Partial<NavigationMenuStyles>;
13
20
  };
@@ -1,4 +1,4 @@
1
- import { DEFAULT_FONT_FAMILY_KEY, DEFAULT_FONT_STYLE, DEFAULT_TEXT_ALIGN, DEFAULT_TEXT_DECORATION, FONT_FAMILY_CONFIGS, FONT_SIZE_BODY, FONT_WEIGHT_NORMAL, defaultHamburgerNavigation, NAVIGATION_DISPLAY, } from '../constants';
1
+ import { DEFAULT_FONT_FAMILY_KEY, DEFAULT_FONT_STYLE, DEFAULT_TEXT_ALIGN, DEFAULT_TEXT_DECORATION, FONT_FAMILY_CONFIGS, FONT_SIZE_BODY, FONT_WEIGHT_NORMAL, STYLE_THEME_KEYS, defaultHamburgerNavigation, NAVIGATION_DISPLAY, } from '../constants';
2
2
  import { VIEWPORTS } from './index';
3
3
  import { TEXT_STYLE_TYPES } from './index';
4
4
  import cloneDeep from 'lodash.clonedeep';
@@ -15,6 +15,29 @@ export class NavigationMenuStyles {
15
15
  options.subNavBackgroundColor ?? defaultOptions.subNavBackgroundColor;
16
16
  }
17
17
  }
18
+ export const getDefaultSubNavBackgroundColor = (defaultTextColor) => {
19
+ if (defaultTextColor === STYLE_THEME_KEYS.LogoTextColor ||
20
+ defaultTextColor === STYLE_THEME_KEYS.LogoTextMultiColor) {
21
+ return STYLE_THEME_KEYS.LogoBackgroundColor;
22
+ }
23
+ if (defaultTextColor === STYLE_THEME_KEYS.LogoBackgroundColor ||
24
+ defaultTextColor === STYLE_THEME_KEYS.LogoBackgroundMultiColor) {
25
+ return STYLE_THEME_KEYS.LogoTextColor;
26
+ }
27
+ return undefined;
28
+ };
29
+ /**
30
+ * The hamburger sub nav background colour is auto color-matched only when the
31
+ * user has not deliberately set it - i.e. it has no value or is transparent.
32
+ * Any explicit colour (a hex) or an already color-matched key is preserved.
33
+ */
34
+ export const isUnsetOrTransparentColor = (color) => {
35
+ if (color == null) {
36
+ return true;
37
+ }
38
+ const normalised = color.trim().toLowerCase();
39
+ return normalised === '' || normalised === 'transparent';
40
+ };
18
41
  class NavigationStyles {
19
42
  displayType;
20
43
  renderAfterLogo;
@@ -79,7 +102,7 @@ class NavigationStyles {
79
102
  color: theme?.secondaryColor,
80
103
  backgroundColor: theme?.primaryColor,
81
104
  },
82
- subNavBackgroundColor: theme?.secondaryColor,
105
+ // No sub nav default: a hex here defeats migration-16's colour match.
83
106
  });
84
107
  }
85
108
  }
@@ -0,0 +1,2 @@
1
+ import type { MigrationData, MigrationOptions } from '../migration.util';
2
+ export declare const migration16: (migrationResult: MigrationData, options: MigrationOptions) => Promise<MigrationData>;
@@ -0,0 +1,47 @@
1
+ import { getDefaultSubNavBackgroundColor, isUnsetOrTransparentColor, } from '../../models';
2
+ /**
3
+ * Migration 16: default the sub nav background colour to "colour matched" (the opposite
4
+ * logo colour) when the menu font is itself colour matched and the sub nav has no
5
+ * deliberate value. The default is applied ONCE, when content is first materialised — a
6
+ * template load, the create-draft flow, or the admin maker (isUserDraft === false). An
7
+ * existing user draft already carries its resolved value (including a deliberate
8
+ * transparent/explicit choice), so it is left untouched.
9
+ */
10
+ // Hamburger keeps its styles on hamburgerMenuStyle; every other nav type uses the
11
+ // top-level navigation styles. (This only locates the styles - the rule itself is uniform.)
12
+ const isHamburger = (displayType) => displayType.includes('hamburger');
13
+ const applyDefaultSubNavColorMatch = (navigation) => {
14
+ if (!navigation?.displayType) {
15
+ return;
16
+ }
17
+ let menuStyles;
18
+ if (isHamburger(navigation.displayType)) {
19
+ navigation.hamburgerMenuStyle =
20
+ navigation.hamburgerMenuStyle ?? {};
21
+ menuStyles = navigation.hamburgerMenuStyle;
22
+ }
23
+ else {
24
+ menuStyles = navigation;
25
+ }
26
+ // Leave a deliberately-set colour (an explicit hex or an already colour-matched key).
27
+ if (!isUnsetOrTransparentColor(menuStyles.subNavBackgroundColor)) {
28
+ return;
29
+ }
30
+ // Only when the menu font is itself colour matched: take the opposite logo colour
31
+ // (the helper returns undefined when the font is not colour matched).
32
+ const colorMatchedSubNav = getDefaultSubNavBackgroundColor(menuStyles.defaultButtonStyle?.color);
33
+ if (colorMatchedSubNav) {
34
+ menuStyles.subNavBackgroundColor = colorMatchedSubNav;
35
+ }
36
+ };
37
+ export const migration16 = async (migrationResult, options) => {
38
+ // Skip user drafts (isUserDraft === true) — they already have their value. Only
39
+ // templates (isUserDraft === false) get the sub nav default.
40
+ if (options.isUserDraft) {
41
+ return migrationResult;
42
+ }
43
+ const { brandPageModel } = migrationResult;
44
+ applyDefaultSubNavColorMatch(brandPageModel.pageHeaderDesktop?.navigation);
45
+ applyDefaultSubNavColorMatch(brandPageModel.pageHeaderMobile?.navigation);
46
+ return migrationResult;
47
+ };
@@ -18,6 +18,7 @@ import { migration12_1 } from './migration/migration-12_1';
18
18
  import { migration13 } from './migration/migration-13';
19
19
  import { migration14 } from './migration/migration-14';
20
20
  import { migration15 } from './migration/migration-15';
21
+ import { migration16 } from './migration/migration-16';
21
22
  const MIGRATION_TABLE = [
22
23
  {
23
24
  version: 1,
@@ -115,6 +116,12 @@ const MIGRATION_TABLE = [
115
116
  migrateFn: migration15,
116
117
  description: 'Adding default mediaOverlayStyle to background styles',
117
118
  },
119
+ {
120
+ version: 16,
121
+ migrateFn: migration16,
122
+ runAlways: true,
123
+ description: 'Default sub nav background color to color match on for TAB_2 and hamburger navs depending on font color only on first load flow',
124
+ },
118
125
  ];
119
126
  export const GetLatestModelVersion = () => Math.max(...MIGRATION_TABLE.map((x) => x.version));
120
127
  export const migrateBrandPageModel = async (brandPageModel, options) => {
@@ -206,15 +206,61 @@ const getPersonalisationValueAsync = async (section, property) => {
206
206
  }
207
207
  return { value: propertyValue, section };
208
208
  };
209
+ // The userPrompt AI content generation only populates these content-bearing sections
210
+ // (see GenerateAiDesignMakerContentService / GenerateWebsiteContentService - About,
211
+ // Information, Profile, Media). Sections like email/website/phone are never generated, so
212
+ // blocks whose role points at an ungenerated section fall back to this pool.
213
+ const PERSONALISATION_FALLBACK_ROLES = [
214
+ 'profile',
215
+ 'about',
216
+ 'information',
217
+ 'media',
218
+ ];
219
+ // A section is "effectively empty" when it carries no renderable content. The userPrompt
220
+ // AI content leaves ungenerated sections (e.g. email/website/phone) as empty objects (null
221
+ // sections are normalised to `{ ...indices }` upstream), and those are what we fall back
222
+ // from. A section that has data but lacks one specific property (e.g. no items, or an
223
+ // invalid shape) is NOT empty - those intentionally keep the original content.
224
+ const isSectionEffectivelyEmpty = (section) => {
225
+ if (!section) {
226
+ return true;
227
+ }
228
+ return (!section.title &&
229
+ !section.name &&
230
+ !section.url &&
231
+ !section.description &&
232
+ !section.descriptionShort &&
233
+ !section.ctaTitle &&
234
+ !section.imageUrls?.length &&
235
+ !section.shapes?.length &&
236
+ !section.items?.length &&
237
+ !section.mainShapesCollection?.tall?.length &&
238
+ !section.mainShapesCollection?.square?.length &&
239
+ !section.mainShapesCollection?.wide?.length);
240
+ };
241
+ // Resolve a property from a specific role's section. Returns null when that section is
242
+ // ungenerated (effectively empty) or cannot supply the property, so the caller can try the
243
+ // next role.
244
+ const resolvePersonalisationValueForRoleAsync = async (role, property, personalisation) => {
245
+ const key = `${role}Section`;
246
+ const section = personalisation[key];
247
+ if (isSectionEffectivelyEmpty(section)) {
248
+ return null;
249
+ }
250
+ const { value, section: updatedSection, valuesToUpdate, } = await getPersonalisationValueAsync(section, property);
251
+ if (value === undefined || value === null) {
252
+ return null;
253
+ }
254
+ return {
255
+ value,
256
+ personalisation: { ...personalisation, [key]: updatedSection },
257
+ valuesToUpdate,
258
+ };
259
+ };
209
260
  const getPersonalisationValueFromPropertyAsync = async (propertyKey, propertyValue, personalisationRole, personalisationOverride, personalisation, contentType) => {
210
261
  if (!personalisationRole || personalisationOverride === 'none') {
211
262
  return { value: undefined, personalisation };
212
263
  }
213
- const matchingValue = Object.entries(personalisation).find(([key]) => key === `${personalisationRole}Section`);
214
- if (!matchingValue) {
215
- return { value: undefined, personalisation };
216
- }
217
- const section = matchingValue[1];
218
264
  const mapping = getPersonalisationMappingForContentType(contentType);
219
265
  const matchingProperty = Object.entries(mapping).find(([, value]) => value.includes(propertyKey));
220
266
  if (!matchingProperty) {
@@ -225,15 +271,31 @@ const getPersonalisationValueFromPropertyAsync = async (propertyKey, propertyVal
225
271
  brandPageType: personalisation.type,
226
272
  isSvgShape: typeof propertyValue === 'string' && propertyValue.endsWith('.svg'),
227
273
  });
228
- const { value, section: updatedSection, valuesToUpdate, } = await getPersonalisationValueAsync(section, property);
229
- return {
230
- value,
231
- personalisation: {
232
- ...personalisation,
233
- [`${personalisationRole}Section`]: updatedSection,
234
- },
235
- valuesToUpdate,
236
- };
274
+ const primaryKey = `${personalisationRole}Section`;
275
+ const primarySection = personalisation[primaryKey];
276
+ // When the block's own section has content, use it as-is - this preserves existing
277
+ // behaviour, including legitimately keeping the original when that section lacks a
278
+ // specific property (e.g. no items, or an invalid shape).
279
+ if (!isSectionEffectivelyEmpty(primarySection)) {
280
+ const { value, section: updatedSection, valuesToUpdate, } = await getPersonalisationValueAsync(primarySection, property);
281
+ return {
282
+ value,
283
+ personalisation: { ...personalisation, [primaryKey]: updatedSection },
284
+ valuesToUpdate,
285
+ };
286
+ }
287
+ // The block's section was never generated (e.g. email/website/phone in the userPrompt
288
+ // content). Fall back to the first populated content section that can supply this
289
+ // property, so the block doesn't render the designer's "should be AI generated"
290
+ // placeholder. When the section exists (handled above) or every section is populated
291
+ // (e.g. the AI Website Builder), this fallback is never reached.
292
+ for (const role of PERSONALISATION_FALLBACK_ROLES) {
293
+ const resolved = await resolvePersonalisationValueForRoleAsync(role, property, personalisation);
294
+ if (resolved) {
295
+ return resolved;
296
+ }
297
+ }
298
+ return { value: undefined, personalisation };
237
299
  };
238
300
  const applyPersonalisationToBrandPageContentsRecursiveAsync = async (personalisation, mappingType, content, personalisationRole) => {
239
301
  let isApplied = false;
@@ -122,7 +122,7 @@ declare const _default: import("vue").DefineComponent<{}, {
122
122
  brandPageType: "default" | "brandSite" | "brandContact";
123
123
  }): void;
124
124
  initialiseStoresByBrandPageModelAsync(brandPageModel: import("@brand-page/models").BrandPageModel): Promise<void>;
125
- initialise({ brandPage, brandPageType, logoDraftDesignAttributes, unsplashApplicationName, templateCategories, personalisationData, isPersonalisationEnabled, businessName, industry, layout, logoVariationImageUrls, shopConfigData, isServerRenderOverride, }: import("@brand-page-maker/stores").InitialisePayload): Promise<void>;
125
+ initialise({ brandPage, brandPageType, logoDraftDesignAttributes, unsplashApplicationName, templateCategories, personalisationData, isPersonalisationEnabled, userPromptContentKey, showAiTemplatesTab, businessName, industry, layout, logoVariationImageUrls, shopConfigData, isServerRenderOverride, }: import("@brand-page-maker/stores").InitialisePayload): Promise<void>;
126
126
  initialisePages({ pages, sections, }: {
127
127
  pages: import("@brand-page/models").PageModel[];
128
128
  sections: import("../../../shared/page-settings/store").PageSettingsStateSections;
@@ -251,6 +251,12 @@ declare const _default: import("vue").DefineComponent<{}, {
251
251
  setUserPersonalisationData({ personalisationData, }: {
252
252
  personalisationData: import("../../../brand-page").UserPersonalisationContent[];
253
253
  }): void;
254
+ setUserPromptContentKey({ userPromptContentKey, }: {
255
+ userPromptContentKey: string | undefined;
256
+ }): void;
257
+ setShowAiTemplatesTab({ showAiTemplatesTab, }: {
258
+ showAiTemplatesTab: boolean;
259
+ }): void;
254
260
  onBackgroundChanged(): void;
255
261
  onContentChanged(): void;
256
262
  onStyleChanged(): void;
@@ -20,6 +20,8 @@ export interface BrandPageMakerViewModel {
20
20
  initialCategories: InitialCategories;
21
21
  personalisation?: UserPersonalisationContent[];
22
22
  isPersonalisationEnabled?: boolean;
23
+ userPromptContentKey?: string;
24
+ showAiTemplatesTab?: boolean;
23
25
  brandPageType?: BrandPageType;
24
26
  businessName?: string;
25
27
  industry?: string;
@@ -167,7 +169,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
167
169
  brandPageType: "default" | "brandSite" | "brandContact";
168
170
  }): void;
169
171
  initialiseStoresByBrandPageModelAsync(brandPageModel: import("@brand-page").BrandPageModel): Promise<void>;
170
- initialise({ brandPage, brandPageType, logoDraftDesignAttributes, unsplashApplicationName, templateCategories, personalisationData, isPersonalisationEnabled, businessName, industry, layout, logoVariationImageUrls, shopConfigData, isServerRenderOverride, }: import("@brand-page-maker/stores").InitialisePayload): Promise<void>;
172
+ initialise({ brandPage, brandPageType, logoDraftDesignAttributes, unsplashApplicationName, templateCategories, personalisationData, isPersonalisationEnabled, userPromptContentKey, showAiTemplatesTab, businessName, industry, layout, logoVariationImageUrls, shopConfigData, isServerRenderOverride, }: import("@brand-page-maker/stores").InitialisePayload): Promise<void>;
171
173
  initialisePages({ pages, sections, }: {
172
174
  pages: import("@brand-page").PageModel[];
173
175
  sections: import("@shared/page-settings/store").PageSettingsStateSections;
@@ -936,6 +938,12 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
936
938
  setUserPersonalisationData({ personalisationData, }: {
937
939
  personalisationData: UserPersonalisationContent[];
938
940
  }): void;
941
+ setUserPromptContentKey({ userPromptContentKey, }: {
942
+ userPromptContentKey: string | undefined;
943
+ }): void;
944
+ setShowAiTemplatesTab({ showAiTemplatesTab, }: {
945
+ showAiTemplatesTab: boolean;
946
+ }): void;
939
947
  onBackgroundChanged(): void;
940
948
  onContentChanged(): void;
941
949
  onStyleChanged(): void;
@@ -1082,6 +1090,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
1082
1090
  initialSearchTerm: string;
1083
1091
  onSearchTermChanged?: import("@shared/template-settings/store").OnSearchTermChangedCallback | undefined;
1084
1092
  }): void;
1093
+ setAiTemplateKeywords(payload: {
1094
+ aiTemplateKeywords: string;
1095
+ }): void;
1085
1096
  notifySearchTermChanged(searchTerm: string | undefined): void;
1086
1097
  clearTemplates(): void;
1087
1098
  getTemplateByTemplateId(id: string): import("@shared/template-settings/models").TemplateSettingsTemplate | undefined;
@@ -148,6 +148,8 @@ export default defineComponent({
148
148
  templateCategories: this.viewModel.templateCategories,
149
149
  personalisationData: this.viewModel.personalisation,
150
150
  isPersonalisationEnabled: this.viewModel.isPersonalisationEnabled || false,
151
+ userPromptContentKey: this.viewModel.userPromptContentKey,
152
+ showAiTemplatesTab: this.viewModel.showAiTemplatesTab || false,
151
153
  brandPageType: this.viewModel.brandPageType,
152
154
  businessName: this.viewModel.businessName,
153
155
  industry: this.viewModel.industry,
@@ -179,6 +179,7 @@ const InitialiseMakerStores = (options) => {
179
179
  isContextualUpgradeModalVisible: false,
180
180
  gettyVideos: [],
181
181
  templateSearchTerm: undefined,
182
+ aiTemplateKeywords: undefined,
182
183
  });
183
184
  userStore.setUserState({
184
185
  isAdmin: options.isAdmin,
@@ -111,7 +111,7 @@ declare const _default: import("vue").DefineComponent<{}, {
111
111
  brandPageType: "default" | "brandSite" | "brandContact";
112
112
  }): void;
113
113
  initialiseStoresByBrandPageModelAsync(brandPageModel: import("../../../lib").BrandPageModel): Promise<void>;
114
- initialise({ brandPage, brandPageType, logoDraftDesignAttributes, unsplashApplicationName, templateCategories, personalisationData, isPersonalisationEnabled, businessName, industry, layout, logoVariationImageUrls, shopConfigData, isServerRenderOverride, }: import("../../stores").InitialisePayload): Promise<void>;
114
+ initialise({ brandPage, brandPageType, logoDraftDesignAttributes, unsplashApplicationName, templateCategories, personalisationData, isPersonalisationEnabled, userPromptContentKey, showAiTemplatesTab, businessName, industry, layout, logoVariationImageUrls, shopConfigData, isServerRenderOverride, }: import("../../stores").InitialisePayload): Promise<void>;
115
115
  initialisePages({ pages, sections, }: {
116
116
  pages: import("../../../lib").PageModel[];
117
117
  sections: import("../../../shared/page-settings/store").PageSettingsStateSections;
@@ -617,7 +617,7 @@ declare const _default: import("vue").DefineComponent<{}, {
617
617
  brandPageType: "default" | "brandSite" | "brandContact";
618
618
  }): void;
619
619
  initialiseStoresByBrandPageModelAsync(brandPageModel: import("@brand-page").BrandPageModel): Promise<void>;
620
- initialise({ brandPage, brandPageType, logoDraftDesignAttributes, unsplashApplicationName, templateCategories, personalisationData, isPersonalisationEnabled, businessName, industry, layout, logoVariationImageUrls, shopConfigData, isServerRenderOverride, }: import("@brand-page-maker/stores").InitialisePayload): Promise<void>;
620
+ initialise({ brandPage, brandPageType, logoDraftDesignAttributes, unsplashApplicationName, templateCategories, personalisationData, isPersonalisationEnabled, userPromptContentKey, showAiTemplatesTab, businessName, industry, layout, logoVariationImageUrls, shopConfigData, isServerRenderOverride, }: import("@brand-page-maker/stores").InitialisePayload): Promise<void>;
621
621
  initialisePages({ pages, sections, }: {
622
622
  pages: import("@brand-page").PageModel[];
623
623
  sections: import("@shared/page-settings/store").PageSettingsStateSections;
@@ -117,7 +117,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
117
117
  brandPageType: "default" | "brandSite" | "brandContact";
118
118
  }): void;
119
119
  initialiseStoresByBrandPageModelAsync(brandPageModel: import("../../../brand-page").BrandPageModel): Promise<void>;
120
- initialise({ brandPage, brandPageType, logoDraftDesignAttributes, unsplashApplicationName, templateCategories, personalisationData, isPersonalisationEnabled, businessName, industry, layout, logoVariationImageUrls, shopConfigData, isServerRenderOverride, }: import("@brand-page-maker/stores").InitialisePayload): Promise<void>;
120
+ initialise({ brandPage, brandPageType, logoDraftDesignAttributes, unsplashApplicationName, templateCategories, personalisationData, isPersonalisationEnabled, userPromptContentKey, showAiTemplatesTab, businessName, industry, layout, logoVariationImageUrls, shopConfigData, isServerRenderOverride, }: import("@brand-page-maker/stores").InitialisePayload): Promise<void>;
121
121
  initialisePages({ pages, sections, }: {
122
122
  pages: import("../../../brand-page").PageModel[];
123
123
  sections: import("../../../shared/page-settings/store").PageSettingsStateSections;
@@ -395,7 +395,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
395
395
  brandPageType: "default" | "brandSite" | "brandContact";
396
396
  }): void;
397
397
  initialiseStoresByBrandPageModelAsync(brandPageModel: import("../../../brand-page").BrandPageModel): Promise<void>;
398
- initialise({ brandPage, brandPageType, logoDraftDesignAttributes, unsplashApplicationName, templateCategories, personalisationData, isPersonalisationEnabled, businessName, industry, layout, logoVariationImageUrls, shopConfigData, isServerRenderOverride, }: import("@brand-page-maker/stores").InitialisePayload): Promise<void>;
398
+ initialise({ brandPage, brandPageType, logoDraftDesignAttributes, unsplashApplicationName, templateCategories, personalisationData, isPersonalisationEnabled, userPromptContentKey, showAiTemplatesTab, businessName, industry, layout, logoVariationImageUrls, shopConfigData, isServerRenderOverride, }: import("@brand-page-maker/stores").InitialisePayload): Promise<void>;
399
399
  initialisePages({ pages, sections, }: {
400
400
  pages: import("../../../brand-page").PageModel[];
401
401
  sections: import("../../../shared/page-settings/store").PageSettingsStateSections;
@@ -396,7 +396,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
396
396
  brandPageType: "default" | "brandSite" | "brandContact";
397
397
  }): void;
398
398
  initialiseStoresByBrandPageModelAsync(brandPageModel: import("../../../brand-page").BrandPageModel): Promise<void>;
399
- initialise({ brandPage, brandPageType, logoDraftDesignAttributes, unsplashApplicationName, templateCategories, personalisationData, isPersonalisationEnabled, businessName, industry, layout, logoVariationImageUrls, shopConfigData, isServerRenderOverride, }: import("@brand-page-maker/stores").InitialisePayload): Promise<void>;
399
+ initialise({ brandPage, brandPageType, logoDraftDesignAttributes, unsplashApplicationName, templateCategories, personalisationData, isPersonalisationEnabled, userPromptContentKey, showAiTemplatesTab, businessName, industry, layout, logoVariationImageUrls, shopConfigData, isServerRenderOverride, }: import("@brand-page-maker/stores").InitialisePayload): Promise<void>;
400
400
  initialisePages({ pages, sections, }: {
401
401
  pages: import("../../../brand-page").PageModel[];
402
402
  sections: import("../../../shared/page-settings/store").PageSettingsStateSections;
@@ -127,7 +127,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
127
127
  brandPageType: "default" | "brandSite" | "brandContact";
128
128
  }): void;
129
129
  initialiseStoresByBrandPageModelAsync(brandPageModel: import("../../../brand-page").BrandPageModel): Promise<void>;
130
- initialise({ brandPage, brandPageType, logoDraftDesignAttributes, unsplashApplicationName, templateCategories, personalisationData, isPersonalisationEnabled, businessName, industry, layout, logoVariationImageUrls, shopConfigData, isServerRenderOverride, }: import("@brand-page-maker/stores").InitialisePayload): Promise<void>;
130
+ initialise({ brandPage, brandPageType, logoDraftDesignAttributes, unsplashApplicationName, templateCategories, personalisationData, isPersonalisationEnabled, userPromptContentKey, showAiTemplatesTab, businessName, industry, layout, logoVariationImageUrls, shopConfigData, isServerRenderOverride, }: import("@brand-page-maker/stores").InitialisePayload): Promise<void>;
131
131
  initialisePages({ pages, sections, }: {
132
132
  pages: import("../../../brand-page").PageModel[];
133
133
  sections: import("../../../shared/page-settings/store").PageSettingsStateSections;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="types/lodash-shims" />
2
2
  import type { PropType } from 'vue';
3
3
  import type { BrandPageContext, BrandPageViewModel, LogoImageModel, LogoTemplateImageModel, LogoTheme, UserPersonalisation } from '@brand-page';
4
- import { type TemplateSettingsTemplate } from '@shared/template-settings/models';
4
+ import type { TemplateSettingsTemplate } from '@shared/template-settings/models';
5
5
  import type { DebounceHandle } from 'lodash.debounce';
6
6
  interface TemplatePreviewData {
7
7
  containerStyle: BrandPageCssStyle;
@@ -68,7 +68,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
68
68
  isAdmin: import("vue").ComputedRef<boolean>;
69
69
  userToken: import("vue").ComputedRef<string | undefined>;
70
70
  isBrandSite: import("vue").ComputedRef<boolean>;
71
- selectedTab: import("vue").ComputedRef<string>;
72
71
  renderAsImage: import("vue").ComputedRef<boolean>;
73
72
  brandPageMakerUserStore: import("pinia").Store<"brandPageMakerUser", import("@brand-page-maker/stores").UserState, {}, {
74
73
  setUserState(payload: {
@@ -447,7 +446,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
447
446
  brandPageType: "default" | "brandSite" | "brandContact";
448
447
  }): void;
449
448
  initialiseStoresByBrandPageModelAsync(brandPageModel: import("@brand-page").BrandPageModel): Promise<void>;
450
- initialise({ brandPage, brandPageType, logoDraftDesignAttributes, unsplashApplicationName, templateCategories, personalisationData, isPersonalisationEnabled, businessName, industry, layout, logoVariationImageUrls, shopConfigData, isServerRenderOverride, }: import("@brand-page-maker/stores").InitialisePayload): Promise<void>;
449
+ initialise({ brandPage, brandPageType, logoDraftDesignAttributes, unsplashApplicationName, templateCategories, personalisationData, isPersonalisationEnabled, userPromptContentKey, showAiTemplatesTab, businessName, industry, layout, logoVariationImageUrls, shopConfigData, isServerRenderOverride, }: import("@brand-page-maker/stores").InitialisePayload): Promise<void>;
451
450
  initialisePages({ pages, sections, }: {
452
451
  pages: import("@brand-page").PageModel[];
453
452
  sections: import("../../../shared/page-settings/store").PageSettingsStateSections;
@@ -2,7 +2,6 @@ import { computed, defineComponent } from 'vue';
2
2
  import { BRAND_PAGE_TYPES, MEDIA_SIZES, VIEWPORTS } from '@brand-page';
3
3
  import { applyLogoThemeToBrandPageModel, applyUserPersonalisationToBrandPageModelAsync, getBrandPageViewModelFromBrandPageModel, } from '@brand-page/utils';
4
4
  import { STYLE_THEME_KEYS } from '@brand-page/constants';
5
- import { TEMPLATE_TABS, } from '@shared/template-settings/models';
6
5
  import debounce from 'lodash.debounce';
7
6
  import { MOBILE_HEIGHT, MOBILE_WIDTH } from '@brand-page-maker/constants';
8
7
  import { useBrandPageContainerStore, useBrandPageMakerStore, useBrandPageMakerUserStore, } from '@brand-page-maker/stores';
@@ -24,7 +23,6 @@ export default defineComponent({
24
23
  isAdmin: computed(() => brandPageMakerUserStore.isAdmin),
25
24
  userToken: computed(() => brandPageMakerUserStore.userToken),
26
25
  isBrandSite: computed(() => brandPageMakerStore.brandPageType === BRAND_PAGE_TYPES.brandSite),
27
- selectedTab: computed(() => templateSettingsStore.selectedTab.key),
28
26
  renderAsImage: computed(() => templateSettingsStore.renderAsImage),
29
27
  brandPageMakerUserStore,
30
28
  brandPageContainerStore,
@@ -171,9 +169,23 @@ export default defineComponent({
171
169
  if (!previewImageUrl) {
172
170
  return '';
173
171
  }
174
- if (this.selectedTab === TEMPLATE_TABS.AI && this.template.contentKey) {
172
+ // Interleaved AI templates (bp-5742) already have the personalisation key
173
+ // baked into the URL by the backend. Appending our own (hash-derived) key
174
+ // on top produces a second, mismatched key and breaks the preview, so only
175
+ // append when the backend hasn't already personalised the URL.
176
+ const isAlreadyPersonalised = previewImageUrl.includes('contentKey=') ||
177
+ previewImageUrl.includes('userPromptContentKey=');
178
+ if (this.isPersonalisable &&
179
+ this.template.contentKey &&
180
+ !isAlreadyPersonalised) {
175
181
  if (this.userToken) {
176
- previewImageUrl += `&contentKey=${this.template.contentKey}&userToken=${this.userToken}`;
182
+ previewImageUrl += `&contentKey=${this.template.contentKey}`;
183
+ // The backend already bakes userToken into brand-site preview URLs. Only add
184
+ // it when missing - two userToken params parse as an array and the preview
185
+ // renderer rejects it ("userToken must be a string type") (bp-5765).
186
+ if (!previewImageUrl.includes('userToken=')) {
187
+ previewImageUrl += `&userToken=${this.userToken}`;
188
+ }
177
189
  }
178
190
  else {
179
191
  previewImageUrl += `&userPromptContentKey=${this.template.contentKey}`;