(window.webpackJsonpalfagresalfa_components_10_3_24=window.webpackJsonpalfagresalfa_components_10_3_24||[]).push([["UnidadMedidaPrecioPLP"],{0:function(e,n){e.exports=React},29:function(e,n){e.exports=ReactApollo},335:function(e,n,i){"use strict";i.r(n),function(e){var n=i(1);i.p=Object(n.getPublicPath)("alfagresalfa.components@10.3.24");var a=Object(n.register)((function(){return i(336)}),e,"alfagresalfa.components@10.3.24","alfagresalfa.components@10.x","UnidadMedidaPrecioPLP");a.renderHotReload,a.setupHMR}.call(this,i(4)(e))},336:function(e,n,i){"use strict";i.r(n);var a=i(0),t=i.n(a),l=i(6),d=i.n(l),r=i(3),u=i.n(r),c=i(29),m=i(35),s=i.n(m);n.default=function(){var e,n,i,l,r,m,o,v,f,k=d()(),p=Object(c.useQuery)(s.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 N,_,S,y=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)})),b=null==y?void 0:y.measurementUnit,F=null==y||null===(n=y.sellers.find((function(e){return e.sellerDefault})))||void 0===n?void 0:n.commertialOffer.RewardValue,h=b||(null===(i=k.selectedItem)||void 0===i?void 0:i.measurementUnit),P=F,O=(null===(l=y.sellers.find((function(e){return e.sellerDefault})))||void 0===l?void 0:l.commertialOffer.ListPrice)||Math.round(null===(r=k.selectedItem)||void 0===r?void 0:r.sellers[0].commertialOffer.ListPrice),D=(null===(m=y.sellers.find((function(e){return e.sellerDefault})))||void 0===m?void 0:m.commertialOffer.Price)||Math.round(null===(o=k.selectedItem)||void 0===o?void 0:o.sellers[0].commertialOffer.Price),w=null===(v=k.selectedItem)||void 0===v?void 0:v.sellers[0].commertialOffer.taxPercentage;w*=100,"M2"!=h&&"m²"!=h&&"m2"!=h||1==P||(N=O/P,w>0&&(N=19*N/100+N),S=Math.round(NaN==N||"NaN"==N||null==N||null==N?null:N).toLocaleString("es-CO",{style:"currency",currency:"COP",minimumFractionDigits:0}),O!=D&&(_=D/P,w>0&&(_=19*_/100+_),_=(_=Math.round(_)).toLocaleString("es-CO",{style:"currency",currency:"COP",minimumFractionDigits:0})));var x=null===(f=k.selectedItem)||void 0===f?void 0:f.sellers[0].commertialOffer.AvailableQuantity;return t.a.createElement(a.Fragment,null,N&&x?t.a.createElement("div",{className:u.a.containerUnidadMedida},_?t.a.createElement("p",{className:u.a.unidadMedidaPrecioPLP},t.a.createElement("span",{style:{color:"#FF4D00",marginRight:"8px"}},_)," ",t.a.createElement("span",{style:{textDecoration:"line-through"}},"$ NaN"===S?"":S+" m²")):t.a.createElement("p",{className:u.a.unidadMedidaPrecioPLP},"$ NaN"===S?"":S+" m²"," ")):null)}},35:function(e,n){var i={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}};i.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 a={};function t(e,n){for(var i=0;i0;){var u=r;r=new Set,u.forEach((function(e){d.has(e)||(d.add(e),(a[e]||new Set).forEach((function(e){r.add(e)})))}))}return d.forEach((function(n){var a=t(e,n);a&&i.definitions.push(a)})),i}(i,"getRewardValue")},6:function(e,n){e.exports=__RENDER_8_COMPONENTS__["vtex.product-context@0.x/useProduct"]}},[[335,"common",0]]]);