@designcrowd/library.brand-page 6.2.5 → 6.2.6
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-CkJM0rEy.js → CreatedOnBrandCrowd-de-de-DpeSEnwP.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-CKOotMQK.js → CreatedOnBrandCrowd-en-us-CxYv3NzT.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-mrDI8AaY.js → CreatedOnBrandCrowd-es-es-CzQ1HRHw.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-DtmVXezM.js → CreatedOnBrandCrowd-fr-ca-J77YZaT1.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-DtmVXezM.js → CreatedOnBrandCrowd-fr-fr-J77YZaT1.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-C8Cy74df.js → CreatedOnBrandCrowd-pt-br-1vh4Smqt.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-C8Cy74df.js → CreatedOnBrandCrowd-pt-pt-1vh4Smqt.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-FVl5OqQM.js → CreatedOnDcom-de-de-CXX6W_29.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-e0s7gZGG.js → CreatedOnDcom-en-us-D78BmX6f.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-BXMekiTg.js → CreatedOnDcom-es-es-FfbPM2vD.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-74Vm0wzS.js → CreatedOnDcom-fr-ca-C6L60rxJ.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-C6TT73Rw.js → CreatedOnDcom-fr-fr-BEDnW9w-.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-Drg2eaLk.js → CreatedOnDcom-pt-br-CZXVvc1n.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-BgsEIMfv.js → CreatedOnDcom-pt-pt-IQq744nb.js} +1 -1
- package/lib/src/brand-page/utils/logo.util.js +2 -2
- package/lib/src/brand-page/utils/migration/migration-07.js +3 -2
- package/lib/src/brand-page/utils/migration/migration-08.js +3 -2
- package/lib/src/clients/fabric-render-client.d.ts +20 -0
- package/lib/src/clients/fabric-render-client.js +43 -0
- package/lib/src/index.mjs +1 -1
- package/lib/src/{lib--ZDYWLFf.js → lib-CyVd3FMn.js} +3399 -3361
- package/lib/src/shared/content-settings/components/GenericTextInput.mixin.d.ts +1 -1
- package/lib/src/shared/content-settings/components/email-field/EmailField.mixin.d.ts +1 -1
- package/lib/src/shared/content-settings/components/tel-field/TelField.mixin.d.ts +1 -1
- package/lib/src/shared/content-settings/components/text-field/TextField.mixin.d.ts +1 -1
- package/lib/src/shared/content-settings/components/textarea-field/TextareaField.mixin.d.ts +1 -1
- package/lib/src/shared/content-settings/components/url-field/UrlField.mixin.d.ts +1 -1
- package/lib/src/shared/content-settings/components/youtube-video-field/YoutubeVideoField.mixin.d.ts +1 -1
- package/package.json +1 -1
- package/src/brand-page/utils/logo.util.recalculate.test.ts +204 -0
- package/src/brand-page/utils/logo.util.ts +2 -2
- package/src/brand-page/utils/migration/migration-07.dimension.test.ts +274 -0
- package/src/brand-page/utils/migration/migration-07.ts +3 -2
- package/src/brand-page/utils/migration/migration-08.test.ts +181 -22
- package/src/brand-page/utils/migration/migration-08.ts +3 -2
- package/src/clients/fabric-render-client.test.ts +198 -0
- package/src/clients/fabric-render-client.ts +85 -0
|
@@ -254,7 +254,7 @@ export const recalculateLogoContentDimensions = async (pageData, editableLogoVar
|
|
|
254
254
|
// For post-purchase or fallback, fetch from Fabric
|
|
255
255
|
if (!logoData || logoData.width <= 0 || logoData.height <= 0) {
|
|
256
256
|
logoData =
|
|
257
|
-
await FabricRenderClient.getInstance().
|
|
257
|
+
await FabricRenderClient.getInstance().getLogoDimensionsByLogoImageAsync(logoImage);
|
|
258
258
|
}
|
|
259
259
|
if (!logoData || logoData.width <= 0 || logoData.height <= 0) {
|
|
260
260
|
return;
|
|
@@ -279,7 +279,7 @@ export const recalculateHeaderLogoSizes = async (pageSettingsStore, logoSettings
|
|
|
279
279
|
const logoImageHeight = pageSettingsStore.sections.header.desktop.logoImageHeight;
|
|
280
280
|
const logoVariation = pageSettingsStore.sections.header.desktop.logoVariation;
|
|
281
281
|
const logoPrePurchase = editableLogoVariations.find((logo) => logo.variationId === logoVariation);
|
|
282
|
-
const logoPostPurchase = await FabricRenderClient.getInstance().
|
|
282
|
+
const logoPostPurchase = await FabricRenderClient.getInstance().getLogoDimensionsByLogoImageAsync(logoSettingsStore.selectedLogoImage);
|
|
283
283
|
const logo = isPrePurchase ? logoPrePurchase : logoPostPurchase;
|
|
284
284
|
if (logo && (logoImageHeight || forceRecalculate)) {
|
|
285
285
|
const optimalSize = getOptimalLogoSize(brandPageType, logo.width, logo.height);
|
|
@@ -20,10 +20,11 @@ export const migration07 = async (migrationResult, options) => {
|
|
|
20
20
|
{ name: 'pageFooterMobile', config: brandPageModel.pageFooterMobile },
|
|
21
21
|
].filter((section) => section.config);
|
|
22
22
|
// Fetch logo data for all sections in parallel
|
|
23
|
+
// Size-only lookups, by recorded exception: 0031-released-logo-size-migrations-may-use-a-size-only-address.md
|
|
23
24
|
const logoDataPromises = sections.map(async (section) => {
|
|
24
25
|
const logoData = section.config?.logoTemplateImage?.logoTemplateToken
|
|
25
|
-
? await fabricClient.
|
|
26
|
-
: await fabricClient.
|
|
26
|
+
? await fabricClient.getLogoDimensionsByLogoTemplateImageAsync(section.config.logoTemplateImage)
|
|
27
|
+
: await fabricClient.getLogoDimensionsByLogoImageAsync(section.config.logoImage);
|
|
27
28
|
return {
|
|
28
29
|
sectionName: section.name,
|
|
29
30
|
logoData,
|
|
@@ -22,13 +22,14 @@ export const migration08 = async (migrationResult, options) => {
|
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
});
|
|
25
|
+
// Size-only lookups, by recorded exception: 0031-released-logo-size-migrations-may-use-a-size-only-address.md
|
|
25
26
|
const logoDataPromises = logoContents.map(async ({ content }) => {
|
|
26
27
|
if (content.logoTemplateImage?.logoTemplateToken) {
|
|
27
|
-
const logoData = await fabricClient.
|
|
28
|
+
const logoData = await fabricClient.getLogoDimensionsByLogoTemplateImageAsync(content.logoTemplateImage);
|
|
28
29
|
return { content, logoData };
|
|
29
30
|
}
|
|
30
31
|
if (content.logoImage?.logoDraftToken) {
|
|
31
|
-
const logoData = await fabricClient.
|
|
32
|
+
const logoData = await fabricClient.getLogoDimensionsByLogoImageAsync({
|
|
32
33
|
logoDraftToken: content.logoImage.logoDraftToken,
|
|
33
34
|
logoVariation: content.logoImage.logoVariation,
|
|
34
35
|
});
|
|
@@ -121,5 +121,25 @@ export declare class FabricRenderClient {
|
|
|
121
121
|
width: number;
|
|
122
122
|
height: number;
|
|
123
123
|
} | undefined>;
|
|
124
|
+
getLogoDimensionsByLogoTemplateImageAsync(logoTemplateImage: {
|
|
125
|
+
logoTemplateToken: string;
|
|
126
|
+
logoTemplateText: string;
|
|
127
|
+
logoTemplateVersion: number;
|
|
128
|
+
layout?: string;
|
|
129
|
+
}): Promise<{
|
|
130
|
+
width: number;
|
|
131
|
+
height: number;
|
|
132
|
+
} | undefined>;
|
|
133
|
+
getLogoDimensionsByLogoImageAsync(logoImage: {
|
|
134
|
+
logoDraftToken: string;
|
|
135
|
+
logoVariation: number;
|
|
136
|
+
logoLastUpdate?: string;
|
|
137
|
+
}): Promise<{
|
|
138
|
+
width: number;
|
|
139
|
+
height: number;
|
|
140
|
+
} | undefined>;
|
|
141
|
+
private getLogoTemplateDimensionsUrl;
|
|
142
|
+
private getLogoDraftDimensionsUrl;
|
|
143
|
+
private fetchLogoDimensionsAsync;
|
|
124
144
|
}
|
|
125
145
|
export {};
|
|
@@ -141,4 +141,47 @@ export class FabricRenderClient {
|
|
|
141
141
|
const { data, width, height } = await response.json();
|
|
142
142
|
return { data, width, height };
|
|
143
143
|
}
|
|
144
|
+
// Released migrations 07/08 call the two size methods: 0031-released-logo-size-migrations-may-use-a-size-only-address.md
|
|
145
|
+
async getLogoDimensionsByLogoTemplateImageAsync(logoTemplateImage) {
|
|
146
|
+
return this.fetchLogoDimensionsAsync(this.getLogoTemplateDimensionsUrl(logoTemplateImage));
|
|
147
|
+
}
|
|
148
|
+
async getLogoDimensionsByLogoImageAsync(logoImage) {
|
|
149
|
+
return this.fetchLogoDimensionsAsync(this.getLogoDraftDimensionsUrl(logoImage));
|
|
150
|
+
}
|
|
151
|
+
// Each brand-page address has a size-only companion at `/dimensions`, which reads only what these two builders send.
|
|
152
|
+
// extract if this grows: this repeats getLogoTemplateUrlByLogoTemplateImage's query.
|
|
153
|
+
getLogoTemplateDimensionsUrl(logoTemplateImage) {
|
|
154
|
+
const url = `${this.baseUrl}/asset/logotemplate/brand-page/${logoTemplateImage.logoTemplateToken}/dimensions?dimensionsType=preview_image_transparent_no_buffer&logoTemplateVersion=${logoTemplateImage.logoTemplateVersion}&text=${encodeURIComponent(logoTemplateImage.logoTemplateText)}`;
|
|
155
|
+
return logoTemplateImage.layout
|
|
156
|
+
? `${url}&layout=${logoTemplateImage.layout}`
|
|
157
|
+
: url;
|
|
158
|
+
}
|
|
159
|
+
getLogoDraftDimensionsUrl(logoImage) {
|
|
160
|
+
if (!logoImage.logoDraftToken) {
|
|
161
|
+
console.warn('getLogoDraftDimensionsUrl: invalid logo draft token');
|
|
162
|
+
return undefined;
|
|
163
|
+
}
|
|
164
|
+
const definition = LogoVariationDefinitions[typeof logoImage.logoVariation === 'number'
|
|
165
|
+
? logoImage.logoVariation
|
|
166
|
+
: 0];
|
|
167
|
+
if (!definition) {
|
|
168
|
+
return undefined;
|
|
169
|
+
}
|
|
170
|
+
const variationQuery = Object.entries(definition)
|
|
171
|
+
.map(([key, value]) => `${key}=${value}`)
|
|
172
|
+
.join('&');
|
|
173
|
+
return `${this.baseUrl}/asset/logodraft/brand-page/${logoImage.logoDraftToken}/dimensions?v=${logoImage.logoLastUpdate || ''}&${variationQuery}`;
|
|
174
|
+
}
|
|
175
|
+
// extract if this grows: the four logo JSON fetches repeat this shape.
|
|
176
|
+
async fetchLogoDimensionsAsync(url) {
|
|
177
|
+
if (!url) {
|
|
178
|
+
return undefined;
|
|
179
|
+
}
|
|
180
|
+
const response = await fetch(url);
|
|
181
|
+
if (response.status !== 200) {
|
|
182
|
+
return undefined;
|
|
183
|
+
}
|
|
184
|
+
const { width, height } = await response.json();
|
|
185
|
+
return { width, height };
|
|
186
|
+
}
|
|
144
187
|
}
|
package/lib/src/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as s, a as I, b as S, c as N, d as e, e as A, f as O, g as t, B as C, h as D, i as G, j as P, k as R, l as o, m as L, n as M, o as r, p as n, q as i, r as l, s as c, t as b, u as F, v as g, w as B, x as Y, y as d, z as U, C as u, D as p, E as H, F as y, G as m, H as K, I as k, J as V, K as v, L as X, M as h, N as f, O as x, P as W, Q as z, R as w, S as J, T as Z, U as j, V as q, W as Q, X as $, Y as aa, Z as Ea, $ as _a, a0 as Ta, a1 as sa, a2 as Ia, a3 as Sa, a4 as Na, a5 as ea, a6 as Aa, a7 as Oa, a8 as ta, a9 as Ca, aa as Da, ab as Ga, ac as Pa, ad as Ra, ae as oa, af as La, ag as Ma, ah as ra, ai as na, aj as ia, ak as la, al as ca, am as ba, an as Fa, ao as ga, ap as Ba, aq as Ya, ar as da, as as Ua, at as ua, au as pa, av as Ha, aw as ya, ax as ma, ay as Ka, az as ka, aA as Va, aB as va, aC as Xa, aD as ha, aE as fa, aF as xa, aG as Wa, aH as za, aI as wa, aJ as Ja, aK as Za, aL as ja, aM as qa, aN as Qa, aO as $a, aP as aE, aQ as EE, aR as _E, aS as TE, aT as sE, aU as IE, aV as SE, aW as NE, aX as eE, aY as AE, aZ as OE, a_ as tE, a$ as CE, b0 as DE, b1 as GE, b2 as PE, b3 as RE, b4 as oE, b5 as LE, b6 as ME, b7 as rE, b8 as nE, b9 as iE, ba as lE, bb as cE, bc as bE, bd as FE, be as gE, bf as BE, bg as YE, bh as dE, bi as UE, bj as uE, bk as pE, bl as HE, bm as yE, bn as mE, bo as KE, bp as kE, bq as VE, br as vE, bs as XE, bt as hE, bu as fE, bv as xE, bw as WE, bx as zE, by as wE, bz as JE, bA as ZE, bB as jE, bC as qE, bD as QE, bE as $E, bF as a_, bG as E_, bH as __, bI as T_, bJ as s_, bK as I_, bL as S_, bM as N_, bN as e_, bO as A_, bP as O_, bQ as t_, bR as C_, bS as D_, bT as G_, bU as P_, bV as R_, bW as o_, bX as L_, bY as M_, bZ as r_, b_ as n_, b$ as i_, c0 as l_, c1 as c_, c2 as b_, c3 as F_, c4 as g_, c5 as B_, c6 as Y_, c7 as d_, c8 as U_, c9 as u_, ca as p_, cb as H_, cc as y_, cd as m_, ce as K_, cf as k_, cg as V_, ch as v_, ci as X_, cj as h_, ck as f_, cl as x_, cm as W_, cn as z_, co as w_, cp as J_, cq as Z_, cr as j_, cs as q_, ct as Q_, cu as $_, cv as aT, cw as ET, cx as _T, cy as TT, cz as sT, cA as IT, cB as ST, cC as NT, cD as eT, cE as AT, cF as OT } from "./lib
|
|
1
|
+
import { A as s, a as I, b as S, c as N, d as e, e as A, f as O, g as t, B as C, h as D, i as G, j as P, k as R, l as o, m as L, n as M, o as r, p as n, q as i, r as l, s as c, t as b, u as F, v as g, w as B, x as Y, y as d, z as U, C as u, D as p, E as H, F as y, G as m, H as K, I as k, J as V, K as v, L as X, M as h, N as f, O as x, P as W, Q as z, R as w, S as J, T as Z, U as j, V as q, W as Q, X as $, Y as aa, Z as Ea, $ as _a, a0 as Ta, a1 as sa, a2 as Ia, a3 as Sa, a4 as Na, a5 as ea, a6 as Aa, a7 as Oa, a8 as ta, a9 as Ca, aa as Da, ab as Ga, ac as Pa, ad as Ra, ae as oa, af as La, ag as Ma, ah as ra, ai as na, aj as ia, ak as la, al as ca, am as ba, an as Fa, ao as ga, ap as Ba, aq as Ya, ar as da, as as Ua, at as ua, au as pa, av as Ha, aw as ya, ax as ma, ay as Ka, az as ka, aA as Va, aB as va, aC as Xa, aD as ha, aE as fa, aF as xa, aG as Wa, aH as za, aI as wa, aJ as Ja, aK as Za, aL as ja, aM as qa, aN as Qa, aO as $a, aP as aE, aQ as EE, aR as _E, aS as TE, aT as sE, aU as IE, aV as SE, aW as NE, aX as eE, aY as AE, aZ as OE, a_ as tE, a$ as CE, b0 as DE, b1 as GE, b2 as PE, b3 as RE, b4 as oE, b5 as LE, b6 as ME, b7 as rE, b8 as nE, b9 as iE, ba as lE, bb as cE, bc as bE, bd as FE, be as gE, bf as BE, bg as YE, bh as dE, bi as UE, bj as uE, bk as pE, bl as HE, bm as yE, bn as mE, bo as KE, bp as kE, bq as VE, br as vE, bs as XE, bt as hE, bu as fE, bv as xE, bw as WE, bx as zE, by as wE, bz as JE, bA as ZE, bB as jE, bC as qE, bD as QE, bE as $E, bF as a_, bG as E_, bH as __, bI as T_, bJ as s_, bK as I_, bL as S_, bM as N_, bN as e_, bO as A_, bP as O_, bQ as t_, bR as C_, bS as D_, bT as G_, bU as P_, bV as R_, bW as o_, bX as L_, bY as M_, bZ as r_, b_ as n_, b$ as i_, c0 as l_, c1 as c_, c2 as b_, c3 as F_, c4 as g_, c5 as B_, c6 as Y_, c7 as d_, c8 as U_, c9 as u_, ca as p_, cb as H_, cc as y_, cd as m_, ce as K_, cf as k_, cg as V_, ch as v_, ci as X_, cj as h_, ck as f_, cl as x_, cm as W_, cn as z_, co as w_, cp as J_, cq as Z_, cr as j_, cs as q_, ct as Q_, cu as $_, cv as aT, cw as ET, cx as _T, cy as TT, cz as sT, cA as IT, cB as ST, cC as NT, cD as eT, cE as AT, cF as OT } from "./lib-CyVd3FMn.js";
|
|
2
2
|
import { U as CT, u as DT } from "./useEventTracker-DwPTmzpa.js";
|
|
3
3
|
import "vue";
|
|
4
4
|
import "vue-cropperjs";
|