@designcrowd/library.brand-page 5.16.28 → 5.16.29-pre-temp-13
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-C-CdtuLf.js → CreatedOnBrandCrowd-de-de-C5cvDYY0.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-DrL7aiqj.js → CreatedOnBrandCrowd-en-us-D0KCSK_6.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-DDJFsUyp.js → CreatedOnBrandCrowd-es-es-BtlaguF9.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-Dv8j7UDI.js → CreatedOnBrandCrowd-fr-ca-RGdnURaa.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-Dv8j7UDI.js → CreatedOnBrandCrowd-fr-fr-RGdnURaa.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-Dp52qW0V.js → CreatedOnBrandCrowd-pt-br-BJwt5ATI.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-Dp52qW0V.js → CreatedOnBrandCrowd-pt-pt-BJwt5ATI.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-Df9pkq3U.js → CreatedOnDcom-de-de-LUA5Wvy5.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-DqHPayYQ.js → CreatedOnDcom-en-us-Dd1UPBVq.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-BcyOZFjl.js → CreatedOnDcom-es-es-CD923NVo.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-DdjkYDpz.js → CreatedOnDcom-fr-ca-C6Mc--2a.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-B3v0x4gQ.js → CreatedOnDcom-fr-fr-Ffrd6Erx.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-DJe-M_Ue.js → CreatedOnDcom-pt-br-BfoY5gWJ.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-B1aOyZ5I.js → CreatedOnDcom-pt-pt-f0ywi387.js} +1 -1
- package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMakerTemplateSettings.mixin.js +2 -5
- package/lib/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.js +4 -4
- package/lib/src/brand-page-maker/composables/useEventTracker.d.ts +6 -0
- package/lib/src/brand-page-maker/composables/useEventTracker.js +6 -0
- package/lib/src/brand-page-maker/constants/template-constants.d.ts +1 -2
- package/lib/src/brand-page-maker/constants/template-constants.js +1 -2
- package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.js +21 -0
- package/lib/src/brand-page-maker/utils/rich-text-editor.util.js +10 -2
- package/lib/src/{bundled-translations-DAA_muNW.js → bundled-translations-CMyG8Azk.js} +54 -54
- package/lib/src/{bundled-translations.de-DE-DmZSAEA4.js → bundled-translations.de-DE-BJPw07Ba.js} +36 -36
- package/lib/src/{bundled-translations.es-ES-CGUGm_zy.js → bundled-translations.es-ES-DqQ7zLxJ.js} +58 -58
- package/lib/src/{bundled-translations.fr-CA-UkcZ1_qS.js → bundled-translations.fr-CA-2dy4OokC.js} +47 -47
- package/lib/src/{bundled-translations.fr-FR-D43nbl6A.js → bundled-translations.fr-FR-Bjh3iNSg.js} +25 -25
- package/lib/src/{bundled-translations.pt-BR-B0o-8NGd.js → bundled-translations.pt-BR-BRC_B0LW.js} +13 -13
- package/lib/src/{bundled-translations.pt-PT-Cx-eIl9m.js → bundled-translations.pt-PT-Ka3E8T1F.js} +56 -56
- package/lib/src/bundles/bundled-translations.de-DE.json +13 -1
- package/lib/src/bundles/bundled-translations.es-ES.json +13 -1
- package/lib/src/bundles/bundled-translations.fr-CA.json +13 -1
- package/lib/src/bundles/bundled-translations.fr-FR.json +13 -1
- package/lib/src/bundles/bundled-translations.json +13 -1
- package/lib/src/bundles/bundled-translations.pt-BR.json +13 -1
- package/lib/src/bundles/bundled-translations.pt-PT.json +13 -1
- package/lib/src/clients/design-template-client.d.ts +2 -0
- package/lib/src/clients/fabric-render-client.d.ts +3 -0
- package/lib/src/css/library.brand-page-brandCrowd.min.css +69 -20
- package/lib/src/css/library.brand-page-brandPage.min.css +69 -20
- package/lib/src/css/library.brand-page-designCom.min.css +69 -20
- package/lib/src/css/library.brand-page-preview.min.css +69 -20
- package/lib/src/index.d.ts +1 -1
- package/lib/src/index.mjs +92 -92
- package/lib/src/{lib-5LK-vR4z.js → lib-BcLmSEKI.js} +17326 -17136
- package/lib/src/lib.js +1 -1
- package/lib/src/shared/logo-settings/components/EditLogoSettings.mixin.d.ts +10 -0
- package/lib/src/shared/logo-settings/components/LogoSettings.mixin.d.ts +10 -0
- package/lib/src/shared/logo-settings/store/editable-logo-store.d.ts +14 -0
- package/lib/src/shared/logo-settings/store/editable-logo-store.js +46 -0
- package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.d.ts +10 -0
- package/lib/src/shared/template-settings/components/TemplatesSettings.mixin.d.ts +1 -0
- package/lib/src/shared/template-settings/components/TemplatesSettings.mixin.js +33 -0
- package/lib/src/shared/template-settings/store/template-settings-store.js +57 -9
- package/package.json +2 -2
- package/src/brand-page-maker/components/brand-page-maker/BrandPageMakerTemplateSettings.mixin.ts +1 -6
- package/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.ts +4 -4
- package/src/brand-page-maker/composables/useEventTracker.ts +8 -0
- package/src/brand-page-maker/constants/template-constants.ts +1 -2
- package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.ts +24 -0
- package/src/brand-page-maker/utils/rich-text-editor.util.ts +11 -2
- package/src/bundles/bundled-translations.de-DE.json +13 -1
- package/src/bundles/bundled-translations.es-ES.json +13 -1
- package/src/bundles/bundled-translations.fr-CA.json +13 -1
- package/src/bundles/bundled-translations.fr-FR.json +13 -1
- package/src/bundles/bundled-translations.json +13 -1
- package/src/bundles/bundled-translations.pt-BR.json +13 -1
- package/src/bundles/bundled-translations.pt-PT.json +13 -1
- package/src/clients/design-template-client.ts +2 -0
- package/src/clients/fabric-render-client.ts +3 -0
- package/src/lib.ts +1 -0
- package/src/shared/content-settings/components/generate-ai-modal/GenerateAiModal.vue +209 -12
- package/src/shared/content-settings/components/generate-ai-modal/i18n/generate-ai.de-DE.json +13 -1
- package/src/shared/content-settings/components/generate-ai-modal/i18n/generate-ai.es-ES.json +13 -1
- package/src/shared/content-settings/components/generate-ai-modal/i18n/generate-ai.fr-CA.json +13 -1
- package/src/shared/content-settings/components/generate-ai-modal/i18n/generate-ai.fr-FR.json +13 -1
- package/src/shared/content-settings/components/generate-ai-modal/i18n/generate-ai.json +13 -1
- package/src/shared/content-settings/components/generate-ai-modal/i18n/generate-ai.pt-BR.json +13 -1
- package/src/shared/content-settings/components/generate-ai-modal/i18n/generate-ai.pt-PT.json +13 -1
- package/src/shared/logo-settings/store/editable-logo-store.ts +67 -0
- package/src/shared/template-settings/components/TemplatesSettings.mixin.ts +46 -0
- package/src/shared/template-settings/store/template-settings-store.ts +78 -10
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
VIEWPORTS,
|
|
14
14
|
type LogoContent,
|
|
15
15
|
LOGO_VARIATION,
|
|
16
|
+
type FabricLogoTheme,
|
|
16
17
|
} from '../../../brand-page';
|
|
17
18
|
import { PAGE_SECTIONS } from '../../../shared/page-settings/models';
|
|
18
19
|
|
|
@@ -101,6 +102,9 @@ export interface EditableLogoVariation {
|
|
|
101
102
|
variationType: string | undefined;
|
|
102
103
|
width: number;
|
|
103
104
|
height: number;
|
|
105
|
+
expiryDate?: string;
|
|
106
|
+
s3Token?: string;
|
|
107
|
+
logoTheme?: FabricLogoTheme;
|
|
104
108
|
}
|
|
105
109
|
|
|
106
110
|
export interface EditableLogoState {
|
|
@@ -133,6 +137,9 @@ export const useUiEditableLogoStore = defineStore('uiEditableLogo', {
|
|
|
133
137
|
variationType: undefined,
|
|
134
138
|
width: 0,
|
|
135
139
|
height: 0,
|
|
140
|
+
expiryDate: undefined,
|
|
141
|
+
s3Token: undefined,
|
|
142
|
+
logoTheme: undefined,
|
|
136
143
|
},
|
|
137
144
|
{
|
|
138
145
|
variationId: LOGO_VARIATION.LOGO_WITH_BACKGROUND,
|
|
@@ -141,6 +148,9 @@ export const useUiEditableLogoStore = defineStore('uiEditableLogo', {
|
|
|
141
148
|
variationType: undefined,
|
|
142
149
|
width: 0,
|
|
143
150
|
height: 0,
|
|
151
|
+
expiryDate: undefined,
|
|
152
|
+
s3Token: undefined,
|
|
153
|
+
logoTheme: undefined,
|
|
144
154
|
},
|
|
145
155
|
{
|
|
146
156
|
variationId: LOGO_VARIATION.LOGO_ONLY_WITH_TRANSPARENT_BACKGROUND,
|
|
@@ -149,6 +159,9 @@ export const useUiEditableLogoStore = defineStore('uiEditableLogo', {
|
|
|
149
159
|
variationType: LOGO_VARIATION_TYPES.ICON_TRANSPARENT_BACKGROUND_ONLY,
|
|
150
160
|
width: 0,
|
|
151
161
|
height: 0,
|
|
162
|
+
expiryDate: undefined,
|
|
163
|
+
s3Token: undefined,
|
|
164
|
+
logoTheme: undefined,
|
|
152
165
|
},
|
|
153
166
|
{
|
|
154
167
|
variationId: LOGO_VARIATION.TEXT_ONLY_WITH_TRANSPARENT_BACKGROUND,
|
|
@@ -157,6 +170,9 @@ export const useUiEditableLogoStore = defineStore('uiEditableLogo', {
|
|
|
157
170
|
variationType: LOGO_VARIATION_TYPES.TEXT_TRANSPARENT_BACKGROUND_ONLY,
|
|
158
171
|
width: 0,
|
|
159
172
|
height: 0,
|
|
173
|
+
expiryDate: undefined,
|
|
174
|
+
s3Token: undefined,
|
|
175
|
+
logoTheme: undefined,
|
|
160
176
|
},
|
|
161
177
|
],
|
|
162
178
|
logoEdits: {
|
|
@@ -451,6 +467,9 @@ export const useUiEditableLogoStore = defineStore('uiEditableLogo', {
|
|
|
451
467
|
editableLogoVariation.base64 = result.base64;
|
|
452
468
|
editableLogoVariation.width = result.width;
|
|
453
469
|
editableLogoVariation.height = result.height;
|
|
470
|
+
editableLogoVariation.expiryDate = result.expiryDate;
|
|
471
|
+
editableLogoVariation.s3Token = result.s3Token;
|
|
472
|
+
editableLogoVariation.logoTheme = result.logoTheme;
|
|
454
473
|
|
|
455
474
|
return result;
|
|
456
475
|
},
|
|
@@ -482,6 +501,53 @@ export const useUiEditableLogoStore = defineStore('uiEditableLogo', {
|
|
|
482
501
|
}
|
|
483
502
|
},
|
|
484
503
|
|
|
504
|
+
isS3TokenExpired(expiryDate: string | undefined): boolean {
|
|
505
|
+
if (!expiryDate) {
|
|
506
|
+
return true;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
const expiryTime = new Date(expiryDate).getTime();
|
|
510
|
+
const currentTime = Date.now();
|
|
511
|
+
|
|
512
|
+
// Add a 5-minute buffer to refresh before actual expiry
|
|
513
|
+
const bufferMs = 5 * 60 * 1000;
|
|
514
|
+
|
|
515
|
+
return currentTime >= expiryTime - bufferMs;
|
|
516
|
+
},
|
|
517
|
+
|
|
518
|
+
async refreshS3TokenIfExpiredAsync(
|
|
519
|
+
logoVariation: number,
|
|
520
|
+
): Promise<boolean> {
|
|
521
|
+
const editableLogoVariation = this.editableLogoVariations[logoVariation];
|
|
522
|
+
|
|
523
|
+
if (!editableLogoVariation) {
|
|
524
|
+
return false;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
const isExpired = this.isS3TokenExpired(editableLogoVariation.expiryDate);
|
|
528
|
+
|
|
529
|
+
if (isExpired) {
|
|
530
|
+
const logoStore = useLogoStore();
|
|
531
|
+
|
|
532
|
+
// Only refresh if logo template asset is available
|
|
533
|
+
if (!logoStore.logoTemplateAsset?.token) {
|
|
534
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
535
|
+
console.warn(
|
|
536
|
+
'Cannot refresh expired S3 token: logo template asset not available',
|
|
537
|
+
);
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
return false;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
await this.updateEditableLogoImageUrlAsync();
|
|
544
|
+
|
|
545
|
+
return true;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
return false;
|
|
549
|
+
},
|
|
550
|
+
|
|
485
551
|
async postEditableLogoRequestAsync(payload: {
|
|
486
552
|
returnJson: boolean;
|
|
487
553
|
dimensionType: string;
|
|
@@ -492,6 +558,7 @@ export const useUiEditableLogoStore = defineStore('uiEditableLogo', {
|
|
|
492
558
|
|
|
493
559
|
const body: ModifyLogoDataRequest = {
|
|
494
560
|
returnJson: payload?.returnJson || false,
|
|
561
|
+
generateS3Url: true,
|
|
495
562
|
dimensionsType: payload?.dimensionType,
|
|
496
563
|
variation: payload?.variationType,
|
|
497
564
|
primaryText: payload?.defaultPrimaryText,
|
|
@@ -19,6 +19,11 @@ import {
|
|
|
19
19
|
import { templateSettingsTr } from '../../../composables/useTranslate';
|
|
20
20
|
|
|
21
21
|
import { useEventTracker } from '../../../brand-page-maker/composables/useEventTracker';
|
|
22
|
+
import {
|
|
23
|
+
useUiEditableLogoStore,
|
|
24
|
+
useUiLogoSettingsStore,
|
|
25
|
+
} from '../../logo-settings/store';
|
|
26
|
+
import { useLogoStore } from '../../../brand-page-maker/stores/logo-store';
|
|
22
27
|
|
|
23
28
|
export default defineComponent({
|
|
24
29
|
props: {
|
|
@@ -155,6 +160,9 @@ export default defineComponent({
|
|
|
155
160
|
},
|
|
156
161
|
},
|
|
157
162
|
async mounted() {
|
|
163
|
+
// Check and refresh S3 token if expired before loading templates
|
|
164
|
+
await this.checkAndRefreshS3TokenIfExpired();
|
|
165
|
+
|
|
158
166
|
// load templates on mounted if it is not initialised
|
|
159
167
|
if (!this.pageCount) {
|
|
160
168
|
await this.templateSettingsStore.loadPageNo({
|
|
@@ -166,6 +174,44 @@ export default defineComponent({
|
|
|
166
174
|
this.debounceOnSearch = debounce(this.setSearchText, 500);
|
|
167
175
|
},
|
|
168
176
|
methods: {
|
|
177
|
+
async checkAndRefreshS3TokenIfExpired() {
|
|
178
|
+
const brandPageMakerContainerStore = useBrandPageContainerStore();
|
|
179
|
+
const editableLogoStore = useUiEditableLogoStore();
|
|
180
|
+
const logoStore = useLogoStore();
|
|
181
|
+
const logoSettingsStore = useUiLogoSettingsStore();
|
|
182
|
+
|
|
183
|
+
// Only check for non-admin (pre-purchase) and non-BYO logos
|
|
184
|
+
if (brandPageMakerContainerStore.isAdmin) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const isByo = logoStore.logoTemplateAsset?.isByo ?? false;
|
|
189
|
+
|
|
190
|
+
if (isByo) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const logoVariation = logoSettingsStore.selectedLogoImage.logoVariation;
|
|
195
|
+
|
|
196
|
+
if (logoVariation === undefined) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
try {
|
|
201
|
+
const wasRefreshed =
|
|
202
|
+
await editableLogoStore.refreshS3TokenIfExpiredAsync(logoVariation);
|
|
203
|
+
|
|
204
|
+
if (wasRefreshed && process.env.NODE_ENV !== 'production') {
|
|
205
|
+
console.log(
|
|
206
|
+
'S3 token was expired in TemplatesSettings and has been refreshed',
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
} catch (error) {
|
|
210
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
211
|
+
console.error('Error checking/refreshing S3 token:', error);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
},
|
|
169
215
|
async onNextClicked() {
|
|
170
216
|
if (!this.isLoadMoreBtnEnabled) {
|
|
171
217
|
return;
|
|
@@ -21,13 +21,17 @@ import {
|
|
|
21
21
|
useBrandPageContainerStore,
|
|
22
22
|
useBrandPageMakerStore,
|
|
23
23
|
useBrandPageMakerUserStore,
|
|
24
|
+
useLogoStore,
|
|
24
25
|
useUiStore,
|
|
25
26
|
} from '../../../brand-page-maker/stores';
|
|
26
27
|
import { useUiSideBarStore } from '../../side-bar/store';
|
|
27
28
|
import { BrandPageModel } from '../../../brand-page/models';
|
|
28
29
|
import { migrateBrandPageModel } from '../../../brand-page/utils';
|
|
29
30
|
import { getAiContentIndexByTemplateTokenAndNumberOfVariations } from '../../../brand-page-maker/utils/ai-content-selection.util';
|
|
30
|
-
import {
|
|
31
|
+
import {
|
|
32
|
+
useUiEditableLogoStore,
|
|
33
|
+
useUiLogoSettingsStore,
|
|
34
|
+
} from '../../logo-settings/store';
|
|
31
35
|
import {
|
|
32
36
|
templateSettingsTr,
|
|
33
37
|
getCurrentLocale,
|
|
@@ -66,9 +70,7 @@ export const useUiTemplateSettingsStore = defineStore('uiTemplateSettings', {
|
|
|
66
70
|
const brandPageMakerUserStore = useBrandPageMakerUserStore();
|
|
67
71
|
|
|
68
72
|
// Set renderAsImage to true if not admin AND not pre-purchase
|
|
69
|
-
const renderAsImage =
|
|
70
|
-
!brandPageMakerUserStore.isAdmin &&
|
|
71
|
-
!brandPageContainerStore.isPrePurchase;
|
|
73
|
+
const renderAsImage = !brandPageMakerUserStore.isAdmin;
|
|
72
74
|
|
|
73
75
|
return {
|
|
74
76
|
isBusy: false,
|
|
@@ -233,6 +235,8 @@ export const useUiTemplateSettingsStore = defineStore('uiTemplateSettings', {
|
|
|
233
235
|
const brandPageContainerStore = useBrandPageContainerStore();
|
|
234
236
|
const brandPageMakerUserStore = useBrandPageMakerUserStore();
|
|
235
237
|
const logoSettingsStore = useUiLogoSettingsStore();
|
|
238
|
+
const logoStore = useLogoStore();
|
|
239
|
+
const editableLogoStore = useUiEditableLogoStore();
|
|
236
240
|
const designTemplateToken = brandPageContainerStore.designTemplateToken;
|
|
237
241
|
|
|
238
242
|
if (brandPageMakerStore.isInitialising) {
|
|
@@ -268,6 +272,28 @@ export const useUiTemplateSettingsStore = defineStore('uiTemplateSettings', {
|
|
|
268
272
|
|
|
269
273
|
const currentLocale = getCurrentLocale();
|
|
270
274
|
|
|
275
|
+
const isByo = logoStore.logoTemplateAsset?.isByo ?? false;
|
|
276
|
+
const logoTemplateToken =
|
|
277
|
+
logoStore.logoTemplateAsset?.token ?? undefined;
|
|
278
|
+
const logoVariation = logoSettingsStore.selectedLogoImage.logoVariation;
|
|
279
|
+
|
|
280
|
+
// Check if S3 token is expired and refresh if needed
|
|
281
|
+
if (!isByo) {
|
|
282
|
+
const wasRefreshed =
|
|
283
|
+
await editableLogoStore.refreshS3TokenIfExpiredAsync(logoVariation);
|
|
284
|
+
|
|
285
|
+
if (wasRefreshed) {
|
|
286
|
+
setTimeout(() => {
|
|
287
|
+
this.loadPageNo({ pageNo });
|
|
288
|
+
}, LOAD_PAGE_RETRY_DELAY);
|
|
289
|
+
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
const editableLogoVariation =
|
|
295
|
+
editableLogoStore.editableLogoVariations[logoVariation];
|
|
296
|
+
|
|
271
297
|
const result =
|
|
272
298
|
await designTemplateClient.getTemplateItemsByTemplateType(
|
|
273
299
|
this.templateType,
|
|
@@ -282,6 +308,8 @@ export const useUiTemplateSettingsStore = defineStore('uiTemplateSettings', {
|
|
|
282
308
|
personalisable: this.selectedTab.key === TEMPLATE_TABS.AI,
|
|
283
309
|
selectedTemplateToken: designTemplateToken,
|
|
284
310
|
locale: currentLocale,
|
|
311
|
+
logoS3Token: !isByo ? editableLogoVariation.s3Token : undefined,
|
|
312
|
+
logoTemplateToken: isByo ? logoTemplateToken : undefined,
|
|
285
313
|
},
|
|
286
314
|
);
|
|
287
315
|
|
|
@@ -294,10 +322,7 @@ export const useUiTemplateSettingsStore = defineStore('uiTemplateSettings', {
|
|
|
294
322
|
const templates = await Promise.all(
|
|
295
323
|
result.paginatedItems.map(async (item) => {
|
|
296
324
|
try {
|
|
297
|
-
if (
|
|
298
|
-
brandPageContainerStore.isPrePurchase ||
|
|
299
|
-
brandPageMakerUserStore.isAdmin
|
|
300
|
-
) {
|
|
325
|
+
if (brandPageMakerUserStore.isAdmin) {
|
|
301
326
|
// Pre-purchase: full template with brandPageModel for live rendering
|
|
302
327
|
const template =
|
|
303
328
|
await designTemplateClient.getTemplateByTemplateToken(
|
|
@@ -376,6 +401,14 @@ export const useUiTemplateSettingsStore = defineStore('uiTemplateSettings', {
|
|
|
376
401
|
templateId: payload.templateId,
|
|
377
402
|
forceApply: payload.forceApply,
|
|
378
403
|
});
|
|
404
|
+
|
|
405
|
+
if (payload.forceApply) {
|
|
406
|
+
await this._setTemplates({
|
|
407
|
+
templates: [],
|
|
408
|
+
});
|
|
409
|
+
await this._setPageNoLoaded({ pageNoLoaded: 0 });
|
|
410
|
+
await this.loadPageNo({ pageNo: 1 });
|
|
411
|
+
}
|
|
379
412
|
},
|
|
380
413
|
async onCategorySelected(payload: OnCategorySelectedPayload) {
|
|
381
414
|
await this._setTemplates({
|
|
@@ -459,9 +492,12 @@ export const useUiTemplateSettingsStore = defineStore('uiTemplateSettings', {
|
|
|
459
492
|
*/
|
|
460
493
|
setupLogoChangeWatcher() {
|
|
461
494
|
const logoSettingsStore = useUiLogoSettingsStore();
|
|
462
|
-
const
|
|
495
|
+
const editableLogoStore = useUiEditableLogoStore();
|
|
463
496
|
const brandPageMakerUserStore = useBrandPageMakerUserStore();
|
|
464
497
|
const { selectedLogoImage } = storeToRefs(logoSettingsStore);
|
|
498
|
+
const { editableLogoVariations } = storeToRefs(editableLogoStore);
|
|
499
|
+
|
|
500
|
+
let s3TokenDebounceTimer: ReturnType<typeof setTimeout> | null = null;
|
|
465
501
|
|
|
466
502
|
// Watch for changes to logoImage (token or variation changes)
|
|
467
503
|
watch(
|
|
@@ -478,7 +514,6 @@ export const useUiTemplateSettingsStore = defineStore('uiTemplateSettings', {
|
|
|
478
514
|
newLogoImage.logoVariation !== oldLogoImage.logoVariation;
|
|
479
515
|
|
|
480
516
|
if (
|
|
481
|
-
!brandPageContainerStore.isPrePurchase &&
|
|
482
517
|
!brandPageMakerUserStore.isAdmin &&
|
|
483
518
|
newLogoImage.logoDraftToken &&
|
|
484
519
|
hasLogoChanged
|
|
@@ -493,6 +528,39 @@ export const useUiTemplateSettingsStore = defineStore('uiTemplateSettings', {
|
|
|
493
528
|
},
|
|
494
529
|
{ deep: true },
|
|
495
530
|
);
|
|
531
|
+
|
|
532
|
+
// Watch for S3 token changes (when user edits logo colors, text, etc.)
|
|
533
|
+
// Debounced to avoid excessive reloads during rapid edits
|
|
534
|
+
watch(
|
|
535
|
+
() =>
|
|
536
|
+
editableLogoVariations.value[selectedLogoImage.value.logoVariation]
|
|
537
|
+
?.s3Token,
|
|
538
|
+
async (newS3Token, oldS3Token) => {
|
|
539
|
+
if (s3TokenDebounceTimer) {
|
|
540
|
+
clearTimeout(s3TokenDebounceTimer);
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
if (!oldS3Token) {
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
if (newS3Token === oldS3Token) {
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
if (brandPageMakerUserStore.isAdmin) {
|
|
552
|
+
return;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
// Debounce the reload by 500ms to avoid rapid successive reloads
|
|
556
|
+
s3TokenDebounceTimer = setTimeout(async () => {
|
|
557
|
+
await this._setTemplates({ templates: [] });
|
|
558
|
+
await this._setPageNoLoaded({ pageNoLoaded: 0 });
|
|
559
|
+
await this._setPageNo({ pageNo: 1 });
|
|
560
|
+
await this.loadPageNo({ pageNo: 1 });
|
|
561
|
+
}, 500);
|
|
562
|
+
},
|
|
563
|
+
);
|
|
496
564
|
},
|
|
497
565
|
},
|
|
498
566
|
});
|