🌱 Ships in 2 working days · Free Grow Bible →

stagingma.kinsta.cloud logo
Price range: $9.99 through $80.00
This product has multiple variants. The options may be chosen on the product page
gift-card-1

Confirm Your Age

You must be 21 years old or over to enter our website.

By entering this site you are confirming you are over 21 years old and agreeing to the Terms and Conditions 

end, Entire site), staging post 754764587. Offers at regular prices only; no discounts. Data source: Italo's 12-month order analysis (Oct 19 2026). */ (function () { 'use strict'; if (window.apfpUpsells) return; window.apfpUpsells = true; /* ---------- blog posts: Klaviyo embedded sign-up forms (mid-article + end) ---------- Runs right away (this script sits at the end of ), so the placeholders exist before Klaviyo's onsite script scans for embeds. Klaviyo only renders LIVE embed forms; drafts leave the placeholder empty (it takes no space). Form ids come from BETH's plan. */ var BLOG_FORMS = { mid: 'UqkySU', // mid-article: Grow Bible end: 'XmkMds', // end of article state: 'RjRzYE' // state grow-guide posts (/blogs/growing/...-in-/): planting reminders }; function injectBlogForms() { if (!document.body.classList.contains('single-post')) return; var holder = document.querySelector('.elementor-widget-theme-post-content [data-elementor-type="wp-post"]') || document.querySelector('.elementor-widget-theme-post-content .elementor-widget-container'); if (!holder || holder.querySelector('.apfp-blog-form')) return; var isState = /\/blogs\/growing\/[^/]*(-in-|in-)[a-z-]+/.test(location.pathname) && /grow|cannabis|weed|marijuana/.test(location.pathname); var add = function (id, where, label) { if (!id || /^__/.test(id)) return; var box = document.createElement('div'); box.className = 'apfp-blog-form apfp-blog-form--' + label; box.setAttribute('style', 'width:100%;max-width:760px;margin:28px auto;clear:both'); box.innerHTML = '
'; if (where === 'end') holder.appendChild(box); else holder.insertBefore(box, where); }; // Mid-article: before the top-level block that holds the middle

