@perceptimagery/dita-configurator-staging 0.2.1000 → 0.2.1205

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.
Files changed (2) hide show
  1. package/dist/index.js +12 -16
  2. 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.1000";
115
+ const version$1 = "0.2.1205";
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,16 @@ 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").setAttribute("close", "");
224
- document.querySelector(".mini-cart").setAttribute("open", "");
225
+ document.querySelector(".drawer.drawer--full").removeAttribute("open");
226
+ document.querySelector(".mini-cart.drawer.drawer--large").setAttribute("open", "");
225
227
  }
226
228
  }
227
229
  }
@@ -51276,12 +51278,9 @@ bool bvhIntersectFirstHit(
51276
51278
  * @returns
51277
51279
  */
51278
51280
  async Get() {
51279
- await fetch(this.config.getCartUrl, this.RequestOptions("GET")).then((response) => {
51280
- const result = response.json();
51281
- return result;
51282
- }).catch((e) => {
51283
- console.error("Error:", e);
51284
- });
51281
+ const response = await fetch(this.config.getCartUrl, this.RequestOptions("GET"));
51282
+ const result = response.json();
51283
+ return result;
51285
51284
  }
51286
51285
  /**
51287
51286
  * @description nice and tidy reuqest wrapper
@@ -51289,12 +51288,9 @@ bool bvhIntersectFirstHit(
51289
51288
  * @returns
51290
51289
  */
51291
51290
  async Post(data) {
51292
- await fetch(this.config.addToCartUrl, this.RequestOptions("POST", data || {})).then((response) => {
51293
- const result = response.json();
51294
- return result;
51295
- }).catch((e) => {
51296
- console.error("Error:", e);
51297
- });
51291
+ const response = await fetch(this.config.addToCartUrl, this.RequestOptions("POST", data || {}));
51292
+ const result = response.json();
51293
+ return result;
51298
51294
  }
51299
51295
  }
51300
51296
  const { log, error } = console;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perceptimagery/dita-configurator-staging",
3
- "version": "0.2.1000",
3
+ "version": "0.2.1205",
4
4
  "author": "Rohan Satpute <rohan@perceptimagery.com>",
5
5
  "license": "UNLICENSED",
6
6
  "main": "dist/index.js",