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gBACb,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;gBACtB,IAAI,CAAC,KAAK,EAAE,CAAC;gBACb,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;aAC1C,GACD,CACH,CACG,CACI,EACZ;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/controllers/dashboard/sc-cancel-dialog/sc-cancel-dialog.scss?tag=sc-cancel-dialog&encapsulation=shadow","src/components/controllers/dashboard/sc-cancel-dialog/sc-cancel-dialog.tsx"],"sourcesContent":[":host {\n display: block;\n font-size: var(--sc-font-size-medium);\n}\n\n\n.close__button {\n position: absolute;\n top: 0;\n right: 0;\n font-size: 22px;\n}\n","import { Component, Event, EventEmitter, h, Prop, State } from '@stencil/core';\nimport { __ } from '@wordpress/i18n';\nimport apiFetch from '../../../../functions/fetch';\n\nimport { CancellationReason, Subscription, SubscriptionProtocol } from '../../../../types';\n\n@Component({\n tag: 'sc-cancel-dialog',\n styleUrl: 'sc-cancel-dialog.scss',\n shadow: true,\n})\nexport class ScCancelDialog {\n @Prop() open: boolean;\n @Prop() protocol: SubscriptionProtocol;\n @Prop() subscription: Subscription;\n @State() reasons: CancellationReason[];\n @State() reason: CancellationReason;\n @State() step: 'cancel' | 'survey' | 'discount' | 'discount-complete' = 'cancel';\n @State() comment: string;\n @Event({ cancelable: true }) scRequestClose: EventEmitter<'close-button' | 'keyboard' | 'overlay'>;\n @Event() scRefresh: EventEmitter<void>;\n\n close() {\n this.reset();\n this.trackAttempt();\n this.scRequestClose.emit('close-button');\n }\n\n reset() {\n this.reason = null;\n this.step = this.protocol?.preservation_enabled ? 'survey' : 'cancel';\n }\n\n async trackAttempt() {\n if (!this.protocol?.preservation_enabled) return;\n await apiFetch({\n method: 'PATCH',\n path: `surecart/v1/subscriptions/${this.subscription?.id}/preserve`,\n });\n }\n\n componentWillLoad() {\n this.reset();\n }\n\n render() {\n return (\n <sc-dialog\n style={{\n '--width': this.step === 'survey' ? '675px' : '500px',\n '--body-spacing': 'var(--sc-spacing-xxx-large)',\n }}\n noHeader\n open={this.open}\n onScRequestClose={() => this.close()}\n >\n <div\n class={{\n cancel: true,\n }}\n >\n <sc-button class=\"close__button\" type=\"text\" circle onClick={() => this.close()}>\n <sc-icon name=\"x\" />\n </sc-button>\n\n {this.step === 'cancel' && (\n <sc-subscription-cancel\n subscription={this.subscription}\n protocol={this.protocol}\n reason={this.reason}\n comment={this.comment}\n onScAbandon={() => this.close()}\n onScCancelled={() => {\n this.scRefresh.emit();\n this.reset();\n this.scRequestClose.emit('close-button');\n }}\n >\n <slot name=\"cancel-popup-content\" slot=\"cancel-popup-content\" />\n </sc-subscription-cancel>\n )}\n\n {this.step === 'survey' && (\n <sc-cancel-survey\n protocol={this.protocol}\n onScAbandon={() => this.close()}\n onScSubmitReason={e => {\n const { comment, reason } = e.detail;\n this.reason = reason;\n this.comment = comment;\n this.step = reason?.coupon_enabled ? 'discount' : 'cancel';\n }}\n />\n )}\n\n {this.step === 'discount' && (\n <sc-cancel-discount\n protocol={this.protocol}\n subscription={this.subscription}\n reason={this.reason}\n comment={this.comment}\n onScCancel={() => (this.step = 'cancel')}\n onScPreserved={() => {\n this.scRefresh.emit();\n this.reset();\n this.scRequestClose.emit('close-button');\n }}\n />\n )}\n </div>\n </sc-dialog>\n );\n }\n}\n"],"version":3}