@designcrowd/library.brand-page 6.2.1 → 6.2.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 (106) hide show
  1. package/lib/src/{CreatedOnBrandCrowd-de-de-CtvPtYF6.js → CreatedOnBrandCrowd-de-de-7P2gNr-R.js} +1 -1
  2. package/lib/src/{CreatedOnBrandCrowd-en-us-eGF-EjAX.js → CreatedOnBrandCrowd-en-us-Dl7BymW6.js} +1 -1
  3. package/lib/src/{CreatedOnBrandCrowd-es-es-CSemsOtT.js → CreatedOnBrandCrowd-es-es-CO4FvWVw.js} +1 -1
  4. package/lib/src/{CreatedOnBrandCrowd-fr-fr-DzylX-AT.js → CreatedOnBrandCrowd-fr-ca-DHNqakQu.js} +1 -1
  5. package/lib/src/{CreatedOnBrandCrowd-fr-ca-DzylX-AT.js → CreatedOnBrandCrowd-fr-fr-DHNqakQu.js} +1 -1
  6. package/lib/src/{CreatedOnBrandCrowd-pt-pt-QMUxXQsE.js → CreatedOnBrandCrowd-pt-br-CGUC-ZbP.js} +1 -1
  7. package/lib/src/{CreatedOnBrandCrowd-pt-br-QMUxXQsE.js → CreatedOnBrandCrowd-pt-pt-CGUC-ZbP.js} +1 -1
  8. package/lib/src/{CreatedOnDcom-de-de-M7OoJt-1.js → CreatedOnDcom-de-de-Dvds-Vmy.js} +1 -1
  9. package/lib/src/{CreatedOnDcom-en-us-D7hMM0AI.js → CreatedOnDcom-en-us-fd3C-8Tp.js} +1 -1
  10. package/lib/src/{CreatedOnDcom-es-es-CLw-BLp2.js → CreatedOnDcom-es-es-DTXZW35-.js} +1 -1
  11. package/lib/src/{CreatedOnDcom-fr-ca-BRu_kmeu.js → CreatedOnDcom-fr-ca-DRCYOKPs.js} +1 -1
  12. package/lib/src/{CreatedOnDcom-fr-fr-IMnEv_yM.js → CreatedOnDcom-fr-fr-DpIB8x2x.js} +1 -1
  13. package/lib/src/{CreatedOnDcom-pt-br-Bt6v1p27.js → CreatedOnDcom-pt-br-Esnxy8wX.js} +1 -1
  14. package/lib/src/{CreatedOnDcom-pt-pt-BVsFJIJg.js → CreatedOnDcom-pt-pt-CaiVHFXR.js} +1 -1
  15. package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.d.ts +7 -1
  16. package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.d.ts +6 -0
  17. package/lib/src/brand-page-maker/composables/useEventTracker.d.ts +3 -0
  18. package/lib/src/brand-page-maker/composables/useEventTracker.js +10 -0
  19. package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.js +2 -4
  20. package/lib/src/{bundled-translations-KY0aSmMp.js → bundled-translations-BYUfWBT3.js} +9 -9
  21. package/lib/src/{bundled-translations.de-DE-BIFi4bYj.js → bundled-translations.de-DE-MmzUu1tt.js} +13 -13
  22. package/lib/src/{bundled-translations.es-ES-CHlKuPLO.js → bundled-translations.es-ES-D-tG33XL.js} +1 -1
  23. package/lib/src/{bundled-translations.fr-CA-DR1fvm8e.js → bundled-translations.fr-CA-CNc1H1h3.js} +1 -1
  24. package/lib/src/{bundled-translations.fr-FR-DnpWVIQg.js → bundled-translations.fr-FR-DX0-yepT.js} +1 -1
  25. package/lib/src/{bundled-translations.pt-BR-p8szTOiT.js → bundled-translations.pt-BR-ih1-LRgy.js} +9 -9
  26. package/lib/src/{bundled-translations.pt-PT-DEk39NhW.js → bundled-translations.pt-PT-Dq2CmD1p.js} +1 -1
  27. package/lib/src/bundles/bundled-translations.de-DE.json +3 -1
  28. package/lib/src/bundles/bundled-translations.es-ES.json +3 -1
  29. package/lib/src/bundles/bundled-translations.fr-CA.json +3 -1
  30. package/lib/src/bundles/bundled-translations.fr-FR.json +3 -1
  31. package/lib/src/bundles/bundled-translations.json +3 -1
  32. package/lib/src/bundles/bundled-translations.pt-BR.json +3 -1
  33. package/lib/src/bundles/bundled-translations.pt-PT.json +3 -1
  34. package/lib/src/composables/useTranslate.d.ts +1 -1
  35. package/lib/src/composables/useTranslate.js +1 -1
  36. package/lib/src/css/library.brand-page-brandCrowd.min.css +4 -4
  37. package/lib/src/css/library.brand-page-brandPage.min.css +4 -4
  38. package/lib/src/css/library.brand-page-designCom.min.css +4 -4
  39. package/lib/src/css/library.brand-page-preview.min.css +4 -4
  40. package/lib/src/index.mjs +2 -2
  41. package/lib/src/{lib-B38VVCSw.js → lib-V7aqfuiB.js} +18106 -17965
  42. package/lib/src/metadata-builder/builders/item-id-utils.d.ts +2 -0
  43. package/lib/src/metadata-builder/builders/item-id-utils.js +8 -2
  44. package/lib/src/shared/content-settings/components/content-settings/ContentSettings.mixin.d.ts +8 -1
  45. package/lib/src/shared/content-settings/components/content-settings/ReplaceImageSettingsForContent.mixin.d.ts +6 -0
  46. package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItem.mixin.d.ts +1 -0
  47. package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.d.ts +5 -0
  48. package/lib/src/shared/content-settings/components/payment-config-field/PaymentConfigField.mixin.d.ts +5 -0
  49. package/lib/src/shared/ecommerce-settings/util/refreshDuplicatedMetadata.d.ts +9 -1
  50. package/lib/src/shared/ecommerce-settings/util/refreshDuplicatedMetadata.js +31 -9
  51. package/lib/src/shared/logo-settings/components/EditLogoSettings.mixin.d.ts +1 -0
  52. package/lib/src/shared/logo-settings/components/LogoSettings.mixin.d.ts +5 -0
  53. package/lib/src/shared/page-navigation/store/page-navigation-store.d.ts +2 -1
  54. package/lib/src/shared/page-navigation/store/page-navigation-store.js +22 -9
  55. package/lib/src/shared/page-settings/components/new-page-modal/NewPageModal.mixin.d.ts +7 -1
  56. package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.d.ts +10 -1
  57. package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.js +12 -35
  58. package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.d.ts +6 -0
  59. package/lib/src/shared/page-settings/duplicate-page.util.d.ts +4 -0
  60. package/lib/src/shared/page-settings/duplicate-page.util.js +82 -0
  61. package/lib/src/shared/page-settings/models.d.ts +1 -0
  62. package/lib/src/shared/page-settings/store/page-settings-store.d.ts +5 -0
  63. package/lib/src/shared/page-settings/store/page-settings-store.js +90 -7
  64. package/lib/src/shared/page-settings/utils.d.ts +3 -0
  65. package/lib/src/shared/page-settings/utils.js +6 -0
  66. package/lib/src/shared/publish-brand-page-with-state/PublishBrandPageModalWithState.mixin.d.ts +1 -0
  67. package/lib/src/shared/side-bar/components/SideBarTabButton.mixin.d.ts +1 -0
  68. package/lib/src/shared/style-settings/components/StyleSettings.mixin.d.ts +1 -0
  69. package/lib/src/shared/template-settings/components/TemplatesSettings.mixin.d.ts +1 -0
  70. package/lib/src/tracker.mjs +1 -1
  71. package/lib/src/{useEventTracker-C5Ql5p7u.js → useEventTracker-DwPTmzpa.js} +13 -3
  72. package/package.json +1 -1
  73. package/src/brand-page-maker/composables/useEventTracker.ts +13 -0
  74. package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.ts +2 -4
  75. package/src/bundles/bundled-translations.de-DE.json +3 -1
  76. package/src/bundles/bundled-translations.es-ES.json +3 -1
  77. package/src/bundles/bundled-translations.fr-CA.json +3 -1
  78. package/src/bundles/bundled-translations.fr-FR.json +3 -1
  79. package/src/bundles/bundled-translations.json +3 -1
  80. package/src/bundles/bundled-translations.pt-BR.json +3 -1
  81. package/src/bundles/bundled-translations.pt-PT.json +3 -1
  82. package/src/composables/useTranslate.ts +2 -1
  83. package/src/metadata-builder/builders/item-id-utils.ts +9 -2
  84. package/src/shared/ecommerce-settings/components/product-config-field/ProductConfigOption.vue +0 -2
  85. package/src/shared/ecommerce-settings/util/refreshDuplicatedMetadata.ts +32 -10
  86. package/src/shared/page-navigation/store/page-navigation-store.ts +41 -13
  87. package/src/shared/page-settings/components/page-settings/NestedDraggable.vue +3 -0
  88. package/src/shared/page-settings/components/page-settings/PageElement.vue +2 -0
  89. package/src/shared/page-settings/components/page-settings/PageSettingMenu.test.ts +105 -0
  90. package/src/shared/page-settings/components/page-settings/PageSettingMenu.vue +16 -0
  91. package/src/shared/page-settings/components/page-settings/PageSettings.duplicate.test.ts +108 -0
  92. package/src/shared/page-settings/components/page-settings/PageSettings.mixin.ts +22 -50
  93. package/src/shared/page-settings/components/page-settings/PageSettings.vue +1 -0
  94. package/src/shared/page-settings/components/page-settings/i18n/page-settings.de-DE.json +3 -1
  95. package/src/shared/page-settings/components/page-settings/i18n/page-settings.es-ES.json +3 -1
  96. package/src/shared/page-settings/components/page-settings/i18n/page-settings.fr-CA.json +3 -1
  97. package/src/shared/page-settings/components/page-settings/i18n/page-settings.fr-FR.json +3 -1
  98. package/src/shared/page-settings/components/page-settings/i18n/page-settings.json +3 -1
  99. package/src/shared/page-settings/components/page-settings/i18n/page-settings.pt-BR.json +3 -1
  100. package/src/shared/page-settings/components/page-settings/i18n/page-settings.pt-PT.json +3 -1
  101. package/src/shared/page-settings/duplicate-page.util.test.ts +382 -0
  102. package/src/shared/page-settings/duplicate-page.util.ts +124 -0
  103. package/src/shared/page-settings/models.ts +1 -0
  104. package/src/shared/page-settings/store/page-settings-store.test.ts +512 -1
  105. package/src/shared/page-settings/store/page-settings-store.ts +145 -11
  106. package/src/shared/page-settings/utils.ts +10 -0