(never inside a flex row). var h2s = holder.querySelectorAll('h2'); if (h2s.length >= 3) { var mid = h2s[Math.floor(h2s.length / 2)], block = mid; while (block.parentElement && block.parentElement !== holder) block = block.parentElement; if (block.parentElement === holder) add(isState ? BLOG_FORMS.state : BLOG_FORMS.mid, block, 'mid'); } add(BLOG_FORMS.end, 'end', 'end'); } try { injectBlogForms(); } catch (e) {} var API = '/wp-json/wc/store/v1'; // Seed variation ids: [1 seed, 6 seeds, 12 seeds], parent product id. var SEEDS = { tropicana: { best: true, parent: 754759002, v: [754759003, 754759004, 754759005], name: 'Tropicana Cookies', type: 'Autoflower', blurb: 'Bright citrus aroma. Our top autoflower.' }, greencrack: { parent: 754758960, v: [754758961, 754758962, 754758963], name: 'Green Crack', type: 'Autoflower', blurb: 'Tangy mango-citrus aroma, a quick grow.' }, sourdiesel: { parent: 754759047, v: [754759048, 754759049, 754759050], name: 'Sour Diesel', type: 'Autoflower', blurb: 'Classic sour fuel aroma.' }, orangepapaya:{ parent: 754759019, v: [754759020, 754759021, 754759022], name: 'Orange Papaya', type: 'Autoflower', blurb: 'Made for small spaces.' }, lcg: { best: true, parent: 754759114, v: [754759115, 754759116, 754759117], name: 'Lemon Cherry Gelato', type: 'Photoperiod', blurb: 'Our top seller, for big outdoor plants.' }, bluedream: { parent: 754759089, v: [754759090, 754759091, 754759092], name: 'Blue Dream', type: 'Photoperiod', blurb: 'Sweet berry flavor, a heavy yielder.' } }; // Which seeds to offer for each kit size. var OFFER = { bonsai: ['tropicana', 'sourdiesel', 'orangepapaya'], two: ['tropicana', 'greencrack', 'sourdiesel'], five: ['tropicana', 'greencrack', 'sourdiesel'], big: ['lcg', 'bluedream', 'tropicana'] }; // 1-pot kit variation -> 2-pot variation, extra cost. var TWO_POT = { 754760350: { to: 754760347, add: '$56.00' }, 754761085: { to: 754761086, add: '$46.96' }, 754760878: { to: 754760880, add: '$40.00' } }; var STARTER_KIT = 754761085; // Indoor 2 gallon, 1 pot ($79.99) var PELLET = 1713, PELLET_PRICE = 2.99; // Jiffy Pellet Seedling Kit Refill: one peat pellet per seed var PACK = [1, 6, 12]; var SEED_IDS = {}, SIX_TO_TWELVE = {}; Object.keys(SEEDS).forEach(function (k) { SEEDS[k].v.forEach(function (id) { SEED_IDS[id] = k; }); SIX_TO_TWELVE[SEEDS[k].v[1]] = SEEDS[k].v[2]; }); var path = location.pathname.replace(/\/+$/, '/'); var onCart = /\/cart\/$/.test(path); var onCheckout = /\/checkout\/$/.test(path); var nonce = null, info = {}; /* ---------- tracking ---------- */ function track(action, label) { try { if (window.gtag) window.gtag('event', 'apfp_upsell', { upsell_action: action, upsell_label: label }); else (window.dataLayer = window.dataLayer || []).push({ event: 'apfp_upsell', upsell_action: action, upsell_label: label }); } catch (e) {} } /* ---------- store helpers ---------- */ function blockStore() { return window.wp && wp.data && wp.data.select && wp.data.select('wc/store/cart') ? wp.data : null; } function getCart() { var d = blockStore(); if (d && (onCart || onCheckout)) { var c = d.select('wc/store/cart').getCartData(); if (c && c.items) return Promise.resolve(c); } return fetch(API + '/cart', { credentials: 'same-origin' }).then(function (r) { nonce = r.headers.get('Nonce') || nonce; return r.json(); }); } function post(route, body) { var go = function () { return fetch(API + route, { method: 'POST', credentials: 'same-origin', headers: { 'Content-Type': 'application/json', Nonce: nonce }, body: JSON.stringify(body) }).then(function (r) { nonce = r.headers.get('Nonce') || nonce; return r.json(); }); }; return nonce ? go() : getCartRaw().then(go); } function getCartRaw() { return fetch(API + '/cart', { credentials: 'same-origin' }).then(function (r) { nonce = r.headers.get('Nonce'); return r.json(); }); } function refreshMiniCart() { try { if (window.jQuery) jQuery(document.body).trigger('wc_fragment_refresh'); } catch (e) {} } function addItem(id, qty) { var d = blockStore(); if (d && (onCart || onCheckout)) return d.dispatch('wc/store/cart').addItemToCart(id, qty || 1); return post('/cart/add-item', { id: id, quantity: qty || 1 }).then(function (r) { refreshMiniCart(); return r; }); } function removeItem(key) { var d = blockStore(); if (d && (onCart || onCheckout)) return d.dispatch('wc/store/cart').removeItemFromCart(key); return post('/cart/remove-item', { key: key }).then(function (r) { refreshMiniCart(); return r; }); } function swapItem(key, toId) { return removeItem(key).then(function () { return addItem(toId, 1); }); } function loadInfo() { var ids = Object.keys(SEEDS).map(function (k) { return SEEDS[k].parent; }).concat([183, PELLET]); try { var c = JSON.parse(sessionStorage.getItem('apfpUpInfo2') || 'null'); if (c && c.t > Date.now() - 36e5) { info = c.d; return Promise.resolve(); } } catch (e) {} return fetch(API + '/products?per_page=20&include=' + ids.join(','), { credentials: 'same-origin' }) .then(function (r) { return r.json(); }) .then(function (list) { (list || []).forEach(function (p) { info[p.id] = { img: p.images && p.images[0] ? (p.images[0].thumbnail || p.images[0].src) : '', url: p.permalink }; }); try { sessionStorage.setItem('apfpUpInfo2', JSON.stringify({ t: Date.now(), d: info })); } catch (e) {} }).catch(function () {}); } /* ---------- reading the cart ---------- */ function kitSize(name) { if (!/grow kit/i.test(name) || /expansion|refill|reload/i.test(name)) return null; if (/bonsai|1\/2 gallon/i.test(name)) return 'bonsai'; if (/35 gallon/i.test(name)) return 'big'; if (/5 gallon/i.test(name)) return 'five'; if (/2 gallon/i.test(name)) return 'two'; return 'five'; } function isSeed(item) { return !!SEED_IDS[item.id] || (/autoflower|photoperiod|strain/i.test(item.name) && !/grow kit/i.test(item.name)); } function packSize(it) { var k = SEED_IDS[it.id]; if (k) return PACK[SEEDS[k].v.indexOf(it.id)] || 1; var v = (it.variation || []).filter(function (a) { return /quantity/i.test(a.attribute); })[0]; return (v && parseInt(v.value, 10)) || 1; } function money(n) { return '$' + n.toFixed(2); } function pelletLine(st, n, short) { var i = info[PELLET] || {}; return '
' + (i.img ? 'Jiffy peat pellet for starting cannabis seeds' : '') + '' + (short ? 'Jiffy peat pellets
' + money(PELLET_PRICE) + ' each, one per seed' : 'Start each seed in a Jiffy pellet. Soak it about 15 minutes, then plant your seed about 1 cm deep. ' + money(PELLET_PRICE) + ' each.') + '
' + '
'; } function readCart(cart) { var s = { kit: null, kitItem: null, seeds: 0, seedCount: 0, pellets: 0, pelletItem: null, six: null, items: (cart && cart.items) || [] }; s.items.forEach(function (it) { var size = kitSize(it.name || ''); if (size && !s.kit) { s.kit = size; s.kitItem = it; } if (it.id === PELLET) { s.pellets += it.quantity; s.pelletItem = it; } if (isSeed(it)) { s.seeds += it.quantity; s.seedCount += it.quantity * packSize(it); if (SIX_TO_TWELVE[it.id] && it.quantity === 1 && !s.six) s.six = it; } }); s.need = Math.max(0, Math.min(s.seedCount, 12) - s.pellets); return s; } /* ---------- UI ---------- */ var CSS = '' + '.apfp-up{font-family:Arial,sans-serif;color:#333;background:#FBF6EA;border:2px solid #72C280;border-radius:16px;padding:18px;margin:18px 0}' + '.apfp-up h3{font-family:Montserrat,Arial,sans-serif;color:#132C17;font-size:20px;margin:0 0 4px}' + '.apfp-up p.apfp-sub{margin:0 0 14px;font-size:14px}' + '.apfp-up-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}' + '.apfp-up-card{background:#fff;border-radius:12px;padding:10px;display:flex;flex-direction:column;gap:6px;box-shadow:0 6px 16px rgba(19,44,23,.10)}' + '.apfp-up-card img{width:100%;aspect-ratio:1/1;object-fit:cover;border-radius:8px;background:#eee}' + '.apfp-up-type{font-size:10px;font-weight:700;letter-spacing:1px;text-transform:uppercase;color:#1F4927}' + '.apfp-up-name{font-family:Montserrat,Arial,sans-serif;font-weight:700;font-size:15px;color:#132C17;line-height:1.2}' + '.apfp-up-blurb{font-size:12px;line-height:1.35;color:#555;flex:1}' + '.apfp-up-btn{display:block;width:100%;border:0;border-radius:8px;padding:10px 6px;font:700 13px Arial,sans-serif;cursor:pointer;background:#72C280;color:#000;text-align:center}' + '.apfp-up-btn:hover{background:#6FD998}.apfp-up-btn.alt{background:#fff;border:1px solid #72C280;color:#132C17;font-weight:600}' + '.apfp-up-btn[disabled]{opacity:.6;cursor:default}' + '.apfp-up-line{display:flex;align-items:center;justify-content:space-between;gap:12px;background:#fff;border-radius:12px;padding:12px 14px;margin-top:12px;font-size:14px}' + '.apfp-up-line .apfp-up-btn{width:auto;padding:10px 16px;white-space:nowrap;background:#A78BFA}' + '.apfp-up > .apfp-up-line:first-child,.apfp-up > .apfp-x + .apfp-up-line{margin-top:0}' + '.apfp-seedpage{font-family:Arial,sans-serif;display:flex;flex-wrap:wrap;gap:10px 12px;align-items:center;max-width:420px;background:#FBF6EA;border:2px solid #72C280;border-radius:12px;padding:12px;margin:14px 0}' + '.apfp-seedpage img{width:56px;height:56px;border-radius:8px;object-fit:cover;flex:0 0 auto}' + '.apfp-seedpage span{flex:1 1 150px;font-size:13px;line-height:1.4;color:#333}.apfp-seedpage b{color:#132C17}' + '.apfp-seedpage .apfp-up-btn{width:100%;padding:11px 14px;white-space:nowrap}' + '@media(max-width:600px){.apfp-seedpage{flex-wrap:wrap}.apfp-seedpage .apfp-up-btn{width:100%}}' + '.apfp-bump{font-family:Arial,sans-serif;border:2px dashed #A78BFA;background:#F5F1FF;border-radius:12px;padding:14px;margin:16px 0;display:flex;gap:12px;align-items:center}' + '.apfp-bump img{width:64px;height:64px;border-radius:8px;object-fit:cover;flex:0 0 auto}' + '.apfp-bump label{display:flex;gap:10px;align-items:flex-start;cursor:pointer;font-size:14px;line-height:1.4;color:#333}' + '.apfp-bump input{width:20px;height:20px;margin-top:2px;flex:0 0 auto;accent-color:#1F4927}' + '.apfp-bump b{color:#132C17}' + '.apfp-modal{position:fixed;inset:0;z-index:999999;background:rgba(19,44,23,.6);display:flex;align-items:center;justify-content:center;padding:16px}' + '.apfp-modal .apfp-up{max-width:640px;width:100%;margin:0;position:relative;max-height:90vh;overflow:auto;background:#FBF6EA}' + '.apfp-x{position:absolute;top:8px;right:10px;border:0;background:none;font-size:26px;line-height:1;cursor:pointer;color:#132C17}' + '.apfp-skip{display:block;margin:12px auto 0;background:none;border:0;color:#555;text-decoration:underline;cursor:pointer;font-size:13px}' + '@media(max-width:600px){.apfp-up-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.apfp-up{padding:14px}.apfp-up-blurb{display:none}' + '.apfp-up-name{font-size:13px}.apfp-up-btn{font-size:12px;padding:9px 4px}.apfp-up-line{flex-direction:column;align-items:stretch;text-align:center}}'; function injectCss() { if (document.getElementById('apfp-up-css')) return; var s = document.createElement('style'); s.id = 'apfp-up-css'; s.textContent = CSS; document.head.appendChild(s); } function esc(t) { var d = document.createElement('div'); d.textContent = t; return d.innerHTML; } function seedCards(keys) { return '
' + keys.map(function (k) { var s = SEEDS[k], i = info[s.parent] || {}; return '
' + (i.img ? '' + esc(s.name) + ' feminized cannabis seeds' : '') + '' + s.type + '' + '' + esc(s.name) + '' + '' + esc(s.blurb) + '' + '' + '' + '
'; }).join('') + '
'; } function offerHtml(st, where) { if (st.kit && st.seeds === 0) { var html = '

Your kit ships without seeds

' + '

Add feminized seeds now so you’re ready to plant the day your kit arrives.' + (st.kit === 'big' ? ' These photoperiods grow big in a 35 gallon pot.' : ' These autoflowers suit your kit and flower on their own.') + '

' + seedCards(OFFER[st.kit]); var up = st.kitItem && st.kitItem.quantity === 1 && TWO_POT[st.kitItem.id]; if (up && where !== 'modal') { html += '
Grow two plants? Switch to the 2-pot kit for ' + up.add + ' more.' + '
'; } return html; } if (where === 'modal') return ''; var parts = []; if (!st.kit && st.seeds > 0) { var k = info[183] || {}; parts.push('

Got something to grow them in?

' + '

Our Indoor 2 Gallon kit has organic super soil, a fabric pot, grow videos and free coaching. Skip it if you already have a kit.

' + '
' + (k.img ? 'Indoor 2 gallon grow kit' : '') + 'Indoor 2 Gallon Grow Kit
Windowsill or grow tent, up to 4 oz
' + '
'); } if (st.need > 0) parts.push(pelletLine(st, st.need)); if (st.six) { parts.push('
Want 6 more seeds? Switch your 6-pack to a 12-pack for $20 more.' + '
'); } return parts.join(''); } function pelletModalHtml(st) { return '

Start your seeds in Jiffy pellets

' + '

One peat pellet per seed gives each one an easy start. Soak it about 15 minutes, then plant your seed about 1 cm deep.

' + pelletLine(st, st.need, true); } function wire(root, after) { root.addEventListener('click', function (e) { var b = e.target.closest('button[data-add],button[data-swap]'); if (!b) return; e.preventDefault(); b.disabled = true; var old = b.textContent; b.textContent = 'Adding…'; var p = b.dataset.add ? addItem(+b.dataset.add, +(b.dataset.qty || 1)) : swapItem(b.dataset.swap, +b.dataset.to); track(b.dataset.add ? 'add' : 'swap', b.dataset.label); Promise.resolve(p).then(function () { b.textContent = 'Added ✓'; if (after) after(); }) .catch(function () { b.disabled = false; b.textContent = old; alert('Sorry, that didn’t add. Please try again.'); }); }); } /* ---------- 1. cart strip ---------- */ function renderStrip() { // Inside the cart's main (left) column, under the item list; never beside it in the flex row. var anchor = document.querySelector('.wc-block-cart__main'); if (!anchor) return; getCart().then(function (cart) { var html = offerHtml(readCart(cart), 'strip'); var box = document.getElementById('apfp-strip'); if (!html) { if (box) box.remove(); return; } if (!box) { box = document.createElement('div'); box.id = 'apfp-strip'; box.className = 'apfp-up'; anchor.appendChild(box); wire(box); track('view', 'cart-strip'); } if (box.dataset.html !== html) { box.innerHTML = html; box.dataset.html = html; } }); } /* ---------- 2. checkout bump ---------- */ function renderBump() { var anchor = document.querySelector('.wp-block-woocommerce-checkout-payment-block, .wc-block-checkout__payment-method'); if (!anchor) return; getCart().then(function (cart) { var st = readCart(cart), box = document.getElementById('apfp-bump'); var pick = st.kit ? SEEDS[OFFER[st.kit][0]] : null; var added = st.items.filter(function (it) { return pick && it.id === pick.v[0]; })[0]; var seedMode = pick && (st.seeds === 0 || added) && !(box && box.dataset.mode === 'pellet'); var bumpN = box ? +(box.dataset.bumpN || 0) : 0; if (!seedMode) { if (st.need > 0 || bumpN > 0) return renderPelletBump(anchor, st, box, bumpN); if (box) box.remove(); return; } if (!box) { box = document.createElement('div'); box.id = 'apfp-bump'; box.className = 'apfp-bump'; box.dataset.mode = 'seed'; anchor.parentNode.insertBefore(box, anchor); track('view', 'checkout-bump'); box.addEventListener('change', function (e) { var cb = e.target; cb.disabled = true; getCart().then(function (c) { var line = (c.items || []).filter(function (it) { return it.id === pick.v[0]; })[0]; var p = cb.checked ? addItem(pick.v[0], 1) : (line ? removeItem(line.key) : null); track(cb.checked ? 'add' : 'remove', 'bump-' + pick.name); return p; }).finally(function () { cb.disabled = false; }); }); } var i = info[pick.parent] || {}; var html = (i.img ? '' + esc(pick.name) + ' seeds' : '') + ''; if (box.dataset.html !== html) { box.innerHTML = html; box.dataset.html = html; } }); } function setQty(key, qty) { var d = blockStore(); if (qty <= 0) return removeItem(key); if (d && (onCart || onCheckout)) return d.dispatch('wc/store/cart').changeCartItemQuantity(key, qty); return post('/cart/update-item', { key: key, quantity: qty }); } function renderPelletBump(anchor, st, box, bumpN) { var n = bumpN || st.need; if (!box) { box = document.createElement('div'); box.id = 'apfp-bump'; box.className = 'apfp-bump'; box.dataset.mode = 'pellet'; anchor.parentNode.insertBefore(box, anchor); track('view', 'checkout-pellet-bump'); box.addEventListener('change', function (e) { var cb = e.target, k = +(box.dataset.offerN || 1); cb.disabled = true; getCart().then(function (c) { var s2 = readCart(c), p; if (cb.checked) { box.dataset.bumpN = String(k); p = addItem(PELLET, k); } else { box.dataset.bumpN = '0'; p = s2.pelletItem ? setQty(s2.pelletItem.key, s2.pelletItem.quantity - k) : null; } track(cb.checked ? 'add' : 'remove', 'bump-pellets-' + k); return p; }).finally(function () { cb.disabled = false; }); }); } box.dataset.mode = 'pellet'; box.dataset.offerN = String(n); var i = info[PELLET] || {}; var html = (i.img ? 'Jiffy peat pellet' : '') + ''; if (box.dataset.html !== html) { box.innerHTML = html; box.dataset.html = html; } } /* ---------- seed pages: pellet offer under the add-to-cart form ---------- */ function renderSeedPage() { var form = document.querySelector('form.variations_form[data-product_variations*="attribute_quantity"]'); if (!form || document.getElementById('apfp-seedpage')) return; var i = info[PELLET] || {}; var box = document.createElement('div'); box.id = 'apfp-seedpage'; box.className = 'apfp-seedpage'; box.innerHTML = (i.img ? 'Jiffy peat pellet for starting cannabis seeds' : '') + 'Starting from seed? Add a Jiffy pellet for each seed. Soak it about 15 minutes, then plant your seed about 1 cm deep.' + ''; form.parentNode.insertBefore(box, form.nextSibling); wire(box); track('view', 'seedpage-pellet'); } /* ---------- 3 & 4. pop-ups ---------- */ function showModal(st, reason, kind) { if (document.getElementById('apfp-modal')) return; var html = kind === 'pellet' ? pelletModalHtml(st) : offerHtml(st, 'modal'); if (!html) return; var m = document.createElement('div'); m.id = 'apfp-modal'; m.className = 'apfp-modal'; m.innerHTML = ''; document.body.appendChild(m); var close = function () { m.remove(); }; m.addEventListener('click', function (e) { if (e.target === m || e.target.closest('.apfp-x,.apfp-skip')) { track('close', reason); close(); } }); wire(m, function () { setTimeout(close, 900); }); try { sessionStorage.setItem(kind === 'pellet' ? 'apfpPelletShown' : 'apfpUpShown', '1'); } catch (e) {} track('view', reason); } function alreadyShown() { try { return sessionStorage.getItem('apfpUpShown') === '1'; } catch (e) { return true; } } function pelletShown() { try { return sessionStorage.getItem('apfpPelletShown') === '1'; } catch (e) { return true; } } // After an add to cart anywhere on the site (not on cart/checkout). // On page load we only react if WooCommerce just said "added to your cart" (classic add-to-cart reloads the page); // after an AJAX add we react whenever the cart grew. function checkAfterAdd(fromEvent) { if (onCart || onCheckout || (alreadyShown() && pelletShown())) return; var flagged = false; try { flagged = Date.now() - +(sessionStorage.getItem('apfpJustAdded') || 0) < 60000; sessionStorage.removeItem('apfpJustAdded'); } catch (e) {} var noticed = /added to your cart/i.test((document.querySelector('.woocommerce-message, .woocommerce-notices-wrapper') || {}).textContent || ''); if (!fromEvent && !flagged && !noticed) return; getCartRaw().then(function (cart) { var st = readCart(cart), count = st.items.length, prev = sessionStorage.getItem('apfpUpCount'); try { sessionStorage.setItem('apfpUpCount', String(count)); } catch (e) {} var justAdded = fromEvent ? count > +(prev || 0) : true; if (!justAdded) return; if (st.kit && st.seeds === 0 && !alreadyShown()) loadInfo().then(function () { showModal(st, 'after-add'); }); else if (st.seeds > 0 && st.need > 0 && !pelletShown()) loadInfo().then(function () { showModal(st, 'after-seed-add', 'pellet'); }); }).catch(function () {}); } // Leaving the cart page (desktop mouse heads for the tab bar). function exitIntent() { document.addEventListener('mouseout', function (e) { if (e.relatedTarget || e.clientY > 8 || alreadyShown()) return; getCart().then(function (cart) { var st = readCart(cart); if (st.kit && st.seeds === 0) showModal(st, 'exit-cart'); }); }); } /* ---------- staging only: open the Klaviyo A/B welcome popup Xqgf2a by our own rules ---------- */ function openWelcomePopup() { if (location.hostname !== 'stagingma.kinsta.cloud') return; if (['cart','checkout','my-account','product','blogs'].indexOf(location.pathname.split('/')[1]) !== -1) return; var now = Date.now(), ls = function (k, v) { try { if (v === undefined) return localStorage.getItem(k); localStorage.setItem(k, v); } catch (e) { return null; } }; if (ls('apfpWelcomeDone') || now - +(ls('apfpWelcomeShown') || 0) < 14 * 864e5) return; window.addEventListener('klaviyoForms', function (e) { if (e.detail && e.detail.formId === 'Xqgf2a' && /submit/i.test(e.detail.type || '')) ls('apfpWelcomeDone', '1'); }); var waited = false, scrolled = false, fired = false; var ageGateOpen = function () { var g = document.querySelector('.elementor-popup-modal'); return !!(g && g.offsetParent !== null && getComputedStyle(g).display !== 'none'); }; var tryOpen = function () { if (fired || !waited || !scrolled || ageGateOpen() || document.getElementById('apfp-modal')) return; fired = true; ls('apfpWelcomeShown', String(Date.now())); (window._klOnsite = window._klOnsite || []).push(['openForm', 'Xqgf2a']); track('view', 'welcome-popup-staging'); }; setTimeout(function () { waited = true; tryOpen(); }, 15000); window.addEventListener('scroll', function () { if (!scrolled && (scrollY + innerHeight) / Math.max(1, document.body.scrollHeight) >= 0.5) { scrolled = true; tryOpen(); } }, { passive: true }); setInterval(tryOpen, 2000); } /* ---------- staging only: Klaviyo flyouts Ye74hD (blog posts, 60% scroll) and X8uXFn (phone product pages, fast scroll-up) ---------- */ function openStagingFlyouts() { if (location.hostname !== 'stagingma.kinsta.cloud') return; var first = location.pathname.split('/')[1]; var ls = function (k, v) { try { if (v === undefined) return localStorage.getItem(k); localStorage.setItem(k, v); } catch (e) { return null; } }; var open = function (id, key) { if (Date.now() - +(ls(key) || 0) < 14 * 864e5 || document.querySelector('.apfp-modal')) return false; ls(key, String(Date.now())); (window._klOnsite = window._klOnsite || []).push(['openForm', id]); track('view', 'flyout-' + id + '-staging'); return true; }; if (first === 'blogs' && document.body.classList.contains('single-post')) { var done = false; window.addEventListener('scroll', function () { if (!done && (scrollY + innerHeight) / Math.max(1, document.body.scrollHeight) >= 0.6) done = open('Ye74hD', 'apfpBlogFlyout') || true; }, { passive: true }); } if (first === 'product' && window.matchMedia('(max-width: 767px)').matches) { var maxY = 0, lastY = scrollY, lastT = Date.now(), fired = false; window.addEventListener('scroll', function () { var y = scrollY, t = Date.now(); maxY = Math.max(maxY, y); var speed = (lastY - y) / Math.max(1, t - lastT); // px per ms, upward if (!fired && maxY > document.body.scrollHeight * 0.3 && speed > 1.2) fired = open('X8uXFn', 'apfpProductFlyout') || true; lastY = y; lastT = t; }, { passive: true }); } } /* ---------- start ---------- */ function start() { injectCss(); loadInfo().then(function () { if (onCart) { renderStrip(); exitIntent(); var d = blockStore(); if (d) d.subscribe(debounce(renderStrip, 400)); setInterval(renderStrip, 4000); } else if (onCheckout) { renderBump(); var d2 = blockStore(); if (d2) d2.subscribe(debounce(renderBump, 400)); setInterval(renderBump, 4000); } else { openWelcomePopup(); openStagingFlyouts(); renderSeedPage(); document.addEventListener('submit', function (e) { if (e.target && e.target.matches && e.target.matches('form.cart')) { try { sessionStorage.setItem('apfpJustAdded', String(Date.now())); } catch (x) {} } }, true); checkAfterAdd(false); var onAdd = function () { setTimeout(function () { checkAfterAdd(true); }, 300); }; if (window.jQuery) jQuery(document.body).on('added_to_cart', onAdd); document.addEventListener('wc-blocks_added_to_cart', onAdd); } }); } function debounce(fn, ms) { var t; return function () { clearTimeout(t); t = setTimeout(fn, ms); }; } if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', start); else start(); })();