@designcrowd/library.brand-page 6.0.22 → 6.0.23-ast-remove

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 (35) hide show
  1. package/lib/src/{CreatedOnBrandCrowd-de-de-BS8dQhaZ.js → CreatedOnBrandCrowd-de-de-C2IaS_Mb.js} +1 -1
  2. package/lib/src/{CreatedOnBrandCrowd-en-us-45ZyXSxn.js → CreatedOnBrandCrowd-en-us-AtykytDu.js} +1 -1
  3. package/lib/src/{CreatedOnBrandCrowd-es-es-B1K3Ojw-.js → CreatedOnBrandCrowd-es-es-CBzMnp_n.js} +1 -1
  4. package/lib/src/{CreatedOnBrandCrowd-fr-fr-4v9c20Q9.js → CreatedOnBrandCrowd-fr-ca-Cz7WzWc3.js} +1 -1
  5. package/lib/src/{CreatedOnBrandCrowd-fr-ca-4v9c20Q9.js → CreatedOnBrandCrowd-fr-fr-Cz7WzWc3.js} +1 -1
  6. package/lib/src/{CreatedOnBrandCrowd-pt-pt-BdDmm1GE.js → CreatedOnBrandCrowd-pt-br-DE3vjPyC.js} +1 -1
  7. package/lib/src/{CreatedOnBrandCrowd-pt-br-BdDmm1GE.js → CreatedOnBrandCrowd-pt-pt-DE3vjPyC.js} +1 -1
  8. package/lib/src/{CreatedOnDcom-de-de-Dc8rOxAE.js → CreatedOnDcom-de-de-DlcGgBF6.js} +1 -1
  9. package/lib/src/{CreatedOnDcom-en-us-Bq6rusW6.js → CreatedOnDcom-en-us-D5jdeN_E.js} +1 -1
  10. package/lib/src/{CreatedOnDcom-es-es-C5gNEuoi.js → CreatedOnDcom-es-es-BBB7ZE8B.js} +1 -1
  11. package/lib/src/{CreatedOnDcom-fr-ca-NL2KoADg.js → CreatedOnDcom-fr-ca-odHmWYoP.js} +1 -1
  12. package/lib/src/{CreatedOnDcom-fr-fr-DZaLN0j-.js → CreatedOnDcom-fr-fr-DKr11T_P.js} +1 -1
  13. package/lib/src/{CreatedOnDcom-pt-br-DXZvo45o.js → CreatedOnDcom-pt-br-s8blQRF7.js} +1 -1
  14. package/lib/src/{CreatedOnDcom-pt-pt-GUJ4aTM2.js → CreatedOnDcom-pt-pt-Dga4RM96.js} +1 -1
  15. package/lib/src/brand-page/models/index.d.ts +0 -1
  16. package/lib/src/brand-page/models/index.js +0 -3
  17. package/lib/src/brand-page-maker/stores/ai-checkpoint/ai-checkpoint-store.d.ts +0 -6
  18. package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.js +0 -2
  19. package/lib/src/css/library.brand-page-brandCrowd.min.css +11 -11
  20. package/lib/src/css/library.brand-page-brandPage.min.css +11 -11
  21. package/lib/src/css/library.brand-page-designCom.min.css +11 -11
  22. package/lib/src/css/library.brand-page-preview.min.css +11 -11
  23. package/lib/src/index.mjs +1 -1
  24. package/lib/src/{lib-Dh4vrmod.js → lib-aLiBOhnh.js} +495 -498
  25. package/lib/src/shared/template-settings/store/template-settings-store.js +4 -4
  26. package/package.json +1 -1
  27. package/src/brand-page/components/shop/PaymentModal.vue +3 -3
  28. package/src/brand-page/components/shop/Shop.vue +4 -4
  29. package/src/brand-page/components/shop/Shop.vue.test.ts +209 -0
  30. package/src/brand-page/models/index.ts +0 -4
  31. package/src/brand-page/utils/__snapshots__/migration.util.test.ts.snap +0 -3
  32. package/src/brand-page/utils/__snapshots__/migration2.util.test.ts.snap +0 -1
  33. package/src/brand-page/utils/__snapshots__/model.util.test.ts.snap +0 -2
  34. package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.ts +0 -2
  35. package/src/shared/template-settings/store/template-settings-store.ts +6 -4
