@designcrowd/library.brand-page 6.1.14 → 6.1.15
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.
- package/lib/src/{CreatedOnBrandCrowd-de-de-CNqGW-GB.js → CreatedOnBrandCrowd-de-de-a7cNT5AA.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-BWZeor_R.js → CreatedOnBrandCrowd-en-us-BpZ89I9T.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-D_-5Qdpd.js → CreatedOnBrandCrowd-es-es-Db0Ot-mQ.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-BC6Xo2uA.js → CreatedOnBrandCrowd-fr-ca-Mbd7Hhxh.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-BC6Xo2uA.js → CreatedOnBrandCrowd-fr-fr-Mbd7Hhxh.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-D10DwNv3.js → CreatedOnBrandCrowd-pt-br-B98aoT6y.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-D10DwNv3.js → CreatedOnBrandCrowd-pt-pt-B98aoT6y.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-BDHrHOOB.js → CreatedOnDcom-de-de-b_GUYmhX.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-EbniAwLE.js → CreatedOnDcom-en-us-BtTIwekM.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-BpAIMuUH.js → CreatedOnDcom-es-es-WbhHNEg-.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-BDSu4efU.js → CreatedOnDcom-fr-ca-DnQOAvS5.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-BR7f1SWB.js → CreatedOnDcom-fr-fr-D7Q-aBNQ.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-DzY1XBcr.js → CreatedOnDcom-pt-br-DnqkF_ve.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-1v5N9vgW.js → CreatedOnDcom-pt-pt-DNyyHF1o.js} +1 -1
- package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.js +4 -1
- package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.d.ts +3 -0
- package/lib/src/brand-page-maker/composables/useEventTracker.d.ts +15 -0
- package/lib/src/brand-page-maker/composables/useEventTracker.js +36 -0
- package/lib/src/index.mjs +2 -2
- package/lib/src/{lib-BMP5cseh.js → lib-33AmrlUy.js} +14282 -14271
- package/lib/src/metadata-builder/builders/reorder-pages-builder.d.ts +13 -0
- package/lib/src/metadata-builder/builders/reorder-pages-builder.js +49 -0
- package/lib/src/shared/content-settings/components/content-settings/ContentSettings.mixin.d.ts +3 -0
- package/lib/src/shared/content-settings/components/content-settings/ReplaceImageSettingsForContent.mixin.d.ts +3 -0
- package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItem.mixin.d.ts +3 -0
- package/lib/src/shared/logo-settings/components/EditLogoSettings.mixin.d.ts +3 -0
- package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.d.ts +3 -0
- package/lib/src/shared/publish-brand-page-with-state/PublishBrandPageModalWithState.mixin.d.ts +3 -0
- package/lib/src/shared/side-bar/components/SideBarTabButton.mixin.d.ts +3 -0
- package/lib/src/shared/style-settings/components/StyleSettings.mixin.d.ts +3 -0
- package/lib/src/shared/template-settings/components/TemplatesSettings.mixin.d.ts +3 -0
- package/lib/src/tracker.d.ts +1 -1
- package/lib/src/tracker.js +1 -1
- package/lib/src/tracker.mjs +9 -7
- package/lib/src/{useEventTracker-Dmc2jFdN.js → useEventTracker-C5Ql5p7u.js} +56 -22
- package/package.json +1 -1
- package/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.ts +9 -1
- package/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.preview-gate.test.ts +38 -1
- package/src/brand-page-maker/components/preview-modal/PreviewModalWithState.test.ts +123 -0
- package/src/brand-page-maker/components/preview-modal/PreviewModalWithState.vue +25 -0
- package/src/brand-page-maker/composables/useEventTracker.ts +41 -0
- package/src/metadata-builder/builders/reorder-pages-builder.ts +80 -0
- package/src/tracker.ts +2 -0
|
@@ -74,6 +74,24 @@ export const EVENTS = {
|
|
|
74
74
|
WEBSITE_MAKER_REDO: 'website_maker_redo',
|
|
75
75
|
WEBSITE_MAKER_HISTORY_CAPPED: 'website_maker_history_capped',
|
|
76
76
|
WEBSITE_MAKER_HISTORY_OVERSIZED: 'website_maker_history_oversized',
|
|
77
|
+
WEBSITE_MAKER_LIVE_PREVIEW_CLICK: 'website_maker_live_preview_click',
|
|
78
|
+
WEBSITE_MAKER_LIVE_PREVIEW_MODAL: 'website_maker_live_preview_modal',
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
// The global `location` prop already means pre/post purchase, so the surface a
|
|
82
|
+
// preview was launched from rides on cta_location, reusing existing values.
|
|
83
|
+
export const PREVIEW_CTA_LOCATIONS = {
|
|
84
|
+
MAKER: 'maker',
|
|
85
|
+
MANAGE_WEBSITE: 'manage_website',
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export const PREVIEW_MODAL_CONTINUATION_EVENTS = {
|
|
89
|
+
EXIT: 'exit',
|
|
90
|
+
// The same button reads "Back to Editor" on the editor and "Edit" on other
|
|
91
|
+
// surfaces — the continuation mirrors the label the user actually clicked.
|
|
92
|
+
BACK_TO_EDITOR: 'back_to_editor',
|
|
93
|
+
EDIT: 'edit',
|
|
94
|
+
PUBLISH: 'publish',
|
|
77
95
|
};
|
|
78
96
|
|
|
79
97
|
export const SELECT_LOCATIONS = {
|
|
@@ -426,6 +444,29 @@ const useEventTracker = () => {
|
|
|
426
444
|
is_enabled: isEnabled,
|
|
427
445
|
});
|
|
428
446
|
},
|
|
447
|
+
// Live preview: the click is tracked separately from the modal opening —
|
|
448
|
+
// sign-in/save gating means a click doesn't always open the modal, and the
|
|
449
|
+
// post-sign-in return trip opens it without a click.
|
|
450
|
+
sendPreviewClickEvent: (ctaLocation: string) => {
|
|
451
|
+
_publishEvent(EVENTS.WEBSITE_MAKER_LIVE_PREVIEW_CLICK, {
|
|
452
|
+
cta_location: ctaLocation,
|
|
453
|
+
});
|
|
454
|
+
},
|
|
455
|
+
sendPreviewModalOpenEvent: (ctaLocation: string) => {
|
|
456
|
+
_publishEvent(EVENTS.WEBSITE_MAKER_LIVE_PREVIEW_MODAL, {
|
|
457
|
+
cta_location: ctaLocation,
|
|
458
|
+
continuation: null,
|
|
459
|
+
});
|
|
460
|
+
},
|
|
461
|
+
sendPreviewModalContinuationEvent: (
|
|
462
|
+
continuation: string,
|
|
463
|
+
ctaLocation: string,
|
|
464
|
+
) => {
|
|
465
|
+
_publishEvent(EVENTS.WEBSITE_MAKER_LIVE_PREVIEW_MODAL, {
|
|
466
|
+
cta_location: ctaLocation,
|
|
467
|
+
continuation,
|
|
468
|
+
});
|
|
469
|
+
},
|
|
429
470
|
// Undo / Redo (BP-5506)
|
|
430
471
|
sendUndoEvent: (props: {
|
|
431
472
|
entries_count: number;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { BrandPageModel, NavOrder } from '../../brand-page/models';
|
|
2
|
+
import {
|
|
3
|
+
BaseMetadataBuilder,
|
|
4
|
+
type BuilderResult,
|
|
5
|
+
type MetadataBuilderRequest,
|
|
6
|
+
} from '../models';
|
|
7
|
+
import type { Logger } from '../logger';
|
|
8
|
+
|
|
9
|
+
export interface ReorderPagesPayload {
|
|
10
|
+
pageOrder: string[];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export class ReorderPagesBuilder extends BaseMetadataBuilder<ReorderPagesPayload> {
|
|
14
|
+
constructor(
|
|
15
|
+
request: MetadataBuilderRequest<ReorderPagesPayload>,
|
|
16
|
+
logger?: Logger,
|
|
17
|
+
) {
|
|
18
|
+
super(request, logger);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async validateAsync(): Promise<{ errors: string[] }> {
|
|
22
|
+
const errors: string[] = [];
|
|
23
|
+
const payload = this.request.payload;
|
|
24
|
+
|
|
25
|
+
if (!payload?.pageOrder?.length) {
|
|
26
|
+
errors.push('page_order is required for reorder_pages');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return { errors };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async buildAsync(model: BrandPageModel): Promise<BuilderResult> {
|
|
33
|
+
this.log('Build called');
|
|
34
|
+
|
|
35
|
+
const validation = await this.validateAsync();
|
|
36
|
+
|
|
37
|
+
if (validation.errors.length) {
|
|
38
|
+
return { request: this.request, model, errors: validation.errors };
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const { pageOrder } = this.request.payload!;
|
|
42
|
+
|
|
43
|
+
// Build pageId → routeId lookup from nav.routes
|
|
44
|
+
const pageIdToRouteId = new Map<string, string>();
|
|
45
|
+
|
|
46
|
+
for (const route of model.nav.routes) {
|
|
47
|
+
pageIdToRouteId.set(route.pageId, route.id);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Build new nav.orders from the flat page_order (array of pageIds)
|
|
51
|
+
const newOrders: NavOrder[] = [];
|
|
52
|
+
const seenRouteIds = new Set<string>();
|
|
53
|
+
|
|
54
|
+
for (const pageId of pageOrder) {
|
|
55
|
+
const routeId = pageIdToRouteId.get(pageId);
|
|
56
|
+
|
|
57
|
+
if (!routeId) continue;
|
|
58
|
+
|
|
59
|
+
newOrders.push({ routeId, subRoutes: [] });
|
|
60
|
+
seenRouteIds.add(routeId);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Safety: append any routes not mentioned (don't lose pages)
|
|
64
|
+
for (const route of model.nav.routes) {
|
|
65
|
+
const routeId = pageIdToRouteId.get(route.pageId);
|
|
66
|
+
|
|
67
|
+
if (routeId && !seenRouteIds.has(routeId)) {
|
|
68
|
+
newOrders.push({ routeId, subRoutes: [] });
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
model.nav.orders = newOrders;
|
|
73
|
+
|
|
74
|
+
this.log({
|
|
75
|
+
message: `Reordered pages: ${pageOrder.join(', ')}`,
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
return { request: this.request, model };
|
|
79
|
+
}
|
|
80
|
+
}
|
package/src/tracker.ts
CHANGED
|
@@ -19,6 +19,8 @@ export {
|
|
|
19
19
|
PUBLISH_MODAL_CONTINUATION_EVENTS,
|
|
20
20
|
GENERATE_TEXT_CONTINUATION_EVENTS,
|
|
21
21
|
PUBLISH_OPTION_MODAL_CONTINUATION_EVENTS,
|
|
22
|
+
PREVIEW_CTA_LOCATIONS,
|
|
23
|
+
PREVIEW_MODAL_CONTINUATION_EVENTS,
|
|
22
24
|
} from './brand-page-maker/composables/useEventTracker';
|
|
23
25
|
export type {
|
|
24
26
|
EventTracker,
|