@designcrowd/library.brand-page 5.16.29-pre-temp-13 → 5.16.29
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-C5cvDYY0.js → CreatedOnBrandCrowd-de-de-BqxcoXxz.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-D0KCSK_6.js → CreatedOnBrandCrowd-en-us-SshxcaVK.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-BtlaguF9.js → CreatedOnBrandCrowd-es-es-CLtIWvg0.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-RGdnURaa.js → CreatedOnBrandCrowd-fr-ca-CWYkoCNp.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-RGdnURaa.js → CreatedOnBrandCrowd-fr-fr-CWYkoCNp.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-BJwt5ATI.js → CreatedOnBrandCrowd-pt-br-CZRm-IwJ.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-BJwt5ATI.js → CreatedOnBrandCrowd-pt-pt-CZRm-IwJ.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-LUA5Wvy5.js → CreatedOnDcom-de-de-sLxgILeR.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-Dd1UPBVq.js → CreatedOnDcom-en-us-BxRGkmts.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-CD923NVo.js → CreatedOnDcom-es-es-oXrblCQa.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-C6Mc--2a.js → CreatedOnDcom-fr-ca-HlHhzmQV.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-Ffrd6Erx.js → CreatedOnDcom-fr-fr-DzlyiYfW.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-BfoY5gWJ.js → CreatedOnDcom-pt-br-Bi2slHcB.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-f0ywi387.js → CreatedOnDcom-pt-pt-CYatu2I5.js} +1 -1
- package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMakerTemplateSettings.mixin.js +5 -2
- package/lib/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.js +4 -4
- package/lib/src/brand-page-maker/constants/template-constants.d.ts +2 -1
- package/lib/src/brand-page-maker/constants/template-constants.js +2 -1
- package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.js +0 -21
- package/lib/src/clients/design-template-client.d.ts +0 -2
- package/lib/src/clients/fabric-render-client.d.ts +0 -3
- package/lib/src/index.d.ts +1 -1
- package/lib/src/index.mjs +92 -92
- package/lib/src/{lib-BcLmSEKI.js → lib-COUy2gkw.js} +13475 -13552
- package/lib/src/lib.js +1 -1
- package/lib/src/shared/logo-settings/components/EditLogoSettings.mixin.d.ts +0 -10
- package/lib/src/shared/logo-settings/components/LogoSettings.mixin.d.ts +0 -10
- package/lib/src/shared/logo-settings/store/editable-logo-store.d.ts +0 -14
- package/lib/src/shared/logo-settings/store/editable-logo-store.js +0 -46
- package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.d.ts +0 -10
- package/lib/src/shared/template-settings/components/TemplatesSettings.mixin.d.ts +0 -1
- package/lib/src/shared/template-settings/components/TemplatesSettings.mixin.js +0 -33
- package/lib/src/shared/template-settings/store/template-settings-store.js +9 -57
- package/package.json +2 -2
- package/src/brand-page-maker/components/brand-page-maker/BrandPageMakerTemplateSettings.mixin.ts +6 -1
- package/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.ts +4 -4
- package/src/brand-page-maker/constants/template-constants.ts +2 -1
- package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.ts +0 -24
- package/src/clients/design-template-client.ts +0 -2
- package/src/clients/fabric-render-client.ts +0 -3
- package/src/lib.ts +0 -1
- package/src/shared/logo-settings/store/editable-logo-store.ts +0 -67
- package/src/shared/template-settings/components/TemplatesSettings.mixin.ts +0 -46
- package/src/shared/template-settings/store/template-settings-store.ts +10 -78
package/lib/src/lib.js
CHANGED
|
@@ -26,7 +26,7 @@ export { default as SensitiveContentModal } from './brand-page/components/sensit
|
|
|
26
26
|
// functions
|
|
27
27
|
export { getBrandPageViewModelFromBrandPageModel, migrateBrandPageModel, } from './brand-page/utils';
|
|
28
28
|
export * as brandPageUtils from './brand-page/utils';
|
|
29
|
-
export { getOptimalLogoSize, calculateOptimizedLogoDimensions,
|
|
29
|
+
export { getOptimalLogoSize, calculateOptimizedLogoDimensions, } from './brand-page/utils/logo.util';
|
|
30
30
|
export { sanitizeRTEHtml } from './brand-page-maker/utils';
|
|
31
31
|
export { getPageSlugFromPageTitle } from './brand-page-maker/utils/slug.util';
|
|
32
32
|
// stores
|
|
@@ -81,14 +81,6 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
81
81
|
variationType: string | undefined;
|
|
82
82
|
width: number;
|
|
83
83
|
height: number;
|
|
84
|
-
expiryDate?: string | undefined;
|
|
85
|
-
s3Token?: string | undefined;
|
|
86
|
-
logoTheme?: {
|
|
87
|
-
backgroundColors: string[];
|
|
88
|
-
textColors: string[];
|
|
89
|
-
textOpacities: number[];
|
|
90
|
-
textValues: any;
|
|
91
|
-
} | undefined;
|
|
92
84
|
}[];
|
|
93
85
|
logoTemplateMetadata: string;
|
|
94
86
|
isLogoDraftSaved: boolean;
|
|
@@ -113,8 +105,6 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
113
105
|
updateEditableLogoImageByVariationAsync(editableLogoVariation: import("../store/editable-logo-store").EditableLogoVariation, defaultPrimaryText?: string | undefined): Promise<import("../../../clients/fabric-render-client").ModifyLogoDataResponse | null>;
|
|
114
106
|
getDraftMetadata(logoDraftToken: string): string | undefined;
|
|
115
107
|
upsertDraftMetadata(metadata: string): void;
|
|
116
|
-
isS3TokenExpired(expiryDate: string | undefined): boolean;
|
|
117
|
-
refreshS3TokenIfExpiredAsync(logoVariation: number): Promise<boolean>;
|
|
118
108
|
postEditableLogoRequestAsync(payload: {
|
|
119
109
|
returnJson: boolean;
|
|
120
110
|
dimensionType: string;
|
|
@@ -253,14 +253,6 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
253
253
|
variationType: string | undefined;
|
|
254
254
|
width: number;
|
|
255
255
|
height: number;
|
|
256
|
-
expiryDate?: string | undefined;
|
|
257
|
-
s3Token?: string | undefined;
|
|
258
|
-
logoTheme?: {
|
|
259
|
-
backgroundColors: string[];
|
|
260
|
-
textColors: string[];
|
|
261
|
-
textOpacities: number[];
|
|
262
|
-
textValues: any;
|
|
263
|
-
} | undefined;
|
|
264
256
|
}[];
|
|
265
257
|
logoTemplateMetadata: string;
|
|
266
258
|
isLogoDraftSaved: boolean;
|
|
@@ -285,8 +277,6 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
285
277
|
updateEditableLogoImageByVariationAsync(editableLogoVariation: import("../store").EditableLogoVariation, defaultPrimaryText?: string | undefined): Promise<import("../../../clients/fabric-render-client").ModifyLogoDataResponse | null>;
|
|
286
278
|
getDraftMetadata(logoDraftToken: string): string | undefined;
|
|
287
279
|
upsertDraftMetadata(metadata: string): void;
|
|
288
|
-
isS3TokenExpired(expiryDate: string | undefined): boolean;
|
|
289
|
-
refreshS3TokenIfExpiredAsync(logoVariation: number): Promise<boolean>;
|
|
290
280
|
postEditableLogoRequestAsync(payload: {
|
|
291
281
|
returnJson: boolean;
|
|
292
282
|
dimensionType: string;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { type ModifyLogoDataResponse } from '../../../clients/fabric-render-client';
|
|
2
|
-
import { type FabricLogoTheme } from '../../../brand-page';
|
|
3
2
|
export interface GradientObject {
|
|
4
3
|
type: string;
|
|
5
4
|
angle: number | undefined;
|
|
@@ -61,9 +60,6 @@ export interface EditableLogoVariation {
|
|
|
61
60
|
variationType: string | undefined;
|
|
62
61
|
width: number;
|
|
63
62
|
height: number;
|
|
64
|
-
expiryDate?: string;
|
|
65
|
-
s3Token?: string;
|
|
66
|
-
logoTheme?: FabricLogoTheme;
|
|
67
63
|
}
|
|
68
64
|
export interface EditableLogoState {
|
|
69
65
|
enableEditMode: boolean;
|
|
@@ -155,14 +151,6 @@ export declare const useUiEditableLogoStore: import("pinia").StoreDefinition<"ui
|
|
|
155
151
|
variationType: string | undefined;
|
|
156
152
|
width: number;
|
|
157
153
|
height: number;
|
|
158
|
-
expiryDate?: string | undefined;
|
|
159
|
-
s3Token?: string | undefined;
|
|
160
|
-
logoTheme?: {
|
|
161
|
-
backgroundColors: string[];
|
|
162
|
-
textColors: string[];
|
|
163
|
-
textOpacities: number[];
|
|
164
|
-
textValues: any;
|
|
165
|
-
} | undefined;
|
|
166
154
|
}[];
|
|
167
155
|
logoTemplateMetadata: string;
|
|
168
156
|
isLogoDraftSaved: boolean;
|
|
@@ -187,8 +175,6 @@ export declare const useUiEditableLogoStore: import("pinia").StoreDefinition<"ui
|
|
|
187
175
|
updateEditableLogoImageByVariationAsync(editableLogoVariation: EditableLogoVariation, defaultPrimaryText?: string): Promise<ModifyLogoDataResponse | null>;
|
|
188
176
|
getDraftMetadata(logoDraftToken: string): string | undefined;
|
|
189
177
|
upsertDraftMetadata(metadata: string): void;
|
|
190
|
-
isS3TokenExpired(expiryDate: string | undefined): boolean;
|
|
191
|
-
refreshS3TokenIfExpiredAsync(logoVariation: number): Promise<boolean>;
|
|
192
178
|
postEditableLogoRequestAsync(payload: {
|
|
193
179
|
returnJson: boolean;
|
|
194
180
|
dimensionType: string;
|
|
@@ -19,9 +19,6 @@ export const useUiEditableLogoStore = defineStore('uiEditableLogo', {
|
|
|
19
19
|
variationType: undefined,
|
|
20
20
|
width: 0,
|
|
21
21
|
height: 0,
|
|
22
|
-
expiryDate: undefined,
|
|
23
|
-
s3Token: undefined,
|
|
24
|
-
logoTheme: undefined,
|
|
25
22
|
},
|
|
26
23
|
{
|
|
27
24
|
variationId: LOGO_VARIATION.LOGO_WITH_BACKGROUND,
|
|
@@ -30,9 +27,6 @@ export const useUiEditableLogoStore = defineStore('uiEditableLogo', {
|
|
|
30
27
|
variationType: undefined,
|
|
31
28
|
width: 0,
|
|
32
29
|
height: 0,
|
|
33
|
-
expiryDate: undefined,
|
|
34
|
-
s3Token: undefined,
|
|
35
|
-
logoTheme: undefined,
|
|
36
30
|
},
|
|
37
31
|
{
|
|
38
32
|
variationId: LOGO_VARIATION.LOGO_ONLY_WITH_TRANSPARENT_BACKGROUND,
|
|
@@ -41,9 +35,6 @@ export const useUiEditableLogoStore = defineStore('uiEditableLogo', {
|
|
|
41
35
|
variationType: LOGO_VARIATION_TYPES.ICON_TRANSPARENT_BACKGROUND_ONLY,
|
|
42
36
|
width: 0,
|
|
43
37
|
height: 0,
|
|
44
|
-
expiryDate: undefined,
|
|
45
|
-
s3Token: undefined,
|
|
46
|
-
logoTheme: undefined,
|
|
47
38
|
},
|
|
48
39
|
{
|
|
49
40
|
variationId: LOGO_VARIATION.TEXT_ONLY_WITH_TRANSPARENT_BACKGROUND,
|
|
@@ -52,9 +43,6 @@ export const useUiEditableLogoStore = defineStore('uiEditableLogo', {
|
|
|
52
43
|
variationType: LOGO_VARIATION_TYPES.TEXT_TRANSPARENT_BACKGROUND_ONLY,
|
|
53
44
|
width: 0,
|
|
54
45
|
height: 0,
|
|
55
|
-
expiryDate: undefined,
|
|
56
|
-
s3Token: undefined,
|
|
57
|
-
logoTheme: undefined,
|
|
58
46
|
},
|
|
59
47
|
],
|
|
60
48
|
logoEdits: {
|
|
@@ -266,9 +254,6 @@ export const useUiEditableLogoStore = defineStore('uiEditableLogo', {
|
|
|
266
254
|
editableLogoVariation.base64 = result.base64;
|
|
267
255
|
editableLogoVariation.width = result.width;
|
|
268
256
|
editableLogoVariation.height = result.height;
|
|
269
|
-
editableLogoVariation.expiryDate = result.expiryDate;
|
|
270
|
-
editableLogoVariation.s3Token = result.s3Token;
|
|
271
|
-
editableLogoVariation.logoTheme = result.logoTheme;
|
|
272
257
|
return result;
|
|
273
258
|
},
|
|
274
259
|
getDraftMetadata(logoDraftToken) {
|
|
@@ -293,41 +278,10 @@ export const useUiEditableLogoStore = defineStore('uiEditableLogo', {
|
|
|
293
278
|
});
|
|
294
279
|
}
|
|
295
280
|
},
|
|
296
|
-
isS3TokenExpired(expiryDate) {
|
|
297
|
-
if (!expiryDate) {
|
|
298
|
-
return true;
|
|
299
|
-
}
|
|
300
|
-
const expiryTime = new Date(expiryDate).getTime();
|
|
301
|
-
const currentTime = Date.now();
|
|
302
|
-
// Add a 5-minute buffer to refresh before actual expiry
|
|
303
|
-
const bufferMs = 5 * 60 * 1000;
|
|
304
|
-
return currentTime >= expiryTime - bufferMs;
|
|
305
|
-
},
|
|
306
|
-
async refreshS3TokenIfExpiredAsync(logoVariation) {
|
|
307
|
-
const editableLogoVariation = this.editableLogoVariations[logoVariation];
|
|
308
|
-
if (!editableLogoVariation) {
|
|
309
|
-
return false;
|
|
310
|
-
}
|
|
311
|
-
const isExpired = this.isS3TokenExpired(editableLogoVariation.expiryDate);
|
|
312
|
-
if (isExpired) {
|
|
313
|
-
const logoStore = useLogoStore();
|
|
314
|
-
// Only refresh if logo template asset is available
|
|
315
|
-
if (!logoStore.logoTemplateAsset?.token) {
|
|
316
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
317
|
-
console.warn('Cannot refresh expired S3 token: logo template asset not available');
|
|
318
|
-
}
|
|
319
|
-
return false;
|
|
320
|
-
}
|
|
321
|
-
await this.updateEditableLogoImageUrlAsync();
|
|
322
|
-
return true;
|
|
323
|
-
}
|
|
324
|
-
return false;
|
|
325
|
-
},
|
|
326
281
|
async postEditableLogoRequestAsync(payload) {
|
|
327
282
|
const logoStore = useLogoStore();
|
|
328
283
|
const body = {
|
|
329
284
|
returnJson: payload?.returnJson || false,
|
|
330
|
-
generateS3Url: true,
|
|
331
285
|
dimensionsType: payload?.dimensionType,
|
|
332
286
|
variation: payload?.variationType,
|
|
333
287
|
primaryText: payload?.defaultPrimaryText,
|
|
@@ -4191,14 +4191,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
4191
4191
|
variationType: string | undefined;
|
|
4192
4192
|
width: number;
|
|
4193
4193
|
height: number;
|
|
4194
|
-
expiryDate?: string | undefined;
|
|
4195
|
-
s3Token?: string | undefined;
|
|
4196
|
-
logoTheme?: {
|
|
4197
|
-
backgroundColors: string[];
|
|
4198
|
-
textColors: string[];
|
|
4199
|
-
textOpacities: number[];
|
|
4200
|
-
textValues: any;
|
|
4201
|
-
} | undefined;
|
|
4202
4194
|
}[];
|
|
4203
4195
|
logoTemplateMetadata: string;
|
|
4204
4196
|
isLogoDraftSaved: boolean;
|
|
@@ -4223,8 +4215,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
4223
4215
|
updateEditableLogoImageByVariationAsync(editableLogoVariation: import("../../../logo-settings/store/editable-logo-store").EditableLogoVariation, defaultPrimaryText?: string | undefined): Promise<import("../../../../clients/fabric-render-client").ModifyLogoDataResponse | null>;
|
|
4224
4216
|
getDraftMetadata(logoDraftToken: string): string | undefined;
|
|
4225
4217
|
upsertDraftMetadata(metadata: string): void;
|
|
4226
|
-
isS3TokenExpired(expiryDate: string | undefined): boolean;
|
|
4227
|
-
refreshS3TokenIfExpiredAsync(logoVariation: number): Promise<boolean>;
|
|
4228
4218
|
postEditableLogoRequestAsync(payload: {
|
|
4229
4219
|
returnJson: boolean;
|
|
4230
4220
|
dimensionType: string;
|
|
@@ -601,7 +601,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
601
601
|
tabMenuClasses(): string;
|
|
602
602
|
visibleTabs(): any;
|
|
603
603
|
}, {
|
|
604
|
-
checkAndRefreshS3TokenIfExpired(): Promise<void>;
|
|
605
604
|
onNextClicked(): Promise<void>;
|
|
606
605
|
onPreviousClicked(): Promise<void>;
|
|
607
606
|
internalOnTemplateSelected(templateId: string): Promise<void>;
|
|
@@ -6,8 +6,6 @@ import { debounce } from '../../functions';
|
|
|
6
6
|
import { useBrandPageContainerStore, useBrandPageMakerStore, useUiStore, } from '../../../brand-page-maker/stores';
|
|
7
7
|
import { templateSettingsTr } from '../../../composables/useTranslate';
|
|
8
8
|
import { useEventTracker } from '../../../brand-page-maker/composables/useEventTracker';
|
|
9
|
-
import { useUiEditableLogoStore, useUiLogoSettingsStore, } from '../../logo-settings/store';
|
|
10
|
-
import { useLogoStore } from '../../../brand-page-maker/stores/logo-store';
|
|
11
9
|
export default defineComponent({
|
|
12
10
|
props: {
|
|
13
11
|
numColumns: {
|
|
@@ -109,8 +107,6 @@ export default defineComponent({
|
|
|
109
107
|
},
|
|
110
108
|
},
|
|
111
109
|
async mounted() {
|
|
112
|
-
// Check and refresh S3 token if expired before loading templates
|
|
113
|
-
await this.checkAndRefreshS3TokenIfExpired();
|
|
114
110
|
// load templates on mounted if it is not initialised
|
|
115
111
|
if (!this.pageCount) {
|
|
116
112
|
await this.templateSettingsStore.loadPageNo({
|
|
@@ -122,35 +118,6 @@ export default defineComponent({
|
|
|
122
118
|
this.debounceOnSearch = debounce(this.setSearchText, 500);
|
|
123
119
|
},
|
|
124
120
|
methods: {
|
|
125
|
-
async checkAndRefreshS3TokenIfExpired() {
|
|
126
|
-
const brandPageMakerContainerStore = useBrandPageContainerStore();
|
|
127
|
-
const editableLogoStore = useUiEditableLogoStore();
|
|
128
|
-
const logoStore = useLogoStore();
|
|
129
|
-
const logoSettingsStore = useUiLogoSettingsStore();
|
|
130
|
-
// Only check for non-admin (pre-purchase) and non-BYO logos
|
|
131
|
-
if (brandPageMakerContainerStore.isAdmin) {
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
const isByo = logoStore.logoTemplateAsset?.isByo ?? false;
|
|
135
|
-
if (isByo) {
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
const logoVariation = logoSettingsStore.selectedLogoImage.logoVariation;
|
|
139
|
-
if (logoVariation === undefined) {
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
try {
|
|
143
|
-
const wasRefreshed = await editableLogoStore.refreshS3TokenIfExpiredAsync(logoVariation);
|
|
144
|
-
if (wasRefreshed && process.env.NODE_ENV !== 'production') {
|
|
145
|
-
console.log('S3 token was expired in TemplatesSettings and has been refreshed');
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
catch (error) {
|
|
149
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
150
|
-
console.error('Error checking/refreshing S3 token:', error);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
},
|
|
154
121
|
async onNextClicked() {
|
|
155
122
|
if (!this.isLoadMoreBtnEnabled) {
|
|
156
123
|
return;
|
|
@@ -3,12 +3,12 @@ import * as DesignTemplateClient from '../../../clients/design-template-client';
|
|
|
3
3
|
import {} from '../../../clients/models';
|
|
4
4
|
import { BP_DEFAULT_TEMPLATE_TYPE_NAME, SIDE_BAR_TAB_NAMES, } from '../../../brand-page-maker/constants';
|
|
5
5
|
import { defineStore, storeToRefs } from 'pinia';
|
|
6
|
-
import { useBrandPageContainerStore, useBrandPageMakerStore, useBrandPageMakerUserStore,
|
|
6
|
+
import { useBrandPageContainerStore, useBrandPageMakerStore, useBrandPageMakerUserStore, useUiStore, } from '../../../brand-page-maker/stores';
|
|
7
7
|
import { useUiSideBarStore } from '../../side-bar/store';
|
|
8
8
|
import { BrandPageModel } from '../../../brand-page/models';
|
|
9
9
|
import { migrateBrandPageModel } from '../../../brand-page/utils';
|
|
10
10
|
import { getAiContentIndexByTemplateTokenAndNumberOfVariations } from '../../../brand-page-maker/utils/ai-content-selection.util';
|
|
11
|
-
import {
|
|
11
|
+
import { useUiLogoSettingsStore } from '../../logo-settings/store';
|
|
12
12
|
import { templateSettingsTr, getCurrentLocale, } from '../../../composables/useTranslate';
|
|
13
13
|
import { watch } from 'vue';
|
|
14
14
|
export const DEFAULT_PAGE_SIZE = 6;
|
|
@@ -18,7 +18,8 @@ export const useUiTemplateSettingsStore = defineStore('uiTemplateSettings', {
|
|
|
18
18
|
const brandPageContainerStore = useBrandPageContainerStore();
|
|
19
19
|
const brandPageMakerUserStore = useBrandPageMakerUserStore();
|
|
20
20
|
// Set renderAsImage to true if not admin AND not pre-purchase
|
|
21
|
-
const renderAsImage = !brandPageMakerUserStore.isAdmin
|
|
21
|
+
const renderAsImage = !brandPageMakerUserStore.isAdmin &&
|
|
22
|
+
!brandPageContainerStore.isPrePurchase;
|
|
22
23
|
return {
|
|
23
24
|
isBusy: false,
|
|
24
25
|
pageCount: 0,
|
|
@@ -143,8 +144,6 @@ export const useUiTemplateSettingsStore = defineStore('uiTemplateSettings', {
|
|
|
143
144
|
const brandPageContainerStore = useBrandPageContainerStore();
|
|
144
145
|
const brandPageMakerUserStore = useBrandPageMakerUserStore();
|
|
145
146
|
const logoSettingsStore = useUiLogoSettingsStore();
|
|
146
|
-
const logoStore = useLogoStore();
|
|
147
|
-
const editableLogoStore = useUiEditableLogoStore();
|
|
148
147
|
const designTemplateToken = brandPageContainerStore.designTemplateToken;
|
|
149
148
|
if (brandPageMakerStore.isInitialising) {
|
|
150
149
|
setTimeout(() => {
|
|
@@ -169,20 +168,6 @@ export const useUiTemplateSettingsStore = defineStore('uiTemplateSettings', {
|
|
|
169
168
|
try {
|
|
170
169
|
const designTemplateClient = DesignTemplateClient.getInstance();
|
|
171
170
|
const currentLocale = getCurrentLocale();
|
|
172
|
-
const isByo = logoStore.logoTemplateAsset?.isByo ?? false;
|
|
173
|
-
const logoTemplateToken = logoStore.logoTemplateAsset?.token ?? undefined;
|
|
174
|
-
const logoVariation = logoSettingsStore.selectedLogoImage.logoVariation;
|
|
175
|
-
// Check if S3 token is expired and refresh if needed
|
|
176
|
-
if (!isByo) {
|
|
177
|
-
const wasRefreshed = await editableLogoStore.refreshS3TokenIfExpiredAsync(logoVariation);
|
|
178
|
-
if (wasRefreshed) {
|
|
179
|
-
setTimeout(() => {
|
|
180
|
-
this.loadPageNo({ pageNo });
|
|
181
|
-
}, LOAD_PAGE_RETRY_DELAY);
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
const editableLogoVariation = editableLogoStore.editableLogoVariations[logoVariation];
|
|
186
171
|
const result = await designTemplateClient.getTemplateItemsByTemplateType(this.templateType, {
|
|
187
172
|
page: pageNo,
|
|
188
173
|
pageSize: DEFAULT_PAGE_SIZE,
|
|
@@ -193,8 +178,6 @@ export const useUiTemplateSettingsStore = defineStore('uiTemplateSettings', {
|
|
|
193
178
|
personalisable: this.selectedTab.key === TEMPLATE_TABS.AI,
|
|
194
179
|
selectedTemplateToken: designTemplateToken,
|
|
195
180
|
locale: currentLocale,
|
|
196
|
-
logoS3Token: !isByo ? editableLogoVariation.s3Token : undefined,
|
|
197
|
-
logoTemplateToken: isByo ? logoTemplateToken : undefined,
|
|
198
181
|
});
|
|
199
182
|
if (!result) {
|
|
200
183
|
return;
|
|
@@ -202,7 +185,8 @@ export const useUiTemplateSettingsStore = defineStore('uiTemplateSettings', {
|
|
|
202
185
|
this._setPageCount({ pageCount: result.pageCount });
|
|
203
186
|
const templates = await Promise.all(result.paginatedItems.map(async (item) => {
|
|
204
187
|
try {
|
|
205
|
-
if (
|
|
188
|
+
if (brandPageContainerStore.isPrePurchase ||
|
|
189
|
+
brandPageMakerUserStore.isAdmin) {
|
|
206
190
|
// Pre-purchase: full template with brandPageModel for live rendering
|
|
207
191
|
const template = await designTemplateClient.getTemplateByTemplateToken(item.designTemplateToken);
|
|
208
192
|
return this.safeMapToTemplateSettingsTemplate(template);
|
|
@@ -261,13 +245,6 @@ export const useUiTemplateSettingsStore = defineStore('uiTemplateSettings', {
|
|
|
261
245
|
templateId: payload.templateId,
|
|
262
246
|
forceApply: payload.forceApply,
|
|
263
247
|
});
|
|
264
|
-
if (payload.forceApply) {
|
|
265
|
-
await this._setTemplates({
|
|
266
|
-
templates: [],
|
|
267
|
-
});
|
|
268
|
-
await this._setPageNoLoaded({ pageNoLoaded: 0 });
|
|
269
|
-
await this.loadPageNo({ pageNo: 1 });
|
|
270
|
-
}
|
|
271
248
|
},
|
|
272
249
|
async onCategorySelected(payload) {
|
|
273
250
|
await this._setTemplates({
|
|
@@ -342,11 +319,9 @@ export const useUiTemplateSettingsStore = defineStore('uiTemplateSettings', {
|
|
|
342
319
|
*/
|
|
343
320
|
setupLogoChangeWatcher() {
|
|
344
321
|
const logoSettingsStore = useUiLogoSettingsStore();
|
|
345
|
-
const
|
|
322
|
+
const brandPageContainerStore = useBrandPageContainerStore();
|
|
346
323
|
const brandPageMakerUserStore = useBrandPageMakerUserStore();
|
|
347
324
|
const { selectedLogoImage } = storeToRefs(logoSettingsStore);
|
|
348
|
-
const { editableLogoVariations } = storeToRefs(editableLogoStore);
|
|
349
|
-
let s3TokenDebounceTimer = null;
|
|
350
325
|
// Watch for changes to logoImage (token or variation changes)
|
|
351
326
|
watch(() => selectedLogoImage.value, async (newLogoImage, oldLogoImage) => {
|
|
352
327
|
// Skip initial load when oldLogoImage is undefined
|
|
@@ -356,7 +331,8 @@ export const useUiTemplateSettingsStore = defineStore('uiTemplateSettings', {
|
|
|
356
331
|
// Only refetch for post-purchase users and when logo actually changes
|
|
357
332
|
const hasLogoChanged = newLogoImage.logoDraftToken !== oldLogoImage.logoDraftToken ||
|
|
358
333
|
newLogoImage.logoVariation !== oldLogoImage.logoVariation;
|
|
359
|
-
if (!
|
|
334
|
+
if (!brandPageContainerStore.isPrePurchase &&
|
|
335
|
+
!brandPageMakerUserStore.isAdmin &&
|
|
360
336
|
newLogoImage.logoDraftToken &&
|
|
361
337
|
hasLogoChanged) {
|
|
362
338
|
// Reset templates state and reload with new logo
|
|
@@ -367,30 +343,6 @@ export const useUiTemplateSettingsStore = defineStore('uiTemplateSettings', {
|
|
|
367
343
|
await this.loadPageNo({ pageNo: 1 });
|
|
368
344
|
}
|
|
369
345
|
}, { deep: true });
|
|
370
|
-
// Watch for S3 token changes (when user edits logo colors, text, etc.)
|
|
371
|
-
// Debounced to avoid excessive reloads during rapid edits
|
|
372
|
-
watch(() => editableLogoVariations.value[selectedLogoImage.value.logoVariation]
|
|
373
|
-
?.s3Token, async (newS3Token, oldS3Token) => {
|
|
374
|
-
if (s3TokenDebounceTimer) {
|
|
375
|
-
clearTimeout(s3TokenDebounceTimer);
|
|
376
|
-
}
|
|
377
|
-
if (!oldS3Token) {
|
|
378
|
-
return;
|
|
379
|
-
}
|
|
380
|
-
if (newS3Token === oldS3Token) {
|
|
381
|
-
return;
|
|
382
|
-
}
|
|
383
|
-
if (brandPageMakerUserStore.isAdmin) {
|
|
384
|
-
return;
|
|
385
|
-
}
|
|
386
|
-
// Debounce the reload by 500ms to avoid rapid successive reloads
|
|
387
|
-
s3TokenDebounceTimer = setTimeout(async () => {
|
|
388
|
-
await this._setTemplates({ templates: [] });
|
|
389
|
-
await this._setPageNoLoaded({ pageNoLoaded: 0 });
|
|
390
|
-
await this._setPageNo({ pageNo: 1 });
|
|
391
|
-
await this.loadPageNo({ pageNo: 1 });
|
|
392
|
-
}, 500);
|
|
393
|
-
});
|
|
394
346
|
},
|
|
395
347
|
},
|
|
396
348
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@designcrowd/library.brand-page",
|
|
3
3
|
"description": "A collection of Maker/Designer applications",
|
|
4
|
-
"version": "5.16.29
|
|
4
|
+
"version": "5.16.29",
|
|
5
5
|
"author": "Design.com Eng",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"type": "module",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"src"
|
|
13
13
|
],
|
|
14
14
|
"scripts": {
|
|
15
|
-
"dev": "
|
|
15
|
+
"dev": "nuxt dev nuxtapp",
|
|
16
16
|
"dev:dcom": "export tailwindTheme=designCom && nuxt dev nuxtapp",
|
|
17
17
|
"docker:publish": "docker build -t bp-maker:latest . --file ./build/Dockerfile.brand-page-lib-publish --build-arg NPM_TOKEN=$NPM_TOKEN --no-cache && cross-env NPM_TOKEN=",
|
|
18
18
|
"lint": "eslint . && tsc --project tsconfig.lint.json --noEmit",
|
package/src/brand-page-maker/components/brand-page-maker/BrandPageMakerTemplateSettings.mixin.ts
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
DESKTOP_WIDTH,
|
|
5
5
|
MOBILE_HEIGHT,
|
|
6
6
|
MOBILE_WIDTH,
|
|
7
|
+
MOBILE_HEIGHT_POST_PURCHASE,
|
|
7
8
|
} from '../../constants';
|
|
8
9
|
import {
|
|
9
10
|
useBrandPageMakerStore,
|
|
@@ -35,7 +36,11 @@ export default defineComponent({
|
|
|
35
36
|
},
|
|
36
37
|
|
|
37
38
|
height(): number {
|
|
38
|
-
|
|
39
|
+
if (this.isBrandSite) {
|
|
40
|
+
return DESKTOP_HEIGHT;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return this.isPrePurchase ? MOBILE_HEIGHT : MOBILE_HEIGHT_POST_PURCHASE;
|
|
39
44
|
},
|
|
40
45
|
},
|
|
41
46
|
});
|
|
@@ -265,7 +265,7 @@ export default defineComponent({
|
|
|
265
265
|
},
|
|
266
266
|
watch: {
|
|
267
267
|
template() {
|
|
268
|
-
if (this.isAdmin) {
|
|
268
|
+
if (this.isAdmin || this.isPrePurchase) {
|
|
269
269
|
this.updateViewModel();
|
|
270
270
|
} else {
|
|
271
271
|
// Reset loading state when template changes for image-based previews
|
|
@@ -275,7 +275,7 @@ export default defineComponent({
|
|
|
275
275
|
},
|
|
276
276
|
logoTheme: {
|
|
277
277
|
handler() {
|
|
278
|
-
if (this.isAdmin) {
|
|
278
|
+
if (this.isAdmin || this.isPrePurchase) {
|
|
279
279
|
this.updateViewModel();
|
|
280
280
|
}
|
|
281
281
|
},
|
|
@@ -283,7 +283,7 @@ export default defineComponent({
|
|
|
283
283
|
},
|
|
284
284
|
previewImageUrl() {
|
|
285
285
|
// Reset loading state whenever the preview URL changes
|
|
286
|
-
if (!this.isAdmin) {
|
|
286
|
+
if (!this.isAdmin && !this.isPrePurchase) {
|
|
287
287
|
this.imageLoading = true;
|
|
288
288
|
this.imageLoadError = false;
|
|
289
289
|
}
|
|
@@ -353,7 +353,7 @@ export default defineComponent({
|
|
|
353
353
|
|
|
354
354
|
async updateViewModel(forceUpdate = true) {
|
|
355
355
|
// Only update view model for admin or pre-purchase mode
|
|
356
|
-
if (!this.isAdmin) {
|
|
356
|
+
if (!this.isAdmin && !this.isPrePurchase) {
|
|
357
357
|
return;
|
|
358
358
|
}
|
|
359
359
|
|
|
@@ -100,7 +100,6 @@ import { commonTr, errorTr } from '../../../composables/useTranslate';
|
|
|
100
100
|
import { UPGRADE_CTA_LOCATIONS } from '../../composables/useEventTracker';
|
|
101
101
|
import { useVideoStore } from '../video';
|
|
102
102
|
import { findValuesByKey } from '../../../helpers/ts.helper';
|
|
103
|
-
import { useLogoStore } from '../logo-store';
|
|
104
103
|
|
|
105
104
|
export interface NotificationMessage {
|
|
106
105
|
type: 'success' | 'warning' | 'error';
|
|
@@ -359,8 +358,6 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
|
|
|
359
358
|
const userStore = useBrandPageMakerUserStore();
|
|
360
359
|
const containerStore = useBrandPageContainerStore();
|
|
361
360
|
const uiContentSettings = useUiContentSettingsStore();
|
|
362
|
-
const editableLogoStore = useUiEditableLogoStore();
|
|
363
|
-
const logoStore = useLogoStore();
|
|
364
361
|
|
|
365
362
|
if (!this.selectedTemplateId) {
|
|
366
363
|
return;
|
|
@@ -412,27 +409,6 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
|
|
|
412
409
|
);
|
|
413
410
|
}
|
|
414
411
|
} else {
|
|
415
|
-
if (containerStore.isPrePurchase) {
|
|
416
|
-
if (logoStore.logoTemplateAsset?.isByo) {
|
|
417
|
-
if (uiStore.logoTheme)
|
|
418
|
-
uiStore.setLogoTheme({
|
|
419
|
-
logoTheme: uiStore.logoTheme,
|
|
420
|
-
});
|
|
421
|
-
} else {
|
|
422
|
-
const logoVariation =
|
|
423
|
-
logoSettingsStore.selectedLogoTemplateImage
|
|
424
|
-
?.logoTemplateVersion ?? 0;
|
|
425
|
-
const logoTheme =
|
|
426
|
-
editableLogoStore.editableLogoVariations[logoVariation]
|
|
427
|
-
?.logoTheme;
|
|
428
|
-
|
|
429
|
-
if (logoTheme)
|
|
430
|
-
uiStore.setLogoTheme({
|
|
431
|
-
logoTheme: parseLogoThemeToCssStyles(logoTheme),
|
|
432
|
-
});
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
|
|
436
412
|
const logoImage =
|
|
437
413
|
logoUtil.safeGetLogoImageFromLogoImageUrl(logoImageUrl);
|
|
438
414
|
|
|
@@ -26,8 +26,6 @@ interface GetTemplatesAsyncOptions {
|
|
|
26
26
|
personalisable?: boolean;
|
|
27
27
|
selectedTemplateToken?: string | false;
|
|
28
28
|
locale?: string;
|
|
29
|
-
logoS3Token?: string;
|
|
30
|
-
logoTemplateToken?: string;
|
|
31
29
|
}
|
|
32
30
|
|
|
33
31
|
export const getTemplatesEndpoint = (templateTypeName: string) =>
|
|
@@ -31,7 +31,6 @@ export interface ModifyLogoDataRequest {
|
|
|
31
31
|
dimensionsType: string;
|
|
32
32
|
variation: string;
|
|
33
33
|
primaryText?: string;
|
|
34
|
-
generateS3Url?: boolean;
|
|
35
34
|
logo: {
|
|
36
35
|
template: {
|
|
37
36
|
token: string;
|
|
@@ -59,8 +58,6 @@ export interface ModifyLogoDataResponse {
|
|
|
59
58
|
metadata: string | null;
|
|
60
59
|
width: number;
|
|
61
60
|
height: number;
|
|
62
|
-
expiryDate?: string;
|
|
63
|
-
s3Token?: string;
|
|
64
61
|
}
|
|
65
62
|
|
|
66
63
|
export const LOGO_DIMENSION_TYPES = {
|
package/src/lib.ts
CHANGED
|
@@ -61,7 +61,6 @@ export type { CriticalResourceURLs } from './brand-page/utils/view-model.util';
|
|
|
61
61
|
export {
|
|
62
62
|
getOptimalLogoSize,
|
|
63
63
|
calculateOptimizedLogoDimensions,
|
|
64
|
-
applyLogoImageBase64UrlToBrandPageTemplateModel,
|
|
65
64
|
} from './brand-page/utils/logo.util';
|
|
66
65
|
export { sanitizeRTEHtml } from './brand-page-maker/utils';
|
|
67
66
|
export { getPageSlugFromPageTitle } from './brand-page-maker/utils/slug.util';
|