@@ -20,6 +20,7 @@ const POST_PURCHASE_PAGE_SECTION_BY_TAB = {
20
20
  };
21
21
  const PRE_PURCHASE_PAGE_SECTION_BY_TAB = {
22
22
  [TEMPLATE_TABS.all]: 'MakerPrePurchaseSidebarTemplatesAllTab',
23
+ [TEMPLATE_TABS.AI]: 'MakerPrePurchaseSidebarTemplatesAiTab',
23
24
  [TEMPLATE_TABS.categories]: 'MakerPrePurchaseSidebarTemplatesCategoryTab',
24
25
  };
25
26
  const LOAD_PAGE_RETRY_DELAY = 250;
@@ -270,9 +271,7 @@ export const useUiTemplateSettingsStore = defineStore('uiTemplateSettings', {
270
271
  uiStore.personalisationData[personalisationContentIndex]
271
272
  .contentKey;
272
273
  }
273
- else if (item.isPersonalisable) {
274
- // Pre-purchase has no personalisationData; personalise AI
275
- // template previews with the prompt content key (bp-5742).
274
+ else if (item.isPersonalisable && !this.searchTerm) {
276
275
  contentKey = uiStore.userPromptContentKey;
277
276
  }
278
277
  return {
@@ -283,7 +282,7 @@ export const useUiTemplateSettingsStore = defineStore('uiTemplateSettings', {
283
282
  // in the userPrompt bucket (post- or pre-purchase). The preview must
284
283
  // then resolve via userPromptContentKey, not the regular bucket which
285
284
  // holds placeholders post-purchase (bp-5454).
286
- usesUserPromptContentKey: !!uiStore.userPromptContentKey,
285
+ usesUserPromptContentKey: !!uiStore.userPromptContentKey && !this.searchTerm,
287
286
  previewImageUrl: item.previewImageUrl,
288
287
  };
289
288
  }
@@ -364,6 +363,7 @@ export const useUiTemplateSettingsStore = defineStore('uiTemplateSettings', {
364
363
  await this._setSearchTerm({
365
364
  searchTerm: payload.searchTerm,
366
365
  });
366
+ this.aiTemplateKeywords = payload.searchTerm ?? '';
367
367
  this.onSearchTermChanged?.(payload.searchTerm);
368
368
  await this._setPageNo({ pageNo: 1 });
369
369
  await this.loadPageNo({ pageNo: 1 });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@designcrowd/library.brand-page",
3
3
  "description": "A collection of Maker/Designer applications",
4
- "version": "6.0.22",
4
+ "version": "6.0.23-ast-remove",
5
5
  "author": "Design.com Eng",
6
6
  "license": "UNLICENSED",
7
7
  "type": "module",
@@ -50,7 +50,7 @@
50
50
  <Button
51
51
  size="medium"
52
52
  class="tw-mt-3 tw-mb-4 tw-py-3 tw-cursor-pointer tw-rounded"
53
- :style="buttonStyle"
53
+ :style="buttonStyle?.style"
54
54
  :label="paymentModalTr('done')"
55
55
  :attrs="{
56
56
  'data-test-tag': 'done-btn',
@@ -67,7 +67,7 @@
67
67
  <Button
68
68
  size="medium"
69
69
  class="tw-mt-3 tw-mb-4 tw-py-3 tw-cursor-pointer tw-rounded"
70
- :style="buttonStyle"
70
+ :style="buttonStyle?.style"
71
71
  :label="paymentModalTr('done')"
72
72
  :attrs="{
73
73
  'data-test-tag': 'done-btn',
@@ -83,7 +83,7 @@
83
83
  size="medium"
84
84
  :full-width="true"
85
85
  class="tw-mb-4 tw-py-3 tw-cursor-pointer tw-rounded"
86
- :style="buttonStyle"
86
+ :style="buttonStyle?.style"
87
87
  label="Proceed to Payment"
88
88
  :attrs="{
89
89
  'data-test-tag': 'proceed-btn',
@@ -58,9 +58,9 @@
58
58
  <ButtonStyleWrapper
59
59
  v-if="viewModel.products.length >= 1"
60
60
  :selected-button-style-id="
61
- viewModel.buttonStyles.selectedButtonStyleId
61
+ viewModel.buttonStyles?.selectedButtonStyleId
62
62
  "
63
- :icon-color="viewModel.buttonStyles.style.backgroundColor"
63
+ :icon-color="viewModel.buttonStyles?.style?.backgroundColor"
64
64
  :no-margin="true"
65
65
  >
66
66
  <button
@@ -113,7 +113,7 @@
113
113
  v-if="data.isPaymentModalVisible"
114
114
  class="modal-payment"
115
115
  :is-visible="data.isPaymentModalVisible"
116
- :button-style="buttonStyle"
116
+ :button-style="viewModel.buttonStyles"
117
117
  :description-style="viewModel.descriptionStyle"
118
118
  :shop-payment-config="shopPaymentConfig"
119
119
  :context="context"
@@ -245,7 +245,7 @@ const buttonStyle = computed((): any => {
245
245
  ...props.viewModel.buttonStyles?.style,
246
246
  color:
247
247
  props.viewModel.buttonTextStyle?.color ||
248
- props.viewModel.buttonStyles?.style.color,
248
+ props.viewModel.buttonStyles?.style?.color,
249
249
  };
250
250
  return buttonStyle;
251
251
  });
@@ -0,0 +1,209 @@
1
+ import { vi } from 'vitest';
2
+ import { shallowMount } from '@vue/test-utils';
3
+ import Shop from './Shop.vue';
4
+ import PaymentModal from './PaymentModal.vue';
5
+ import { createPinia, setActivePinia } from 'pinia';
6
+ import {
7
+ BRAND_PAGE_TYPES,
8
+ ButtonStyles,
9
+ MEDIA_SIZES,
10
+ type BrandPageContext,
11
+ } from '@brand-page/models';
12
+ import type { ShopViewModel } from '@brand-page/view-models';
13
+
14
+ vi.mock('../../clients/brand-page.client', () => ({
15
+ default: {
16
+ getPaymentConfigStatusByPaymentConfigId: vi.fn(),
17
+ createBrandPageCart: vi.fn(),
18
+ },
19
+ }));
20
+
21
+ vi.mock('@brand-page/utils/raygun.util', () => ({
22
+ default: { safeSendRaygunError: vi.fn() },
23
+ }));
24
+
25
+ const createContext = (): BrandPageContext => ({
26
+ brandPageSlug: 'test',
27
+ brandPageToken: '',
28
+ isMobile: false,
29
+ isPreview: true,
30
+ isProduction: false,
31
+ isServerRender: false,
32
+ options: { mediaSizes: MEDIA_SIZES.sizeThumb },
33
+ isTemplate: false,
34
+ isDesignCom: false,
35
+ pageTitle: 'Test',
36
+ runtimeEnvironment: '',
37
+ stripePublishableKey: undefined,
38
+ customDomain: undefined,
39
+ brandPageType: BRAND_PAGE_TYPES.brandSite,
40
+ isBrandPage: false,
41
+ isBrandPageOrIsBrandContact: false,
42
+ isBrandSite: true,
43
+ isBrandContact: false,
44
+ pages: [],
45
+ isCapturingPreview: false,
46
+ recaptchaSiteKey: undefined,
47
+ nav: { navItems: [] },
48
+ });
49
+
50
+ const PRODUCT = {
51
+ id: '1',
52
+ name: 'Test',
53
+ price: 1,
54
+ description: '',
55
+ imageUrl: '',
56
+ } as any;
57
+
58
+ const createViewModel = (
59
+ overrides: Partial<ShopViewModel> = {},
60
+ ): ShopViewModel =>
61
+ ({
62
+ id: '1',
63
+ type: 'shop-section',
64
+ role: 'shop-section',
65
+ title: 'Shop',
66
+ description: '',
67
+ successMessage: 'Thanks!',
68
+ products: [],
69
+ displayStyle: 'text',
70
+ aspectRatio: '1:1',
71
+ fillColor: {},
72
+ defaultBorderColor: {},
73
+ itemTextStyle: {},
74
+ backgroundStyle: {},
75
+ buttonStyles: new ButtonStyles(),
76
+ isFullWidth: true,
77
+ isShippingEnabled: false,
78
+ shopPaymentConfig: {
79
+ paymentConfig: {},
80
+ paymentOptionDisplayType: 'text',
81
+ paymentOptionImageType: 'none',
82
+ isCustomerRequestDetailsEnabled: false,
83
+ isShippingEnabled: false,
84
+ },
85
+ ...overrides,
86
+ }) as ShopViewModel;
87
+
88
+ const mountShop = (viewModel: ShopViewModel) =>
89
+ shallowMount(Shop, {
90
+ props: {
91
+ context: createContext(),
92
+ viewModel,
93
+ contentIndex: 0,
94
+ },
95
+ });
96
+
97
+ describe('Shop', () => {
98
+ beforeEach(() => {
99
+ setActivePinia(createPinia());
100
+ });
101
+
102
+ describe('buttonStyles defensive access', () => {
103
+ it('does not throw when buttonStyles has no style property', () => {
104
+ const vm = createViewModel({
105
+ buttonStyles: { selectedButtonStyleId: 'BUTTON_STYLE_1' } as any,
106
+ products: [PRODUCT],
107
+ });
108
+
109
+ expect(() => mountShop(vm)).not.toThrow();
110
+ });
111
+
112
+ it('does not throw when buttonStyles is undefined', () => {
113
+ const vm = createViewModel({
114
+ buttonStyles: undefined as any,
115
+ products: [PRODUCT],
116
+ });
117
+
118
+ expect(() => mountShop(vm)).not.toThrow();
119
+ });
120
+
121
+ it('renders correctly with fully populated buttonStyles', () => {
122
+ const vm = createViewModel({
123
+ buttonStyles: new ButtonStyles({
124
+ selectedButtonStyleId: 'BUTTON_STYLE_1',
125
+ style: {
126
+ color: 'rgb(255, 0, 0)',
127
+ backgroundColor: 'rgb(0, 0, 255)',
128
+ },
129
+ }),
130
+ products: [PRODUCT],
131
+ });
132
+
133
+ const wrapper = mountShop(vm);
134
+
135
+ expect(
136
+ wrapper.find('[data-component="button-style-wrapper"]').exists() ||
137
+ wrapper.findComponent({ name: 'ButtonStyleWrapper' }).exists(),
138
+ ).toBe(true);
139
+ });
140
+ });
141
+ });
142
+
143
+ describe('PaymentModal', () => {
144
+ beforeEach(() => {
145
+ setActivePinia(createPinia());
146
+ });
147
+
148
+ const mountPaymentModal = (buttonStyle: any) =>
149
+ shallowMount(PaymentModal, {
150
+ props: {
151
+ context: createContext(),
152
+ isVisible: true,
153
+ buttonStyle,
154
+ shopPaymentConfig: { paymentConfig: {} } as any,
155
+ descriptionStyle: undefined,
156
+ successMessage: 'Thanks!',
157
+ isShippingEnabled: false,
158
+ },
159
+ });
160
+
161
+ it('does not throw when given a ButtonStyles instance', () => {
162
+ const buttonStyles = new ButtonStyles({
163
+ selectedButtonStyleId: 'BUTTON_STYLE_1',
164
+ style: { color: 'rgb(255, 0, 0)', backgroundColor: 'rgb(0, 0, 255)' },
165
+ });
166
+
167
+ expect(() => mountPaymentModal(buttonStyles)).not.toThrow();
168
+ });
169
+
170
+ it('receives a ButtonStyles with .style (not flat CSS)', () => {
171
+ const buttonStyles = new ButtonStyles({
172
+ selectedButtonStyleId: 'BUTTON_STYLE_1',
173
+ style: { color: 'rgb(255, 0, 0)', backgroundColor: 'rgb(0, 0, 255)' },
174
+ });
175
+
176
+ const wrapper = mountPaymentModal(buttonStyles);
177
+ const prop = wrapper.props('buttonStyle');
178
+
179
+ expect(prop).toHaveProperty('style');
180
+ expect(prop).toHaveProperty('selectedButtonStyleId');
181
+ expect(prop.style.color).toBe('rgb(255, 0, 0)');
182
+ expect(prop.style.backgroundColor).toBe('rgb(0, 0, 255)');
183
+ });
184
+
185
+ it('passes buttonStyles through to RequestPaymentStripe', () => {
186
+ const buttonStyles = new ButtonStyles({
187
+ selectedButtonStyleId: 'BUTTON_STYLE_1',
188
+ style: { color: 'rgb(255, 0, 0)', backgroundColor: 'rgb(0, 0, 255)' },
189
+ });
190
+
191
+ const wrapper = mountPaymentModal(buttonStyles);
192
+ const stripe = wrapper.findComponent({
193
+ name: 'RequestPaymentStripe',
194
+ });
195
+
196
+ if (stripe.exists()) {
197
+ const stripeProp = stripe.props('buttonStyles');
198
+
199
+ expect(stripeProp).toHaveProperty('style');
200
+ expect(stripeProp.style.color).toBe('rgb(255, 0, 0)');
201
+ }
202
+ });
203
+
204
+ it('would fail with a flat CSS object — .style is undefined', () => {
205
+ const flatCss = { color: 'rgb(255,0,0)', backgroundColor: 'rgb(0,0,255)' };
206
+
207
+ expect((flatCss as any).style).toBeUndefined();
208
+ });
209
+ });
@@ -947,10 +947,6 @@ export class BrandPageModel {
947
947
  // Model version
948
948
  v: number;
949
949
 
950
- // AI personalisation key persisted with the draft so previews survive login/checkout-back/
951
- // refresh - content is retrieved by this token (user-agnostic), not regenerated (bp-5742).
952
- userPromptContentKey?: string;
953
-
954
950
  styles: PageStyles;
955
951
 
956
952
  /** @deprecated */
@@ -462,7 +462,6 @@ exports[`migration.util > Banner Contents - text Align and Font Family should no
462
462
  },
463
463
  },
464
464
  },
465
- "userPromptContentKey": undefined,
466
465
  "v": 19,
467
466
  },
468
467
  "useOldLogoRenderSize": true,
@@ -915,7 +914,6 @@ exports[`migration.util > migrateBrandPageModel should return brand page model w
915
914
  },
916
915
  },
917
916
  },
918
- "userPromptContentKey": undefined,
919
917
  "v": 19,
920
918
  },
921
919
  "useOldLogoRenderSize": true,
@@ -1375,7 +1373,6 @@ exports[`migration.util > migrateBrandPageModel should return brand page model w
1375
1373
  },
1376
1374
  },
1377
1375
  },
1378
- "userPromptContentKey": undefined,
1379
1376
  "v": 19,
1380
1377
  },
1381
1378
  "useOldLogoRenderSize": true,
@@ -478,7 +478,6 @@ exports[`migration02.ts > migration02 should return converted letterspacing 1`]
478
478
  },
479
479
  },
480
480
  },
481
- "userPromptContentKey": undefined,
482
481
  "v": 0,
483
482
  },
484
483
  "useOldLogoRenderSize": false,
@@ -452,7 +452,6 @@ BrandPageModel {
452
452
  },
453
453
  },
454
454
  },
455
- "userPromptContentKey": undefined,
456
455
  "v": 0,
457
456
  }
458
457
  `;
@@ -924,7 +923,6 @@ BrandPageModel {
924
923
  },
925
924
  },
926
925
  },
927
- "userPromptContentKey": undefined,
928
926
  "v": 0,
929
927
  }
