@designcrowd/library.brand-page 5.15.20 → 5.15.21-ast-previews-1

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 (32) hide show
  1. package/lib/src/{CreatedOnBrandCrowd-de-de-MYtK52Bs.js → CreatedOnBrandCrowd-de-de-CpnpHE49.js} +1 -1
  2. package/lib/src/{CreatedOnBrandCrowd-en-us-BHGC5Nmb.js → CreatedOnBrandCrowd-en-us-BIGhMN5u.js} +1 -1
  3. package/lib/src/{CreatedOnBrandCrowd-es-es-D4XNuvrY.js → CreatedOnBrandCrowd-es-es-CtKRTlv7.js} +1 -1
  4. package/lib/src/{CreatedOnBrandCrowd-fr-fr-mY1thoNM.js → CreatedOnBrandCrowd-fr-ca-BBNKz47j.js} +1 -1
  5. package/lib/src/{CreatedOnBrandCrowd-fr-ca-mY1thoNM.js → CreatedOnBrandCrowd-fr-fr-BBNKz47j.js} +1 -1
  6. package/lib/src/{CreatedOnBrandCrowd-pt-pt-DBaS94bZ.js → CreatedOnBrandCrowd-pt-br-Wnnr3n4j.js} +1 -1
  7. package/lib/src/{CreatedOnBrandCrowd-pt-br-DBaS94bZ.js → CreatedOnBrandCrowd-pt-pt-Wnnr3n4j.js} +1 -1
  8. package/lib/src/{CreatedOnDcom-de-de-DhyBwBYE.js → CreatedOnDcom-de-de-xpiTmZqL.js} +1 -1
  9. package/lib/src/{CreatedOnDcom-en-us-Df7BT6-g.js → CreatedOnDcom-en-us-BMvVmlFi.js} +1 -1
  10. package/lib/src/{CreatedOnDcom-es-es-BnMEaFFL.js → CreatedOnDcom-es-es-BE9YKsHY.js} +1 -1
  11. package/lib/src/{CreatedOnDcom-fr-ca-DcNLgJwa.js → CreatedOnDcom-fr-ca-DPnuVEcJ.js} +1 -1
  12. package/lib/src/{CreatedOnDcom-fr-fr-CgBj0lnM.js → CreatedOnDcom-fr-fr-Cc-uYmho.js} +1 -1
  13. package/lib/src/{CreatedOnDcom-pt-br-C-Vp9NA7.js → CreatedOnDcom-pt-br-Cjk02D8C.js} +1 -1
  14. package/lib/src/{CreatedOnDcom-pt-pt-B6dI2H57.js → CreatedOnDcom-pt-pt-80vidYJw.js} +1 -1
  15. package/lib/src/brand-page/utils/migration/migration-07.js +1 -1
  16. package/lib/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.d.ts +227 -0
  17. package/lib/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.js +67 -5
  18. package/lib/src/css/library.brand-page-brandCrowd.min.css +49 -31
  19. package/lib/src/css/library.brand-page-brandPage.min.css +49 -31
  20. package/lib/src/css/library.brand-page-designCom.min.css +49 -31
  21. package/lib/src/css/library.brand-page-preview.min.css +49 -31
  22. package/lib/src/index.mjs +1 -1
  23. package/lib/src/{lib-Wi8WDfSl.js → lib-DPoy_qLA.js} +1973 -1910
  24. package/lib/src/shared/template-settings/store/template-settings-store.js +13 -5
  25. package/package.json +1 -1
  26. package/src/brand-page/components/brand-page-footer/BrandPageFooter.vue +18 -9
  27. package/src/brand-page/components/page/Page.vue +2 -2
  28. package/src/brand-page/utils/migration/migration-07.ts +6 -4
  29. package/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.ts +85 -5
  30. package/src/brand-page-maker/components/template-preview/TemplatePreview.vue +40 -4
  31. package/src/brand-page-maker/components/template-preview-with-state/TemplatePreviewWithState.vue +4 -6
  32. package/src/shared/template-settings/store/template-settings-store.ts +14 -7
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as e, openBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-Wi8WDfSl.js";
2
+ import { _ as t } from "./lib-DPoy_qLA.js";
3
3
  const i = {}, h = {
4
4
  width: "275",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as e, openBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-Wi8WDfSl.js";
2
+ import { _ as t } from "./lib-DPoy_qLA.js";
3
3
  const i = {}, h = {
4
4
  width: "251",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as e, openBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-Wi8WDfSl.js";
2
+ import { _ as t } from "./lib-DPoy_qLA.js";
3
3
  const i = {}, h = {
4
4
  width: "250",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as e, openBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-Wi8WDfSl.js";
2
+ import { _ as t } from "./lib-DPoy_qLA.js";
3
3
  const i = {}, h = {
4
4
  width: "237",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as e, openBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-Wi8WDfSl.js";
2
+ import { _ as t } from "./lib-DPoy_qLA.js";
3
3
  const i = {}, h = {
4
4
  width: "237",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as e, openBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-Wi8WDfSl.js";
2
+ import { _ as t } from "./lib-DPoy_qLA.js";
3
3
  const i = {}, h = {
4
4
  width: "263",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as e, openBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-Wi8WDfSl.js";
2
+ import { _ as t } from "./lib-DPoy_qLA.js";
3
3
  const i = {}, h = {
4
4
  width: "263",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as H, openBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as e } from "./lib-Wi8WDfSl.js";
2
+ import { _ as e } from "./lib-DPoy_qLA.js";
3
3
  const M = {}, Z = {
4
4
  width: "242",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as H, openBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as e } from "./lib-Wi8WDfSl.js";
2
+ import { _ as e } from "./lib-DPoy_qLA.js";
3
3
  const i = {}, M = {
4
4
  width: "231",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as H, openBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as e } from "./lib-Wi8WDfSl.js";
2
+ import { _ as e } from "./lib-DPoy_qLA.js";
3
3
  const M = {}, Z = {
4
4
  width: "230",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as H, openBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as e } from "./lib-Wi8WDfSl.js";
2
+ import { _ as e } from "./lib-DPoy_qLA.js";
3
3
  const i = {}, l = {
4
4
  width: "216",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as H, openBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as e } from "./lib-Wi8WDfSl.js";
2
+ import { _ as e } from "./lib-DPoy_qLA.js";
3
3
  const i = {}, l = {
4
4
  width: "216",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as H, openBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as M } from "./lib-Wi8WDfSl.js";
2
+ import { _ as M } from "./lib-DPoy_qLA.js";
3
3
  const Z = {}, e = {
4
4
  width: "232",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as H, openBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as M } from "./lib-Wi8WDfSl.js";
2
+ import { _ as M } from "./lib-DPoy_qLA.js";
3
3
  const Z = {}, e = {
4
4
  width: "232",
5
5
  height: "36",
@@ -1,4 +1,4 @@
1
- import { BRAND_PAGE_TYPES, DEFAULT_LOGO_HEIGHT, DEFAULT_LOGO_WIDTH, PageFooterDesktop, PageFooterMobile, PageHeaderDesktop, PageHeaderMobile, } from '../..';
1
+ import { BRAND_PAGE_TYPES, DEFAULT_LOGO_HEIGHT, DEFAULT_LOGO_WIDTH, } from '../..';
2
2
  import { FabricRenderClient } from '../../../clients/fabric-render-client';
3
3
  import { calculateLogoDimensions } from '../logo.util';
4
4
  export const migration07 = async (migrationResult, options) => {
@@ -15,6 +15,8 @@ interface TemplatePreviewData {
15
15
  renderHeight: number;
16
16
  renderWidth: number;
17
17
  rootStyles: BrandPageCssStyle;
18
+ imageLoadError: boolean;
19
+ imageLoading: boolean;
18
20
  }
19
21
  declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
20
22
  logoImage: {
@@ -61,6 +63,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
61
63
  };
62
64
  }>, {
63
65
  selectedTemplateId: import("vue").ComputedRef<string | false>;
66
+ isPrePurchase: import("vue").ComputedRef<boolean>;
64
67
  brandPageMakerStore: import("pinia").Store<"brandPageMaker", import("../../stores").BrandPageMakerState, {
65
68
  contentErrorCount(): number;
66
69
  brandPageBaseUrl(): string;
@@ -186,6 +189,224 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
186
189
  showStripeOnboardingModal(): Promise<void>;
187
190
  selectInitialCategories(payload: import("../../../shared/template-settings/models").InitialCategories): void;
188
191
  }>;
192
+ brandPageContainerStore: import("pinia").Store<"brandPageContainer", import("../../stores").BrandPageContainerState, {
193
+ brandPageContentTypes(): string[];
194
+ isAdmin(): boolean;
195
+ isPublished: (state: {
196
+ availableTaxes: any[];
197
+ brandPageBaseUrl: string;
198
+ baseFabricRenderUrl: string;
199
+ brandPageDescription: string;
200
+ brandPageDisplayName: string;
201
+ sensitiveContent: number;
202
+ brandPageSlug: string;
203
+ brandPageStatus: string;
204
+ brandPageToken: string | undefined;
205
+ brandPageTitle: string;
206
+ customDomain: {
207
+ id: string;
208
+ created: Date;
209
+ updated: Date;
210
+ brandPageToken: string;
211
+ domainName: string;
212
+ status: "active" | "pending" | "failed" | "renewFailed" | "deleted";
213
+ dnsConfigurationStatus: "request_expired" | "missing_expected_dns_records" | "invalid_multiple_dns_records_exist" | "unexpected_aaaa_record" | "completed";
214
+ triggerOrigin?: string | undefined;
215
+ } | null;
216
+ createCustomDomainErrorMessage: string | null;
217
+ customDomainConfig?: {
218
+ dns: {
219
+ ipAddresses: string[];
220
+ };
221
+ } | undefined;
222
+ designDraftToken?: string | undefined;
223
+ designTemplateToken: string;
224
+ isCustomDomainEnabled: boolean;
225
+ isBrandPageSlugEditMode: boolean;
226
+ isPublishModalVisible: boolean;
227
+ isUpgradeModalVisible: boolean;
228
+ isPublishing: boolean;
229
+ isProduction: boolean;
230
+ isSellDomainNameEnabled: boolean;
231
+ isStripeOnboardingModalVisible: boolean;
232
+ isReactivationModal: boolean;
233
+ isPublishUpgradeModal: boolean;
234
+ isSaving: boolean;
235
+ backButtonLabel: string;
236
+ manageWebsiteDesignsUrl: string;
237
+ publishErrorMessage: string;
238
+ upgradeUrl: string;
239
+ reactivationUrl: string;
240
+ runtimeEnvironment: string;
241
+ selectedTaxId: number | undefined;
242
+ slug: string;
243
+ standalone: boolean;
244
+ triggerSaveSuccessMessage: boolean;
245
+ isDesignCom: boolean;
246
+ isPrePurchase: boolean;
247
+ makerFonts: any[];
248
+ eventButtonLocation?: string | undefined;
249
+ websiteUpsellModalViewModel?: any;
250
+ showPublishOptionModal?: boolean | undefined;
251
+ abTests: Record<string, string>;
252
+ isSubsequentPublish: boolean;
253
+ } & import("pinia").PiniaCustomStateProperties<import("../../stores").BrandPageContainerState>) => boolean;
254
+ isUserDraft: (state: {
255
+ availableTaxes: any[];
256
+ brandPageBaseUrl: string;
257
+ baseFabricRenderUrl: string;
258
+ brandPageDescription: string;
259
+ brandPageDisplayName: string;
260
+ sensitiveContent: number;
261
+ brandPageSlug: string;
262
+ brandPageStatus: string;
263
+ brandPageToken: string | undefined;
264
+ brandPageTitle: string;
265
+ customDomain: {
266
+ id: string;
267
+ created: Date;
268
+ updated: Date;
269
+ brandPageToken: string;
270
+ domainName: string;
271
+ status: "active" | "pending" | "failed" | "renewFailed" | "deleted";
272
+ dnsConfigurationStatus: "request_expired" | "missing_expected_dns_records" | "invalid_multiple_dns_records_exist" | "unexpected_aaaa_record" | "completed";
273
+ triggerOrigin?: string | undefined;
274
+ } | null;
275
+ createCustomDomainErrorMessage: string | null;
276
+ customDomainConfig?: {
277
+ dns: {
278
+ ipAddresses: string[];
279
+ };
280
+ } | undefined;
281
+ designDraftToken?: string | undefined;
282
+ designTemplateToken: string;
283
+ isCustomDomainEnabled: boolean;
284
+ isBrandPageSlugEditMode: boolean;
285
+ isPublishModalVisible: boolean;
286
+ isUpgradeModalVisible: boolean;
287
+ isPublishing: boolean;
288
+ isProduction: boolean;
289
+ isSellDomainNameEnabled: boolean;
290
+ isStripeOnboardingModalVisible: boolean;
291
+ isReactivationModal: boolean;
292
+ isPublishUpgradeModal: boolean;
293
+ isSaving: boolean;
294
+ backButtonLabel: string;
295
+ manageWebsiteDesignsUrl: string;
296
+ publishErrorMessage: string;
297
+ upgradeUrl: string;
298
+ reactivationUrl: string;
299
+ runtimeEnvironment: string;
300
+ selectedTaxId: number | undefined;
301
+ slug: string;
302
+ standalone: boolean;
303
+ triggerSaveSuccessMessage: boolean;
304
+ isDesignCom: boolean;
305
+ isPrePurchase: boolean;
306
+ makerFonts: any[];
307
+ eventButtonLocation?: string | undefined;
308
+ websiteUpsellModalViewModel?: any;
309
+ showPublishOptionModal?: boolean | undefined;
310
+ abTests: Record<string, string>;
311
+ isSubsequentPublish: boolean;
312
+ } & import("pinia").PiniaCustomStateProperties<import("../../stores").BrandPageContainerState>) => boolean;
313
+ }, {
314
+ initialise(payload: import("../../stores/brandpage-container").InitialisePayload): void;
315
+ setDesignTemplateToken(payload: any): void;
316
+ setDesignDraftToken(payload: any): void;
317
+ setIsBrandPageSlugEditMode(payload: any): void;
318
+ setIsPublishing(payload: any): void;
319
+ setIsPublishModalVisible(payload: any): void;
320
+ setIsPublishUpgradeModal(payload: any): void;
321
+ setIsSaving(payload: any): void;
322
+ setIsUpgradeModalVisible(payload: any): void;
323
+ setPublishErrorMessage(payload: any): void;
324
+ setTriggerSaveSuccessMessage(payload: any): void;
325
+ setSlug(payload: any): void;
326
+ updateBrandPageMeta(payload: any): void;
327
+ updateBrandPageSensitiveContent(payload: any): void;
328
+ setLogoDraftToken(payload: {
329
+ logoDraftToken: string;
330
+ }): void;
331
+ setBackUrl(payload: any): void;
332
+ setIsStripeOnboardingModalVisible(payload: any): void;
333
+ setSelectedTaxId(payload: any): void;
334
+ setBrandPageCustomDomainConfig({ customDomainConfig }: {
335
+ customDomainConfig: any;
336
+ }): void;
337
+ setBrandPageCustomDomain(payload: {
338
+ customDomain: import("../../models").CustomDomainModel | null;
339
+ }): void;
340
+ setCreateCustomDomainErrorMessage(payload: any): void;
341
+ setBrandPageIsCustomDomainEnabled(payload: any): void;
342
+ setIsSubsequentPublish(payload: any): void;
343
+ clearPublishErrorMessage(): void;
344
+ closePublishModal(payload?: {
345
+ skipShowNextNotificationMessage?: boolean | undefined;
346
+ }): Promise<void>;
347
+ closeUpgradeModal(): Promise<void>;
348
+ endBrandPageSlugEditMode(): void;
349
+ publishBrandPage({ shouldPublish, slug }: {
350
+ shouldPublish: any;
351
+ slug: any;
352
+ }): Promise<false | {
353
+ success: boolean;
354
+ websiteUpsellModalViewModel: any;
355
+ }>;
356
+ publishBrandPageWithCustomDomainAsync({ shouldPublish, slug, domain, isPurchasedDomain, }: {
357
+ shouldPublish: any;
358
+ slug: any;
359
+ domain: any;
360
+ isPurchasedDomain: any;
361
+ }): Promise<boolean | undefined>;
362
+ checkWebsiteSlugAsync(slug: string): Promise<import("../../models/api.model").WebsiteSlugCheckResponse | null>;
363
+ redirectToLogoEditPage(logoEditUrl: string, locale: string): Promise<void>;
364
+ redirectToCreateNewDesignPage(): Promise<void>;
365
+ redirectToStripeOnboarding(): Promise<void>;
366
+ exportDesignAsync(): Promise<any>;
367
+ saveBrandPage(payload?: {
368
+ isPublish?: boolean | undefined;
369
+ eventButtonLocation?: string | undefined;
370
+ }): Promise<false | {
371
+ saved: boolean;
372
+ canPublish: boolean;
373
+ websiteUpsellModalViewModel: any;
374
+ }>;
375
+ saveAndPublishBrandPage(eventButtonLocation: string): Promise<void>;
376
+ saveTemplate(): Promise<void>;
377
+ setBrandPageStatus(status: any): Promise<void>;
378
+ showPublishModal(eventButtonLocation?: string | undefined, websiteUpsellModalViewModel?: any, isSubsequentPublish?: boolean | undefined): void;
379
+ showBrandPageSlugEditModal(eventButtonLocation: string): Promise<void>;
380
+ showUpgradeModalAndSaveAsync(): Promise<void>;
381
+ showStripeOnboardingModal(): void;
382
+ closeStripeOnboardingModal(): void;
383
+ showSaveSuccessMessage(): Promise<void>;
384
+ startBrandPageSlugEditMode(): void;
385
+ triggerLockedContentClickedEvent(contentType: string): Promise<void>;
386
+ unpublishBrandPage(): Promise<void>;
387
+ updateBrandPageSettings({ description, title }: {
388
+ description: any;
389
+ title: any;
390
+ }): Promise<void>;
391
+ updateSensitiveContent({ sensitiveContent }: {
392
+ sensitiveContent: any;
393
+ }): Promise<void>;
394
+ createBrandPageCustomDomain({ domainName }: {
395
+ domainName: any;
396
+ }): Promise<false | undefined>;
397
+ createBrandPageWithPurchasedDomain({ domainName }: {
398
+ domainName: any;
399
+ }): Promise<false | undefined>;
400
+ deleteBrandPageCustomDomain({ designDraftToken, customDomainId }: {
401
+ designDraftToken: any;
402
+ customDomainId: any;
403
+ }): Promise<void>;
404
+ refreshBrandPageCustomDomainConfig(): Promise<void>;
405
+ refreshBrandPageCustomDomain(): Promise<void>;
406
+ updateBrandPageIsCustomDomainEnabled({ isCustomDomainEnabled }: {
407
+ isCustomDomainEnabled: any;
408
+ }): Promise<void>;
409
+ }>;
189
410
  }, TemplatePreviewData, {
190
411
  context(): BrandPageContext;
191
412
  previewViewport(): string;
@@ -193,10 +414,16 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
193
414
  innerContainerStyle(): BrandPageCssStyle;
194
415
  isPersonalisable(): boolean;
195
416
  cssVariablesStyle(): Record<string, string>;
417
+ previewImageUrl(): string;
196
418
  }, {
197
419
  onOverlayClicked(): void;
198
420
  onResize(): void;
199
421
  onSetPreviewStyles(styles: BrandPageCssStyle): void;
422
+ onImageError(): void;
423
+ onImageLoad(): void;
424
+ generatePreviewImageUrl(): string;
425
+ getPreviewBaseUrl(): string;
426
+ regeneratePreview(): void;
200
427
  updateViewModel(forceUpdate?: boolean): Promise<void>;
201
428
  }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "template-selected"[], "template-selected", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
202
429
  logoImage: {
@@ -4,16 +4,19 @@ import { applyLogoThemeToBrandPageModel, applyUserPersonalisationToBrandPageMode
4
4
  import { STYLE_THEME_KEYS } from '../../../brand-page/constants';
5
5
  import debounce from 'lodash.debounce';
6
6
  import { MOBILE_HEIGHT, MOBILE_WIDTH } from '../../constants';
7
- import { useBrandPageMakerStore } from '../../stores';
7
+ import { useBrandPageContainerStore, useBrandPageMakerStore, } from '../../stores';
8
8
  import { applyLogoImageBase64UrlToBrandPageTemplateModel, applyLogoImageToBrandPageTemplateModel, applyLogoTemplateImageToBrandPageTemplateModel, } from '../../../brand-page/utils/logo.util';
9
9
  const DEBOUNCE_IN_MS = 250;
10
10
  export default defineComponent({
11
11
  emits: ['template-selected'],
12
12
  setup() {
13
13
  const brandPageMakerStore = useBrandPageMakerStore();
14
+ const brandPageContainerStore = useBrandPageContainerStore();
14
15
  return {
15
16
  selectedTemplateId: computed(() => brandPageMakerStore.selectedTemplateId),
17
+ isPrePurchase: computed(() => brandPageContainerStore.isPrePurchase),
16
18
  brandPageMakerStore,
19
+ brandPageContainerStore,
17
20
  };
18
21
  },
19
22
  props: {
@@ -72,6 +75,8 @@ export default defineComponent({
72
75
  renderWidth: 400,
73
76
  rootStyles: {},
74
77
  viewModel: undefined,
78
+ imageLoadError: false,
79
+ imageLoading: true,
75
80
  };
76
81
  return data;
77
82
  },
@@ -145,16 +150,42 @@ export default defineComponent({
145
150
  });
146
151
  return cssVariables;
147
152
  },
153
+ previewImageUrl() {
154
+ return this.generatePreviewImageUrl();
155
+ },
148
156
  },
149
157
  watch: {
150
- logoTheme: {
151
- handler() {
158
+ template() {
159
+ if (this.isPrePurchase) {
152
160
  this.updateViewModel();
161
+ }
162
+ else {
163
+ this.imageLoading = true;
164
+ this.regeneratePreview();
165
+ }
166
+ },
167
+ logoImage: {
168
+ handler() {
169
+ this.regeneratePreview();
153
170
  },
154
171
  deep: true,
155
172
  },
156
- template() {
157
- this.updateViewModel();
173
+ logoTemplateImage: {
174
+ handler() {
175
+ this.regeneratePreview();
176
+ },
177
+ deep: true,
178
+ },
179
+ logoTheme: {
180
+ handler() {
181
+ if (this.isPrePurchase) {
182
+ this.updateViewModel();
183
+ }
184
+ else {
185
+ this.regeneratePreview();
186
+ }
187
+ },
188
+ deep: true,
158
189
  },
159
190
  },
160
191
  created() {
@@ -195,7 +226,38 @@ export default defineComponent({
195
226
  onSetPreviewStyles(styles) {
196
227
  this.rootStyles = styles;
197
228
  },
229
+ onImageError() {
230
+ console.warn(`Failed to load preview image for template ${this.template.id}`);
231
+ this.imageLoadError = true;
232
+ this.imageLoading = false;
233
+ },
234
+ onImageLoad() {
235
+ this.imageLoadError = false;
236
+ this.imageLoading = false;
237
+ },
238
+ generatePreviewImageUrl() {
239
+ const baseUrl = this.getPreviewBaseUrl();
240
+ const logoDraftToken = this.logoImage?.logoDraftToken ||
241
+ '0B660926-D94A-4E29-99D1-F07E67AA6E49';
242
+ const deviceType = this.brandPageMakerStore.brandPageType === 'brandSite'
243
+ ? 'desktop'
244
+ : 'mobile';
245
+ return `${baseUrl}/preview/template/${this.template.id}/${logoDraftToken}?deviceType=${deviceType}`;
246
+ },
247
+ getPreviewBaseUrl() {
248
+ const domainSuffix = '.brand.page';
249
+ const envPrefix = window.location.hostname.split('.')[0];
250
+ return `https://preview-${envPrefix}${domainSuffix}`;
251
+ },
252
+ regeneratePreview() {
253
+ this.imageLoadError = false;
254
+ this.imageLoading = true;
255
+ this.$forceUpdate();
256
+ },
198
257
  async updateViewModel(forceUpdate = true) {
258
+ if (!this.isPrePurchase) {
259
+ return;
260
+ }
199
261
  let model = this.template.brandPageModel;
200
262
  if (this.logoImageBase64Url) {
201
263
  model = applyLogoImageBase64UrlToBrandPageTemplateModel(model, this.logoImageBase64Url);