@soma-vertical-web/multi-lib 0.0.66 → 0.0.67

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/index2.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react/jsx-runtime"),I=require("./index-CwBIv223.js"),N=require("@soma-vertical-web/core-components"),ne=require("yup"),se=require("sanitize-html");function oe(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const s=oe(ne),ae=({slug:t,data:e,SectionZone:n,COMMON_PAGE_COLUMN_GAP:r,identifyWhoIsFirst:a})=>{const o=e==null?void 0:e.find(p=>{var y,g,m,R;return((g=(y=p.config)==null?void 0:y.responsive)==null?void 0:g.deviceType)==="desktop"&&((R=(m=p.config)==null?void 0:m.seo)==null?void 0:R.slug)===t}),i=o==null?void 0:o.config.responsive.gapCustom,l=o==null?void 0:o.config.responsive.gapSections,c=e==null?void 0:e.find(p=>{var y,g,m,R;return((g=(y=p.config)==null?void 0:y.responsive)==null?void 0:g.deviceType)==="mobile"&&((R=(m=p.config)==null?void 0:m.seo)==null?void 0:R.slug)===t}),d=c==null?void 0:c.config.responsive.gapCustom,u=c==null?void 0:c.config.responsive.gapSections;return f.jsxs(f.Fragment,{children:[f.jsx(N.Utils.Column,{gap:i&&l?l:r,className:N.helpers.classNameConcat(I.responsive["responsive-desktop-flex"],"utils-column-modifier"),children:f.jsx(n,{data:(o==null?void 0:o.sections)??[],identifyWhoIsFirst:a})}),f.jsx(N.Utils.Column,{gap:d&&u?u:r,className:N.helpers.classNameConcat(I.responsive["responsive-mobile-flex"],"utils-column-modifier"),children:f.jsx(n,{data:(c==null?void 0:c.sections)??[],identifyWhoIsFirst:a})})]})},ie=async({slug:t,SectionZone:e,COMMON_PAGE_COLUMN_GAP:n,identifyWhoIsFirst:r=!1,...a})=>{const{data:o}=await I.getContentType({contentType:"common_page",...a});return f.jsx(ae,{data:o,slug:t,SectionZone:e,COMMON_PAGE_COLUMN_GAP:n,identifyWhoIsFirst:r})},ce=async({PAYMENT_FLAGS_DICTIONARY:t,PAYMENT_FLAGS:e,LEGAL_INFORMATION_TEXT:n,SectionZone:r,ICONS:a,Footer:o,FooterSupport:i,...l})=>{var p,y,g,m,R,O,T,E,F,h,v;const{data:c}=await I.getContentType({contentType:"footer",...l}),d=Array.isArray(c)&&((p=c[0])==null?void 0:p.type)==="footer"?c[0]:null,u={...(y=d==null?void 0:d.paymentInfo)==null?void 0:y.paymentInfo,acceptedFlags:Array.isArray((g=d==null?void 0:d.paymentInfo)==null?void 0:g.paymentInfo.acceptedFlags)?(m=d==null?void 0:d.paymentInfo)==null?void 0:m.paymentInfo.acceptedFlags.filter(C=>!!t[C]).map(C=>t[C]):[]};return d?f.jsx(o,{data:{...d},socialInfo:(R=d.socialMedia)==null?void 0:R.socialMedia,socialMedias:(T=(O=d.socialMedia)==null?void 0:O.socialMedia)==null?void 0:T.medias,payments:u,adornment:{...(F=(E=d.supportInfo)==null?void 0:E.supportInfo)!=null&&F.content?{bottom:f.jsx(i,{content:(v=(h=d.supportInfo)==null?void 0:h.supportInfo)==null?void 0:v.content,CONSTANTS:{ICONS:a,PAYMENT_FLAGS:e,PAYMENT_FLAGS_DICTIONARY:t}})}:{},...d.sections.length?{top:f.jsx(r,{data:d.sections})}:{}},LEGAL_INFORMATION_TEXT:n,ICONS:a}):f.jsx(f.Fragment,{})},le=async({children:t,ClientHeaderProvider:e,...n})=>{var o,i,l,c;const{data:r}=await I.getContentType({contentType:"header",...n}),a=(o=r[0])==null?void 0:o.sections.map(d=>d.data);return f.jsx(e,{headerData:{...(i=r[0])==null?void 0:i.layerConfig.config,subMenus:a??[],categories:((l=r[0])==null?void 0:l.categories.categories.items)??[],navigationLinks:((c=r[0])==null?void 0:c.navigationLinks.navigationLinks.items)??[]},children:t})},ue=t=>{var i,l;const e=(l=(i=t[0])==null?void 0:i.items)==null?void 0:l.items;if((e==null?void 0:e.items.length)===0||t.length===0)return{iconLabel:"",label:"",content:[]};const n=e==null?void 0:e.iconLabel,r=e==null?void 0:e.label,a=e==null?void 0:e.helpButtonSize,o=e.items.map((c,d)=>({type:c.type,id:`${d.toString()}-${c.title.toLowerCase()}`,title:c.title,subtitle:c.subtitle,description:c.description,buttonLabel:c.buttonLabel,buttonHref:c.buttonHref,buttonMode:c.buttonMode,buttonSize:c.buttonSize,buttonIcon:c.buttonIcon}));return{iconLabel:n,label:r,helpButtonSize:a,content:o}},de=async({HelpButton:t,ICONS:e,className:n,...r})=>{const{data:a}=await I.getContentType({contentType:"helpbutton",...r});if(!a)return f.jsx(f.Fragment,{});const o=ue(a);return f.jsx(t,{data:o,...r,ICONS:e,className:n})},pe=async({children:t,productId:e,COMMON_PAGE_COLUMN_GAP:n,SectionZone:r,PDPContentProvider:a,...o})=>{const{data:i}=await I.getContentType({contentType:"product_page",...o});return f.jsx(a,{data:i[0],productId:e,COMMON_PAGE_COLUMN_GAP:n,SectionZone:r,children:t})},me={"column-modifier":"_column-modifier_1tqap_1"},ge=async({children:t,slug:e,SectionZone:n,COMMON_PAGE_COLUMN_GAP_PDC:r,PLPContentProvider:a,...o})=>{const{data:i}=await I.getContentType({contentType:"categories_page",...o}),l=i.find(p=>{var y,g,m;return((y=p.config)==null?void 0:y.seo.slug)===e&&((m=(g=p.config)==null?void 0:g.responsive)==null?void 0:m.deviceType)==="desktop"}),c=i.find(p=>{var y,g,m;return((y=p.config)==null?void 0:y.seo.slug)===e&&((m=(g=p.config)==null?void 0:g.responsive)==null?void 0:m.deviceType)==="mobile"}),d=i.find(p=>{var y,g,m;return((y=p.config)==null?void 0:y.seo.slug)==="default"&&((m=(g=p.config)==null?void 0:g.responsive)==null?void 0:m.deviceType)==="desktop"}),u=i.find(p=>{var y,g,m;return((y=p.config)==null?void 0:y.seo.slug)==="default"&&((m=(g=p.config)==null?void 0:g.responsive)==null?void 0:m.deviceType)==="mobile"});return f.jsxs(f.Fragment,{children:[f.jsx(N.Utils.Column,{className:N.helpers.classNameConcat(I.responsive["responsive-desktop-flex"],me["column-modifier"]),style:{minHeight:"100vh"},children:f.jsx(a,{data:l??d,device:"desktop",SectionZone:n,COMMON_PAGE_COLUMN_GAP_PDC:r,children:t})}),f.jsx(N.Utils.Column,{className:I.responsive["responsive-mobile-flex"],children:f.jsx(a,{data:c??u,device:"mobile",SectionZone:n,COMMON_PAGE_COLUMN_GAP_PDC:r,children:t})})]})},fe=async({slug:t,...e})=>{var i,l,c;const{data:n}=await I.getContentType({contentType:"redirect_to_search",...e}),r=((c=(l=(i=n[0])==null?void 0:i.redirectToSearch)==null?void 0:l.redirectToSearch)==null?void 0:c.paths)??[];if(!!!r.length)return{slug:t,query:null,redirect:!1};const o=r.find(d=>{var u,p;return((u=d.path)==null?void 0:u.replace(/\//g,"-").toLowerCase())===t.replace(/\//g,"-").toLowerCase()||((p=d.path)==null?void 0:p.replace(/\//g,"-").toLowerCase())===`/${t}`.replace(/\//g,"-").toLowerCase()});return o?{slug:t,query:o==null?void 0:o.searchQuery,redirect:!0,collectionId:o==null?void 0:o.collectionId,filters:o==null?void 0:o.filters,sort:o==null?void 0:o.sort}:{slug:t,query:null,redirect:!1,collectionId:null,filters:null,sort:null}},he=async({slug:t,...e})=>{var i,l,c;const{data:n}=await I.getContentType({contentType:"redirect_to_search",...e}),r=((c=(l=(i=n[0])==null?void 0:i.redirectToSearch)==null?void 0:l.redirectToSearch)==null?void 0:c.paths)??[];if(!!!r.length)return null;const o=r.find(d=>{var u,p;return((u=d.path)==null?void 0:u.replace(/\//g,"-").toLowerCase())===t.replace(/\//g,"-").toLowerCase()||((p=d.path)==null?void 0:p.replace(/\//g,"-").toLowerCase())===`/${t}`.replace(/\//g,"-").toLowerCase()});return o?{slug:t,title:o.pageTitle,description:o.pageDescription}:null},ye=async({children:t,SectionZone:e,className:n,...r})=>{const{data:a}=await I.getContentType({contentType:"search_page",...r});return Array.isArray(a)&&a.length>0?f.jsx(I.SearchPageScreening,{data:a,SectionZone:e,className:n,children:t}):f.jsx(f.Fragment,{children:t})},be=async({ClientTipbarContent:t,...e})=>{const{data:n}=await I.getContentType({contentType:"tipbar",...e});return f.jsx(t,{data:n})},Ie={CommonPageContent:ie,HeaderContent:le,TipbarContent:be,FooterContent:ce,PLPContent:ge,PDPContent:pe,getRedirectData:fe,getPLPSynteticMetaData:he,SearchPageContent:ye,HelpButtonContent:de},Ce={Components:Ie},b=async(t,e={})=>{const{method:n="GET",body:r,headers:a={},priority:o="auto",cache:i="default"}=e;return fetch(t,{method:n,headers:{...a,Accept:"application/json","Content-Type":"application/json"},priority:o,cache:i,...r?{body:JSON.stringify(r)}:{}}).then(l=>l.json()).catch(l=>{console.error("[ERROR FETCH VTEX]",l)})},w=new Map;async function Re(t,e={}){var n;try{const{abort:r=!1}=e,a=new AbortController;r&&(w.has(t)&&((n=w.get(t))==null||n.abort(),w.delete(t)),w.set(t,a));const o=b(t,{...e,...r?{signal:a.signal}:{}});return r&&w.delete(t),o}catch(r){if(r.name==="AbortError"){console.log(`[REQUEST CANCELLED]: ${t}`);return}throw console.error(`[ERROR API]: ${r.message}`),r}}const ve=s.object({country:s.string().length(3,"Country code must be 3 characters long").required("Country is required"),postalCode:s.string().nullable()});async function Se({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await ve.validate(e);const{country:r,postalCode:a}=e;return await b(`${t}/api/checkout/pub/postal-code/${r}/${a}`,{method:"POST",body:e,...n})}const Te=s.object({orderFormId:s.string().nullable(),sellerCode:s.string().nullable(),sellerName:s.string().nullable()});async function x({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await Te.validate(e);const{orderFormId:r,sellerCode:a,sellerName:o}=e,i=a?`${a.trim()} - ${o}`:null;return b(`${t}/api/checkout/pub/orderForm/${r}/attachments/openTextField`,{method:"POST",body:{value:i},...n})}const Ee=s.object({orderFormId:s.string().nullable(),sellerCode:s.string().nullable(),marketingData:s.object()});async function U({apiUrl:t,body:e,extraData:n={},fetchOptions:r}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await Ee.validate(e);const{orderFormId:a,sellerCode:o,marketingData:i}=e,l=o?{utmCampaign:o?o.toUpperCase():"",utmiCampaign:o?`${n.VENDOR_CODE}`:"semcodigo"}:{};return b(`${t}/api/checkout/pub/orderForm/${a}/attachments/marketingData`,{method:"POST",body:{...i,...l},...r})}const Oe=s.object({orderFormId:s.string().nullable(),sellerCode:s.string().nullable(),sellerName:s.string().nullable()});async function Fe({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await Oe.validate(e);const r=await x({apiUrl:t,body:e,fetchOptions:n});return U({apiUrl:t,body:{...e,marketingData:r==null?void 0:r.marketingData},fetchOptions:n})}const qe=s.object({orderFormId:s.string().nullable(),coupon:s.string().nullable()});async function $e({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await qe.validate(e);const{coupon:r="",orderFormId:a}=e;return b(`${t}/api/checkout/pub/orderForm/${a}/coupons`,{method:"POST",body:{text:r},...n})}const Pe=s.object({appId:s.string().required("App ID is required"),orderFormId:s.string().nullable(),key:s.array().of(s.string())});async function je({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await Pe.validate(e);const{appId:r="faststore",orderFormId:a,key:o}=e;return b(`${t}/api/checkout/pub/orderForm/${a}/customData/${r}/${o}`,{method:"PUT",...n})}const Ne=s.object().shape({name:s.string().required("Attachment name is required"),content:s.object().nullable()});var G;const we=s.object().shape({attachments:(G=s.array().of(Ne))==null?void 0:G.nullable(),id:s.string().required("ID of SKU is required"),index:s.number().integer().nullable(),quantity:s.number().integer().nullable(),seller:s.string().required("Seller is required"),price:s.number().integer()}),Ae=s.object({orderFormId:s.string().required("OrderFormId is required"),orderItems:s.array().of(we)});async function ke({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await Ae.validate(e);const{orderFormId:r,orderItems:a}=e;return b(`${t}/api/checkout/pub/orderForm/${r}/items`,{method:"POST",body:{orderItems:a},...n})}const De=s.object({orderFormId:s.string().nullable()});async function _e({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await De.validate(e);const{orderFormId:r}=e;return b(`${t}/api/checkout/pub/orderForm/${r}/items/removeAll`,{method:"POST",...n})}const He=s.object().shape({name:s.string().required("Attachment name is required"),content:s.object().nullable()});var M;const Be=s.object().shape({attachments:(M=s.array().of(He))==null?void 0:M.nullable(),id:s.string().required("ID of SKU is required"),index:s.number().integer().nullable(),quantity:s.number().integer().nullable(),seller:s.string().required("Seller is required"),price:s.number().integer()}),Le=s.object({orderFormId:s.string().nullable(),orderItems:s.array().of(Be)});async function Ge({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await Le.validate(e);const{orderFormId:r,orderItems:a}=e;return b(`${t}/api/checkout/pub/orderForm/${r}/items/update`,{method:"POST",body:{orderItems:a},...n})}const Me=s.object({orderFormId:s.string().nullable()});async function xe({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await Me.validate(e);const{orderFormId:r}=e;return b(`${t}/api/checkout/pub/orderForm/${r}/messages/clear`,{method:"POST",...n})}const Ue=s.object({id:s.string().nullable(),itemIndex:s.number().nullable(),orderFormId:s.string().nullable(),remove:s.boolean().nullable()});async function Ve({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await Ue.validate(e);const{itemIndex:r,orderFormId:a,id:o,remove:i}=e,l=i?`/${o}/remove`:"",c=`${t}/api/checkout/pub/orderForm/${a}/items/${r}/offerings${l}`;return b(c,{method:"POST",body:{id:o},...n})}const ze=s.object({orderFormId:s.string().nullable()});async function Qe({apiUrl:t,body:e,fetchOptions:n,extraData:r}){var i;if(!e){console.error("[ERROR FETCHING] Body is required");return}await ze.validate(e);const a=new URLSearchParams({refreshOutdatedData:"true"}),o=e.orderFormId&&((i=r.orderFormPurchaseId)==null?void 0:i.value)!==e.orderFormId?`${t}/api/checkout/pub/orderForm/${e.orderFormId}?${String(a)}`:`${t}/api/checkout/pub/orderForm`;return b(o,{method:"GET",...n})}const Ke=s.object({orderFormId:s.string().nullable(),email:s.string().email().required(),firstName:s.string().required(),lastName:s.string().required(),documentType:s.string().required(),document:s.string().required(),phone:s.string().matches(/^\+\d{1,3}\d{10,11}$/)});async function Je({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await Ke.validate(e);const{orderFormId:r,...a}=e;return b(`${t}/api/checkout/pub/orderForm/${r}/attachments/clientProfileData`,{method:"POST",body:{...a},...n})}const Ye=s.object({sellerCode:s.string().nullable()});async function We({apiUrl:t,body:e,extraData:n,fetchOptions:r}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await Ye.validate(e);const{sellerCode:a=""}=e;return b(`${t}/api/dataentities/${n.ENTITIES}/search?_fields=${n.FIELDS}&${n.FILTER}=${a}`,{method:"GET",headers:{Accept:"application/vnd.vtex.ds.v10+json"},...r})}const Xe=s.object().shape({country:s.string().length(3,"Country code must be 3 characters long").required("Country is required"),orderFormId:s.string().nullable(),postalCode:s.string().nullable()});async function Ze({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await Xe.validate(e);const{country:r,orderFormId:a,postalCode:o}=e,i=o?{address:{addressType:"residential",postalCode:o,country:r}}:{logisticsInfo:[],clearAddressIfPostalCodeNotFound:!0};return b(`${t}/api/checkout/pub/orderForm/${a}/attachments/shippingData`,{method:"POST",body:i,...n})}const et=s.object().shape({orderFormId:s.string().nullable(),options:s.array().of(s.object().shape({itemIndex:s.number(),selectedDeliveryChannel:s.string(),selectedSla:s.string()})),selectedAddresses:s.array().of(s.object().shape({addressId:s.string().required(),addressType:s.string().required(),city:s.string().nullable(),complement:s.string().nullable(),country:s.string().required().length(3),geoCoordinates:s.array().of(s.number()).required().min(0),isDisposable:s.boolean().required(),neighborhood:s.string().nullable(),number:s.string().nullable(),postalCode:s.string().required(),receiverName:s.string().nullable(),reference:s.string().nullable(),state:s.string().nullable(),street:s.string().nullable()}))});async function tt({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await et.validate(e);const{orderFormId:r,options:a,selectedAddresses:o}=e;return b(`${t}/api/checkout/pub/orderForm/${r}/attachments/shippingData`,{method:"POST",body:{selectedAddresses:o,clearAddressIfPostalCodeNotFound:!1,logisticsInfo:a},...n})}const rt=s.object({country:s.string().length(3,"Country code must be 3 characters long").required("Country is required"),postalCode:s.string().nullable(),geoCoordinates:s.object().shape({longitude:s.number().required(),latitude:s.number().required()})});async function nt({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await rt.validate(e);const{country:r="",geoCoordinates:a,postalCode:o=""}=e,i=new URLSearchParams({country:String(r)});return o?i.append("postalCode",o):i.append("geoCoordinates",`${a==null?void 0:a.longitude};${a==null?void 0:a.latitude}`),await b(`${t}/api/checkout/pub/regions/?${i.toString()}`,{method:"GET",...n})}const st=s.object({id:s.string().required("ID of SKU is required"),quantity:s.number().integer().required("Quantity of item is required"),seller:s.string()}),ot=s.object({items:s.array().of(st),country:s.string().length(3,"Country code must be 3 characters long").required("Country is required"),postalCode:s.string().nullable(),geoCoordinates:s.array().nullable().of(s.number()).length(2)});async function at({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}return await ot.validate(e),b(`${t}/api/checkout/pub/orderForms/simulation`,{method:"POST",body:e,...n})}const it=Object.freeze(Object.defineProperty({__proto__:null,getMasterDataSellerCode:We,getOrderForm:Qe,postOrderFormAddCoupon:$e,postOrderFormAttachClientProfileData:Je,postOrderFormAttachOrderFormData:Fe,postOrderFormAttachShippingData:Ze,postOrderFormAttachmentsMarketingData:U,postOrderFormAttachmentsOpenTextField:x,postOrderFormClearMessages:xe,postOrderFormFreightSimulation:at,postOrderFormItems:ke,postOrderFormRegion:nt,postOrderFormRemoveAllItems:_e,postOrderFormUpdateItems:Ge,postOrderFormUpdateShippingData:tt,postOrderformAddress:Se,putOrderFormCustomData:je,updateOrderFormOffering:Ve},Symbol.toStringTag,{value:"Module"})),ct=s.object({skuId:s.string()});async function lt({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await ct.validate(e);const{skuId:r}=e;return b(`${t}/api/catalog/pvt/stockkeepingunitkit?parentSkuId=${r}`,{...n})}const ut=s.object({ids:s.array().of(s.string().required("ID are required")).required("IDs are required")});async function dt({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await ut.validate(e);const{ids:r}=e;return b(`${t}/api/catalog_system/pub/products/search?fq=${r.map(a=>`productId:${a}`).join("&fq=")}`,{...n})}const pt=s.object({productId:s.number().required("Product ID is required")});async function mt({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await pt.validate(e);const{productId:r}=e;return b(`${t}/api/catalog_system/pub/products/crossselling/similars/${r.toString()}`,{...n})}const gt=Object.freeze(Object.defineProperty({__proto__:null,getCatalogKitProducts:lt,getCatalogProducts:dt,getCatalogSimilars:mt},Symbol.toStringTag,{value:"Module"})),ft=s.object({query:s.string()});async function ht({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await ft.validate(e);const{query:r=""}=e,a=new URLSearchParams({query:r});return b(`${t}/api/io/_v/api/intelligent-search/autocomplete_suggestions?${a.toString()}`,{...n})}const yt=(t,e)=>se(t,e),bt=t=>({...t,description:t.description?yt(t.description):t.description}),It=({offer:t,seller:e,product:n})=>({...t,product:n,seller:e}),V=(t,e)=>({...t,isVariantOf:bt(e)}),Ct=t=>t?"https://schema.org/InStock":"https://schema.org/OutOfStock",A=t=>t.AvailableQuantity>0,H=t=>t.spotPrice??0,Rt=t=>t.Price??0,z=(t,e)=>A(t)&&!A(e)?-1:!A(t)&&A(e)?1:H(t)-H(e),vt=(t,e)=>{let n=0;for(let r=1;r<t.length;r++)e(t[n],t[r])>0&&(n=r);return t[n]},Q=t=>{const e=t.flatMap(r=>r.sellers.map(a=>({offer:a.commertialOffer,sku:r}))),n=vt(e,({offer:r},{offer:a})=>z(r,a));return n?n.sku:t[0]},K=t=>t.map(({imageUrl:e,imageText:n,imageLabel:r})=>({alternateName:n??"",url:e.replace("vteximg.com.br","vtexassets.com"),keywords:r})),k={attachment:"ATTACHMENT",specification:"SPECIFICATION",attribute:"ATTRIBUTE"},St=t=>({name:t.name,value:t.content,valueReference:k.attachment}),Tt=t=>({propertyID:t.id,name:t.name,value:t.value,valueReference:{valueReference:k.attribute,visible:t.visible}}),D=(t,e,n)=>{const r=t.flatMap(({name:i,values:l})=>l?l.map(c=>({name:i,value:c,valueReference:k.specification})):{name:i,value:"",valueReference:k.specification}),a=Array.isArray(n)?n.map(St):[],o=e?e.map(Tt):[];return[...r,...a,...o]},B="ÁÄÂÀÃÅČÇĆĎÉĚËÈÊẼĔȆÍÌÎÏŇÑÓÖÒÔÕØŘŔŠŤÚŮÜÙÛÝŸŽáäâàãåčçćďéěëèêẽĕȇíìîïňñóöòôõøðřŕšťúůüùûýÿžþÞĐđ߯a",Et="AAAAAACCCDEEEEEEEEIIIINNOOOOOORRSTUUUUUYYZaaaaaacccdeeeeeeeeiiiinnooooooorrstuuuuuyyzbBDdBAa",Ot=t=>{let e=t.slice(0);for(let n=0;n<B.length;n++)e=e.replace(new RegExp(B.charAt(n),"g"),Et.charAt(n));return e},Ft=t=>t.replace(/[·/_,:]/,"-"),J=t=>{const n=t.replace(/,/g,"").replace(/[*+~.()'"!:@&\[\]`/ %$#?{}|><=_^]/g,"-");return Ft(Ot(n)).toLowerCase()},Y=t=>`/${t}/p`,W=t=>{const e=Math.max(...t.map(r=>r.NumberOfInstallments)),n=t.find(r=>r.NumberOfInstallments===e);return{count:(n==null?void 0:n.NumberOfInstallments)??0,value:(n==null?void 0:n.Value)??0}},X=(t,e)=>{const n={price:0,listPrice:0,sellerDefault:!1},a=t.map(o=>It({offer:o.commertialOffer,seller:o,product:e})).sort(z).map(o=>(o.seller.sellerId==="1"&&o.AvailableQuantity>0&&(n.price=o.Price,n.listPrice=o.ListPrice,n.sellerDefault=!0),{availability:o.AvailableQuantity>0,listPrice:o.ListPrice,price:Rt(o),priceValidUntil:o.PriceValidUntil,priceCurrency:"BRL",installments:o.Installments,lowPrice:o.spotPrice,quantity:o.AvailableQuantity,seller:{identifier:o.seller.sellerId}}));return{lowPrice:n.sellerDefault?n.price:a[0].price,highPrice:n.sellerDefault?n.listPrice:a[0].listPrice,offers:a}},Z=t=>{const{attributes:e,itemId:n,name:r,sellers:a,variations:o}=t;return{additionalProperty:D(o,e,[]),name:r,offers:{offers:a==null?void 0:a.map(({sellerId:i,commertialOffer:l})=>({availability:Ct(l.AvailableQuantity>0),listPrice:l.ListPrice,price:l.Price,quantity:l.AvailableQuantity,seller:{identifier:i}}))},sku:n}},qt=t=>{var S;const{attributes:e,referenceId:n,isVariantOf:r,images:a,itemId:o,name:i,sellers:l,videos:c,variations:d}=t,{brand:u,categories:p,categoriesIds:y,description:g,linkText:m,productClusters:R,clusterHighlights:O,productName:T,properties:E,productId:F,productReference:h}=r,v=p.slice().reverse(),C=X(l,t.isVariantOf),q=W(C.offers[0].installments);return{sku:o,gtin:((S=n==null?void 0:n[0])==null?void 0:S.Value)??h??"",name:T??i,description:g,releaseDate:r.releaseDate??"",slug:m,video:c[0],categories:p,categoriesIds:y,id:F,brand:{name:u,brandName:u},seo:{description:g,title:T,canonical:Y(m)},cluster:{generals:R,highlights:O},properties:E,availability:{status:C.offers[0].availability},breadcrumbList:{itemListElement:[...v.map((P,j)=>{const $=P.split("/"),_=$[$.length-2],re=$.map(J).join("/");return{name:_,item:re,position:j+1}}),{name:r.productName,item:m,position:p.length+1}],numberOfItems:p.length},image:K(a),offers:C,additionalProperty:D(d,e,[]),isVariantOf:{productGroupID:r.productId,hasVariant:r.items.map(P=>Z(P))},installments:q}},$t=t=>{var q;const{attributes:e,referenceId:n,isVariantOf:r,images:a,itemId:o,name:i,sellers:l,Videos:c,variations:d}=t,{brand:u,categories:p,categoriesIds:y,description:g,linkText:m,productClusters:R,productName:O,Coleção:T,"ID Coleção":E,productId:F}=r,h=p.slice().reverse(),v=X(l,t.isVariantOf),C=W(v.offers[0].installments);return{sku:o,gtin:((q=n[0])==null?void 0:q.Value)??"",name:O??i,description:g,releaseDate:r.releaseDate??"",slug:m,video:c[0],categories:p,categoriesIds:y,collection:T,collectionId:E,id:F,brand:{name:u,brandName:u},seo:{description:g,title:O,canonical:Y(m)},cluster:{generals:R,highlights:[]},availability:{status:v.offers[0].availability},breadcrumbList:{itemListElement:[...h.map((S,P)=>{const j=S.split("/"),$=j[j.length-2],_=j.map(J).join("/");return{name:$,item:_,position:P+1}}),{name:r.productName,item:m,position:p.length+1}],numberOfItems:p.length},image:K(a),offers:v,additionalProperty:D(d,e,[]),isVariantOf:{productGroupID:r.productId,hasVariant:r.items.map(S=>{const{variations:P}=S,j=P.map($=>({name:$,values:S[$]}));return{...Z(S),additionalProperty:D(j,e,[])}})},installments:C}},Pt=s.array().of(s.object({key:s.string().required(),value:s.string().required()})).required("Facets are required");async function jt({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await Pt.validate(e);const r=new URLSearchParams({}),a=e.map(({key:i,value:l})=>`${i}/${l}`).join("/");I.addSearchParamsFacets(e,r);const o=`${t}/api/catalog_system/pub/products/crossselling/${a}`;return b(o,{cache:"no-store",...n}).then(i=>i.map(c=>{const d=Q(c.items);return d&&V(d,c)}).filter(c=>!!c).map(c=>({node:$t(c)})))}const ee=({apiUrl:t,body:e,fetchOptions:n,extraData:r})=>{if(!e){console.error("[ERROR FETCHING] Body is required");return}const{query:a="",page:o=1,count:i,sort:l="",facets:c=[],type:d,hideUnavailableItems:u=!0,locale:p=""}=e,y=new URLSearchParams({page:o.toString(),count:(i==null?void 0:i.toString())??(r==null?void 0:r.ITEMS_PER_PAGE)??24,query:a,sort:l,locale:p});u!==void 0&&y.append("hideUnavailableItems",u.toString());const g=c.map(m=>`${m.key}/${m.value}`).join("/")??"";return Re(`${t}/api/io/_v/api/intelligent-search/${d}/${g}?${y.toString()}`,{headers:{Accept:"application/json","content-type":"application/json"},...n})};async function Nt({body:t,extraData:e,...n}){if(!t){console.error("[ERROR FETCHING] Body is required");return}const r=await ee({body:{...t,type:"product_search"},extraData:e,...n}),a=(r==null?void 0:r.products.map(l=>{const c=Q(l.items);return c&&V(c,l)}).filter(l=>!!l))??[],{pagination:o,recordsFiltered:i}=r;return{data:{pagination:{nextPage:o.after.length>0,previousPage:o.before.length>0,startCursor:"0",endCursor:i.toString(),count:i,total:o.count},products:a.map((l,c)=>({node:qt(l),cursor:c.toString()}))}}}async function wt({body:t,extraData:e,...n}){if(!t){console.error("[ERROR FETCHING] Body is required");return}const r=await ee({body:{...t,type:"facets"},extraData:e,...n});return!r||!r.facets?(console.error("[ERROR FETCHING] No facets found"),{data:{facets:[]}}):{data:{...r,facets:I.formattedFacets(r,t==null?void 0:t.selectedFacets,(t==null?void 0:t.query)??"")}}}const At=s.object({query:s.string().optional(),locale:s.string().optional()});async function kt({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await At.validate(e);const{query:r="",locale:a="default_locale"}=e,o=new URLSearchParams({query:r,locale:a});return b(`${t}/api/io/_v/api/intelligent-search/search_suggestions?${o.toString()}`,{...n})}async function Dt({apiUrl:t}){return b(`${t}/api/io/_v/api/intelligent-search/top_searches`)}const _t=Object.freeze(Object.defineProperty({__proto__:null,getSearchAutoCompleteSuggestions:ht,getSearchCrossellingProducts:jt,getSearchFacets:wt,getSearchProducts:Nt,getSearchSuggestedTerms:kt,getSearchTopSearchs:Dt},Symbol.toStringTag,{value:"Module"})),Ht=s.object({masterDataEntity:s.string().nonNullable(),payload:s.object().shape({}).nullable()});async function Bt({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await Ht.validate(e);const{masterDataEntity:r,payload:a}=e,o=`${t}/api/dataentities/${r}/documents`;return b(o,{method:"POST",body:{payload:a},...n})}const Lt=s.object().shape({_where:s.string().optional(),_fields:s.string().optional(),_sort:s.string().optional(),_from:s.number().integer().min(0).optional(),_to:s.number().integer().min(0).optional(),_keyword:s.string().optional()}),Gt=s.object({masterDataEntity:s.string().required(),searchFields:Lt,headers:s.object().shape({"REST-Range":s.string().notRequired()})});async function Mt({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}const r=new URLSearchParams;await Gt.validate(e);const{masterDataEntity:a,searchFields:o,headers:i}=e;o&&Object.entries(o).forEach(([c,d])=>{r.append(c,String(d))}),"_fields"in o||r==null||r.append("_fields","_all");const l=`${t}/api/dataentities/${a}/search?${r.toString()}`;return b(l,{headers:{"REST-Range":i["REST-Range"]??"resources=0-20"},method:"GET",...n})}const xt=s.object({dataEntityName:s.string().required(),id:s.string().required(),fieldsToBeUpdated:s.object().shape({})});async function Ut({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await xt.validate(e);const{dataEntityName:r,id:a,fieldsToBeUpdated:o}=e,i=`${t}/api/dataentities/${r}/documents/${a}`;return b(i,{body:{fieldsToBeUpdated:o},method:"PATCH",...n})}const Vt=Object.freeze(Object.defineProperty({__proto__:null,getSearchMasterdata:Mt,patchUpdateMasterdata:Ut,postMasterdata:Bt},Symbol.toStringTag,{value:"Module"}));async function zt({body:t,apiUrl:e,extraData:n,fetchOptions:r}){const{productIds:a}=t;if(!a)return console.error("[ERROR FETCHING] productIds is required"),[];const{NAME_SPLIT_SYMBOL:o}=n;if(!o)return console.error("[ERROR FETCHING] NAME_SPLIT_SYMBOL is required"),[];const i=a.map(u=>typeof u=="string"||typeof u=="number"?`productId:${u}`:"").join("&fq="),l=await b(`${e}/api/catalog_system/pub/products/search?fq=${i}`,{...r}),c=u=>Object.keys(u).map(p=>({id:p,name:u[p]}));return l.map((u,p)=>{var F;const{installments:y,price:g,listPrice:m,sizes:R,allSizesAvailable:O}=I.getSkuInfos({items:u.items,NAME_SPLIT_SYMBOL:o}),T=O?!0:R.some(h=>h.available),E=u.items[0].sellers[0].commertialOffer;return{node:{sku:u.items[0].itemId,gtin:u.productReference,name:u.productName,description:u.description,releaseDate:u.releaseDate,slug:u.linkText,categories:u.categories,categoriesIds:u.categoriesIds,id:u.items[0].itemId,brand:{name:u.brand,brandName:u.brand},seo:{description:u.description,title:u.productName,canonical:`/${u.linkText}/p`},cluster:{generals:c(u.productClusters),highlights:c(u.clusterHighlights)},availability:{status:T},image:u.items[0].images.map(({imageLabel:h,imageUrl:v})=>({alternateName:h,url:v,keywords:h})),offers:{lowPrice:g,highPrice:m,offers:[{availability:T,listPrice:m,price:g,priceValidUntil:E.PriceValidUntil,priceCurrency:"BRL",installments:E.Installments,lowPrice:g,quantity:E.AvailableQuantity,seller:{identifier:u.items[0].sellers[0].sellerId}}]},additionalProperty:(F=u==null?void 0:u.skuSpecifications)==null?void 0:F.map(h=>({name:u==null?void 0:u.skuSpecifications[0].field.name,value:h,valueReference:"SPECIFICATION"})),isVariantOf:{productGroupID:u.productId,hasVariant:u.items.map(h=>{var v;return{additionalProperty:h==null?void 0:h.variations.map(()=>{var C,q,S;return{name:(C=h==null?void 0:h.variations)==null?void 0:C[0],value:(S=h==null?void 0:h[(q=h==null?void 0:h.variations)==null?void 0:q[0]])==null?void 0:S[0],valueReference:"SPECIFICATION"}}),name:h.name,offers:{offers:(v=h.sellers)==null?void 0:v.map(({commertialOffer:C,sellerId:q})=>({availability:"https://schema.org/InStock",listPrice:C.ListPrice,price:C.Price,quantity:C.AvailableQuantity,seller:{identifier:q}}))},sku:h.itemId,slug:`-${h.itemId}`}})},installments:y},cursor:p.toString()}})}const Qt=Object.freeze(Object.defineProperty({__proto__:null,getWishlistProducts:zt},Symbol.toStringTag,{value:"Module"})),Kt=(t="")=>t.charAt(0).toUpperCase()+t.slice(1),L=(t,e=" ")=>!t||typeof t=="string"&&t.length===0?t:(Array.isArray(t)?t:t.split("-")).map(Kt).join(e),Jt=({canonical:t,seo:e,slug:n})=>{const r=Array.isArray(n)?n.join(", "):n;return{id:0,Title:`${Array.isArray(n)?n.map(o=>L(o)).join(","):L(n)} - ${e.title}`,MetaTagDescription:e.description,name:r,hasChildren:!1,url:t,children:[]}},Yt=({canonical:t,category:e,previousImages:n,seo:r})=>({category:String(e==null?void 0:e.id),title:(e==null?void 0:e.Title)??r.title,description:(e==null?void 0:e.MetaTagDescription)??r.description,alternates:{canonical:t},openGraph:{type:"website",title:(e==null?void 0:e.Title)??r.title,description:(e==null?void 0:e.MetaTagDescription)??r.description,images:Array.isArray(n)?[...n]:[]}}),Wt=({items:t,parent:e,apiUrl:n,find:r})=>{const a=t.find(i=>i.url.replace(n,"")===decodeURIComponent(e.toLowerCase()));return(a==null?void 0:a.children.find(i=>i.name.toLowerCase()===decodeURIComponent(String(r))))??a},Xt=t=>{t instanceof Error?(console.error(`[ERROR CATEGORY INFO]: ${t.message}`),console.error(t.stack)):console.error("[ERROR CATEGORY INFO]: Unknown error",t)},Zt=new Set(["brand","category","department","subcategory","collection","cluster"]),er=t=>typeof(t==null?void 0:t.pageType)=="string"&&Zt.has(t==null?void 0:t.pageType.toLowerCase()),tr=t=>({collection:t.Coleção,categoryId:t.categoryId,current_collection:t["Coleção Atual"],items:t.items}),te=(t,e)=>t.reduce((n,r)=>{if(r.items.filter(i=>i.sellers.find(l=>l.commertialOffer.IsAvailable)).length===0||(n==null?void 0:n.find(i=>(i==null?void 0:i.productId)===(r==null?void 0:r.productId)))!==void 0)return n;const o=r.items[0].images.find(i=>e.includes(i.imageLabel));return n.push({slug:`/${r.linkText}/p`,productId:r==null?void 0:r.productId,textureImage:(o==null?void 0:o.imageUrl)??"",textureAlt:(o==null?void 0:o.imageText)??""}),n},[]),rr=Object.freeze(Object.defineProperty({__proto__:null,createEmptySeoCategory:Jt,createSeoCategory:Yt,findCategory:Wt,formattedSimilars:te,isCollectionPageType:er,notFindCategoryError:Xt,responseAdapter:tr},Symbol.toStringTag,{value:"Module"})),nr={parseSearchState:I.parseSearchState,convertSearchParams:I.convertSearchParams,filterNonRootFacets:I.filterNonRootFacets,filterNonCategorySelected:I.filterNonCategorySelected},sr=async({children:t,apiUrl:e,productId:n,ClientItems:r,PDP_INFO:a,TEXTURE_IMAGE:o,TOGGLE_STYLE_MODIFIER:i})=>{const l=await fetch(`${e}/api/catalog_system/pub/products/crossselling/similars/${n.toString()}`).then(d=>d.json()),c=te(l,o);return f.jsxs("div",{className:I.styles.similars,children:[f.jsxs("div",{className:I.styles["similars-info"],children:[f.jsx("span",{className:I.styles["sections-title"],children:a.product.color_title}),t]}),f.jsx(r,{productId:n,similars:c,TOGGLE_STYLE_MODIFIER:i})]})},or={checkout:it,catalog:gt,cms:I.cms,search:_t,masterdata:Vt,wishlist:{...Qt}},ar={catalog:rr,search:nr,product:I.productHelpers},ir={template:{pdp:{PDPSimilars:sr}}};exports.serverAPIs=or;exports.serverCMS=Ce;exports.serverComponents=ir;exports.serverHelpers=ar;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react/jsx-runtime"),I=require("./index-CwBIv223.js"),N=require("@soma-vertical-web/core-components"),ne=require("yup"),se=require("sanitize-html");function oe(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const s=oe(ne),ae=({slug:t,data:e,SectionZone:n,COMMON_PAGE_COLUMN_GAP:r,identifyWhoIsFirst:a})=>{const o=e==null?void 0:e.find(p=>{var y,g,m,R;return((g=(y=p.config)==null?void 0:y.responsive)==null?void 0:g.deviceType)==="desktop"&&((R=(m=p.config)==null?void 0:m.seo)==null?void 0:R.slug)===t}),i=o==null?void 0:o.config.responsive.gapCustom,l=o==null?void 0:o.config.responsive.gapSections,c=e==null?void 0:e.find(p=>{var y,g,m,R;return((g=(y=p.config)==null?void 0:y.responsive)==null?void 0:g.deviceType)==="mobile"&&((R=(m=p.config)==null?void 0:m.seo)==null?void 0:R.slug)===t}),d=c==null?void 0:c.config.responsive.gapCustom,u=c==null?void 0:c.config.responsive.gapSections;return f.jsxs(f.Fragment,{children:[f.jsx(N.Utils.Column,{gap:i&&l?l:r,className:N.helpers.classNameConcat(I.responsive["responsive-desktop-flex"],"utils-column-modifier"),children:f.jsx(n,{data:(o==null?void 0:o.sections)??[],identifyWhoIsFirst:a})}),f.jsx(N.Utils.Column,{gap:d&&u?u:r,className:N.helpers.classNameConcat(I.responsive["responsive-mobile-flex"],"utils-column-modifier"),children:f.jsx(n,{data:(c==null?void 0:c.sections)??[],identifyWhoIsFirst:a})})]})},ie=async({slug:t,SectionZone:e,COMMON_PAGE_COLUMN_GAP:n,identifyWhoIsFirst:r=!1,...a})=>{const{data:o}=await I.getContentType({contentType:"common_page",...a});return f.jsx(ae,{data:o,slug:t,SectionZone:e,COMMON_PAGE_COLUMN_GAP:n,identifyWhoIsFirst:r})},ce=async({PAYMENT_FLAGS_DICTIONARY:t,PAYMENT_FLAGS:e,LEGAL_INFORMATION_TEXT:n,SectionZone:r,ICONS:a,Footer:o,FooterSupport:i,...l})=>{var p,y,g,m,R,O,T,E,F,h,v;const{data:c}=await I.getContentType({contentType:"footer",...l}),d=Array.isArray(c)&&((p=c[0])==null?void 0:p.type)==="footer"?c[0]:null,u={...(y=d==null?void 0:d.paymentInfo)==null?void 0:y.paymentInfo,acceptedFlags:Array.isArray((g=d==null?void 0:d.paymentInfo)==null?void 0:g.paymentInfo.acceptedFlags)?(m=d==null?void 0:d.paymentInfo)==null?void 0:m.paymentInfo.acceptedFlags.filter(C=>!!t[C]).map(C=>t[C]):[]};return d?f.jsx(o,{data:{...d},socialInfo:(R=d.socialMedia)==null?void 0:R.socialMedia,socialMedias:(T=(O=d.socialMedia)==null?void 0:O.socialMedia)==null?void 0:T.medias,payments:u,adornment:{...(F=(E=d.supportInfo)==null?void 0:E.supportInfo)!=null&&F.content?{bottom:f.jsx(i,{content:(v=(h=d.supportInfo)==null?void 0:h.supportInfo)==null?void 0:v.content,CONSTANTS:{ICONS:a,PAYMENT_FLAGS:e,PAYMENT_FLAGS_DICTIONARY:t}})}:{},...d.sections.length?{top:f.jsx(r,{data:d.sections})}:{}},LEGAL_INFORMATION_TEXT:n,ICONS:a}):f.jsx(f.Fragment,{})},le=async({children:t,ClientHeaderProvider:e,...n})=>{var o,i,l,c;const{data:r}=await I.getContentType({contentType:"header",...n}),a=(o=r[0])==null?void 0:o.sections.map(d=>d.data);return f.jsx(e,{headerData:{...(i=r[0])==null?void 0:i.layerConfig.config,subMenus:a??[],categories:((l=r[0])==null?void 0:l.categories.categories.items)??[],navigationLinks:((c=r[0])==null?void 0:c.navigationLinks.navigationLinks.items)??[]},children:t})},ue=t=>{var i,l;const e=(l=(i=t[0])==null?void 0:i.items)==null?void 0:l.items;if((e==null?void 0:e.items.length)===0||t.length===0)return{iconLabel:"",label:"",content:[]};const n=e==null?void 0:e.iconLabel,r=e==null?void 0:e.label,a=e==null?void 0:e.helpButtonSize,o=e.items.map((c,d)=>({type:c.type,id:`${d.toString()}-${c.title.toLowerCase()}`,title:c.title,subtitle:c.subtitle,description:c.description,buttonLabel:c.buttonLabel,buttonHref:c.buttonHref,buttonMode:c.buttonMode,buttonSize:c.buttonSize,buttonIcon:c.buttonIcon}));return{iconLabel:n,label:r,helpButtonSize:a,content:o}},de=async({HelpButton:t,ICONS:e,className:n,...r})=>{const{data:a}=await I.getContentType({contentType:"helpbutton",...r});if(!a)return f.jsx(f.Fragment,{});const o=ue(a);return f.jsx(t,{data:o,ICONS:e,className:n})},pe=async({children:t,productId:e,COMMON_PAGE_COLUMN_GAP:n,SectionZone:r,PDPContentProvider:a,...o})=>{const{data:i}=await I.getContentType({contentType:"product_page",...o});return f.jsx(a,{data:i[0],productId:e,COMMON_PAGE_COLUMN_GAP:n,SectionZone:r,children:t})},me={"column-modifier":"_column-modifier_1tqap_1"},ge=async({children:t,slug:e,SectionZone:n,COMMON_PAGE_COLUMN_GAP_PDC:r,PLPContentProvider:a,...o})=>{const{data:i}=await I.getContentType({contentType:"categories_page",...o}),l=i.find(p=>{var y,g,m;return((y=p.config)==null?void 0:y.seo.slug)===e&&((m=(g=p.config)==null?void 0:g.responsive)==null?void 0:m.deviceType)==="desktop"}),c=i.find(p=>{var y,g,m;return((y=p.config)==null?void 0:y.seo.slug)===e&&((m=(g=p.config)==null?void 0:g.responsive)==null?void 0:m.deviceType)==="mobile"}),d=i.find(p=>{var y,g,m;return((y=p.config)==null?void 0:y.seo.slug)==="default"&&((m=(g=p.config)==null?void 0:g.responsive)==null?void 0:m.deviceType)==="desktop"}),u=i.find(p=>{var y,g,m;return((y=p.config)==null?void 0:y.seo.slug)==="default"&&((m=(g=p.config)==null?void 0:g.responsive)==null?void 0:m.deviceType)==="mobile"});return f.jsxs(f.Fragment,{children:[f.jsx(N.Utils.Column,{className:N.helpers.classNameConcat(I.responsive["responsive-desktop-flex"],me["column-modifier"]),style:{minHeight:"100vh"},children:f.jsx(a,{data:l??d,device:"desktop",SectionZone:n,COMMON_PAGE_COLUMN_GAP_PDC:r,children:t})}),f.jsx(N.Utils.Column,{className:I.responsive["responsive-mobile-flex"],children:f.jsx(a,{data:c??u,device:"mobile",SectionZone:n,COMMON_PAGE_COLUMN_GAP_PDC:r,children:t})})]})},fe=async({slug:t,...e})=>{var i,l,c;const{data:n}=await I.getContentType({contentType:"redirect_to_search",...e}),r=((c=(l=(i=n[0])==null?void 0:i.redirectToSearch)==null?void 0:l.redirectToSearch)==null?void 0:c.paths)??[];if(!!!r.length)return{slug:t,query:null,redirect:!1};const o=r.find(d=>{var u,p;return((u=d.path)==null?void 0:u.replace(/\//g,"-").toLowerCase())===t.replace(/\//g,"-").toLowerCase()||((p=d.path)==null?void 0:p.replace(/\//g,"-").toLowerCase())===`/${t}`.replace(/\//g,"-").toLowerCase()});return o?{slug:t,query:o==null?void 0:o.searchQuery,redirect:!0,collectionId:o==null?void 0:o.collectionId,filters:o==null?void 0:o.filters,sort:o==null?void 0:o.sort}:{slug:t,query:null,redirect:!1,collectionId:null,filters:null,sort:null}},he=async({slug:t,...e})=>{var i,l,c;const{data:n}=await I.getContentType({contentType:"redirect_to_search",...e}),r=((c=(l=(i=n[0])==null?void 0:i.redirectToSearch)==null?void 0:l.redirectToSearch)==null?void 0:c.paths)??[];if(!!!r.length)return null;const o=r.find(d=>{var u,p;return((u=d.path)==null?void 0:u.replace(/\//g,"-").toLowerCase())===t.replace(/\//g,"-").toLowerCase()||((p=d.path)==null?void 0:p.replace(/\//g,"-").toLowerCase())===`/${t}`.replace(/\//g,"-").toLowerCase()});return o?{slug:t,title:o.pageTitle,description:o.pageDescription}:null},ye=async({children:t,SectionZone:e,className:n,...r})=>{const{data:a}=await I.getContentType({contentType:"search_page",...r});return Array.isArray(a)&&a.length>0?f.jsx(I.SearchPageScreening,{data:a,SectionZone:e,className:n,children:t}):f.jsx(f.Fragment,{children:t})},be=async({ClientTipbarContent:t,...e})=>{const{data:n}=await I.getContentType({contentType:"tipbar",...e});return f.jsx(t,{data:n})},Ie={CommonPageContent:ie,HeaderContent:le,TipbarContent:be,FooterContent:ce,PLPContent:ge,PDPContent:pe,getRedirectData:fe,getPLPSynteticMetaData:he,SearchPageContent:ye,HelpButtonContent:de},Ce={Components:Ie},b=async(t,e={})=>{const{method:n="GET",body:r,headers:a={},priority:o="auto",cache:i="default"}=e;return fetch(t,{method:n,headers:{...a,Accept:"application/json","Content-Type":"application/json"},priority:o,cache:i,...r?{body:JSON.stringify(r)}:{}}).then(l=>l.json()).catch(l=>{console.error("[ERROR FETCH VTEX]",l)})},w=new Map;async function Re(t,e={}){var n;try{const{abort:r=!1}=e,a=new AbortController;r&&(w.has(t)&&((n=w.get(t))==null||n.abort(),w.delete(t)),w.set(t,a));const o=b(t,{...e,...r?{signal:a.signal}:{}});return r&&w.delete(t),o}catch(r){if(r.name==="AbortError"){console.log(`[REQUEST CANCELLED]: ${t}`);return}throw console.error(`[ERROR API]: ${r.message}`),r}}const ve=s.object({country:s.string().length(3,"Country code must be 3 characters long").required("Country is required"),postalCode:s.string().nullable()});async function Se({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await ve.validate(e);const{country:r,postalCode:a}=e;return await b(`${t}/api/checkout/pub/postal-code/${r}/${a}`,{method:"POST",body:e,...n})}const Te=s.object({orderFormId:s.string().nullable(),sellerCode:s.string().nullable(),sellerName:s.string().nullable()});async function x({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await Te.validate(e);const{orderFormId:r,sellerCode:a,sellerName:o}=e,i=a?`${a.trim()} - ${o}`:null;return b(`${t}/api/checkout/pub/orderForm/${r}/attachments/openTextField`,{method:"POST",body:{value:i},...n})}const Ee=s.object({orderFormId:s.string().nullable(),sellerCode:s.string().nullable(),marketingData:s.object()});async function U({apiUrl:t,body:e,extraData:n={},fetchOptions:r}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await Ee.validate(e);const{orderFormId:a,sellerCode:o,marketingData:i}=e,l=o?{utmCampaign:o?o.toUpperCase():"",utmiCampaign:o?`${n.VENDOR_CODE}`:"semcodigo"}:{};return b(`${t}/api/checkout/pub/orderForm/${a}/attachments/marketingData`,{method:"POST",body:{...i,...l},...r})}const Oe=s.object({orderFormId:s.string().nullable(),sellerCode:s.string().nullable(),sellerName:s.string().nullable()});async function Fe({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await Oe.validate(e);const r=await x({apiUrl:t,body:e,fetchOptions:n});return U({apiUrl:t,body:{...e,marketingData:r==null?void 0:r.marketingData},fetchOptions:n})}const qe=s.object({orderFormId:s.string().nullable(),coupon:s.string().nullable()});async function $e({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await qe.validate(e);const{coupon:r="",orderFormId:a}=e;return b(`${t}/api/checkout/pub/orderForm/${a}/coupons`,{method:"POST",body:{text:r},...n})}const Pe=s.object({appId:s.string().required("App ID is required"),orderFormId:s.string().nullable(),key:s.array().of(s.string())});async function je({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await Pe.validate(e);const{appId:r="faststore",orderFormId:a,key:o}=e;return b(`${t}/api/checkout/pub/orderForm/${a}/customData/${r}/${o}`,{method:"PUT",...n})}const Ne=s.object().shape({name:s.string().required("Attachment name is required"),content:s.object().nullable()});var G;const we=s.object().shape({attachments:(G=s.array().of(Ne))==null?void 0:G.nullable(),id:s.string().required("ID of SKU is required"),index:s.number().integer().nullable(),quantity:s.number().integer().nullable(),seller:s.string().required("Seller is required"),price:s.number().integer()}),Ae=s.object({orderFormId:s.string().required("OrderFormId is required"),orderItems:s.array().of(we)});async function ke({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await Ae.validate(e);const{orderFormId:r,orderItems:a}=e;return b(`${t}/api/checkout/pub/orderForm/${r}/items`,{method:"POST",body:{orderItems:a},...n})}const De=s.object({orderFormId:s.string().nullable()});async function _e({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await De.validate(e);const{orderFormId:r}=e;return b(`${t}/api/checkout/pub/orderForm/${r}/items/removeAll`,{method:"POST",...n})}const He=s.object().shape({name:s.string().required("Attachment name is required"),content:s.object().nullable()});var M;const Be=s.object().shape({attachments:(M=s.array().of(He))==null?void 0:M.nullable(),id:s.string().required("ID of SKU is required"),index:s.number().integer().nullable(),quantity:s.number().integer().nullable(),seller:s.string().required("Seller is required"),price:s.number().integer()}),Le=s.object({orderFormId:s.string().nullable(),orderItems:s.array().of(Be)});async function Ge({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await Le.validate(e);const{orderFormId:r,orderItems:a}=e;return b(`${t}/api/checkout/pub/orderForm/${r}/items/update`,{method:"POST",body:{orderItems:a},...n})}const Me=s.object({orderFormId:s.string().nullable()});async function xe({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await Me.validate(e);const{orderFormId:r}=e;return b(`${t}/api/checkout/pub/orderForm/${r}/messages/clear`,{method:"POST",...n})}const Ue=s.object({id:s.string().nullable(),itemIndex:s.number().nullable(),orderFormId:s.string().nullable(),remove:s.boolean().nullable()});async function Ve({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await Ue.validate(e);const{itemIndex:r,orderFormId:a,id:o,remove:i}=e,l=i?`/${o}/remove`:"",c=`${t}/api/checkout/pub/orderForm/${a}/items/${r}/offerings${l}`;return b(c,{method:"POST",body:{id:o},...n})}const ze=s.object({orderFormId:s.string().nullable()});async function Qe({apiUrl:t,body:e,fetchOptions:n,extraData:r}){var i;if(!e){console.error("[ERROR FETCHING] Body is required");return}await ze.validate(e);const a=new URLSearchParams({refreshOutdatedData:"true"}),o=e.orderFormId&&((i=r.orderFormPurchaseId)==null?void 0:i.value)!==e.orderFormId?`${t}/api/checkout/pub/orderForm/${e.orderFormId}?${String(a)}`:`${t}/api/checkout/pub/orderForm`;return b(o,{method:"GET",...n})}const Ke=s.object({orderFormId:s.string().nullable(),email:s.string().email().required(),firstName:s.string().required(),lastName:s.string().required(),documentType:s.string().required(),document:s.string().required(),phone:s.string().matches(/^\+\d{1,3}\d{10,11}$/)});async function Je({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await Ke.validate(e);const{orderFormId:r,...a}=e;return b(`${t}/api/checkout/pub/orderForm/${r}/attachments/clientProfileData`,{method:"POST",body:{...a},...n})}const Ye=s.object({sellerCode:s.string().nullable()});async function We({apiUrl:t,body:e,extraData:n,fetchOptions:r}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await Ye.validate(e);const{sellerCode:a=""}=e;return b(`${t}/api/dataentities/${n.ENTITIES}/search?_fields=${n.FIELDS}&${n.FILTER}=${a}`,{method:"GET",headers:{Accept:"application/vnd.vtex.ds.v10+json"},...r})}const Xe=s.object().shape({country:s.string().length(3,"Country code must be 3 characters long").required("Country is required"),orderFormId:s.string().nullable(),postalCode:s.string().nullable()});async function Ze({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await Xe.validate(e);const{country:r,orderFormId:a,postalCode:o}=e,i=o?{address:{addressType:"residential",postalCode:o,country:r}}:{logisticsInfo:[],clearAddressIfPostalCodeNotFound:!0};return b(`${t}/api/checkout/pub/orderForm/${a}/attachments/shippingData`,{method:"POST",body:i,...n})}const et=s.object().shape({orderFormId:s.string().nullable(),options:s.array().of(s.object().shape({itemIndex:s.number(),selectedDeliveryChannel:s.string(),selectedSla:s.string()})),selectedAddresses:s.array().of(s.object().shape({addressId:s.string().required(),addressType:s.string().required(),city:s.string().nullable(),complement:s.string().nullable(),country:s.string().required().length(3),geoCoordinates:s.array().of(s.number()).required().min(0),isDisposable:s.boolean().required(),neighborhood:s.string().nullable(),number:s.string().nullable(),postalCode:s.string().required(),receiverName:s.string().nullable(),reference:s.string().nullable(),state:s.string().nullable(),street:s.string().nullable()}))});async function tt({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await et.validate(e);const{orderFormId:r,options:a,selectedAddresses:o}=e;return b(`${t}/api/checkout/pub/orderForm/${r}/attachments/shippingData`,{method:"POST",body:{selectedAddresses:o,clearAddressIfPostalCodeNotFound:!1,logisticsInfo:a},...n})}const rt=s.object({country:s.string().length(3,"Country code must be 3 characters long").required("Country is required"),postalCode:s.string().nullable(),geoCoordinates:s.object().shape({longitude:s.number().required(),latitude:s.number().required()})});async function nt({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await rt.validate(e);const{country:r="",geoCoordinates:a,postalCode:o=""}=e,i=new URLSearchParams({country:String(r)});return o?i.append("postalCode",o):i.append("geoCoordinates",`${a==null?void 0:a.longitude};${a==null?void 0:a.latitude}`),await b(`${t}/api/checkout/pub/regions/?${i.toString()}`,{method:"GET",...n})}const st=s.object({id:s.string().required("ID of SKU is required"),quantity:s.number().integer().required("Quantity of item is required"),seller:s.string()}),ot=s.object({items:s.array().of(st),country:s.string().length(3,"Country code must be 3 characters long").required("Country is required"),postalCode:s.string().nullable(),geoCoordinates:s.array().nullable().of(s.number()).length(2)});async function at({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}return await ot.validate(e),b(`${t}/api/checkout/pub/orderForms/simulation`,{method:"POST",body:e,...n})}const it=Object.freeze(Object.defineProperty({__proto__:null,getMasterDataSellerCode:We,getOrderForm:Qe,postOrderFormAddCoupon:$e,postOrderFormAttachClientProfileData:Je,postOrderFormAttachOrderFormData:Fe,postOrderFormAttachShippingData:Ze,postOrderFormAttachmentsMarketingData:U,postOrderFormAttachmentsOpenTextField:x,postOrderFormClearMessages:xe,postOrderFormFreightSimulation:at,postOrderFormItems:ke,postOrderFormRegion:nt,postOrderFormRemoveAllItems:_e,postOrderFormUpdateItems:Ge,postOrderFormUpdateShippingData:tt,postOrderformAddress:Se,putOrderFormCustomData:je,updateOrderFormOffering:Ve},Symbol.toStringTag,{value:"Module"})),ct=s.object({skuId:s.string()});async function lt({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await ct.validate(e);const{skuId:r}=e;return b(`${t}/api/catalog/pvt/stockkeepingunitkit?parentSkuId=${r}`,{...n})}const ut=s.object({ids:s.array().of(s.string().required("ID are required")).required("IDs are required")});async function dt({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await ut.validate(e);const{ids:r}=e;return b(`${t}/api/catalog_system/pub/products/search?fq=${r.map(a=>`productId:${a}`).join("&fq=")}`,{...n})}const pt=s.object({productId:s.number().required("Product ID is required")});async function mt({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await pt.validate(e);const{productId:r}=e;return b(`${t}/api/catalog_system/pub/products/crossselling/similars/${r.toString()}`,{...n})}const gt=Object.freeze(Object.defineProperty({__proto__:null,getCatalogKitProducts:lt,getCatalogProducts:dt,getCatalogSimilars:mt},Symbol.toStringTag,{value:"Module"})),ft=s.object({query:s.string()});async function ht({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await ft.validate(e);const{query:r=""}=e,a=new URLSearchParams({query:r});return b(`${t}/api/io/_v/api/intelligent-search/autocomplete_suggestions?${a.toString()}`,{...n})}const yt=(t,e)=>se(t,e),bt=t=>({...t,description:t.description?yt(t.description):t.description}),It=({offer:t,seller:e,product:n})=>({...t,product:n,seller:e}),V=(t,e)=>({...t,isVariantOf:bt(e)}),Ct=t=>t?"https://schema.org/InStock":"https://schema.org/OutOfStock",A=t=>t.AvailableQuantity>0,H=t=>t.spotPrice??0,Rt=t=>t.Price??0,z=(t,e)=>A(t)&&!A(e)?-1:!A(t)&&A(e)?1:H(t)-H(e),vt=(t,e)=>{let n=0;for(let r=1;r<t.length;r++)e(t[n],t[r])>0&&(n=r);return t[n]},Q=t=>{const e=t.flatMap(r=>r.sellers.map(a=>({offer:a.commertialOffer,sku:r}))),n=vt(e,({offer:r},{offer:a})=>z(r,a));return n?n.sku:t[0]},K=t=>t.map(({imageUrl:e,imageText:n,imageLabel:r})=>({alternateName:n??"",url:e.replace("vteximg.com.br","vtexassets.com"),keywords:r})),k={attachment:"ATTACHMENT",specification:"SPECIFICATION",attribute:"ATTRIBUTE"},St=t=>({name:t.name,value:t.content,valueReference:k.attachment}),Tt=t=>({propertyID:t.id,name:t.name,value:t.value,valueReference:{valueReference:k.attribute,visible:t.visible}}),D=(t,e,n)=>{const r=t.flatMap(({name:i,values:l})=>l?l.map(c=>({name:i,value:c,valueReference:k.specification})):{name:i,value:"",valueReference:k.specification}),a=Array.isArray(n)?n.map(St):[],o=e?e.map(Tt):[];return[...r,...a,...o]},B="ÁÄÂÀÃÅČÇĆĎÉĚËÈÊẼĔȆÍÌÎÏŇÑÓÖÒÔÕØŘŔŠŤÚŮÜÙÛÝŸŽáäâàãåčçćďéěëèêẽĕȇíìîïňñóöòôõøðřŕšťúůüùûýÿžþÞĐđ߯a",Et="AAAAAACCCDEEEEEEEEIIIINNOOOOOORRSTUUUUUYYZaaaaaacccdeeeeeeeeiiiinnooooooorrstuuuuuyyzbBDdBAa",Ot=t=>{let e=t.slice(0);for(let n=0;n<B.length;n++)e=e.replace(new RegExp(B.charAt(n),"g"),Et.charAt(n));return e},Ft=t=>t.replace(/[·/_,:]/,"-"),J=t=>{const n=t.replace(/,/g,"").replace(/[*+~.()'"!:@&\[\]`/ %$#?{}|><=_^]/g,"-");return Ft(Ot(n)).toLowerCase()},Y=t=>`/${t}/p`,W=t=>{const e=Math.max(...t.map(r=>r.NumberOfInstallments)),n=t.find(r=>r.NumberOfInstallments===e);return{count:(n==null?void 0:n.NumberOfInstallments)??0,value:(n==null?void 0:n.Value)??0}},X=(t,e)=>{const n={price:0,listPrice:0,sellerDefault:!1},a=t.map(o=>It({offer:o.commertialOffer,seller:o,product:e})).sort(z).map(o=>(o.seller.sellerId==="1"&&o.AvailableQuantity>0&&(n.price=o.Price,n.listPrice=o.ListPrice,n.sellerDefault=!0),{availability:o.AvailableQuantity>0,listPrice:o.ListPrice,price:Rt(o),priceValidUntil:o.PriceValidUntil,priceCurrency:"BRL",installments:o.Installments,lowPrice:o.spotPrice,quantity:o.AvailableQuantity,seller:{identifier:o.seller.sellerId}}));return{lowPrice:n.sellerDefault?n.price:a[0].price,highPrice:n.sellerDefault?n.listPrice:a[0].listPrice,offers:a}},Z=t=>{const{attributes:e,itemId:n,name:r,sellers:a,variations:o}=t;return{additionalProperty:D(o,e,[]),name:r,offers:{offers:a==null?void 0:a.map(({sellerId:i,commertialOffer:l})=>({availability:Ct(l.AvailableQuantity>0),listPrice:l.ListPrice,price:l.Price,quantity:l.AvailableQuantity,seller:{identifier:i}}))},sku:n}},qt=t=>{var S;const{attributes:e,referenceId:n,isVariantOf:r,images:a,itemId:o,name:i,sellers:l,videos:c,variations:d}=t,{brand:u,categories:p,categoriesIds:y,description:g,linkText:m,productClusters:R,clusterHighlights:O,productName:T,properties:E,productId:F,productReference:h}=r,v=p.slice().reverse(),C=X(l,t.isVariantOf),q=W(C.offers[0].installments);return{sku:o,gtin:((S=n==null?void 0:n[0])==null?void 0:S.Value)??h??"",name:T??i,description:g,releaseDate:r.releaseDate??"",slug:m,video:c[0],categories:p,categoriesIds:y,id:F,brand:{name:u,brandName:u},seo:{description:g,title:T,canonical:Y(m)},cluster:{generals:R,highlights:O},properties:E,availability:{status:C.offers[0].availability},breadcrumbList:{itemListElement:[...v.map((P,j)=>{const $=P.split("/"),_=$[$.length-2],re=$.map(J).join("/");return{name:_,item:re,position:j+1}}),{name:r.productName,item:m,position:p.length+1}],numberOfItems:p.length},image:K(a),offers:C,additionalProperty:D(d,e,[]),isVariantOf:{productGroupID:r.productId,hasVariant:r.items.map(P=>Z(P))},installments:q}},$t=t=>{var q;const{attributes:e,referenceId:n,isVariantOf:r,images:a,itemId:o,name:i,sellers:l,Videos:c,variations:d}=t,{brand:u,categories:p,categoriesIds:y,description:g,linkText:m,productClusters:R,productName:O,Coleção:T,"ID Coleção":E,productId:F}=r,h=p.slice().reverse(),v=X(l,t.isVariantOf),C=W(v.offers[0].installments);return{sku:o,gtin:((q=n[0])==null?void 0:q.Value)??"",name:O??i,description:g,releaseDate:r.releaseDate??"",slug:m,video:c[0],categories:p,categoriesIds:y,collection:T,collectionId:E,id:F,brand:{name:u,brandName:u},seo:{description:g,title:O,canonical:Y(m)},cluster:{generals:R,highlights:[]},availability:{status:v.offers[0].availability},breadcrumbList:{itemListElement:[...h.map((S,P)=>{const j=S.split("/"),$=j[j.length-2],_=j.map(J).join("/");return{name:$,item:_,position:P+1}}),{name:r.productName,item:m,position:p.length+1}],numberOfItems:p.length},image:K(a),offers:v,additionalProperty:D(d,e,[]),isVariantOf:{productGroupID:r.productId,hasVariant:r.items.map(S=>{const{variations:P}=S,j=P.map($=>({name:$,values:S[$]}));return{...Z(S),additionalProperty:D(j,e,[])}})},installments:C}},Pt=s.array().of(s.object({key:s.string().required(),value:s.string().required()})).required("Facets are required");async function jt({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await Pt.validate(e);const r=new URLSearchParams({}),a=e.map(({key:i,value:l})=>`${i}/${l}`).join("/");I.addSearchParamsFacets(e,r);const o=`${t}/api/catalog_system/pub/products/crossselling/${a}`;return b(o,{cache:"no-store",...n}).then(i=>i.map(c=>{const d=Q(c.items);return d&&V(d,c)}).filter(c=>!!c).map(c=>({node:$t(c)})))}const ee=({apiUrl:t,body:e,fetchOptions:n,extraData:r})=>{if(!e){console.error("[ERROR FETCHING] Body is required");return}const{query:a="",page:o=1,count:i,sort:l="",facets:c=[],type:d,hideUnavailableItems:u=!0,locale:p=""}=e,y=new URLSearchParams({page:o.toString(),count:(i==null?void 0:i.toString())??(r==null?void 0:r.ITEMS_PER_PAGE)??24,query:a,sort:l,locale:p});u!==void 0&&y.append("hideUnavailableItems",u.toString());const g=c.map(m=>`${m.key}/${m.value}`).join("/")??"";return Re(`${t}/api/io/_v/api/intelligent-search/${d}/${g}?${y.toString()}`,{headers:{Accept:"application/json","content-type":"application/json"},...n})};async function Nt({body:t,extraData:e,...n}){if(!t){console.error("[ERROR FETCHING] Body is required");return}const r=await ee({body:{...t,type:"product_search"},extraData:e,...n}),a=(r==null?void 0:r.products.map(l=>{const c=Q(l.items);return c&&V(c,l)}).filter(l=>!!l))??[],{pagination:o,recordsFiltered:i}=r;return{data:{pagination:{nextPage:o.after.length>0,previousPage:o.before.length>0,startCursor:"0",endCursor:i.toString(),count:i,total:o.count},products:a.map((l,c)=>({node:qt(l),cursor:c.toString()}))}}}async function wt({body:t,extraData:e,...n}){if(!t){console.error("[ERROR FETCHING] Body is required");return}const r=await ee({body:{...t,type:"facets"},extraData:e,...n});return!r||!r.facets?(console.error("[ERROR FETCHING] No facets found"),{data:{facets:[]}}):{data:{...r,facets:I.formattedFacets(r,t==null?void 0:t.selectedFacets,(t==null?void 0:t.query)??"")}}}const At=s.object({query:s.string().optional(),locale:s.string().optional()});async function kt({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await At.validate(e);const{query:r="",locale:a="default_locale"}=e,o=new URLSearchParams({query:r,locale:a});return b(`${t}/api/io/_v/api/intelligent-search/search_suggestions?${o.toString()}`,{...n})}async function Dt({apiUrl:t}){return b(`${t}/api/io/_v/api/intelligent-search/top_searches`)}const _t=Object.freeze(Object.defineProperty({__proto__:null,getSearchAutoCompleteSuggestions:ht,getSearchCrossellingProducts:jt,getSearchFacets:wt,getSearchProducts:Nt,getSearchSuggestedTerms:kt,getSearchTopSearchs:Dt},Symbol.toStringTag,{value:"Module"})),Ht=s.object({masterDataEntity:s.string().nonNullable(),payload:s.object().shape({}).nullable()});async function Bt({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await Ht.validate(e);const{masterDataEntity:r,payload:a}=e,o=`${t}/api/dataentities/${r}/documents`;return b(o,{method:"POST",body:{payload:a},...n})}const Lt=s.object().shape({_where:s.string().optional(),_fields:s.string().optional(),_sort:s.string().optional(),_from:s.number().integer().min(0).optional(),_to:s.number().integer().min(0).optional(),_keyword:s.string().optional()}),Gt=s.object({masterDataEntity:s.string().required(),searchFields:Lt,headers:s.object().shape({"REST-Range":s.string().notRequired()})});async function Mt({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}const r=new URLSearchParams;await Gt.validate(e);const{masterDataEntity:a,searchFields:o,headers:i}=e;o&&Object.entries(o).forEach(([c,d])=>{r.append(c,String(d))}),"_fields"in o||r==null||r.append("_fields","_all");const l=`${t}/api/dataentities/${a}/search?${r.toString()}`;return b(l,{headers:{"REST-Range":i["REST-Range"]??"resources=0-20"},method:"GET",...n})}const xt=s.object({dataEntityName:s.string().required(),id:s.string().required(),fieldsToBeUpdated:s.object().shape({})});async function Ut({apiUrl:t,body:e,fetchOptions:n}){if(!e){console.error("[ERROR FETCHING] Body is required");return}await xt.validate(e);const{dataEntityName:r,id:a,fieldsToBeUpdated:o}=e,i=`${t}/api/dataentities/${r}/documents/${a}`;return b(i,{body:{fieldsToBeUpdated:o},method:"PATCH",...n})}const Vt=Object.freeze(Object.defineProperty({__proto__:null,getSearchMasterdata:Mt,patchUpdateMasterdata:Ut,postMasterdata:Bt},Symbol.toStringTag,{value:"Module"}));async function zt({body:t,apiUrl:e,extraData:n,fetchOptions:r}){const{productIds:a}=t;if(!a)return console.error("[ERROR FETCHING] productIds is required"),[];const{NAME_SPLIT_SYMBOL:o}=n;if(!o)return console.error("[ERROR FETCHING] NAME_SPLIT_SYMBOL is required"),[];const i=a.map(u=>typeof u=="string"||typeof u=="number"?`productId:${u}`:"").join("&fq="),l=await b(`${e}/api/catalog_system/pub/products/search?fq=${i}`,{...r}),c=u=>Object.keys(u).map(p=>({id:p,name:u[p]}));return l.map((u,p)=>{var F;const{installments:y,price:g,listPrice:m,sizes:R,allSizesAvailable:O}=I.getSkuInfos({items:u.items,NAME_SPLIT_SYMBOL:o}),T=O?!0:R.some(h=>h.available),E=u.items[0].sellers[0].commertialOffer;return{node:{sku:u.items[0].itemId,gtin:u.productReference,name:u.productName,description:u.description,releaseDate:u.releaseDate,slug:u.linkText,categories:u.categories,categoriesIds:u.categoriesIds,id:u.items[0].itemId,brand:{name:u.brand,brandName:u.brand},seo:{description:u.description,title:u.productName,canonical:`/${u.linkText}/p`},cluster:{generals:c(u.productClusters),highlights:c(u.clusterHighlights)},availability:{status:T},image:u.items[0].images.map(({imageLabel:h,imageUrl:v})=>({alternateName:h,url:v,keywords:h})),offers:{lowPrice:g,highPrice:m,offers:[{availability:T,listPrice:m,price:g,priceValidUntil:E.PriceValidUntil,priceCurrency:"BRL",installments:E.Installments,lowPrice:g,quantity:E.AvailableQuantity,seller:{identifier:u.items[0].sellers[0].sellerId}}]},additionalProperty:(F=u==null?void 0:u.skuSpecifications)==null?void 0:F.map(h=>({name:u==null?void 0:u.skuSpecifications[0].field.name,value:h,valueReference:"SPECIFICATION"})),isVariantOf:{productGroupID:u.productId,hasVariant:u.items.map(h=>{var v;return{additionalProperty:h==null?void 0:h.variations.map(()=>{var C,q,S;return{name:(C=h==null?void 0:h.variations)==null?void 0:C[0],value:(S=h==null?void 0:h[(q=h==null?void 0:h.variations)==null?void 0:q[0]])==null?void 0:S[0],valueReference:"SPECIFICATION"}}),name:h.name,offers:{offers:(v=h.sellers)==null?void 0:v.map(({commertialOffer:C,sellerId:q})=>({availability:"https://schema.org/InStock",listPrice:C.ListPrice,price:C.Price,quantity:C.AvailableQuantity,seller:{identifier:q}}))},sku:h.itemId,slug:`-${h.itemId}`}})},installments:y},cursor:p.toString()}})}const Qt=Object.freeze(Object.defineProperty({__proto__:null,getWishlistProducts:zt},Symbol.toStringTag,{value:"Module"})),Kt=(t="")=>t.charAt(0).toUpperCase()+t.slice(1),L=(t,e=" ")=>!t||typeof t=="string"&&t.length===0?t:(Array.isArray(t)?t:t.split("-")).map(Kt).join(e),Jt=({canonical:t,seo:e,slug:n})=>{const r=Array.isArray(n)?n.join(", "):n;return{id:0,Title:`${Array.isArray(n)?n.map(o=>L(o)).join(","):L(n)} - ${e.title}`,MetaTagDescription:e.description,name:r,hasChildren:!1,url:t,children:[]}},Yt=({canonical:t,category:e,previousImages:n,seo:r})=>({category:String(e==null?void 0:e.id),title:(e==null?void 0:e.Title)??r.title,description:(e==null?void 0:e.MetaTagDescription)??r.description,alternates:{canonical:t},openGraph:{type:"website",title:(e==null?void 0:e.Title)??r.title,description:(e==null?void 0:e.MetaTagDescription)??r.description,images:Array.isArray(n)?[...n]:[]}}),Wt=({items:t,parent:e,apiUrl:n,find:r})=>{const a=t.find(i=>i.url.replace(n,"")===decodeURIComponent(e.toLowerCase()));return(a==null?void 0:a.children.find(i=>i.name.toLowerCase()===decodeURIComponent(String(r))))??a},Xt=t=>{t instanceof Error?(console.error(`[ERROR CATEGORY INFO]: ${t.message}`),console.error(t.stack)):console.error("[ERROR CATEGORY INFO]: Unknown error",t)},Zt=new Set(["brand","category","department","subcategory","collection","cluster"]),er=t=>typeof(t==null?void 0:t.pageType)=="string"&&Zt.has(t==null?void 0:t.pageType.toLowerCase()),tr=t=>({collection:t.Coleção,categoryId:t.categoryId,current_collection:t["Coleção Atual"],items:t.items}),te=(t,e)=>t.reduce((n,r)=>{if(r.items.filter(i=>i.sellers.find(l=>l.commertialOffer.IsAvailable)).length===0||(n==null?void 0:n.find(i=>(i==null?void 0:i.productId)===(r==null?void 0:r.productId)))!==void 0)return n;const o=r.items[0].images.find(i=>e.includes(i.imageLabel));return n.push({slug:`/${r.linkText}/p`,productId:r==null?void 0:r.productId,textureImage:(o==null?void 0:o.imageUrl)??"",textureAlt:(o==null?void 0:o.imageText)??""}),n},[]),rr=Object.freeze(Object.defineProperty({__proto__:null,createEmptySeoCategory:Jt,createSeoCategory:Yt,findCategory:Wt,formattedSimilars:te,isCollectionPageType:er,notFindCategoryError:Xt,responseAdapter:tr},Symbol.toStringTag,{value:"Module"})),nr={parseSearchState:I.parseSearchState,convertSearchParams:I.convertSearchParams,filterNonRootFacets:I.filterNonRootFacets,filterNonCategorySelected:I.filterNonCategorySelected},sr=async({children:t,apiUrl:e,productId:n,ClientItems:r,PDP_INFO:a,TEXTURE_IMAGE:o,TOGGLE_STYLE_MODIFIER:i})=>{const l=await fetch(`${e}/api/catalog_system/pub/products/crossselling/similars/${n.toString()}`).then(d=>d.json()),c=te(l,o);return f.jsxs("div",{className:I.styles.similars,children:[f.jsxs("div",{className:I.styles["similars-info"],children:[f.jsx("span",{className:I.styles["sections-title"],children:a.product.color_title}),t]}),f.jsx(r,{productId:n,similars:c,TOGGLE_STYLE_MODIFIER:i})]})},or={checkout:it,catalog:gt,cms:I.cms,search:_t,masterdata:Vt,wishlist:{...Qt}},ar={catalog:rr,search:nr,product:I.productHelpers},ir={template:{pdp:{PDPSimilars:sr}}};exports.serverAPIs=or;exports.serverCMS=Ce;exports.serverComponents=ir;exports.serverHelpers=ar;
package/index2.mjs CHANGED
@@ -182,7 +182,6 @@ const Ie = ({
182
182
  t,
183
183
  {
184
184
  data: o,
185
- ...r,
186
185
  ICONS: e,
187
186
  className: n
188
187
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soma-vertical-web/multi-lib",
3
- "version": "0.0.66",
3
+ "version": "0.0.67",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  import { ICONSType } from '../../../constants';
2
- import { ISectionResponseBase } from '../../Factories';
3
2
  import { BannerType } from '../Banner';
3
+ import { ISectionResponseBase } from '../../Factories';
4
4
 
5
5
  export type TControllerPosition = 'superior-direita' | 'inferior-direita' | 'dentro-inferior-centro' | 'dentro-inferior-esquerda';
6
6
  export interface BannerCarouselSectionType extends ISectionResponseBase {
@@ -20,8 +20,7 @@ export interface BannerCarouselSectionType extends ISectionResponseBase {
20
20
  first?: boolean;
21
21
  };
22
22
  }
23
- export interface BannerCarouselProps {
24
- data: BannerCarouselSectionType;
23
+ export interface BannerCarouselProps extends BannerCarouselSectionType {
25
24
  ICONS: ICONSType;
26
25
  }
27
26
  export interface BannerCarouselControllersType {
@@ -18,6 +18,8 @@ export interface BennefitsBarSectionType extends ISectionResponseBase {
18
18
  subtitle: string;
19
19
  }[];
20
20
  };
21
+ }
22
+ export interface BennefitsBarProps extends BennefitsBarSectionType {
21
23
  CONSTANTS: {
22
24
  BENNEFITS_BAR_TITLE: BENNEFITS_BAR_TITLEType;
23
25
  ICONS: ICONSType;
@@ -1,3 +1,4 @@
1
+ import { ICONSType, MASTER_DATA_ENTITY, NEWSLETTER_CONFIGS } from '../../../constants';
1
2
  import { ISectionResponseBase } from '../../Factories';
2
3
 
3
4
  export interface NewsLetterSectionType extends ISectionResponseBase {
@@ -17,4 +18,9 @@ export interface NewsLetterSectionType extends ISectionResponseBase {
17
18
  }[];
18
19
  componentIndex?: number;
19
20
  };
21
+ CONSTANTS: {
22
+ MASTER_DATA_ENTITY: MASTER_DATA_ENTITY;
23
+ NEWSLETTER_CONFIGS: NEWSLETTER_CONFIGS;
24
+ ICONS: ICONSType;
25
+ };
20
26
  }
@@ -73,8 +73,7 @@ export interface ProductCarouselSectionType extends ISectionResponseBase {
73
73
  }[];
74
74
  };
75
75
  }
76
- export interface ProductCarouselProps {
77
- data: ProductCarouselSectionType;
76
+ export interface ProductCarouselProps extends ProductCarouselSectionType {
78
77
  CONSTANTS: ConstantsType['CONSTANTS'];
79
78
  WishListToggle: ConstantsType['WishListToggle'];
80
79
  }
@@ -91,8 +90,7 @@ export interface PDPProductCarouselSectionType extends ISectionResponseBase {
91
90
  }[];
92
91
  };
93
92
  }
94
- export interface PDPProductCarouselProps {
95
- data: PDPProductCarouselSectionType;
93
+ export interface PDPProductCarouselProps extends ISectionResponseBase, PDPProductCarouselSectionType {
96
94
  CONSTANTS: ConstantsType['CONSTANTS'];
97
95
  WishListToggle: ConstantsType['WishListToggle'];
98
96
  }
@@ -0,0 +1,64 @@
1
+ import { BENNEFITS_BAR_TITLEType, BUY_BUTTON_LABELSType, BUY_PACKAGEType, FREIGHT_CALCULATIONType, ICONSType, MAIN_IMAGEType, MASTER_DATA_ENTITY, NEWSLETTER_CONFIGS, PLP_GRID_SCROLL_BACKType, PLP_INFINITE_SCROLLType, PLP_PRODUCT_SIMILAR_DELAYType, PLP_SHOW_VIDEO_ON_PRODUCT_CARDType, PLP_SORT_DEFAULTType, PRODUCT_CARD_IMAGE_ASPECT_RATIOType, PRODUCT_CARD_TEXTSType, PRODUCT_CARD_TOP_WISHLIST_TOGGLEType, PRODUCT_IMAGE_DIMENSIONSType, SECOND_IMAGEType, StoreConfigType, TEXTURE_IMAGEType, Z_INDEX_WARType } from '../../../constants';
2
+ import { ISectionResponseBase } from '../../Factories';
3
+
4
+ type BannerConstants = {
5
+ ICONS: ICONSType;
6
+ };
7
+ type ProductCarouselConstants = {
8
+ BUY_BUTTON_LABELS: BUY_BUTTON_LABELSType;
9
+ BUY_PACKAGE: BUY_PACKAGEType;
10
+ FREIGHT_CALCULATION: FREIGHT_CALCULATIONType;
11
+ ICONS: ICONSType;
12
+ ITEMS_DEFAULT_SORT: PLP_SORT_DEFAULTType;
13
+ MAIN_IMAGE: MAIN_IMAGEType;
14
+ PLP_GRID_SCROLL_BACK: PLP_GRID_SCROLL_BACKType;
15
+ PLP_INFINITE_SCROLL: PLP_INFINITE_SCROLLType;
16
+ PLP_PRODUCT_SIMILAR_DELAY: PLP_PRODUCT_SIMILAR_DELAYType;
17
+ PLP_SHOW_VIDEO_ON_PRODUCT_CARD: PLP_SHOW_VIDEO_ON_PRODUCT_CARDType;
18
+ PRODUCT_CARD_IMAGE_ASPECT_RATIO: PRODUCT_CARD_IMAGE_ASPECT_RATIOType;
19
+ PRODUCT_CARD_TEXTS: PRODUCT_CARD_TEXTSType;
20
+ PRODUCT_CARD_TOP_WISHLIST_TOGGLE: PRODUCT_CARD_TOP_WISHLIST_TOGGLEType;
21
+ PRODUCT_IMAGE_DIMENSIONS: PRODUCT_IMAGE_DIMENSIONSType;
22
+ SECOND_IMAGE: SECOND_IMAGEType;
23
+ TEXTURE_IMAGE: TEXTURE_IMAGEType;
24
+ Z_INDEX_WAR: Z_INDEX_WARType;
25
+ StoreConfig_MainSellerId: StoreConfigType['mainSeller']['id'];
26
+ };
27
+ type PDPProductCarouselConstants = ProductCarouselConstants;
28
+ type BennefitsBarConstants = {
29
+ BENNEFITS_BAR_TITLE: BENNEFITS_BAR_TITLEType;
30
+ ICONS: ICONSType;
31
+ };
32
+ type NewsletterConstants = {
33
+ MASTER_DATA_ENTITY: MASTER_DATA_ENTITY;
34
+ NEWSLETTER_CONFIGS: NEWSLETTER_CONFIGS;
35
+ ICONS: ICONSType;
36
+ };
37
+ type TextContentConstants = {
38
+ ICONS: ICONSType;
39
+ };
40
+ type TextAccordionConstants = {
41
+ ICONS: ICONSType;
42
+ };
43
+ type BannerCarouselConstants = {
44
+ ICONS: ICONSType;
45
+ };
46
+ export type SectionConstants = {
47
+ Banner: BannerConstants;
48
+ 'Product Carousel': ProductCarouselConstants;
49
+ 'PDP Product Carousel': PDPProductCarouselConstants;
50
+ 'Bennefits Bar': BennefitsBarConstants;
51
+ newsletter: NewsletterConstants;
52
+ TextContent: TextContentConstants;
53
+ TextAccordion: TextAccordionConstants;
54
+ 'Banner Carousel': BannerCarouselConstants;
55
+ };
56
+ export type SectionName = keyof SectionConstants;
57
+ export interface SectionZoneProps {
58
+ data: Array<ISectionResponseBase & {
59
+ data?: any;
60
+ }>;
61
+ identifyWhoIsFirst?: boolean;
62
+ componentConfigs: Record<string, any>;
63
+ }
64
+ export {};