@runwell/shopify-toolkit 0.24.3 → 0.24.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -155,7 +155,10 @@
|
|
|
155
155
|
display: flex;
|
|
156
156
|
flex-direction: column;
|
|
157
157
|
gap: 10px;
|
|
158
|
-
margin
|
|
158
|
+
margin: 0 0 1.2rem 0;
|
|
159
|
+
padding: 0;
|
|
160
|
+
border: 0;
|
|
161
|
+
min-inline-size: 0;
|
|
159
162
|
}
|
|
160
163
|
|
|
161
164
|
.runwell-bundle-quantity-builder__option {
|
|
@@ -179,7 +182,9 @@
|
|
|
179
182
|
}
|
|
180
183
|
|
|
181
184
|
.runwell-bundle-quantity-builder__option--popular {
|
|
182
|
-
|
|
185
|
+
/* Visual emphasis lives in the MOST POPULAR badge; do not stack a
|
|
186
|
+
colored border here, since that would still read as 'selected'
|
|
187
|
+
when the customer has actually picked a different tier. */
|
|
183
188
|
position: relative;
|
|
184
189
|
}
|
|
185
190
|
|
|
@@ -151,11 +151,21 @@
|
|
|
151
151
|
items.push({ id: parseInt(giftVariantId, 10), quantity: 1 });
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
+
// Dawn's cart-drawer needs the cart-drawer + cart-icon-bubble
|
|
155
|
+
// sections re-rendered before .open() will show the new items
|
|
156
|
+
// (it starts in is-empty state and renderContents() updates +
|
|
157
|
+
// opens in one call). We pass `sections` to /cart/add.js so the
|
|
158
|
+
// response includes the freshly rendered HTML for each.
|
|
159
|
+
const drawer = document.querySelector('cart-drawer');
|
|
160
|
+
const cartSections = drawer && typeof drawer.getSectionsToRender === 'function'
|
|
161
|
+
? drawer.getSectionsToRender().map(function (s) { return s.section || s.id; }).filter(Boolean)
|
|
162
|
+
: ['cart-drawer', 'cart-icon-bubble'];
|
|
163
|
+
|
|
154
164
|
fetch('/cart/add.js', {
|
|
155
165
|
method: 'POST',
|
|
156
166
|
credentials: 'same-origin',
|
|
157
167
|
headers: { 'Content-Type': 'application/json', Accept: 'application/json' },
|
|
158
|
-
body: JSON.stringify({ items: items }),
|
|
168
|
+
body: JSON.stringify({ items: items, sections: cartSections, sections_url: window.location.pathname }),
|
|
159
169
|
})
|
|
160
170
|
.then(function (r) {
|
|
161
171
|
if (!r.ok) {
|
|
@@ -165,25 +175,27 @@
|
|
|
165
175
|
}
|
|
166
176
|
return r.json();
|
|
167
177
|
})
|
|
168
|
-
.then(function () {
|
|
178
|
+
.then(function (json) {
|
|
169
179
|
setAtcState(atc, 'added');
|
|
170
180
|
document.dispatchEvent(new CustomEvent('cart:updated', { bubbles: true }));
|
|
171
|
-
|
|
172
|
-
//
|
|
173
|
-
//
|
|
174
|
-
|
|
181
|
+
|
|
182
|
+
// Dawn pattern: renderContents(parsedState) updates each
|
|
183
|
+
// section's DOM from json.sections and opens the drawer.
|
|
184
|
+
if (drawer && typeof drawer.renderContents === 'function') {
|
|
185
|
+
drawer.renderContents(json);
|
|
186
|
+
setTimeout(function () { setAtcState(atc, 'idle'); }, 2000);
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
// Fallback A: drawer exists but no renderContents (older
|
|
190
|
+
// theme). Open and hope the drawer fetches fresh state.
|
|
175
191
|
if (drawer && typeof drawer.open === 'function') {
|
|
176
192
|
drawer.open();
|
|
177
193
|
setTimeout(function () { setAtcState(atc, 'idle'); }, 2000);
|
|
178
|
-
|
|
179
|
-
drawer.classList.add('active');
|
|
180
|
-
document.body.classList.add('overflow-hidden');
|
|
181
|
-
setTimeout(function () { setAtcState(atc, 'idle'); }, 2000);
|
|
182
|
-
} else {
|
|
183
|
-
// No drawer wired up. Send the customer to /cart so they can
|
|
184
|
-
// see what was added rather than being stuck on the PDP.
|
|
185
|
-
setTimeout(function () { window.location.href = '/cart'; }, 600);
|
|
194
|
+
return;
|
|
186
195
|
}
|
|
196
|
+
// Fallback B: send customer to /cart so they always land
|
|
197
|
+
// somewhere they can verify the items.
|
|
198
|
+
setTimeout(function () { window.location.href = '/cart'; }, 600);
|
|
187
199
|
})
|
|
188
200
|
.catch(function (err) {
|
|
189
201
|
console.error('[runwell-bundle] ATC failed:', err);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@runwell/shopify-toolkit",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.5",
|
|
4
4
|
"description": "Reusable Shopify theme modules from Runwell. Replaces typically app-driven features (reviews, wishlist, urgency, FAQ, post-purchase upsell, exit popups, free-ship progress, sticky ATC, testimonials, badges, bundles) with native Liquid + JS + CSS that ship across multiple client themes via a config-driven sync CLI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|