@designcrowd/library.brand-page 5.19.1 → 5.19.2

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 (86) hide show
  1. package/lib/src/{CreatedOnBrandCrowd-de-de-BmeMc9oz.js → CreatedOnBrandCrowd-de-de-Ekmn0O3s.js} +1 -1
  2. package/lib/src/{CreatedOnBrandCrowd-en-us-CQNdm_6P.js → CreatedOnBrandCrowd-en-us-BjeXlKTS.js} +1 -1
  3. package/lib/src/{CreatedOnBrandCrowd-es-es-BrmHWeAM.js → CreatedOnBrandCrowd-es-es-rpNINAMY.js} +1 -1
  4. package/lib/src/{CreatedOnBrandCrowd-fr-fr-CaIyjTXl.js → CreatedOnBrandCrowd-fr-ca-BL4nSaLj.js} +1 -1
  5. package/lib/src/{CreatedOnBrandCrowd-fr-ca-CaIyjTXl.js → CreatedOnBrandCrowd-fr-fr-BL4nSaLj.js} +1 -1
  6. package/lib/src/{CreatedOnBrandCrowd-pt-pt-BClE0Nd9.js → CreatedOnBrandCrowd-pt-br-K0r4FyYq.js} +1 -1
  7. package/lib/src/{CreatedOnBrandCrowd-pt-br-BClE0Nd9.js → CreatedOnBrandCrowd-pt-pt-K0r4FyYq.js} +1 -1
  8. package/lib/src/{CreatedOnDcom-de-de-CkrdlPqK.js → CreatedOnDcom-de-de-0XYyEKYc.js} +1 -1
  9. package/lib/src/{CreatedOnDcom-en-us-D33J9qky.js → CreatedOnDcom-en-us-E8hvwiMd.js} +1 -1
  10. package/lib/src/{CreatedOnDcom-es-es-BsmInngw.js → CreatedOnDcom-es-es-pRuCd7xX.js} +1 -1
  11. package/lib/src/{CreatedOnDcom-fr-ca-DOXlsRea.js → CreatedOnDcom-fr-ca-Bu4V3jpn.js} +1 -1
  12. package/lib/src/{CreatedOnDcom-fr-fr-SfFYLtyn.js → CreatedOnDcom-fr-fr-CCcrGNz2.js} +1 -1
  13. package/lib/src/{CreatedOnDcom-pt-br-DcWeuZUy.js → CreatedOnDcom-pt-br-1GTvaLKd.js} +1 -1
  14. package/lib/src/{CreatedOnDcom-pt-pt-DZsZZ4iX.js → CreatedOnDcom-pt-pt-CTIYW10X.js} +1 -1
  15. package/lib/src/brand-page/models/index.d.ts +1 -0
  16. package/lib/src/brand-page/models/index.js +3 -0
  17. package/lib/src/brand-page/utils/personalisation.util.js +72 -14
  18. package/lib/src/brand-page-maker/components/action-bar/ActionBar.mixin.d.ts +1 -1
  19. package/lib/src/brand-page-maker/components/admin-background-settings/AdminBackgroundSettings.mixin.d.ts +6 -0
  20. package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.d.ts +12 -1
  21. package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.js +2 -0
  22. package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.stories.js +1 -0
  23. package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMakerTemplateSettings.mixin.d.ts +1 -1
  24. package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.d.ts +1 -1
  25. package/lib/src/brand-page-maker/components/brandpage-settings/ReplaceImageSettingsForBrandPageSettings.mixin.d.ts +1 -1
  26. package/lib/src/brand-page-maker/components/seo-settings/SeoPageSettings.mixin.d.ts +1 -1
  27. package/lib/src/brand-page-maker/components/seo-settings/UrlSettings.mixin.d.ts +1 -1
  28. package/lib/src/brand-page-maker/components/social-share/SocialShare.mixin.d.ts +1 -1
  29. package/lib/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.d.ts +2 -3
  30. package/lib/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.js +16 -5
  31. package/lib/src/brand-page-maker/stores/ai-checkpoint/ai-checkpoint-store.d.ts +6 -0
  32. package/lib/src/brand-page-maker/stores/brandpage-container/brand-page-container-store.d.ts +1 -0
  33. package/lib/src/brand-page-maker/stores/brandpage-container/brand-page-container-store.js +3 -0
  34. package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.d.ts +3 -1
  35. package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.js +5 -1
  36. package/lib/src/brand-page-maker/stores/ui/ui-store.d.ts +6 -0
  37. package/lib/src/brand-page-maker/stores/ui/ui-store.js +8 -0
  38. package/lib/src/clients/design-template-client.d.ts +3 -0
  39. package/lib/src/clients/models.d.ts +2 -0
  40. package/lib/src/css/library.brand-page-brandCrowd.min.css +19 -7
  41. package/lib/src/css/library.brand-page-brandPage.min.css +19 -7
  42. package/lib/src/css/library.brand-page-designCom.min.css +19 -7
  43. package/lib/src/css/library.brand-page-preview.min.css +19 -7
  44. package/lib/src/index.mjs +1 -1
  45. package/lib/src/{lib-C5vGkjfs.js → lib-BfgUqu0B.js} +22777 -22678
  46. package/lib/src/shared/content-settings/components/content-settings/ContentSettings.mixin.d.ts +1 -1
  47. package/lib/src/shared/content-settings/components/content-settings/ReplaceImageSettingsForContent.mixin.d.ts +1 -1
  48. package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.d.ts +7 -1
  49. package/lib/src/shared/logo-settings/components/EditLogoSettings.mixin.d.ts +9 -0
  50. package/lib/src/shared/logo-settings/components/LogoSettings.mixin.d.ts +1 -1
  51. package/lib/src/shared/logo-versions/LogoVersions.mixin.d.ts +6 -0
  52. package/lib/src/shared/models.d.ts +2 -0
  53. package/lib/src/shared/my-designs/MyDesigns.mixin.d.ts +6 -0
  54. package/lib/src/shared/my-uploads/MyMedia.mixin.d.ts +6 -0
  55. package/lib/src/shared/my-uploads/MyUploads.mixin.d.ts +6 -0
  56. package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.d.ts +7 -1
  57. package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.d.ts +7 -1
  58. package/lib/src/shared/publish-brand-page-with-state/PublishBrandPageModalWithState.mixin.d.ts +1 -1
  59. package/lib/src/shared/style-settings/components/StyleSettings.mixin.d.ts +7 -1
  60. package/lib/src/shared/template-settings/components/TemplatesSettings.mixin.d.ts +10 -439
  61. package/lib/src/shared/template-settings/components/TemplatesSettings.mixin.js +2 -2
  62. package/lib/src/shared/template-settings/models.d.ts +1 -0
  63. package/lib/src/shared/template-settings/store/template-settings-store.d.ts +4 -0
  64. package/lib/src/shared/template-settings/store/template-settings-store.js +79 -11
  65. package/lib/src/shared/unsplash-library/UnsplashLibrary.mixin.d.ts +6 -0
  66. package/package.json +1 -1
  67. package/src/brand-page/models/index.ts +4 -0
  68. package/src/brand-page/utils/__snapshots__/migration.util.test.ts.snap +3 -0
  69. package/src/brand-page/utils/__snapshots__/migration2.util.test.ts.snap +1 -0
  70. package/src/brand-page/utils/__snapshots__/model.util.test.ts.snap +2 -0
  71. package/src/brand-page/utils/personalisation.util.test.ts +35 -0
  72. package/src/brand-page/utils/personalisation.util.ts +119 -23
  73. package/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.ts +4 -0
  74. package/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.stories.ts +1 -0
  75. package/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.ts +22 -8
  76. package/src/brand-page-maker/components/template-preview/TemplatePreview.vue +5 -10
  77. package/src/brand-page-maker/components/template-preview/TemplatePreviewAiBadge.vue +12 -0
  78. package/src/brand-page-maker/stores/brandpage-container/brand-page-container-store.ts +5 -0
  79. package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.ts +10 -0
  80. package/src/brand-page-maker/stores/ui/ui-store.ts +16 -0
  81. package/src/clients/design-template-client.ts +3 -0
  82. package/src/clients/models.ts +2 -0
  83. package/src/shared/models.ts +6 -0
  84. package/src/shared/template-settings/components/TemplatesSettings.mixin.ts +2 -2
  85. package/src/shared/template-settings/models.ts +1 -0
  86. package/src/shared/template-settings/store/template-settings-store.ts +105 -18
