@perceptimagery/dita-configurator-staging 0.2.1000 → 0.2.1301
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/dist/index.js +20 -16
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -112,7 +112,7 @@ var __publicField = (obj, key, value) => {
|
|
|
112
112
|
host: "https://api.sprie.io"
|
|
113
113
|
};
|
|
114
114
|
const config$1 = Object.freeze(Config$2);
|
|
115
|
-
const version$1 = "0.2.
|
|
115
|
+
const version$1 = "0.2.1301";
|
|
116
116
|
function modifyLensArr$1(arr, element) {
|
|
117
117
|
const index = arr.findIndex((e) => e["sku"] === element["sku"]);
|
|
118
118
|
if (index !== -1) {
|
|
@@ -214,14 +214,23 @@ var __publicField = (obj, key, value) => {
|
|
|
214
214
|
}
|
|
215
215
|
async HandleShopifyAddToCart(items) {
|
|
216
216
|
let formData = {
|
|
217
|
-
"items": items
|
|
217
|
+
"items": items,
|
|
218
|
+
"sections": "mini-cart"
|
|
218
219
|
};
|
|
219
220
|
const responseData = await this.shopifyAPI.Post(formData);
|
|
220
221
|
if (responseData) {
|
|
221
222
|
const cart = await this.shopifyAPI.Get();
|
|
223
|
+
document.querySelector("#shopify-section-mini-cart").outerHTML = responseData.sections["mini-cart"];
|
|
222
224
|
document.querySelector(".header__cart-count").textContent = cart.item_count;
|
|
223
|
-
document.querySelector(".drawer--full")
|
|
224
|
-
|
|
225
|
+
const desktopContainer = document.querySelector(".drawer.drawer--full");
|
|
226
|
+
if (desktopContainer && desktopContainer.hasAttribute("open")) {
|
|
227
|
+
desktopContainer.removeAttribute("open");
|
|
228
|
+
}
|
|
229
|
+
const mobileContainer = document.querySelector(".popover.hidden-lap-and-up.popover--full");
|
|
230
|
+
if (mobileContainer && mobileContainer.hasAttribute("open")) {
|
|
231
|
+
mobileContainer.removeAttribute("open");
|
|
232
|
+
}
|
|
233
|
+
document.querySelector(".mini-cart.drawer.drawer--large").setAttribute("open", "");
|
|
225
234
|
}
|
|
226
235
|
}
|
|
227
236
|
}
|
|
@@ -51276,12 +51285,9 @@ bool bvhIntersectFirstHit(
|
|
|
51276
51285
|
* @returns
|
|
51277
51286
|
*/
|
|
51278
51287
|
async Get() {
|
|
51279
|
-
await fetch(this.config.getCartUrl, this.RequestOptions("GET"))
|
|
51280
|
-
|
|
51281
|
-
|
|
51282
|
-
}).catch((e) => {
|
|
51283
|
-
console.error("Error:", e);
|
|
51284
|
-
});
|
|
51288
|
+
const response = await fetch(this.config.getCartUrl, this.RequestOptions("GET"));
|
|
51289
|
+
const result = response.json();
|
|
51290
|
+
return result;
|
|
51285
51291
|
}
|
|
51286
51292
|
/**
|
|
51287
51293
|
* @description nice and tidy reuqest wrapper
|
|
@@ -51289,12 +51295,10 @@ bool bvhIntersectFirstHit(
|
|
|
51289
51295
|
* @returns
|
|
51290
51296
|
*/
|
|
51291
51297
|
async Post(data) {
|
|
51292
|
-
|
|
51293
|
-
|
|
51294
|
-
|
|
51295
|
-
|
|
51296
|
-
console.error("Error:", e);
|
|
51297
|
-
});
|
|
51298
|
+
console.log(this.config.addToCartUrl);
|
|
51299
|
+
const response = await fetch(this.config.addToCartUrl, this.RequestOptions("POST", data || {}));
|
|
51300
|
+
const result = response.json();
|
|
51301
|
+
return result;
|
|
51298
51302
|
}
|
|
51299
51303
|
}
|
|
51300
51304
|
const { log, error } = console;
|