update template pro conditions

*add futur panel section pro link with utm
*update conditions taking care of new variable values
This commit is contained in:
Jordan Blasenhauer 2024-03-05 11:04:09 +01:00
parent 640e3a0e86
commit 70ba6f3640
6 changed files with 75 additions and 88 deletions

View file

@ -29,37 +29,36 @@
<div role="tablist" data-account-tabs class="block col-span-12 mb-4">
<!-- tabs -->
{% for tab in tabs %}
<button role="tab"
data-tab-handler="{{ tab['id'] }}"
class="{% if loop.first %}active{% endif %} tabs-tab-btn">
<span class="w-full flex justify-between items-center">
<!-- text and icon -->
<span class="tabs-name">{{ tab['name'] }}</span>
<svg data-popover-btn="{{ tab['name'] }}"
class=" fill-blue-500 h-5 w-5 mr-2 hover:brightness-95"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 512 512">
<path d="M256 512c141.4 0 256-114.6 256-256S397.4 0 256 0S0 114.6 0 256S114.6 512 256 512zM216 336h24V272H216c-13.3 0-24-10.7-24-24s10.7-24 24-24h48c13.3 0 24 10.7 24 24v88h8c13.3 0 24 10.7 24 24s-10.7 24-24 24H216c-13.3 0-24-10.7-24-24s10.7-24 24-24zm40-144c-17.7 0-32-14.3-32-32s14.3-32 32-32s32 14.3 32 32s-14.3 32-32 32z" />
</svg>
<!-- end text and icon -->
<!-- popover -->
<span data-popover-content="{{ tab['name'] }}"
class="tabs-popover-container hidden">
<span class="tabs-popover-text">{{ tab['description'] }}</span>
</span>
<!-- end popover -->
<button role="tab"
data-tab-handler="{{ tab['id'] }}"
class="{% if loop.first %}active{% endif %} tabs-tab-btn">
<span class="w-full flex justify-between items-center">
<!-- text and icon -->
<span class="tabs-name">{{ tab['name'] }}</span>
<svg data-popover-btn="{{ tab['name'] }}"
class=" fill-blue-500 h-5 w-5 mr-2 hover:brightness-95"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 512 512">
<path d="M256 512c141.4 0 256-114.6 256-256S397.4 0 256 0S0 114.6 0 256S114.6 512 256 512zM216 336h24V272H216c-13.3 0-24-10.7-24-24s10.7-24 24-24h48c13.3 0 24 10.7 24 24v88h8c13.3 0 24 10.7 24 24s-10.7 24-24 24H216c-13.3 0-24-10.7-24-24s10.7-24 24-24zm40-144c-17.7 0-32-14.3-32-32s14.3-32 32-32s32 14.3 32 32s-14.3 32-32 32z" />
</svg>
<!-- end text and icon -->
<!-- popover -->
<span data-popover-content="{{ tab['name'] }}"
class="tabs-popover-container hidden">
<span class="tabs-popover-text">{{ tab['description'] }}</span>
</span>
</button>
<!-- end popover -->
</span>
</button>
{% endfor %}
<!--end tabs-->
</div>
</div>
{% set global_info = {
"message" : "You are using pro version" if is_pro_version and pro_status else "Pro version is expired" if is_pro_version and not pro_status else "You are using free version",
"link_message" : "Upgrade to pro" if not is_pro_version else "Renew my license" if is_pro_version and not pro_status else "",
"icon" : "pro" if is_pro_version and pro_status else "free"
}
%}
"message" : "Pro version" if is_pro_version else "Pro version but exceeding services" if pro_status == "active" and pro_overlapped else "Pro version is expired" if pro_status == "expired" else "Pro version suspended" if pro_status == "suspended" else "You are using free version",
"link_message" : "All features available" if is_pro_version else "Awaiting compliance" if pro_status == "active" and pro_overlapped "Renew license" if pro_status == "expired" else "Talk to team" if pro_status == "suspended" else "Upgrade to pro",
"icon" : "pro" if is_pro_version else "free"
} %}
<div data-tab-item="global"
class="grid grid-cols-12 w-full justify-items-center">
<div class="col-span-12">
@ -67,9 +66,7 @@
VERSION
</h5>
<div class="flex justify-center items-center">
<p class="mb-0 mr-2 dark:text-gray-300">
{{global_info['message']}}
</p>
<p class="mb-0 mr-2 dark:text-gray-300">{{ global_info['message'] }}</p>
<div role="img"
aria-label="version"
class="dark:brightness-90 inline-block w-8 h-8 text-center rounded-circle bg-yellow-500">
@ -96,32 +93,26 @@
{% if global_info['link_message'] %}
<div class="flex justify-center mt-2">
<a class="text-center font-semibold text-yellow-500 underline"
href="https://panel.bunkerweb.io/">{{ global_info['link_message'] }}</a>
href="https://panel.bunkerweb.io/?utm_campaign=self&utm_source=ui#pro">{{ global_info['link_message'] }}</a>
</div>
{% endif %}
{% if is_pro_version and pro_status %}
<div class="mt-2 flex flex-col justify-center items-center">
{% if pro_expire %}
<p class="my-2 mr-2 dark:text-gray-300 text-center">
Your license is valid until {{ pro_expire }}
</p>
{% endif %}
{% if pro_services %}
<p class="my-2 mr-2 dark:text-gray-300 text-center">
You can handle {{ pro_services }} services
</p>
{% endif %}
{% if pro_overlapped %}
<p class="my-2 mr-2 text-red-500 font-bold dark:brightness-95 text-center">
You have more services than allowed by your pro license. Upgrade your license or move some services to draft mode before your license lockout.
</p>
{% endif %}
</div>
{% if is_pro_version %}
<div class="mt-2 flex flex-col justify-center items-center">
{% if pro_expire %}
<p class="my-2 mr-2 dark:text-gray-300 text-center">Your license is valid until {{ pro_expire }}</p>
{% endif %}
{% if pro_services %}
<p class="my-2 mr-2 dark:text-gray-300 text-center">You can handle {{ pro_services }} services</p>
{% endif %}
</div>
{% endif %}
{% if not is_pro_version and pro_status == "active" and pro_overlapped %}
<div class="mt-2 flex flex-col justify-center items-center">
<p class="my-2 mr-2 text-red-500 text-center">
You have more services than your license allows. Delete or draft some services to reach the number of {{ pro_services }} services.
</p>
</div>
{% endif %}
</div>
</div>
<div data-tab-item="username"

