|
15 | 15 | import PillarList from '$lib/PillarList.svelte'; |
16 | 16 | import CtaSection from '$lib/CtaSection.svelte'; |
17 | 17 |
|
| 18 | + const BREVO_ACTION = 'https://f4c90f0b.sibforms.com/serve/MUIFAAbBH-WyHvhepdhs6G8ul1wze6MjoVvTKJ8hy6wQ2pt2zfKhS72lm7K5SfgHHreybw_QGra18wfbFENLUX33U10YYUe1aPoQOEePElxdHbiM2uGL0Sdsei-N34xBCkoktWbqbtQe1cMW95PLNJ4gd9cZ_YonM0j3W1TrUXhliIJyTXuJ7u4B8pL9aH8uFVKQbzNfUWpWw_ovuA=='; |
| 19 | + let email = ''; |
| 20 | + let state = 'idle'; // idle | loading | success | error |
| 21 | +
|
| 22 | + async function subscribe(e) { |
| 23 | + e.preventDefault(); |
| 24 | + state = 'loading'; |
| 25 | + try { |
| 26 | + const body = new FormData(); |
| 27 | + body.append('EMAIL', email); |
| 28 | + body.append('email_address_check', ''); |
| 29 | + body.append('locale', 'en'); |
| 30 | + await fetch(BREVO_ACTION, { method: 'POST', body, mode: 'no-cors' }); |
| 31 | + state = 'success'; |
| 32 | + } catch { |
| 33 | + state = 'error'; |
| 34 | + } |
| 35 | + } |
| 36 | +
|
18 | 37 | const pillars = [ |
19 | 38 | { |
20 | 39 | num: '01', |
|
76 | 95 | sovereign stack. |
77 | 96 | </p> |
78 | 97 |
|
79 | | - <form class="brevo-form" method="POST" action="https://f4c90f0b.sibforms.com/serve/MUIFAAbBH-WyHvhepdhs6G8ul1wze6MjoVvTKJ8hy6wQ2pt2zfKhS72lm7K5SfgHHreybw_QGra18wfbFENLUX33U10YYUe1aPoQOEePElxdHbiM2uGL0Sdsei-N34xBCkoktWbqbtQe1cMW95PLNJ4gd9cZ_YonM0j3W1TrUXhliIJyTXuJ7u4B8pL9aH8uFVKQbzNfUWpWw_ovuA=="> |
80 | | - <div class="brevo-field-row"> |
81 | | - <input class="brevo-input" type="email" id="EMAIL" name="EMAIL" autocomplete="email" placeholder="YOUR EMAIL ADDRESS" required /> |
82 | | - <button class="btn-primary brevo-submit" type="submit">SUBSCRIBE →</button> |
83 | | - </div> |
84 | | - <input type="text" name="email_address_check" value="" style="display:none" /> |
85 | | - <input type="hidden" name="locale" value="en" /> |
86 | | - </form> |
| 98 | + {#if state === 'success'} |
| 99 | + <p class="brevo-success">CONFIRMED. CHECK YOUR INBOX FOR THE OPT-IN EMAIL.</p> |
| 100 | + {:else} |
| 101 | + <form class="brevo-form" on:submit={subscribe}> |
| 102 | + <div class="brevo-field-row"> |
| 103 | + <input class="brevo-input" type="email" bind:value={email} autocomplete="email" placeholder="YOUR EMAIL ADDRESS" required /> |
| 104 | + <button class="btn-primary brevo-submit" type="submit" disabled={state === 'loading'}> |
| 105 | + {state === 'loading' ? 'SENDING...' : 'SUBSCRIBE →'} |
| 106 | + </button> |
| 107 | + </div> |
| 108 | + {#if state === 'error'} |
| 109 | + <p class="brevo-error">SUBMISSION FAILED. PLEASE TRY AGAIN.</p> |
| 110 | + {/if} |
| 111 | + </form> |
| 112 | + {/if} |
87 | 113 |
|
88 | 114 | <p class="launch-note">Double opt-in enabled. Unsubscribe anytime.</p> |
89 | 115 | </div> |
|
179 | 205 | white-space: nowrap; |
180 | 206 | } |
181 | 207 |
|
| 208 | + .brevo-success { |
| 209 | + font-size: var(--fs-body-sm); |
| 210 | + letter-spacing: var(--ls-wider); |
| 211 | + text-transform: uppercase; |
| 212 | + color: var(--text-primary); |
| 213 | + } |
| 214 | +
|
| 215 | + .brevo-error { |
| 216 | + font-size: var(--fs-body-xs); |
| 217 | + letter-spacing: var(--ls-wider); |
| 218 | + text-transform: uppercase; |
| 219 | + color: var(--text-secondary); |
| 220 | + } |
| 221 | +
|
182 | 222 | @media (max-width: 768px) { |
183 | 223 | .launch-briefing { |
184 | 224 | padding: var(--space-5xl) var(--space-xl); |
|
0 commit comments