@ordergroove/offers 2.27.8 → 2.27.9
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.
- package/CHANGELOG.md +11 -0
- package/dist/bundle-report.html +4 -4
- package/dist/offers.js +16 -16
- package/dist/offers.js.map +2 -2
- package/package.json +2 -2
- package/src/shopify/shopifyMiddleware.ts +12 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ordergroove/offers",
|
|
3
|
-
"version": "2.27.
|
|
3
|
+
"version": "2.27.9",
|
|
4
4
|
"description": "offer state component",
|
|
5
5
|
"author": "Eugenio Lattanzio <eugenio63@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/ordergroove/plush-toys#readme",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@ordergroove/offers-templates": "^0.4.14"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "1fe61755f2c43dca9e7d0b895ac7e7ce0413b1a9"
|
|
49
49
|
}
|
|
@@ -34,11 +34,19 @@ async function setupPdp(store, offer) {
|
|
|
34
34
|
console.warn('OG: Unable to fetch product details for PDP', err);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
|
|
38
37
|
const form = offer.closest('form');
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
if (form) {
|
|
39
|
+
const mo = new MutationObserver(() => syncProductId(form, offer));
|
|
40
|
+
mo.observe(form, { subtree: true, childList: true });
|
|
41
|
+
} else {
|
|
42
|
+
for (let it of document.querySelectorAll('form[action="/cart/add"] [name=id]')) {
|
|
43
|
+
const input = it as HTMLFormElement;
|
|
44
|
+
if (input.getAttribute('value') === offer.getAttribute('product')) {
|
|
45
|
+
const mo = new MutationObserver(() => syncProductId(input.form, offer));
|
|
46
|
+
mo.observe(input.form, { subtree: true, childList: true });
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
42
50
|
}
|
|
43
51
|
|
|
44
52
|
const getCart = async () => await (await fetch(CART_JS_URL)).json();
|