<commit_before>import $ from 'jquery';
import ModalComponent from 'ghost-admin/components/modal-base';
import boundOneWay from '../utils/bound-one-way';
import copyTextToClipboard from 'ghost-admin/utils/copy-text-to-clipboard';
import {alias, reads} from '@ember/object/computed';
import {computed} from '@ember/object';
import {htmlSafe} from '@ember/string';
import {run} from '@ember/runloop';
import {inject as service} from '@ember/service';
import {task, timeout} from 'ember-concurrency';
const ICON_EXTENSIONS = ['gif', 'jpg', 'jpeg', 'png', 'svg'];

const ICON_MAPPING = [
    {
        icon: 'user-circle',
        value: 'icon-1'
    },
    {
        icon: 'ambulance',
        value: 'icon-2'
    },
    {
        icon: 'book-open',
        value: 'icon-3'
    },
    {
        icon: 'store',
        value: 'icon-4'
    },
    {
        icon: 'gift',
        value: 'icon-5'
    }
];

export default ModalComponent.extend({
    settings: service(),
    membersUtils: service(),
    config: service(),
    page: 'signup',
    iconExtensions: null,
    defaultButtonIcons: null,
    isShowModalLink: true,
    customIcon: null,
    confirm() {},

    signupButtonText: boundOneWay('settings.portalButtonSignupText'),
    buttonIcon: boundOneWay('settings.portalButtonIcon'),
    allowSelfSignup: alias('settings.membersAllowFreeSignup'),

    isStripeConfigured: reads('membersUtils.isStripeEnabled'),

    backgroundStyle: computed('settings.accentColor', function () {
        let color = this.get('settings.accentColor') || '#ffffff';
        return htmlSafe(`background-color: ${color}`);
    }),

    accentColor: computed('settings.accentColor', function () {
        let color = this.get('settings.accentColor');
        if (color && color[0] === '#') {
            return color.slice(1);
        }
        return color;
    }),

    showModalLinkOrAttribute: computed('isShowModalLink', function () {
        if (this.isShowModalLink) {
            return `${this.config.get('blogUrl')}/#/portal`;
        }
        return `data-portal`;
    }),

    portalPreviewUrl: computed('selectedButtonStyle', 'buttonIcon', 'signupButtonText', 'page', 'isFreeChecked', 'isMonthlyChecked', 'isYearlyChecked', 'settings.{portalName,portalButton,accentColor}', function () {
        const baseUrl = this.config.get('blogUrl');
        const portalBase = '/#/portal';
        const settingsParam = new URLSearchParams();
        settingsParam.append('button', this.settings.get('portalButton'));
        settingsParam.append('name', this.settings.get('portalName'));
        settingsParam.append('isFree', this.isFreeChecked);
        settingsParam.append('isMonthly', this.isMonthlyChecked);
        settingsParam.append('isYearly', this.isYearlyChecked);
        settingsParam.append('page', this.page);
        if (this.buttonIcon) {<commit_msg>Updated portal preview iframe url<commit_after>import $ from 'jquery';
import ModalComponent from 'ghost-admin/components/modal-base';
import boundOneWay from '../utils/bound-one-way';
import copyTextToClipboard from 'ghost-admin/utils/copy-text-to-clipboard';
import {alias, reads} from '@ember/object/computed';
import {computed} from '@ember/object';
import {htmlSafe} from '@ember/string';
import {run} from '@ember/runloop';
import {inject as service} from '@ember/service';
import {task, timeout} from 'ember-concurrency';
const ICON_EXTENSIONS = ['gif', 'jpg', 'jpeg', 'png', 'svg'];

const ICON_MAPPING = [
    {
        icon: 'user-circle',
        value: 'icon-1'
    },
    {
        icon: 'ambulance',
        value: 'icon-2'
    },
    {
        icon: 'book-open',
        value: 'icon-3'
    },
    {
        icon: 'store',
        value: 'icon-4'
    },
    {
        icon: 'gift',
        value: 'icon-5'
    }
];

export default ModalComponent.extend({
    settings: service(),
    membersUtils: service(),
    config: service(),
    page: 'signup',
    iconExtensions: null,
    defaultButtonIcons: null,
    isShowModalLink: true,
    customIcon: null,
    confirm() {},

    signupButtonText: boundOneWay('settings.portalButtonSignupText'),
    buttonIcon: boundOneWay('settings.portalButtonIcon'),
    allowSelfSignup: alias('settings.membersAllowFreeSignup'),

    isStripeConfigured: reads('membersUtils.isStripeEnabled'),

    backgroundStyle: computed('settings.accentColor', function () {
        let color = this.get('settings.accentColor') || '#ffffff';
        return htmlSafe(`background-color: ${color}`);
    }),

    accentColor: computed('settings.accentColor', function () {
        let color = this.get('settings.accentColor');
        if (color && color[0] === '#') {
            return color.slice(1);
        }
        return color;
    }),

    showModalLinkOrAttribute: computed('isShowModalLink', function () {
        if (this.isShowModalLink) {
            return `${this.config.get('blogUrl')}/#/portal`;
        }
        return `data-portal`;
    }),

    portalPreviewUrl: computed('selectedButtonStyle', 'buttonIcon', 'signupButtonText', 'page', 'isFreeChecked', 'isMonthlyChecked', 'isYearlyChecked', 'settings.{portalName,portalButton,accentColor}', function () {
        const baseUrl = this.config.get('blogUrl');
        const portalBase = '/#/portal/preview';
        const settingsParam = new URLSearchParams();
        settingsParam.append('button', this.settings.get('portalButton'));
        settingsParam.append('name', this.settings.get('portalName'));
        settingsParam.append('isFree', this.isFreeChecked);
        settingsParam.append('isMonthly', this.isMonthlyChecked);
        settingsParam.append('isYearly', this.isYearlyChecked);
        settingsParam.append('page', this.page);
        if (this.buttonIcon) {
{'fraction_non_alphanumeric': 0.15284071104914604, 'fraction_numerical': 0.0024398745207389336, 'mean_word_length': 3.334592145015106, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5214704', 'n_tokens_mistral': 1709, 'n_tokens_neox': 1707, 'n_words': 336}