@designcrowd/library.brand-page 5.18.3-undo-38 → 5.18.3
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-ydEGYl5O.js → CreatedOnBrandCrowd-de-de-CkuAAwKQ.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-BiJ8RmwM.js → CreatedOnBrandCrowd-en-us-Coln5kSU.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-C8CyL1ny.js → CreatedOnBrandCrowd-es-es-raGyXChm.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-BMh0yIJJ.js → CreatedOnBrandCrowd-fr-ca-BT_WYYxW.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-BMh0yIJJ.js → CreatedOnBrandCrowd-fr-fr-BT_WYYxW.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-C0DghlQk.js → CreatedOnBrandCrowd-pt-br-BRbD_kiI.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-C0DghlQk.js → CreatedOnBrandCrowd-pt-pt-BRbD_kiI.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-CZEnW0qm.js → CreatedOnDcom-de-de-DetCIFxa.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-DPpRkfrD.js → CreatedOnDcom-en-us-D0LeF_V2.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-8yTtB23v.js → CreatedOnDcom-es-es-CHa4stWS.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-DdGwSBLy.js → CreatedOnDcom-fr-ca-ntW7A335.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-DRGbffC4.js → CreatedOnDcom-fr-fr-C6rQcclc.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-CWm_1vbQ.js → CreatedOnDcom-pt-br-Cn07ZK_m.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-DZBR79tn.js → CreatedOnDcom-pt-pt-CewmqYVY.js} +1 -1
- package/lib/src/brand-page-maker/components/action-bar/ActionBar.mixin.d.ts +2 -7
- package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.d.ts +2 -7
- package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.js +0 -10
- package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMakerTemplateSettings.mixin.d.ts +2 -7
- package/lib/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-page-examples.js +0 -1
- package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.d.ts +2 -87
- package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.js +0 -5
- package/lib/src/brand-page-maker/components/brandpage-settings/ReplaceImageSettingsForBrandPageSettings.mixin.d.ts +2 -7
- package/lib/src/brand-page-maker/components/quick-link-bar/QuickLinkBar.mixin.d.ts +0 -3
- package/lib/src/brand-page-maker/components/quick-link-bar/QuickLinkBar.mixin.js +0 -11
- package/lib/src/brand-page-maker/components/seo-settings/SeoPageSettings.mixin.d.ts +2 -7
- package/lib/src/brand-page-maker/components/seo-settings/UrlSettings.mixin.d.ts +2 -7
- package/lib/src/brand-page-maker/components/social-share/SocialShare.mixin.d.ts +2 -7
- package/lib/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.d.ts +2 -7
- package/lib/src/brand-page-maker/composables/ai-chat/useAiWebsiteBuilderChat.js +0 -9
- package/lib/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.js +1 -20
- package/lib/src/brand-page-maker/composables/useEventTracker.d.ts +0 -20
- package/lib/src/brand-page-maker/composables/useEventTracker.js +0 -17
- package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.d.ts +2 -41
- package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.js +5 -307
- package/lib/src/brand-page-maker/stores/logo-store/logo-store.d.ts +0 -1
- package/lib/src/brand-page-maker/stores/user/user-store.js +0 -1
- package/lib/src/bundled-translations-B5Fkt3qd.js +175 -0
- package/lib/src/bundles/bundled-translations.json +1 -3
- package/lib/src/constants/ui.d.ts +0 -1
- package/lib/src/css/library.brand-page-brandCrowd.min.css +15 -20
- package/lib/src/css/library.brand-page-brandPage.min.css +16 -20
- package/lib/src/css/library.brand-page-designCom.min.css +15 -20
- package/lib/src/css/library.brand-page-preview.min.css +15 -20
- package/lib/src/index.mjs +1 -1
- package/lib/src/{lib-BZlXQjdd.js → lib-CGfmcIBb.js} +29373 -29970
- package/lib/src/shared/content-settings/components/content-settings/ContentSettings.mixin.d.ts +2 -87
- package/lib/src/shared/content-settings/components/content-settings/ContentSettings.mixin.js +0 -5
- package/lib/src/shared/content-settings/components/content-settings/ContentSettings.stories.js +0 -1
- package/lib/src/shared/content-settings/components/content-settings/ReplaceImageSettingsForContent.mixin.d.ts +2 -23
- package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItem.mixin.d.ts +0 -16
- package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.d.ts +2 -7
- package/lib/src/shared/content-settings/components/draggable-item-list/DraggableItemList.mixin.d.ts +0 -3
- package/lib/src/shared/content-settings/components/draggable-item-list/DraggableItemList.mixin.js +2 -19
- package/lib/src/shared/content-settings/components/form-fields-field/FormFieldsField.mixin.js +8 -18
- package/lib/src/shared/content-settings/components/payment-config-field/PaymentConfigField.mixin.d.ts +0 -64
- package/lib/src/shared/content-settings/components/payment-config-field/PaymentConfigField.mixin.js +0 -6
- package/lib/src/shared/logo-settings/components/EditLogoSettings.mixin.d.ts +0 -19
- package/lib/src/shared/logo-settings/components/EditLogoSettings.mixin.js +0 -11
- package/lib/src/shared/logo-settings/components/LogoSettings.mixin.d.ts +2 -10
- package/lib/src/shared/logo-settings/store/editable-logo-store.d.ts +1 -5
- package/lib/src/shared/logo-settings/store/editable-logo-store.js +0 -31
- package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.d.ts +2 -24
- package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.d.ts +2 -10
- package/lib/src/shared/publish-brand-page-with-state/PublishBrandPageModalWithState.mixin.d.ts +2 -23
- package/lib/src/shared/side-bar/components/SideBarTabButton.mixin.d.ts +0 -16
- package/lib/src/shared/style-settings/components/StyleSettings.mixin.d.ts +2 -23
- package/lib/src/shared/template-settings/components/TemplatesSettings.mixin.d.ts +0 -16
- package/package.json +1 -1
- package/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.ts +0 -11
- package/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.vue +3 -2
- package/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-page-examples.ts +0 -1
- package/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.ts +0 -5
- package/src/brand-page-maker/components/cookie-collection/CookieSettings.vue +17 -18
- package/src/brand-page-maker/components/quick-link-bar/QuickLinkBar.mixin.ts +0 -13
- package/src/brand-page-maker/components/quick-link-bar/QuickLinkBar.vue +3 -26
- package/src/brand-page-maker/components/quick-link-bar/i18n/quick-link-bar.json +1 -3
- package/src/brand-page-maker/components/save-contact/SaveContact.vue +19 -12
- package/src/brand-page-maker/composables/ai-chat/useAiWebsiteBuilderChat.ts +0 -10
- package/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.ts +1 -24
- package/src/brand-page-maker/composables/useEventTracker.ts +0 -29
- package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.test.ts +0 -335
- package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.ts +4 -371
- package/src/brand-page-maker/stores/logo-store/logo-store.ts +0 -5
- package/src/brand-page-maker/stores/user/user-store.ts +0 -1
- package/src/bundles/bundled-translations.json +1 -3
- package/src/constants/ui.ts +0 -1
- package/src/shared/content-settings/components/content-settings/ContentSettings.mixin.ts +0 -5
- package/src/shared/content-settings/components/content-settings/ContentSettings.stories.ts +0 -1
- package/src/shared/content-settings/components/draggable-item-list/DraggableItemList.mixin.ts +2 -19
- package/src/shared/content-settings/components/draggable-item-list/DraggableItemList.vue +1 -1
- package/src/shared/content-settings/components/form-fields-field/FormFieldsField.mixin.ts +10 -26
- package/src/shared/content-settings/components/logo-selection-field/LogoSelection.vue +48 -63
- package/src/shared/content-settings/components/page-dropdown-field/PageDropdownField.vue +0 -4
- package/src/shared/content-settings/components/payment-config-field/PaymentConfigField.mixin.ts +0 -7
- package/src/shared/content-settings/components/text-field/TextField.vue +0 -1
- package/src/shared/content-settings/components/text-image-field/TextImageField.vue +4 -33
- package/src/shared/logo-settings/components/EditLogoSettings.mixin.ts +0 -11
- package/src/shared/logo-settings/store/editable-logo-store.ts +1 -42
- package/lib/src/brand-page-maker/composables/useUndoRedoFlag.d.ts +0 -16
- package/lib/src/brand-page-maker/composables/useUndoRedoFlag.js +0 -22
- package/lib/src/brand-page-maker/stores/history/history-store.d.ts +0 -83
- package/lib/src/brand-page-maker/stores/history/history-store.js +0 -495
- package/lib/src/bundled-translations-D1q3rSEz.js +0 -175
- package/lib/src/metadata-builder/builders/reorder-pages-builder.d.ts +0 -13
- package/lib/src/metadata-builder/builders/reorder-pages-builder.js +0 -49
- package/src/brand-page-maker/components/quick-link-bar/RedoButton.vue +0 -66
- package/src/brand-page-maker/components/quick-link-bar/UndoButton.vue +0 -66
- package/src/brand-page-maker/components/quick-link-bar/undo-redo-buttons.test.ts +0 -116
- package/src/brand-page-maker/composables/useUndoRedoFlag.ts +0 -26
- package/src/brand-page-maker/stores/history/history-store.test.ts +0 -1120
- package/src/brand-page-maker/stores/history/history-store.ts +0 -660
- package/src/metadata-builder/builders/reorder-pages-builder.ts +0 -80
|
@@ -21,7 +21,6 @@ import { buildInitialMarks, emToPx, isStyleChanged, pxToEm, sanitiseClientSideRT
|
|
|
21
21
|
import { HYPERLINK_TYPE, } from '@brand-page';
|
|
22
22
|
import { letterSpacingValueConvertor, colorConvertor, backgroundColorConvertor, } from '@brand-page-maker/convertors';
|
|
23
23
|
import { useUiContentSettingsStore } from '@shared/content-settings/store';
|
|
24
|
-
import { useHistoryStore } from '@brand-page-maker/stores/history/history-store';
|
|
25
24
|
import { AllSelection } from 'prosemirror-state';
|
|
26
25
|
import { MaxLength } from './extensions/MaxLength';
|
|
27
26
|
import { AutoLink } from './extensions/AutoLink';
|
|
@@ -73,10 +72,6 @@ export const useExternalRichTextEditor = () => {
|
|
|
73
72
|
};
|
|
74
73
|
};
|
|
75
74
|
export const useRichTextEditor = (model, props, emit, fontSettings, fontStyleDropdownRef, selectedGlobalTextStyles, onSelectTextStyleType, updateRichTextEditor, textStyleTypeOptions, markedText, isHyperlinkPopupOpen, selectedLinkTypeValue) => {
|
|
76
|
-
const historyStore = useHistoryStore();
|
|
77
|
-
// TipTap rehydrates and writes back canonical HTML on mount — fold
|
|
78
|
-
// that into the current head instead of pushing a phantom entry.
|
|
79
|
-
historyStore.mergeNextMutation();
|
|
80
75
|
const editor = new Editor({
|
|
81
76
|
content: model.value ?? '',
|
|
82
77
|
editable: !props.readOnly,
|
|
@@ -234,14 +229,7 @@ export const useRichTextEditor = (model, props, emit, fontSettings, fontStyleDro
|
|
|
234
229
|
}
|
|
235
230
|
});
|
|
236
231
|
watch(() => model.value, (newValue) => {
|
|
237
|
-
|
|
238
|
-
// (history undo/redo, template switch, reorder). `!editor.isFocused`
|
|
239
|
-
// distinguishes "external mutation" from "user is typing in me" — the
|
|
240
|
-
// latter would wipe the user's cursor if we called setContent.
|
|
241
|
-
// `updateRichTextEditor.value` is retained as an explicit override for
|
|
242
|
-
// callers (reorder) that need to force a re-seed while focused.
|
|
243
|
-
const isExternalMutation = updateRichTextEditor.value || !editor.isFocused;
|
|
244
|
-
if (isExternalMutation && editor.getHTML() !== newValue) {
|
|
232
|
+
if (updateRichTextEditor.value && editor.getHTML() !== newValue) {
|
|
245
233
|
editor.commands.setContent(newValue, false);
|
|
246
234
|
updateRichTextEditor.value = false;
|
|
247
235
|
//text style type is not switching when reordering
|
|
@@ -268,13 +256,6 @@ export const useRichTextEditor = (model, props, emit, fontSettings, fontStyleDro
|
|
|
268
256
|
emit('update:modelValue', sanitizedData.sanitizedHtml);
|
|
269
257
|
});
|
|
270
258
|
editor.on('selectionUpdate', () => {
|
|
271
|
-
// Skip while a history snapshot is being applied — `setContent` fires
|
|
272
|
-
// selectionUpdate before the editor has fully rehydrated, which causes
|
|
273
|
-
// toolbar buttons (alignment, letter-spacing) to flash through bogus
|
|
274
|
-
// active states before settling. The editor emits a final selectionUpdate
|
|
275
|
-
// after apply completes, which lands the correct values (BP-5506).
|
|
276
|
-
if (historyStore.isApplyingSnapshot)
|
|
277
|
-
return;
|
|
278
259
|
const textStyleAttributes = editor.getAttributes('textStyle');
|
|
279
260
|
const highlightAttributes = editor.getAttributes('highlight');
|
|
280
261
|
const focusedAlignment = editor.getAttributes(editor.state.selection.$anchor.node().type.name);
|
|
@@ -55,10 +55,6 @@ export declare const EVENTS: {
|
|
|
55
55
|
WEBSITE_MAKER_DIGITAL_BUSINESS_CARDS_HIDE_POPUP: string;
|
|
56
56
|
WEBSITE_MAKER_GETTY_VIDEO: string;
|
|
57
57
|
WEBSITE_MAKER_SHIPPING_TOGGLE: string;
|
|
58
|
-
WEBSITE_MAKER_UNDO: string;
|
|
59
|
-
WEBSITE_MAKER_REDO: string;
|
|
60
|
-
WEBSITE_MAKER_HISTORY_CAPPED: string;
|
|
61
|
-
WEBSITE_MAKER_HISTORY_OVERSIZED: string;
|
|
62
58
|
};
|
|
63
59
|
export declare const SELECT_LOCATIONS: {
|
|
64
60
|
MAKER_PREVIEW: string;
|
|
@@ -111,22 +107,6 @@ export declare const PUBLISH_OPTION_MODAL_CONTINUATION_EVENTS: {
|
|
|
111
107
|
};
|
|
112
108
|
declare const useEventTracker: () => {
|
|
113
109
|
sendShippingToggleEvent: (isEnabled: boolean) => void;
|
|
114
|
-
sendUndoEvent: (props: {
|
|
115
|
-
entries_count: number;
|
|
116
|
-
actor: string | undefined;
|
|
117
|
-
}) => void;
|
|
118
|
-
sendRedoEvent: (props: {
|
|
119
|
-
entries_count: number;
|
|
120
|
-
actor: string | undefined;
|
|
121
|
-
}) => void;
|
|
122
|
-
sendHistoryCappedEvent: (props: {
|
|
123
|
-
entries_count: number;
|
|
124
|
-
size_bytes: number;
|
|
125
|
-
}) => void;
|
|
126
|
-
sendHistoryOversizedEvent: (props: {
|
|
127
|
-
attempted_bytes: number;
|
|
128
|
-
source: string;
|
|
129
|
-
}) => void;
|
|
130
110
|
sendSaveContactEvent: () => void;
|
|
131
111
|
sendStartForFreeEvent: () => void;
|
|
132
112
|
sendFooterLinkClickEvent: (linkType: 'watermark_logo' | 'create_your_website') => void;
|
|
@@ -36,10 +36,6 @@ export const EVENTS = {
|
|
|
36
36
|
WEBSITE_MAKER_DIGITAL_BUSINESS_CARDS_HIDE_POPUP: 'website_maker_digital_business_cards_hide_popup',
|
|
37
37
|
WEBSITE_MAKER_GETTY_VIDEO: 'website_maker_getty_video',
|
|
38
38
|
WEBSITE_MAKER_SHIPPING_TOGGLE: 'website_maker_shipping_toggle',
|
|
39
|
-
WEBSITE_MAKER_UNDO: 'website_maker_undo',
|
|
40
|
-
WEBSITE_MAKER_REDO: 'website_maker_redo',
|
|
41
|
-
WEBSITE_MAKER_HISTORY_CAPPED: 'website_maker_history_capped',
|
|
42
|
-
WEBSITE_MAKER_HISTORY_OVERSIZED: 'website_maker_history_oversized',
|
|
43
39
|
};
|
|
44
40
|
export const SELECT_LOCATIONS = {
|
|
45
41
|
MAKER_PREVIEW: 'maker_preview',
|
|
@@ -325,19 +321,6 @@ const useEventTracker = () => {
|
|
|
325
321
|
is_enabled: isEnabled,
|
|
326
322
|
});
|
|
327
323
|
},
|
|
328
|
-
// Undo / Redo (BP-5506)
|
|
329
|
-
sendUndoEvent: (props) => {
|
|
330
|
-
_publishEvent(EVENTS.WEBSITE_MAKER_UNDO, props);
|
|
331
|
-
},
|
|
332
|
-
sendRedoEvent: (props) => {
|
|
333
|
-
_publishEvent(EVENTS.WEBSITE_MAKER_REDO, props);
|
|
334
|
-
},
|
|
335
|
-
sendHistoryCappedEvent: (props) => {
|
|
336
|
-
_publishEvent(EVENTS.WEBSITE_MAKER_HISTORY_CAPPED, props);
|
|
337
|
-
},
|
|
338
|
-
sendHistoryOversizedEvent: (props) => {
|
|
339
|
-
_publishEvent(EVENTS.WEBSITE_MAKER_HISTORY_OVERSIZED, props);
|
|
340
|
-
},
|
|
341
324
|
};
|
|
342
325
|
};
|
|
343
326
|
export { useEventTracker };
|
|
@@ -177,55 +177,16 @@ export declare const useBrandPageMakerStore: import("pinia").StoreDefinition<"br
|
|
|
177
177
|
hideChangeTemplateConfirmModal(): void;
|
|
178
178
|
onBackgroundChanged(): void;
|
|
179
179
|
onChangeTemplateConfirmModalCancel(): void;
|
|
180
|
-
onChangeTemplateConfirmModalConfirm():
|
|
180
|
+
onChangeTemplateConfirmModalConfirm(): void;
|
|
181
181
|
onContentChanged(): void;
|
|
182
182
|
onStyleChanged(): void;
|
|
183
|
-
onTemplateSelected(payload: OnTemplateSelectedPayload):
|
|
183
|
+
onTemplateSelected(payload: OnTemplateSelectedPayload): void;
|
|
184
184
|
setSelectedTabName(payload: any): void;
|
|
185
185
|
showNextNotificationMessage(): Promise<void>;
|
|
186
186
|
updateContent<TContent extends Content, P extends {
|
|
187
187
|
id: string;
|
|
188
188
|
content: TContent;
|
|
189
189
|
}>(payload: P): Promise<void>;
|
|
190
|
-
/**
|
|
191
|
-
* Restore every store that the `brandPageData` getter reads from, so undo
|
|
192
|
-
* and redo bring back the EXACT document state captured at snapshot time.
|
|
193
|
-
*
|
|
194
|
-
* `initialiseStoresByBrandPageModelAsync` is too narrow for undo/redo — it
|
|
195
|
-
* only rehydrates pages, sections, and nav structure, which is enough for
|
|
196
|
-
* the AI-apply path but leaves navigation styles, backgrounds, button/text/
|
|
197
|
-
* logo/gallery styles, shop config, and several own-store fields unchanged.
|
|
198
|
-
* This action mirrors the full hydration surface of `applySelectedTemplate`
|
|
199
|
-
* (minus the template-specific logo/personalisation logic) so a restore is
|
|
200
|
-
* a complete round-trip of what `brandPageData` returns.
|
|
201
|
-
*
|
|
202
|
-
* Called ONLY by history-store during undo/redo. The history store sets
|
|
203
|
-
* `isApplyingSnapshot=true` across this call to prevent the deep-watcher
|
|
204
|
-
* on `brandPageData` from re-capturing the restored state.
|
|
205
|
-
*/
|
|
206
|
-
/**
|
|
207
|
-
* Force-commit a `template_switch` entry to the history store, if the
|
|
208
|
-
* history store has a baseline (which only happens when the undo/redo
|
|
209
|
-
* feature flag is on — see `BrandPageMaker.mixin.ts`).
|
|
210
|
-
*/
|
|
211
|
-
_captureTemplateSwitchIfEnabled(): void;
|
|
212
|
-
applyHistorySnapshot(snapshot: BrandPageModel, activePageId?: string, logoEditsStr?: string): Promise<void>;
|
|
213
|
-
_syncLogoSettingsFromSnapshot(snapshot: BrandPageModel, logoEditsStr?: string): Promise<void>;
|
|
214
|
-
/**
|
|
215
|
-
* Restore the active page after a history apply. The id passed in is
|
|
216
|
-
* already validated against the restored nav by the history store; if
|
|
217
|
-
* it's undefined (no entry walking back had a viable page), fall back
|
|
218
|
-
* to the first/default route so the URL, `routeStore.currentRoute.params`,
|
|
219
|
-
* `pageNavigation.activePageId`, and the page-tab highlight all line up.
|
|
220
|
-
*
|
|
221
|
-
* `setCurrentActivePage` is called explicitly in addition to
|
|
222
|
-
* `navigateToPageByPageId` because `navigateToPageByPageId` is a no-op
|
|
223
|
-
* when the router instance is undefined (e.g. SSR / unit tests), but the
|
|
224
|
-
* Pinia state must still be updated so the sidebar's `currentPage`
|
|
225
|
-
* getter returns the right page.
|
|
226
|
-
*/
|
|
227
|
-
_navigateToActivePage(activePageId?: string): void;
|
|
228
|
-
_fallbackSidebarIfSelectedContentMissing(snapshot: BrandPageModel): void;
|
|
229
190
|
export(): BrandPageModel;
|
|
230
191
|
setBrandPageType({ brandPageType }: {
|
|
231
192
|
brandPageType: BrandPageType;
|
|
@@ -2,7 +2,6 @@ import { EMPTY_LOGO_IMAGE_MODEL, SENSITIVE_CONTENT_TYPES, TEXT_STYLE_TYPES, VIEW
|
|
|
2
2
|
import { BackgroundStyles, BRAND_PAGE_TYPES, BrandPageModel, CONTENT_TYPES, NavigationDesktop, NavigationMobile, NavModel, } from '@brand-page';
|
|
3
3
|
import { useBrandPageMakerUserStore } from '../user';
|
|
4
4
|
import { defineStore } from 'pinia';
|
|
5
|
-
import { toRaw } from 'vue';
|
|
6
5
|
import { useUiStore } from '../ui';
|
|
7
6
|
import { useUiLogoSettingsStore, useUiEditableLogoStore, } from '@shared/logo-settings/store';
|
|
8
7
|
import { useUiStyleSettingsStore } from '@shared/style-settings/store';
|
|
@@ -12,7 +11,7 @@ import { useShopConfigStore } from '@shared/ecommerce-settings/store/shop-settin
|
|
|
12
11
|
import { usePageNavigationStore } from '@shared/page-navigation/store/page-navigation-store';
|
|
13
12
|
import { applyLogoThemeToBrandPageModel, migrateBrandPageModel, applyUserPersonalisationToBrandPageModelAsync, getBrandPageViewModelFromBrandPageModel, isLogoContent, parseLogoThemeToCssStyles, logoUtil, GetLatestModelVersion, } from '@brand-page/utils';
|
|
14
13
|
import { navigateToPageByPageId } from '../../routing';
|
|
15
|
-
import { BRANDPAGE_DEFAULT_ERROR_MESSAGE_DESCRIPTION, BRANDPAGE_DEFAULT_SAVE_MESSAGE_DESCRIPTION, MAKER_MOBILE_BREAKPOINT, MESSAGE_VISIBLE_DURATION,
|
|
14
|
+
import { BRANDPAGE_DEFAULT_ERROR_MESSAGE_DESCRIPTION, BRANDPAGE_DEFAULT_SAVE_MESSAGE_DESCRIPTION, MAKER_MOBILE_BREAKPOINT, MESSAGE_VISIBLE_DURATION, } from '@brand-page-maker/constants';
|
|
16
15
|
import { useUiSideBarStore } from '@shared/side-bar/store';
|
|
17
16
|
import { delayInMS } from '../../../utils/ui-util';
|
|
18
17
|
import { useUiContentSettingsStore } from '@shared/content-settings/store';
|
|
@@ -34,7 +33,6 @@ import { useConsent } from '@brand-page/composables/consent.composable';
|
|
|
34
33
|
import { commonTr, errorTr } from '@src/composables/useTranslate';
|
|
35
34
|
import { UPGRADE_CTA_LOCATIONS } from '../../composables/useEventTracker';
|
|
36
35
|
import { useVideoStore } from '../video';
|
|
37
|
-
import { useHistoryStore } from '../history/history-store';
|
|
38
36
|
import { findValuesByKey } from '../../../helpers/ts.helper';
|
|
39
37
|
import { useLogoStore } from '../logo-store';
|
|
40
38
|
const brandPageTypeTemplateTypeMap = {
|
|
@@ -389,15 +387,6 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
|
|
|
389
387
|
description: payload.noDescription ? '' : description,
|
|
390
388
|
},
|
|
391
389
|
});
|
|
392
|
-
// Any successful save re-baselines the undo stack so a user can't
|
|
393
|
-
// undo back past the persisted state. This covers Save Progress /
|
|
394
|
-
// Publish AND settings-only saves (updateBrandPage,
|
|
395
|
-
// updateSensitiveContent, admin saveTemplate) — settings-tab
|
|
396
|
-
// actions persist the metadata, so allowing undo to roll them
|
|
397
|
-
// back would let the local stack drift from what's saved.
|
|
398
|
-
// reset() no-ops in non-undo-redo sessions (no baseline = nothing
|
|
399
|
-
// to clear).
|
|
400
|
-
useHistoryStore().reset();
|
|
401
390
|
},
|
|
402
391
|
hideChangeTemplateConfirmModal() {
|
|
403
392
|
this.setIsChangeTemplateConfirmModalVisible({
|
|
@@ -411,11 +400,10 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
|
|
|
411
400
|
this.setSelectedTemplateId({ templateId: false });
|
|
412
401
|
this.hideChangeTemplateConfirmModal();
|
|
413
402
|
},
|
|
414
|
-
|
|
415
|
-
|
|
403
|
+
onChangeTemplateConfirmModalConfirm() {
|
|
404
|
+
this.applySelectedTemplate();
|
|
416
405
|
this.hideChangeTemplateConfirmModal();
|
|
417
406
|
this.isModifiedAfterTemplateApplied = false;
|
|
418
|
-
this._captureTemplateSwitchIfEnabled();
|
|
419
407
|
},
|
|
420
408
|
onContentChanged() {
|
|
421
409
|
this.setIsModifiedAfterTemplateApplied();
|
|
@@ -423,7 +411,7 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
|
|
|
423
411
|
onStyleChanged() {
|
|
424
412
|
this.setIsModifiedAfterTemplateApplied();
|
|
425
413
|
},
|
|
426
|
-
|
|
414
|
+
onTemplateSelected(payload) {
|
|
427
415
|
this.setSelectedTemplateId({
|
|
428
416
|
templateId: payload.templateId,
|
|
429
417
|
});
|
|
@@ -433,8 +421,7 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
|
|
|
433
421
|
});
|
|
434
422
|
}
|
|
435
423
|
else {
|
|
436
|
-
|
|
437
|
-
this._captureTemplateSwitchIfEnabled();
|
|
424
|
+
this.applySelectedTemplate();
|
|
438
425
|
}
|
|
439
426
|
},
|
|
440
427
|
setSelectedTabName(payload) {
|
|
@@ -460,295 +447,6 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
|
|
|
460
447
|
async updateContent(payload) {
|
|
461
448
|
const uiContentSettingsStore = useUiContentSettingsStore();
|
|
462
449
|
uiContentSettingsStore.updateContent(payload);
|
|
463
|
-
// NOTE (Bolt 1, 2026-04-23): this action is not the actual edit path used
|
|
464
|
-
// by the UI — sidebar inputs call uiContentSettingsStore.updateItemValue
|
|
465
|
-
// directly. History capture is driven by a deep `watch(brandPageData, ...)`
|
|
466
|
-
// installed in history-store once the baseline is captured, so we do not
|
|
467
|
-
// need to instrument this action. Kept here as a pass-through because
|
|
468
|
-
// removing it may affect other callers.
|
|
469
|
-
},
|
|
470
|
-
/**
|
|
471
|
-
* Restore every store that the `brandPageData` getter reads from, so undo
|
|
472
|
-
* and redo bring back the EXACT document state captured at snapshot time.
|
|
473
|
-
*
|
|
474
|
-
* `initialiseStoresByBrandPageModelAsync` is too narrow for undo/redo — it
|
|
475
|
-
* only rehydrates pages, sections, and nav structure, which is enough for
|
|
476
|
-
* the AI-apply path but leaves navigation styles, backgrounds, button/text/
|
|
477
|
-
* logo/gallery styles, shop config, and several own-store fields unchanged.
|
|
478
|
-
* This action mirrors the full hydration surface of `applySelectedTemplate`
|
|
479
|
-
* (minus the template-specific logo/personalisation logic) so a restore is
|
|
480
|
-
* a complete round-trip of what `brandPageData` returns.
|
|
481
|
-
*
|
|
482
|
-
* Called ONLY by history-store during undo/redo. The history store sets
|
|
483
|
-
* `isApplyingSnapshot=true` across this call to prevent the deep-watcher
|
|
484
|
-
* on `brandPageData` from re-capturing the restored state.
|
|
485
|
-
*/
|
|
486
|
-
/**
|
|
487
|
-
* Force-commit a `template_switch` entry to the history store, if the
|
|
488
|
-
* history store has a baseline (which only happens when the undo/redo
|
|
489
|
-
* feature flag is on — see `BrandPageMaker.mixin.ts`).
|
|
490
|
-
*/
|
|
491
|
-
_captureTemplateSwitchIfEnabled() {
|
|
492
|
-
const historyStore = useHistoryStore();
|
|
493
|
-
if (!historyStore.baselineCaptured)
|
|
494
|
-
return;
|
|
495
|
-
historyStore.captureTemplateSwitch();
|
|
496
|
-
},
|
|
497
|
-
async applyHistorySnapshot(snapshot, activePageId, logoEditsStr) {
|
|
498
|
-
const styleSettingsStore = useUiStyleSettingsStore();
|
|
499
|
-
const navigationStyleSettingsStore = useUiNavigationStyleSettingsStore();
|
|
500
|
-
const backgroundSettingsStore = useUiBackgroundSettingsStore();
|
|
501
|
-
const pageNavigationStore = usePageNavigationStore();
|
|
502
|
-
const shopStore = useShopConfigStore();
|
|
503
|
-
// 1. Pages + header/footer sections (also covers content items).
|
|
504
|
-
this.initialisePagesForCurrentPage({
|
|
505
|
-
pages: snapshot.pages,
|
|
506
|
-
sections: {
|
|
507
|
-
[PAGE_SECTIONS.header]: {
|
|
508
|
-
[VIEWPORTS.desktop]: snapshot.pageHeaderDesktop,
|
|
509
|
-
[VIEWPORTS.mobile]: snapshot.pageHeaderMobile,
|
|
510
|
-
},
|
|
511
|
-
[PAGE_SECTIONS.footer]: {
|
|
512
|
-
[VIEWPORTS.desktop]: snapshot.pageFooterDesktop,
|
|
513
|
-
[VIEWPORTS.mobile]: snapshot.pageFooterMobile,
|
|
514
|
-
},
|
|
515
|
-
},
|
|
516
|
-
});
|
|
517
|
-
// 2. Page-level nav structure (routes, orders).
|
|
518
|
-
pageNavigationStore.setNav({ nav: snapshot.nav });
|
|
519
|
-
// 3. Navigation STYLES (header/footer nav colors, alignment, etc.) —
|
|
520
|
-
// this is the bit that was being dropped before.
|
|
521
|
-
// Use function-form $patch so each nested style object is replaced as a
|
|
522
|
-
// whole reference. The object-form $patch (used by setState) deep-merges
|
|
523
|
-
// and would leave keys present in the live state but absent from the
|
|
524
|
-
// snapshot in place — e.g. switching button styles then undoing would
|
|
525
|
-
// leave the new style's borderRadius/borderStyle/borderWidth applied.
|
|
526
|
-
navigationStyleSettingsStore.$patch((state) => {
|
|
527
|
-
state.navigation[PAGE_SECTIONS.header][VIEWPORTS.desktop] =
|
|
528
|
-
new NavigationDesktop(snapshot.pageHeaderDesktop?.navigation);
|
|
529
|
-
state.navigation[PAGE_SECTIONS.header][VIEWPORTS.mobile] =
|
|
530
|
-
new NavigationMobile(snapshot.pageHeaderMobile?.navigation);
|
|
531
|
-
});
|
|
532
|
-
// 4. Global styles (logo, button, text, gallery). Same whole-reference
|
|
533
|
-
// replacement reasoning as step 3.
|
|
534
|
-
styleSettingsStore.$patch((state) => {
|
|
535
|
-
state.buttonStyles = snapshot.styles.buttonStyles;
|
|
536
|
-
state.logoStyles = snapshot.styles.logoStyles;
|
|
537
|
-
state.textStyles = snapshot.styles.textStyles;
|
|
538
|
-
state.galleryStyles = snapshot.styles.galleryStyles;
|
|
539
|
-
});
|
|
540
|
-
// 5. Background styles. Same whole-reference replacement reasoning as
|
|
541
|
-
// step 3 — `setBackgroundStyles` calls per-field setters that
|
|
542
|
-
// `Object.assign` partials onto the live `style` and
|
|
543
|
-
// `backgroundShapeStyle` objects, so keys from the previous mode
|
|
544
|
-
// (e.g. background image url, shape style props) would survive an
|
|
545
|
-
// undo back to a state that doesn't have them.
|
|
546
|
-
backgroundSettingsStore.$patch((state) => {
|
|
547
|
-
state.backgroundStyles = snapshot.styles.backgroundStyles;
|
|
548
|
-
});
|
|
549
|
-
backgroundSettingsStore.onBackgroundChanged();
|
|
550
|
-
// 6. Shop products are derived from shop-content blocks inside `pages`,
|
|
551
|
-
// so they're already implicitly restored at step 1. Re-run the shop
|
|
552
|
-
// store's derivation to keep `products` in sync with the snapshot
|
|
553
|
-
// pages. paymentConfig is intentionally NOT restored — selecting it is
|
|
554
|
-
// backend-confirmed (Stripe Connect / payment-provider linkage) per
|
|
555
|
-
// project-guardrails.md, so it must persist across undo. We pass the
|
|
556
|
-
// live paymentConfig back in to preserve it.
|
|
557
|
-
shopStore.initialiseShopStore({
|
|
558
|
-
paymentConfig: shopStore.paymentConfig,
|
|
559
|
-
pages: snapshot.pages ?? [],
|
|
560
|
-
});
|
|
561
|
-
// 7. Own-store scalar fields surfaced by the brandPageData getter.
|
|
562
|
-
if (snapshot.isModifiedAfterTemplateApplied !== undefined) {
|
|
563
|
-
this.isModifiedAfterTemplateApplied =
|
|
564
|
-
snapshot.isModifiedAfterTemplateApplied;
|
|
565
|
-
}
|
|
566
|
-
if (snapshot.brandPageType) {
|
|
567
|
-
this.setBrandPageType({ brandPageType: snapshot.brandPageType });
|
|
568
|
-
}
|
|
569
|
-
this.faviconUrl = snapshot.faviconUrl;
|
|
570
|
-
this.ogImageUrl = snapshot.ogImageUrl;
|
|
571
|
-
this.measurementID = snapshot.measurementID;
|
|
572
|
-
this.adsenseID = snapshot.adsenseID;
|
|
573
|
-
this.ogTitle = snapshot.ogTitle;
|
|
574
|
-
this.ogDescription = snapshot.ogDescription;
|
|
575
|
-
this.cookieOptions = snapshot.cookieOptions;
|
|
576
|
-
this.saveContactSettings = snapshot.saveContactSettings;
|
|
577
|
-
// 8. Re-sync the logo-settings sidebar's `selectedLogoImage` from the
|
|
578
|
-
// restored header logo. The preview rehydrates via the page contents,
|
|
579
|
-
// but `uiLogoSettings` holds its own copy that drives the sidebar
|
|
580
|
-
// "current logo" state — same pattern as `initialiseStoresByBrandPageModelAsync`.
|
|
581
|
-
// Also restores the variations grid + template asset for the
|
|
582
|
-
// snapshot's draft token (both are sidecars to `brandPageData` —
|
|
583
|
-
// BYO upload mutates them out of band). When the captured entry
|
|
584
|
-
// carries a `logoEdits` sidecar (pre-purchase logo-tab edits —
|
|
585
|
-
// text, support text, logo colors, fonts), `editableLogoStore.logoEdits`
|
|
586
|
-
// is restored from that string so the sidebar form fields and the
|
|
587
|
-
// save-time fabric-render POST both pick up the pre-edit state.
|
|
588
|
-
await this._syncLogoSettingsFromSnapshot(snapshot, logoEditsStr);
|
|
589
|
-
// 9. If the sidebar is editing a content item that no longer exists in
|
|
590
|
-
// the restored page, fall back to the Content tab so the user doesn't
|
|
591
|
-
// stare at a blank settings panel.
|
|
592
|
-
this._fallbackSidebarIfSelectedContentMissing(snapshot);
|
|
593
|
-
// 10. Switch to the page the user was viewing when this entry was
|
|
594
|
-
// captured (or the closest still-existing page if the captured
|
|
595
|
-
// page was the one being undone-away). The history store does the
|
|
596
|
-
// walk-back resolution and passes us a pageId that's guaranteed to
|
|
597
|
-
// exist in the restored nav — or undefined if no entry walking
|
|
598
|
-
// back has a viable id, in which case we fall through to the
|
|
599
|
-
// first/default route. Without this, the page-tabs carousel keeps
|
|
600
|
-
// highlighting whatever page slug is in the URL (which can no
|
|
601
|
-
// longer match any nav item after a page-add undo) and the
|
|
602
|
-
// sidebar's `currentPage` getter silently falls back to page 0.
|
|
603
|
-
this._navigateToActivePage(activePageId);
|
|
604
|
-
},
|
|
605
|
-
async _syncLogoSettingsFromSnapshot(snapshot, logoEditsStr) {
|
|
606
|
-
const logoSettingsStore = useUiLogoSettingsStore();
|
|
607
|
-
const editableLogoStore = useUiEditableLogoStore();
|
|
608
|
-
const logoStore = useLogoStore();
|
|
609
|
-
const containerStore = useBrandPageContainerStore();
|
|
610
|
-
// Pre-restore logo identity, used to short-circuit the
|
|
611
|
-
// fabric-render call when only non-logo state changed.
|
|
612
|
-
const prevLogoEditsStr = JSON.stringify(toRaw(editableLogoStore.logoEdits));
|
|
613
|
-
const prevDraftToken = editableLogoStore.logoDraftToken;
|
|
614
|
-
// Wholesale-replace via $patch so prior textObjects/colors don't
|
|
615
|
-
// leak across template switches.
|
|
616
|
-
if (logoEditsStr) {
|
|
617
|
-
try {
|
|
618
|
-
const parsed = JSON.parse(logoEditsStr);
|
|
619
|
-
editableLogoStore.$patch({ logoEdits: parsed });
|
|
620
|
-
}
|
|
621
|
-
catch (error) {
|
|
622
|
-
console.error('brandpage-maker-store: failed to restore logoEdits', error);
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
const logoImage = snapshot.brandPageType === BRAND_PAGE_TYPES.default
|
|
626
|
-
? snapshot.pages?.[0]?.contents?.find((c) => c.type === 'logo')?.logoImage
|
|
627
|
-
: snapshot.pageHeaderDesktop?.logoImage;
|
|
628
|
-
if (!logoImage)
|
|
629
|
-
return;
|
|
630
|
-
logoSettingsStore.setState({
|
|
631
|
-
newState: { selectedLogoImage: logoImage },
|
|
632
|
-
});
|
|
633
|
-
const draftToken = logoImage.logoDraftToken;
|
|
634
|
-
if (!draftToken)
|
|
635
|
-
return;
|
|
636
|
-
// Re-derive enableEditMode + templateAsset from the draft registry
|
|
637
|
-
// (append-only for the session) instead of stashing on every entry.
|
|
638
|
-
const draft = logoStore.getLogoDraftAssetByToken(draftToken);
|
|
639
|
-
if (draft) {
|
|
640
|
-
editableLogoStore.setEnableEditMode(!draft.isByo);
|
|
641
|
-
if (draft.templateAsset) {
|
|
642
|
-
logoStore.setLogoTemplateAsset(draft.templateAsset);
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
editableLogoStore.setLogoDraftToken(draftToken);
|
|
646
|
-
// No logo change → cache is still correct; just stamp base64 back
|
|
647
|
-
// (snapshot doesn't carry logoImageBase64Url).
|
|
648
|
-
const logoUnchanged = prevDraftToken === draftToken &&
|
|
649
|
-
(logoEditsStr === undefined || logoEditsStr === prevLogoEditsStr);
|
|
650
|
-
if (logoUnchanged) {
|
|
651
|
-
editableLogoStore.stampLogoBase64IntoBrandPageData();
|
|
652
|
-
return;
|
|
653
|
-
}
|
|
654
|
-
const isByo = !!draft?.isByo;
|
|
655
|
-
if (isByo) {
|
|
656
|
-
// BYO mints a fresh draftToken per upload so the per-token
|
|
657
|
-
// cache always matches; no re-render needed.
|
|
658
|
-
if (editableLogoStore.restoreVariationsForDraftToken(draftToken)) {
|
|
659
|
-
editableLogoStore.stampLogoBase64IntoBrandPageData();
|
|
660
|
-
}
|
|
661
|
-
return;
|
|
662
|
-
}
|
|
663
|
-
// Designed: draft token is reused across edits, so the cache
|
|
664
|
-
// only holds the latest render. Re-issue fabric-render — same
|
|
665
|
-
// call as the live edit path. Awaited so concurrent undos
|
|
666
|
-
// serialize and the call sits inside the isApplyingSnapshot
|
|
667
|
-
// window (watcher guard suppresses the writeback).
|
|
668
|
-
if (containerStore.isPrePurchase &&
|
|
669
|
-
logoEditsStr &&
|
|
670
|
-
logoStore.logoTemplateAsset) {
|
|
671
|
-
// Stamp the cached (pre-undo) base64 onto brandPageData first
|
|
672
|
-
// so the canvas keeps showing the previous logo while the
|
|
673
|
-
// re-render is in flight. Without this the logoImageBase64Url
|
|
674
|
-
// fields are undefined (snapshot is stripped pre-purchase) and
|
|
675
|
-
// the canvas flickers blank for ~500-1500ms.
|
|
676
|
-
editableLogoStore.stampLogoBase64IntoBrandPageData();
|
|
677
|
-
try {
|
|
678
|
-
await editableLogoStore.updateEditableLogoImageUrlAsync();
|
|
679
|
-
}
|
|
680
|
-
catch (error) {
|
|
681
|
-
console.error('brandpage-maker-store: failed to re-render logo on history apply', error);
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
},
|
|
685
|
-
/**
|
|
686
|
-
* Restore the active page after a history apply. The id passed in is
|
|
687
|
-
* already validated against the restored nav by the history store; if
|
|
688
|
-
* it's undefined (no entry walking back had a viable page), fall back
|
|
689
|
-
* to the first/default route so the URL, `routeStore.currentRoute.params`,
|
|
690
|
-
* `pageNavigation.activePageId`, and the page-tab highlight all line up.
|
|
691
|
-
*
|
|
692
|
-
* `setCurrentActivePage` is called explicitly in addition to
|
|
693
|
-
* `navigateToPageByPageId` because `navigateToPageByPageId` is a no-op
|
|
694
|
-
* when the router instance is undefined (e.g. SSR / unit tests), but the
|
|
695
|
-
* Pinia state must still be updated so the sidebar's `currentPage`
|
|
696
|
-
* getter returns the right page.
|
|
697
|
-
*/
|
|
698
|
-
_navigateToActivePage(activePageId) {
|
|
699
|
-
const pageNavigationStore = usePageNavigationStore();
|
|
700
|
-
let targetPageId = activePageId;
|
|
701
|
-
if (!targetPageId) {
|
|
702
|
-
const fallbackRoute = pageNavigationStore.routes.length
|
|
703
|
-
? pageNavigationStore.getFirstOrDefaultRoute()
|
|
704
|
-
: undefined;
|
|
705
|
-
targetPageId = fallbackRoute?.pageId;
|
|
706
|
-
}
|
|
707
|
-
if (!targetPageId)
|
|
708
|
-
return;
|
|
709
|
-
// Skip both the Pinia write and the router push when the target page
|
|
710
|
-
// is already active. The router push fires `router.afterEach` even
|
|
711
|
-
// for same-page navigation, and BrandPageMaker.mixin's afterEach hook
|
|
712
|
-
// resets the content-settings modeStack — which would snap the
|
|
713
|
-
// sidebar back to the default Content tab on every undo/redo,
|
|
714
|
-
// regardless of whether the user was deep-editing a content item.
|
|
715
|
-
if (pageNavigationStore.activePageId === targetPageId)
|
|
716
|
-
return;
|
|
717
|
-
pageNavigationStore.setCurrentActivePage({ pageId: targetPageId });
|
|
718
|
-
navigateToPageByPageId(targetPageId);
|
|
719
|
-
},
|
|
720
|
-
_fallbackSidebarIfSelectedContentMissing(snapshot) {
|
|
721
|
-
const contentSettingsStore = useUiContentSettingsStore();
|
|
722
|
-
const sideBarStore = useUiSideBarStore();
|
|
723
|
-
const selectedItemId = contentSettingsStore.selectedItemId;
|
|
724
|
-
if (!selectedItemId)
|
|
725
|
-
return;
|
|
726
|
-
const existingContentIds = new Set();
|
|
727
|
-
snapshot.pages?.forEach((page) => {
|
|
728
|
-
page.contents?.forEach((content) => {
|
|
729
|
-
if (content?.id)
|
|
730
|
-
existingContentIds.add(content.id);
|
|
731
|
-
});
|
|
732
|
-
});
|
|
733
|
-
if (existingContentIds.has(selectedItemId))
|
|
734
|
-
return;
|
|
735
|
-
// The previously-selected content was undone away. Restore the
|
|
736
|
-
// Content tab's natural landing state — the same shape produced
|
|
737
|
-
// when the user clicks the Content tab fresh — instead of leaving
|
|
738
|
-
// the sidebar stuck rendering `<FocusedContentItemSettings>` for
|
|
739
|
-
// a missing item, which paints a blank panel.
|
|
740
|
-
//
|
|
741
|
-
// `resetMode()` pops the modeStack back to the base `edit` entry
|
|
742
|
-
// (the default landing mode); clearing `selectedItemId` releases
|
|
743
|
-
// the pointer to the now-deleted item.
|
|
744
|
-
sideBarStore.setSelectedTabName({
|
|
745
|
-
tabName: SIDE_BAR_TAB_NAMES.CONTENT_SETTINGS,
|
|
746
|
-
});
|
|
747
|
-
contentSettingsStore.resetMode();
|
|
748
|
-
contentSettingsStore.selectedItemId = null;
|
|
749
|
-
contentSettingsStore.selectedItemFieldName = null;
|
|
750
|
-
contentSettingsStore.selectedItemIndex = null;
|
|
751
|
-
contentSettingsStore.selectedItemValue = null;
|
|
752
450
|
},
|
|
753
451
|
export() {
|
|
754
452
|
const data = this.brandPageData;
|