@@ -14,6 +14,7 @@ import * as DesignTemplateClient from '../../../clients/design-template-client';
14
14
  import { type DesignTemplate } from '../../../clients/models';
15
15
  import {
16
16
  BP_DEFAULT_TEMPLATE_TYPE_NAME,
17
+ BP_BRAND_SITE_TEMPLATE_TYPE_NAME,
17
18
  SIDE_BAR_TAB_NAMES,
18
19
  } from '@brand-page-maker/constants';
19
20
  import { defineStore, storeToRefs } from 'pinia';
@@ -32,6 +33,7 @@ import {
32
33
  useUiEditableLogoStore,
33
34
  useUiLogoSettingsStore,
34
35
  } from '../../logo-settings/store';
36
+ import { useEventTracker } from '@brand-page-maker/composables/useEventTracker';
35
37
  import {
36
38
  templateSettingsTr,
37
39
  getCurrentLocale,
@@ -39,6 +41,17 @@ import {
39
41
  import { watch } from 'vue';
40
42
 
41
43
  export const DEFAULT_PAGE_SIZE = 6;
44
+
45
+ const POST_PURCHASE_PAGE_SECTION_BY_TAB: Record<string, string> = {
46
+ [TEMPLATE_TABS.all]: 'MakerPostPurchaseSidebarTemplatesAllTab',
47
+ [TEMPLATE_TABS.AI]: 'MakerPostPurchaseSidebarTemplatesAiTab',
48
+ [TEMPLATE_TABS.categories]: 'MakerPostPurchaseSidebarTemplatesCategoryTab',
49
+ };
50
+
51
+ const PRE_PURCHASE_PAGE_SECTION_BY_TAB: Record<string, string> = {
52
+ [TEMPLATE_TABS.all]: 'MakerPrePurchaseSidebarTemplatesAllTab',
53
+ [TEMPLATE_TABS.categories]: 'MakerPrePurchaseSidebarTemplatesCategoryTab',
54
+ };
42
55
  const LOAD_PAGE_RETRY_DELAY = 250;
43
56
 
44
57
  type SelectedTabType = {
@@ -66,6 +79,7 @@ export interface TemplatesSettingState {
66
79
  tabsWithTranslations: SelectedTabType[];
67
80
  logoChangeWatcherInitialized: boolean;
68
81
  initialSearchTerm: string | undefined;
82
+ aiTemplateKeywords: string | undefined;
69
83
  onSearchTermChanged: OnSearchTermChangedCallback | undefined;
70
84
  }
71
85
 
@@ -103,6 +117,7 @@ export const useUiTemplateSettingsStore = defineStore('uiTemplateSettings', {
103
117
  cachedTemplates: {},
104
118
  logoChangeWatcherInitialized: false,
105
119
  initialSearchTerm: undefined,
120
+ aiTemplateKeywords: undefined,
106
121
  onSearchTermChanged: undefined,
107
122
  };
108
123
  },
@@ -302,22 +317,60 @@ export const useUiTemplateSettingsStore = defineStore('uiTemplateSettings', {
302
317
  const editableLogoVariation =
303
318
  editableLogoStore.editableLogoVariations[logoVariation];
304
319
 
320
+ const isPrePurchase = brandPageContainerStore.isPrePurchase;
321
+ const isBrandSite =
322
+ this.templateType === BP_BRAND_SITE_TEMPLATE_TYPE_NAME;
323
+
324
+ // Pre-purchase has no logo draft for logo-based recommendation, so fall back to the seeded
325
+ // search term (the keyword from the URL/cookie - never the business name) so the All tab
326
+ // stays relevant instead of generic (bp-5454).
327
+ const effectiveSearchTerm =
328
+ !this.searchTerm &&
329
+ !this.selectedCategory &&
330
+ isPrePurchase &&
331
+ isBrandSite &&
332
+ this.selectedTab.key === TEMPLATE_TABS.all
333
+ ? this.initialSearchTerm
334
+ : this.searchTerm;
335
+
336
+ const pageSection = isBrandSite
337
+ ? (isPrePurchase
338
+ ? PRE_PURCHASE_PAGE_SECTION_BY_TAB
339
+ : POST_PURCHASE_PAGE_SECTION_BY_TAB)[this.selectedTab.key]
340
+ : undefined;
341
+
342
+ const pageName = isBrandSite
343
+ ? isPrePurchase
344
+ ? 'maker-pre-purchase'
345
+ : 'maker'
346
+ : undefined;
347
+
348
+ const baseParams = {
349
+ page: pageNo,
350
+ categoryName: this.selectedCategory,
351
+ searchTerm: effectiveSearchTerm,
352
+ keywords: this.aiTemplateKeywords,
353
+ logoDraftToken: logoSettingsStore.selectedLogoImage.logoDraftToken,
354
+ logoVariation: logoSettingsStore.selectedLogoImage.logoVariation,
355
+ selectedTemplateToken: designTemplateToken,
356
+ locale: currentLocale,
357
+ logoS3Token: !isByo ? editableLogoVariation.s3Token : undefined,
358
+ logoTemplateToken: isByo ? logoTemplateToken : undefined,
359
+ useLogoForRecommendedTemplates:
360
+ isBrandSite && this.selectedTab.key === TEMPLATE_TABS.all,
361
+ pageSection,
362
+ pageName,
363
+ };
364
+
365
+ // AI templates are interleaved server-side for the Brand Site All tab
366
+ // (bp-5306); the frontend just renders the returned order.
305
367
  const result =
306
368
  await designTemplateClient.getTemplateItemsByTemplateType(
307
369
  this.templateType,
308
370
  {
309
- page: pageNo,
371
+ ...baseParams,
310
372
  pageSize: DEFAULT_PAGE_SIZE,
311
- categoryName: this.selectedCategory,
312
- searchTerm: this.searchTerm,
313
- logoDraftToken:
314
- logoSettingsStore.selectedLogoImage.logoDraftToken,
315
- logoVariation: logoSettingsStore.selectedLogoImage.logoVariation,
316
373
  personalisable: this.selectedTab.key === TEMPLATE_TABS.AI,
317
- selectedTemplateToken: designTemplateToken,
318
- locale: currentLocale,
319
- logoS3Token: !isByo ? editableLogoVariation.s3Token : undefined,
320
- logoTemplateToken: isByo ? logoTemplateToken : undefined,
321
374
  },
322
375
  );
323
376
 
@@ -327,11 +380,27 @@ export const useUiTemplateSettingsStore = defineStore('uiTemplateSettings', {
327
380
 
328
381
  this._setPageCount({ pageCount: result.pageCount });
329
382
 
383
+ if (
384
+ pageNo === 1 &&
385
+ result.abTestValuesToBePushed &&
386
+ Object.keys(result.abTestValuesToBePushed).length > 0
387
+ ) {
388
+ const eventTracker = useEventTracker();
389
+
390
+ for (const [experimentName, experimentValue] of Object.entries(
391
+ result.abTestValuesToBePushed,
392
+ )) {
393
+ eventTracker.sendExperimentStartedEvent(
394
+ experimentName,
395
+ experimentValue,
396
+ );
397
+ }
398
+ }
399
+
330
400
  const templates = await Promise.all(
331
401
  result.paginatedItems.map(async (item) => {
332
402
  try {
333
403
  if (brandPageMakerUserStore.isAdmin) {
334
- // Pre-purchase: full template with brandPageModel for live rendering
335
404
  const template =
336
405
  await designTemplateClient.getTemplateByTemplateToken(
337
406
  item.designTemplateToken,
@@ -349,17 +418,24 @@ export const useUiTemplateSettingsStore = defineStore('uiTemplateSettings', {
349
418
  uiStore.personalisationData.length,
350
419
  );
351
420
 
352
- // Get the contentKey from the selected personalisation variation
353
- // This is needed for the backend preview URL to show the correct variation
354
- const selectedPersonalisation =
355
- uiStore.personalisationData[personalisationContentIndex];
356
-
357
- contentKey = selectedPersonalisation.contentKey;
421
+ contentKey =
422
+ uiStore.personalisationData[personalisationContentIndex]
423
+ .contentKey;
424
+ } else if (item.isPersonalisable) {
425
+ // Pre-purchase has no personalisationData; personalise AI
426
+ // template previews with the prompt content key (bp-5742).
427
+ contentKey = uiStore.userPromptContentKey;
358
428
  }
359
429
 
360
430
  return {
361
431
  id: item.designTemplateToken,
432
+ isPersonalisable: item.isPersonalisable,
362
433
  contentKey,
434
+ // A userPromptContentKey signals this design's real AI images live
435
+ // in the userPrompt bucket (post- or pre-purchase). The preview must
436
+ // then resolve via userPromptContentKey, not the regular bucket which
437
+ // holds placeholders post-purchase (bp-5454).
438
+ usesUserPromptContentKey: !!uiStore.userPromptContentKey,
363
439
  previewImageUrl: item.previewImageUrl,
364
440
  } as TemplateSettingsTemplate;
365
441
  }
@@ -374,7 +450,15 @@ export const useUiTemplateSettingsStore = defineStore('uiTemplateSettings', {
374
450
  (t): t is TemplateSettingsTemplate => t !== null,
375
451
  );
376
452
 
377
- this._addTemplates({ templates: validTemplates });
453
+ // The Categories tab must never surface AI templates or the AI badge
454
+ // (bp-5454 scenario 5). The badge is driven purely by isPersonalisable,
455
+ // so clear it for category results regardless of the template's catalog flag.
456
+ const displayTemplates =
457
+ this.selectedTab.key === TEMPLATE_TABS.categories
458
+ ? validTemplates.map((t) => ({ ...t, isPersonalisable: false }))
459
+ : validTemplates;
460
+
461
+ this._addTemplates({ templates: displayTemplates });
378
462
  this._setPageNoLoaded({ pageNoLoaded: pageNo });
379
463
  } finally {
380
464
  this._setIsBusy({ isBusy: false });
@@ -496,6 +580,9 @@ export const useUiTemplateSettingsStore = defineStore('uiTemplateSettings', {
496
580
  this.initialSearchTerm = payload.initialSearchTerm;
497
581
  this.onSearchTermChanged = payload.onSearchTermChanged;
498
582
  },
583
+ setAiTemplateKeywords(payload: { aiTemplateKeywords: string }) {
584
+ this.aiTemplateKeywords = payload.aiTemplateKeywords;
585
+ },
499
586
  notifySearchTermChanged(searchTerm: string | undefined) {
500
587
  this.onSearchTermChanged?.(searchTerm);
501
588
  },