cloudcommerce 0.8.3 → 0.8.4
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/CHANGELOG.md +12 -0
- package/ecomplus-stores/monocard/functions/core/package.json +1 -1
- package/ecomplus-stores/monocard/functions/events/package.json +2 -2
- package/ecomplus-stores/monocard/functions/modules/package.json +2 -2
- package/ecomplus-stores/monocard/functions/passport/package.json +2 -2
- package/ecomplus-stores/monocard/functions/ssr/package.json +6 -6
- package/ecomplus-stores/monocard/package.json +1 -1
- package/package.json +1 -1
- package/packages/api/package.json +1 -1
- package/packages/apps/correios/package.json +1 -1
- package/packages/apps/custom-payment/package.json +1 -1
- package/packages/apps/custom-shipping/package.json +1 -1
- package/packages/apps/datafrete/package.json +1 -1
- package/packages/apps/discounts/package.json +1 -1
- package/packages/apps/emails/package.json +1 -1
- package/packages/apps/fb-conversions/package.json +1 -1
- package/packages/apps/frenet/package.json +1 -1
- package/packages/apps/galaxpay/package.json +1 -1
- package/packages/apps/google-analytics/package.json +1 -1
- package/packages/apps/infinitepay/package.json +1 -1
- package/packages/apps/jadlog/package.json +1 -1
- package/packages/apps/loyalty-points/package.json +1 -1
- package/packages/apps/melhor-envio/package.json +1 -1
- package/packages/apps/mercadopago/package.json +1 -1
- package/packages/apps/pagarme/package.json +1 -1
- package/packages/apps/paghiper/package.json +1 -1
- package/packages/apps/pix/package.json +1 -1
- package/packages/apps/tiny-erp/package.json +1 -1
- package/packages/apps/webhooks/package.json +1 -1
- package/packages/cli/package.json +1 -1
- package/packages/config/package.json +1 -1
- package/packages/emails/package.json +1 -1
- package/packages/events/package.json +1 -1
- package/packages/firebase/package.json +1 -1
- package/packages/i18n/package.json +1 -1
- package/packages/modules/package.json +1 -1
- package/packages/passport/package.json +1 -1
- package/packages/ssr/package.json +1 -1
- package/packages/storefront/dist/server/chunks/pages/{all.27c6aee2.mjs → all.090434f8.mjs} +21 -7
- package/packages/storefront/dist/server/entry.mjs +2 -2
- package/packages/storefront/package.json +1 -1
- package/packages/storefront/src/lib/components/Picture.astro +20 -8
- package/packages/storefront/src/lib/layouts/BaseBody.astro +5 -3
- package/packages/storefront/src/lib/layouts/BaseHead.astro +15 -7
- package/packages/storefront/src/serverless/Picture.runtime.astro +12 -2
- package/packages/types/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.8.4](https://github.com/ecomplus/cloud-commerce/compare/v0.8.3...v0.8.4) (2023-03-18)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **storefront:** Update custom `<Picture>` to support lazy load libs with `hasImg={false}` prop ([be9bbdc](https://github.com/ecomplus/cloud-commerce/commit/be9bbdc46635717b52dd23ab0f5daec11c3a37a8))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* **storefront:** Fix built (fav)icon format to png only ([e02b3cc](https://github.com/ecomplus/cloud-commerce/commit/e02b3cc0e35d7330c4c317e1a7d70e0032844afc))
|
|
16
|
+
|
|
5
17
|
### [0.8.3](https://github.com/ecomplus/cloud-commerce/compare/v0.8.2...v0.8.3) (2023-03-18)
|
|
6
18
|
|
|
7
19
|
|
|
@@ -18,15 +18,15 @@
|
|
|
18
18
|
"main": "index.js",
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@astrojs/node": "5.1.0",
|
|
21
|
-
"@cloudcommerce/api": "^0.8.
|
|
22
|
-
"@cloudcommerce/firebase": "^0.8.
|
|
23
|
-
"@cloudcommerce/ssr": "^0.8.
|
|
21
|
+
"@cloudcommerce/api": "^0.8.3",
|
|
22
|
+
"@cloudcommerce/firebase": "^0.8.3",
|
|
23
|
+
"@cloudcommerce/ssr": "^0.8.3",
|
|
24
24
|
"@vueuse/motion": "2.0.0-beta.22"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@cloudcommerce/i18n": "^0.8.
|
|
28
|
-
"@cloudcommerce/storefront": "^0.8.
|
|
29
|
-
"@cloudcommerce/types": "^0.8.
|
|
27
|
+
"@cloudcommerce/i18n": "^0.8.3",
|
|
28
|
+
"@cloudcommerce/storefront": "^0.8.3",
|
|
29
|
+
"@cloudcommerce/types": "^0.8.3",
|
|
30
30
|
"@fontsource/inter": "^4.5.15",
|
|
31
31
|
"@iconify-json/ri": "^1.1.5",
|
|
32
32
|
"@iconify-json/wpf": "^1.1.4",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloudcommerce",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.4",
|
|
5
5
|
"description": "Open fair-code headless commerce platform: API-first, microservices based, event driven and cloud native",
|
|
6
6
|
"main": "packages/api/lib/index.js",
|
|
7
7
|
"author": "E-Com Club Softwares para E-commerce <ti@e-com.club>",
|
|
@@ -476,6 +476,10 @@ const $$Astro$g = createAstro("https://ecom2-002.web.app");
|
|
|
476
476
|
const $$BaseHead = createComponent(async ($$result, $$props, $$slots) => {
|
|
477
477
|
const Astro2 = $$result.createAstro($$Astro$g, $$props, $$slots);
|
|
478
478
|
Astro2.self = $$BaseHead;
|
|
479
|
+
const deployRand = process.env.DEPLOY_RAND || "_";
|
|
480
|
+
const getIconUrl = (size) => {
|
|
481
|
+
return `/_image?f=png&w=${size}&h=${size}&href=${encodeURIComponent(settings.icon)}&V=${deployRand}`;
|
|
482
|
+
};
|
|
479
483
|
const {
|
|
480
484
|
storeId,
|
|
481
485
|
cmsContent,
|
|
@@ -489,7 +493,8 @@ const $$BaseHead = createComponent(async ($$result, $$props, $$slots) => {
|
|
|
489
493
|
const state = apiDoc || cmsContent || {};
|
|
490
494
|
const title = state.meta_title || state.name || state.title || Astro2.props.title || settings.name;
|
|
491
495
|
const description = state.meta_description || state.short_description || settings.description;
|
|
492
|
-
const favicon = settings.icon ?
|
|
496
|
+
const favicon = settings.icon ? getIconUrl(32) : "/favicon.ico";
|
|
497
|
+
const shortcutIcon = settings.icon ? getIconUrl(192) : null;
|
|
493
498
|
const canonicalUrl = new URL(Astro2.url.pathname, Astro2.site || `https://${domain}`);
|
|
494
499
|
const cmsMetatags = await cms("metatags");
|
|
495
500
|
const ogLocale = lang.length === 2 ? lang : lang.substring(0, 2) + lang.slice(3).toUpperCase();
|
|
@@ -508,13 +513,14 @@ const $$BaseHead = createComponent(async ($$result, $$props, $$slots) => {
|
|
|
508
513
|
return renderTemplate`<meta charset="UTF-8">
|
|
509
514
|
<meta name="viewport" content="width=device-width">
|
|
510
515
|
<meta name="theme-color"${addAttribute(primaryColor, "content")}>
|
|
511
|
-
<link rel="icon"${addAttribute(favicon, "href")}>
|
|
516
|
+
<link rel="icon" type="image/png"${addAttribute(favicon, "href")} sizes="32x32">
|
|
517
|
+
${shortcutIcon && renderTemplate`<link rel="icon" type="image/png"${addAttribute(shortcutIcon, "href")} sizes="192x192">`}
|
|
512
518
|
<title>${title}</title>
|
|
513
519
|
<meta name="description"${addAttribute(description, "content")}>
|
|
514
520
|
<meta name="author"${addAttribute(settings.name, "content")}>
|
|
515
521
|
<meta name="generator"${addAttribute(Astro2.generator, "content")}>
|
|
516
522
|
<link rel="canonical"${addAttribute(canonicalUrl, "href")}>
|
|
517
|
-
|
|
523
|
+
${shortcutIcon && renderTemplate`<link rel="apple-touch-icon"${addAttribute(shortcutIcon, "href")}>`}
|
|
518
524
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
519
525
|
<meta name="apple-mobile-web-app-status-bar-style" content="default">
|
|
520
526
|
<meta property="og:site_name"${addAttribute(settings.name, "content")}>
|
|
@@ -822,6 +828,7 @@ const $$Picture = createComponent(async ($$result, $$props, $$slots) => {
|
|
|
822
828
|
formats = ["avif", "webp"],
|
|
823
829
|
loading = "lazy",
|
|
824
830
|
decoding = "async",
|
|
831
|
+
hasImg = true,
|
|
825
832
|
...attrs
|
|
826
833
|
} = Astro2.props;
|
|
827
834
|
let aspectRatio = propAspectRatio;
|
|
@@ -847,9 +854,16 @@ const $$Picture = createComponent(async ($$result, $$props, $$slots) => {
|
|
|
847
854
|
delete image.src;
|
|
848
855
|
delete image.width;
|
|
849
856
|
delete image.height;
|
|
850
|
-
|
|
857
|
+
const pictureAttrs = {};
|
|
858
|
+
if (!hasImg) {
|
|
859
|
+
pictureAttrs["data-alt"] = alt;
|
|
860
|
+
Object.assign(pictureAttrs, attrs);
|
|
861
|
+
delete pictureAttrs.width;
|
|
862
|
+
delete pictureAttrs.height;
|
|
863
|
+
}
|
|
864
|
+
return renderTemplate`${maybeRenderHead($$result)}<picture${spreadAttributes(pictureAttrs)}>
|
|
851
865
|
${sources.map((attrs2) => renderTemplate`<source${addAttribute(attrs2.type, "type")}${addAttribute(attrs2.srcset.replace(/\s(\w+)$/, `&V=${process.env.DEPLOY_RAND} $1`), "srcset")}${addAttribute(sizes, "sizes")}>`)}
|
|
852
|
-
|
|
866
|
+
${hasImg && renderTemplate`<img${spreadAttributes(image)}${addAttribute(loading, "loading")}${addAttribute(decoding, "decoding")}${addAttribute(imgSrc, "src")}${spreadAttributes(attrs)}>`}
|
|
853
867
|
</picture>`;
|
|
854
868
|
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/components/Picture.astro");
|
|
855
869
|
|
|
@@ -857,14 +871,14 @@ const $$Astro$d = createAstro("https://ecom2-002.web.app");
|
|
|
857
871
|
const $$BaseBody = createComponent(async ($$result, $$props, $$slots) => {
|
|
858
872
|
const Astro2 = $$result.createAstro($$Astro$d, $$props, $$slots);
|
|
859
873
|
Astro2.self = $$BaseBody;
|
|
860
|
-
const { settings
|
|
874
|
+
const { settings } = Astro2.props.pageContext;
|
|
861
875
|
return renderTemplate`${maybeRenderHead($$result)}<body>
|
|
862
876
|
<div id="teleported-overlap" class="relative z-50"></div>
|
|
863
877
|
<div id="teleported-top" class="relative z-0"></div>
|
|
864
878
|
${renderSlot($$result, $$slots["default"])}
|
|
865
879
|
${renderSlot($$result, $$slots["before-body-end"])}
|
|
866
880
|
<div id="teleported-bottom" class="relative z-0"></div>
|
|
867
|
-
${icon && renderTemplate`${renderComponent($$result, "Picture", $$Picture, { "src": icon, "alt": "Icon", "widths": [32, 192, 512], "sizes": "32px", "class": "hidden absolute", "style": "bottom: -1000px" })}`}
|
|
881
|
+
${settings.icon && renderTemplate`${renderComponent($$result, "Picture", $$Picture, { "src": settings.icon, "alt": "Icon", "formats": ["png"], "widths": [32, 192, 512], "sizes": "32px", "class": "hidden absolute", "style": "bottom: -1000px", "hasImg": false })}`}
|
|
868
882
|
</body>`;
|
|
869
883
|
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/BaseBody.astro");
|
|
870
884
|
|
|
@@ -14,7 +14,7 @@ import enableDestroy from 'server-destroy';
|
|
|
14
14
|
import { defineComponent, computed, useSSRContext, mergeProps, h as h$1, createSSRApp } from 'vue';
|
|
15
15
|
import { ssrRenderSlotInner, ssrRenderAttrs, ssrRenderSlot, renderToString } from 'vue/server-renderer';
|
|
16
16
|
import { img, imgSizes, i18n, formatMoney } from '@ecomplus/utils';
|
|
17
|
-
/* empty css */import { _ as _export_sfc, a as _page0, b as _page1, c as _page2, d as _page3, e as _page4, f as _page5 } from './chunks/pages/all.
|
|
17
|
+
/* empty css */import { _ as _export_sfc, a as _page0, b as _page1, c as _page2, d as _page3, e as _page4, f as _page5 } from './chunks/pages/all.090434f8.mjs';
|
|
18
18
|
import 'mime';
|
|
19
19
|
import 'cookie';
|
|
20
20
|
import 'kleur/colors';
|
|
@@ -3062,7 +3062,7 @@ const _renderer1 = {
|
|
|
3062
3062
|
const pageMap = new Map([["../../node_modules/.pnpm/@astrojs+image@0.16.0_astro@2.1.2+sharp@0.31.3/node_modules/@astrojs/image/dist/endpoint.js", _page0],["src/pages/index.astro", _page1],["src/pages/fallback.astro", _page2],["src/pages/app/index.astro", _page3],["src/pages/app/account.astro", _page4],["src/pages/[...slug].astro", _page5],]);
|
|
3063
3063
|
const renderers = [Object.assign({"name":"astro:jsx","serverEntrypoint":"astro/jsx/server.js","jsxImportSource":"astro"}, { ssr: server_default }),Object.assign({"name":"@astrojs/vue","clientEntrypoint":"@astrojs/vue/client.js","serverEntrypoint":"@astrojs/vue/server.js"}, { ssr: _renderer1 }),];
|
|
3064
3064
|
|
|
3065
|
-
const _manifest = Object.assign(deserializeManifest({"adapterName":"@astrojs/node","routes":[{"file":"","links":[],"scripts":[],"routeData":{"type":"endpoint","route":"/_image","pattern":"^\\/_image$","segments":[[{"content":"_image","dynamic":false,"spread":false}]],"params":[],"component":"../../node_modules/.pnpm/@astrojs+image@0.16.0_astro@2.1.2+sharp@0.31.3/node_modules/@astrojs/image/dist/endpoint.js","pathname":"/_image","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":["_astro/_...slug_.0607a6ef.css","_astro/index.0c833781.css"],"scripts":[{"type":"external","value":"_astro/hoisted.721ad75d.js"}],"routeData":{"route":"/","type":"page","pattern":"^\\/$","segments":[],"params":[],"component":"src/pages/index.astro","pathname":"/","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":["_astro/_...slug_.0607a6ef.css"],"scripts":[{"type":"external","value":"_astro/hoisted.721ad75d.js"}],"routeData":{"route":"/fallback","type":"page","pattern":"^\\/fallback\\/?$","segments":[[{"content":"fallback","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/fallback.astro","pathname":"/fallback","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[],"routeData":{"route":"/app","type":"page","pattern":"^\\/app\\/?$","segments":[[{"content":"app","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/app/index.astro","pathname":"/app","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[],"routeData":{"route":"/app/account","type":"page","pattern":"^\\/app\\/account\\/?$","segments":[[{"content":"app","dynamic":false,"spread":false}],[{"content":"account","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/app/account.astro","pathname":"/app/account","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":["_astro/_...slug_.0607a6ef.css"],"scripts":[{"type":"external","value":"_astro/hoisted.721ad75d.js"}],"routeData":{"route":"/[...slug]","type":"page","pattern":"^(?:\\/(.*?))?\\/?$","segments":[[{"content":"...slug","dynamic":true,"spread":true}]],"params":["...slug"],"component":"src/pages/[...slug].astro","prerender":false,"_meta":{"trailingSlash":"ignore"}}}],"site":"https://ecom2-002.web.app","base":"/","markdown":{"drafts":false,"syntaxHighlight":"shiki","shikiConfig":{"langs":[],"theme":"github-dark","wrap":false},"remarkPlugins":[],"rehypePlugins":[],"remarkRehype":{},"gfm":true,"smartypants":true},"pageMap":null,"propagation":[],"renderers":[],"entryModules":{"\u0000@astrojs-ssr-virtual-entry":"_@astrojs-ssr-virtual-entry.mjs","@@sf/components/ProductCard.vue":"_astro/ProductCard.7e891c08.js","
|
|
3065
|
+
const _manifest = Object.assign(deserializeManifest({"adapterName":"@astrojs/node","routes":[{"file":"","links":[],"scripts":[],"routeData":{"type":"endpoint","route":"/_image","pattern":"^\\/_image$","segments":[[{"content":"_image","dynamic":false,"spread":false}]],"params":[],"component":"../../node_modules/.pnpm/@astrojs+image@0.16.0_astro@2.1.2+sharp@0.31.3/node_modules/@astrojs/image/dist/endpoint.js","pathname":"/_image","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":["_astro/_...slug_.0607a6ef.css","_astro/index.0c833781.css"],"scripts":[{"type":"external","value":"_astro/hoisted.721ad75d.js"}],"routeData":{"route":"/","type":"page","pattern":"^\\/$","segments":[],"params":[],"component":"src/pages/index.astro","pathname":"/","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":["_astro/_...slug_.0607a6ef.css"],"scripts":[{"type":"external","value":"_astro/hoisted.721ad75d.js"}],"routeData":{"route":"/fallback","type":"page","pattern":"^\\/fallback\\/?$","segments":[[{"content":"fallback","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/fallback.astro","pathname":"/fallback","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[],"routeData":{"route":"/app","type":"page","pattern":"^\\/app\\/?$","segments":[[{"content":"app","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/app/index.astro","pathname":"/app","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[],"routeData":{"route":"/app/account","type":"page","pattern":"^\\/app\\/account\\/?$","segments":[[{"content":"app","dynamic":false,"spread":false}],[{"content":"account","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/app/account.astro","pathname":"/app/account","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":["_astro/_...slug_.0607a6ef.css"],"scripts":[{"type":"external","value":"_astro/hoisted.721ad75d.js"}],"routeData":{"route":"/[...slug]","type":"page","pattern":"^(?:\\/(.*?))?\\/?$","segments":[[{"content":"...slug","dynamic":true,"spread":true}]],"params":["...slug"],"component":"src/pages/[...slug].astro","prerender":false,"_meta":{"trailingSlash":"ignore"}}}],"site":"https://ecom2-002.web.app","base":"/","markdown":{"drafts":false,"syntaxHighlight":"shiki","shikiConfig":{"langs":[],"theme":"github-dark","wrap":false},"remarkPlugins":[],"rehypePlugins":[],"remarkRehype":{},"gfm":true,"smartypants":true},"pageMap":null,"propagation":[],"renderers":[],"entryModules":{"\u0000@astrojs-ssr-virtual-entry":"_@astrojs-ssr-virtual-entry.mjs","@@sf/components/ProductCard.vue":"_astro/ProductCard.7e891c08.js","~/components/Prices.vue":"_astro/Prices.55399c72.js","~/components/PitchBar.vue":"_astro/PitchBar.db7cd775.js","@astrojs/vue/client.js":"_astro/client.0de2f274.js","/astro/hoisted.js?q=0":"_astro/hoisted.721ad75d.js","/home/leo/code/ecomplus/cloud-commerce/node_modules/workbox-window/build/workbox-window.prod.es5.mjs":"_astro/workbox-window.prod.es5.295a6886.js","~/components/ShopHeader.vue":"_astro/ShopHeader.e93c8274.js","/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/scripts/firebase-app.ts":"_astro/firebase-app.72e91a3e.js","astro:scripts/before-hydration.js":""},"assets":["/_astro/index.0c833781.css","/_astro/server.1bc2fa51.css","/_astro/_...slug_.0607a6ef.css","/manifest.webmanifest","/robots.txt","/sw.js","/workbox-e0d788d4.js","/_astro/PitchBar.db7cd775.js","/_astro/Prices.55399c72.js","/_astro/ProductCard.7e891c08.js","/_astro/ShopHeader.e93c8274.js","/_astro/_plugin-vue_export-helper.77ed7c18.js","/_astro/client.0de2f274.js","/_astro/firebase-app.72e91a3e.js","/_astro/format-money.ab6b71eb.js","/_astro/hoisted.721ad75d.js","/_astro/idle-callback.889bf0ea.js","/_astro/index.16f33784.js","/_astro/modules-info.06ac0727.js","/_astro/preload-helper.101896b7.js","/_astro/runtime-dom.esm-bundler.d2f39f33.js","/_astro/session-utm.72684b84.js","/_astro/workbox-window.prod.es5.295a6886.js","/admin/config.json","/assets/cms-preview.css","/assets/cms.css","/assets/cvv.png","/assets/img-placeholder.png","/assets/payments.png","/assets/ssl-safe.png","/img/icon.png","/img/large-icon.png","/img/uploads/banner1.png","/img/uploads/banner2.png","/img/uploads/banner2.webp","/img/uploads/favicon.png","/img/uploads/headless.png","/img/uploads/headphone.png","/img/uploads/headphone.webp","/img/uploads/icon.png","/img/uploads/large-icon.png","/img/uploads/logo.png","/img/uploads/logo.webp","/img/uploads/og-image.png","/img/uploads/passion.png","/img/uploads/passion.webp","/img/uploads/pwa-reliable.png","/img/uploads/rect8589.png","/img/uploads/rect859.png","/img/uploads/rect89.png","/img/uploads/rect89.webp","/img/uploads/ssl-safe.png"]}), {
|
|
3066
3066
|
pageMap: pageMap,
|
|
3067
3067
|
renderers: renderers
|
|
3068
3068
|
});
|
|
@@ -7,6 +7,7 @@ import { getPicture } from '@astrojs/image';
|
|
|
7
7
|
export type Props = Omit<PictureComponentRemoteImageProps, 'aspectRatio'> & {
|
|
8
8
|
aspectRatio?: PictureComponentRemoteImageProps['aspectRatio'],
|
|
9
9
|
fetchpriority?: 'high' | 'low' | 'auto',
|
|
10
|
+
hasImg?: boolean,
|
|
10
11
|
};
|
|
11
12
|
|
|
12
13
|
const tryImageSize = (src: string) => {
|
|
@@ -44,6 +45,7 @@ const {
|
|
|
44
45
|
formats = ['avif', 'webp'],
|
|
45
46
|
loading = 'lazy',
|
|
46
47
|
decoding = 'async',
|
|
48
|
+
hasImg = true,
|
|
47
49
|
...attrs
|
|
48
50
|
} = Astro.props;
|
|
49
51
|
|
|
@@ -71,19 +73,29 @@ const imgSrc = `${image.src}&V=${process.env.DEPLOY_RAND}`;
|
|
|
71
73
|
delete image.src;
|
|
72
74
|
delete image.width;
|
|
73
75
|
delete image.height;
|
|
76
|
+
|
|
77
|
+
const pictureAttrs: Partial<typeof attrs & { alt: string }> = {};
|
|
78
|
+
if (!hasImg) {
|
|
79
|
+
pictureAttrs['data-alt'] = alt;
|
|
80
|
+
Object.assign(pictureAttrs, attrs);
|
|
81
|
+
delete pictureAttrs.width;
|
|
82
|
+
delete pictureAttrs.height;
|
|
83
|
+
}
|
|
74
84
|
---
|
|
75
85
|
|
|
76
|
-
<picture>
|
|
86
|
+
<picture {...pictureAttrs}>
|
|
77
87
|
{sources.map((attrs) => <source
|
|
78
88
|
type={attrs.type}
|
|
79
89
|
srcset={attrs.srcset.replace(/\s(\w+)$/, `&V=${process.env.DEPLOY_RAND} $1`)}
|
|
80
90
|
sizes={sizes}
|
|
81
91
|
/>)}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
92
|
+
{hasImg &&
|
|
93
|
+
<img
|
|
94
|
+
{...image}
|
|
95
|
+
loading={loading}
|
|
96
|
+
decoding={decoding}
|
|
97
|
+
src={imgSrc}
|
|
98
|
+
{...attrs}
|
|
99
|
+
/>
|
|
100
|
+
}
|
|
89
101
|
</picture>
|
|
@@ -11,7 +11,7 @@ export interface Props {
|
|
|
11
11
|
pageContext: PageContext;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
const { settings
|
|
14
|
+
const { settings } = Astro.props.pageContext;
|
|
15
15
|
---
|
|
16
16
|
|
|
17
17
|
<body>
|
|
@@ -20,14 +20,16 @@ const { settings: { icon } } = Astro.props.pageContext;
|
|
|
20
20
|
<slot />
|
|
21
21
|
<slot name="before-body-end" />
|
|
22
22
|
<div id="teleported-bottom" class="relative z-0"></div>
|
|
23
|
-
{icon &&
|
|
23
|
+
{settings.icon &&
|
|
24
24
|
<Picture
|
|
25
|
-
src={icon}
|
|
25
|
+
src={settings.icon}
|
|
26
26
|
alt="Icon"
|
|
27
|
+
formats={['png']}
|
|
27
28
|
widths={[32, 192, 512]}
|
|
28
29
|
sizes="32px"
|
|
29
30
|
class="hidden absolute"
|
|
30
31
|
style="bottom: -1000px"
|
|
32
|
+
hasImg={false}
|
|
31
33
|
/>
|
|
32
34
|
}
|
|
33
35
|
</body>
|
|
@@ -8,6 +8,12 @@ export interface Props {
|
|
|
8
8
|
title?: string;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
const deployRand = process.env.DEPLOY_RAND || '_';
|
|
12
|
+
const getIconUrl = (size: number) => {
|
|
13
|
+
return `/_image?f=png&w=${size}&h=${size}`
|
|
14
|
+
+ `&href=${encodeURIComponent(settings.icon)}&V=${deployRand}`;
|
|
15
|
+
};
|
|
16
|
+
|
|
11
17
|
const {
|
|
12
18
|
storeId,
|
|
13
19
|
cmsContent,
|
|
@@ -18,13 +24,12 @@ const {
|
|
|
18
24
|
settings,
|
|
19
25
|
cms,
|
|
20
26
|
} = Astro.props.pageContext;
|
|
27
|
+
|
|
21
28
|
const state = apiDoc || cmsContent || {};
|
|
22
29
|
const title = state.meta_title || state.name || state.title || Astro.props.title || settings.name;
|
|
23
30
|
const description = state.meta_description || state.short_description || settings.description;
|
|
24
|
-
const favicon = settings.icon
|
|
25
|
-
|
|
26
|
-
+ `&href=${encodeURIComponent(settings.icon)}&V=${import.meta.env.DEPLOY_RAND}`
|
|
27
|
-
: '/favicon.ico';
|
|
31
|
+
const favicon = settings.icon ? getIconUrl(32) : '/favicon.ico';
|
|
32
|
+
const shortcutIcon = settings.icon ? getIconUrl(192) : null;
|
|
28
33
|
const canonicalUrl = new URL(Astro.url.pathname, Astro.site || `https://${domain}`);
|
|
29
34
|
const cmsMetatags = await cms('metatags');
|
|
30
35
|
const ogLocale = lang.length === 2 ? lang : lang.substring(0, 2) + lang.slice(3).toUpperCase();
|
|
@@ -46,13 +51,15 @@ if (!ogImage) {
|
|
|
46
51
|
<meta charset="UTF-8">
|
|
47
52
|
<meta name="viewport" content="width=device-width">
|
|
48
53
|
<meta name="theme-color" content={primaryColor}>
|
|
49
|
-
<link rel="icon" href={favicon} />
|
|
54
|
+
<link rel="icon" type="image/png" href={favicon} sizes="32x32" />
|
|
55
|
+
{shortcutIcon &&
|
|
56
|
+
<link rel="icon" type="image/png" href={shortcutIcon} sizes="192x192" />}
|
|
50
57
|
<title>{title}</title>
|
|
51
58
|
<meta name="description" content={description}>
|
|
52
59
|
<meta name="author" content={settings.name}>
|
|
53
60
|
<meta name="generator" content={Astro.generator} />
|
|
54
61
|
<link rel="canonical" href={canonicalUrl} />
|
|
55
|
-
<link rel="apple-touch-icon" href={
|
|
62
|
+
{shortcutIcon && <link rel="apple-touch-icon" href={shortcutIcon} />}
|
|
56
63
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
57
64
|
<meta name="apple-mobile-web-app-status-bar-style" content="default">
|
|
58
65
|
<meta property="og:site_name" content={settings.name}>
|
|
@@ -62,7 +69,8 @@ if (!ogImage) {
|
|
|
62
69
|
<meta property="og:type" content="website">
|
|
63
70
|
<meta property="og:locale" content={ogLocale}>
|
|
64
71
|
{ogImage && <meta property="og:image" content={ogImage} />}
|
|
65
|
-
{cmsMetatags?.fb_app_id &&
|
|
72
|
+
{cmsMetatags?.fb_app_id &&
|
|
73
|
+
<meta property="fb:app_id" content={cmsMetatags.fb_app_id} />}
|
|
66
74
|
<meta name="twitter:card" content="summary">
|
|
67
75
|
{cmsMetatags?.twitter_username &&
|
|
68
76
|
<meta name="twitter:site" content={cmsMetatags.twitter_username} />}
|
|
@@ -7,6 +7,7 @@ import { getPicture } from './get-picture';
|
|
|
7
7
|
export type Props = Omit<PictureComponentRemoteImageProps, 'aspectRatio'> & {
|
|
8
8
|
aspectRatio?: PictureComponentRemoteImageProps['aspectRatio'],
|
|
9
9
|
fetchpriority?: 'high' | 'low' | 'auto',
|
|
10
|
+
hasImg?: boolean,
|
|
10
11
|
};
|
|
11
12
|
|
|
12
13
|
const { STOREFRONT_BASE_DIR } = process.env;
|
|
@@ -59,6 +60,7 @@ const {
|
|
|
59
60
|
formats = ['avif', 'webp'],
|
|
60
61
|
loading = 'lazy',
|
|
61
62
|
decoding = 'async',
|
|
63
|
+
hasImg = true,
|
|
62
64
|
...attrs
|
|
63
65
|
} = Astro.props;
|
|
64
66
|
|
|
@@ -84,9 +86,17 @@ const { image, sources } = await getPicture({
|
|
|
84
86
|
});
|
|
85
87
|
delete image.width;
|
|
86
88
|
delete image.height;
|
|
89
|
+
|
|
90
|
+
const pictureAttrs: Partial<typeof attrs & { alt: string }> = {};
|
|
91
|
+
if (!hasImg) {
|
|
92
|
+
pictureAttrs['data-alt'] = alt;
|
|
93
|
+
Object.assign(pictureAttrs, attrs);
|
|
94
|
+
delete pictureAttrs.width;
|
|
95
|
+
delete pictureAttrs.height;
|
|
96
|
+
}
|
|
87
97
|
---
|
|
88
98
|
|
|
89
|
-
<picture>
|
|
99
|
+
<picture {...pictureAttrs}>
|
|
90
100
|
{sources.map((attrs) => <source {...attrs} sizes={sizes} />)}
|
|
91
|
-
<img {...image} loading={loading} decoding={decoding} {...attrs} />
|
|
101
|
+
{hasImg && <img {...image} loading={loading} decoding={decoding} {...attrs} />}
|
|
92
102
|
</picture>
|