2021-03-29 14:49:09 +03:00
|
|
|
import Controller from '@ember/controller';
|
2021-05-19 17:26:45 +03:00
|
|
|
import envConfig from 'ghost-admin/config/environment';
|
2021-03-29 14:49:09 +03:00
|
|
|
import {action} from '@ember/object';
|
2021-05-18 11:11:22 +03:00
|
|
|
import {currencies, getCurrencyOptions, getSymbol} from 'ghost-admin/utils/currency';
|
2021-03-29 14:49:09 +03:00
|
|
|
import {inject as service} from '@ember/service';
|
|
|
|
import {task} from 'ember-concurrency-decorators';
|
|
|
|
import {tracked} from '@glimmer/tracking';
|
|
|
|
|
2021-05-18 11:11:22 +03:00
|
|
|
const CURRENCIES = currencies.map((currency) => {
|
|
|
|
return {
|
|
|
|
value: currency.isoCode.toLowerCase(),
|
|
|
|
label: `${currency.isoCode} - ${currency.name}`,
|
|
|
|
isoCode: currency.isoCode
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2021-03-29 14:49:09 +03:00
|
|
|
export default class MembersAccessController extends Controller {
|
2021-05-18 15:59:47 +03:00
|
|
|
@service config;
|
2021-06-22 11:48:59 +03:00
|
|
|
@service feature;
|
2021-05-18 15:59:47 +03:00
|
|
|
@service membersUtils;
|
2021-03-29 14:49:09 +03:00
|
|
|
@service settings;
|
2021-05-17 17:29:07 +03:00
|
|
|
@service store;
|
2021-08-17 12:54:12 +03:00
|
|
|
@service session;
|
2021-03-29 14:49:09 +03:00
|
|
|
|
2021-05-17 14:40:08 +03:00
|
|
|
@tracked showLeavePortalModal = false;
|
|
|
|
@tracked showLeaveRouteModal = false;
|
2021-05-17 10:58:15 +03:00
|
|
|
@tracked showPortalSettings = false;
|
2021-05-17 18:14:38 +03:00
|
|
|
@tracked showStripeConnect = false;
|
2021-06-04 10:42:52 +03:00
|
|
|
@tracked showProductModal = false;
|
2021-05-17 10:58:15 +03:00
|
|
|
|
2021-05-17 17:29:07 +03:00
|
|
|
@tracked product = null;
|
2021-06-04 10:42:52 +03:00
|
|
|
@tracked products = null;
|
|
|
|
@tracked productModel = null;
|
2021-05-17 17:29:07 +03:00
|
|
|
@tracked paidSignupRedirect;
|
|
|
|
@tracked freeSignupRedirect;
|
|
|
|
@tracked stripeMonthlyAmount = 5;
|
|
|
|
@tracked stripeYearlyAmount = 50;
|
|
|
|
@tracked currency = 'usd';
|
|
|
|
@tracked stripePlanError = '';
|
|
|
|
|
2021-05-18 15:59:47 +03:00
|
|
|
@tracked portalPreviewUrl = '';
|
2021-05-24 21:29:18 +03:00
|
|
|
|
|
|
|
portalPreviewGuid = Date.now().valueOf();
|
2021-05-18 15:59:47 +03:00
|
|
|
|
2021-05-17 10:58:15 +03:00
|
|
|
queryParams = ['showPortalSettings'];
|
2021-03-29 14:49:09 +03:00
|
|
|
|
2022-01-17 21:53:43 +03:00
|
|
|
get freeProduct() {
|
|
|
|
return this.products?.find(product => product.type === 'free');
|
|
|
|
}
|
|
|
|
|
|
|
|
get paidProducts() {
|
|
|
|
return this.products?.filter(product => product.type === 'paid');
|
|
|
|
}
|
|
|
|
|
2021-05-18 16:42:37 +03:00
|
|
|
get allCurrencies() {
|
|
|
|
return getCurrencyOptions();
|
|
|
|
}
|
2021-05-17 17:29:07 +03:00
|
|
|
|
2021-05-18 16:42:37 +03:00
|
|
|
get siteUrl() {
|
|
|
|
return this.config.get('blogUrl');
|
2021-05-17 17:29:07 +03:00
|
|
|
}
|
|
|
|
|
2021-05-18 11:11:22 +03:00
|
|
|
get selectedCurrency() {
|
|
|
|
return CURRENCIES.findBy('value', this.currency);
|
|
|
|
}
|
|
|
|
|
2021-05-19 17:26:45 +03:00
|
|
|
get isConnectDisallowed() {
|
|
|
|
const siteUrl = this.config.get('blogUrl');
|
|
|
|
return envConfig.environment !== 'development' && !/^https:/.test(siteUrl);
|
|
|
|
}
|
|
|
|
|
2021-05-19 20:32:28 +03:00
|
|
|
get hasChangedPrices() {
|
|
|
|
if (this.product) {
|
2021-06-04 10:42:52 +03:00
|
|
|
const monthlyPrice = this.product.get('monthlyPrice');
|
|
|
|
const yearlyPrice = this.product.get('yearlyPrice');
|
2021-05-19 20:32:28 +03:00
|
|
|
|
2021-09-30 11:51:55 +03:00
|
|
|
if (monthlyPrice?.amount && parseFloat(this.stripeMonthlyAmount) !== (monthlyPrice.amount / 100)) {
|
2021-05-19 20:32:28 +03:00
|
|
|
return true;
|
|
|
|
}
|
2021-09-30 11:51:55 +03:00
|
|
|
if (yearlyPrice?.amount && parseFloat(this.stripeYearlyAmount) !== (yearlyPrice.amount / 100)) {
|
2021-05-19 20:32:28 +03:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-05-19 20:20:07 +03:00
|
|
|
@action
|
|
|
|
setup() {
|
2021-06-04 10:42:52 +03:00
|
|
|
this.fetchProducts.perform();
|
2021-05-19 20:20:07 +03:00
|
|
|
this.updatePortalPreview();
|
|
|
|
}
|
|
|
|
|
2021-03-29 14:49:09 +03:00
|
|
|
leaveRoute(transition) {
|
2021-05-19 20:32:28 +03:00
|
|
|
if (this.settings.get('hasDirtyAttributes') || this.hasChangedPrices) {
|
2021-03-29 14:49:09 +03:00
|
|
|
transition.abort();
|
|
|
|
this.leaveSettingsTransition = transition;
|
2021-05-17 14:40:08 +03:00
|
|
|
this.showLeaveRouteModal = true;
|
2021-03-29 14:49:09 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-19 20:20:07 +03:00
|
|
|
@action
|
|
|
|
async confirmLeave() {
|
|
|
|
this.settings.rollbackAttributes();
|
|
|
|
this.resetPrices();
|
|
|
|
this.leaveSettingsTransition.retry();
|
|
|
|
}
|
2021-05-17 17:29:07 +03:00
|
|
|
|
2021-05-19 20:20:07 +03:00
|
|
|
@action
|
|
|
|
cancelLeave() {
|
|
|
|
this.showLeaveRouteModal = false;
|
|
|
|
this.leaveSettingsTransition = null;
|
2021-05-17 17:29:07 +03:00
|
|
|
}
|
|
|
|
|
2021-05-20 16:43:04 +03:00
|
|
|
@action
|
|
|
|
async membersSubscriptionAccessChanged() {
|
2021-05-20 17:00:46 +03:00
|
|
|
const oldValue = this.settings.changedAttributes().membersSignupAccess?.[0];
|
2021-05-20 16:43:04 +03:00
|
|
|
|
|
|
|
if (oldValue === 'none') {
|
|
|
|
// when saved value is 'none' the server won't inject the portal script
|
|
|
|
// to work around that and show the expected portal preview we save and
|
|
|
|
// force a refresh
|
2021-05-25 11:40:17 +03:00
|
|
|
await this.switchFromNoneTask.perform();
|
2021-05-20 16:43:04 +03:00
|
|
|
} else {
|
|
|
|
this.updatePortalPreview();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-17 17:29:07 +03:00
|
|
|
@action
|
|
|
|
setStripePlansCurrency(event) {
|
|
|
|
const newCurrency = event.value;
|
|
|
|
this.currency = newCurrency;
|
|
|
|
}
|
|
|
|
|
|
|
|
@action
|
|
|
|
setPaidSignupRedirect(url) {
|
|
|
|
this.paidSignupRedirect = url;
|
|
|
|
}
|
|
|
|
|
|
|
|
@action
|
|
|
|
setFreeSignupRedirect(url) {
|
|
|
|
this.freeSignupRedirect = url;
|
|
|
|
}
|
|
|
|
|
|
|
|
@action
|
|
|
|
validatePaidSignupRedirect() {
|
|
|
|
return this._validateSignupRedirect(this.paidSignupRedirect, 'membersPaidSignupRedirect');
|
|
|
|
}
|
|
|
|
|
|
|
|
@action
|
|
|
|
validateFreeSignupRedirect() {
|
|
|
|
return this._validateSignupRedirect(this.freeSignupRedirect, 'membersFreeSignupRedirect');
|
|
|
|
}
|
|
|
|
|
|
|
|
@action
|
2021-05-24 21:29:18 +03:00
|
|
|
validateStripePlans({updatePortalPreview = true} = {}) {
|
2021-05-17 17:29:07 +03:00
|
|
|
this.stripePlanError = undefined;
|
|
|
|
|
|
|
|
try {
|
|
|
|
const yearlyAmount = this.stripeYearlyAmount;
|
|
|
|
const monthlyAmount = this.stripeMonthlyAmount;
|
|
|
|
const symbol = getSymbol(this.currency);
|
|
|
|
if (!yearlyAmount || yearlyAmount < 1 || !monthlyAmount || monthlyAmount < 1) {
|
|
|
|
throw new TypeError(`Subscription amount must be at least ${symbol}1.00`);
|
|
|
|
}
|
2021-05-18 15:59:47 +03:00
|
|
|
|
2021-05-24 21:29:18 +03:00
|
|
|
if (updatePortalPreview) {
|
|
|
|
this.updatePortalPreview();
|
|
|
|
}
|
2021-05-17 17:29:07 +03:00
|
|
|
} catch (err) {
|
|
|
|
this.stripePlanError = err.message;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-19 22:24:13 +03:00
|
|
|
@action
|
|
|
|
openStripeConnect() {
|
2021-05-20 16:31:51 +03:00
|
|
|
this.stripeEnabledOnOpen = this.membersUtils.isStripeEnabled;
|
2021-05-19 22:24:13 +03:00
|
|
|
this.showStripeConnect = true;
|
|
|
|
}
|
|
|
|
|
2021-05-17 18:14:38 +03:00
|
|
|
@action
|
2021-05-20 16:31:51 +03:00
|
|
|
async closeStripeConnect() {
|
|
|
|
if (this.stripeEnabledOnOpen !== this.membersUtils.isStripeEnabled) {
|
2021-05-24 21:29:18 +03:00
|
|
|
await this.saveSettingsTask.perform({forceRefresh: true});
|
2021-05-20 16:31:51 +03:00
|
|
|
}
|
2021-05-17 18:14:38 +03:00
|
|
|
this.showStripeConnect = false;
|
|
|
|
}
|
|
|
|
|
2021-06-04 10:42:52 +03:00
|
|
|
@action
|
|
|
|
async openEditProduct(product) {
|
|
|
|
this.productModel = product;
|
|
|
|
this.showProductModal = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@action
|
|
|
|
async openNewProduct() {
|
|
|
|
this.productModel = this.store.createRecord('product');
|
|
|
|
this.showProductModal = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@action
|
|
|
|
closeProductModal() {
|
|
|
|
this.showProductModal = false;
|
|
|
|
}
|
|
|
|
|
2021-05-18 15:59:47 +03:00
|
|
|
@action
|
|
|
|
openPortalSettings() {
|
|
|
|
this.saveSettingsTask.perform();
|
|
|
|
this.showPortalSettings = true;
|
|
|
|
}
|
|
|
|
|
2021-05-17 10:58:15 +03:00
|
|
|
@action
|
|
|
|
closePortalSettings() {
|
|
|
|
const changedAttributes = this.settings.changedAttributes();
|
|
|
|
if (changedAttributes && Object.keys(changedAttributes).length > 0) {
|
2021-05-17 14:40:08 +03:00
|
|
|
this.showLeavePortalModal = true;
|
2021-05-17 10:58:15 +03:00
|
|
|
} else {
|
|
|
|
this.showPortalSettings = false;
|
2021-05-18 15:59:47 +03:00
|
|
|
this.updatePortalPreview();
|
2021-05-17 10:58:15 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-17 14:40:08 +03:00
|
|
|
@action
|
|
|
|
async confirmClosePortalSettings() {
|
|
|
|
this.settings.rollbackAttributes();
|
|
|
|
this.showPortalSettings = false;
|
|
|
|
this.showLeavePortalModal = false;
|
2021-05-18 15:59:47 +03:00
|
|
|
this.updatePortalPreview();
|
2021-05-17 14:40:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
@action
|
|
|
|
cancelClosePortalSettings() {
|
|
|
|
this.showLeavePortalModal = false;
|
|
|
|
}
|
|
|
|
|
2021-05-18 15:59:47 +03:00
|
|
|
@action
|
2021-06-04 10:42:52 +03:00
|
|
|
updatePortalPreview({forceRefresh} = {forceRefresh: false}) {
|
2021-05-18 15:59:47 +03:00
|
|
|
// TODO: can these be worked out from settings in membersUtils?
|
2021-05-18 20:29:34 +03:00
|
|
|
const monthlyPrice = this.stripeMonthlyAmount * 100;
|
|
|
|
const yearlyPrice = this.stripeYearlyAmount * 100;
|
|
|
|
let portalPlans = this.settings.get('portalPlans') || [];
|
|
|
|
|
2021-06-04 10:42:52 +03:00
|
|
|
let isMonthlyChecked = portalPlans.includes('monthly');
|
|
|
|
let isYearlyChecked = portalPlans.includes('yearly');
|
2021-05-18 15:59:47 +03:00
|
|
|
|
2021-05-24 21:29:18 +03:00
|
|
|
const newUrl = new URL(this.membersUtils.getPortalPreviewUrl({
|
2021-05-18 16:34:46 +03:00
|
|
|
button: false,
|
2021-05-18 15:59:47 +03:00
|
|
|
monthlyPrice,
|
2021-05-18 20:29:34 +03:00
|
|
|
yearlyPrice,
|
|
|
|
currency: this.currency,
|
|
|
|
isMonthlyChecked,
|
|
|
|
isYearlyChecked,
|
|
|
|
portalPlans: null
|
2021-05-24 21:29:18 +03:00
|
|
|
}));
|
|
|
|
|
|
|
|
if (forceRefresh) {
|
|
|
|
this.portalPreviewGuid = Date.now().valueOf();
|
|
|
|
}
|
|
|
|
newUrl.searchParams.set('v', this.portalPreviewGuid);
|
|
|
|
|
|
|
|
this.portalPreviewUrl = newUrl;
|
2021-05-18 20:26:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
@action
|
2021-05-27 15:20:37 +03:00
|
|
|
portalPreviewInserted(iframe) {
|
2021-05-24 19:27:52 +03:00
|
|
|
this.portalPreviewIframe = iframe;
|
2021-05-27 15:20:37 +03:00
|
|
|
|
|
|
|
if (!this.portalMessageListener) {
|
|
|
|
this.portalMessageListener = (event) => {
|
|
|
|
// don't resize membership portal preview when events fire in customize portal modal
|
|
|
|
if (this.showPortalSettings) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const resizeEvents = ['portal-ready', 'portal-preview-updated'];
|
2021-10-21 20:29:16 +03:00
|
|
|
if (resizeEvents.includes(event.data.type) && event.data.payload?.height && this.portalPreviewIframe?.parentNode) {
|
2021-05-27 15:20:37 +03:00
|
|
|
this.portalPreviewIframe.parentNode.style.height = `${event.data.payload.height}px`;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
window.addEventListener('message', this.portalMessageListener, true);
|
|
|
|
}
|
2021-05-18 20:26:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
@action
|
|
|
|
portalPreviewDestroyed() {
|
|
|
|
this.portalPreviewIframe = null;
|
2021-05-27 15:20:37 +03:00
|
|
|
|
|
|
|
if (this.portalMessageListener) {
|
|
|
|
window.removeEventListener('message', this.portalMessageListener);
|
|
|
|
}
|
2021-05-18 20:26:07 +03:00
|
|
|
}
|
|
|
|
|
2021-06-04 10:42:52 +03:00
|
|
|
@action
|
|
|
|
confirmProductSave() {
|
2021-08-26 10:36:16 +03:00
|
|
|
this.updatePortalPreview({forceRefresh: true});
|
2021-06-04 10:42:52 +03:00
|
|
|
return this.fetchProducts.perform();
|
|
|
|
}
|
|
|
|
|
2021-05-25 11:40:17 +03:00
|
|
|
@task
|
|
|
|
*switchFromNoneTask() {
|
|
|
|
return yield this.saveSettingsTask.perform({forceRefresh: true});
|
|
|
|
}
|
|
|
|
|
2021-06-04 10:42:52 +03:00
|
|
|
setupPortalProduct(product) {
|
|
|
|
if (product) {
|
|
|
|
const monthlyPrice = product.get('monthlyPrice');
|
|
|
|
const yearlyPrice = product.get('yearlyPrice');
|
2021-05-17 17:29:07 +03:00
|
|
|
if (monthlyPrice && monthlyPrice.amount) {
|
|
|
|
this.stripeMonthlyAmount = (monthlyPrice.amount / 100);
|
|
|
|
this.currency = monthlyPrice.currency;
|
|
|
|
}
|
|
|
|
if (yearlyPrice && yearlyPrice.amount) {
|
|
|
|
this.stripeYearlyAmount = (yearlyPrice.amount / 100);
|
|
|
|
}
|
2021-05-18 20:29:34 +03:00
|
|
|
this.updatePortalPreview();
|
2021-05-17 17:29:07 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-04 10:42:52 +03:00
|
|
|
@task({drop: true})
|
|
|
|
*fetchProducts() {
|
2022-01-17 21:53:43 +03:00
|
|
|
this.products = yield this.store.query('product', {
|
2022-01-17 21:56:56 +03:00
|
|
|
include: 'monthly_price,yearly_price,benefits'
|
2022-01-17 21:53:43 +03:00
|
|
|
});
|
2022-01-17 21:56:56 +03:00
|
|
|
this.product = this.paidProducts.firstObject;
|
2021-06-04 10:42:52 +03:00
|
|
|
this.setupPortalProduct(this.product);
|
|
|
|
}
|
|
|
|
|
2021-03-29 14:49:09 +03:00
|
|
|
@task({drop: true})
|
2021-05-24 21:29:18 +03:00
|
|
|
*saveSettingsTask(options) {
|
2021-06-22 11:48:59 +03:00
|
|
|
if (!this.feature.get('multipleProducts')) {
|
|
|
|
yield this.validateStripePlans({updatePortalPreview: false});
|
2021-05-17 17:29:07 +03:00
|
|
|
|
2021-06-22 11:48:59 +03:00
|
|
|
if (this.stripePlanError) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.settings.get('errors').length !== 0) {
|
|
|
|
return;
|
|
|
|
}
|
2021-05-17 17:29:07 +03:00
|
|
|
|
2021-06-04 10:42:52 +03:00
|
|
|
yield this.saveProduct();
|
2021-06-22 11:48:59 +03:00
|
|
|
const result = yield this.settings.save();
|
2021-05-18 15:59:47 +03:00
|
|
|
|
2021-06-22 11:48:59 +03:00
|
|
|
this.updatePortalPreview(options);
|
2021-05-18 15:59:47 +03:00
|
|
|
|
2021-06-22 11:48:59 +03:00
|
|
|
return result;
|
|
|
|
} else {
|
|
|
|
if (this.settings.get('errors').length !== 0) {
|
|
|
|
return;
|
|
|
|
}
|
2021-08-20 13:14:37 +03:00
|
|
|
// When no filer is selected in `Specific tier(s)` option
|
2021-07-16 16:01:23 +03:00
|
|
|
if (!this.settings.get('defaultContentVisibility')) {
|
|
|
|
return;
|
|
|
|
}
|
2021-06-22 11:48:59 +03:00
|
|
|
const result = yield this.settings.save();
|
|
|
|
this.updatePortalPreview(options);
|
|
|
|
return result;
|
|
|
|
}
|
2021-03-29 14:49:09 +03:00
|
|
|
}
|
2021-05-17 14:40:08 +03:00
|
|
|
|
2021-06-04 10:42:52 +03:00
|
|
|
async saveProduct() {
|
|
|
|
const isStripeConnected = this.settings.get('stripeConnectAccountId');
|
|
|
|
if (this.product && isStripeConnected) {
|
|
|
|
const monthlyAmount = this.stripeMonthlyAmount * 100;
|
|
|
|
const yearlyAmount = this.stripeYearlyAmount * 100;
|
|
|
|
|
|
|
|
this.product.set('monthlyPrice', {
|
|
|
|
nickname: 'Monthly',
|
|
|
|
amount: monthlyAmount,
|
|
|
|
active: true,
|
|
|
|
currency: this.currency,
|
|
|
|
interval: 'month',
|
|
|
|
type: 'recurring'
|
|
|
|
});
|
|
|
|
this.product.set('yearlyPrice', {
|
|
|
|
nickname: 'Yearly',
|
|
|
|
amount: yearlyAmount,
|
|
|
|
active: true,
|
|
|
|
currency: this.currency,
|
|
|
|
interval: 'year',
|
|
|
|
type: 'recurring'
|
|
|
|
});
|
|
|
|
|
|
|
|
const savedProduct = await this.product.save();
|
|
|
|
return savedProduct;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-19 20:32:28 +03:00
|
|
|
resetPrices() {
|
2021-06-04 10:42:52 +03:00
|
|
|
const monthlyPrice = this.product.get('monthlyPrice');
|
|
|
|
const yearlyPrice = this.product.get('yearlyPrice');
|
2021-05-19 20:32:28 +03:00
|
|
|
|
2021-05-24 17:32:49 +03:00
|
|
|
this.stripeMonthlyAmount = monthlyPrice ? (monthlyPrice.amount / 100) : 5;
|
|
|
|
this.stripeYearlyAmount = yearlyPrice ? (yearlyPrice.amount / 100) : 50;
|
2021-05-19 20:32:28 +03:00
|
|
|
}
|
|
|
|
|
2021-05-17 14:40:08 +03:00
|
|
|
reset() {
|
|
|
|
this.showLeaveRouteModal = false;
|
|
|
|
this.showLeavePortalModal = false;
|
|
|
|
this.showPortalSettings = false;
|
|
|
|
}
|
2021-05-19 20:20:07 +03:00
|
|
|
|
|
|
|
_validateSignupRedirect(url, type) {
|
|
|
|
const siteUrl = this.config.get('blogUrl');
|
|
|
|
let errMessage = `Please enter a valid URL`;
|
|
|
|
this.settings.get('errors').remove(type);
|
|
|
|
this.settings.get('hasValidated').removeObject(type);
|
|
|
|
|
|
|
|
if (url === null) {
|
|
|
|
this.settings.get('errors').add(type, errMessage);
|
|
|
|
this.settings.get('hasValidated').pushObject(type);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (url === undefined) {
|
|
|
|
// Not initialised
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (url.href.startsWith(siteUrl)) {
|
|
|
|
const path = url.href.replace(siteUrl, '');
|
|
|
|
this.settings.set(type, path);
|
|
|
|
} else {
|
|
|
|
this.settings.set(type, url.href);
|
|
|
|
}
|
|
|
|
}
|
2021-03-29 14:49:09 +03:00
|
|
|
}
|