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

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-C2IaS_Mb.js → CreatedOnBrandCrowd-de-de-CiyqScwz.js} +1 -1
  2. package/lib/src/{CreatedOnBrandCrowd-en-us-AtykytDu.js → CreatedOnBrandCrowd-en-us-CZZ_j7Gw.js} +1 -1
  3. package/lib/src/{CreatedOnBrandCrowd-es-es-CBzMnp_n.js → CreatedOnBrandCrowd-es-es-CWXjDCio.js} +1 -1
  4. package/lib/src/{CreatedOnBrandCrowd-fr-fr-Cz7WzWc3.js → CreatedOnBrandCrowd-fr-ca-CfkjOdy9.js} +1 -1
  5. package/lib/src/{CreatedOnBrandCrowd-fr-ca-Cz7WzWc3.js → CreatedOnBrandCrowd-fr-fr-CfkjOdy9.js} +1 -1
  6. package/lib/src/{CreatedOnBrandCrowd-pt-pt-DE3vjPyC.js → CreatedOnBrandCrowd-pt-br-EOc0tNKn.js} +1 -1
  7. package/lib/src/{CreatedOnBrandCrowd-pt-br-DE3vjPyC.js → CreatedOnBrandCrowd-pt-pt-EOc0tNKn.js} +1 -1
  8. package/lib/src/{CreatedOnDcom-de-de-DlcGgBF6.js → CreatedOnDcom-de-de-BJmeOo0W.js} +1 -1
  9. package/lib/src/{CreatedOnDcom-en-us-D5jdeN_E.js → CreatedOnDcom-en-us-NQxuJRPk.js} +1 -1
  10. package/lib/src/{CreatedOnDcom-es-es-BBB7ZE8B.js → CreatedOnDcom-es-es-DLY_-jUJ.js} +1 -1
  11. package/lib/src/{CreatedOnDcom-fr-ca-odHmWYoP.js → CreatedOnDcom-fr-ca-CIQECmJV.js} +1 -1
  12. package/lib/src/{CreatedOnDcom-fr-fr-DKr11T_P.js → CreatedOnDcom-fr-fr-Cu6db7o5.js} +1 -1
  13. package/lib/src/{CreatedOnDcom-pt-br-s8blQRF7.js → CreatedOnDcom-pt-br-DbOUnilX.js} +1 -1
  14. package/lib/src/{CreatedOnDcom-pt-pt-Dga4RM96.js → CreatedOnDcom-pt-pt-K1MZafvR.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-maker/stores/ai-checkpoint/ai-checkpoint-store.d.ts +6 -0
  18. package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.js +2 -0
  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-aLiBOhnh.js → lib-BhVYr7xx.js} +495 -492
  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 +1 -1
  29. package/src/brand-page/components/shop/Shop.vue.test.ts +27 -81
  30. package/src/brand-page/models/index.ts +4 -0
  31. package/src/brand-page/utils/__snapshots__/migration.util.test.ts.snap +3 -0
  32. package/src/brand-page/utils/__snapshots__/migration2.util.test.ts.snap +1 -0
  33. package/src/brand-page/utils/__snapshots__/model.util.test.ts.snap +2 -0
  34. package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.ts +2 -0
  35. package/src/shared/template-settings/store/template-settings-store.ts +4 -6
@@ -20,7 +20,6 @@ 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',
24
23
  [TEMPLATE_TABS.categories]: 'MakerPrePurchaseSidebarTemplatesCategoryTab',
25
24
  };
26
25
  const LOAD_PAGE_RETRY_DELAY = 250;
