import{h}from"@stencil/core";import{__}from"@wordpress/i18n";import{state as checkoutState}from"../../../../store/checkout/index";export class ScOrderBumps{constructor(){this.label=void 0,this.help=void 0,this.showControl=void 0,this.hideAddedItems=void 0}isBumpAdded(e){var t,o;return((null===(o=null===(t=null==checkoutState?void 0:checkoutState.checkout)||void 0===t?void 0:t.line_items)||void 0===o?void 0:o.data)||[]).some((t=>(null==t?void 0:t.bump)===e))}render(){var e,t;const o=((null===(t=null===(e=null==checkoutState?void 0:checkoutState.checkout)||void 0===e?void 0:e.recommended_bumps)||void 0===t?void 0:t.data)||[]).filter((e=>{var t,o,r,i;return!(0!==(null===(i=null===(r=null===(o=null===(t=null==e?void 0:e.price)||void 0===t?void 0:t.product)||void 0===o?void 0:o.variants)||void 0===r?void 0:r.pagination)||void 0===i?void 0:i.count)||this.hideAddedItems&&this.isBumpAdded(null==e?void 0:e.id))}));return(null==o?void 0:o.length)?h("sc-form-control",{label:this.label||__("Recommended","surecart"),help:this.help},h("div",{class:"bumps__list","aria-label":__("Order bump summary","surecart")},o.map((e=>h("sc-order-bump",{key:null==e?void 0:e.id,bump:e,showControl:this.showControl,exportparts:"choice__base, choice__content, base-content, image, text, title, cta, amount, price, tag, description, button, base, control, checked-icon"}))))):null}static get is(){return"sc-order-bumps"}static get encapsulation(){return"shadow"}static get originalStyleUrls(){return{$:["sc-order-bumps.scss"]}}static get styleUrls(){return{$:["sc-order-bumps.css"]}}static get properties(){return{label:{type:"string",mutable:!1,complexType:{original:"string",resolved:"string",references:{}},required:!1,optional:!1,docs:{tags:[],text:""},attribute:"label",reflect:!1},help:{type:"string",mutable:!1,complexType:{original:"string",resolved:"string",references:{}},required:!1,optional:!1,docs:{tags:[],text:""},attribute:"help",reflect:!1},showControl:{type:"boolean",mutable:!1,complexType:{original:"boolean",resolved:"boolean",references:{}},required:!1,optional:!1,docs:{tags:[],text:"Should we show the controls (classic design)"},attribute:"show-control",reflect:!1},hideAddedItems:{type:"boolean",mutable:!1,complexType:{original:"boolean",resolved:"boolean",references:{}},required:!1,optional:!1,docs:{tags:[],text:"Hide bumps that have already been added to the checkout."},attribute:"hide-added-items",reflect:!1}}}}