관리-도구
편집 파일: reviews-by-product.js
this.kkart=this.kkart||{},this.kkart.blocks=this.kkart.blocks||{},this.kkart.blocks["reviews-by-product"]=function(e){function t(t){for(var n,i,a=t[0],s=t[1],u=t[2],d=0,p=[];d<a.length;d++)i=a[d],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&p.push(o[i][0]),o[i]=0;for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n]);for(l&&l(t);p.length;)p.shift()();return c.push.apply(c,u||[]),r()}function r(){for(var e,t=0;t<c.length;t++){for(var r=c[t],n=!0,a=1;a<r.length;a++){var s=r[a];0!==o[s]&&(n=!1)}n&&(c.splice(t--,1),e=i(i.s=r[0]))}return e}var n={},o={36:0},c=[];function i(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.m=e,i.c=n,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="";var a=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],s=a.push.bind(a);a.push=t,a=a.slice();for(var u=0;u<a.length;u++)t(a[u]);var l=s;return c.push([829,0]),r()}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},108:function(e,t){},109:function(e,t){},110:function(e,t){},111:function(e,t){},112:function(e,t){},113:function(e,t){},114:function(e,t){},115:function(e,t){},116:function(e,t){},117:function(e,t){},118:function(e,t){},119:function(e,t){},120:function(e,t){},121:function(e,t){},122:function(e,t){},13:function(e,t){!function(){e.exports=this.wp.apiFetch}()},137:function(e,t,r){"use strict";r.d(t,"a",(function(){return d})),r.d(t,"b",(function(){return p})),r.d(t,"c",(function(){return b}));var n=r(0),o=r(1),c=r(192),i=r(4),a=r(14),s=r(3),u=r(5),l=r(74),d=function(e,t){return Object(n.createElement)(a.BlockControls,null,Object(n.createElement)(i.Toolbar,{controls:[{icon:"edit",title:Object(o.__)("Edit",'kkart'),onClick:function(){return t({editMode:!e})},isActive:e}]}))},p=function(e,t){return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(i.ToggleControl,{label:Object(o.__)("Product rating",'kkart'),checked:e.showReviewRating,onChange:function(){return t({showReviewRating:!e.showReviewRating})}}),e.showReviewRating&&!u.K&&Object(n.createElement)(i.Notice,{className:"kkart-block-base-control-notice",isDismissible:!1},Object(c.a)(Object(o.__)("Product rating is disabled in your <a>store settings</a>.",'kkart'),{a:Object(n.createElement)("a",{href:Object(s.getAdminLink)("admin.php?page=kkart-settings&tab=products"),target:"_blank",rel:"noopener noreferrer"})})),Object(n.createElement)(i.ToggleControl,{label:Object(o.__)("Reviewer name",'kkart'),checked:e.showReviewerName,onChange:function(){return t({showReviewerName:!e.showReviewerName})}}),Object(n.createElement)(i.ToggleControl,{label:Object(o.__)("Image",'kkart'),checked:e.showReviewImage,onChange:function(){return t({showReviewImage:!e.showReviewImage})}}),Object(n.createElement)(i.ToggleControl,{label:Object(o.__)("Review date",'kkart'),checked:e.showReviewDate,onChange:function(){return t({showReviewDate:!e.showReviewDate})}}),Object(n.createElement)(i.ToggleControl,{label:Object(o.__)("Review content",'kkart'),checked:e.showReviewContent,onChange:function(){return t({showReviewContent:!e.showReviewContent})}}),e.showReviewImage&&Object(n.createElement)(n.Fragment,null,Object(n.createElement)(l.a,{label:Object(o.__)("Review image",'kkart'),value:e.imageType,options:[{label:Object(o.__)("Reviewer photo",'kkart'),value:"reviewer"},{label:Object(o.__)("Product",'kkart'),value:"product"}],onChange:function(e){return t({imageType:e})}}),"reviewer"===e.imageType&&!u.Q&&Object(n.createElement)(i.Notice,{className:"kkart-block-base-control-notice",isDismissible:!1},Object(c.a)(Object(o.__)("Reviewer photo is disabled in your <a>site settings</a>.",'kkart'),{a:Object(n.createElement)("a",{href:Object(s.getAdminLink)("options-discussion.php"),target:"_blank",rel:"noopener noreferrer"})}))))},b=function(e,t){return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(i.ToggleControl,{label:Object(o.__)("Order by",'kkart'),checked:e.showOrderby,onChange:function(){return t({showOrderby:!e.showOrderby})}}),Object(n.createElement)(i.SelectControl,{label:Object(o.__)("Order Product Reviews by",'kkart'),value:e.orderby,options:[{label:"Most recent",value:"most-recent"},{label:"Highest Rating",value:"highest-rating"},{label:"Lowest Rating",value:"lowest-rating"}],onChange:function(e){return t({orderby:e})}}),Object(n.createElement)(i.RangeControl,{label:Object(o.__)("Starting Number of Reviews",'kkart'),value:e.reviewsOnPageLoad,onChange:function(e){return t({reviewsOnPageLoad:e})},max:20,min:1}),Object(n.createElement)(i.ToggleControl,{label:Object(o.__)("Load more",'kkart'),checked:e.showLoadMore,onChange:function(){return t({showLoadMore:!e.showLoadMore})}}),e.showLoadMore&&Object(n.createElement)(i.RangeControl,{label:Object(o.__)("Load More Reviews",'kkart'),value:e.reviewsOnLoadMore,onChange:function(e){return t({reviewsOnLoadMore:e})},max:20,min:1}))}},14:function(e,t){!function(){e.exports=this.wp.blockEditor}()},143:function(e,t,r){"use strict";var n=r(51),o=r.n(n),c=r(10),i=r.n(c),a=r(0),s=r(1),u=r(6),l=(r(2),r(50)),d=r(4),p=r(7),b=r.n(p),f=r(22),g=r.n(f),v=r(25),w=r.n(v),m=r(23),h=r.n(m),O=r(24),j=r.n(O),y=r(12),_=r.n(y),k=r(26);function E(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=_()(e);if(t){var o=_()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return j()(this,r)}}var R=Object(k.createHigherOrderComponent)((function(e){var t=function(t){h()(n,t);var r=E(n);function n(){return g()(this,n),r.apply(this,arguments)}return w()(n,[{key:"render",value:function(){var t=this.props.selected;return Object(a.createElement)(e,i()({},this.props,{selected:Object(u.isNil)(t)?[]:[t]}))}}]),n}(a.Component);return t.defaultProps={selected:null},t}),"withTransformSingleSelectToMultipleSelect"),P=r(302),S=r(15),x=r.n(S),C=r(37),D=r.n(C),N=r(19),L=r.n(N),I=r(8),T=r.n(I),M=r(43),A=r.n(M),B=r(40),H=r(44);function V(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function z(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?V(Object(r),!0).forEach((function(t){T()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):V(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function F(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=_()(e);if(t){var o=_()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return j()(this,r)}}var U=Object(k.createHigherOrderComponent)((function(e){var t=function(t){h()(n,t);var r=F(n);function n(){var e;g()(this,n);for(var t=arguments.length,o=new Array(t),c=0;c<t;c++)o[c]=arguments[c];return e=r.call.apply(r,[this].concat(o)),T()(L()(e),"state",{error:null,loading:!1,variations:{}}),T()(L()(e),"loadVariations",(function(){var t=e.props.products,r=e.state,n=r.loading,o=r.variations;if(!n){var c=e.getExpandedProduct();if(c&&!o[c]){var i=t.find((function(e){return e.id===c}));i.variations&&0!==i.variations.length?(e.setState({loading:!0}),Object(B.g)(c).then((function(t){var r=t.map((function(e){return z(z({},e),{},{parent:c})}));e.setState({variations:z(z({},e.state.variations),{},T()({},c,r)),loading:!1,error:null})})).catch(function(){var t=D()(x.a.mark((function t(r){var n;return x.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(H.a)(r);case 2:n=t.sent,e.setState({variations:z(z({},e.state.variations),{},T()({},c,null)),loading:!1,error:n});case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())):e.setState({variations:z(z({},e.state.variations),{},T()({},c,null)),loading:!1,error:null})}}})),e}return w()(n,[{key:"componentDidMount",value:function(){var e=this.props,t=e.selected,r=e.showVariations;t&&r&&this.loadVariations()}},{key:"componentDidUpdate",value:function(e){var t=this.props,r=t.isLoading,n=t.selected;t.showVariations&&(!A()(e.selected,n)||e.isLoading&&!r)&&this.loadVariations()}},{key:"isProductId",value:function(e){return this.props.products.some((function(t){return t.id===e}))}},{key:"findParentProduct",value:function(e){return this.props.products.filter((function(t){return t.variations&&t.variations.find((function(t){return t.id===e}))}))[0].id}},{key:"getExpandedProduct",value:function(){var e=this.props,t=e.isLoading,r=e.selected;if(!e.showVariations)return null;var n=r&&r.length?r[0]:null;return n?this.prevSelectedItem=n:this.prevSelectedItem&&(t||this.isProductId(this.prevSelectedItem)||(n=this.prevSelectedItem)),!t&&n?this.isProductId(n)?n:this.findParentProduct(n):null}},{key:"render",value:function(){var t=this.props,r=t.error,n=t.isLoading,o=this.state,c=o.error,s=o.loading,u=o.variations;return Object(a.createElement)(e,i()({},this.props,{error:c||r,expandedProduct:this.getExpandedProduct(),isLoading:n,variations:u,variationsLoading:s}))}}]),n}(a.Component);return T()(t,"defaultProps",{selected:[],showVariations:!1}),t}),"withProductVariations"),Q=r(61),W=r(57),q=Object(a.createElement)(W.a,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(a.createElement)("path",{fill:"#1E8CBE",d:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"})),G=Object(a.createElement)(W.a,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(a.createElement)("path",{fill:"#757575",d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"})),J=r(49);r(200);function K(e,t){if(!t)return e;var r=new RegExp(Object(u.escapeRegExp)(t),"ig");return e.replace(r,"<strong>$&</strong>")}var $=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e?Object(a.createElement)(Q.a,{srcElement:q}):Object(a.createElement)(Q.a,{srcElement:G})},Y={list:Object(s.__)("Products",'kkart'),noItems:Object(s.__)("Your store doesn't have any products.",'kkart'),search:Object(s.__)("Search for a product to display",'kkart'),updated:Object(s.__)("Product search results updated.",'kkart')},X=function(e){var t=e.expandedProduct,r=e.error,n=e.isLoading,c=e.onChange,p=e.onSearch,f=e.products,g=e.renderItem,v=e.selected,w=e.showVariations,m=e.variations,h=e.variationsLoading,O=function(e){var r=e.item,n=e.search,o=e.depth,c=void 0===o?0:o,p=e.isSelected,f=e.onSelect,g=r.variations&&Array.isArray(r.variations)?r.variations.length:0,v=b()("kkart-search-product__item","kkart-search-list__item","depth-".concat(c),{"is-searching":n.length>0,"is-skip-level":0===c&&0!==r.parent,"is-variable":g>0}),w=Object.assign({},e);delete w.isSingle;var m={role:"menuitemradio"};return r.breadcrumbs.length&&(m["aria-label"]="".concat(r.breadcrumbs[0],": ").concat(r.name)),g&&(m["aria-expanded"]=r.id===t),r.breadcrumbs.length?(Object(u.isEmpty)(r.variation)||(r.name=r.variation),Object(a.createElement)(l.b,i()({className:v},e,m))):[Object(a.createElement)(d.MenuItem,i()({key:"product-".concat(r.id),isSelected:p},w,m,{className:v,onClick:function(){f(r)()}}),Object(a.createElement)("span",{className:"kkart-search-list__item-state"},$(p)),Object(a.createElement)("span",{className:"kkart-search-list__item-label"},Object(a.createElement)("span",{className:"kkart-search-list__item-name",dangerouslySetInnerHTML:{__html:K(r.name,n)}})),g?Object(a.createElement)("span",{className:"kkart-search-list__item-variation-count"},Object(s.sprintf)(Object(s._n)("%d variation","%d variations",g,'kkart'),g)):null),t===r.id&&g>0&&h&&Object(a.createElement)("div",{key:"loading",className:"kkart-search-list__item kkart-search-product__itemdepth-1 is-loading is-not-active"},Object(a.createElement)(d.Spinner,null))]};if(r)return Object(a.createElement)(J.a,{error:r});var j=m&&m[t]?m[t]:[],y=[].concat(o()(f),o()(j));return Object(a.createElement)(l.a,{className:"kkart-products",list:y,isLoading:n,isSingle:!0,selected:y.filter((function(e){var t=e.id;return v.includes(t)})),onChange:c,renderItem:g||(w?O:null),onSearch:p,messages:Y,isHierarchical:!0})};X.defaultProps={expandedProduct:null,selected:[],showVariations:!1};t.a=R(Object(P.a)(U(X)))},144:function(e,t,r){"use strict";var n=r(0),o=r(57),c=Object(n.createElement)(o.a,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"}));t.a=c},147:function(e,t){},149:function(e,t,r){"use strict";var n=r(0),o=(r(2),r(7)),c=r.n(o),i=r(48),a=r(193);r(202);t.a=Object(a.a)((function(e){var t=e.className,r=e.instanceId,o=e.defaultValue,a=e.label,s=e.onChange,u=e.options,l=e.screenReaderLabel,d=e.readOnly,p=e.value,b="kkart-block-components-sort-select__select-".concat(r);return Object(n.createElement)("div",{className:c()("kkart-block-sort-select","kkart-block-components-sort-select",t)},Object(n.createElement)(i.a,{label:a,screenReaderLabel:l,wrapperElement:"label",wrapperProps:{className:"kkart-block-sort-select__label kkart-block-components-sort-select__label",htmlFor:b}}),Object(n.createElement)("select",{id:b,className:"kkart-block-sort-select__select kkart-block-components-sort-select__select",defaultValue:o,onChange:s,readOnly:d,value:p},u.map((function(e){return Object(n.createElement)("option",{key:e.key,value:e.key},e.label)}))))}))},15:function(e,t){!function(){e.exports=this.regeneratorRuntime}()},157:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(1),o=r(5),c={attributes:{editMode:!1,imageType:"reviewer",orderby:"most-recent",reviewsOnLoadMore:10,reviewsOnPageLoad:10,showLoadMore:!0,showOrderby:!0,showReviewDate:!0,showReviewerName:!0,showReviewImage:!0,showReviewRating:!0,showReviewContent:!0,previewReviews:[{id:1,date_created:"2019-07-15T17:05:04",formatted_date_created:Object(n.__)("July 15, 2019",'kkart'),date_created_gmt:"2019-07-15T15:05:04",product_id:0,product_name:Object(n.__)("WordPress Pennant",'kkart'),product_permalink:"#",reviewer:Object(n.__)("Alice",'kkart'),review:"<p>".concat(Object(n.__)("I bought this product last week and I'm very happy with it.",'kkart'),"</p>\n"),reviewer_avatar_urls:{48:o.U+"img/avatar.jpg",96:o.U+"img/avatar.jpg"},rating:5,verified:!0},{id:2,date_created:"2019-07-12T12:39:39",formatted_date_created:Object(n.__)("July 12, 2019",'kkart'),date_created_gmt:"2019-07-12T10:39:39",product_id:0,product_name:Object(n.__)("WordPress Pennant",'kkart'),product_permalink:"#",reviewer:Object(n.__)("Bob",'kkart'),review:"<p>".concat(Object(n.__)("This product is awesome, I love it!",'kkart'),"</p>\n"),reviewer_avatar_urls:{48:o.U+"img/avatar.jpg",96:o.U+"img/avatar.jpg"},rating:null,verified:!1}]}}},17:function(e,t){!function(){e.exports=this.wp.blocks}()},18:function(e,t){!function(){e.exports=this.wp.url}()},182:function(e,t,r){"use strict";t.a={editMode:{type:"boolean",default:!0},imageType:{type:"string",default:"reviewer"},orderby:{type:"string",default:"most-recent"},reviewsOnLoadMore:{type:"number",default:10},reviewsOnPageLoad:{type:"number",default:10},showLoadMore:{type:"boolean",default:!0},showOrderby:{type:"boolean",default:!0},showReviewDate:{type:"boolean",default:!0},showReviewerName:{type:"boolean",default:!0},showReviewImage:{type:"boolean",default:!0},showReviewRating:{type:"boolean",default:!0},showReviewContent:{type:"boolean",default:!0},previewReviews:{type:"array",default:null}}},183:function(e,t,r){"use strict";var n=r(10),o=r.n(n),c=r(0),i=(r(201),r(71));t.a=function(e){var t=e.attributes;return Object(c.createElement)("div",o()({className:Object(i.a)(t)},Object(i.b)(t)))}},188:function(e,t,r){"use strict";var n=r(22),o=r.n(n),c=r(25),i=r.n(c),a=r(23),s=r.n(a),u=r(24),l=r.n(u),d=r(12),p=r.n(d),b=r(0),f=r(1),g=r(9),v=(r(2),r(6)),w=r(4),m=r(5),h=r(93),O=r(48),j=(r(258),function(e){var t=e.onClick,r=e.label,n=e.screenReaderLabel;return Object(b.createElement)("div",{className:"wp-block-button kkart-block-load-more kkart-block-components-load-more"},Object(b.createElement)("button",{className:"wp-block-button__link",onClick:t},Object(b.createElement)(O.a,{label:r,screenReaderLabel:n})))});j.defaultProps={label:Object(f.__)("Load more",'kkart')};var y=j,_=r(149),k=(r(255),function(e){var t=e.defaultValue,r=e.onChange,n=e.readOnly,o=e.value;return Object(b.createElement)(_.a,{className:"kkart-block-review-sort-select kkart-block-components-review-sort-select",defaultValue:t,label:Object(f.__)("Order by",'kkart'),onChange:r,options:[{key:"most-recent",label:Object(f.__)("Most recent",'kkart')},{key:"highest-rating",label:Object(f.__)("Highest rating",'kkart')},{key:"lowest-rating",label:Object(f.__)("Lowest rating",'kkart')}],readOnly:n,screenReaderLabel:Object(f.__)("Order reviews by",'kkart'),value:o})}),E=r(8),R=r.n(E),P=r(7),S=r.n(P),x=r(19),C=r.n(x),D=r(232),N=r.n(D),L=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"...",n=N()(e,{suffix:r,limit:t});return n.html},I=function(e,t,r,n){var o=T(e,t,r);return L(e,o-n.length,n)},T=function(e,t,r){for(var n={start:0,middle:0,end:e.length};n.start<=n.end;)n.middle=Math.floor((n.start+n.end)/2),t.innerHTML=L(e,n.middle),n=M(n,t.clientHeight,r);return n.middle},M=function(e,t,r){return t<=r?e.start=e.middle+1:e.end=e.middle-1,e};function A(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=p()(e);if(t){var o=p()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return l()(this,r)}}var B=function(e){s()(r,e);var t=A(r);function r(e){var n;return o()(this,r),(n=t.apply(this,arguments)).state={isExpanded:!1,clampEnabled:null,content:e.children,summary:"."},n.reviewSummary=Object(g.createRef)(),n.reviewContent=Object(g.createRef)(),n.getButton=n.getButton.bind(C()(n)),n.onClick=n.onClick.bind(C()(n)),n}return i()(r,[{key:"componentDidMount",value:function(){if(this.props.children){var e=this.props,t=e.maxLines,r=e.ellipsis,n=(this.reviewSummary.current.clientHeight+1)*t+1,o=this.reviewContent.current.clientHeight+1>n;this.setState({clampEnabled:o}),o&&this.setState({summary:I(this.reviewContent.current.innerHTML,this.reviewSummary.current,n,r)})}}},{key:"getButton",value:function(){var e=this.state.isExpanded,t=this.props,r=t.className,n=t.lessText,o=t.moreText,c=e?n:o;if(c)return Object(b.createElement)("a",{href:"#more",className:r+"__read_more",onClick:this.onClick,"aria-expanded":!e,role:"button"},c)}},{key:"onClick",value:function(e){e.preventDefault();var t=this.state.isExpanded;this.setState({isExpanded:!t})}},{key:"render",value:function(){var e=this.props.className,t=this.state,r=t.content,n=t.summary,o=t.clampEnabled,c=t.isExpanded;return r?!1===o?Object(b.createElement)("div",{className:e},Object(b.createElement)("div",{ref:this.reviewContent},r)):Object(b.createElement)("div",{className:e},(!c||null===o)&&Object(b.createElement)("div",{ref:this.reviewSummary,"aria-hidden":c,dangerouslySetInnerHTML:{__html:n}}),(c||null===o)&&Object(b.createElement)("div",{ref:this.reviewContent,"aria-hidden":!c},r),this.getButton()):null}}]),r}(g.Component);B.defaultProps={maxLines:3,ellipsis:"…",moreText:Object(f.__)("Read more",'kkart'),lessText:Object(f.__)("Read less",'kkart'),className:"read-more-content"};var H=B;r(257);var V=function(e){var t=e.attributes,r=e.review,n=void 0===r?{}:r,o=t.imageType,c=t.showReviewDate,i=t.showReviewerName,a=t.showReviewImage,s=t.showReviewRating,u=t.showReviewContent,l=t.showProductName,d=n.rating,p=!Object.keys(n).length>0,g=Number.isFinite(d)&&s;return Object(b.createElement)("li",{className:S()("kkart-block-review-list-item__item","kkart-block-components-review-list-item__item",{"is-loading":p}),"aria-hidden":p},(l||c||i||a||g)&&Object(b.createElement)("div",{className:"kkart-block-review-list-item__info kkart-block-components-review-list-item__info"},a&&function(e,t,r){var n,o;return r||!e?Object(b.createElement)("div",{className:"kkart-block-review-list-item__image kkart-block-components-review-list-item__image",width:"48",height:"48"}):Object(b.createElement)("div",{className:"kkart-block-review-list-item__image kkart-block-components-review-list-item__image"},"product"===t?Object(b.createElement)("img",{"aria-hidden":"true",alt:(null===(n=e.product_image)||void 0===n?void 0:n.alt)||"",src:(null===(o=e.product_image)||void 0===o?void 0:o.thumbnail)||""}):Object(b.createElement)("img",{"aria-hidden":"true",alt:"",src:e.reviewer_avatar_urls[48]||"",srcSet:e.reviewer_avatar_urls[96]+" 2x"}),e.verified&&Object(b.createElement)("div",{className:"kkart-block-review-list-item__verified kkart-block-components-review-list-item__verified",title:Object(f.__)("Verified buyer",'kkart')},Object(f.__)("Verified buyer",'kkart')))}(n,o,p),(l||i||g||c)&&Object(b.createElement)("div",{className:"kkart-block-review-list-item__meta kkart-block-components-review-list-item__meta"},g&&function(e){var t=e.rating,r={width:t/5*100+"%"};return Object(b.createElement)("div",{className:"kkart-block-review-list-item__rating kkart-block-components-review-list-item__rating"},Object(b.createElement)("div",{className:"kkart-block-review-list-item__rating__stars kkart-block-components-review-list-item__rating__stars",role:"img"},Object(b.createElement)("span",{style:r},Object(f.sprintf)(Object(f.__)("Rated %f out of 5",'kkart'),t))))}(n),l&&function(e){return Object(b.createElement)("div",{className:"kkart-block-review-list-item__product kkart-block-components-review-list-item__product"},Object(b.createElement)("a",{href:e.product_permalink,dangerouslySetInnerHTML:{__html:e.product_name}}))}(n),i&&function(e){var t=e.reviewer,r=void 0===t?"":t;return Object(b.createElement)("div",{className:"kkart-block-review-list-item__author kkart-block-components-review-list-item__author"},r)}(n),c&&function(e){var t=e.date_created,r=e.formatted_date_created;return Object(b.createElement)("time",{className:"kkart-block-review-list-item__published-date kkart-block-components-review-list-item__published-date",dateTime:t},r)}(n))),u&&function(e){return Object(b.createElement)(H,{maxLines:10,moreText:Object(f.__)("Read full review",'kkart'),lessText:Object(f.__)("Hide full review",'kkart'),className:"kkart-block-review-list-item__text kkart-block-components-review-list-item__text"},Object(b.createElement)("div",{dangerouslySetInnerHTML:{__html:e.review||""}}))}(n))};r(256);function z(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function F(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?z(Object(r),!0).forEach((function(t){R()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):z(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var U=function(e){var t=e.attributes,r=e.reviews,n=(m.Q||"product"===t.imageType)&&t.showReviewImage,o=m.K&&t.showReviewRating,c=F(F({},t),{},{showReviewImage:n,showReviewRating:o});return Object(b.createElement)("ul",{className:"kkart-block-review-list kkart-block-components-review-list"},0===r.length?Object(b.createElement)(V,{attributes:c}):r.map((function(e,t){return Object(b.createElement)(V,{key:e.id||t,attributes:c,review:e})})))},Q=r(10),W=r.n(Q),q=r(15),G=r.n(q),J=r(37),K=r.n(J),$=r(43),Y=r.n($),X=r(71),Z=r(44);function ee(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=p()(e);if(t){var o=p()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return l()(this,r)}}function te(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=p()(e);if(t){var o=p()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return l()(this,r)}}var re=function(e){var t=function(t){s()(n,t);var r=ee(n);function n(){var e;o()(this,n);for(var t=arguments.length,c=new Array(t),i=0;i<t;i++)c[i]=arguments[i];return e=r.call.apply(r,[this].concat(c)),R()(C()(e),"isPreview",!!e.props.attributes.previewReviews),R()(C()(e),"delayedAppendReviews",e.props.delayFunction(e.appendReviews)),R()(C()(e),"state",{error:null,loading:!0,reviews:e.isPreview?e.props.attributes.previewReviews:[],totalReviews:e.isPreview?e.props.attributes.previewReviews.length:0}),R()(C()(e),"setError",function(){var t=K()(G.a.mark((function t(r){var n,o;return G.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.props.onReviewsLoadError,t.next=3,Object(Z.a)(r);case 3:o=t.sent,e.setState({reviews:[],loading:!1,error:o}),n(o);case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),e}return i()(n,[{key:"componentDidMount",value:function(){this.replaceReviews()}},{key:"componentDidUpdate",value:function(e){e.reviewsToDisplay<this.props.reviewsToDisplay?this.delayedAppendReviews():this.shouldReplaceReviews(e,this.props)&&this.replaceReviews()}},{key:"shouldReplaceReviews",value:function(e,t){return e.orderby!==t.orderby||e.order!==t.order||e.productId!==t.productId||!Y()(e.categoryIds,t.categoryIds)}},{key:"componentWillUnMount",value:function(){this.delayedAppendReviews.cancel&&this.delayedAppendReviews.cancel()}},{key:"getArgs",value:function(e){var t=this.props,r=t.categoryIds,n=t.order,o=t.orderby,c=t.productId,i={order:n,orderby:o,per_page:t.reviewsToDisplay-e,offset:e};return r&&r.length&&(i.category_id=Array.isArray(r)?r.join(","):r),c&&(i.product_id=c),i}},{key:"replaceReviews",value:function(){if(!this.isPreview){var e=this.props.onReviewsReplaced;this.updateListOfReviews().then(e)}}},{key:"appendReviews",value:function(){if(!this.isPreview){var e=this.props,t=e.onReviewsAppended,r=e.reviewsToDisplay,n=this.state.reviews;r<=n.length||this.updateListOfReviews(n).then(t)}}},{key:"updateListOfReviews",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=this.props.reviewsToDisplay,n=this.state.totalReviews,o=Math.min(n,r)-t.length;return this.setState({loading:!0,reviews:t.concat(Array(o).fill({}))}),Object(X.c)(this.getArgs(t.length)).then((function(r){var n=r.reviews,o=r.totalReviews;return e.setState({reviews:t.filter((function(e){return Object.keys(e).length})).concat(n),totalReviews:o,loading:!1,error:null}),{newReviews:n}})).catch(this.setError)}},{key:"render",value:function(){var t=this.props.reviewsToDisplay,r=this.state,n=r.error,o=r.loading,c=r.reviews,i=r.totalReviews;return Object(b.createElement)(e,W()({},this.props,{error:n,isLoading:o,reviews:c.slice(0,t),totalReviews:i}))}}]),n}(g.Component);R()(t,"defaultProps",{delayFunction:function(e){return e},onReviewsAppended:function(){},onReviewsLoadError:function(){},onReviewsReplaced:function(){}});var r=e.displayName,n=void 0===r?e.name||"Component":r;return t.displayName="WithReviews( ".concat(n," )"),t}(function(e){s()(r,e);var t=te(r);function r(){return o()(this,r),t.apply(this,arguments)}return i()(r,[{key:"render",value:function(){var e=this.props,t=e.attributes,r=e.error,n=e.isLoading,o=e.noReviewsPlaceholder,c=e.reviews,i=e.totalReviews;return r?Object(b.createElement)(h.a,{className:"kkart-block-featured-product-error",error:r,isLoading:n}):0!==c.length||n?Object(b.createElement)(w.Disabled,null,t.showOrderby&&m.K&&Object(b.createElement)(k,{readOnly:!0,value:t.orderby}),Object(b.createElement)(U,{attributes:t,reviews:c}),t.showLoadMore&&i>c.length&&Object(b.createElement)(y,{screenReaderLabel:Object(f.__)("Load more reviews",'kkart')})):Object(b.createElement)(o,{attributes:t})}}]),r}(g.Component));function ne(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=p()(e);if(t){var o=p()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return l()(this,r)}}var oe=function(e){s()(r,e);var t=ne(r);function r(){return o()(this,r),t.apply(this,arguments)}return i()(r,[{key:"renderHiddenContentPlaceholder",value:function(){var e=this.props,t=e.icon,r=e.name;return Object(b.createElement)(w.Placeholder,{icon:t,label:r},Object(f.__)("The content for this block is hidden due to block settings.",'kkart'))}},{key:"render",value:function(){var e=this.props,t=e.attributes,r=e.noReviewsPlaceholder,n=t.categoryIds,o=t.productId,c=t.reviewsOnPageLoad,i=t.showProductName,a=t.showReviewDate,s=t.showReviewerName,u=t.showReviewContent,l=t.showReviewImage,d=t.showReviewRating,p=Object(X.d)(t.orderby),f=p.order,g=p.orderby;return!(u||d||a||s||l||i)?this.renderHiddenContentPlaceholder():Object(b.createElement)("div",{className:Object(X.a)(t)},Object(b.createElement)(re,{attributes:t,categoryIds:n,delayFunction:function(e){return Object(v.debounce)(e,400)},noReviewsPlaceholder:r,orderby:g,order:f,productId:o,reviewsToDisplay:c}))}}]),r}(g.Component);t.a=oe},200:function(e,t){},201:function(e,t){},202:function(e,t){},255:function(e,t){},256:function(e,t){},257:function(e,t){},258:function(e,t){},26:function(e,t){!function(){e.exports=this.wp.compose}()},3:function(e,t){!function(){e.exports=this.kkart.wcSettings}()},302:function(e,t,r){"use strict";var n=r(10),o=r.n(n),c=r(15),i=r.n(c),a=r(37),s=r.n(a),u=r(22),l=r.n(u),d=r(25),p=r.n(d),b=r(19),f=r.n(b),g=r(23),v=r.n(g),w=r(24),m=r.n(w),h=r(12),O=r.n(h),j=r(0),y=r(6),_=r(26),k=(r(2),r(5)),E=r(40),R=r(44);function P(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=O()(e);if(t){var o=O()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return m()(this,r)}}var S=Object(_.createHigherOrderComponent)((function(e){var t=function(t){v()(c,t);var r,n=P(c);function c(){var e;return l()(this,c),(e=n.apply(this,arguments)).state={list:[],loading:!0},e.setError=e.setError.bind(f()(e)),e.debouncedOnSearch=Object(y.debounce)(e.onSearch.bind(f()(e)),400),e}return p()(c,[{key:"componentDidMount",value:function(){var e=this,t=this.props.selected;Object(E.h)({selected:t}).then((function(t){e.setState({list:t,loading:!1})})).catch(this.setError)}},{key:"componentWillUnmount",value:function(){this.debouncedOnSearch.cancel()}},{key:"onSearch",value:function(e){var t=this,r=this.props.selected;Object(E.h)({selected:r,search:e}).then((function(e){t.setState({list:e,loading:!1})})).catch(this.setError)}},{key:"setError",value:(r=s()(i.a.mark((function e(t){var r;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(R.a)(t);case 2:r=e.sent,this.setState({list:[],loading:!1,error:r});case 4:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"render",value:function(){var t=this,r=this.state,n=r.error,c=r.list,i=r.loading;return Object(j.createElement)(e,o()({},this.props,{error:n,products:c,isLoading:i,onSearch:k.v?function(e){t.setState({loading:!0}),t.debouncedOnSearch(e)}:null}))}}]),c}(j.Component);return t.defaultProps={selected:[]},t}),"withSearchedProducts");t.a=S},305:function(e,t,r){"use strict";var n=r(0),o=r(57),c=Object(n.createElement)(o.a,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(n.createElement)("path",{d:"M21.99 4c0-1.1-.89-2-1.99-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h14l4 4-.01-18zM20 4v13.17L18.83 16H4V4h16zM6 12h12v2H6zm0-3h12v2H6zm0-3h12v2H6z"}));t.a=c},33:function(e,t){!function(){e.exports=this.wp.htmlEntities}()},35:function(e,t){!function(){e.exports=this.moment}()},4:function(e,t){!function(){e.exports=this.wp.components}()},40:function(e,t,r){"use strict";r.d(t,"h",(function(){return p})),r.d(t,"e",(function(){return b})),r.d(t,"b",(function(){return f})),r.d(t,"i",(function(){return g})),r.d(t,"f",(function(){return v})),r.d(t,"c",(function(){return w})),r.d(t,"d",(function(){return m})),r.d(t,"g",(function(){return h})),r.d(t,"a",(function(){return O}));var n=r(8),o=r.n(n),c=r(18),i=r(13),a=r.n(i),s=r(6),u=r(5);function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function d(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?l(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var p=function(e){var t=e.selected,r=void 0===t?[]:t,n=e.search,o=void 0===n?"":n,i=e.queryArgs,l=function(e){var t=e.selected,r=void 0===t?[]:t,n=e.search,o=void 0===n?"":n,i=e.queryArgs,a=void 0===i?[]:i,s={per_page:u.v?100:0,catalog_visibility:"any",search:o,orderby:"title",order:"asc"},l=[Object(c.addQueryArgs)("/kkart/store/products",d(d({},s),a))];return u.v&&r.length&&l.push(Object(c.addQueryArgs)("/kkart/store/products",{catalog_visibility:"any",include:r})),l}({selected:r,search:o,queryArgs:void 0===i?[]:i});return Promise.all(l.map((function(e){return a()({path:e})}))).then((function(e){return Object(s.uniqBy)(Object(s.flatten)(e),"id").map((function(e){return d(d({},e),{},{parent:0})}))})).catch((function(e){throw e}))},b=function(e){return a()({path:"/kkart/store/products/".concat(e)})},f=function(){return a()({path:"kkart/store/products/attributes"})},g=function(e){return a()({path:"kkart/store/products/attributes/".concat(e,"/terms")})},v=function(e){var t=e.selected,r=function(e){var t=e.selected,r=void 0===t?[]:t,n=e.search,o=[Object(c.addQueryArgs)("kkart/store/products/tags",{per_page:u.y?100:0,orderby:u.y?"count":"name",order:u.y?"desc":"asc",search:n})];return u.y&&r.length&&o.push(Object(c.addQueryArgs)("kkart/store/products/tags",{include:r})),o}({selected:void 0===t?[]:t,search:e.search});return Promise.all(r.map((function(e){return a()({path:e})}))).then((function(e){return Object(s.uniqBy)(Object(s.flatten)(e),"id")}))},w=function(e){return a()({path:Object(c.addQueryArgs)("kkart/store/products/categories",d({per_page:0},e))})},m=function(e){return a()({path:"kkart/store/products/categories/".concat(e)})},h=function(e){return a()({path:Object(c.addQueryArgs)("kkart/store/products",{per_page:0,type:"variation",parent:e})})},O=function(e,t){if(!e.title.raw)return e.slug;var r=1===t.filter((function(t){return t.title.raw===e.title.raw})).length;return e.title.raw+(r?"":" - ".concat(e.slug))}},43:function(e,t){!function(){e.exports=this.wp.isShallowEqual}()},44:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(15),o=r.n(n),c=r(37),i=r.n(c),a=function(){var e=i()(o.a.mark((function e(t){var r;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("function"!=typeof t.json){e.next=11;break}return e.prev=1,e.next=4,t.json();case 4:return r=e.sent,e.abrupt("return",{message:r.message,type:r.type||"api"});case 8:return e.prev=8,e.t0=e.catch(1),e.abrupt("return",{message:e.t0.message,type:"general"});case 11:return e.abrupt("return",{message:t.message,type:t.type||"general"});case 12:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t){return e.apply(this,arguments)}}()},47:function(e,t){!function(){e.exports=this.wp.escapeHtml}()},48:function(e,t,r){"use strict";var n=r(8),o=r.n(n),c=r(0),i=(r(2),r(9)),a=r(7),s=r.n(a);function u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}t.a=function(e){var t,r=e.label,n=e.screenReaderLabel,o=e.wrapperElement,a=e.wrapperProps,u=void 0===a?{}:a,d=null!=r,p=null!=n;return!d&&p?(t=o||"span",u=l(l({},u),{},{className:s()(u.className,"screen-reader-text")}),Object(c.createElement)(t,u,n)):(t=o||i.Fragment,d&&p&&r!==n?Object(c.createElement)(t,u,Object(c.createElement)("span",{"aria-hidden":"true"},r),Object(c.createElement)("span",{className:"screen-reader-text"},n)):Object(c.createElement)(t,u,r))}},49:function(e,t,r){"use strict";var n=r(0),o=r(1),c=(r(2),r(47));t.a=function(e){var t,r,i,a=e.error;return Object(n.createElement)("div",{className:"kkart-block-error-message"},(r=(t=a).message,i=t.type,r?"general"===i?Object(n.createElement)("span",null,Object(o.__)("The following error was returned",'kkart'),Object(n.createElement)("br",null),Object(n.createElement)("code",null,Object(c.escapeHTML)(r))):"api"===i?Object(n.createElement)("span",null,Object(o.__)("The following error was returned from the API",'kkart'),Object(n.createElement)("br",null),Object(n.createElement)("code",null,Object(c.escapeHTML)(r))):r:Object(o.__)("An unknown error occurred which prevented the block from being updated.",'kkart')))}},5:function(e,t,r){"use strict";r.d(t,"l",(function(){return o})),r.d(t,"K",(function(){return c})),r.d(t,"Q",(function(){return i})),r.d(t,"A",(function(){return a})),r.d(t,"C",(function(){return s})),r.d(t,"m",(function(){return u})),r.d(t,"B",(function(){return l})),r.d(t,"E",(function(){return d})),r.d(t,"o",(function(){return p})),r.d(t,"D",(function(){return b})),r.d(t,"n",(function(){return f})),r.d(t,"G",(function(){return g})),r.d(t,"v",(function(){return v})),r.d(t,"y",(function(){return w})),r.d(t,"s",(function(){return m})),r.d(t,"t",(function(){return h})),r.d(t,"u",(function(){return O})),r.d(t,"k",(function(){return j})),r.d(t,"M",(function(){return y})),r.d(t,"R",(function(){return _})),r.d(t,"q",(function(){return k})),r.d(t,"r",(function(){return E})),r.d(t,"p",(function(){return R})),r.d(t,"J",(function(){return P})),r.d(t,"c",(function(){return S})),r.d(t,"w",(function(){return x})),r.d(t,"x",(function(){return C})),r.d(t,"U",(function(){return N})),r.d(t,"V",(function(){return L})),r.d(t,"L",(function(){return I})),r.d(t,"a",(function(){return T})),r.d(t,"O",(function(){return M})),r.d(t,"b",(function(){return A})),r.d(t,"N",(function(){return B})),r.d(t,"F",(function(){return H})),r.d(t,"i",(function(){return V})),r.d(t,"P",(function(){return U})),r.d(t,"h",(function(){return Q})),r.d(t,"j",(function(){return W})),r.d(t,"I",(function(){return q})),r.d(t,"H",(function(){return G})),r.d(t,"T",(function(){return J})),r.d(t,"S",(function(){return K})),r.d(t,"d",(function(){return $})),r.d(t,"e",(function(){return Y})),r.d(t,"f",(function(){return X})),r.d(t,"g",(function(){return Z})),r.d(t,"z",(function(){return ee})),r.d(t,"Y",(function(){return re})),r.d(t,"Z",(function(){return ne})),r.d(t,"W",(function(){return oe})),r.d(t,"X",(function(){return ce}));var n=r(3),o=Object(n.getSetting)("currentUserIsAdmin",!1),c=Object(n.getSetting)("reviewRatingsEnabled",!0),i=Object(n.getSetting)("showAvatars",!0),a=Object(n.getSetting)("max_columns",6),s=Object(n.getSetting)("min_columns",1),u=Object(n.getSetting)("default_columns",3),l=Object(n.getSetting)("max_rows",6),d=Object(n.getSetting)("min_rows",1),p=Object(n.getSetting)("default_rows",3),b=Object(n.getSetting)("min_height",500),f=Object(n.getSetting)("default_height",500),g=Object(n.getSetting)("placeholderImgSrc",""),v=(Object(n.getSetting)("thumbnail_size",300),Object(n.getSetting)("isLargeCatalog")),w=Object(n.getSetting)("limitTags"),m=Object(n.getSetting)("hasProducts",!0),h=Object(n.getSetting)("hasTags",!0),O=Object(n.getSetting)("homeUrl",""),j=Object(n.getSetting)("couponsEnabled",!0),y=Object(n.getSetting)("shippingEnabled",!0),_=Object(n.getSetting)("taxesEnabled",!0),k=Object(n.getSetting)("displayItemizedTaxes",!1),E=Object(n.getSetting)("hasDarkEditorStyleSupport",!1),R=(Object(n.getSetting)("displayShopPricesIncludingTax",!1),Object(n.getSetting)("displayCartPricesIncludingTax",!1)),P=Object(n.getSetting)("productCount",0),S=Object(n.getSetting)("attributes",[]),x=Object(n.getSetting)("isShippingCalculatorEnabled",!0),C=Object(n.getSetting)("isShippingCostHidden",!1),D=Object(n.getSetting)("kkartBlocksPhase",1),N=Object(n.getSetting)("wcBlocksAssetUrl",""),L=Object(n.getSetting)("wcBlocksBuildUrl",""),I=Object(n.getSetting)("shippingCountries",{}),T=Object(n.getSetting)("allowedCountries",{}),M=Object(n.getSetting)("shippingStates",{}),A=Object(n.getSetting)("allowedStates",{}),B=Object(n.getSetting)("shippingMethodsExist",!1),H=Object(n.getSetting)("paymentGatewaySortOrder",[]),V=Object(n.getSetting)("checkoutShowLoginReminder",!0),z={id:0,title:"",permalink:""},F=Object(n.getSetting)("storePages",{shop:z,cart:z,checkout:z,privacy:z,terms:z}),U=F.shop.permalink,Q=F.checkout.id,W=F.checkout.permalink,q=F.privacy.permalink,G=F.privacy.title,J=F.terms.permalink,K=F.terms.title,$=F.cart.id,Y=F.cart.permalink,X=Object(n.getSetting)("checkoutAllowsGuest",!1),Z=Object(n.getSetting)("checkoutAllowsSignup",!1),ee=Object(n.getSetting)("loginUrl","/wp-login.php"),te=r(17),re=function(e,t){if(D>2)return Object(te.registerBlockType)(e,t)},ne=function(e,t){if(D>1)return Object(te.registerBlockType)(e,t)},oe=function(){return D>2},ce=function(){return D>1}},533:function(e,t,r){"use strict";var n=r(10),o=r.n(n),c=r(15),i=r.n(c),a=r(37),s=r.n(a),u=r(22),l=r.n(u),d=r(25),p=r.n(d),b=r(19),f=r.n(b),g=r(23),v=r.n(g),w=r(24),m=r.n(w),h=r(12),O=r.n(h),j=r(8),y=r.n(j),_=r(0),k=r(26),E=r(40),R=r(44);function P(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=O()(e);if(t){var o=O()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return m()(this,r)}}var S=Object(k.createHigherOrderComponent)((function(e){return function(t){v()(n,t);var r=P(n);function n(){var e;l()(this,n);for(var t=arguments.length,o=new Array(t),c=0;c<t;c++)o[c]=arguments[c];return e=r.call.apply(r,[this].concat(o)),y()(f()(e),"state",{error:null,loading:!1,product:"preview"===e.props.attributes.productId?e.props.attributes.previewProduct:null}),y()(f()(e),"loadProduct",(function(){var t=e.props.attributes.productId;"preview"!==t&&(t?(e.setState({loading:!0}),Object(E.e)(t).then((function(t){e.setState({product:t,loading:!1,error:null})})).catch(function(){var t=s()(i.a.mark((function t(r){var n;return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(R.a)(r);case 2:n=t.sent,e.setState({product:null,loading:!1,error:n});case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())):e.setState({product:null,loading:!1,error:null}))})),e}return p()(n,[{key:"componentDidMount",value:function(){this.loadProduct()}},{key:"componentDidUpdate",value:function(e){e.attributes.productId!==this.props.attributes.productId&&this.loadProduct()}},{key:"render",value:function(){var t=this.state,r=t.error,n=t.loading,c=t.product;return Object(_.createElement)(e,o()({},this.props,{error:r,getProduct:this.loadProduct,isLoading:n,product:c}))}}]),n}(_.Component)}),"withProduct");t.a=S},54:function(e,t){!function(){e.exports=this.wp.keycodes}()},6:function(e,t){!function(){e.exports=this.lodash}()},61:function(e,t,r){"use strict";var n=r(8),o=r.n(n),c=r(27),i=r.n(c),a=r(9);r(2);function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}t.a=function(e){var t=e.srcElement,r=e.size,n=void 0===r?24:r,c=i()(e,["srcElement","size"]);return Object(a.isValidElement)(t)&&Object(a.cloneElement)(t,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({width:n,height:n},c))}},71:function(e,t,r){"use strict";r.d(t,"d",(function(){return s})),r.d(t,"c",(function(){return u})),r.d(t,"a",(function(){return l})),r.d(t,"b",(function(){return d}));var n=r(13),o=r.n(n),c=r(7),i=r.n(c),a=r(5),s=function(e){if(a.K){if("lowest-rating"===e)return{order:"asc",orderby:"rating"};if("highest-rating"===e)return{order:"desc",orderby:"rating"}}return{order:"desc",orderby:"date_gmt"}},u=function(e){return o()({path:"/kkart/store/products/reviews?"+Object.entries(e).map((function(e){return e.join("=")})).join("&"),parse:!1}).then((function(e){return e.json().then((function(t){return{reviews:t,totalReviews:parseInt(e.headers.get("x-wp-total"),10)}}))}))},l=function(e){var t=e.className,r=e.categoryIds,n=e.productId,o=e.showReviewDate,c=e.showReviewerName,a=e.showReviewContent,s=e.showProductName,u=e.showReviewImage,l=e.showReviewRating,d="kkart-block-all-reviews";return n&&(d="kkart-block-reviews-by-product"),Array.isArray(r)&&(d="kkart-block-reviews-by-category"),i()(d,t,{"has-image":u,"has-name":c,"has-date":o,"has-rating":l,"has-content":a,"has-product-name":s})},d=function(e){var t=e.categoryIds,r=e.imageType,n=e.orderby,o=e.productId,c={"data-image-type":r,"data-orderby":n,"data-reviews-on-page-load":e.reviewsOnPageLoad,"data-reviews-on-load-more":e.reviewsOnLoadMore,"data-show-load-more":e.showLoadMore,"data-show-orderby":e.showOrderby};return o&&(c["data-product-id"]=o),Array.isArray(t)&&(c["data-category-ids"]=t.join(",")),c}},74:function(e,t,r){"use strict";var n=r(10),o=r.n(n),c=r(22),i=r.n(c),a=r(25),s=r.n(a),u=r(19),l=r.n(u),d=r(23),p=r.n(d),b=r(24),f=r.n(b),g=r(12),v=r.n(g),w=r(0),m=r(6),h=r(7),O=r.n(h),j=r(4),y=r(26);r(122);function _(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=v()(e);if(t){var o=v()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return f()(this,r)}}var k=function(e){p()(r,e);var t=_(r);function r(){var e;return i()(this,r),(e=t.apply(this,arguments)).onClick=e.onClick.bind(l()(e)),e}return s()(r,[{key:"onClick",value:function(e){this.props.onChange&&this.props.onChange(e.target.value)}},{key:"render",value:function(){var e,t=this,r=this.props,n=r.label,c=r.checked,i=r.instanceId,a=r.className,s=r.help,u=r.options,l=r.value,d="inspector-toggle-button-control-".concat(i);return s&&(e=Object(m.isFunction)(s)?s(c):s),Object(w.createElement)(j.BaseControl,{id:d,help:e,className:O()("components-toggle-button-control",a)},Object(w.createElement)("label",{id:d+"__label",htmlFor:d,className:"components-toggle-button-control__label"},n),Object(w.createElement)(j.ButtonGroup,{"aria-labelledby":d+"__label"},u.map((function(e,r){var c={};return l===e.value?(c.isPrimary=!0,c["aria-pressed"]=!0):(c.isDefault=!0,c["aria-pressed"]=!1),Object(w.createElement)(j.Button,o()({key:"".concat(e.label,"-").concat(e.value,"-").concat(r),value:e.value,onClick:t.onClick,"aria-label":n+": "+e.label},c),e.label)}))))}}]),r}(w.Component);t.a=Object(y.withInstanceId)(k)},75:function(e,t){!function(){e.exports=this.wp.hooks}()},77:function(e,t){!function(){e.exports=this.ReactDOM}()},78:function(e,t){!function(){e.exports=this.wp.dom}()},829:function(e,t,r){e.exports=r(922)},83:function(e,t){!function(){e.exports=this.wp.viewport}()},9:function(e,t){!function(){e.exports=this.React}()},922:function(e,t,r){"use strict";r.r(t);var n=r(8),o=r.n(n),c=r(0),i=r(1),a=r(17),s=r(61),u=r(305),l=(r(201),r(10)),d=r.n(l),p=r(14),b=r(4),f=r(50),g=(r(2),r(143)),v=r(188),w=r(93),m=r(533),h=Object(m.a)((function(e){var t=e.error,r=e.getProduct,n=e.isLoading,o=e.product;if(t)return Object(c.createElement)(w.a,{className:"kkart-block-featured-product-error",error:t,isLoading:n,onRetry:r});var a=!o||n?Object(c.createElement)(b.Spinner,null):Object(i.sprintf)(Object(i.__)("This block lists reviews for a selected product. %s doesn't have any reviews yet, but they will show up here when it does.",'kkart'),o.name);return Object(c.createElement)(b.Placeholder,{className:"kkart-block-reviews-by-product",icon:Object(c.createElement)(s.a,{srcElement:u.a,className:"block-editor-block-icon"}),label:Object(i.__)("Reviews by Product",'kkart')},a)})),O=r(137),j=Object(b.withSpokenMessages)((function(e){var t=e.attributes,r=e.debouncedSpeak,n=e.setAttributes,o=t.editMode,a=t.productId,l=function(e){var t=e.item,r=void 0===t?0:t;return Object(c.createElement)(f.b,d()({},e,{countLabel:Object(i.sprintf)(Object(i._n)("%d Review","%d Reviews",r.review_count,'kkart'),r.review_count),showCount:!0,"aria-label":Object(i.sprintf)(Object(i._n)("%1$s, has %2$d review","%1$s, has %2$d reviews",r.review_count,'kkart'),r.name,r.review_count)}))};return!a||o?Object(c.createElement)(b.Placeholder,{icon:Object(c.createElement)(s.a,{icon:u.a,className:"block-editor-block-icon"}),label:Object(i.__)("Reviews by Product",'kkart'),className:"kkart-block-reviews-by-product"},Object(i.__)("Show reviews of your product to build trust",'kkart'),Object(c.createElement)("div",{className:"kkart-block-reviews__selection"},Object(c.createElement)(g.a,{selected:t.productId||0,onChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=e[0]?e[0].id:0;n({productId:t})},queryArgs:{orderby:"comment_count",order:"desc"},renderItem:l}),Object(c.createElement)(b.Button,{isPrimary:!0,onClick:function(){n({editMode:!1}),r(Object(i.__)("Showing Reviews by Product block preview.",'kkart'))}},Object(i.__)("Done",'kkart')))):Object(c.createElement)(c.Fragment,null,Object(O.a)(o,n),Object(c.createElement)(p.InspectorControls,{key:"inspector"},Object(c.createElement)(b.PanelBody,{title:Object(i.__)("Product",'kkart'),initialOpen:!1},Object(c.createElement)(g.a,{selected:t.productId||0,onChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=e[0]?e[0].id:0;n({productId:t})},renderItem:l})),Object(c.createElement)(b.PanelBody,{title:Object(i.__)("Content",'kkart')},Object(O.b)(t,n)),Object(c.createElement)(b.PanelBody,{title:Object(i.__)("List Settings",'kkart')},Object(O.c)(t,n))),Object(c.createElement)(v.a,{attributes:t,icon:Object(c.createElement)(s.a,{icon:u.a,className:"block-editor-block-icon"}),name:Object(i.__)("Reviews by Product",'kkart'),noReviewsPlaceholder:h}))})),y=r(182),_=r(183),k=r(157);function E(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function R(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?E(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):E(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}Object(a.registerBlockType)("kkart/reviews-by-product",{title:Object(i.__)("Reviews by Product",'kkart'),icon:{src:Object(c.createElement)(s.a,{srcElement:u.a}),foreground:"#96588a"},category:"kkart",keywords:[Object(i.__)("Kkart",'kkart')],description:Object(i.__)("Show reviews of your products to build trust.",'kkart'),supports:{html:!1},example:R(R({},k.a),{},{attributes:R(R({},k.a.attributes),{},{productId:1})}),attributes:R(R({},y.a),{},{productId:{type:"number"}}),edit:function(e){return Object(c.createElement)(j,e)},save:_.a})},93:function(e,t,r){"use strict";var n=r(0),o=r(1),c=(r(2),r(61)),i=r(144),a=r(7),s=r.n(a),u=r(4),l=r(49);r(147);t.a=function(e){var t=e.className,r=e.error,a=e.isLoading,d=e.onRetry;return Object(n.createElement)(u.Placeholder,{icon:Object(n.createElement)(c.a,{srcElement:i.a}),label:Object(o.__)("Sorry, an error occurred",'kkart'),className:s()("kkart-block-api-error",t)},Object(n.createElement)(l.a,{error:r}),d&&Object(n.createElement)(n.Fragment,null,a?Object(n.createElement)(u.Spinner,null):Object(n.createElement)(u.Button,{isDefault:!0,onClick:d},Object(o.__)("Retry",'kkart'))))}},94:function(e,t){!function(){e.exports=this.wp.date}()}});