2021-05-17 18:14:38 +03:00
|
|
|
import ModalBase from 'ghost-admin/components/modal-base';
|
|
|
|
import classic from 'ember-classic-decorator';
|
|
|
|
import {action} from '@ember/object';
|
|
|
|
import {inject as service} from '@ember/service';
|
|
|
|
|
|
|
|
// TODO: update modals to work fully with Glimmer components
|
|
|
|
@classic
|
|
|
|
export default class ModalStripeConnect extends ModalBase {
|
|
|
|
@service settings;
|
|
|
|
|
|
|
|
@action
|
|
|
|
setStripeConnectIntegrationTokenSetting(stripeConnectIntegrationToken) {
|
|
|
|
this.settings.set('stripeConnectIntegrationToken', stripeConnectIntegrationToken);
|
|
|
|
}
|
2021-05-20 19:20:49 +03:00
|
|
|
|
2021-05-21 10:56:55 +03:00
|
|
|
@action
|
|
|
|
reset() {
|
|
|
|
// stripeConnectIntegrationToken is not a persisted value so we don't want
|
|
|
|
// to keep it around across transitions
|
|
|
|
this.settings.set('stripeConnectIntegrationToken', undefined);
|
|
|
|
}
|
|
|
|
|
2021-05-20 19:20:49 +03:00
|
|
|
@action
|
|
|
|
updateSuccessModifier() {
|
|
|
|
if (this.settings.get('stripeConnectAccountId')) {
|
|
|
|
if (this.modifier?.indexOf('stripe-connected') === -1) {
|
|
|
|
this.updateModifier(`${this.modifier} stripe-connected`);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (this.modifier?.indexOf('stripe-connected') !== -1) {
|
|
|
|
this.updateModifier(this.modifier.replace(/\s?stripe-connected/, ''));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-05-17 18:14:38 +03:00
|
|
|
}
|