Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
151 commits
Select commit Hold shift + click to select a range
0d945f6
Build Cellife homepage foundation with brand styling
cremechese Oct 22, 2026
e7bda78
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 23, 2026
7c22062
Make homepage hero full width with frosted text overlay
cremechese Oct 23, 2026
4b234ba
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 23, 2026
ee25063
Make hero glass panel more transparent
cremechese Oct 23, 2026
c270cfa
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 23, 2026
15233c9
Add isolated supplement and diagnostic shopping journeys
cremechese Oct 23, 2026
504b6af
Enable first-visit homepage pathway selection overlay
cremechese Oct 23, 2026
6ca5b59
Load journey overlay script independently of header section settings
cremechese Oct 23, 2026
378dc33
Make supplements the homepage while retaining pathway popup
cremechese Oct 23, 2026
61cc866
Build Cellife editorial storefront with editable content placeholders
cremechese Oct 23, 2026
b829d12
Record Shopify preview verification and review limitations
cremechese Oct 23, 2026
48cf2c6
Focus homepage on products, moving stories, quiz and welcome offer
cremechese Oct 23, 2026
4cdebdf
Fix Shopify quiz-banner URL schema and retry homepage sync
cremechese Oct 23, 2026
a35ed57
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 26, 2026
859932c
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 26, 2026
3e92718
Preserve desktop hero composition with height cap and matching side bars
cremechese Oct 29, 2026
cefe044
Show complete product bottles in cards without cropping or hover zoom
cremechese Oct 29, 2026
f90acf7
Keep primary product photo and add restrained accessible hover zoom
cremechese Oct 29, 2026
af094d1
Add theme-editor slider for product image hover zoom strength
cremechese Oct 29, 2026
b4a0d1a
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 29, 2026
8ae3760
Move product hover zoom control into Product cards theme settings
cremechese Oct 29, 2026
4174795
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 29, 2026
40c560a
Add curated four-product picker independent of shelf collection link
cremechese Oct 29, 2026
8d88ea9
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 29, 2026
bf72271
Replace homepage approach cards with centered icon values section
cremechese Oct 29, 2026
5d3b4be
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 29, 2026
6dd6897
Add accessible footer credits for four supplied Flaticon attributions
cremechese Oct 29, 2026
d43dc9d
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 29, 2026
ec8f2ff
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 29, 2026
8fa1eab
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 29, 2026
da4c2d9
Align icon headings, fixed-height image frames and captions across sh…
cremechese Oct 29, 2026
81e3907
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 29, 2026
a367ddc
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 29, 2026
81d0b42
Create mixed testimonial and portrait-video rail preserving uploaded …
cremechese Oct 29, 2026
058d55e
Add optional story ratings, verified labels and linked video product …
cremechese Oct 29, 2026
273c621
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 29, 2026
511c2da
Add testimonial attribution subtitles with clear name and role hierarchy
cremechese Oct 29, 2026
9452610
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 29, 2026
06a0dbd
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 29, 2026
65ec0d5
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 29, 2026
f221150
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 29, 2026
ea8eb40
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 29, 2026
ce4f048
Center-fill testimonial videos and posters without letterboxing
cremechese Oct 29, 2026
f3a1836
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 29, 2026
dc0abe2
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 29, 2026
e957a8c
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 29, 2026
6a6aaec
Add per-testimonial quote size slider and prevent top clipping on lon…
cremechese Oct 29, 2026
e0815c7
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 30, 2026
a854393
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 30, 2026
b85f827
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 30, 2026
524a29c
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 30, 2026
4c1d1b1
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 30, 2026
5566055
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 30, 2026
db561b3
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 30, 2026
5d85d24
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 30, 2026
d2aca13
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 30, 2026
1082662
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 30, 2026
08e4e7c
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 30, 2026
03dd6e6
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 30, 2026
e6d55ee
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 30, 2026
52e6228
Add Cellife Product Finder to unpublished preview theme with native p…
cremechese Oct 30, 2026
c291043
Replace finder with clean v2 two-to-three-question discovery flow
cremechese Oct 30, 2026
d14e7b8
Simplify finder result copy and add native add-to-cart with product p…
cremechese Oct 30, 2026
ee66094
Move finder purchase controls above product precautions
cremechese Oct 30, 2026
96516eb
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 30, 2026
ffbe864
Enable welcome signup with CELLIFE10 across supplements and diagnosti…
cremechese Oct 30, 2026
274c945
Improve welcome signup button interaction feedback
cremechese Oct 30, 2026
4b60045
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 30, 2026
5d92c40
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 30, 2026
da18a7c
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 30, 2026
7883a4d
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 30, 2026
a7e60dd
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Oct 30, 2026
65a022e
Recreate Cellife footer with editable brand blurb and Shop Company Su…
cremechese Oct 30, 2026
49aa68a
Migrate six legacy Cellife templates to current Dawn sections
cremechese Nov 3, 2026
be99f0c
Restore uniform All Products cards and independent collection pagination
cremechese Nov 3, 2026
6afbfa9
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 3, 2026
0cecae9
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 3, 2026
c44e845
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 3, 2026
9acb50a
Copy latest homepage into independently editable diagnostics landing …
cremechese Nov 3, 2026
986348d
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 3, 2026
6c1801a
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 3, 2026
7d6cfc5
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 3, 2026
43edd5a
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 3, 2026
d902c81
Fix Cellife product shelf title contrast with brand blue
cremechese Nov 3, 2026
7262ba9
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 4, 2026
efeb9c8
Remove quiz call to action from diagnostics hero
cremechese Nov 4, 2026
74ef661
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 4, 2026
9de8c41
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 4, 2026
7026264
Move transparent content-sized hero styling into shared stylesheet
cremechese Nov 4, 2026
48781ff
Stack mobile hero copy above full uncropped product artwork
cremechese Nov 4, 2026
828ecd0
Center shared hero copy and actions on mobile
cremechese Nov 4, 2026
1b81b40
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 4, 2026
d0dd632
Add four diagnostic icon attributions to footer credits
cremechese Nov 4, 2026
f54f8a1
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 4, 2026
f351ee1
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 4, 2026
4da9392
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 4, 2026
ea2b459
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 4, 2026
c25cf25
Constrain tall icons and wrap icon section supporting text
cremechese Nov 4, 2026
7fa4b80
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 4, 2026
248563c
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 4, 2026
392c112
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 4, 2026
327f145
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 4, 2026
573de49
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 4, 2026
c5e9eef
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 4, 2026
df7bcba
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 4, 2026
35b39c4
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 4, 2026
632cc86
Connect quiz links and enable product finder on published themes
cremechese Nov 4, 2026
12abd75
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 4, 2026
b6744ca
Add compact adjustable height limit for product page photos
cremechese Nov 4, 2026
fcf7d1b
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 4, 2026
fd91fad
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 4, 2026
151402a
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 4, 2026
52ad03d
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 4, 2026
b9725f0
Align collection card titles prices and actions with light image padding
cremechese Nov 4, 2026
3a15310
Install self-hosted Broadacre and Inter fonts and correct Cellife bra…
cremechese Nov 4, 2026
1d4c1f4
Use Broadacre Thin headings and remove nested testimonial scrolling
cremechese Nov 4, 2026
dcbb153
Increase heading weight from Broadacre Thin to Light
cremechese Nov 4, 2026
9ac63b4
Use Inter for product titles while retaining Broadacre editorial head…
cremechese Nov 4, 2026
8a6bfa0
Increase Broadacre headings from Light to Regular
cremechese Nov 4, 2026
1e22fd0
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 5, 2026
c195ada
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 5, 2026
a4b4675
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 5, 2026
b6db956
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 9, 2026
5f6ebce
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 9, 2026
e746f93
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 9, 2026
6956722
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 9, 2026
b111939
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 9, 2026
1958abc
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 9, 2026
6c637f4
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 9, 2026
fa0089a
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 9, 2026
61978e5
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 9, 2026
9d431bf
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 9, 2026
5a82102
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 9, 2026
4d5cf53
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 9, 2026
a78aa29
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 9, 2026
155a107
Add five-option Broadacre heading weight setting with Medium default
cremechese Nov 9, 2026
196ccb7
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 9, 2026
2818e48
Reduce Cellife hero copy width to 75 percent
cremechese Nov 9, 2026
67d6504
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 9, 2026
70ef427
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 9, 2026
fbe547a
Add modest padding around mobile hero artwork
cremechese Nov 9, 2026
563ca29
Fix mobile page overflow from non-breaking community introduction text
cremechese Nov 9, 2026
d63baee
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 10, 2026
3208364
Add stock-independent export enquiry basket with native contact submi…
cremechese Nov 13, 2026
ce96a0e
Hide export variant dropdown for single-variant products
cremechese Nov 16, 2026
416d591
Style export enquiry count as red circle beside native cart count
cremechese Nov 16, 2026
bb08840
Preserve native enquiry success state and submit prepared contact pay…
cremechese Nov 16, 2026
9a93e1c
Update from Shopify for theme cellife-shopify-theme/cellife-rebuild b…
shopify[bot] Nov 20, 2026
8b5b712
Embed Hulk enquiry form on export collection
cremechese Nov 20, 2026
65e5bab
Attach Hulk form directly to export collection
cremechese Nov 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
name: CI
on: [push]
name: Theme checks
on: [push, pull_request]
permissions:
contents: read
jobs:
lhci:
name: Lighthouse
structure:
name: JSON and section schemas
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Lighthouse
uses: shopify/lighthouse-ci-action@v1
with:
store: ${{ secrets.SHOP_STORE_OS2 }}
password: ${{ secrets.SHOP_PASSWORD_OS2 }}
access_token: ${{ secrets.SHOP_ACCESS_TOKEN }}
collection_handle: all
lhci_github_app_token: ${{ secrets.LHCI_GITHUB_TOKEN }}
pull_theme: ${{ secrets.SHOP_PULL_THEME }}
- run: python3 scripts/check-theme-json.py
theme-check:
name: Theme Check
runs-on: ubuntu-latest
Expand Down
230 changes: 230 additions & 0 deletions PROJECT_PLAN.md

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# Dawn
# Cellife Shopify theme

