cloudcommerce 0.18.2 → 0.19.0
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/.github/renovate.json +1 -2
- package/CHANGELOG.md +26 -0
- package/package.json +6 -6
- package/packages/api/package.json +1 -1
- package/packages/apps/affilate-program/package.json +2 -2
- 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 +2 -2
- package/packages/apps/discounts/package.json +1 -1
- package/packages/apps/emails/package.json +2 -2
- package/packages/apps/fb-conversions/package.json +2 -2
- package/packages/apps/flash-courier/package.json +1 -1
- package/packages/apps/frenet/package.json +2 -2
- package/packages/apps/galaxpay/package.json +2 -2
- package/packages/apps/google-analytics/package.json +2 -2
- package/packages/apps/jadlog/package.json +1 -1
- package/packages/apps/loyalty-points/package.json +1 -1
- package/packages/apps/melhor-envio/package.json +2 -2
- package/packages/apps/mercadopago/package.json +2 -2
- package/packages/apps/pagarme/package.json +2 -2
- package/packages/apps/paghiper/package.json +2 -2
- package/packages/apps/pix/package.json +2 -2
- package/packages/apps/tiny-erp/package.json +2 -2
- package/packages/apps/webhooks/package.json +2 -2
- 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 +2 -2
- package/packages/feeds/package.json +1 -1
- package/packages/firebase/package.json +2 -2
- package/packages/i18n/package.json +1 -1
- package/packages/modules/package.json +2 -2
- package/packages/passport/package.json +2 -2
- package/packages/ssr/lib/firebase/serve-storefront.js +81 -72
- package/packages/ssr/lib/firebase/serve-storefront.js.map +1 -1
- package/packages/ssr/package.json +3 -3
- package/packages/ssr/src/firebase/serve-storefront.ts +89 -84
- package/packages/storefront/config/storefront.tailwind.cjs +5 -8
- package/packages/storefront/dist/client/_astro/Carousel.62c97a79.js +1 -0
- package/packages/storefront/dist/client/_astro/HeroSlider.b2622951.js +1 -0
- package/packages/storefront/dist/client/_astro/PitchBar.ed85833a.js +1 -0
- package/packages/storefront/dist/client/_astro/ProductShelf.f63b3dc2.js +1 -0
- package/packages/storefront/dist/client/_astro/ShopHeader.61f52cad.js +4 -0
- package/packages/storefront/dist/client/_astro/_...slug_.c58d7d89.css +1 -0
- package/packages/storefront/dist/client/_astro/_plugin-vue_export-helper.4cb7dd76.js +1 -0
- package/packages/storefront/dist/client/_astro/api.4984c5be.js +1 -0
- package/packages/storefront/dist/client/_astro/client.8035a95a.js +1 -0
- package/packages/storefront/dist/client/_astro/img.abbe849f.js +1 -0
- package/packages/storefront/dist/client/_astro/index.b93f3d06.js +1 -0
- package/packages/storefront/dist/client/sw.js +1 -1
- package/packages/storefront/dist/server/chunks/{_...4cff750f.mjs → _...38dc610a.mjs} +3 -3
- package/packages/storefront/dist/server/chunks/{account@_@astro.9bc80fb8.mjs → account@_@astro.691bc27d.mjs} +3 -3
- package/packages/storefront/dist/server/chunks/{astro.2df8d1c5.mjs → astro.45d3047f.mjs} +10 -3
- package/packages/storefront/dist/server/chunks/{endpoint@_@js.36a1cfa7.mjs → endpoint@_@js.59bf44fe.mjs} +3 -3
- package/packages/storefront/dist/server/chunks/{fallback@_@astro.6af59549.mjs → fallback@_@astro.c8a88451.mjs} +3 -3
- package/packages/storefront/dist/server/chunks/{index@_@astro.846e70bb.mjs → index@_@astro.d808b7a7.mjs} +3 -3
- package/packages/storefront/dist/server/chunks/{index@_@astro.1ea814dc.mjs → index@_@astro.d93b7b12.mjs} +3 -3
- package/packages/storefront/dist/server/chunks/pages/{_...slug_.astro.906634b2.mjs → _...slug_.astro.b5433bcf.mjs} +119 -30
- package/packages/storefront/dist/server/chunks/pages/{account.astro.f630663e.mjs → account.astro.f07cf19e.mjs} +1 -1
- package/packages/storefront/dist/server/chunks/pages/{endpoint.js.ffec1d05.mjs → endpoint.js.2c6d6e4a.mjs} +1 -1
- package/packages/storefront/dist/server/chunks/pages/{fallback.astro.0a073a86.mjs → fallback.astro.09db7801.mjs} +2 -2
- package/packages/storefront/dist/server/chunks/pages/{index.astro.fb8fe537.mjs → index.astro.753ff02c.mjs} +91 -77
- package/packages/storefront/dist/server/entry.mjs +9 -9
- package/packages/storefront/dist/server/renderers.mjs +2 -2
- package/packages/storefront/package.json +5 -5
- package/packages/storefront/src/images/get-built-picture.ts +1 -0
- package/packages/storefront/src/images/use-ssr-picture.ts +11 -6
- package/packages/storefront/src/lib/components/{HeroPicture.astro → Banner.astro} +8 -4
- package/packages/storefront/src/lib/composables/use-product-card.ts +10 -11
- package/packages/storefront/src/lib/state/shopping-cart/parse-product.ts +6 -3
- package/packages/storefront/src/lib/state/shopping-cart.ts +3 -3
- package/packages/types/package.json +1 -1
- package/packages/storefront/dist/client/_astro/Carousel.533b4b19.js +0 -1
- package/packages/storefront/dist/client/_astro/HeroSlider.359c76cc.js +0 -1
- package/packages/storefront/dist/client/_astro/PitchBar.75d2999f.js +0 -1
- package/packages/storefront/dist/client/_astro/Prices.bd0d3474.js +0 -1
- package/packages/storefront/dist/client/_astro/ProductShelf.83c66e3e.js +0 -1
- package/packages/storefront/dist/client/_astro/ShopHeader.a06de422.js +0 -4
- package/packages/storefront/dist/client/_astro/_...slug_.b19aabfc.css +0 -1
- package/packages/storefront/dist/client/_astro/_plugin-vue_export-helper.4e6dc3af.js +0 -1
- package/packages/storefront/dist/client/_astro/api.7f62c1ff.js +0 -1
- package/packages/storefront/dist/client/_astro/client.24201f93.js +0 -1
- package/packages/storefront/dist/client/_astro/img.22ad29ec.js +0 -1
- package/packages/storefront/dist/client/_astro/index.ddc27a3a.js +0 -1
- package/packages/storefront/dist/client/_astro/modules-info.d6bd555b.js +0 -1
- package/packages/storefront/dist/client/_astro/runtime-dom.esm-bundler.578d6e91.js +0 -1
- package/packages/storefront/dist/client/img/uploads/banner1.png +0 -0
- package/packages/storefront/dist/client/img/uploads/banner2.png +0 -0
- package/packages/storefront/dist/client/img/uploads/favicon.png +0 -0
- package/packages/storefront/dist/client/img/uploads/headless.png +0 -0
- package/packages/storefront/dist/client/img/uploads/headphone.png +0 -0
- package/packages/storefront/dist/client/img/uploads/passion.png +0 -0
- package/packages/storefront/dist/client/img/uploads/pwa-reliable.png +0 -0
- package/packages/storefront/dist/client/img/uploads/rect89.png +0 -0
- package/packages/storefront/dist/client/img/uploads/ssl-safe.png +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { c as createAstro, a as createComponent, r as renderTemplate, d as renderComponent, m as maybeRenderHead, b as addAttribute, u as unescapeHTML, F as Fragment$1 } from '../astro.
|
|
2
|
-
import { b as $$Picture, p as parseShippingPhrase, _ as _export_sfc, C as Carousel, c as CarouselControl, d as availableExtraDiscount, e as installmentsOption, f as discountOption, g as loyaltyPointsPrograms, l as loadRouteContext, $ as $$PageHeader, a as $$Base } from './_...slug_.astro.
|
|
3
|
-
import
|
|
4
|
-
import { computed, useSSRContext, defineComponent, mergeProps, withCtx, createVNode, withDirectives, vShow, resolveDynamicComponent, createTextVNode, toDisplayString, openBlock, createBlock, Fragment, renderList, renderSlot, createCommentVNode, ref, shallowReactive, resolveComponent, withAsyncContext } from 'vue';
|
|
1
|
+
import { c as createAstro, a as createComponent, r as renderTemplate, d as renderComponent, m as maybeRenderHead, b as addAttribute, u as unescapeHTML, F as Fragment$1 } from '../astro.45d3047f.mjs';
|
|
2
|
+
import { b as $$Picture, p as parseShippingPhrase, _ as _export_sfc, C as Carousel, c as CarouselControl, d as availableExtraDiscount, e as installmentsOption, f as discountOption, g as loyaltyPointsPrograms, h as addProductToCart, l as loadRouteContext, $ as $$PageHeader, a as $$Base } from './_...slug_.astro.b5433bcf.mjs';
|
|
3
|
+
import { computed, useSSRContext, defineComponent, mergeProps, withCtx, createVNode, withDirectives, vShow, resolveDynamicComponent, createTextVNode, toDisplayString, openBlock, createBlock, Fragment, renderList, renderSlot, createCommentVNode, ref, shallowReactive, resolveComponent, withModifiers, withAsyncContext } from 'vue';
|
|
5
4
|
import { ssrRenderAttrs, ssrRenderComponent, ssrRenderStyle, ssrRenderList, ssrRenderClass, ssrRenderAttr, ssrRenderSlot, ssrRenderVNode, ssrInterpolate } from 'vue/server-renderer';
|
|
5
|
+
import api from '@cloudcommerce/api';
|
|
6
6
|
import { inStock, price, name, img, onPromotion } from '@ecomplus/utils';
|
|
7
7
|
import { useElementHover, watchOnce } from '@vueuse/core';
|
|
8
8
|
|
|
@@ -43,9 +43,9 @@ const usePageHero = async ({ routeContext }) => {
|
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
const $$Astro$4 = createAstro("https://ecom2-demo.web.app");
|
|
46
|
-
const $$
|
|
46
|
+
const $$Banner = createComponent(async ($$result, $$props, $$slots) => {
|
|
47
47
|
const Astro2 = $$result.createAstro($$Astro$4, $$props, $$slots);
|
|
48
|
-
Astro2.self = $$
|
|
48
|
+
Astro2.self = $$Banner;
|
|
49
49
|
const {
|
|
50
50
|
img,
|
|
51
51
|
alt,
|
|
@@ -53,7 +53,9 @@ const $$HeroPicture = createComponent(async ($$result, $$props, $$slots) => {
|
|
|
53
53
|
title,
|
|
54
54
|
subtitle,
|
|
55
55
|
buttonText,
|
|
56
|
-
index
|
|
56
|
+
index,
|
|
57
|
+
class: className = "max-w-screen-2xl",
|
|
58
|
+
mobileClass = "max-w-screen-sm"
|
|
57
59
|
} = Astro2.props;
|
|
58
60
|
const hasHeader = title || subtitle || buttonText;
|
|
59
61
|
let { widths, mobileWidths } = Astro2.props;
|
|
@@ -70,9 +72,9 @@ const $$HeroPicture = createComponent(async ($$result, $$props, $$slots) => {
|
|
|
70
72
|
if (!mobileWidths?.length) {
|
|
71
73
|
mobileWidths = [720, 856];
|
|
72
74
|
}
|
|
73
|
-
return renderTemplate`${renderComponent($$result, "Picture", $$Picture, { "src": img, "alt": alt || "", "widths": widths, "fetchpriority": index === 0 ? "high" : "low", "loading": index === 0 ? "eager" : "lazy", "class": `${mobileImg ? "hidden md:block" : ""}
|
|
74
|
-
${mobileImg && renderTemplate`${renderComponent($$result, "Picture", $$Picture, { "src": mobileImg, "alt": alt || "", "widths": mobileWidths, "fetchpriority": index === 0 ? "high" : "low", "loading": index === 0 ? "eager" : "lazy", "class":
|
|
75
|
-
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/components/
|
|
75
|
+
return renderTemplate`${renderComponent($$result, "Picture", $$Picture, { "src": img, "alt": alt || "", "widths": widths, "fetchpriority": index === 0 ? "high" : "low", "loading": index === 0 ? "eager" : "lazy", "class": `${mobileImg ? "hidden md:block " : ""}mx-auto ${className}` })}
|
|
76
|
+
${mobileImg && renderTemplate`${renderComponent($$result, "Picture", $$Picture, { "src": mobileImg, "alt": alt || "", "widths": mobileWidths, "fetchpriority": index === 0 ? "high" : "low", "loading": index === 0 ? "eager" : "lazy", "class": `md:hidden mx-auto ${mobileClass}` })}`}`;
|
|
77
|
+
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/components/Banner.astro");
|
|
76
78
|
|
|
77
79
|
const useHeroSlider = (props) => {
|
|
78
80
|
const parsedSlides = computed(() => {
|
|
@@ -108,7 +110,10 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
108
110
|
});
|
|
109
111
|
function _sfc_ssrRender$3(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
|
|
110
112
|
_push(`<section${ssrRenderAttrs(mergeProps({ class: "relative mx-auto" }, _attrs))}>`);
|
|
111
|
-
_push(ssrRenderComponent($setup["Carousel"], {
|
|
113
|
+
_push(ssrRenderComponent($setup["Carousel"], {
|
|
114
|
+
autoplay: $props.autoplay,
|
|
115
|
+
class: "secondary [&>*]:items-center"
|
|
116
|
+
}, {
|
|
112
117
|
controls: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
113
118
|
if (_push2) {
|
|
114
119
|
_push2(`<div style="${ssrRenderStyle($setup.parsedSlides.length > 1 ? null : { display: "none" })}" class="absolute z-10 bottom-5 flex justify-end items-center w-screen right-5 xl:right-auto xl:max-w-screen-xl xl:left-1/2 xl:-ms-[640px]"${_scopeId}><div class="relative w-20 h-10 rounded-full bg-white/50 text-primary shadow-sm ring-1 ring-black/5"${_scopeId}>`);
|
|
@@ -170,7 +175,7 @@ function _sfc_ssrRender$3(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
|
|
|
170
175
|
if (_push2) {
|
|
171
176
|
_push2(`<!--[-->`);
|
|
172
177
|
ssrRenderList($setup.parsedSlides, (slide, i) => {
|
|
173
|
-
_push2(`<li class="shrink-0 basis-full
|
|
178
|
+
_push2(`<li class="shrink-0 basis-full"${_scopeId}><div class="${ssrRenderClass([slide.hasHeader ? "grid grid-cols-1 md:grid-cols-2 items-center" : null, "w-screen max-w-screen-2xl mx-auto overflow-x-hidden"])}"${_scopeId}><a${ssrRenderAttr("href", slide.href)} class="${ssrRenderClass(slide.hasHeader ? "basis-1/2 grow-0 md:order-last" : null)}"${_scopeId}>`);
|
|
174
179
|
ssrRenderSlot(_ctx.$slots, `picture-${i}`, {}, null, _push2, _parent2, _scopeId);
|
|
175
180
|
_push2(`</a>`);
|
|
176
181
|
if (slide.hasHeader) {
|
|
@@ -209,7 +214,7 @@ function _sfc_ssrRender$3(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
|
|
|
209
214
|
(openBlock(true), createBlock(Fragment, null, renderList($setup.parsedSlides, (slide, i) => {
|
|
210
215
|
return openBlock(), createBlock("li", {
|
|
211
216
|
key: i,
|
|
212
|
-
class: "shrink-0 basis-full
|
|
217
|
+
class: "shrink-0 basis-full"
|
|
213
218
|
}, [
|
|
214
219
|
createVNode("div", {
|
|
215
220
|
class: ["w-screen max-w-screen-2xl mx-auto overflow-x-hidden", slide.hasHeader ? "grid grid-cols-1 md:grid-cols-2 items-center" : null]
|
|
@@ -405,11 +410,12 @@ const useProductCard = (props) => {
|
|
|
405
410
|
const isFetching = ref(false);
|
|
406
411
|
let fetching = null;
|
|
407
412
|
const fetchError = ref(null);
|
|
413
|
+
const { productId } = props;
|
|
408
414
|
const product = shallowReactive({
|
|
409
415
|
...props.product,
|
|
416
|
+
_id: props.product?._id || productId,
|
|
410
417
|
price: price(props.product || {})
|
|
411
418
|
});
|
|
412
|
-
const { productId } = props;
|
|
413
419
|
if (!props.product && productId) {
|
|
414
420
|
isFetching.value = true;
|
|
415
421
|
fetching = (async () => {
|
|
@@ -442,13 +448,6 @@ const useProductCard = (props) => {
|
|
|
442
448
|
if (img$1)
|
|
443
449
|
_images.push(img$1);
|
|
444
450
|
});
|
|
445
|
-
} else {
|
|
446
|
-
const { picture } = product;
|
|
447
|
-
if (picture) {
|
|
448
|
-
const img$1 = img(picture);
|
|
449
|
-
if (img$1)
|
|
450
|
-
_images.push(img$1);
|
|
451
|
-
}
|
|
452
451
|
}
|
|
453
452
|
return _images;
|
|
454
453
|
});
|
|
@@ -465,6 +464,11 @@ const useProductCard = (props) => {
|
|
|
465
464
|
}
|
|
466
465
|
return 0;
|
|
467
466
|
});
|
|
467
|
+
const hasVariations = computed(() => {
|
|
468
|
+
if (product.has_variations)
|
|
469
|
+
return true;
|
|
470
|
+
return Boolean(product.variations?.length);
|
|
471
|
+
});
|
|
468
472
|
return {
|
|
469
473
|
isFetching,
|
|
470
474
|
fetching,
|
|
@@ -475,7 +479,8 @@ const useProductCard = (props) => {
|
|
|
475
479
|
images,
|
|
476
480
|
isInStock,
|
|
477
481
|
isActive,
|
|
478
|
-
discountPercentage
|
|
482
|
+
discountPercentage,
|
|
483
|
+
hasVariations
|
|
479
484
|
};
|
|
480
485
|
};
|
|
481
486
|
|
|
@@ -697,7 +702,7 @@ function _sfc_ssrRender$2(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
|
|
|
697
702
|
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
698
703
|
if (_push2) {
|
|
699
704
|
if ($setup.cashbackValue && $props.hasCashback) {
|
|
700
|
-
_push2(`<div class="relative z-10"${_scopeId}><span${ssrRenderAttr("data-tooltip", "Receba $1 de volta".replace("$1", _ctx.$percentage($setup.cashbackPercentage)))}${_scopeId}><i class="i-
|
|
705
|
+
_push2(`<div class="relative z-10"${_scopeId}><span${ssrRenderAttr("data-tooltip", "Receba $1 de volta".replace("$1", _ctx.$percentage($setup.cashbackPercentage)))}${_scopeId}><i class="i-arrow-uturn-left mr-1"${_scopeId}></i><span class="font-medium"${_scopeId}>${ssrInterpolate(_ctx.$money($setup.cashbackValue))}</span><small${_scopeId}> cashback</small></span></div>`);
|
|
701
706
|
} else {
|
|
702
707
|
_push2(`<!---->`);
|
|
703
708
|
}
|
|
@@ -710,7 +715,7 @@ function _sfc_ssrRender$2(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
|
|
|
710
715
|
createVNode("span", {
|
|
711
716
|
"data-tooltip": "Receba $1 de volta".replace("$1", _ctx.$percentage($setup.cashbackPercentage))
|
|
712
717
|
}, [
|
|
713
|
-
createVNode("i", { class: "i-
|
|
718
|
+
createVNode("i", { class: "i-arrow-uturn-left mr-1" }),
|
|
714
719
|
createVNode("span", { class: "font-medium" }, toDisplayString(_ctx.$money($setup.cashbackValue)), 1),
|
|
715
720
|
createVNode("small", null, " cashback")
|
|
716
721
|
], 8, ["data-tooltip"])
|
|
@@ -816,7 +821,11 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
816
821
|
product,
|
|
817
822
|
title,
|
|
818
823
|
link,
|
|
819
|
-
images
|
|
824
|
+
images,
|
|
825
|
+
isInStock,
|
|
826
|
+
isActive,
|
|
827
|
+
discountPercentage,
|
|
828
|
+
hasVariations
|
|
820
829
|
} = useProductCard({
|
|
821
830
|
product: props.product,
|
|
822
831
|
productId: props.productId
|
|
@@ -827,7 +836,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
827
836
|
watchOnce(isHovered, () => {
|
|
828
837
|
wasHoveredOnce.value = true;
|
|
829
838
|
});
|
|
830
|
-
const __returned__ = { props, product, title, link, images, card, isHovered, wasHoveredOnce,
|
|
839
|
+
const __returned__ = { props, product, title, link, images, isInStock, isActive, discountPercentage, hasVariations, card, isHovered, wasHoveredOnce, get addProductToCart() {
|
|
840
|
+
return addProductToCart;
|
|
841
|
+
}, Prices };
|
|
831
842
|
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
832
843
|
return __returned__;
|
|
833
844
|
}
|
|
@@ -866,9 +877,18 @@ function _sfc_ssrRender$1(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
|
|
|
866
877
|
} else {
|
|
867
878
|
_push2(`<div class="w-full h-full bg-gradient-to-br from-base-50/20 to-base-100"${_scopeId}></div>`);
|
|
868
879
|
}
|
|
869
|
-
_push2(`</div></div
|
|
880
|
+
_push2(`</div></div>`);
|
|
881
|
+
if ($setup.discountPercentage) {
|
|
882
|
+
_push2(`<span class="uno-bm03rg"${_scopeId}> -<strong${_scopeId}>${ssrInterpolate($setup.discountPercentage)}</strong>% </span>`);
|
|
883
|
+
} else {
|
|
884
|
+
_push2(`<!---->`);
|
|
885
|
+
}
|
|
886
|
+
_push2(`<div class="relative flex flex-col grow justify-between p-4 group-hover:backdrop-blur-md bg-white/40 z-10"${_scopeId}>`);
|
|
870
887
|
ssrRenderVNode(_push2, createVNode(resolveDynamicComponent($props.headingTag), {
|
|
871
|
-
class: ["ui-link
|
|
888
|
+
class: ["ui-link no-underline line-clamp-2", [
|
|
889
|
+
$setup.isActive ? "text-base-700" : "text-base-500",
|
|
890
|
+
$setup.link ? "group-hover:underline group-hover:text-primary" : null
|
|
891
|
+
]]
|
|
872
892
|
}, {
|
|
873
893
|
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
|
874
894
|
if (_push3) {
|
|
@@ -882,8 +902,20 @@ function _sfc_ssrRender$1(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
|
|
|
882
902
|
_: 1
|
|
883
903
|
}), _parent2, _scopeId);
|
|
884
904
|
_push2(`<div class="pt-2"${_scopeId}>`);
|
|
885
|
-
|
|
886
|
-
|
|
905
|
+
if ($setup.isActive) {
|
|
906
|
+
_push2(`<div${_scopeId}>`);
|
|
907
|
+
_push2(ssrRenderComponent($setup["Prices"], { product: $setup.product }, null, _parent2, _scopeId));
|
|
908
|
+
_push2(`</div>`);
|
|
909
|
+
} else {
|
|
910
|
+
_push2(`<span class="ui-badge bg-warning-100 text-warning-700"${_scopeId}>${ssrInterpolate(!$setup.isInStock ? "Sem estoque" : "Inativo")}</span>`);
|
|
911
|
+
}
|
|
912
|
+
_push2(`</div>`);
|
|
913
|
+
if ($setup.isActive && !$setup.hasVariations) {
|
|
914
|
+
_push2(`<button class="ui-btn-sm ui-btn-primary absolute -top-6 left-0 w-full rounded-none opacity-0 group-hover:opacity-100 transition -z-10 group-hover:z-10"${_scopeId}><i class="i-plus-20-solid mr-0.5"${_scopeId}></i> ${ssrInterpolate("Adicionar ao carrinho")}</button>`);
|
|
915
|
+
} else {
|
|
916
|
+
_push2(`<!---->`);
|
|
917
|
+
}
|
|
918
|
+
_push2(`</div>`);
|
|
887
919
|
} else {
|
|
888
920
|
return [
|
|
889
921
|
createVNode("div", { class: "aspect-square p-2 motion-safe:group-hover:scale-110 transition-transform" }, [
|
|
@@ -906,9 +938,20 @@ function _sfc_ssrRender$1(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
|
|
|
906
938
|
}))
|
|
907
939
|
])
|
|
908
940
|
]),
|
|
909
|
-
|
|
941
|
+
$setup.discountPercentage ? (openBlock(), createBlock("span", {
|
|
942
|
+
key: 0,
|
|
943
|
+
class: "uno-bm03rg"
|
|
944
|
+
}, [
|
|
945
|
+
createTextVNode(" -"),
|
|
946
|
+
createVNode("strong", null, toDisplayString($setup.discountPercentage), 1),
|
|
947
|
+
createTextVNode("% ")
|
|
948
|
+
])) : createCommentVNode("", true),
|
|
949
|
+
createVNode("div", { class: "relative flex flex-col grow justify-between p-4 group-hover:backdrop-blur-md bg-white/40 z-10" }, [
|
|
910
950
|
(openBlock(), createBlock(resolveDynamicComponent($props.headingTag), {
|
|
911
|
-
class: ["ui-link
|
|
951
|
+
class: ["ui-link no-underline line-clamp-2", [
|
|
952
|
+
$setup.isActive ? "text-base-700" : "text-base-500",
|
|
953
|
+
$setup.link ? "group-hover:underline group-hover:text-primary" : null
|
|
954
|
+
]]
|
|
912
955
|
}, {
|
|
913
956
|
default: withCtx(() => [
|
|
914
957
|
createTextVNode(toDisplayString($setup.title), 1)
|
|
@@ -916,8 +959,21 @@ function _sfc_ssrRender$1(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
|
|
|
916
959
|
_: 1
|
|
917
960
|
}, 8, ["class"])),
|
|
918
961
|
createVNode("div", { class: "pt-2" }, [
|
|
919
|
-
|
|
920
|
-
|
|
962
|
+
$setup.isActive ? (openBlock(), createBlock("div", { key: 0 }, [
|
|
963
|
+
createVNode($setup["Prices"], { product: $setup.product }, null, 8, ["product"])
|
|
964
|
+
])) : (openBlock(), createBlock("span", {
|
|
965
|
+
key: 1,
|
|
966
|
+
class: "ui-badge bg-warning-100 text-warning-700"
|
|
967
|
+
}, toDisplayString(!$setup.isInStock ? "Sem estoque" : "Inativo"), 1))
|
|
968
|
+
]),
|
|
969
|
+
$setup.isActive && !$setup.hasVariations ? (openBlock(), createBlock("button", {
|
|
970
|
+
key: 0,
|
|
971
|
+
class: "ui-btn-sm ui-btn-primary absolute -top-6 left-0 w-full rounded-none opacity-0 group-hover:opacity-100 transition -z-10 group-hover:z-10",
|
|
972
|
+
onClick: withModifiers(($event) => $setup.addProductToCart($setup.product), ["prevent"])
|
|
973
|
+
}, [
|
|
974
|
+
createVNode("i", { class: "i-plus-20-solid mr-0.5" }),
|
|
975
|
+
createTextVNode(" " + toDisplayString("Adicionar ao carrinho"))
|
|
976
|
+
], 8, ["onClick"])) : createCommentVNode("", true)
|
|
921
977
|
])
|
|
922
978
|
];
|
|
923
979
|
}
|
|
@@ -1073,51 +1129,9 @@ const $$Home = createComponent(async ($$result, $$props, $$slots) => {
|
|
|
1073
1129
|
const { routeContext } = Astro2.locals;
|
|
1074
1130
|
const { heroSlider } = await usePageHero({ routeContext });
|
|
1075
1131
|
const heroSlides = heroSlider.slides;
|
|
1076
|
-
const products = (await api.get("products")).data.result;
|
|
1077
1132
|
return renderTemplate`${maybeRenderHead()}<main>
|
|
1078
|
-
${heroSlider.slides.length && renderTemplate`${renderComponent($$result, "HeroSlider", HeroSlider, { ...heroSlider, "client:load": true, "client:component-hydration": "load", "client:component-path": "~/components/HeroSlider.vue", "client:component-export": "default" }, { "picture-0": ($$result2) => renderTemplate`${heroSlides[0] && renderTemplate`${renderComponent($$result2, "
|
|
1133
|
+
${heroSlider.slides.length && renderTemplate`${renderComponent($$result, "HeroSlider", HeroSlider, { ...heroSlider, "client:load": true, "client:component-hydration": "load", "client:component-path": "~/components/HeroSlider.vue", "client:component-export": "default" }, { "picture-0": ($$result2) => renderTemplate`${heroSlides[0] && renderTemplate`${renderComponent($$result2, "Banner", $$Banner, { "slot": "picture-0", ...heroSlides[0], "index": 0 })}`}`, "picture-1": ($$result2) => renderTemplate`${heroSlides[1] && renderTemplate`${renderComponent($$result2, "Banner", $$Banner, { "slot": "picture-1", ...heroSlides[1], "index": 1 })}`}`, "picture-2": ($$result2) => renderTemplate`${heroSlides[2] && renderTemplate`${renderComponent($$result2, "Banner", $$Banner, { "slot": "picture-2", ...heroSlides[2], "index": 2 })}`}`, "picture-3": ($$result2) => renderTemplate`${heroSlides[3] && renderTemplate`${renderComponent($$result2, "Banner", $$Banner, { "slot": "picture-3", ...heroSlides[3], "index": 3 })}`}`, "picture-4": ($$result2) => renderTemplate`${heroSlides[4] && renderTemplate`${renderComponent($$result2, "Banner", $$Banner, { "slot": "picture-4", ...heroSlides[4], "index": 4 })}`}`, "picture-5": ($$result2) => renderTemplate`${heroSlides[5] && renderTemplate`${renderComponent($$result2, "Banner", $$Banner, { "slot": "picture-5", ...heroSlides[5], "index": 5 })}`}`, "picture-6": ($$result2) => renderTemplate`${heroSlides[6] && renderTemplate`${renderComponent($$result2, "Banner", $$Banner, { "slot": "picture-6", ...heroSlides[6], "index": 6 })}`}`, "picture-7": ($$result2) => renderTemplate`${heroSlides[7] && renderTemplate`${renderComponent($$result2, "Banner", $$Banner, { "slot": "picture-7", ...heroSlides[7], "index": 7 })}`}`, "picture-8": ($$result2) => renderTemplate`${heroSlides[8] && renderTemplate`${renderComponent($$result2, "Banner", $$Banner, { "slot": "picture-8", ...heroSlides[8], "index": 8 })}`}`, "picture-9": ($$result2) => renderTemplate`${heroSlides[9] && renderTemplate`${renderComponent($$result2, "Banner", $$Banner, { "slot": "picture-9", ...heroSlides[9], "index": 9 })}`}` })}`}
|
|
1079
1134
|
${renderComponent($$result, "Sections", $$Sections, {})}
|
|
1080
|
-
|
|
1081
|
-
<h1>Welcome to <span class="text-primary">Astro</span></h1>
|
|
1082
|
-
<ul role="list" class="mt-3 fs-20">
|
|
1083
|
-
${products.map((product) => renderTemplate`<li>
|
|
1084
|
-
<a${addAttribute(`/${product.slug}`, "href")}>${product.sku}</a>
|
|
1085
|
-
</li>`)}
|
|
1086
|
-
</ul>
|
|
1087
|
-
<div class="prose">
|
|
1088
|
-
<h1>Oi</h1>
|
|
1089
|
-
<p>Olá <a href="/">link</a></p>
|
|
1090
|
-
<ul>
|
|
1091
|
-
<li>So here is the first item in this list.</li>
|
|
1092
|
-
<li>In this example we're keeping the items short.</li>
|
|
1093
|
-
<li>Later, we'll use longer, more complex list items.</li>
|
|
1094
|
-
</ul>
|
|
1095
|
-
<details>
|
|
1096
|
-
<summary role="button">Accordion 1</summary>
|
|
1097
|
-
<p>…</p>
|
|
1098
|
-
</details>
|
|
1099
|
-
</div>
|
|
1100
|
-
<div>
|
|
1101
|
-
<h1>Oi</h1>
|
|
1102
|
-
<p>Olá <a href="/">link</a></p>
|
|
1103
|
-
<details>
|
|
1104
|
-
<summary role="button">Accordion 1</summary>
|
|
1105
|
-
<p>…</p>
|
|
1106
|
-
</details>
|
|
1107
|
-
</div>
|
|
1108
|
-
<div class="mt-2">
|
|
1109
|
-
<div>
|
|
1110
|
-
<label class="block">
|
|
1111
|
-
<span class="text-gray-700">Email address</span>
|
|
1112
|
-
<input type="email" class="mt-1 block w-full" placeholder="john@example.com">
|
|
1113
|
-
</label>
|
|
1114
|
-
<label class="inline-flex items-center">
|
|
1115
|
-
<input type="checkbox" checked>
|
|
1116
|
-
<span class="ml-2 font-brand">Email me news and special offers</span>
|
|
1117
|
-
</label>
|
|
1118
|
-
</div>
|
|
1119
|
-
</div>
|
|
1120
|
-
${renderComponent($$result, "Prices", Prices, { "price": 10, "client:load": true, "client:component-hydration": "load", "client:component-path": "~/components/Prices.vue", "client:component-export": "default" })}
|
|
1121
1135
|
</main>`;
|
|
1122
1136
|
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/main/Home.astro");
|
|
1123
1137
|
|
|
@@ -3,7 +3,7 @@ import { webcrypto } from 'node:crypto';
|
|
|
3
3
|
import { ByteLengthQueuingStrategy, CountQueuingStrategy, ReadableByteStreamController, ReadableStream, ReadableStreamBYOBReader, ReadableStreamBYOBRequest, ReadableStreamDefaultController, ReadableStreamDefaultReader, TransformStream, WritableStream, WritableStreamDefaultController, WritableStreamDefaultWriter } from 'node:stream/web';
|
|
4
4
|
import { File, FormData, Headers, Request, Response, fetch } from 'undici';
|
|
5
5
|
import { setTimeout as setTimeout$1, clearTimeout as clearTimeout$1 } from 'node:timers';
|
|
6
|
-
import { N as NodeApp, g as deserializeManifest } from './chunks/astro.
|
|
6
|
+
import { N as NodeApp, g as deserializeManifest } from './chunks/astro.45d3047f.mjs';
|
|
7
7
|
import { Readable } from 'stream';
|
|
8
8
|
import https from 'https';
|
|
9
9
|
import path from 'path';
|
|
@@ -24,7 +24,7 @@ import 'string-width';
|
|
|
24
24
|
import 'vue';
|
|
25
25
|
import 'vue/server-renderer';
|
|
26
26
|
import '@ecomplus/utils';
|
|
27
|
-
import './chunks/pages/_...slug_.astro.
|
|
27
|
+
import './chunks/pages/_...slug_.astro.b5433bcf.mjs';
|
|
28
28
|
import 'node:fs/promises';
|
|
29
29
|
import 'node:path';
|
|
30
30
|
import 'node:url';
|
|
@@ -2824,13 +2824,13 @@ const adapter = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
|
2824
2824
|
start
|
|
2825
2825
|
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2826
2826
|
|
|
2827
|
-
const _page0 = () => import('./chunks/endpoint@_@js.
|
|
2828
|
-
const _page1 = () => import('./chunks/index@_@astro.
|
|
2829
|
-
const _page2 = () => import('./chunks/fallback@_@astro.
|
|
2830
|
-
const _page3 = () => import('./chunks/index@_@astro.
|
|
2831
|
-
const _page4 = () => import('./chunks/account@_@astro.
|
|
2832
|
-
const _page5 = () => import('./chunks/_...
|
|
2833
|
-
const _manifest = Object.assign(deserializeManifest({"adapterName":"@astrojs/node","routes":[{"file":"","links":[],"scripts":[],"styles":[],"routeData":{"type":"endpoint","route":"/_image","pattern":"^\\/_image$","segments":[[{"content":"_image","dynamic":false,"spread":false}]],"params":[],"component":"../../node_modules/.pnpm/@astrojs+image@0.17.2_astro@2.8.
|
|
2827
|
+
const _page0 = () => import('./chunks/endpoint@_@js.59bf44fe.mjs');
|
|
2828
|
+
const _page1 = () => import('./chunks/index@_@astro.d93b7b12.mjs');
|
|
2829
|
+
const _page2 = () => import('./chunks/fallback@_@astro.c8a88451.mjs');
|
|
2830
|
+
const _page3 = () => import('./chunks/index@_@astro.d808b7a7.mjs');
|
|
2831
|
+
const _page4 = () => import('./chunks/account@_@astro.691bc27d.mjs');
|
|
2832
|
+
const _page5 = () => import('./chunks/_...38dc610a.mjs');const pageMap = new Map([["../../node_modules/.pnpm/@astrojs+image@0.17.2_astro@2.8.3_sharp@0.32.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]]);
|
|
2833
|
+
const _manifest = Object.assign(deserializeManifest({"adapterName":"@astrojs/node","routes":[{"file":"","links":[],"scripts":[],"styles":[],"routeData":{"type":"endpoint","route":"/_image","pattern":"^\\/_image$","segments":[[{"content":"_image","dynamic":false,"spread":false}]],"params":[],"component":"../../node_modules/.pnpm/@astrojs+image@0.17.2_astro@2.8.3_sharp@0.32.3/node_modules/@astrojs/image/dist/endpoint.js","pathname":"/_image","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[{"type":"external","value":"/_astro/hoisted.9d9d7ac4.js"}],"styles":[{"type":"external","src":"/_astro/_...slug_.c58d7d89.css"}],"routeData":{"route":"/","type":"page","pattern":"^\\/$","segments":[],"params":[],"component":"src/pages/index.astro","pathname":"/","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[{"type":"external","value":"/_astro/hoisted.9d9d7ac4.js"}],"styles":[{"type":"external","src":"/_astro/_...slug_.c58d7d89.css"}],"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":[],"styles":[],"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":[],"styles":[],"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":[],"scripts":[{"type":"external","value":"/_astro/hoisted.9d9d7ac4.js"}],"styles":[{"type":"external","src":"/_astro/_...slug_.c58d7d89.css"}],"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-demo.web.app","base":"/","compressHTML":false,"markdown":{"drafts":false,"syntaxHighlight":"shiki","shikiConfig":{"langs":[],"theme":"github-dark","wrap":false},"remarkPlugins":[],"rehypePlugins":[],"remarkRehype":{},"gfm":true,"smartypants":true},"componentMetadata":[["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/[...slug].astro",{"propagation":"none","containsHead":true}],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/fallback.astro",{"propagation":"none","containsHead":true}],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/index.astro",{"propagation":"none","containsHead":true}]],"renderers":[],"clientDirectives":[["idle","(()=>{var i=t=>{let e=async()=>{await(await t())()};\"requestIdleCallback\"in window?window.requestIdleCallback(e):setTimeout(e,200)};(self.Astro||(self.Astro={})).idle=i;window.dispatchEvent(new Event(\"astro:idle\"));})();"],["load","(()=>{var e=async t=>{await(await t())()};(self.Astro||(self.Astro={})).load=e;window.dispatchEvent(new Event(\"astro:load\"));})();"],["media","(()=>{var s=(i,t)=>{let a=async()=>{await(await i())()};if(t.value){let e=matchMedia(t.value);e.matches?a():e.addEventListener(\"change\",a,{once:!0})}};(self.Astro||(self.Astro={})).media=s;window.dispatchEvent(new Event(\"astro:media\"));})();"],["only","(()=>{var e=async t=>{await(await t())()};(self.Astro||(self.Astro={})).only=e;window.dispatchEvent(new Event(\"astro:only\"));})();"],["visible","(()=>{var r=(i,c,n)=>{let s=async()=>{await(await i())()},t=new IntersectionObserver(e=>{for(let o of e)if(o.isIntersecting){t.disconnect(),s();break}});for(let e of n.children)t.observe(e)};(self.Astro||(self.Astro={})).visible=r;window.dispatchEvent(new Event(\"astro:visible\"));})();"]],"entryModules":{"\u0000@astrojs-ssr-virtual-entry":"_@astrojs-ssr-virtual-entry.mjs","\u0000@astro-renderers":"renderers.mjs","\u0000empty-middleware":"_empty-middleware.mjs","/src/pages/app/account.astro":"chunks/pages/account.astro.f07cf19e.mjs","/src/pages/fallback.astro":"chunks/pages/fallback.astro.09db7801.mjs","\u0000@astro-page:../../node_modules/.pnpm/@astrojs+image@0.17.2_astro@2.8.3_sharp@0.32.3/node_modules/@astrojs/image/dist/endpoint@_@js":"chunks/endpoint@_@js.59bf44fe.mjs","\u0000@astro-page:src/pages/index@_@astro":"chunks/index@_@astro.d93b7b12.mjs","\u0000@astro-page:src/pages/fallback@_@astro":"chunks/fallback@_@astro.c8a88451.mjs","\u0000@astro-page:src/pages/app/index@_@astro":"chunks/index@_@astro.d808b7a7.mjs","\u0000@astro-page:src/pages/app/account@_@astro":"chunks/account@_@astro.691bc27d.mjs","\u0000@astro-page:src/pages/[...slug]@_@astro":"chunks/_...38dc610a.mjs","~/components/HeroSlider.vue":"_astro/HeroSlider.b2622951.js","~/components/PitchBar.vue":"_astro/PitchBar.ed85833a.js","/astro/hoisted.js?q=0":"_astro/hoisted.9d9d7ac4.js","@astrojs/vue/client.js":"_astro/client.8035a95a.js","/home/leo/code/ecomplus/cloud-commerce/node_modules/workbox-window/build/workbox-window.prod.es5.mjs":"_astro/workbox-window.prod.es5.a7b12eab.js","~/components/ProductShelf.vue":"_astro/ProductShelf.f63b3dc2.js","~/components/ShopHeader.vue":"_astro/ShopHeader.61f52cad.js","/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/scripts/firebase-app.ts":"_astro/firebase-app.84207480.js","astro:scripts/before-hydration.js":""},"assets":["/_astro/_...slug_.c58d7d89.css","/manifest.webmanifest","/robots.txt","/sw.js","/workbox-5e0bf4e4.js","/_astro/Carousel.62c97a79.js","/_astro/HeroSlider.b2622951.js","/_astro/PitchBar.ed85833a.js","/_astro/ProductShelf.f63b3dc2.js","/_astro/ShopHeader.61f52cad.js","/_astro/_plugin-vue_export-helper.4cb7dd76.js","/_astro/api.4984c5be.js","/_astro/client.8035a95a.js","/_astro/firebase-app.84207480.js","/_astro/hoisted.9d9d7ac4.js","/_astro/img.abbe849f.js","/_astro/index.b93f3d06.js","/_astro/preload-helper.cf010ec4.js","/_astro/session-utm.744b0db3.js","/_astro/workbox-window.prod.es5.a7b12eab.js","/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/banner2.webp","/img/uploads/ecom-icon.png","/img/uploads/headphone.webp","/img/uploads/logo.png","/img/uploads/og-image.png","/img/uploads/passion.webp","/img/uploads/rect8589.png","/img/uploads/rect859.png","/img/uploads/rect89.webp"]}), {
|
|
2834
2834
|
pageMap,
|
|
2835
2835
|
renderers,
|
|
2836
2836
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { h as server_default } from './chunks/astro.
|
|
1
|
+
import { h as server_default } from './chunks/astro.45d3047f.mjs';
|
|
2
2
|
import { useSSRContext, defineComponent, computed, mergeProps, h, createSSRApp } from 'vue';
|
|
3
3
|
import { ssrRenderSlotInner, ssrRenderAttrs, ssrRenderSlot, renderToString } from 'vue/server-renderer';
|
|
4
4
|
import { img, imgSizes, i18n, formatMoney } from '@ecomplus/utils';
|
|
5
|
-
import { _ as _export_sfc } from './chunks/pages/_...slug_.astro.
|
|
5
|
+
import { _ as _export_sfc } from './chunks/pages/_...slug_.astro.b5433bcf.mjs';
|
|
6
6
|
import 'path-to-regexp';
|
|
7
7
|
import 'cookie';
|
|
8
8
|
import '@astrojs/internal-helpers/path';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/storefront",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.19.0",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce storefront with Astro",
|
|
6
6
|
"bin": {
|
|
7
7
|
"storefront": "./scripts/build-prod.sh"
|
|
@@ -43,17 +43,17 @@
|
|
|
43
43
|
"@iconify-json/logos": "^1.1.33",
|
|
44
44
|
"@vite-pwa/astro": "^0.1.1",
|
|
45
45
|
"@vueuse/core": "10.2.1",
|
|
46
|
-
"astro": "2.8.
|
|
46
|
+
"astro": "2.8.3",
|
|
47
47
|
"chroma-js": "^2.4.2",
|
|
48
48
|
"dotenv": "^16.3.1",
|
|
49
49
|
"firebase": "^9.23.0",
|
|
50
50
|
"image-size": "^1.0.2",
|
|
51
51
|
"mime": "^3.0.0",
|
|
52
52
|
"semver": "^7.5.4",
|
|
53
|
-
"sharp": "^0.32.
|
|
54
|
-
"tailwindcss": "^3.3.
|
|
53
|
+
"sharp": "^0.32.3",
|
|
54
|
+
"tailwindcss": "^3.3.3",
|
|
55
55
|
"unocss": "^0.53.5",
|
|
56
|
-
"vite": "^4.4.
|
|
56
|
+
"vite": "^4.4.4",
|
|
57
57
|
"vite-plugin-pwa": "^0.16.4",
|
|
58
58
|
"vue": "^3.3.4"
|
|
59
59
|
},
|
|
@@ -3,6 +3,10 @@ import type {
|
|
|
3
3
|
GetPictureParams,
|
|
4
4
|
GetPictureResult,
|
|
5
5
|
} from '@astrojs/image/dist/lib/get-picture';
|
|
6
|
+
import type {
|
|
7
|
+
GetPictureParams as GetBuiltPictureParams,
|
|
8
|
+
GetPictureResult as GetBuiltPictureResult,
|
|
9
|
+
} from './get-built-picture';
|
|
6
10
|
|
|
7
11
|
export type PictureProps = Omit<PictureComponentRemoteImageProps, 'aspectRatio' | 'sizes'> & {
|
|
8
12
|
sizes?: string;
|
|
@@ -26,7 +30,8 @@ const getAspectRatio = (src: string | ImageSize, tryImageSize: TryImageSize) =>
|
|
|
26
30
|
|
|
27
31
|
export type UsePictureParams = PictureProps & {
|
|
28
32
|
tryImageSize: TryImageSize;
|
|
29
|
-
getPicture: (params: GetPictureParams) => Promise<GetPictureResult
|
|
33
|
+
getPicture: ((params: GetPictureParams) => Promise<GetPictureResult>)
|
|
34
|
+
| ((params: GetBuiltPictureParams) => Promise<GetBuiltPictureResult>);
|
|
30
35
|
};
|
|
31
36
|
|
|
32
37
|
const useSSRPicture = async (params: UsePictureParams) => {
|
|
@@ -48,7 +53,7 @@ const useSSRPicture = async (params: UsePictureParams) => {
|
|
|
48
53
|
...attrs
|
|
49
54
|
} = params;
|
|
50
55
|
|
|
51
|
-
let aspectRatio: number;
|
|
56
|
+
let aspectRatio: number | undefined;
|
|
52
57
|
if (propAspectRatio) {
|
|
53
58
|
if (typeof propAspectRatio === 'number') {
|
|
54
59
|
aspectRatio = propAspectRatio;
|
|
@@ -67,7 +72,7 @@ const useSSRPicture = async (params: UsePictureParams) => {
|
|
|
67
72
|
let sizes: string = propSizes || '';
|
|
68
73
|
if (!sizes && attrs.class) {
|
|
69
74
|
const classNames = attrs.class.split(' ');
|
|
70
|
-
let nextSize: string;
|
|
75
|
+
let nextSize: string | undefined;
|
|
71
76
|
const breakpoints = {
|
|
72
77
|
sm: 640,
|
|
73
78
|
md: 768,
|
|
@@ -75,10 +80,10 @@ const useSSRPicture = async (params: UsePictureParams) => {
|
|
|
75
80
|
xl: 1280,
|
|
76
81
|
'2xl': 1536,
|
|
77
82
|
};
|
|
78
|
-
[
|
|
79
|
-
[''],
|
|
83
|
+
([
|
|
84
|
+
['', 0],
|
|
80
85
|
...Object.entries(breakpoints),
|
|
81
|
-
].forEach(([breakpoint, minWidth]
|
|
86
|
+
] as Array<[string, number]>).forEach(([breakpoint, minWidth]) => {
|
|
82
87
|
const classRegex = breakpoint
|
|
83
88
|
? new RegExp(`^${breakpoint}:max-w-(\\[\\w+\\]|screen-\\w+)$`)
|
|
84
89
|
: /^max-w-(\[\w+\]|screen-\w+)$/;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
---
|
|
2
|
-
import type { HeroSliderProps } from '@@sf/layouts/
|
|
2
|
+
import type { HeroSliderProps } from '@@sf/layouts/main/use-page-hero';
|
|
3
3
|
import Picture from '@@sf/components/Picture.astro';
|
|
4
4
|
|
|
5
5
|
export type Props = HeroSliderProps['slides'][0] & {
|
|
6
6
|
index: number;
|
|
7
7
|
widths?: number[];
|
|
8
|
+
class?: string;
|
|
8
9
|
mobileWidths?: number[];
|
|
10
|
+
mobileClass?: string;
|
|
9
11
|
};
|
|
10
12
|
|
|
11
13
|
const {
|
|
@@ -16,9 +18,11 @@ const {
|
|
|
16
18
|
subtitle,
|
|
17
19
|
buttonText,
|
|
18
20
|
index,
|
|
21
|
+
class: className = 'max-w-screen-2xl',
|
|
22
|
+
mobileClass = 'max-w-screen-sm',
|
|
19
23
|
} = Astro.props as Props;
|
|
20
24
|
const hasHeader = title || subtitle || buttonText;
|
|
21
|
-
let { widths, mobileWidths }= Astro.props;
|
|
25
|
+
let { widths, mobileWidths } = Astro.props;
|
|
22
26
|
if (!widths?.length) {
|
|
23
27
|
if (mobileImg) {
|
|
24
28
|
widths = [1536, 2048];
|
|
@@ -40,7 +44,7 @@ if (!mobileWidths?.length) {
|
|
|
40
44
|
widths={widths}
|
|
41
45
|
fetchpriority={index === 0 ? 'high' : 'low'}
|
|
42
46
|
loading={index === 0 ? 'eager' : 'lazy'}
|
|
43
|
-
class={`${(mobileImg ? 'hidden md:block' : '')}
|
|
47
|
+
class={`${(mobileImg ? 'hidden md:block ' : '')}mx-auto ${className}`}
|
|
44
48
|
/>
|
|
45
49
|
{mobileImg &&
|
|
46
50
|
<Picture
|
|
@@ -49,6 +53,6 @@ if (!mobileWidths?.length) {
|
|
|
49
53
|
widths={mobileWidths}
|
|
50
54
|
fetchpriority={index === 0 ? 'high' : 'low'}
|
|
51
55
|
loading={index === 0 ? 'eager' : 'lazy'}
|
|
52
|
-
class=
|
|
56
|
+
class={`md:hidden mx-auto ${mobileClass}`}
|
|
53
57
|
/>
|
|
54
58
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Products,
|
|
1
|
+
import type { Products, SearchItem } from '@cloudcommerce/types';
|
|
2
2
|
import { ref, computed, shallowReactive } from 'vue';
|
|
3
3
|
import api from '@cloudcommerce/api';
|
|
4
4
|
import {
|
|
@@ -9,10 +9,9 @@ import {
|
|
|
9
9
|
onPromotion as checkOnPromotion,
|
|
10
10
|
} from '@ecomplus/utils';
|
|
11
11
|
|
|
12
|
-
type CartItem = Carts['items'][0];
|
|
13
12
|
type PictureSize = { url: string; alt?: string; size?: string };
|
|
14
13
|
|
|
15
|
-
export type ProductItem = Products | SearchItem
|
|
14
|
+
export type ProductItem = Products | SearchItem;
|
|
16
15
|
|
|
17
16
|
export type Props = {
|
|
18
17
|
product?: ProductItem;
|
|
@@ -23,12 +22,13 @@ const useProductCard = <T extends ProductItem | undefined = undefined>(props: Pr
|
|
|
23
22
|
const isFetching = ref(false);
|
|
24
23
|
let fetching: Promise<void> | null = null;
|
|
25
24
|
const fetchError = ref<Error | null>(null);
|
|
25
|
+
const { productId } = props;
|
|
26
26
|
const product = shallowReactive<(T extends undefined ? Partial<SearchItem> : T)
|
|
27
|
-
& { price: number }>({
|
|
27
|
+
& { _id: Products['_id'], price: number }>({
|
|
28
28
|
...(props.product as Exclude<T, undefined>),
|
|
29
|
+
_id: (props.product?._id || productId) as Products['_id'],
|
|
29
30
|
price: getPrice(props.product || {}),
|
|
30
31
|
});
|
|
31
|
-
const { productId } = props;
|
|
32
32
|
if (!props.product && productId) {
|
|
33
33
|
isFetching.value = true;
|
|
34
34
|
fetching = (async () => {
|
|
@@ -61,12 +61,6 @@ const useProductCard = <T extends ProductItem | undefined = undefined>(props: Pr
|
|
|
61
61
|
const img = getImg(picture);
|
|
62
62
|
if (img) _images.push(img);
|
|
63
63
|
}));
|
|
64
|
-
} else {
|
|
65
|
-
const { picture } = (product as CartItem);
|
|
66
|
-
if (picture) {
|
|
67
|
-
const img = getImg(picture);
|
|
68
|
-
if (img) _images.push(img);
|
|
69
|
-
}
|
|
70
64
|
}
|
|
71
65
|
return _images;
|
|
72
66
|
});
|
|
@@ -84,6 +78,10 @@ const useProductCard = <T extends ProductItem | undefined = undefined>(props: Pr
|
|
|
84
78
|
}
|
|
85
79
|
return 0;
|
|
86
80
|
});
|
|
81
|
+
const hasVariations = computed(() => {
|
|
82
|
+
if ((product as SearchItem).has_variations) return true;
|
|
83
|
+
return Boolean(product.variations?.length);
|
|
84
|
+
});
|
|
87
85
|
|
|
88
86
|
return {
|
|
89
87
|
isFetching,
|
|
@@ -96,6 +94,7 @@ const useProductCard = <T extends ProductItem | undefined = undefined>(props: Pr
|
|
|
96
94
|
isInStock,
|
|
97
95
|
isActive,
|
|
98
96
|
discountPercentage,
|
|
97
|
+
hasVariations,
|
|
99
98
|
};
|
|
100
99
|
};
|
|
101
100
|
|