cloudcommerce 0.5.0 → 0.6.1
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 +29 -0
- 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/client.d.ts +23 -3
- package/packages/storefront/dist/client/_astro/PitchBar.457658a3.js +1 -0
- package/packages/storefront/dist/client/_astro/Prices.a1302bf9.js +1 -0
- package/packages/storefront/dist/client/_astro/ProductCard.1a45764a.js +1 -0
- package/packages/storefront/dist/client/_astro/ShopHeader.0a6766ac.js +1 -0
- package/packages/storefront/dist/client/_astro/{_...slug_.648728f3.css → _...slug_.6721f699.css} +1 -1
- package/packages/storefront/dist/client/_astro/_plugin-vue_export-helper.6da04e63.js +1 -0
- package/packages/storefront/dist/client/_astro/client.b854166f.js +1 -0
- package/packages/storefront/dist/client/_astro/firebase-app.7ce2ebb1.js +1426 -0
- package/packages/storefront/dist/client/_astro/format-money.6f464cee.js +1 -0
- package/packages/storefront/dist/client/_astro/hoisted.721ad75d.js +1 -0
- package/packages/storefront/dist/client/_astro/idle-callback.889bf0ea.js +1 -0
- package/packages/storefront/dist/client/_astro/index.a500792d.js +1 -0
- package/packages/storefront/dist/client/_astro/modules-info.80ae4e30.js +1 -0
- package/packages/storefront/dist/client/_astro/preload-helper.101896b7.js +1 -0
- package/packages/storefront/dist/client/_astro/{runtime-dom.esm-bundler.e8b26f2c.js → runtime-dom.esm-bundler.acde10ec.js} +1 -1
- package/packages/storefront/dist/client/fallback/index.html +3 -3
- package/packages/storefront/dist/client/sw.js +1 -1
- package/packages/storefront/dist/server/chunks/pages/{all.ba8f4b85.mjs → all.e0f284c9.mjs} +240 -26
- package/packages/storefront/dist/server/chunks/{prerender.8cd4ad42.mjs → prerender.9f6cbb00.mjs} +0 -0
- package/packages/storefront/dist/server/entry.mjs +5 -5
- package/packages/storefront/package.json +1 -1
- package/packages/storefront/server.d.ts +34 -0
- package/packages/storefront/src/env.d.ts +1 -0
- package/packages/storefront/src/helpers/afetch.ts +3 -1
- package/packages/storefront/src/helpers/idle-callback.ts +9 -0
- package/packages/storefront/src/lib/browser-env.ts +22 -0
- package/packages/storefront/src/lib/components/LoginForm.vue +13 -9
- package/packages/storefront/src/lib/components/SocialNetworkIcon.vue +29 -0
- package/packages/storefront/src/lib/components/SocialNetworkLink.vue +37 -0
- package/packages/storefront/src/lib/components/globals/ALink.vue +2 -2
- package/packages/storefront/src/lib/layouts/BaseStateJson.astro +1 -1
- package/packages/storefront/src/lib/scripts/firebase-app.ts +11 -3
- package/packages/storefront/src/lib/server-data.ts +25 -0
- package/packages/storefront/src/lib/ssr-context.ts +8 -6
- package/packages/storefront/src/lib/state/customer-session.ts +51 -30
- package/packages/storefront/src/lib/state/modules-info.ts +2 -5
- package/packages/storefront/tailwind.config.cjs +1 -0
- package/packages/types/package.json +1 -1
- package/packages/storefront/dist/client/_astro/PitchBar.df2672ff.js +0 -1
- package/packages/storefront/dist/client/_astro/Prices.99fa99bf.js +0 -1
- package/packages/storefront/dist/client/_astro/ProductCard.a322c854.js +0 -1
- package/packages/storefront/dist/client/_astro/ShopHeader.abd6dec6.js +0 -1
- package/packages/storefront/dist/client/_astro/_plugin-vue_export-helper.e6f0b936.js +0 -1
- package/packages/storefront/dist/client/_astro/client.e6b58b55.js +0 -1
- package/packages/storefront/dist/client/_astro/ecom-utils.92f137f6.js +0 -1
- package/packages/storefront/dist/client/_astro/hoisted.6edd7364.js +0 -1
- package/packages/storefront/dist/client/_astro/index.5dd878ac.js +0 -1
- package/packages/storefront/dist/client/_astro/modules-info.e8935203.js +0 -1
- package/packages/storefront/src/lib/components/ADrawer.vue +0 -110
- package/packages/storefront/src/lib/components/LoginDrawer.vue +0 -82
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,35 @@
|
|
|
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.6.1](https://github.com/ecomplus/cloud-commerce/compare/v0.6.0...v0.6.1) (2023-02-19)
|
|
6
|
+
|
|
7
|
+
## [0.6.0](https://github.com/ecomplus/cloud-commerce/compare/v0.5.0...v0.6.0) (2023-02-19)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### ⚠ BREAKING CHANGES
|
|
11
|
+
|
|
12
|
+
* **storefront:** `ADrawer` and `LoginDrawer` components no more exists
|
|
13
|
+
* **storefront:** Importing `@@sf/state/customer-session` does not start Firebase Auth automatically anymore, must call `initializeFirebaseAuth`
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **storefront:** Add `@@sf/browser-env` to exporting booleans for navigator and screen detection ([1281ad5](https://github.com/ecomplus/cloud-commerce/commit/1281ad50b6d23e7336dde1d5e5d4519ddeddcfa7))
|
|
18
|
+
* **storefront:** Add `@@sf/server-data` exporting `settings` and `apiContext` SSRred objects ([40ac1db](https://github.com/ecomplus/cloud-commerce/commit/40ac1db1a30ceb818a019ef21606c7541ceb229c))
|
|
19
|
+
* **storefront:** Also set `globalThis.storefront.context` on SSR context ([2c2fe64](https://github.com/ecomplus/cloud-commerce/commit/2c2fe642a1c07f32a5ee9851cf9c9dfde77e854a))
|
|
20
|
+
* **storefront:** New `SocialNetworkIcon` and `SocialNetworkLink` components ([9702da6](https://github.com/ecomplus/cloud-commerce/commit/9702da68bac461a085c58de143ddf1b5d0c120c7))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Bug Fixes
|
|
24
|
+
|
|
25
|
+
* **storefront:** Auto set customer session email from Firebase if empty, even if not verified ([f1741a9](https://github.com/ecomplus/cloud-commerce/commit/f1741a9696b1bfa3f253aa05404a5c57f5387c7c))
|
|
26
|
+
* **storefront:** Fix `ALink` global component to target _blank on external host ([dffe5d8](https://github.com/ecomplus/cloud-commerce/commit/dffe5d81c6b7261aab3c4bda22b94e337f65e013))
|
|
27
|
+
* **storefront:** Fixing default context API doc minifier regex ([711413f](https://github.com/ecomplus/cloud-commerce/commit/711413f993a087395078aca723483e3ffa4e5aae))
|
|
28
|
+
* **storefront:** Make customer session state SSR friendly ([7dd8dff](https://github.com/ecomplus/cloud-commerce/commit/7dd8dff3680a112f9e9afd348b3a8696466056ff))
|
|
29
|
+
* **storefront:** Update customer session state `isLogged` with email verified only ([d5ada3a](https://github.com/ecomplus/cloud-commerce/commit/d5ada3a130b7082d328611071178d4b92e4721cc))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
* **storefront:** Removing not intended to use `ADrawer` (=> `Drawer`) and `LoginDrawer` components ([0254f4c](https://github.com/ecomplus/cloud-commerce/commit/0254f4c82a76048b71e29bdcfeffa37b6992793d))
|
|
33
|
+
|
|
5
34
|
## [0.5.0](https://github.com/ecomplus/cloud-commerce/compare/v0.4.1...v0.5.0) (2023-02-16)
|
|
6
35
|
|
|
7
36
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloudcommerce",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.6.1",
|
|
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>",
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
/// <reference types="./src/vue-globals" />
|
|
2
2
|
|
|
3
|
+
type DocCleanupFields = 'body_html'
|
|
4
|
+
| 'body_text'
|
|
5
|
+
| 'meta_title'
|
|
6
|
+
| 'meta_description'
|
|
7
|
+
| 'i18n'
|
|
8
|
+
| 'metafields'
|
|
9
|
+
| 'hidden_metafields';
|
|
10
|
+
|
|
3
11
|
interface Window {
|
|
4
12
|
firebaseConfig?: {
|
|
5
13
|
apiKey: string,
|
|
@@ -16,10 +24,22 @@ interface Window {
|
|
|
16
24
|
ECOM_CURRENCY_SYMBOL: string;
|
|
17
25
|
ECOM_COUNTRY_CODE: string;
|
|
18
26
|
storefront?: {
|
|
19
|
-
settings: import('./src/lib/
|
|
27
|
+
settings: import('./src/lib/cms').CmsSettings,
|
|
20
28
|
context?: {
|
|
21
|
-
resource:
|
|
22
|
-
doc:
|
|
29
|
+
resource: 'products',
|
|
30
|
+
doc: Omit<import('@cloudcommerce/api/types').ProductSet, DocCleanupFields>,
|
|
31
|
+
timestamp: number,
|
|
32
|
+
} | {
|
|
33
|
+
resource: 'categories',
|
|
34
|
+
doc: Omit<import('@cloudcommerce/api/types').CategorySet, DocCleanupFields>,
|
|
35
|
+
timestamp: number,
|
|
36
|
+
} | {
|
|
37
|
+
resource: 'brands',
|
|
38
|
+
doc: Omit<import('@cloudcommerce/api/types').BrandSet, DocCleanupFields>,
|
|
39
|
+
timestamp: number,
|
|
40
|
+
} | {
|
|
41
|
+
resource: 'collections',
|
|
42
|
+
doc: Omit<import('@cloudcommerce/api/types').CollectionSet, DocCleanupFields>,
|
|
23
43
|
timestamp: number,
|
|
24
44
|
},
|
|
25
45
|
modulesInfoPreset?: Partial<typeof import('./src/lib/state/modules-info').default>,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{v as G}from"./runtime-dom.esm-bundler.acde10ec.js";import{p as J}from"./modules-info.80ae4e30.js";import{c as g,d as z,_ as R,m as Q,o as u,a as p,p as x,e as I,n as D,j as d,q as b,s as O,u as X,v as Y,x as Z,y as ee,k as $,w as m,l as q,g as C,z as te,A as ae,B as oe,F as ne,C as re,b as se}from"./_plugin-vue_export-helper.6da04e63.js";import{u as le,a as ie,b as ue}from"./index.a500792d.js";/* empty css */import"./session-utm.72684b84.js";import"./idle-callback.889bf0ea.js";import"./format-money.6f464cee.js";const ce=o=>{const r=g(()=>o.slides.map(({html:e})=>J(e).value)),a=g(()=>r.value.filter(e=>e).length);return{parsedContents:r,countValidSlides:a}},K=Symbol("carousel"),de=z({__name:"CarouselControl",props:{direction:{default:1}},setup(o,{expose:r}){r();const{changeSlide:a}=Q(K),e={changeSlide:a};return Object.defineProperty(e,"__isScriptSetup",{enumerable:!1,value:!0}),e}}),fe=["aria-label","data-carousel-control"];function pe(o,r,a,e,s,n){return u(),p("button",{type:"button","aria-label":a.direction>0?"Próximo":"Anterior",onClick:r[0]||(r[0]=i=>e.changeSlide(a.direction)),"data-carousel-control":a.direction>0?"next":"previous"},[x(o.$slots,"default",{},()=>[I("i",{class:D(["m-0",a.direction>0?"i-chevron-right":"i-chevron-left"])},null,2)])],8,fe)}const U=R(de,[["render",pe]]),me=z({__name:"Carousel",props:{as:{default:"ul"},modelValue:{default:1},autoplay:null},emits:["update:modelValue"],setup(o,{expose:r,emit:a}){r();const e=o,s=d(e.modelValue-1);b(O(e,"modelValue"),t=>{s.value=t-1}),b(s,(t,l)=>{t!==l&&a("update:modelValue",t+1)});const n=d(null),{x:i,isScrolling:f,arrivedState:S}=le(n),y=g(()=>S.left),w=g(()=>S.right),h=d([]),B=d(0),P=d(0),V=d(0),j=()=>{B.value=n.value.scrollWidth,P.value=n.value.offsetWidth},A=()=>{const t=[...n.value.children];h.value=t.map(l=>({offsetLeft:l.offsetLeft,width:l.offsetWidth}))},E=t=>{const l=t>0?s.value:s.value+t,M=h.value[l]?.width||0;return M?M*t:0},L=()=>{const t=h.value.findIndex(l=>Math.abs(l.offsetLeft-i.value)<=5);t>-1&&(s.value=t||0)},T=()=>{const t=B.value-P.value;V.value=h.value.findIndex(({offsetLeft:l})=>l>=t-5)};let c=null;const v=()=>{e.autoplay&&(clearTimeout(c),c=setTimeout(()=>{_(1)},e.autoplay))},_=t=>{if(t<0){if(y.value){T(),s.value=V.value-1,_(1);return}}else if(w.value){s.value=1,_(-1);return}const l=E(t);l&&(n.value.scrollBy({left:l,behavior:"smooth"}),v())};b(f,t=>{t?clearTimeout(c):(L(),v())});const N=d(null),F=ie(N);b(F,t=>{t?clearTimeout(c):v()});const W=()=>{n.value&&(j(),A(),L(),T())},k=ue(W,400);X(()=>{W(),Y(()=>{[...n.value.children].forEach(t=>{t.setAttribute("tabindex","0")})}),v(),window.addEventListener("resize",k)}),Z(()=>{window.removeEventListener("resize",k),clearTimeout(c)}),ee(K,{autoplay:O(e,"autoplay"),changeSlide:_,isBoundLeft:y,isBoundRight:w});const H={props:e,emit:a,currentIndex:s,wrapper:n,currentPos:i,isScrolling:f,arrivedState:S,isBoundLeft:y,isBoundRight:w,slidesWidth:h,wrapperScrollWidth:B,wrapperVisibleWidth:P,indexCount:V,calcWrapperWidth:j,calcSlidesWidth:A,calcNextWidth:E,calcCurrentIndex:L,calcIndexCount:T,get autoplayTimer(){return c},set autoplayTimer(t){c=t},restartAutoplay:v,changeSlide:_,carousel:N,isHovered:F,calcOnInit:W,onResize:k,CarouselControl:U};return Object.defineProperty(H,"__isScriptSetup",{enumerable:!1,value:!0}),H}}),he={ref:"carousel","data-carousel":""};function ve(o,r,a,e,s,n){return u(),p("div",he,[(u(),$(q(a.as),{ref:"wrapper","data-carousel-wrapper":""},{default:m(()=>[x(o.$slots,"default")]),_:3},512)),x(o.$slots,"controls",te(ae({changeSlide:e.changeSlide,isBoundLeft:e.isBoundLeft,isBoundRight:e.isBoundRight,currentPage:e.currentIndex+1,pageCount:e.indexCount+1})),()=>[C(e.CarouselControl,{direction:-1},{default:m(()=>[x(o.$slots,"previous")]),_:3}),C(e.CarouselControl,null,{default:m(()=>[x(o.$slots,"next")]),_:3})])],512)}const _e=R(me,[["render",ve]]),xe=z({__name:"PitchBar",props:{slides:null},setup(o,{expose:r}){r();const a=o,{parsedContents:e,countValidSlides:s}=ce(a),n={props:a,parsedContents:e,countValidSlides:s,Carousel:_e,CarouselControl:U};return Object.defineProperty(n,"__isScriptSetup",{enumerable:!1,value:!0}),n}}),Ce={class:"bg-base-100 relative z-1"},be={class:"container md:w-2/3 mx-auto px-3 py-1"},ge=["innerHTML"],Se={class:"text-xl leading-none text-base-400"};function ye(o,r,a,e,s,n){return u(),p("div",Ce,[I("div",be,[C(e.Carousel,{autoplay:e.countValidSlides>1?7e3:null},{controls:m(()=>[oe(I("div",Se,[C(e.CarouselControl,{direction:-1,class:"pr-2 bg-base-100 hover:text-base-700"}),C(e.CarouselControl,{class:"pl-2 bg-base-100 hover:text-base-700"})],512),[[G,e.countValidSlides>1]])]),default:m(()=>[(u(!0),p(ne,null,re(a.slides,(i,f)=>(u(),p("li",{key:f},[(u(),$(q(i.href?"ALink":"span"),{href:i.href,target:i.target,class:D(["inline-block px-8",i.href?"hover:underline":null])},{default:m(()=>[e.parsedContents[f]?(u(),p("span",{key:0,innerHTML:e.parsedContents[f],class:"prose text-sm text-base-800"},null,8,ge)):se("",!0)]),_:2},1032,["href","target","class"]))]))),128))]),_:1},8,["autoplay"])])])}const Ie=R(xe,[["render",ye]]);export{Ie as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{m as k}from"./modules-info.80ae4e30.js";import{g,c as S}from"./format-money.6f464cee.js";import{c as a,d as M,_ as T,a as i,t as o,b as u,e as h,f as C,n as I,g as L,w as D,r as z,o as l}from"./_plugin-vue_export-helper.6da04e63.js";/* empty css */import"./session-utm.72684b84.js";import"./idle-callback.889bf0ea.js";const j=(n,c)=>{const{type:s,value:t}=c;let r;return t?(s==="percentage"?r=n*((100-t)/100):r=n-t,r>0?r:0):n},E=n=>{const c=a(()=>n.product||{price:n.price||0,base_price:n.basePrice}),s=a(()=>{const{variations:e}=c.value;if(e){const d=g(c.value);for(let v=0;v<e.length;v++)if(g({...c.value,...e[v]})>d)return!0}return!1}),t=a(()=>k.apply_discount.available_extra_discount),r=a(()=>{const e=g(c.value),d=t.value;return d&&(!d.min_amount||e>d.min_amount)?j(e,d):e}),f=a(()=>{if(S(c.value))return c.value.base_price;const e=g(c.value);return e>r.value?e:0}),m=a(()=>n.installmentsOption||k.list_payments.installments_option||{max_number:1}),b=a(()=>{if(m.value.max_number<=1)return 1;const e=m.value.min_installment||5,d=Math.round(r.value/e);return Math.min(d,m.value.max_number)}),y=a(()=>m.value.monthly_interest||0),V=a(()=>{if(b.value>=2){if(!y.value)return r.value/b.value;const e=y.value/100;return r.value*e/(1-(1+e)**-b.value)}return 0}),p=a(()=>{const e=n.discountOption||k.list_payments.discount_option;return e&&(!e.min_amount||e.min_amount<=r.value)&&(!n.isAmountTotal||e.apply_at==="total")?e:{}}),x=a(()=>{const{label:e}=p.value;return e?e.includes(" ")?e:`via ${e}`:""}),O=a(()=>j(r.value,p.value)),_=a(()=>{if(n.loyaltyPointsProgram)return n.loyaltyPointsProgram;const e=k.list_payments.loyalty_points_programs;if(e){const d=Object.keys(e);for(let v=0;v<d.length;v++){const P=e[d[v]];if(P&&P.earn_percentage>0)return P}}return{ratio:0}}),W=a(()=>_.value.min_subtotal_to_earn||0),w=a(()=>_.value.name||""),N=a(()=>_.value.earn_percentage||0),B=a(()=>N.value*_.value.ratio),A=a(()=>B.value>=1?r.value*(B.value/100):0);return{hasVariedPrices:s,salePrice:r,comparePrice:f,installmentsObject:m,installmentsNumber:b,monthlyInterest:y,installmentValue:V,discountObject:p,discountLabel:x,priceWithDiscount:O,pointsProgramObject:_,pointsMinPrice:W,pointsProgramName:w,earnPointsPercentage:N,cashbackPercentage:B,cashbackValue:A}},F=M({__name:"Prices",props:{product:null,price:null,basePrice:null,isAmountTotal:{type:Boolean},installmentsOption:null,discountOption:null,isBig:{type:Boolean},isLiteral:{type:Boolean},hasCashback:{type:Boolean,default:!0},hasPriceOptions:{type:Boolean,default:!0}},setup(n,{expose:c}){c();const s=n,{hasVariedPrices:t,salePrice:r,comparePrice:f,cashbackPercentage:m,cashbackValue:b,installmentsNumber:y,monthlyInterest:V,installmentValue:p,priceWithDiscount:x,discountLabel:O}=E(s),_={props:s,hasVariedPrices:t,salePrice:r,comparePrice:f,cashbackPercentage:m,cashbackValue:b,installmentsNumber:y,monthlyInterest:V,installmentValue:p,priceWithDiscount:x,discountLabel:O};return Object.defineProperty(_,"__isScriptSetup",{enumerable:!1,value:!0}),_}}),R={key:0,class:"text-base-500 mr-1"},q={key:0},G={key:1},H={key:0},J={key:0,class:"relative z-10"},K=["data-tooltip"],Q=h("i",{class:"i-cashback mr-1"},null,-1),U={class:"font-medium"},X=h("small",null," cashback",-1),Y={key:0},Z={key:0},$={key:1},ee={key:2},te={key:0},ne={key:0},ae={key:1};function se(n,c,s,t,r,f){const m=z("Fade");return l(),i("div",{class:I(["text-base-600",s.isBig?"text-lg":null]),"data-prices":""},[t.comparePrice?(l(),i("span",R,[s.isLiteral?(l(),i("small",q,o("De "))):u("",!0),h("s",null,o(n.$money(t.comparePrice)),1),s.isLiteral?(l(),i("small",G,o(" Por"))):u("",!0)])):u("",!0),h("strong",{class:I(["inline-block text-base-800",s.isBig?"text-5xl block":null])},[t.hasVariedPrices?(l(),i("small",H,o("A partir de "))):u("",!0),C(" "+o(n.$money(t.salePrice)),1)],2),L(m,{slide:"down"},{default:D(()=>[t.cashbackValue&&s.hasCashback?(l(),i("div",J,[h("span",{"data-tooltip":"Receba $1 de volta".replace("$1",n.$percentage(t.cashbackPercentage))},[Q,h("span",U,o(n.$money(t.cashbackValue)),1),X],8,K)])):u("",!0)]),_:1}),L(m,{slide:"down"},{default:D(()=>[t.installmentValue&&s.hasPriceOptions?(l(),i("div",Y,[s.isLiteral?(l(),i("small",Z,o("Até "))):u("",!0),C(" "+o(t.installmentsNumber)+"x ",1),s.isLiteral?(l(),i("small",$,o(" De "))):u("",!0),h("span",null,o(n.$money(t.installmentValue)),1),!t.monthlyInterest&&s.isLiteral?(l(),i("small",ee,o("Sem juros"))):u("",!0)])):u("",!0)]),_:1}),L(m,{slide:"down"},{default:D(()=>[t.priceWithDiscount<t.salePrice&&s.hasPriceOptions?(l(),i("div",te,[t.discountLabel?u("",!0):(l(),i("small",ne,o("A partir de "))),h("span",null,o(n.$money(t.priceWithDiscount)),1),t.discountLabel?(l(),i("small",ae,o(` ${t.discountLabel}`),1)):u("",!0)])):u("",!0)]),_:1})],2)}const me=T(F,[["render",se]]);export{me as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import d from"./Prices.a1302bf9.js";import{d as _,_ as u,j as o,k as m,w as a,l as f,o as P,g as r,f as l,t as n}from"./_plugin-vue_export-helper.6da04e63.js";import"./modules-info.80ae4e30.js";import"./session-utm.72684b84.js";import"./idle-callback.889bf0ea.js";import"./format-money.6f464cee.js";/* empty css */const b=_({__name:"ProductCard",props:{as:{default:"div"}},setup(p,{expose:s}){s();const i=o(12),e=o(!1);setTimeout(()=>{i.value=8,e.value=!0},5e3);const c={price:i,isBig:e,Prices:d};return Object.defineProperty(c,"__isScriptSetup",{enumerable:!1,value:!0}),c}});function g(p,s,i,e,c,v){return P(),m(f(i.as),null,{default:a(()=>[r(e.Prices,null,{default:a(({salePrice:t})=>[l(" ProductCard "+n(t),1)]),_:1}),r(e.Prices,{product:{price:e.price}},null,8,["product"]),r(e.Prices,{price:12,"base-price":17}),r(e.Prices,{price:12,"base-price":16,"is-literal":!0}),r(e.Prices,{price:12,"is-big":e.isBig},null,8,["is-big"]),r(e.Prices,{price:14,"base-price":18,"is-big":e.isBig,"is-literal":!0},null,8,["is-big"]),r(e.Prices,{price:12,"base-price":16},{"compare-value":a(({comparePrice:t})=>[l(" x"+n(t),1)]),_:1})]),_:1})}const j=u(b,[["render",g]]);export{j as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as oe,u as ne,p as re,b as ie}from"./index.a500792d.js";import{j as k,c as v,q as C,u as Q,d as L,s as le,_ as P,r as U,o as c,k as $,w as M,a as p,n as x,e as l,p as V,b as I,a3 as ce,g as B,h as ue,l as de,t as E,F as z,C as H,f as me,a4 as he,a5 as pe,a6 as fe}from"./_plugin-vue_export-helper.6da04e63.js";import{w as _e}from"./runtime-dom.esm-bundler.acde10ec.js";import{_ as ge}from"./preload-helper.101896b7.js";import{i as ye}from"./idle-callback.889bf0ea.js";const we=e=>{if(e){if(e.display_name)return e.display_name;if(e.name&&e.name.given_name)return e.name.given_name}return""},ve=we,be=e=>{const{header:s,canSetStyles:t,canCreateHeightDiv:a,isShownOnScrollDown:n}={canSetStyles:!0,canCreateHeightDiv:!0,...e},{ready:r,start:o}=oe(100,{controls:!0,immediate:!1}),i=k(0),u=k(0);let f;const{y:S}=ne(document),m=v(()=>r.value&&S.value>u.value*1.2),h=k("none");C(m,async y=>{t&&(s.value.style.position=y?"sticky":null),f&&(f.style.height=y?`${i.value}px`:null),y?(await re(300),h.value="opacity var(--transition-slow), transform var(--transition)"):(o(),h.value="none")});const A=k(!1);return C(S,(y,d)=>{A.value=y>0&&y<d}),Q(()=>{const y=()=>{i.value=s.value.offsetHeight,u.value=i.value+window.pageYOffset+s.value.getBoundingClientRect().top,o()},d=s.value.getElementsByTagName("IMG");let w=!0;for(let _=0;_<d.length;_++){const T=d[_];(!T.complete||T.naturalHeight===0)&&(w=!1,T.onload=y)}w&&y(),window.addEventListener("resize",ie(y,300)),t&&(s.value.style.willChange="transform",C([m,A],([_,T])=>{let j=null,K=null;_&&(!T||n)&&(j="0",K="translateY(-100%)"),s.value.style.opacity=j,s.value.style.transform=K}),C(h,_=>{s.value.style.transition=_})),a&&(f=document.createElement("div"),s.value.parentElement.insertBefore(f,s.value))}),{staticHeight:i,staticY:u,isSticky:m,isScrollUp:A,transition:h}},Se=e=>e.filter(({slug:s,parent:t})=>s&&!t),ke=(e,s)=>e.filter(({slug:t,parent:a})=>t&&a?a._id===s._id||a.slug&&a.slug===s.slug:!1),xe=e=>{const{header:s}=e,{isSticky:t,staticHeight:a,staticY:n}=be({header:s}),r=v(()=>t.value?s.value.offsetHeight:n.value),o=Se(e.categories),i=m=>ke(e.categories,m),u=m=>({...m,subcategories:i(m).map(h=>u(h))}),f=o.map(u),S=k(!1);return{isSticky:t,staticHeight:a,staticY:n,positionY:r,mainCategories:o,getSubcategories:i,getCategoryTree:u,categoryTrees:f,isSidenavOpen:S}},Te=L({__name:"Drawer",props:{modelValue:{type:Boolean,default:!1},placement:{default:"start"},position:{default:"fixed"},hasCloseButton:{type:Boolean,default:!0}},emits:["update:modelValue"],setup(e,{expose:s,emit:t}){s();const a=e,n=()=>t("update:modelValue",!1),r=k(null),o=h=>{r.value?.contains(h.target)||n()},i=h=>{h.key==="Escape"&&n()};C(le(a,"modelValue"),async h=>{h?(document.body.style.overflow="hidden",setTimeout(()=>{document.addEventListener("click",o,{passive:!0}),document.addEventListener("keydown",i,{passive:!0})},500)):(document.body.style.overflow=null,document.removeEventListener("click",o),document.removeEventListener("keydown",i))});const u=v(()=>{switch(a.placement){case"start":return"left";case"end":return"right";case"top":return"up";default:return"down"}}),f=v(()=>a.position==="fixed"),S=v(()=>a.placement==="start"||a.placement==="end"),m={props:a,emit:t,close:n,drawer:r,outsideClickListener:o,escClickListener:i,slideTo:u,isFixed:f,isPlacementX:S};return Object.defineProperty(m,"__isScriptSetup",{enumerable:!1,value:!0}),m}}),Ce=["open","data-drawer"],Oe={class:"relative h-full"},Ee=["onClick"],Ae=l("i",{class:"i-close text-base-400 text-3xl"},null,-1),Ne={key:0,class:"fixed top-0 left-0 w-screen h-screen bg-black/50 z-40","data-drawer-backdrop":""};function Ie(e,s,t,a,n,r){const o=U("Fade");return c(),$(o,{slide:a.slideTo,speed:"slow","is-floating":""},{default:M(()=>[t.modelValue?(c(),p("dialog",{key:0,ref:"drawer",class:x(["w-screen max-w-sm shadow p-0 m-0 z-50",[t.position,a.isFixed?`top-0 left-0 ${a.isPlacementX?"h-screen":""}`:null]]),open:t.modelValue,"data-drawer":t.placement},[l("div",Oe,[t.hasCloseButton?(c(),p("button",{key:0,type:"button","aria-label":"Fechar",onClick:_e(a.close,["prevent"]),class:x(["absolute top-2",t.placement==="end"?"left-2":"right-2"]),"data-drawer-close":""},[V(e.$slots,"close",{},()=>[Ae])],10,Ee)):I("",!0),V(e.$slots,"default")]),(c(),$(ce,{to:"#teleported-top"},[B(o,null,{default:M(()=>[t.modelValue?(c(),p("div",Ne)):I("",!0)]),_:1})]))],10,Ce)):I("",!0)]),_:3},8,["slide"])}const $e=P(Te,[["render",Ie]]);globalThis.__apiCache||(globalThis.__apiCache={});const N={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0};class q extends Error{constructor(s,t,a,n=!1){t?(super(t.statusText),this.data=t.data,this.statusCode=t.status):super(a||"Request error"),this.config=s,this.response=t,this.isTimeout=n}}const Le={middleware(e){const s={...e.headers};if(!e.isNoAuth)if(e.accessToken)s.Authorization=`Bearer ${e.accessToken}`;else{const r=e.authenticationId||N.ECOM_AUTHENTICATION_ID,o=e.apiKey||N.ECOM_API_KEY;if(r&&o){const i=`${r}:${o}`,u=typeof Buffer=="function"?Buffer.from(i).toString("base64"):btoa(i);s.Authorization=`Basic ${u}`}}let t=e.baseUrl||N.API_BASE_URL||"https://ecomplus.io/v2";const{endpoint:a,params:n}=e;if(a!=="login"&&a!=="authenticate"&&a!=="ask-auth-callback"&&a!=="check-username"){const r=e.storeId||N.ECOM_STORE_ID;if(!r)throw new Error("`storeId` must be set in config or `ECOM_STORE_ID` env var");t+=`/:${r}`;const o=e.lang||N.ECOM_LANG;o&&(t+=`,lang:${o}`)}if(t+=`/${a}`,n){if(typeof n=="string")t+=`?${n}`;else if(typeof n=="object"){const r=new URLSearchParams;Object.keys(n).forEach(o=>{const i=n[o];Array.isArray(i)?i.forEach(u=>{r.append(o,u)}):r.append(o,i)}),t+=`?${r.toString()}`}}return{url:t,headers:s}}},g=async(e,s=0)=>{const{url:t,headers:a}=Le.middleware(e),{method:n="get",timeout:r=2e4,maxRetries:o=3,cacheMaxAge:i=6e5}=e,u=n==="get"&&(e.canCache||e.canCache===void 0&&N.SSR);let f;if(u){f=`${t}${JSON.stringify(a)}`;const w=globalThis.__apiCache[f];if(w&&Date.now()-w.timestamp<=i)return{...w.res,config:e}}const S=e.body||e.data;let m;S&&(m=JSON.stringify(S),a["Content-Type"]="application/json",a["Content-Length"]=m.length.toString());const h=new AbortController;let A=!1;const y=setTimeout(()=>{h.abort(),A=!0},r);let d;try{d=await(e.fetch||fetch)(t,{method:n,headers:a,body:m,signal:h.signal})}catch(w){throw new q(e,d,w.message,A)}if(clearTimeout(y),d){if(d.ok){const _={...d,data:await d.json()};return u&&f&&(globalThis.__apiCache[f]={timestamp:Date.now(),res:_}),{..._,config:e}}const{status:w}=d;if(o<s&&(w===429||w>=500)){const _=d.headers.get("retry-after");return new Promise((T,j)=>{setTimeout(()=>{g(e,s+1).then(T).catch(j)},_&&parseInt(_,10)||5e3)})}}try{d.data=await d?.json()}catch{}throw new q(e,d)},Pe=(e,s)=>g({...s,endpoint:e}),Ve=(e,s,t)=>g({...t,method:"post",endpoint:e,body:s}),Be=(e,s,t)=>g({...t,method:"put",endpoint:e,body:s}),De=(e,s,t)=>g({...t,method:"patch",endpoint:e,body:s}),Z=(e,s)=>g({...s,method:"delete",endpoint:e});g.get=Pe;g.post=Ve;g.put=Be;g.patch=De;g.del=Z;g.delete=Z;const je=(e,s,t=localStorage)=>{let a;const n=t.getItem(e);if(n)try{a=JSON.parse(n)}catch{a=null,t.removeItem(e)}const r=ue(a||s);return C(r,()=>{t.setItem(e,JSON.stringify(r))}),r},ee="SESSION",R={customer:{display_name:"",main_email:""},auth:null},b=je(ee,R),Y=v(()=>{const{auth:e}=b;return e&&new Date(e.expires).getTime()-Date.now()>1e3*10}),te=v(()=>b.customer),F=v(()=>ve(te.value)),G=v({get(){return te.value.main_email},set(e){b.customer.main_email=e}});let O;const Me=v(()=>Y.value||!!O?.currentUser?.emailVerified),ae=()=>{b.auth=R.auth,b.customer=R.customer,localStorage.removeItem(ee),O.signOut()},se=async()=>{const e=await O.currentUser.getIdToken(),{domain:s}=window.storefront.settings;try{const t=await fetch(`https://${s}/api/passport/token`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});b.auth=await t.json()}catch(t){console.error(t)}},ze=async()=>(Y.value||await se(),b.auth.access_token),He=async()=>{const e=await ze(),{data:s}=await g.get(`customers/${b.auth.customer_id}`,{accessToken:e});return b.customer=s,s};let W=!1;const Re=(e=!window.location.pathname.startsWith("/app/"))=>{if(W)return;W=!0;const s=()=>ge(()=>import("./firebase-app.7ce2ebb1.js"),[]).then(({getAuth:t,onAuthStateChanged:a,isSignInWithEmailLink:n,signInWithEmailLink:r})=>{if(O=t(),a(O,async o=>{if(o){if(o.displayName&&!F.value&&(b.customer.display_name=o.displayName),o.email&&(!G.value||o.emailVerified)&&(b.customer.main_email=o.email),o.emailVerified){const i=o.email!==G.value;(i||!Y.value)&&(await se(),(i||!F.value)&&await He())}}else ae()}),n(O,window.location.href)){const i=new URLSearchParams(window.location.search).get("email");i&&r(O,i,window.location.href).then(()=>window.localStorage.removeItem("emailForSignIn")).catch(console.error)}}).catch(console.error);e?ye(s):s()},{settings:X,context:Lt}=globalThis.storefront,Fe=["whatsapp","instagram","facebook","twitter","youtube","tiktok","pinterest"],J={};Fe.forEach(e=>{X[e]&&(J[e]=X[e])});let D;D=navigator.userAgent,document.body?document.body.offsetWidth:window.screen.width;D.includes("Safari")&&D.includes("Chrome");const Ue=/iPad|iPhone|iPod/.test(D)&&!window.MSStream,Ye=Ue||/Android|webOS|BlackBerry|IEMobile|Opera Mini/i.test(D),Je=L({__name:"SocialNetworkIcon",props:{as:{default:"i"},network:null},setup(e,{expose:s}){s();const t=e,a=v(()=>{switch(t.network){case"facebook":return"i-facebook";case"instagram":return"i-instagram";case"whatsapp":return"i-whatsapp";case"youtube":return"i-youtube";case"pinterest":return"i-pinterest";case"tiktok":return"i-tiktok";case"twitter":return"i-twitter";default:return""}}),n={props:t,iconClassName:a};return Object.defineProperty(n,"__isScriptSetup",{enumerable:!1,value:!0}),n}});function Ke(e,s,t,a,n,r){return c(),$(de(t.as),{class:x(a.iconClassName)},null,8,["class"])}const qe=P(Je,[["render",Ke]]),Ge=L({__name:"SocialNetworkLink",props:{network:null,href:null,message:null},setup(e,{expose:s}){s();const t=e,a=v(()=>{let r=t.href||J[t.network];if(t.network==="whatsapp"){const o=r.replace(/[^+\d]/g,"");r=`https://${Ye?"api":"web"}.whatsapp.com/send?phone=`+encodeURIComponent(o.charAt(0)==="+"?o:`+55${o}`),t.message&&(r+=`&text=${encodeURIComponent(t.message)}`)}return r}),n={props:t,fixedHref:a,SocialNetworkIcon:qe};return Object.defineProperty(n,"__isScriptSetup",{enumerable:!1,value:!0}),n}});function We(e,s,t,a,n,r){const o=U("ALink");return c(),$(o,{href:a.fixedHref},{default:M(()=>[V(e.$slots,"default",{},()=>[B(a.SocialNetworkIcon,{network:t.network},null,8,["network"]),V(e.$slots,"append")])]),_:3},8,["href"])}const Xe=P(Ge,[["render",We]]),Qe=L({__name:"ShopSidenavCategory",props:{categoryTree:null},setup(e,{expose:s}){s();const t=k(!1),a=k(!0);C(t,r=>{r?setTimeout(()=>{a.value=!1},25):a.value=!0});const n={isOpen:t,isFaded:a};return Object.defineProperty(n,"__isScriptSetup",{enumerable:!1,value:!0}),n}}),Ze={class:"text-lg text-base-800"},et=["src"],tt=["href"],at=["href"],st=["src"],ot={class:"inline"};function nt(e,s,t,a,n,r){const o=U("ShopSidenavCategory",!0);return c(),p("li",Ze,[t.categoryTree.subcategories.length?(c(),p("details",{key:0,class:"bg-white overflow-y-auto overflow-x-hidden z-10 open:absolute open:top-0 open:left-0 open:w-full open:h-full",onToggle:s[0]||(s[0]=i=>a.isOpen=!a.isOpen)},[l("summary",{class:x(["cursor-pointer list-none px-6 py-3 active:bg-base-100 transition-colors",a.isOpen?"bg-base-100":null])},[l("i",{class:x(a.isOpen?"i-arrow-left text-lg":"i-arrow-right float-right mb-0 mt-1 text-xl text-base-500")},null,2),!a.isOpen&&t.categoryTree.icon?(c(),p("img",{key:0,loading:"lazy",src:t.categoryTree.icon.url,class:"w-auto h-5 inline mr-3"},null,8,et)):I("",!0),l("h3",{class:x(["inline",a.isOpen?"ml-4 text-base":null])},E(t.categoryTree.name),3)],2),l("ul",{class:x(["mt-2 transition-opacity",a.isFaded?"opacity-20":"opacity-100"]),tabindex:"-1"},[(c(!0),p(z,null,H(t.categoryTree.subcategories,i=>(c(),$(o,{key:i._id,"category-tree":i},null,8,["category-tree"]))),128)),l("li",null,[l("a",{href:`/${t.categoryTree.slug}`,class:"block px-6 py-3 text-base underline active:bg-base-200"},E("Ver toda a categoria $1".replace("$1",t.categoryTree.name)),9,tt)])],2)],32)):(c(),p("a",{key:1,href:`/${t.categoryTree.slug}`,class:"block px-6 py-3 active:bg-base-200"},[!a.isOpen&&t.categoryTree.icon?(c(),p("img",{key:0,loading:"lazy",src:t.categoryTree.icon.url,class:"w-auto h-5 inline mr-3"},null,8,st)):I("",!0),l("h3",ot,E(t.categoryTree.name),1)],8,at))])}const rt=P(Qe,[["render",nt]]),it=L({__name:"ShopSidenav",props:{categoryTrees:null},setup(e,{expose:s}){s(),Q(()=>Re());const t={get customerName(){return F},get isLogged(){return Me},get logout(){return ae},get socialNetworks(){return J},SocialNetworkLink:Xe,ShopSidenavCategory:rt};return Object.defineProperty(t,"__isScriptSetup",{enumerable:!1,value:!0}),t}}),lt={class:"flex flex-col h-full"},ct={class:"py-4 grow"},ut={class:"relative h-full"},dt={class:"text-base"},mt={class:"flex items-center px-2 py-4 bg-base-100"},ht={href:"/app/account",class:"p-2 grow flex items-center gap-3"},pt=l("i",{class:"i-account text-4xl text-base-500 m-0"},null,-1),ft={class:"leading-tight"},_t=l("small",{class:"block lowercase font-semibold text-primary"},E("Meus pedidos")+", "+E("Minha conta"),-1),gt=l("span",{class:"text-base-600"},E("Sair"),-1),yt=l("i",{class:"i-logout text-lg ml-1"},null,-1),wt=[gt,yt],vt={class:"flex gap-3 p-4 bg-base-200 text-xl text-base-700"};function bt(e,s,t,a,n,r){return c(),p("aside",lt,[l("nav",ct,[l("ul",ut,[(c(!0),p(z,null,H(t.categoryTrees,o=>(c(),$(a.ShopSidenavCategory,{key:o._id,"category-tree":o},null,8,["category-tree"]))),128))])]),l("footer",dt,[l("div",mt,[l("a",ht,[pt,l("span",ft,[me(E(`Olá ${a.customerName||"Visitante"}`)+" ",1),_t])]),a.isLogged?(c(),p("button",{key:0,onClick:s[0]||(s[0]=(...o)=>a.logout&&a.logout(...o)),class:"p-2 text-right text-base-800"},wt)):I("",!0)]),l("ul",vt,[(c(!0),p(z,null,H(a.socialNetworks,(o,i)=>(c(),p("li",{key:i},[B(a.SocialNetworkLink,{network:i,class:"p-1 active:text-primary"},null,8,["network"])]))),128))])])])}const St=P(it,[["render",bt]]),kt=L({__name:"ShopHeader",props:{categories:null},setup(e,{expose:s}){s();const t=e,a=k(null),{isSticky:n,positionY:r,categoryTrees:o,isSidenavOpen:i}=xe({...t,header:a}),u={props:t,header:a,isSticky:n,positionY:r,categoryTrees:o,isSidenavOpen:i,Drawer:$e,ShopSidenav:St};return Object.defineProperty(u,"__isScriptSetup",{enumerable:!1,value:!0}),u}}),xt={class:"container lg:max-w-7xl mx-auto px-1 lg:pl-3 grid grid-flow-col grid-cols-3 justify-between items-center md:grid-cols-none md:auto-cols-max"},Tt={class:"md:hidden"},Ct=pe('<nav class="hidden md:block"></nav><div class="px-2 flex justify-end items-center gap-3 lg:gap-4 text-base-800"><button aria-label="Buscar produtos"><i class="i-search w-7 h-7 hover:text-primary hover:scale-110 active:scale-125"></i></button><button class="hidden sm:block" aria-label="Minha conta"><i class="i-account w-7 h-7 hover:text-primary hover:scale-110 active:scale-125"></i></button><button aria-label="Abrir carrinho"><i class="i-shopping-cart w-7 h-7 hover:text-primary hover:scale-110 active:scale-125"></i></button></div>',2);function Ot(e,s,t,a,n,r){return c(),p("header",{ref:"header",class:x(["top-0 z-50 transition-colors",[a.isSticky&&!a.isSidenavOpen?"bg-white/80":"bg-white",a.isSticky?"backdrop-blur-md shadow py-2 md:py-3":"py-3 sm:py-4 md:py-5"]])},[l("div",xt,[l("div",Tt,[l("button",{class:"px-2 my-1","aria-label":"Abrir/fechar menu",onClick:s[0]||(s[0]=o=>a.isSidenavOpen=!a.isSidenavOpen)},[l("i",{class:x(["text-base-500 text-3xl",a.isSidenavOpen?"i-close":"i-menu"])},null,2)])]),V(e.$slots,"logo"),Ct]),B(a.Drawer,{modelValue:a.isSidenavOpen,"onUpdate:modelValue":s[1]||(s[1]=o=>a.isSidenavOpen=o),"has-close-button":!1,position:"absolute",class:"mt-3 -z-1",style:he({height:`calc(100vh - ${a.positionY}px + .5rem)`})},{default:M(()=>[B(a.ShopSidenav,fe({class:"bg-white pt-6"},{categoryTrees:a.categoryTrees}),null,16)]),_:1},8,["modelValue","style"])],2)}const Pt=P(kt,[["render",Ot]]);export{Pt as default};
|