2022-04-01 14:22:41 +03:00
<button class="close" href title="Close" type="button" {{ on "click" this .closeModal }} >
2021-06-04 10:37:47 +03:00
{{ svg-jar "close" }}
</button>
2022-05-11 20:11:54 +03:00
<div class="gh-tier-modal-content" data-test-modal="edit-tier">
2022-02-19 01:36:01 +03:00
<header class="modal-header">
2021-09-02 17:01:25 +03:00
<h1 data-test-text="title"> {{ this .title }} </h1>
</header>
2021-06-04 10:37:47 +03:00
2021-09-02 17:01:25 +03:00
<form>
2022-08-05 12:59:11 +03:00
<div class="modal-body gh-form-edit-tier gh-tier-settings">
2022-01-19 04:19:51 +03:00
<div class="gh-main-section columns-3">
<div class="gh-main-section-block span-2">
<h4 class="gh-main-section-header small bn">Basic</h4>
2022-05-11 20:11:54 +03:00
<div class="gh-main-section-content grey gh-tier-priceform-block">
{{ # unless this .isFreeTier }}
2022-09-13 11:23:54 +03:00
<GhFormGroup @errors= {{ this .tier .errors }} @hasValidated= {{ this .tier .hasValidated }} @property="name" data-test-formgroup="name">
2022-01-19 04:19:51 +03:00
<label for="name" class="fw6">Name</label>
<GhTextInput
2022-05-11 20:11:54 +03:00
@value= {{ readonly this .tier .name }}
@input= {{ action ( mut this .tier .name ) value = "target.value" }}
2022-01-19 04:19:51 +03:00
@name="name"
2022-08-12 13:54:44 +03:00
@autofocus= {{ true }}
2022-01-19 04:19:51 +03:00
@placeholder="Bronze"
@id="name"
2022-02-19 01:36:01 +03:00
@class="gh-input"
2022-05-11 20:11:54 +03:00
data-test-input="tier-name" />
2022-09-13 11:23:54 +03:00
<GhErrorMessage @errors= {{ this .tier .errors }} @property="name" />
2022-01-19 04:19:51 +03:00
</GhFormGroup>
2022-02-02 19:09:43 +03:00
{{ / unless }}
2022-02-19 01:36:01 +03:00
2022-09-13 11:23:54 +03:00
<GhFormGroup @errors= {{ this .tier .errors }} @property="description" data-test-formgroup="description">
2022-01-19 04:19:51 +03:00
<label for="description" class="fw6">Description</label>
2022-05-11 20:11:54 +03:00
{{ # if this .isFreeTier }}
2022-01-17 21:53:43 +03:00
<GhTextInput
2022-05-11 20:11:54 +03:00
@value= {{ readonly this .tier .description }}
@input= {{ action ( mut this .tier .description ) value = "target.value" }}
2022-01-18 14:28:46 +03:00
@name="description"
2022-02-02 19:09:43 +03:00
@placeholder="Free preview of {{ this .settings .title }} "
2022-01-18 14:28:46 +03:00
@id="description"
2022-02-19 01:36:01 +03:00
@class="gh-input"
2022-05-11 20:11:54 +03:00
data-test-input="free-tier-description" />
2022-01-19 04:19:51 +03:00
{{ else }}
<GhTextInput
2022-05-11 20:11:54 +03:00
@value= {{ readonly this .tier .description }}
@input= {{ action ( mut this .tier .description ) value = "target.value" }}
2022-01-19 04:19:51 +03:00
@name="description"
2022-02-02 19:09:43 +03:00
@placeholder="Full access to premium content"
2022-01-19 04:19:51 +03:00
@id="description"
2022-02-19 01:36:01 +03:00
@class="gh-input"
2022-05-11 20:11:54 +03:00
data-test-input="tier-description" />
2022-01-19 04:19:51 +03:00
{{ / if }}
2022-09-13 11:23:54 +03:00
<GhErrorMessage @errors= {{ this .tier .errors }} @property="description" />
2022-01-19 04:19:51 +03:00
</GhFormGroup>
2022-02-19 01:36:01 +03:00
2022-05-11 20:11:54 +03:00
{{ # unless this .isFreeTier }}
2022-08-14 14:59:32 +03:00
<div class="gh-settings-members-pricetrialcont">
<GhFormGroup @errors= {{ this .settings .errors }} @hasValidated= {{ this .settings .hasValidated }} @property="prices" data-test-formgroup="prices">
<div class="gh-settings-members-pricelabelcont free-trial-enabled">
<label for="monthlyPrice" class="fw6">Prices</label>
<div>
<span class="gh-setting-members-currency gh-select">
<div class="gh-setting-members-currencylabel">
<span> {{ this .currency }} </span>
{{ svg-jar "arrow-down-small" }}
</div>
<OneWaySelect
@value= {{ this .selectedCurrency }}
id="currency"
name="currency"
@options= {{ readonly this .allCurrencies }}
@optionValuePath="value"
@optionLabelPath="label"
@update= {{ action "setCurrency" }}
/>
</span>
</div>
2022-01-17 21:53:43 +03:00
</div>
2022-08-14 14:59:32 +03:00
<div class="gh-setting-members-prices free-trial-enabled">
2021-09-02 17:01:25 +03:00
2022-08-14 14:59:32 +03:00
<div class="gh-input-group">
<GhTextInput
@id="monthlyPrice"
@value= {{ readonly this .stripeMonthlyAmount }}
@type="number"
@input= {{ action ( mut this .stripeMonthlyAmount ) value = "target.value" }}
@focus-out= {{ this .validateStripePlans }}
2022-12-08 19:40:25 +03:00
data-test-input="monthly-price"
2022-08-14 14:59:32 +03:00
/>
<span class="gh-input-append"><span class="ttu"> {{ this .currency }} </span>/month</span>
</div>
<div class="gh-input-group">
<GhTextInput
@id="yearlyPrice"
@value= {{ readonly this .stripeYearlyAmount }}
@type="number"
@input= {{ action ( mut this .stripeYearlyAmount ) value = "target.value" }}
@focus-out= {{ this .validateStripePlans }}
@placeholder=''
data-test-title-input= {{ true }}
2022-12-08 19:40:25 +03:00
data-test-input="yearly-price"
2022-08-14 14:59:32 +03:00
/>
<span class="gh-input-append"><span class="ttu"> {{ this .currency }} </span>/year</span>
</div>
2022-01-19 04:19:51 +03:00
</div>
2022-08-14 14:59:32 +03:00
{{ # if this .stripePlanError }}
<p class="response w-100"><span class="red"> {{ this .stripePlanError }} </span></p>
{{ / if }}
</GhFormGroup>
2023-01-04 14:39:42 +03:00
2022-09-13 11:23:54 +03:00
<GhFormGroup @errors= {{ this .tier .errors }} @property="trialDays" data-test-formgroup="trialDays">
2022-08-12 19:23:57 +03:00
<div class="flex justify-between items-center mb2">
2022-08-05 12:59:11 +03:00
<div>
<h4 class="gh-tier-setting-title">Add a free trial</h4>
</div>
<div class="for-switch small">
<label class="switch" for="free-trial">
<Input
@checked= {{ this .freeTrialEnabled }}
@type="checkbox"
id="free-trial"
name="free-trial"
{{ on "click" this .setFreeTrialEnabled }}
/>
2023-01-04 14:39:42 +03:00
<span class="input-toggle-component" data-test-toggle="free-trial"></span>
2022-08-05 12:59:11 +03:00
</label>
</div>
</div>
2022-08-12 19:23:57 +03:00
<div class="gh-input-group {{ unless this .freeTrialEnabled "gh-input-group-tier-trial-disabled" }} ">
2022-08-05 12:59:11 +03:00
<GhTextInput
@value= {{ readonly this .tier .trialDays }}
@type="number"
{{ on "input" this .setTrialDays }}
@name="trial"
@id="trial"
@class="gh-input"
2022-08-12 19:23:57 +03:00
@disabled= {{ unless this .freeTrialEnabled "true" }}
2022-08-05 12:59:11 +03:00
data-test-input="tier-trial" />
<span class="gh-input-append">days</span>
</div>
2022-08-19 10:58:42 +03:00
<p>Members will be subscribed at full price once the trial ends. <a class="trial-docs-link" href="https://ghost.org/help/free-trials">Learn more</a></p>
2022-08-05 12:59:11 +03:00
{{ # if this .hasTrialDaysError }}
2022-08-09 17:54:13 +03:00
<p class="response w-100"><span class="red">Free trial must be at least 1 day</span></p>
2022-08-05 12:59:11 +03:00
{{ / if }}
</GhFormGroup>
2022-08-12 19:23:57 +03:00
</div>
2023-01-04 14:39:42 +03:00
2022-05-16 18:25:03 +03:00
<GhFormGroup>
<label for="welcomePage" class="fw6">Welcome page</label>
<GhUrlInput
@id="welcomePage"
@value= {{ readonly this .model .tier .welcomePageURL }}
@baseUrl= {{ readonly this .siteUrl }}
@setResult= {{ this .setWelcomePageURL }}
@validateUrl= {{ this .validateWelcomePageURL }}
@placeholder= {{ readonly this .siteUrl }}
/>
{{ # if this .isFreeTier }}
<p>Redirect to this URL after signup for a free membership</p>
{{ else }}
<p>Redirect to this URL after signup for premium membership</p>
{{ / if }}
</GhFormGroup>
2022-02-02 19:09:43 +03:00
{{ / unless }}
2022-01-19 04:19:51 +03:00
</div>
2021-09-02 17:01:25 +03:00
2022-01-19 04:19:51 +03:00
<h4 class="gh-main-section-header small bn">Benefits</h4>
2022-05-11 20:11:54 +03:00
<div class="gh-main-section-content grey gh-tier-form-benefits">
<div class="gh-tier-benefits">
2022-03-14 13:51:19 +03:00
<div class="gh-blognav">
2022-01-19 04:19:51 +03:00
<SortableObjects
@sortableObjectList= {{ this .benefits }}
@useSwap= {{ false }}
@sortEndAction= {{ action "reorderItems" }}
>
{{ # each this .benefits as | benefitItem in dex | }}
<DraggableObject @content= {{ benefitItem }} @dragHandle=".gh-blognav-grab" @isSortable= {{ true }} >
<GhBenefitItem
@benefitItem= {{ benefitItem }}
@addItem= {{ action "addBenefit" }}
@focusItem= {{ action "focusItem" }}
@deleteItem= {{ action "deleteBenefit" }}
@updateLabel= {{ action "updateLabel" }}
2022-02-19 01:36:01 +03:00
data-test-benefit-item= {{ in dex }} />
2022-01-19 04:19:51 +03:00
</DraggableObject>
{{ / each }}
</SortableObjects>
<GhBenefitItem
2022-05-11 20:11:54 +03:00
@isFreeTier= {{ this .isFreeTier }}
2022-01-19 04:19:51 +03:00
@benefitItem= {{ this .newBenefit }}
@addItem= {{ action "addBenefit" }}
@deleteItem= {{ action "deleteBenefit" }}
@updateLabel= {{ action "updateLabel" }}
2022-02-19 01:36:01 +03:00
data-test-benefit-item="new" />
2022-03-14 13:51:19 +03:00
</div>
2021-06-04 15:27:33 +03:00
</div>
2021-09-02 17:01:25 +03:00
</div>
2022-01-19 04:19:51 +03:00
</div>
2022-05-11 20:11:54 +03:00
<div class="gh-main-section-block gh-tier-form-tierpreview" data-test-tierpreview>
<div class="gh-tier-form-tierpreview-content">
{{ # if this .isFreeTier }}
2022-02-19 01:36:01 +03:00
<h4 class="gh-main-section-header small bn" data-test-tierpreview-title>Free Membership Preview</h4>
2022-02-02 19:09:43 +03:00
{{ else }}
2022-05-11 20:11:54 +03:00
<div class="gh-tier-form-tierpreivew-cadence">
2022-04-01 14:22:41 +03:00
<h4 class="gh-main-section-header small bn" data-test-tierpreview-title>Tier Preview</h4>
<div>
<button class="gh-btn {{ if ( eq this .previewCadence "monthly" ) "selected" }} " type="button" {{ on "click" ( fn this .changeCadence "monthly" ) }} ><span>Monthly</span></button>
<button class="gh-btn {{ if ( eq this .previewCadence "yearly" ) "selected" }} " type="button" {{ on "click" ( fn this .changeCadence "yearly" ) }} ><span>Yearly</span></button>
</div>
</div>
2022-01-19 04:19:51 +03:00
{{ / if }}
2022-04-01 14:22:41 +03:00
<div class="gh-main-section-content">
2022-05-11 20:11:54 +03:00
<div class="gh-portal-tier-card-header">
{{ # if this .tier .name }}
<h4 class="gh-portal-tier-name" data-test-tierpreview-name style= {{ this .accentColorStyle }} > {{ this .tier .name }} </h4>
2022-02-02 19:09:43 +03:00
{{ else }}
2022-05-11 20:11:54 +03:00
<h4 class="placeholder gh-portal-tier-name" style= {{ this .accentColorStyle }} data-test-tierpreview-name>Bronze</h4>
2022-01-18 14:28:46 +03:00
{{ / if }}
2022-01-19 04:19:51 +03:00
2022-05-11 20:11:54 +03:00
<div class="gh-portal-tier-card-pricecontainer" data-test-tierpreview-price>
2022-08-16 17:44:11 +03:00
{{ # if this .isFreeTier }}
<div class="gh-portal-tier-price">
<span class="currency-sign"> {{ currency-symbol this .currency }} </span>
<span class="amount">0</span>
</div>
{{ else }}
{{ # if this .stripeYearlyAmount }}
<div class="gh-portal-tier-price">
<span class="currency-sign"> {{ currency-symbol this .currency }} </span>
{{ # if ( eq this .previewCadence "monthly" ) }}
<span class="amount">
{{ format-number this .stripeMonthlyAmount }}
</span>
<span class="billing-period">/month</span>
2022-04-01 14:22:41 +03:00
{{ else }}
2022-08-16 17:44:11 +03:00
<span class="amount">
{{ format-number this .stripeYearlyAmount }}
</span>
<span class="billing-period">/year</span>
2022-04-01 14:22:41 +03:00
{{ / if }}
2022-08-16 17:44:11 +03:00
</div>
{{ # if this .isFreeTrialEnabled }}
2022-04-01 14:22:41 +03:00
<span class="gh-portal-discount-label">
<span style="background-color: {{ this .settings .accentColor }} "></span>
2022-08-16 17:44:11 +03:00
{{ this .tier .trialDays }} days free</span>
{{ / if }}
{{ else }}
2022-05-11 20:11:54 +03:00
<div class="gh-portal-tier-price placeholder">
2022-04-01 14:22:41 +03:00
<span class="currency-sign"> {{ currency-symbol this .currency }} </span>
<span class="amount">0</span>
<span class="billing-period">/year</span>
</div>
{{ / if }}
2022-08-08 13:53:08 +03:00
{{ / if }}
2022-08-16 17:44:11 +03:00
</div>
{{ # if ( and ( eq this .previewCadence "yearly" ) ( gt this .discountValue 0 ) ) }}
<span class="gh-portal-discount-label-trial" style= {{ this .accentColorStyle }} >
{{ this .discountValue }} % discount
2022-08-08 15:27:02 +03:00
</span>
2022-08-16 17:44:11 +03:00
{{ / if }}
2022-04-01 14:22:41 +03:00
</div>
2022-05-11 20:11:54 +03:00
<div class="gh-portal-tier-card-details">
<div class="gh-portal-tier-card-detaildata">
{{ # if this .tier .description }}
<div class="gh-portal-tier-description" data-test-tierpreview-description> {{ this .tier .description }} </div>
2022-01-19 04:19:51 +03:00
{{ else }}
2022-05-11 20:11:54 +03:00
{{ # if this .isFreeTier }}
<div class="placeholder gh-portal-tier-description" data-test-tierpreview-description>Free preview of {{ this .settings .title }} </div>
2022-04-01 14:22:41 +03:00
{{ else }}
2022-05-11 20:11:54 +03:00
<div class="placeholder gh-portal-tier-description" data-test-tierpreview-description>Full access to premium content</div>
2022-04-01 14:22:41 +03:00
{{ / if }}
2022-01-19 04:19:51 +03:00
{{ / if }}
2021-09-02 17:01:25 +03:00
2022-04-01 14:22:41 +03:00
{{ # if this .benefits }}
2022-05-11 20:11:54 +03:00
<div class="gh-portal-tier-benefits" data-test-tierpreview-benefits>
2022-04-01 14:22:41 +03:00
{{ # each this .benefits as | benefitItem | }}
2022-05-11 20:11:54 +03:00
<div class="gh-portal-tier-benefit"> {{ svg-jar "check-2" }}
2022-04-01 14:22:41 +03:00
<div class="gh-portal-benefit-title"> {{ benefitItem .name }} </div>
</div>
{{ / each }}
</div>
2022-01-17 21:53:43 +03:00
{{ else }}
2022-05-11 20:11:54 +03:00
<div class="placeholder gh-portal-tier-benefits" data-test-tierpreview-benefits>
{{ # if this .isFreeTier }}
<div class="gh-portal-tier-benefit"> {{ svg-jar "check-2" }}
2022-04-01 14:22:41 +03:00
<div class="gh-portal-benefit-title">
Access to all public posts
</div>
</div>
{{ else }}
2022-05-11 20:11:54 +03:00
<div class="gh-portal-tier-benefit">
2022-04-01 14:22:41 +03:00
{{ svg-jar "check-2" }}
<div class="gh-portal-benefit-title">Expert analysis</div>
</div>
{{ / if }}
</div>
2022-01-17 21:53:43 +03:00
{{ / if }}
2022-04-01 14:22:41 +03:00
</div>
2021-09-02 17:01:25 +03:00
</div>
2022-04-01 14:22:41 +03:00
2021-09-02 17:01:25 +03:00
</div>
2021-06-04 15:27:33 +03:00
</div>
2021-06-18 11:51:06 +03:00
</div>
2021-06-04 10:37:47 +03:00
</div>
2022-01-19 04:19:51 +03:00
</div>
2021-09-02 17:01:25 +03:00
</form>
2021-06-04 10:37:47 +03:00
</div>
2021-09-02 17:01:25 +03:00
<div class="modal-footer top-shadow items-center">
2021-09-02 23:37:14 +03:00
<button
2022-02-02 19:09:43 +03:00
class="gh-btn" data-test-button="cancel-webhook" type="button" {{ action "closeModal" }}
2021-09-02 23:37:14 +03:00
{{!-- disable mouseDown so it doesn't trigger focus-out validations --}}
{{ action ( optional this .noop ) on = "mouseDown" }}
>
<span>Cancel</span>
</button>
2022-05-11 20:11:54 +03:00
<GhTaskButton @buttonText=" {{ if this .isExistingTier "Save" "Add tier" }} "
2021-09-02 23:37:14 +03:00
@successText= {{ this .successText }}
2022-05-11 20:11:54 +03:00
@task= {{ this .saveTier }}
2021-09-02 23:37:14 +03:00
@idleClass="gh-btn-primary"
2022-05-11 20:11:54 +03:00
@class="gh-btn {{ if this .isExistingTier "gh-btn-black" "gh-btn-green" }} gh-btn-icon"
data-test-button="save-tier" />
2021-06-30 13:21:08 +03:00
</div>