mirror of
https://github.com/shoelace-style/webawesome.git
synced 2026-01-12 04:09:12 +00:00
Gating Launch Sale-Based Banner and Dialog (#1769)
* gating wa-launch banner and dialog based on coupon state * addressing PR feedback * Update packages/webawesome/docs/_includes/_dialog-wa-launch.njk Co-authored-by: Konnor Rogers <konnor5456@gmail.com> --------- Co-authored-by: Konnor Rogers <konnor5456@gmail.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
{% raw %}
|
||||
{%- if not currentUser.hasPro -%}
|
||||
{%- if req.stripe.discount.active and not currentUser.hasPro -%}
|
||||
<div slot="banner" class="banner-wa-launch wa-dark">
|
||||
<div class="banner-content wa-split">
|
||||
<div class="wa-cluster wa-gap-s">
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<wa-dialog id="dialog-site" light-dismiss without-header>
|
||||
{% raw %}
|
||||
{%- if req.stripe.discount.active and not currentUser.hasPro -%}
|
||||
<wa-dialog id="dialog-site" light-dismiss without-header>
|
||||
|
||||
<div class="background-wa-pattern" style="justify-content: center; margin-inline: calc(var(--spacing) * -1); margin-block-start: calc(var(--spacing) * -1); margin-block-end: var(--spacing); background: linear-gradient(to bottom, var(--wa-color-brand), var(--wa-color-brand-50)); color: var(--wa-color-brand-on-loud); padding: var(--wa-space-3xl) var(--spacing); --background-pattern-opacity: 0.2; --background-pattern-image: url('/assets/images/bg-wa-pattern.svg');">
|
||||
|
||||
@@ -19,9 +21,9 @@
|
||||
</wa-button>
|
||||
</div>
|
||||
</div>
|
||||
</wa-dialog>
|
||||
</wa-dialog>
|
||||
|
||||
<script type="module">
|
||||
<script type="module">
|
||||
(function() {
|
||||
const SITE_DIALOG_DISMISSED_KEY = 'dialog-wa-launch-sale-dismissed';
|
||||
|
||||
@@ -84,14 +86,10 @@
|
||||
}, 500);
|
||||
};
|
||||
|
||||
// Initialize when ready
|
||||
if (customElements.get('wa-dialog')) {
|
||||
initDialog();
|
||||
} else {
|
||||
document.addEventListener('wa-discovery-complete', initDialog, { once: true });
|
||||
// Fallback timeout in case wa-discovery-complete doesn't fire
|
||||
setTimeout(initDialog, 100);
|
||||
}
|
||||
customElements.whenDefined("wa-dialog").then(() => {
|
||||
initDialog()
|
||||
})
|
||||
})();
|
||||
</script>
|
||||
|
||||
</script>
|
||||
{%- endif -%}
|
||||
{% endraw %}
|
||||
|
||||
@@ -139,11 +139,7 @@
|
||||
|
||||
{#- Site-Wide Dialog -#}
|
||||
{% if hasSiteDialog %}
|
||||
{% raw %}
|
||||
{%- if not currentUser.hasPro -%}
|
||||
{% include "_dialog-wa-launch.njk" ignore missing %}
|
||||
{%- endif -%}
|
||||
{% endraw %}
|
||||
{% endif %}
|
||||
|
||||
{# Footer #}
|
||||
|
||||
Reference in New Issue
Block a user