Start with [the project plan](PROJECT_PLAN.md) and [the Cellife development guide](docs/DEVELOPMENT.md)
for baseline provenance, local checks and the safe preview workflow. The upstream
Dawn documentation follows for reference; the Cellife guide takes precedence for
project workflow and release safety.

## Upstream Dawn

[![Build status](https://github.com/shopify/dawn/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/Shopify/dawn/actions/workflows/ci.yml?query=branch%3Amain)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?color=informational)](/.github/CONTRIBUTING.md)
Expand Down
Binary file added assets/broadacre-hairline.woff2
Binary file not shown.
Binary file added assets/broadacre-light.woff2
Binary file not shown.
Binary file added assets/broadacre-medium.woff2
Binary file not shown.
Binary file added assets/broadacre-regular.woff2
Binary file not shown.
Binary file added assets/broadacre-thin.woff2
Binary file not shown.
233 changes: 233 additions & 0 deletions assets/cellife-editorial.css

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions assets/cellife-export-basket.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* Product/quantity data only. No customer details or payment data are persisted. */
export const KEY = 'cellife-export-enquiry:v1';
export const MAX_ITEMS = 50;
export function normalizeEntries(value) {
if (!Array.isArray(value) || value.length > MAX_ITEMS) throw new Error('Invalid enquiry cart.');
const seen = new Set();
return value.map(item => {
if (!item || !/^[a-z0-9][a-z0-9-]{0,199}$/.test(item.handle) || !/^\d{1,24}$/.test(String(item.variantId)) || !Number.isInteger(item.quantity) || item.quantity < 1 || item.quantity > 999) throw new Error('Invalid enquiry item.');
const variantId = String(item.variantId);
if (seen.has(variantId)) throw new Error('Duplicate enquiry item.');
seen.add(variantId);
return {handle: item.handle, variantId, quantity: item.quantity};
});
}
export function mergeEntry(items, entry) {
const next = normalizeEntries(items).map(item => ({...item}));
const valid = normalizeEntries([entry])[0], existing = next.find(item => item.variantId === valid.variantId);
if (existing) existing.quantity += valid.quantity;
else next.push(valid);
return normalizeEntries(next);
}
export function subtractSubmitted(items, submitted) {
return normalizeEntries(items).map(item => ({...item, quantity: item.quantity - (submitted.find(sent => sent.variantId === item.variantId)?.quantity || 0)})).filter(item => item.quantity > 0);
}
export function summary(items) {
return ['EXPORT PRODUCT ENQUIRY — NO PAYMENT / NOT A CONFIRMED ORDER', ...items.map(({entry, product, variant}) => [
'Product: ' + product.title, 'Variant: ' + variant.title, 'Quantity: ' + entry.quantity,
'SKU: ' + (variant.sku || 'Not supplied'), 'Barcode: ' + (variant.barcode || 'Not supplied'),
'Product ID: ' + product.id, 'Variant ID: ' + variant.id,
'Brand: ' + product.vendor, 'Type: ' + product.type,
'Product URL: ' + product.url
].join('\n'))].join('\n\n');
}
228 changes: 228 additions & 0 deletions assets/cellife-export-enquiry.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
import {KEY, normalizeEntries, mergeEntry, subtractSubmitted, summary} from './cellife-export-basket.js';

const routes = JSON.parse(document.getElementById('CellifeExportRoutes')?.textContent || '{"root":"/","cart":"/cart"}');
const cartPath = routes.cart.replace(/\/$/, ''), pendingKey = KEY + ':submitted';
function readState() {
const stored = JSON.parse(localStorage.getItem(KEY) || '[]');
return {items:normalizeEntries(Array.isArray(stored) ? stored : stored.items), moved:stored.moved || {}};
}
function read() { return readState().items; }
function writeState(state) {
localStorage.setItem(KEY, JSON.stringify({items:normalizeEntries(state.items), moved:state.moved}));
document.dispatchEvent(new CustomEvent('cellife:export-change'));
}
function save(items) {
const state = readState(), valid = normalizeEntries(items);
for (const [key, moved] of Object.entries(state.moved)) {
if (!valid.some(item => item.variantId === moved.variantId && item.quantity >= moved.quantity)) delete state.moved[key];
}
writeState({items:valid, moved:state.moved});
}
function message(target, text) { if (target) target.textContent = text; }
function count() { try { return read().reduce((sum, item) => sum + item.quantity, 0); } catch { return 0; } }
function refreshIndicators() {
const total = count();
document.documentElement.classList.toggle('cellife-export-pending', total > 0);
const cartLink = document.getElementById('cart-icon-bubble');
let badge = cartLink?.querySelector('[data-export-count]');
if (!badge && cartLink && total) {
badge = document.createElement('span'); badge.dataset.exportCount = '';
badge.className = 'cellife-export-count'; cartLink.append(badge);
}
if (badge) {
badge.hidden = !total;
if (badge.textContent !== String(total)) badge.textContent = String(total);
badge.setAttribute('aria-label', 'Export enquiry items: ' + total);
}
// Only cart checkout controls change. Regular product payment buttons stay native.
document.querySelectorAll('button[name="checkout"]').forEach(button => {
if (!button.dataset.exportOriginalLabel) button.dataset.exportOriginalLabel = button.textContent.trim();
const label = total ? 'Review export enquiry' : button.dataset.exportOriginalLabel;
if (button.textContent.trim() !== label) button.textContent = label;
});
}
function interceptCheckout(event) {
if (!count()) return;
const target = event.target.closest?.('button[name="checkout"], a[href]');
const isCartLink = target?.id === 'cart-icon-bubble';
const href = target?.getAttribute('href') || '';
const payment = target?.matches('button[name="checkout"]') || /^\/(?:[a-z]{2}(?:-[a-z]{2})?\/)?checkout(?:[/?#]|$)/i.test(href);
if (isCartLink || payment) {
event.preventDefault(); event.stopImmediatePropagation();
location.assign(cartPath + '#cellife-export-enquiry');
}
}
document.addEventListener('click', interceptCheckout, true);
document.addEventListener('submit', event => {
if (event.submitter?.name === 'checkout' && count()) {
event.preventDefault(); event.stopImmediatePropagation(); location.assign(cartPath + '#cellife-export-enquiry');
}
}, true);
// Dawn replaces cart controls using Section Rendering.
new MutationObserver(refreshIndicators).observe(document.body, {childList:true, subtree:true});
document.addEventListener('cellife:export-change', refreshIndicators);
window.addEventListener('storage', event => { if (event.key === KEY || event.key === null) document.dispatchEvent(new CustomEvent('cellife:export-change')); });
refreshIndicators();

const metadata = new Map();
async function getProduct(handle, fresh = false) {
if (!fresh && metadata.has(handle)) return metadata.get(handle);
const url = new URL(routes.root + 'products/' + handle, location.origin);
url.searchParams.set('view', 'cellife-export-data');
const response = await fetch(url, {cache:'no-store', credentials:'same-origin'});
if (!response.ok) throw new Error('Product information could not be loaded. Please try again.');
let product;
try { product = JSON.parse(await response.text()); }
catch { throw new Error('Product information could not be loaded. Please try again.'); }
if (product.exportOnly !== true || product.handle !== handle || !/^\d{1,24}$/.test(String(product.id)) || typeof product.title !== 'string' || !product.title || typeof product.url !== 'string' || !Array.isArray(product.variants) || product.variants.some(v => !/^\d{1,24}$/.test(String(v.id)) || typeof v.title !== 'string')) throw new Error('An item is no longer available for export enquiry. Remove it to continue.');
product.url = new URL(product.url, location.origin).href;
if (new URL(product.url).origin !== location.origin) throw new Error('Invalid product link.');
metadata.set(handle, product);
return product;
}
async function resolveItems(entries, fresh = false) {
return Promise.all(entries.map(async entry => {
const product = await getProduct(entry.handle, fresh), variant = product.variants.find(v => String(v.id) === entry.variantId);
if (!variant) throw new Error('A selected variant no longer exists. Remove that item and select it again.');
return {entry, product, variant};
}));
}
if (!customElements.get('cellife-export-picker')) customElements.define('cellife-export-picker', class extends HTMLElement {
connectedCallback() {
if (this.ready) return; this.ready = true;
const button = this.querySelector('[data-export-add]'), status = this.querySelector('[data-export-status]');
let product;
try { product = JSON.parse(this.querySelector('[data-export-product]').textContent); if (!product.exportOnly) return; }
catch { return; }
button.disabled = false;
button.addEventListener('click', async () => {
const input = this.querySelector('[data-export-quantity]');
if (!input.reportValidity()) return;
button.disabled = true;
try {
const entry = normalizeEntries([{handle:product.handle, variantId:this.querySelector('[data-export-variant]').value, quantity:Number(input.value)}])[0];
await resolveItems([entry], true);
save(mergeEntry(read(), entry));
message(status, 'Added to your export enquiry cart. You can keep browsing or review your enquiry cart.');
} catch (error) { message(status, error instanceof DOMException ? 'Your browser could not save the enquiry cart. Enable browser storage or contact Cellife directly.' : error.message); }
finally { button.disabled = false; }
});
}
});

if (!customElements.get('cellife-export-enquiry')) customElements.define('cellife-export-enquiry', class extends HTMLElement {
connectedCallback() {
if (this.ready) return; this.ready = true;
this.form = this.querySelector('form');
this.fields = this.querySelector('[data-export-fields]');
this.items = this.querySelector('[data-export-items]');
this.status = this.querySelector('[data-export-message]');
this.native = JSON.parse(this.querySelector('[data-export-native]').textContent);
if (typeof window.subscribe === 'function') this.unsubscribeCart = window.subscribe('cart-update', ({cartData}) => {
if (!Array.isArray(cartData?.items)) return;
this.native.items = this.native.items.filter(item => cartData.items.some(line => line.key === item.key));
this.native.regularCount = cartData.items.filter(line => !this.native.items.some(item => item.key === line.key)).reduce((sum,line) => sum + line.quantity, 0);
this.querySelector('[data-export-mixed]').hidden = !this.native.regularCount;
this.querySelector('[data-export-native-warning]').hidden = !this.native.items.length;
this.render();
});
this.querySelector('[data-export-mixed]').hidden = !this.native.regularCount;
this.querySelector('[data-export-native-warning]').hidden = !this.native.items.length;
const country = this.querySelector('#ExportCountry');
[...country.options].filter(option => ['Australia','---'].includes(option.value)).forEach(option => option.disabled = true);
country.addEventListener('change', () => country.setCustomValidity(country.value === 'Australia' ? 'Choose a destination outside Australia.' : ''));
this.querySelector('[data-export-migrate]').addEventListener('click', () => this.migrate());
this.handleChange = () => this.render(); document.addEventListener('cellife:export-change', this.handleChange);
this.form.addEventListener('submit', event => this.submit(event), {capture:true});
if (this.querySelector('[data-export-success]')) {
try {
const submitted = normalizeEntries(JSON.parse(sessionStorage.getItem(pendingKey) || '[]'));
if (submitted.length) save(subtractSubmitted(read(), submitted));
sessionStorage.removeItem(pendingKey);
} catch { /* Keep the saved enquiry if a confirmed submission cannot be reconciled. */ }
this.querySelector('[data-export-success]').focus();
}
this.render();
}
disconnectedCallback() { document.removeEventListener('cellife:export-change', this.handleChange); this.unsubscribeCart?.(); }
async render() {
const version = this.version = (this.version || 0) + 1;
this.fields.disabled = true; this.hidden = false;
let entries;
try { entries = read(); }
catch { message(this.status, 'The saved enquiry cart could not be read. Please contact Cellife for help.'); return; }
const success = Boolean(this.querySelector('[data-export-success]'));
this.hidden = !entries.length && !this.native.items.length && !success;
this.querySelector('[data-export-empty]').hidden = entries.length > 0 || success;
this.items.replaceChildren();
if (!entries.length) return;
let resolved = [];
try { resolved = await resolveItems(entries); }
catch (error) { message(this.status, error.message); }
if (this.version !== version) return;
for (const entry of entries) {
const item = resolved.find(item => item.entry.variantId === entry.variantId);
const row = document.createElement('div'); row.className = 'cellife-export-item';
const info = document.createElement('div'), title = document.createElement('h3');
title.textContent = item?.product.title || entry.handle; info.append(title);
if (item) { const details = document.createElement('p'); details.textContent = item.variant.title + (item.variant.sku ? ' · SKU: ' + item.variant.sku : ''); info.append(details); }
const label = document.createElement('label'); label.textContent = 'Quantity';
const input = document.createElement('input'); input.type = 'number'; input.min = '1'; input.max = '999'; input.step = '1'; input.value = entry.quantity;
label.append(input);
input.addEventListener('change', () => {
if (!input.reportValidity()) return;
try { save(read().map(existing => existing.variantId === entry.variantId ? {...existing, quantity:Number(input.value)} : existing)); }
catch (error) { message(this.status, error.message); }
});
const remove = document.createElement('button'); remove.type = 'button'; remove.className = 'link underlined-link'; remove.textContent = 'Remove'; remove.setAttribute('aria-label', 'Remove ' + (item?.product.title || entry.handle));
remove.addEventListener('click', () => { try { save(read().filter(existing => existing.variantId !== entry.variantId)); } catch (error) { message(this.status, error.message); } });
row.append(info, label, remove); this.items.append(row);
}
this.fields.disabled = resolved.length !== entries.length || this.native.items.length > 0;
if (!this.fields.disabled) message(this.status, 'Availability, pricing and shipping will be confirmed by the Cellife team.');
}
async submit(event) {
if (this.prepared) { this.prepared = false; return; }
event.preventDefault();
event.stopImmediatePropagation(); // Only the fully prepared second submit reaches Shopify's handlers.
if (this.submitting) return;
const country = this.querySelector('#ExportCountry');
if (!country.value || ['Australia','---'].includes(country.value) || this.native.items.length) {
country.setCustomValidity('Choose an export destination outside Australia.'); country.reportValidity(); return;
}
this.submitting = true;
const button = this.form.querySelector('button[type="submit"]'); button.disabled = true;
try {
const entries = read(); if (!entries.length) throw new Error('Add a product before submitting.');
const resolved = await resolveItems(entries, true);
this.querySelector('[data-export-summary]').value = summary(resolved);
// Snapshot only product IDs/quantities, never the customer's form fields.
try { sessionStorage.setItem(pendingKey, JSON.stringify(entries)); } catch { /* Confirmation will retain cart if storage is unavailable. */ }
this.prepared = true; button.disabled = false;
this.form.requestSubmit(button); // Preserve native Shopify validation and spam protection.
} catch (error) { message(this.status, error.message); }
finally { this.submitting = false; button.disabled = false; }
}
async migrate() {
const button = this.querySelector('[data-export-migrate]'); button.disabled = true;
try {
const cartResponse = await fetch(cartPath + '.js', {cache:'no-store'}); if (!cartResponse.ok) throw new Error('Could not read the shopping cart.');
const cart = await cartResponse.json();
const lines = cart.items.filter(item => this.native.items.some(native => native.key === item.key));
const entries = lines.map(item => ({handle:item.handle, variantId:String(item.variant_id), quantity:item.quantity}));
await resolveItems(entries, true);
// Journal each line so retrying a failed cart update cannot duplicate its quantity.
const state = readState(), journal = state.moved;
let items = state.items;
for (let index = 0; index < lines.length; index++) if (!journal[lines[index].key]) { items = mergeEntry(items, entries[index]); journal[lines[index].key] = {variantId:entries[index].variantId,quantity:entries[index].quantity}; }
// One atomic browser-storage write precedes the Shopify mutation. Retries are idempotent.
writeState({items, moved:journal});
const response = await fetch(cartPath + '/update.js', {method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({updates:Object.fromEntries(lines.map(line => [line.key,0]))})});
if (!response.ok) throw new Error('Products are saved in your enquiry cart, but the shopping cart could not be updated. Please retry.');
const updated = await response.json();
if (updated.items.some(item => lines.some(line => line.key === item.key))) throw new Error('Some export products remain in the shopping cart. Please retry.');
writeState({items:read(), moved:{}});
location.assign(cartPath + '?export_cart_updated=' + Date.now() + '#cellife-export-enquiry');
} catch (error) { message(this.status, error.message); button.disabled = false; }
}
});
2 changes: 2 additions & 0 deletions assets/cellife-finder-data.js

Large diffs are not rendered by default.

Loading
Loading