@gem-sdk/pages 1.9.60 → 1.10.18
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/dist/cjs/components/builder/Toolbox.js +11 -6
- package/dist/cjs/libs/shopify-cdn-with-google-fonts.js +1845 -0
- package/dist/cjs/pages/builder.js +8 -8
- package/dist/esm/components/builder/Toolbox.js +13 -8
- package/dist/esm/libs/shopify-cdn-with-google-fonts.js +1843 -0
- package/dist/esm/pages/builder.js +9 -9
- package/package.json +1 -1
|
@@ -8,6 +8,7 @@ var react = require('react');
|
|
|
8
8
|
var googleFonts = require('../../libs/google-fonts.js');
|
|
9
9
|
var genCss = require('../../libs/helpers/gen-css.js');
|
|
10
10
|
var getStorefrontApi = require('../../libs/get-storefront-api.js');
|
|
11
|
+
var shopifyCdnWithGoogleFonts = require('../../libs/shopify-cdn-with-google-fonts.js');
|
|
11
12
|
|
|
12
13
|
const globalStyleId = 'global-style';
|
|
13
14
|
const globalFontId = 'google-font-builder';
|
|
@@ -24,7 +25,6 @@ const Toolbox = ()=>{
|
|
|
24
25
|
const addSection = core.useSectionStore((s)=>s.addSection);
|
|
25
26
|
const changeSwatches = core.useShopStore((s)=>s.changeSwatches);
|
|
26
27
|
const changeLayoutSettings = core.useShopStore((s)=>s.changeLayoutSettings);
|
|
27
|
-
const [initEventSuccess, setInitEventSuccess] = react.useState(false);
|
|
28
28
|
const clearModal = core.useModalStore((s)=>s.clearModal);
|
|
29
29
|
// Revalidate all query with key match query/
|
|
30
30
|
const onRevalidateQuery = react.useCallback(()=>{
|
|
@@ -52,6 +52,14 @@ const Toolbox = ()=>{
|
|
|
52
52
|
const themeStyle = genCss.genCSS(detail.data, detail.mobileOnly);
|
|
53
53
|
const font = Object.entries(detail.data?.font).map(([, value])=>{
|
|
54
54
|
return value;
|
|
55
|
+
}).map((item)=>{
|
|
56
|
+
if (item.type == 'custom') {
|
|
57
|
+
const isGoogleFont = shopifyCdnWithGoogleFonts.shopifyCdnWithGoogleFonts.find((ggFont)=>ggFont.family == item.family);
|
|
58
|
+
if (isGoogleFont) {
|
|
59
|
+
return isGoogleFont;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return item;
|
|
55
63
|
});
|
|
56
64
|
const fontUrl = googleFonts.createFontUrl(font);
|
|
57
65
|
const globalStyle = document.getElementById(globalStyleId);
|
|
@@ -199,7 +207,6 @@ const Toolbox = ()=>{
|
|
|
199
207
|
window.addEventListener('set-global-style', onChangeGlobalStyle);
|
|
200
208
|
window.addEventListener('update-global-swatches-data', onChangeSwatchesData);
|
|
201
209
|
window.addEventListener('on-off-header-footer', onChangeLayoutSettingData);
|
|
202
|
-
setInitEventSuccess(true);
|
|
203
210
|
return ()=>{
|
|
204
211
|
window.removeEventListener('update-shop-info', onChangeShopInfo);
|
|
205
212
|
window.removeEventListener('revalidate-query', onRevalidateQuery);
|
|
@@ -210,7 +217,7 @@ const Toolbox = ()=>{
|
|
|
210
217
|
window.removeEventListener('update-entity-prop', onUpdateEntityProp);
|
|
211
218
|
window.removeEventListener('set-global-style', onChangeGlobalStyle);
|
|
212
219
|
window.removeEventListener('update-global-swatches-data', onChangeSwatchesData);
|
|
213
|
-
window.
|
|
220
|
+
window.removeEventListener('on-off-header-footer', onChangeLayoutSettingData);
|
|
214
221
|
};
|
|
215
222
|
}, [
|
|
216
223
|
onAddEntity,
|
|
@@ -225,9 +232,7 @@ const Toolbox = ()=>{
|
|
|
225
232
|
onChangeLayoutSettingData
|
|
226
233
|
]);
|
|
227
234
|
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
228
|
-
className:
|
|
229
|
-
toolbox: initEventSuccess
|
|
230
|
-
})
|
|
235
|
+
className: "toolbox"
|
|
231
236
|
});
|
|
232
237
|
};
|
|
233
238
|
var Toolbox$1 = /*#__PURE__*/ react.memo(Toolbox);
|