930
928
  `;
@@ -1819,7 +1819,6 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
1819
1819
  const navigationStyleSettingsStore = useUiNavigationStyleSettingsStore();
1820
1820
  const shopStore = useShopConfigStore();
1821
1821
  const pageNavigationStore = usePageNavigationStore();
1822
- const uiStore = useUiStore();
1823
1822
 
1824
1823
  const pages = pageSettingsStore.pages.map((p) => ({
1825
1824
  ...p,
@@ -1837,7 +1836,6 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
1837
1836
 
1838
1837
  return {
1839
1838
  v: GetLatestModelVersion(),
1840
- userPromptContentKey: uiStore.userPromptContentKey,
1841
1839
  pages,
1842
1840
  styles: {
1843
1841
  logoStyles,
@@ -50,6 +50,7 @@ const POST_PURCHASE_PAGE_SECTION_BY_TAB: Record<string, string> = {
50
50
 
51
51
  const PRE_PURCHASE_PAGE_SECTION_BY_TAB: Record<string, string> = {
52
52
  [TEMPLATE_TABS.all]: 'MakerPrePurchaseSidebarTemplatesAllTab',
53
+ [TEMPLATE_TABS.AI]: 'MakerPrePurchaseSidebarTemplatesAiTab',
53
54
  [TEMPLATE_TABS.categories]: 'MakerPrePurchaseSidebarTemplatesCategoryTab',
54
55
  };
55
56
  const LOAD_PAGE_RETRY_DELAY = 250;
@@ -421,9 +422,7 @@ export const useUiTemplateSettingsStore = defineStore('uiTemplateSettings', {
421
422
  contentKey =
422
423
  uiStore.personalisationData[personalisationContentIndex]
423
424
  .contentKey;
424
- } else if (item.isPersonalisable) {
425
- // Pre-purchase has no personalisationData; personalise AI
426
- // template previews with the prompt content key (bp-5742).
425
+ } else if (item.isPersonalisable && !this.searchTerm) {
427
426
  contentKey = uiStore.userPromptContentKey;
428
427
  }
429
428
 
@@ -435,7 +434,8 @@ export const useUiTemplateSettingsStore = defineStore('uiTemplateSettings', {
435
434
  // in the userPrompt bucket (post- or pre-purchase). The preview must
436
435
  // then resolve via userPromptContentKey, not the regular bucket which
437
436
  // holds placeholders post-purchase (bp-5454).
438
- usesUserPromptContentKey: !!uiStore.userPromptContentKey,
437
+ usesUserPromptContentKey:
438
+ !!uiStore.userPromptContentKey && !this.searchTerm,
439
439
  previewImageUrl: item.previewImageUrl,
440
440
  } as TemplateSettingsTemplate;
441
441
  }
@@ -529,6 +529,8 @@ export const useUiTemplateSettingsStore = defineStore('uiTemplateSettings', {
529
529
  searchTerm: payload.searchTerm,
530
530
  });
531
531
 
532
+ this.aiTemplateKeywords = payload.searchTerm ?? '';
533
+
532
534
  this.onSearchTermChanged?.(payload.searchTerm);
533
535
 
534
536
  await this._setPageNo({ pageNo: 1 });