@designcrowd/library.brand-page 6.2.2-live-preview-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 (43) hide show
  1. package/lib/src/{CreatedOnBrandCrowd-de-de-Cn0M-eZ1.js → CreatedOnBrandCrowd-de-de-7P2gNr-R.js} +1 -1
  2. package/lib/src/{CreatedOnBrandCrowd-en-us-DRLMSDZr.js → CreatedOnBrandCrowd-en-us-Dl7BymW6.js} +1 -1
  3. package/lib/src/{CreatedOnBrandCrowd-es-es-BglTu73U.js → CreatedOnBrandCrowd-es-es-CO4FvWVw.js} +1 -1
  4. package/lib/src/{CreatedOnBrandCrowd-fr-fr-Bj6YZ_el.js → CreatedOnBrandCrowd-fr-ca-DHNqakQu.js} +1 -1
  5. package/lib/src/{CreatedOnBrandCrowd-fr-ca-Bj6YZ_el.js → CreatedOnBrandCrowd-fr-fr-DHNqakQu.js} +1 -1
  6. package/lib/src/{CreatedOnBrandCrowd-pt-pt-DEoOmQ1F.js → CreatedOnBrandCrowd-pt-br-CGUC-ZbP.js} +1 -1
  7. package/lib/src/{CreatedOnBrandCrowd-pt-br-DEoOmQ1F.js → CreatedOnBrandCrowd-pt-pt-CGUC-ZbP.js} +1 -1
  8. package/lib/src/{CreatedOnDcom-de-de-BZ7gTt4Z.js → CreatedOnDcom-de-de-Dvds-Vmy.js} +1 -1
  9. package/lib/src/{CreatedOnDcom-en-us-CD6Km5sH.js → CreatedOnDcom-en-us-fd3C-8Tp.js} +1 -1
  10. package/lib/src/{CreatedOnDcom-es-es-CNpZHvEl.js → CreatedOnDcom-es-es-DTXZW35-.js} +1 -1
  11. package/lib/src/{CreatedOnDcom-fr-ca-URS-ydJ1.js → CreatedOnDcom-fr-ca-DRCYOKPs.js} +1 -1
  12. package/lib/src/{CreatedOnDcom-fr-fr-D2AVeA3H.js → CreatedOnDcom-fr-fr-DpIB8x2x.js} +1 -1
  13. package/lib/src/{CreatedOnDcom-pt-br-C32frnFs.js → CreatedOnDcom-pt-br-Esnxy8wX.js} +1 -1
  14. package/lib/src/{CreatedOnDcom-pt-pt-TDYGjRXS.js → CreatedOnDcom-pt-pt-CaiVHFXR.js} +1 -1
  15. package/lib/src/brand-page/models/brand-page-context.model.d.ts +2 -0
  16. package/lib/src/brand-page/models/brand-page-context.model.js +12 -0
  17. package/lib/src/brand-page-maker/components/action-bar/ActionBar.mixin.d.ts +1 -0
  18. package/lib/src/brand-page-maker/components/action-bar/ActionBar.mixin.js +9 -0
  19. package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.d.ts +42 -0
  20. package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.d.ts +42 -0
  21. package/lib/src/brand-page-maker/components/preview/Preview.mixin.d.ts +14 -0
  22. package/lib/src/brand-page-maker/components/quick-link-bar/QuickLinkBar.mixin.d.ts +42 -0
  23. package/lib/src/brand-page-maker/components/seo-settings/SeoPageSettings.mixin.d.ts +42 -0
  24. package/lib/src/brand-page-maker/components/seo-settings/UrlSettings.mixin.d.ts +42 -0
  25. package/lib/src/brand-page-maker/components/seo-settings/UseExistingDomainModal.mixin.d.ts +42 -0
  26. package/lib/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.d.ts +42 -0
  27. package/lib/src/brand-page-maker/components/upgrade-to-premium-button/UpgradeToPremiumButton.mixin.d.ts +42 -0
  28. package/lib/src/brand-page-maker/stores/brandpage-container/brand-page-container-store.d.ts +42 -0
  29. package/lib/src/index.mjs +1 -1
  30. package/lib/src/{lib-Dm9AuOJL.js → lib-V7aqfuiB.js} +10906 -10891
  31. package/lib/src/shared/content-settings/components/payment-config-field/PaymentConfigField.mixin.d.ts +42 -0
  32. package/lib/src/shared/logo-settings/components/LogoSettings.mixin.d.ts +42 -0
  33. package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.d.ts +42 -0
  34. package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.d.ts +42 -0
  35. package/lib/src/shared/publish-brand-page-with-state/PublishBrandPageModalWithState.mixin.d.ts +56 -0
  36. package/lib/src/shared/side-bar/components/SideBar.mixin.d.ts +42 -0
  37. package/lib/src/shared/style-settings/components/StyleSettings.mixin.d.ts +42 -0
  38. package/package.json +1 -1
  39. package/src/brand-page/models/brand-page-context.model.ts +23 -0
  40. package/src/brand-page-maker/components/action-bar/ActionBar.mixin.ts +10 -0
  41. package/src/brand-page-maker/components/action-bar/ActionBarNavigation.test.ts +49 -8
  42. package/src/brand-page-maker/components/action-bar/ActionBarNavigation.vue +1 -1
  43. package/src/shared/page-settings/store/page-settings-store.test.ts +71 -0