@@ -20,11 +20,17 @@ import type {
20
20
  LogoTemplateImageModel,
21
21
  BrandPagePaymentConfig,
22
22
  BrandPagePaymentConfigCurrency,
23
+ NavOrder,
23
24
  NavRoute,
24
25
  } from '@brand-page';
25
26
  import { v4 as uuid } from 'uuid';
26
27
  import type { ContentPage } from '../models';
27
28
  import { PAGE_SECTIONS } from '../models';
29
+ import { toPageModels } from '../utils';
30
+ import {
31
+ duplicatePageContents,
32
+ getDuplicatePageTitle,
33
+ } from '../duplicate-page.util';
28
34
  import { navigateToPageByPageId } from '@brand-page-maker/routing';
29
35
  import { getPageSlugFromPageTitle } from '@brand-page-maker/utils';
30
36
  import { useUiContentSettingsStore } from '../../content-settings/store';
@@ -163,6 +169,71 @@ export const useUiPageSettingsStore = defineStore('uiPageSettings', {
163
169
  setPages({ pages }: { pages: ContentPage[] }): void {
164
170
  this.pages = pages;
165
171
  },
172
+ // `orders` is the hierarchy; `pages` is a flat list that has to match it
173
+ // depth-first, because row indexes drive the home check and the hide/delete
174
+ // gating. Anything reshaping orders should re-derive pages after - except
175
+ // addNewPage, which predates this and appends by visibility instead; the
176
+ // next drag-end catches it up.
177
+ syncPagesWithOrders(): void {
178
+ const pageNavigationStore = usePageNavigationStore();
179
+ const pageIdOrder: string[] = [];
180
+
181
+ const collectPageIds = (orders: NavOrder[]): void => {
182
+ for (const order of orders) {
183
+ const route = pageNavigationStore.routes.find(
184
+ (r) => r.id === order.routeId,
185
+ );
186
+
187
+ if (route?.pageId) {
188
+ pageIdOrder.push(route.pageId);
189
+ }
190
+
191
+ if (order.subRoutes?.length) {
192
+ collectPageIds(order.subRoutes);
193
+ }
194
+ }
195
+ };
196
+
197
+ collectPageIds(pageNavigationStore.orders);
198
+
199
+ if (!pageIdOrder.length) {
200
+ return;
201
+ }
202
+
203
+ const pageMap = new Map<string, ContentPage>(
204
+ this.pages.map((page) => [page.id, page]),
205
+ );
206
+
207
+ const orderedPages: ContentPage[] = [];
208
+
209
+ for (const pageId of pageIdOrder) {
210
+ const page = pageMap.get(pageId);
211
+
212
+ if (page) {
213
+ orderedPages.push(page);
214
+ pageMap.delete(pageId);
215
+ }
216
+ }
217
+
218
+ // A page with no route would otherwise vanish.
219
+ orderedPages.push(...pageMap.values());
220
+
221
+ this.setPages({ pages: orderedPages });
222
+ },
223
+ async showPageLimitUpgradeModalAsync(ctaLocation: string): Promise<void> {
224
+ const uiStore = useUiStore();
225
+ const eventTracker = useEventTracker();
226
+
227
+ eventTracker.setUpsellBridgeState({
228
+ cta_location: ctaLocation,
229
+ trigger_type: TRIGGER_TYPE.AUTOMATIC,
230
+ content_type: null,
231
+ });
232
+
233
+ await uiStore.showUpgradeModalAndSaveAsync(
234
+ WEBSITE_UPGRADE_CONTEXT_TYPES.AddPage,
235
+ );
236
+ },
166
237
  async setNewPageModalVisibilityAsync({
167
238
  isNewPageModalVisible,
168
239
  parentPageId,
@@ -170,18 +241,9 @@ export const useUiPageSettingsStore = defineStore('uiPageSettings', {
170
241
  isNewPageModalVisible: boolean;
171
242
  parentPageId?: string;
172
243
  }) {
173
- const uiStore = useUiStore();
174
- const eventTracker = useEventTracker();
175
-
176
244
  if (isNewPageModalVisible && !this.canAddPage) {
177
- eventTracker.setUpsellBridgeState({
178
- cta_location: UPGRADE_CTA_LOCATIONS.ADD_NEW_PAGE,
179
- trigger_type: TRIGGER_TYPE.AUTOMATIC,
180
- content_type: null,
181
- });
182
-
183
- await uiStore.showUpgradeModalAndSaveAsync(
184
- WEBSITE_UPGRADE_CONTEXT_TYPES.AddPage,
245
+ await this.showPageLimitUpgradeModalAsync(
246
+ UPGRADE_CTA_LOCATIONS.ADD_NEW_PAGE,
185
247
  );
186
248
 
187
249
  return;
@@ -477,6 +539,78 @@ export const useUiPageSettingsStore = defineStore('uiPageSettings', {
477
539
 
478
540
  return newPage;
479
541
  },
542
+ async duplicatePage({
543
+ pageId,
544
+ }: {
545
+ pageId: string;
546
+ }): Promise<ContentPage | undefined> {
547
+ const pageNavigationStore = usePageNavigationStore();
548
+
549
+ // Gate first: a paywalled duplicate must not leave a half-created page.
550
+ if (!this.canAddPage) {
551
+ await this.showPageLimitUpgradeModalAsync(
552
+ UPGRADE_CTA_LOCATIONS.DUPLICATE_PAGE,
553
+ );
554
+
555
+ return undefined;
556
+ }
557
+
558
+ const sourcePage = this.pages.find((page) => page.id === pageId);
559
+
560
+ const sourceRoute = pageNavigationStore.routes.find(
561
+ (route) => route.pageId === pageId,
562
+ );
563
+
564
+ if (!sourcePage || !sourceRoute) {
565
+ return undefined;
566
+ }
567
+
568
+ const parentRouteId = pageNavigationStore.getParentRouteIdForPage(pageId);
569
+
570
+ const title = getDuplicatePageTitle(
571
+ sourcePage.title,
572
+ pageNavigationStore.getDisplayNamesForDepth(parentRouteId),
573
+ Boolean(parentRouteId),
574
+ );
575
+
576
+ const newPage: ContentPage = {
577
+ id: uuid(),
578
+ title,
579
+ contents: duplicatePageContents(sourcePage.contents),
580
+ // A copy of a hidden page stays hidden, or it publishes into the nav.
581
+ isHidden: sourcePage.isHidden,
582
+ };
583
+
584
+ // addNavRoute navigates to the copy and reads its contents, so the page
585
+ // has to exist before the route does. syncPagesWithOrders places it.
586
+ this.setPages({ pages: [...this.pages, newPage] });
587
+
588
+ const newRoute: NavRoute = {
589
+ id: uuid(),
590
+ pageId: newPage.id,
591
+ pageSlug: getPageSlugFromPageTitle(
592
+ title,
593
+ pageNavigationStore.getPageSlugsForDepth(parentRouteId),
594
+ ),
595
+ isHidden: Boolean(sourceRoute.isHidden),
596
+ displayName: title,
597
+ };
598
+
599
+ pageNavigationStore.addNavRoute(newRoute, parentRouteId, sourceRoute.id);
600
+
601
+ this.syncPagesWithOrders();
602
+
603
+ // shopConfig.products is DERIVED from the shop blocks, not updated with
604
+ // them - without this the copy's fresh product ids never reach the save.
605
+ const shopConfigStore = useShopConfigStore();
606
+
607
+ shopConfigStore.initialiseShopStore({
608
+ paymentConfig: shopConfigStore.paymentConfig,
609
+ pages: toPageModels(this.pages),
610
+ });
611
+
612
+ return newPage;
613
+ },
480
614
  setSelectedSectionName({
481
615
  sectionName,
482
616
  }: {
@@ -1,8 +1,18 @@
1
+ import type { PageModel } from '@brand-page';
1
2
  import { errorTr } from '@src/composables/useTranslate';
3
+ import type { ContentPage } from './models';
2
4
 
3
5
  export const MAX_PAGE_TITLE_LENGTH = 30;
4
6
  export const MAX_SUBPAGE_TITLE_LENGTH = 20;
5
7
 
8
+ // The maker holds a page's sections as ContentItems (settings wrapper + content);
9
+ // everything that consumes a BrandPageModel wants the bare content.
10
+ export const toPageModels = (pages: ContentPage[]): PageModel[] =>
11
+ pages.map((page) => ({
12
+ ...page,
13
+ contents: page.contents.map((item) => item.settings.content),
14
+ })) as PageModel[];
15
+
6
16
  export const getPageTitleError = (
7
17
  pageTitle: string,
8
18
  isSubPage: boolean,