@@ -271,7 +270,9 @@ export const useUiTemplateSettingsStore = defineStore('uiTemplateSettings', {
271
270
  uiStore.personalisationData[personalisationContentIndex]
272
271
  .contentKey;
273
272
  }
274
- else if (item.isPersonalisable && !this.searchTerm) {
273
+ else if (item.isPersonalisable) {
274
+ // Pre-purchase has no personalisationData; personalise AI
275
+ // template previews with the prompt content key (bp-5742).
275
276
  contentKey = uiStore.userPromptContentKey;
276
277
  }
277
278
  return {
@@ -282,7 +283,7 @@ export const useUiTemplateSettingsStore = defineStore('uiTemplateSettings', {
282
283
  // in the userPrompt bucket (post- or pre-purchase). The preview must
283
284
  // then resolve via userPromptContentKey, not the regular bucket which
284
285
  // holds placeholders post-purchase (bp-5454).
285
- usesUserPromptContentKey: !!uiStore.userPromptContentKey && !this.searchTerm,
286
+ usesUserPromptContentKey: !!uiStore.userPromptContentKey,
286
287
  previewImageUrl: item.previewImageUrl,
287
288
  };
288
289
  }
@@ -363,7 +364,6 @@ export const useUiTemplateSettingsStore = defineStore('uiTemplateSettings', {
363
364
  await this._setSearchTerm({
364
365
  searchTerm: payload.searchTerm,
365
366
  });
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.23-ast-remove",
4
+ "version": "6.0.23",
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?.style"
53
+ :style="buttonStyle"
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?.style"
70
+ :style="buttonStyle"
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?.style"
86
+ :style="buttonStyle"
87
87
  label="Proceed to Payment"
88
88
  :attrs="{
89
89
  'data-test-tag': 'proceed-btn',
@@ -113,7 +113,7 @@
113
113
  v-if="data.isPaymentModalVisible"
114
114
  class="modal-payment"
115
115
  :is-visible="data.isPaymentModalVisible"
116
- :button-style="viewModel.buttonStyles"
116
+ :button-style="buttonStyle"
117
117
  :description-style="viewModel.descriptionStyle"
118
118
  :shop-payment-config="shopPaymentConfig"
119
119
  :context="context"
@@ -1,7 +1,6 @@
1
1
  import { vi } from 'vitest';
2
2
  import { shallowMount } from '@vue/test-utils';
3
3
  import Shop from './Shop.vue';
4
- import PaymentModal from './PaymentModal.vue';
5
4
  import { createPinia, setActivePinia } from 'pinia';
6
5
  import {
7
6
  BRAND_PAGE_TYPES,
@@ -14,7 +13,6 @@ import type { ShopViewModel } from '@brand-page/view-models';
14
13
  vi.mock('../../clients/brand-page.client', () => ({
15
14
  default: {
16
15
  getPaymentConfigStatusByPaymentConfigId: vi.fn(),
17
- createBrandPageCart: vi.fn(),
18
16
  },
19
17
  }));
20
18
 
@@ -47,14 +45,6 @@ const createContext = (): BrandPageContext => ({
47
45
  nav: { navItems: [] },
48
46
  });
49
47
 
50
- const PRODUCT = {
51
- id: '1',
52
- name: 'Test',
53
- price: 1,
54
- description: '',
55
- imageUrl: '',
56
- } as any;
57
-
58
48
  const createViewModel = (
59
49
  overrides: Partial<ShopViewModel> = {},
60
50
  ): ShopViewModel =>
@@ -103,7 +93,15 @@ describe('Shop', () => {
103
93
  it('does not throw when buttonStyles has no style property', () => {
104
94
  const vm = createViewModel({
105
95
  buttonStyles: { selectedButtonStyleId: 'BUTTON_STYLE_1' } as any,
106
- products: [PRODUCT],
96
+ products: [
97
+ {
98
+ id: '1',
99
+ name: 'Test',
100
+ price: 1,
101
+ description: '',
102
+ imageUrl: '',
103
+ } as any,
104
+ ],
107
105
  });
108
106
 
109
107
  expect(() => mountShop(vm)).not.toThrow();
@@ -112,7 +110,15 @@ describe('Shop', () => {
112
110
  it('does not throw when buttonStyles is undefined', () => {
113
111
  const vm = createViewModel({
114
112
  buttonStyles: undefined as any,
115
- products: [PRODUCT],
113
+ products: [
114
+ {
115
+ id: '1',
116
+ name: 'Test',
117
+ price: 1,
118
+ description: '',
119
+ imageUrl: '',
120
+ } as any,
121
+ ],
116
122
  });
117
123
 
118
124
  expect(() => mountShop(vm)).not.toThrow();
@@ -127,7 +133,15 @@ describe('Shop', () => {
127
133
  backgroundColor: 'rgb(0, 0, 255)',
128
134
  },
129
135
  }),
130
- products: [PRODUCT],
136
+ products: [
137
+ {
138
+ id: '1',
139
+ name: 'Test',
140
+ price: 1,
141
+ description: '',
142
+ imageUrl: '',
143
+ } as any,
144
+ ],
131
145
  });
132
146
 
133
147
  const wrapper = mountShop(vm);
@@ -139,71 +153,3 @@ describe('Shop', () => {
139
153
  });
140
154
  });
141
155
  });
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,6 +947,10 @@ 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
+
950
954
  styles: PageStyles;
951
955
 
952
956
  /** @deprecated */
@@ -462,6 +462,7 @@ exports[`migration.util > Banner Contents - text Align and Font Family should no
462
462
  },
463
463
  },
464
464
  },
465
+ "userPromptContentKey": undefined,
465
466
  "v": 19,
466
467
  },
467
468
  "useOldLogoRenderSize": true,
@@ -914,6 +915,7 @@ exports[`migration.util > migrateBrandPageModel should return brand page model w
914
915
  },
915
916
  },
916
917
  },
918
+ "userPromptContentKey": undefined,
917
919
  "v": 19,
918
920
  },
919
921
  "useOldLogoRenderSize": true,
@@ -1373,6 +1375,7 @@ exports[`migration.util > migrateBrandPageModel should return brand page model w
1373
1375
  },
1374
1376
  },
1375
1377
  },
1378
+ "userPromptContentKey": undefined,
1376
1379
  "v": 19,
1377
1380
  },
1378
1381
  "useOldLogoRenderSize": true,
@@ -478,6 +478,7 @@ exports[`migration02.ts > migration02 should return converted letterspacing 1`]
478
478
  },
479
479
  },
480
480
  },
481
+ "userPromptContentKey": undefined,
481
482
  "v": 0,
482
483
  },
483
484
  "useOldLogoRenderSize": false,
@@ -452,6 +452,7 @@ BrandPageModel {
452
452
  },
453
453
  },
454
454
  },
455
+ "userPromptContentKey": undefined,
455
456
  "v": 0,
456
457
  }
457
458
  `;
@@ -923,6 +924,7 @@ BrandPageModel {
923
924
  },
924
925
  },
925
926
  },
927
+ "userPromptContentKey": undefined,
926
928
  "v": 0,
927
929
  }
928
930
  `;
@@ -1819,6 +1819,7 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
1819
1819
  const navigationStyleSettingsStore = useUiNavigationStyleSettingsStore();
1820
1820
  const shopStore = useShopConfigStore();
1821
1821
  const pageNavigationStore = usePageNavigationStore();
1822
+ const uiStore = useUiStore();
1822
1823
 
1823
1824
  const pages = pageSettingsStore.pages.map((p) => ({
1824
1825
  ...p,
@@ -1836,6 +1837,7 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
1836
1837
 
1837
1838
  return {
1838
1839
  v: GetLatestModelVersion(),
1840
+ userPromptContentKey: uiStore.userPromptContentKey,
1839
1841
  pages,
1840
1842
  styles: {
1841
1843
  logoStyles,
@@ -50,7 +50,6 @@ 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',
54
53
  [TEMPLATE_TABS.categories]: 'MakerPrePurchaseSidebarTemplatesCategoryTab',
55
54
  };
56
55
  const LOAD_PAGE_RETRY_DELAY = 250;
@@ -422,7 +421,9 @@ export const useUiTemplateSettingsStore = defineStore('uiTemplateSettings', {
422
421
  contentKey =
423
422
  uiStore.personalisationData[personalisationContentIndex]
424
423
  .contentKey;
425
- } else if (item.isPersonalisable && !this.searchTerm) {
424
+ } else if (item.isPersonalisable) {
425
+ // Pre-purchase has no personalisationData; personalise AI
426
+ // template previews with the prompt content key (bp-5742).
426
427
  contentKey = uiStore.userPromptContentKey;
427
428
  }
428
429
 
@@ -434,8 +435,7 @@ export const useUiTemplateSettingsStore = defineStore('uiTemplateSettings', {
434
435
  // in the userPrompt bucket (post- or pre-purchase). The preview must
435
436
  // then resolve via userPromptContentKey, not the regular bucket which
436
437
  // holds placeholders post-purchase (bp-5454).
437
- usesUserPromptContentKey:
438
- !!uiStore.userPromptContentKey && !this.searchTerm,
438
+ usesUserPromptContentKey: !!uiStore.userPromptContentKey,
439
439
  previewImageUrl: item.previewImageUrl,
440
440
  } as TemplateSettingsTemplate;
441
441
  }
@@ -529,8 +529,6 @@ export const useUiTemplateSettingsStore = defineStore('uiTemplateSettings', {
529
529
  searchTerm: payload.searchTerm,
530
530
  });
531
531
 
532
- this.aiTemplateKeywords = payload.searchTerm ?? '';
533
-
534
532
  this.onSearchTermChanged?.(payload.searchTerm);
535
533
 
536
534
  await this._setPageNo({ pageNo: 1 });