(window.webpackJsonpalfagresalfa_components_10_3_24=window.webpackJsonpalfagresalfa_components_10_3_24||[]).push([["UnidadMedidaPlp"],{0:function(e,n){e.exports=React},29:function(e,n){e.exports=ReactApollo},333:function(e,n,a){"use strict";a.r(n),function(e){var n=a(1);a.p=Object(n.getPublicPath)("alfagresalfa.components@10.3.24");var i=Object(n.register)((function(){return a(334)}),e,"alfagresalfa.components@10.3.24","alfagresalfa.components@10.x","UnidadMedidaPlp");i.renderHotReload,i.setupHMR}.call(this,a(4)(e))},334:function(e,n,a){"use strict";a.r(n);var i=a(0),t=a.n(i),d=a(6),l=a.n(d),r=a(3),u=a.n(r),m=a(29),o=a(35),c=a.n(o);n.default=function(){var e,n,a,d,r,o,s,v,f,k=l()(),p=Object(m.useQuery)(c.a,{variables:{value:(null===(e=k.selectedItem)||void 0===e?void 0:e.itemId)||""}}),g=p.data;if(p.loading||!g||!g.product)return null;var b=null==g?void 0:g.product.items.find((function(e){var n;return e.itemId==(null===(n=k.selectedItem)||void 0===n?void 0:n.itemId)})),N=(null==b?void 0:b.measurementUnit)||k.product.items[0].measurementUnit,x=(null==g?void 0:g.product.properties)||(null==k||null===(n=k.product)||void 0===n?void 0:n.properties);null==x||x.forEach((function(e){if("Unidad de empaque"==(null==e?void 0:e.name)){var n=e.values[0]?e.values[0]:"";N=n.toLowerCase()}}));var V=[{nombre:" m²",unidadVtex:"M2"},{nombre:" m²",unidadVtex:"m2"},{nombre:" m²",unidadVtex:"m²"},{nombre:" m³",unidadVtex:"m3"},{nombre:" m³",unidadVtex:"m³"},{nombre:" Un",unidadVtex:"un"},{nombre:" Galón",unidadVtex:"gl"},{nombre:" Caja",unidadVtex:"cj"},{nombre:" Caja",unidadVtex:"ca"},{nombre:" Kg",unidadVtex:"kg"},{nombre:" Metro",unidadVtex:"m"},{nombre:" Galón",unidadVtex:"gls"},{nombre:" Galón",unidadVtex:"GLS"},{nombre:" Mililitro",unidadVtex:"ml"},{nombre:" Litro",unidadVtex:"l"},{nombre:" Rollo",unidadVtex:"rol"},{nombre:" Gramo",unidadVtex:"g"},{nombre:" Tonelada",unidadVtex:"t"},{nombre:" Cuarto galón",unidadVtex:"cto"},{nombre:" Bolsa",unidadVtex:"bol"},{nombre:" Cuñete",unidadVtex:"cun"}].find((function(e){return e.unidadVtex===N}));V=V?V.nombre:N;var _=null===(a=b.variations.find((function(e){return"Formato"==e.name})))||void 0===a?void 0:a.values[0];" Galón"==V&&"5 GL"==_?V=" Cuñete":" Galón"!=V&&" Cuñete"!=V||"2.5 GL"!=_||(V=" Medio cuñete");var S=null===(d=k.selectedItem)||void 0===d?void 0:d.sellers[0].commertialOffer.AvailableQuantity,F=(null===(r=b.sellers.find((function(e){return e.sellerDefault})))||void 0===r?void 0:r.commertialOffer.ListPrice)||Math.round(null===(o=k.selectedItem)||void 0===o?void 0:o.sellers[0].commertialOffer.ListPrice),y=(null===(s=b.sellers.find((function(e){return e.sellerDefault})))||void 0===s?void 0:s.commertialOffer.Price)||Math.round(null===(v=k.selectedItem)||void 0===v?void 0:v.sellers[0].commertialOffer.Price),h=null===(f=k.selectedItem)||void 0===f?void 0:f.sellers[0].commertialOffer.taxPercentage,P=F;(h*=100)>0&&(P=19*F/100+F),P=(P=Math.round(P)).toLocaleString("es-CO",{style:"currency",currency:"COP",minimumFractionDigits:0});var O=y;return h>0&&(O=19*y/100+y),O=(O=Math.round(O)).toLocaleString("es-CO",{style:"currency",currency:"COP",minimumFractionDigits:0}),t.a.createElement(i.Fragment,null,S>0?t.a.createElement("div",{className:u.a.containerPreciosIVA},F!=y?t.a.createElement("div",{className:u.a.containerPrecioFullAntes},t.a.createElement("p",{className:u.a.precioFullPlp},O),t.a.createElement("p",{className:u.a.precioFullPlpAntes},P)):t.a.createElement("div",{className:u.a.containerPrecioFull},t.a.createElement("p",{className:u.a.precioFullPlp},O)),t.a.createElement("div",{className:u.a.containerUnidadMedida},t.a.createElement("p",{className:u.a.unidadMedidaPlp}," ",V))):null)}},35:function(e,n){var a={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"getRewardValue"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"value"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}},directives:[]}],directives:[{kind:"Directive",name:{kind:"Name",value:"context"},arguments:[{kind:"Argument",name:{kind:"Name",value:"sender"},value:{kind:"StringValue",value:"alfagresalfa.components@10.3.24",block:!1}}]}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"product"},arguments:[{kind:"Argument",name:{kind:"Name",value:"identifier"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"field"},value:{kind:"EnumValue",value:"sku"}},{kind:"ObjectField",name:{kind:"Name",value:"value"},value:{kind:"Variable",name:{kind:"Name",value:"value"}}}]}}],directives:[{kind:"Directive",name:{kind:"Name",value:"context"},arguments:[{kind:"Argument",name:{kind:"Name",value:"provider"},value:{kind:"StringValue",value:"vtex.search-graphql",block:!1}}]},{kind:"Directive",name:{kind:"Name",value:"runtimeMeta"},arguments:[{kind:"Argument",name:{kind:"Name",value:"hash"},value:{kind:"StringValue",value:"f2775381c4e97caeec110c6a32855cb03bc03d613a17c346bec033fcfab8cc26",block:!1}}]}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"productId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"properties"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"values"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"__typename"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"items"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"itemId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"measurementUnit"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"variations"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"values"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"__typename"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"sellers"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"sellerDefault"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"commertialOffer"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"Price"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"ListPrice"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"RewardValue"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"AvailableQuantity"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"__typename"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"__typename"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"__typename"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"__typename"},arguments:[],directives:[]}]}}]}}],loc:{start:0,end:721}};a.loc.source={body:'query getRewardValue($value: ID!) @context(sender: "alfagresalfa.components@10.3.24") {\n product(identifier: {field: sku, value: $value}) @context(provider: "vtex.search-graphql") @runtimeMeta(hash: "f2775381c4e97caeec110c6a32855cb03bc03d613a17c346bec033fcfab8cc26") {\n productId\n properties {\n name\n values\n __typename\n }\n items {\n itemId\n measurementUnit\n variations {\n name\n values\n __typename\n }\n sellers {\n sellerDefault\n commertialOffer {\n Price\n ListPrice\n RewardValue\n AvailableQuantity\n __typename\n }\n __typename\n }\n __typename\n }\n __typename\n }\n}\n',name:"GraphQL request",locationOffset:{line:1,column:1}};var i={};function t(e,n){for(var a=0;a0;){var u=r;r=new Set,u.forEach((function(e){l.has(e)||(l.add(e),(i[e]||new Set).forEach((function(e){r.add(e)})))}))}return l.forEach((function(n){var i=t(e,n);i&&a.definitions.push(i)})),a}(a,"getRewardValue")},6:function(e,n){e.exports=__RENDER_8_COMPONENTS__["vtex.product-context@0.x/useProduct"]}},[[333,"common",0]]]);