@@ -22,6 +22,7 @@ import { setLocaleAsync } from '@src/composables/useTranslate';
22
22
  import { usePageNavigationStore } from '@src/shared/page-navigation/store/page-navigation-store';
23
23
  import { useShopConfigStore } from '@shared/ecommerce-settings/store/shop-settings-store';
24
24
  import { useEventTracker } from '@brand-page-maker/composables/useEventTracker';
25
+ import { useHistoryStore } from '@brand-page-maker/stores/history/history-store';
25
26
  import { toPageModels } from '../utils';
26
27
 
27
28
  vi.mock('../../../clients/brand-page-client', () => ({
@@ -677,6 +678,53 @@ describe('duplicatePage', () => {
677
678
  ).toBe(true);
678
679
  });
679
680
 
681
+ test("deleting the copy's product leaves the source's product alone", async () => {
682
+ // The consequence the id rotation exists to prevent. `deleteProduct` filters
683
+ // the site-wide catalogue BY ID, so a copy that kept the source's ids would
684
+ // take the original's row down with it - silently, until the next save.
685
+ const { pageSettingsStore } = await initialiseAsync();
686
+ const shopConfigStore = useShopConfigStore();
687
+
688
+ const source = pageSettingsStore.addNewPage({ title: 'Shop' });
689
+
690
+ pageSettingsStore.setPageContents({
691
+ pageId: source.id,
692
+ contents: [
693
+ {
694
+ id: 'shop-1',
695
+ type: 'shop-section',
696
+ settings: {
697
+ content: {
698
+ id: 'shop-1',
699
+ type: 'shop-section',
700
+ products: [
701
+ { id: 'product-1', name: 'Latte', variant: [], skus: [] },
702
+ ],
703
+ shopPaymentConfig: { paymentConfig: { id: 'stripe-1' } },
704
+ },
705
+ },
706
+ } as unknown as ContentItem<Content>,
707
+ ],
708
+ });
709
+
710
+ shopConfigStore.initialiseShopStore({
711
+ paymentConfig: { id: 'stripe-1' } as never,
712
+ pages: toPageModels(pageSettingsStore.pages) as never,
713
+ });
714
+
715
+ const copy = await pageSettingsStore.duplicatePage({ pageId: source.id });
716
+
717
+ const copyProductId = (
718
+ copy?.contents[0].settings.content as unknown as {
719
+ products: { id: string }[];
720
+ }
721
+ ).products[0].id;
722
+
723
+ shopConfigStore.deleteProduct(copyProductId);
724
+
725
+ expect(shopConfigStore.products.map((p) => p.id)).toEqual(['product-1']);
726
+ });
727
+
680
728
  test('adds the copy shop products to the site-wide catalogue', async () => {
681
729
  // The catalogue is derived from the shop blocks and is what the save
682
730
  // upserts. Without a re-derive the copy's fresh product ids never reach the
@@ -723,6 +771,29 @@ describe('duplicatePage', () => {
723
771
  expect(shopConfigStore.paymentConfig?.id).toEqual('stripe-1');
724
772
  });
725
773
 
774
+ test('undo removes both halves of a duplicate', async () => {
775
+ // duplicatePage writes to two stores - the page into page-settings, the
776
+ // route into page-navigation. A snapshot that caught only one would leave
777
+ // an orphan behind on undo.
778
+ const { pageSettingsStore, pageNavigationStore } = await initialiseAsync();
779
+ const historyStore = useHistoryStore();
780
+
781
+ const source = pageSettingsStore.addNewPage({ title: 'About' });
782
+
783
+ historyStore.captureBaseline();
784
+
785
+ const copy = await pageSettingsStore.duplicatePage({ pageId: source.id });
786
+
787
+ historyStore.capture({ source: 'manual_edit', actor: 'user' });
788
+
789
+ await historyStore.undo();
790
+
791
+ expect(pageSettingsStore.pages.map((p) => p.id)).not.toContain(copy?.id);
792
+ expect(pageNavigationStore.routes.some((r) => r.pageId === copy?.id)).toBe(
793
+ false,
794
+ );
795
+ });
796
+
726
797
  test('is a no-op for an unknown page id', async () => {
727
798
  const { pageSettingsStore } = await initialiseAsync();
728
799