FileMaster
Search
Toggle Dark Mode
Home
/
.
/
wp-content
/
plugins
/
surecart
/
dist
/
components
/
components
Edit File: sc-cancel-dialog2.js
import{proxyCustomElement,HTMLElement,createEvent,h}from"@stencil/core/internal/client";import{a as apiFetch}from"./fetch.js";import{d as defineCustomElement$i}from"./sc-alert2.js";import{d as defineCustomElement$h}from"./sc-block-ui2.js";import{d as defineCustomElement$g}from"./sc-button2.js";import{d as defineCustomElement$f}from"./sc-cancel-discount2.js";import{d as defineCustomElement$e}from"./sc-cancel-survey2.js";import{d as defineCustomElement$d}from"./sc-choice2.js";import{d as defineCustomElement$c}from"./sc-choices2.js";import{d as defineCustomElement$b}from"./sc-dashboard-module2.js";import{d as defineCustomElement$a}from"./sc-dialog2.js";import{d as defineCustomElement$9}from"./sc-flex2.js";import{d as defineCustomElement$8}from"./sc-form2.js";import{d as defineCustomElement$7}from"./sc-form-control2.js";import{d as defineCustomElement$6}from"./sc-icon2.js";import{d as defineCustomElement$5}from"./sc-skeleton2.js";import{d as defineCustomElement$4}from"./sc-spinner2.js";import{d as defineCustomElement$3}from"./sc-subscription-cancel2.js";import{d as defineCustomElement$2}from"./sc-textarea2.js";import{d as defineCustomElement$1}from"./sc-visually-hidden2.js";const scCancelDialogCss=":host{display:block;font-size:var(--sc-font-size-medium)}.close__button{position:absolute;top:0;right:0;font-size:22px}",ScCancelDialogStyle0=scCancelDialogCss,ScCancelDialog=proxyCustomElement(class extends HTMLElement{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.scRequestClose=createEvent(this,"scRequestClose",7),this.scRefresh=createEvent(this,"scRefresh",7),this.open=void 0,this.protocol=void 0,this.subscription=void 0,this.reasons=void 0,this.reason=void 0,this.step="cancel",this.comment=void 0}close(){this.reset(),this.trackAttempt(),this.scRequestClose.emit("close-button")}reset(){var e;this.reason=null,this.step=(null===(e=this.protocol)||void 0===e?void 0:e.preservation_enabled)?"survey":"cancel"}async trackAttempt(){var e,s;(null===(e=this.protocol)||void 0===e?void 0:e.preservation_enabled)&&await apiFetch({method:"PATCH",path:`surecart/v1/subscriptions/${null===(s=this.subscription)||void 0===s?void 0:s.id}/preserve`})}componentWillLoad(){this.reset()}render(){return h("sc-dialog",{key:"6eaf232211319195dcf4dbcb0ff88d051926b9d4",style:{"--width":"survey"===this.step?"675px":"500px","--body-spacing":"var(--sc-spacing-xxx-large)"},noHeader:!0,open:this.open,onScRequestClose:()=>this.close()},h("div",{key:"43bf9d9266ef39b10c065915681ff66c17654e29",class:{cancel:!0}},h("sc-button",{key:"f4960b5bb3d4fae0157cd22e7fbc943daadd5471",class:"close__button",type:"text",circle:!0,onClick:()=>this.close()},h("sc-icon",{key:"022f6a05319958949e16f15327fa4a8274ac3436",name:"x"})),"cancel"===this.step&&h("sc-subscription-cancel",{key:"a569401486d467227d0e15e1b5d6f3031da1f1dd",subscription:this.subscription,protocol:this.protocol,reason:this.reason,comment:this.comment,onScAbandon:()=>this.close(),onScCancelled:()=>{this.scRefresh.emit(),this.reset(),this.scRequestClose.emit("close-button")}},h("slot",{key:"f9418cf8864463592dfcb9943ce8d168d8134897",name:"cancel-popup-content",slot:"cancel-popup-content"})),"survey"===this.step&&h("sc-cancel-survey",{key:"8824ba51fdbde1506ed8e170d731a40324288ce9",protocol:this.protocol,onScAbandon:()=>this.close(),onScSubmitReason:e=>{const{comment:s,reason:t}=e.detail;this.reason=t,this.comment=s,this.step=(null==t?void 0:t.coupon_enabled)?"discount":"cancel"}}),"discount"===this.step&&h("sc-cancel-discount",{key:"665e984a5743247c548a0bc5ee665eb29fe7ecf8",protocol:this.protocol,subscription:this.subscription,reason:this.reason,comment:this.comment,onScCancel:()=>this.step="cancel",onScPreserved:()=>{this.scRefresh.emit(),this.reset(),this.scRequestClose.emit("close-button")}})))}static get style(){return ScCancelDialogStyle0}},[1,"sc-cancel-dialog",{open:[4],protocol:[16],subscription:[16],reasons:[32],reason:[32],step:[32],comment:[32]}]);function defineCustomElement(){"undefined"!=typeof customElements&&["sc-cancel-dialog","sc-alert","sc-block-ui","sc-button","sc-cancel-discount","sc-cancel-survey","sc-choice","sc-choices","sc-dashboard-module","sc-dialog","sc-flex","sc-form","sc-form-control","sc-icon","sc-skeleton","sc-spinner","sc-subscription-cancel","sc-textarea","sc-visually-hidden"].forEach((e=>{switch(e){case"sc-cancel-dialog":customElements.get(e)||customElements.define(e,ScCancelDialog);break;case"sc-alert":customElements.get(e)||defineCustomElement$i();break;case"sc-block-ui":customElements.get(e)||defineCustomElement$h();break;case"sc-button":customElements.get(e)||defineCustomElement$g();break;case"sc-cancel-discount":customElements.get(e)||defineCustomElement$f();break;case"sc-cancel-survey":customElements.get(e)||defineCustomElement$e();break;case"sc-choice":customElements.get(e)||defineCustomElement$d();break;case"sc-choices":customElements.get(e)||defineCustomElement$c();break;case"sc-dashboard-module":customElements.get(e)||defineCustomElement$b();break;case"sc-dialog":customElements.get(e)||defineCustomElement$a();break;case"sc-flex":customElements.get(e)||defineCustomElement$9();break;case"sc-form":customElements.get(e)||defineCustomElement$8();break;case"sc-form-control":customElements.get(e)||defineCustomElement$7();break;case"sc-icon":customElements.get(e)||defineCustomElement$6();break;case"sc-skeleton":customElements.get(e)||defineCustomElement$5();break;case"sc-spinner":customElements.get(e)||defineCustomElement$4();break;case"sc-subscription-cancel":customElements.get(e)||defineCustomElement$3();break;case"sc-textarea":customElements.get(e)||defineCustomElement$2();break;case"sc-visually-hidden":customElements.get(e)||defineCustomElement$1()}}))}export{ScCancelDialog as S,defineCustomElement as d};
Save
Back