View file

@ -1,9 +1,8 @@
<!-- float button-->
{% with messages = get_flashed_messages(with_categories=true) %}
{% if is_pro_version and pro_status and pro_overlapped %}
{% set messages = messages.append(('error', 'You have more services than allowed by your pro license. Upgrade your license or move some services to draft mode before your license lockout.'))%}
{% endif %}
{% if pro_status == "active" and pro_overlapped %}
{% set messages = messages.append(('error', 'You have more services than allowed by your pro license. Upgrade your license or move some services to draft mode to unlock your pro license.')) %}
{% endif %}
<div data-flash-group
class="transition-all group group-hover hover:brightness-75 dark:hover:brightness-105 fixed top-[4.5rem] right-20 sm:right-24 xl:right-24 z-990">
<button aria-controls="sidebar-flash"

View file

@ -1,7 +1,7 @@
{% extends "base.html" %}
{% block content %}
{% set cards = [
{'name' : 'Version', 'title' : 'PRO' if is_pro_version and pro_status else 'EXPIRED' if is_pro_version and not pro_status else 'FREE', 'link' : '#' if is_pro_version and pro_status else 'https://github.com/bunkerity/bunkerweb', 'subtitle' : 'all features available' if is_pro_version and pro_status else 'renew your license' if is_pro_version and not pro_status else 'upgrade to pro', 'subtitle_color' : 'success' if is_pro_version and pro_status else 'warning' },
{'name' : 'Version', 'title' : "PRO" if is_pro_version else "PRO LOCKED" if pro_status == "active" and pro_overlapped else "EXPIRED" if pro_status == "expired" else "SUSPENDED" if pro_status == "suspended" else "FREE", 'link' : 'https://panel.bunkerweb.io/?utm_campaign=self&utm_source=ui#pro', 'subtitle' : "all features available" if is_pro_version else "awaiting compliance" if pro_status == "active" and pro_overlapped "renew license" if pro_status == "expired" else "talk to team" if pro_status == "suspended" else "upgrade to pro", 'subtitle_color' : 'success' if is_pro_version else 'warning' },
{'name' : 'Version number', 'title' : version, 'link' : 'https://github.com/bunkerity/bunkerweb', 'subtitle' : "couldn'd fint remote" if not remote_version else "latest version" if remote_version and check_version else 'Update to ' + remote_version , 'subtitle_color' : "error" if not remote_version else "success" if remote_version and check_version else 'warning'},
{'name' : 'Instances', 'title' : instances_number, 'link' : 'loading?next=' + url_for('instances') , 'subtitle' : instance_health_count|string + ' / ' + instances_number|string + ' is working' , 'subtitle_color' : "info",},
{'name' : 'Services', 'title' : services_number, 'link' : 'loading?next=' + url_for('services') , 'subtitle' : services_ui_count|string + ' ui, ' + services_scheduler_count|string + ' scheduler, ' + services_autoconf_count|string + ' autoconf ' , 'subtitle_color' : "info"},
@ -10,7 +10,10 @@
<div class="col-span-12 grid grid-cols-12 justify-start items-start gap-4">
{% for card in cards %}
<!-- stats card -->
<a href="{{ card['link'] }}" class="home-card" target="_blank" rel="noopener">
<a href="{{ card['link'] }}"
class="home-card"
target="_blank"
rel="noopener">
<!-- text -->
<div>
<p class="home-card-name">{{ card['name'] }}</p>
@ -23,7 +26,7 @@
<div role="img"
aria-label="version"
class="home-card-svg-container {{ card['name'].replace(' ', '-') |lower }}">
{% if card['name'] == "Version" and is_pro_version and pro_status %}
{% if card['name'] == "Version" and is_pro_version %}
<svg class="leading-none text-lg relative scale-[0.6]"
viewBox="0 0 48 46"
fill="none"
@ -32,7 +35,7 @@
<path class="fill-white" d="M21.2803 45.5H26.7198C33.8098 45.5 37.3545 45.5 39.7198 43.383C40.7523 42.4588 41.4057 40.793 41.8775 38.625H6.1224C6.59413 40.793 7.24783 42.4588 8.2802 43.383C10.6454 45.5 14.1903 45.5 21.2803 45.5Z" fill="#1C274C" />
</svg>
{% endif %}
{% if card['name'] == "Version" and not is_pro_version or card['name'] == "Version" and is_pro_version and not pro_status %}
{% if card['name'] == "Version" and not is_pro_version %}
<svg class="leading-none fill-white text-yellow-500 text-lg relative scale-[0.6]"
xmlns="http://www.w3.org/2000/svg"
fill="none"

View file

@ -223,7 +223,7 @@
<li class="mt-0.5 w-full">
<a {% if not is_pro_version %}target="_blank" rel="noopener"{% endif %}
class="dark:hover:bg-primary/20 hover:bg-primary/5 hover:rounded-lg dark:text-gray-200 py-1 text-sm ease-nav-brand my-0 mx-2 flex items-center whitespace-nowrap px-4 transition"
href="{% if not is_pro_version %}https://panel.bunkerweb.io/{% else %}javascript:void(0){% endif %}"
href="{% if not is_pro_version %}https://panel.bunkerweb.io/?utm_campaign=self&utm_source=ui#pro{% else %}javascript:void(0){% endif %}"
<div class="mr-2 flex items-center justify-center rounded-lg bg-center stroke-0 text-center p-1 xl:p-1.5">
<svg class="h-5 w-5 dark:brightness-90"
viewBox="0 0 48 46"

View file

@ -21,10 +21,10 @@
</p>
</div>
{% endfor %}
{% if (plugins_count_pro > 0 and not is_pro_version) or (plugins_count_pro > 0 and is_pro_version and not pro_status) %}
<p class="ml-2 mt-0 mb-2 mr-2 text-red-500 font-bold dark:brightness-95 text-sm">
You have pro plugins without pro version.
</p>
{% if plugins_count_pro > 0 and not is_pro_version %}
<p class="ml-2 mt-0 mb-2 mr-2 text-red-500 font-bold dark:brightness-95 text-sm">
You have pro plugins without pro version.
</p>
{% endif %}
</div>
<!-- end info -->
@ -156,7 +156,6 @@
<div data-plugins-list-container
class="min-h-[55vh] max-h-80 overflow-hidden overflow-y-auto p-4 col-span-12 relative min-w-0 break-words bg-white shadow-xl dark:bg-slate-850 dark:shadow-dark-xl rounded-2xl bg-clip-border">
<h5 class="mb-4 mt-2 font-bold dark:text-white/90 mx-2">LIST</h5>
<div data-plugins-list class="grid grid-cols-12 gap-3">
{% for plugin in plugins %}
<div data-plugins-type="{{ plugin['type'] }}"
@ -194,7 +193,7 @@
<a {% if not is_pro_version %}target="_blank" rel="noopener"{% endif %}
aria-label="pro plugin"
class="hover:-translate-y-px mx-1 -translate-y-0.5"
href="{% if not is_pro_version %}https://panel.bunkerweb.io/{% else %}javascript:void(0){% endif %}">
href="{% if not is_pro_version %}https://panel.bunkerweb.io/?utm_campaign=self&utm_source=ui#pro{% else %}javascript:void(0){% endif %}">
<svg class="h-6 w-6 dark:brightness-90"
viewBox="0 0 48 46"
fill="none"

View file

@ -6,7 +6,7 @@
class="{% if loop.index != 1 %}hidden{% endif %} w-full px-1">
<!-- title and desc -->
<div class="col-span-12" data-setting-header>
{% if (plugin['type'] == "pro" and not is_pro_version) or (plugin['type'] == "pro" and is_pro_version and not pro_status) %}
{% if plugin['type'] == "pro" and not is_pro_version %}
<p class="ml-2 mt-0 mb-2 mr-2 text-red-500 font-bold dark:brightness-95 text-sm">
You need a valid pro license to use this plugin
</p>
@ -28,25 +28,23 @@
</a>
{% endif %}
{% if plugin['type'] == "pro" %}
<a {% if not is_pro_version %}target="_blank" rel="noopener"{% endif %}
aria-label="pro plugin"
class="hover:-translate-y-px mx-1 -translate-y-0.5 ml-1"
href="{% if not is_pro_version %}https://panel.bunkerweb.io/{% else %}javascript:void(0){% endif %}">
<svg class="h-6 w-6 dark:brightness-90"
viewBox="0 0 48 46"
fill="none"
xmlns="http://www.w3.org/2000/svg">
<path class="fill-yellow-500" d="M43.218 28.2327L43.6765 23.971C43.921 21.6973 44.0825 20.1957 43.9557 19.2497L44 19.25C46.071 19.25 47.75 17.5711 47.75 15.5C47.75 13.4289 46.071 11.75 44 11.75C41.929 11.75 40.25 13.4289 40.25 15.5C40.25 16.4366 40.5935 17.2931 41.1613 17.9503C40.346 18.4535 39.2805 19.515 37.6763 21.1128C36.4405 22.3438 35.8225 22.9593 35.1333 23.0548C34.7513 23.1075 34.3622 23.0532 34.0095 22.898C33.373 22.6175 32.9485 21.8567 32.0997 20.335L27.6262 12.3135C27.1025 11.3747 26.6642 10.5889 26.2692 9.95662C27.89 9.12967 29 7.44445 29 5.5C29 2.73857 26.7615 0.5 24 0.5C21.2385 0.5 19 2.73857 19 5.5C19 7.44445 20.11 9.12967 21.7308 9.95662C21.3358 10.589 20.8975 11.3746 20.3738 12.3135L15.9002 20.335C15.0514 21.8567 14.627 22.6175 13.9905 22.898C13.6379 23.0532 13.2487 23.1075 12.8668 23.0548C12.1774 22.9593 11.5595 22.3438 10.3238 21.1128C8.71968 19.515 7.6539 18.4535 6.83882 17.9503C7.4066 17.2931 7.75 16.4366 7.75 15.5C7.75 13.4289 6.07107 11.75 4 11.75C1.92893 11.75 0.25 13.4289 0.25 15.5C0.25 17.5711 1.92893 19.25 4 19.25L4.04428 19.2497C3.91755 20.1957 4.07905 21.6973 4.32362 23.971L4.782 28.2327C5.03645 30.5982 5.24802 32.849 5.50717 34.875H42.4928C42.752 32.849 42.9635 30.5982 43.218 28.2327Z" fill="#1C274C" />
<path class="fill-yellow-500" d="M21.2803 45.5H26.7198C33.8098 45.5 37.3545 45.5 39.7198 43.383C40.7523 42.4588 41.4057 40.793 41.8775 38.625H6.1224C6.59413 40.793 7.24783 42.4588 8.2802 43.383C10.6454 45.5 14.1903 45.5 21.2803 45.5Z" fill="#1C274C" />
</svg>
</a>
<a {% if not is_pro_version %}target="_blank" rel="noopener"{% endif %}
aria-label="pro plugin"
class="hover:-translate-y-px mx-1 -translate-y-0.5 ml-1"
href="{% if not is_pro_version %}https://panel.bunkerweb.io/?utm_campaign=self&utm_source=ui#pro{% else %}javascript:void(0){% endif %}">
<svg class="h-6 w-6 dark:brightness-90"
viewBox="0 0 48 46"
fill="none"
xmlns="http://www.w3.org/2000/svg">
<path class="fill-yellow-500" d="M43.218 28.2327L43.6765 23.971C43.921 21.6973 44.0825 20.1957 43.9557 19.2497L44 19.25C46.071 19.25 47.75 17.5711 47.75 15.5C47.75 13.4289 46.071 11.75 44 11.75C41.929 11.75 40.25 13.4289 40.25 15.5C40.25 16.4366 40.5935 17.2931 41.1613 17.9503C40.346 18.4535 39.2805 19.515 37.6763 21.1128C36.4405 22.3438 35.8225 22.9593 35.1333 23.0548C34.7513 23.1075 34.3622 23.0532 34.0095 22.898C33.373 22.6175 32.9485 21.8567 32.0997 20.335L27.6262 12.3135C27.1025 11.3747 26.6642 10.5889 26.2692 9.95662C27.89 9.12967 29 7.44445 29 5.5C29 2.73857 26.7615 0.5 24 0.5C21.2385 0.5 19 2.73857 19 5.5C19 7.44445 20.11 9.12967 21.7308 9.95662C21.3358 10.589 20.8975 11.3746 20.3738 12.3135L15.9002 20.335C15.0514 21.8567 14.627 22.6175 13.9905 22.898C13.6379 23.0532 13.2487 23.1075 12.8668 23.0548C12.1774 22.9593 11.5595 22.3438 10.3238 21.1128C8.71968 19.515 7.6539 18.4535 6.83882 17.9503C7.4066 17.2931 7.75 16.4366 7.75 15.5C7.75 13.4289 6.07107 11.75 4 11.75C1.92893 11.75 0.25 13.4289 0.25 15.5C0.25 17.5711 1.92893 19.25 4 19.25L4.04428 19.2497C3.91755 20.1957 4.07905 21.6973 4.32362 23.971L4.782 28.2327C5.03645 30.5982 5.24802 32.849 5.50717 34.875H42.4928C42.752 32.849 42.9635 30.5982 43.218 28.2327Z" fill="#1C274C" />
<path class="fill-yellow-500" d="M21.2803 45.5H26.7198C33.8098 45.5 37.3545 45.5 39.7198 43.383C40.7523 42.4588 41.4057 40.793 41.8775 38.625H6.1224C6.59413 40.793 7.24783 42.4588 8.2802 43.383C10.6454 45.5 14.1903 45.5 21.2803 45.5Z" fill="#1C274C" />
</svg>
</a>
{% endif %}
</div>
<div class="transition duration-300 ease-in-out dark:opacity-90 ml-2 ">
<p class="text-sm dark:text-gray-300 mb-1">{{ plugin['description'] }}</p>
</div>
</div>
<!-- end title and desc -->
<div data-plugin-settings class="w-full grid grid-cols-12">
@ -55,10 +53,7 @@
{% if setting not in ["IS_LOADING", "IS_DRAFT"] and current_endpoint
== "global-config" and value['context'] == "global" and not value['multiple'] or setting != "IS_DRAFT" and current_endpoint ==
"services" and value['context'] == "multisite" and not value['multiple'] %}
<div data-setting-container
data-{{current_endpoint}}-context="{{ value['context'] }}"
class="mx-0 sm:mx-2 my-2 col-span-12 md:my-3 md:col-span-6 2xl:my-3 2xl:col-span-4"
id="form-edit-{{ current_endpoint }}-{{ value["id"] }}">
<div data-setting-container data-{{ current_endpoint }}-context="{{ value['context'] }}" class="mx-0 sm:mx-2 my-2 col-span-12 md:my-3 md:col-span-6 2xl:my-3 2xl:col-span-4" id="form-edit-{{ current_endpoint }}-{{ value["id"] }}">
<!-- title and info -->
<div class="flex items-center my-1 relative z-10">
<h5 class="input-title">{{ value["label"] }}</h5>
@ -249,9 +244,9 @@
{% endif %}
{% endfor %}
{% if multList|length > 0 %}
<h5 class="transition duration-300 ease-in-out ml-2 font-bold text-[1.1rem] uppercase dark:text-white/90 mt-2 mb-0">
multiple settings
</h5>
<h5 class="transition duration-300 ease-in-out ml-2 font-bold text-[1.1rem] uppercase dark:text-white/90 mt-2 mb-0">
multiple settings
</h5>
{% endif %}
{% for multiple in multList %}
<!-- plugin multiple handler -->