@plasmicpkgs/commerce-local 0.0.242 → 0.0.244

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.
@@ -2289,306 +2289,113 @@ function _extends() {
2289
2289
  return n;
2290
2290
  }, _extends.apply(null, arguments);
2291
2291
  }
2292
- function _regeneratorRuntime() {
2293
- _regeneratorRuntime = function () {
2294
- return e;
2295
- };
2296
- var t,
2297
- e = {},
2298
- r = Object.prototype,
2299
- n = r.hasOwnProperty,
2300
- o = Object.defineProperty || function (t, e, r) {
2301
- t[e] = r.value;
2302
- },
2303
- i = "function" == typeof Symbol ? Symbol : {},
2304
- a = i.iterator || "@@iterator",
2305
- c = i.asyncIterator || "@@asyncIterator",
2306
- u = i.toStringTag || "@@toStringTag";
2307
- function define(t, e, r) {
2308
- return Object.defineProperty(t, e, {
2309
- value: r,
2310
- enumerable: !0,
2311
- configurable: !0,
2312
- writable: !0
2313
- }), t[e];
2314
- }
2315
- try {
2316
- define({}, "");
2317
- } catch (t) {
2318
- define = function (t, e, r) {
2319
- return t[e] = r;
2320
- };
2321
- }
2322
- function wrap(t, e, r, n) {
2323
- var i = e && e.prototype instanceof Generator ? e : Generator,
2324
- a = Object.create(i.prototype),
2325
- c = new Context(n || []);
2326
- return o(a, "_invoke", {
2327
- value: makeInvokeMethod(t, r, c)
2328
- }), a;
2329
- }
2330
- function tryCatch(t, e, r) {
2331
- try {
2332
- return {
2333
- type: "normal",
2334
- arg: t.call(e, r)
2335
- };
2336
- } catch (t) {
2337
- return {
2338
- type: "throw",
2339
- arg: t
2340
- };
2341
- }
2342
- }
2343
- e.wrap = wrap;
2344
- var h = "suspendedStart",
2345
- l = "suspendedYield",
2346
- f = "executing",
2347
- s = "completed",
2348
- y = {};
2349
- function Generator() {}
2350
- function GeneratorFunction() {}
2351
- function GeneratorFunctionPrototype() {}
2352
- var p = {};
2353
- define(p, a, function () {
2354
- return this;
2355
- });
2356
- var d = Object.getPrototypeOf,
2357
- v = d && d(d(values([])));
2358
- v && v !== r && n.call(v, a) && (p = v);
2359
- var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
2360
- function defineIteratorMethods(t) {
2361
- ["next", "throw", "return"].forEach(function (e) {
2362
- define(t, e, function (t) {
2363
- return this._invoke(e, t);
2364
- });
2365
- });
2366
- }
2367
- function AsyncIterator(t, e) {
2368
- function invoke(r, o, i, a) {
2369
- var c = tryCatch(t[r], t, o);
2370
- if ("throw" !== c.type) {
2371
- var u = c.arg,
2372
- h = u.value;
2373
- return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
2374
- invoke("next", t, i, a);
2375
- }, function (t) {
2376
- invoke("throw", t, i, a);
2377
- }) : e.resolve(h).then(function (t) {
2378
- u.value = t, i(u);
2379
- }, function (t) {
2380
- return invoke("throw", t, i, a);
2381
- });
2382
- }
2383
- a(c.arg);
2384
- }
2385
- var r;
2386
- o(this, "_invoke", {
2387
- value: function (t, n) {
2388
- function callInvokeWithMethodAndArg() {
2389
- return new e(function (e, r) {
2390
- invoke(t, n, e, r);
2391
- });
2292
+ function _regenerator() {
2293
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
2294
+ var e,
2295
+ t,
2296
+ r = "function" == typeof Symbol ? Symbol : {},
2297
+ n = r.iterator || "@@iterator",
2298
+ o = r.toStringTag || "@@toStringTag";
2299
+ function i(r, n, o, i) {
2300
+ var c = n && n.prototype instanceof Generator ? n : Generator,
2301
+ u = Object.create(c.prototype);
2302
+ return _regeneratorDefine(u, "_invoke", function (r, n, o) {
2303
+ var i,
2304
+ c,
2305
+ u,
2306
+ f = 0,
2307
+ p = o || [],
2308
+ y = !1,
2309
+ G = {
2310
+ p: 0,
2311
+ n: 0,
2312
+ v: e,
2313
+ a: d,
2314
+ f: d.bind(e, 4),
2315
+ d: function (t, r) {
2316
+ return i = t, c = 0, u = e, G.n = r, a;
2317
+ }
2318
+ };
2319
+ function d(r, n) {
2320
+ for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
2321
+ var o,
2322
+ i = p[t],
2323
+ d = G.p,
2324
+ l = i[2];
2325
+ r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
2392
2326
  }
2393
- return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
2327
+ if (o || r > 1) return a;
2328
+ throw y = !0, n;
2394
2329
  }
2395
- });
2396
- }
2397
- function makeInvokeMethod(e, r, n) {
2398
- var o = h;
2399
- return function (i, a) {
2400
- if (o === f) throw Error("Generator is already running");
2401
- if (o === s) {
2402
- if ("throw" === i) throw a;
2330
+ return function (o, p, l) {
2331
+ if (f > 1) throw TypeError("Generator is already running");
2332
+ for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
2333
+ i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
2334
+ try {
2335
+ if (f = 2, i) {
2336
+ if (c || (o = "next"), t = i[o]) {
2337
+ if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
2338
+ if (!t.done) return t;
2339
+ u = t.value, c < 2 && (c = 0);
2340
+ } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
2341
+ i = e;
2342
+ } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
2343
+ } catch (t) {
2344
+ i = e, c = 1, u = t;
2345
+ } finally {
2346
+ f = 1;
2347
+ }
2348
+ }
2403
2349
  return {
2404
2350
  value: t,
2405
- done: !0
2351
+ done: y
2406
2352
  };
2407
- }
2408
- for (n.method = i, n.arg = a;;) {
2409
- var c = n.delegate;
2410
- if (c) {
2411
- var u = maybeInvokeDelegate(c, n);
2412
- if (u) {
2413
- if (u === y) continue;
2414
- return u;
2415
- }
2416
- }
2417
- if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
2418
- if (o === h) throw o = s, n.arg;
2419
- n.dispatchException(n.arg);
2420
- } else "return" === n.method && n.abrupt("return", n.arg);
2421
- o = f;
2422
- var p = tryCatch(e, r, n);
2423
- if ("normal" === p.type) {
2424
- if (o = n.done ? s : l, p.arg === y) continue;
2425
- return {
2426
- value: p.arg,
2427
- done: n.done
2428
- };
2429
- }
2430
- "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
2431
- }
2432
- };
2433
- }
2434
- function maybeInvokeDelegate(e, r) {
2435
- var n = r.method,
2436
- o = e.iterator[n];
2437
- if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
2438
- var i = tryCatch(o, e.iterator, r.arg);
2439
- if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
2440
- var a = i.arg;
2441
- return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
2442
- }
2443
- function pushTryEntry(t) {
2444
- var e = {
2445
- tryLoc: t[0]
2446
- };
2447
- 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
2448
- }
2449
- function resetTryEntry(t) {
2450
- var e = t.completion || {};
2451
- e.type = "normal", delete e.arg, t.completion = e;
2452
- }
2453
- function Context(t) {
2454
- this.tryEntries = [{
2455
- tryLoc: "root"
2456
- }], t.forEach(pushTryEntry, this), this.reset(!0);
2353
+ };
2354
+ }(r, o, i), !0), u;
2457
2355
  }
2458
- function values(e) {
2459
- if (e || "" === e) {
2460
- var r = e[a];
2461
- if (r) return r.call(e);
2462
- if ("function" == typeof e.next) return e;
2463
- if (!isNaN(e.length)) {
2464
- var o = -1,
2465
- i = function next() {
2466
- for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
2467
- return next.value = t, next.done = !0, next;
2468
- };
2469
- return i.next = i;
2470
- }
2471
- }
2472
- throw new TypeError(typeof e + " is not iterable");
2356
+ var a = {};
2357
+ function Generator() {}
2358
+ function GeneratorFunction() {}
2359
+ function GeneratorFunctionPrototype() {}
2360
+ t = Object.getPrototypeOf;
2361
+ var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
2362
+ return this;
2363
+ }), t),
2364
+ u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
2365
+ function f(e) {
2366
+ return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
2473
2367
  }
2474
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
2475
- value: GeneratorFunctionPrototype,
2476
- configurable: !0
2477
- }), o(GeneratorFunctionPrototype, "constructor", {
2478
- value: GeneratorFunction,
2479
- configurable: !0
2480
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
2481
- var e = "function" == typeof t && t.constructor;
2482
- return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
2483
- }, e.mark = function (t) {
2484
- return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
2485
- }, e.awrap = function (t) {
2486
- return {
2487
- __await: t
2488
- };
2489
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
2490
- return this;
2491
- }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
2492
- void 0 === i && (i = Promise);
2493
- var a = new AsyncIterator(wrap(t, r, n, o), i);
2494
- return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
2495
- return t.done ? t.value : a.next();
2496
- });
2497
- }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
2368
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function () {
2498
2369
  return this;
2499
- }), define(g, "toString", function () {
2370
+ }), _regeneratorDefine(u, "toString", function () {
2500
2371
  return "[object Generator]";
2501
- }), e.keys = function (t) {
2502
- var e = Object(t),
2503
- r = [];
2504
- for (var n in e) r.push(n);
2505
- return r.reverse(), function next() {
2506
- for (; r.length;) {
2507
- var t = r.pop();
2508
- if (t in e) return next.value = t, next.done = !1, next;
2509
- }
2510
- return next.done = !0, next;
2372
+ }), (_regenerator = function () {
2373
+ return {
2374
+ w: i,
2375
+ m: f
2511
2376
  };
2512
- }, e.values = values, Context.prototype = {
2513
- constructor: Context,
2514
- reset: function (e) {
2515
- if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
2516
- },
2517
- stop: function () {
2518
- this.done = !0;
2519
- var t = this.tryEntries[0].completion;
2520
- if ("throw" === t.type) throw t.arg;
2521
- return this.rval;
2522
- },
2523
- dispatchException: function (e) {
2524
- if (this.done) throw e;
2525
- var r = this;
2526
- function handle(n, o) {
2527
- return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
2528
- }
2529
- for (var o = this.tryEntries.length - 1; o >= 0; --o) {
2530
- var i = this.tryEntries[o],
2531
- a = i.completion;
2532
- if ("root" === i.tryLoc) return handle("end");
2533
- if (i.tryLoc <= this.prev) {
2534
- var c = n.call(i, "catchLoc"),
2535
- u = n.call(i, "finallyLoc");
2536
- if (c && u) {
2537
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
2538
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
2539
- } else if (c) {
2540
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
2541
- } else {
2542
- if (!u) throw Error("try statement without catch or finally");
2543
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
2544
- }
2545
- }
2546
- }
2547
- },
2548
- abrupt: function (t, e) {
2549
- for (var r = this.tryEntries.length - 1; r >= 0; --r) {
2550
- var o = this.tryEntries[r];
2551
- if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
2552
- var i = o;
2553
- break;
2554
- }
2555
- }
2556
- i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
2557
- var a = i ? i.completion : {};
2558
- return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
2559
- },
2560
- complete: function (t, e) {
2561
- if ("throw" === t.type) throw t.arg;
2562
- return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
2563
- },
2564
- finish: function (t) {
2565
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
2566
- var r = this.tryEntries[e];
2567
- if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
2568
- }
2569
- },
2570
- catch: function (t) {
2571
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
2572
- var r = this.tryEntries[e];
2573
- if (r.tryLoc === t) {
2574
- var n = r.completion;
2575
- if ("throw" === n.type) {
2576
- var o = n.arg;
2577
- resetTryEntry(r);
2578
- }
2579
- return o;
2580
- }
2581
- }
2582
- throw Error("illegal catch attempt");
2583
- },
2584
- delegateYield: function (e, r, n) {
2585
- return this.delegate = {
2586
- iterator: values(e),
2587
- resultName: r,
2588
- nextLoc: n
2589
- }, "next" === this.method && (this.arg = t), y;
2377
+ })();
2378
+ }
2379
+ function _regeneratorDefine(e, r, n, t) {
2380
+ var i = Object.defineProperty;
2381
+ try {
2382
+ i({}, "", {});
2383
+ } catch (e) {
2384
+ i = 0;
2385
+ }
2386
+ _regeneratorDefine = function (e, r, n, t) {
2387
+ function o(r, n) {
2388
+ _regeneratorDefine(e, r, function (e) {
2389
+ return this._invoke(r, n, e);
2390
+ });
2590
2391
  }
2591
- }, e;
2392
+ r ? i ? i(e, r, {
2393
+ value: n,
2394
+ enumerable: !t,
2395
+ configurable: !t,
2396
+ writable: !t
2397
+ }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
2398
+ }, _regeneratorDefine(e, r, n, t);
2592
2399
  }
2593
2400
  function _unsupportedIterableToArray(r, a) {
2594
2401
  if (r) {
@@ -2599,31 +2406,30 @@ function _unsupportedIterableToArray(r, a) {
2599
2406
  }
2600
2407
 
2601
2408
  var fetcher = /*#__PURE__*/function () {
2602
- var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
2409
+ var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
2603
2410
  var res, _yield$res$json, data;
2604
- return _regeneratorRuntime().wrap(function _callee$(_context) {
2605
- while (1) switch (_context.prev = _context.next) {
2411
+ return _regenerator().w(function (_context) {
2412
+ while (1) switch (_context.n) {
2606
2413
  case 0:
2607
2414
  console.log('FETCHER');
2608
- _context.next = 3;
2415
+ _context.n = 1;
2609
2416
  return fetch('./data.json');
2610
- case 3:
2611
- res = _context.sent;
2417
+ case 1:
2418
+ res = _context.v;
2612
2419
  if (!res.ok) {
2613
- _context.next = 10;
2420
+ _context.n = 3;
2614
2421
  break;
2615
2422
  }
2616
- _context.next = 7;
2423
+ _context.n = 2;
2617
2424
  return res.json();
2618
- case 7:
2619
- _yield$res$json = _context.sent;
2425
+ case 2:
2426
+ _yield$res$json = _context.v;
2620
2427
  data = _yield$res$json.data;
2621
- return _context.abrupt("return", data);
2622
- case 10:
2428
+ return _context.a(2, data);
2429
+ case 3:
2623
2430
  throw res;
2624
- case 11:
2625
- case "end":
2626
- return _context.stop();
2431
+ case 4:
2432
+ return _context.a(2);
2627
2433
  }
2628
2434
  }, _callee);
2629
2435
  }));
@@ -2657,8 +2463,7 @@ var createCart = function createCart() {
2657
2463
  return cart;
2658
2464
  };
2659
2465
  var getCart = function getCart(cartId) {
2660
- var _cartId;
2661
- cartId = (_cartId = cartId) != null ? _cartId : Cookies.get(LOCAL_CART_ID);
2466
+ cartId = cartId != null ? cartId : Cookies.get(LOCAL_CART_ID);
2662
2467
  var cartStr = Cookies.get(LOCAL_CART_OBJ);
2663
2468
  var cart = cartStr ? JSON.parse(cartStr) : undefined;
2664
2469
  if (!cart || cart.id !== cartId) {
@@ -2680,16 +2485,13 @@ var handler = {
2680
2485
  query: "use-cart"
2681
2486
  },
2682
2487
  fetcher: function fetcher(_ref) {
2683
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
2488
+ return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
2684
2489
  var input, fetch;
2685
- return _regeneratorRuntime().wrap(function _callee$(_context) {
2686
- while (1) switch (_context.prev = _context.next) {
2490
+ return _regenerator().w(function (_context) {
2491
+ while (1) switch (_context.n) {
2687
2492
  case 0:
2688
2493
  input = _ref.input, fetch = _ref.fetch;
2689
- return _context.abrupt("return", getCart(input.cartId));
2690
- case 2:
2691
- case "end":
2692
- return _context.stop();
2494
+ return _context.a(2, getCart(input.cartId));
2693
2495
  }
2694
2496
  }, _callee);
2695
2497
  }))();
@@ -2722,21 +2524,21 @@ var handler$1 = {
2722
2524
  query: "use-add-item"
2723
2525
  },
2724
2526
  fetcher: function fetcher(_ref) {
2725
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
2527
+ return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
2726
2528
  var _item$quantity;
2727
2529
  var item, fetch, lineItem, cart, _iterator, _step, product, variant, _item$quantity2, currentLineItem;
2728
- return _regeneratorRuntime().wrap(function _callee$(_context) {
2729
- while (1) switch (_context.prev = _context.next) {
2530
+ return _regenerator().w(function (_context) {
2531
+ while (1) switch (_context.n) {
2730
2532
  case 0:
2731
2533
  item = _ref.input, fetch = _ref.fetch;
2732
2534
  if (!(item.quantity && (!Number.isInteger(item.quantity) || item.quantity < 1))) {
2733
- _context.next = 3;
2535
+ _context.n = 1;
2734
2536
  break;
2735
2537
  }
2736
2538
  throw new commerce.CommerceError({
2737
2539
  message: "The item quantity has to be a valid integer greater than 0"
2738
2540
  });
2739
- case 3:
2541
+ case 1:
2740
2542
  lineItem = {
2741
2543
  variantId: item.variantId,
2742
2544
  quantity: (_item$quantity = item.quantity) != null ? _item$quantity : 1
@@ -2760,10 +2562,7 @@ var handler$1 = {
2760
2562
  }
2761
2563
  }
2762
2564
  }
2763
- return _context.abrupt("return", cartUpdate(cart));
2764
- case 7:
2765
- case "end":
2766
- return _context.stop();
2565
+ return _context.a(2, cartUpdate(cart));
2767
2566
  }
2768
2567
  }, _callee);
2769
2568
  }))();
@@ -2774,24 +2573,21 @@ var handler$1 = {
2774
2573
  var _useCart = commerce.useCart(),
2775
2574
  mutate = _useCart.mutate;
2776
2575
  return React.useCallback(/*#__PURE__*/function () {
2777
- var _addItem = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
2576
+ var _addItem = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(input) {
2778
2577
  var data;
2779
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2780
- while (1) switch (_context2.prev = _context2.next) {
2578
+ return _regenerator().w(function (_context2) {
2579
+ while (1) switch (_context2.n) {
2781
2580
  case 0:
2782
- _context2.next = 2;
2581
+ _context2.n = 1;
2783
2582
  return fetch({
2784
2583
  input: input
2785
2584
  });
2786
- case 2:
2787
- data = _context2.sent;
2788
- _context2.next = 5;
2585
+ case 1:
2586
+ data = _context2.v;
2587
+ _context2.n = 2;
2789
2588
  return mutate(data, false);
2790
- case 5:
2791
- return _context2.abrupt("return", data);
2792
- case 6:
2793
- case "end":
2794
- return _context2.stop();
2589
+ case 2:
2590
+ return _context2.a(2, data);
2795
2591
  }
2796
2592
  }, _callee2);
2797
2593
  }));
@@ -2809,13 +2605,12 @@ var handler$2 = {
2809
2605
  query: ''
2810
2606
  },
2811
2607
  fetcher: function fetcher(_ref) {
2812
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
2813
- return _regeneratorRuntime().wrap(function _callee$(_context) {
2814
- while (1) switch (_context.prev = _context.next) {
2608
+ return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
2609
+ return _regenerator().w(function (_context) {
2610
+ while (1) switch (_context.n) {
2815
2611
  case 0:
2816
2612
  case 1:
2817
- case "end":
2818
- return _context.stop();
2613
+ return _context.a(2);
2819
2614
  }
2820
2615
  }, _callee);
2821
2616
  }))();
@@ -2823,14 +2618,11 @@ var handler$2 = {
2823
2618
  useHook: function useHook(_ref2) {
2824
2619
  return function () {
2825
2620
  return /*#__PURE__*/function () {
2826
- var _addItem = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
2827
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2828
- while (1) switch (_context2.prev = _context2.next) {
2621
+ var _addItem = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
2622
+ return _regenerator().w(function (_context2) {
2623
+ while (1) switch (_context2.n) {
2829
2624
  case 0:
2830
- return _context2.abrupt("return", {});
2831
- case 1:
2832
- case "end":
2833
- return _context2.stop();
2625
+ return _context2.a(2, {});
2834
2626
  }
2835
2627
  }, _callee2);
2836
2628
  }));
@@ -2848,13 +2640,12 @@ var handler$3 = {
2848
2640
  query: ''
2849
2641
  },
2850
2642
  fetcher: function fetcher(_ref) {
2851
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
2852
- return _regeneratorRuntime().wrap(function _callee$(_context) {
2853
- while (1) switch (_context.prev = _context.next) {
2643
+ return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
2644
+ return _regenerator().w(function (_context) {
2645
+ while (1) switch (_context.n) {
2854
2646
  case 0:
2855
2647
  case 1:
2856
- case "end":
2857
- return _context.stop();
2648
+ return _context.a(2);
2858
2649
  }
2859
2650
  }, _callee);
2860
2651
  }))();
@@ -2862,14 +2653,11 @@ var handler$3 = {
2862
2653
  useHook: function useHook(_ref2) {
2863
2654
  return function () {
2864
2655
  return /*#__PURE__*/function () {
2865
- var _removeItem = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
2866
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2867
- while (1) switch (_context2.prev = _context2.next) {
2656
+ var _removeItem = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(input) {
2657
+ return _regenerator().w(function (_context2) {
2658
+ while (1) switch (_context2.n) {
2868
2659
  case 0:
2869
- return _context2.abrupt("return", {});
2870
- case 1:
2871
- case "end":
2872
- return _context2.stop();
2660
+ return _context2.a(2, {});
2873
2661
  }
2874
2662
  }, _callee2);
2875
2663
  }));
@@ -2902,10 +2690,10 @@ var handler$4 = {
2902
2690
  query: "use-search"
2903
2691
  },
2904
2692
  fetcher: function fetcher(_ref) {
2905
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
2693
+ return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
2906
2694
  var input, fetch, search, categoryId, brandId, sort, count, products, category;
2907
- return _regeneratorRuntime().wrap(function _callee$(_context) {
2908
- while (1) switch (_context.prev = _context.next) {
2695
+ return _regenerator().w(function (_context) {
2696
+ while (1) switch (_context.n) {
2909
2697
  case 0:
2910
2698
  input = _ref.input, fetch = _ref.fetch;
2911
2699
  search = input.search, categoryId = input.categoryId, brandId = input.brandId, sort = input.sort, count = input.count;
@@ -2934,13 +2722,10 @@ var handler$4 = {
2934
2722
  return sortProduct(a, b, sort);
2935
2723
  });
2936
2724
  }
2937
- return _context.abrupt("return", {
2725
+ return _context.a(2, {
2938
2726
  products: products.slice(0, count),
2939
2727
  found: products.length > 0
2940
2728
  });
2941
- case 8:
2942
- case "end":
2943
- return _context.stop();
2944
2729
  }
2945
2730
  }, _callee);
2946
2731
  }))();
@@ -2966,20 +2751,17 @@ var handler$5 = {
2966
2751
  query: "use-product"
2967
2752
  },
2968
2753
  fetcher: function fetcher(_ref) {
2969
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
2754
+ return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
2970
2755
  var _data$products$find;
2971
2756
  var input, fetch, id;
2972
- return _regeneratorRuntime().wrap(function _callee$(_context) {
2973
- while (1) switch (_context.prev = _context.next) {
2757
+ return _regenerator().w(function (_context) {
2758
+ while (1) switch (_context.n) {
2974
2759
  case 0:
2975
2760
  input = _ref.input, fetch = _ref.fetch;
2976
2761
  id = input.id;
2977
- return _context.abrupt("return", (_data$products$find = data.products.find(function (product) {
2762
+ return _context.a(2, (_data$products$find = data.products.find(function (product) {
2978
2763
  return [product.id, product.slug].includes(id);
2979
2764
  })) != null ? _data$products$find : null);
2980
- case 3:
2981
- case "end":
2982
- return _context.stop();
2983
2765
  }
2984
2766
  }, _callee);
2985
2767
  }))();
@@ -3005,26 +2787,23 @@ var handler$6 = {
3005
2787
  query: "use-categories"
3006
2788
  },
3007
2789
  fetcher: function fetcher(_ref) {
3008
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
2790
+ return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
3009
2791
  var input, fetch, categoryId, category;
3010
- return _regeneratorRuntime().wrap(function _callee$(_context) {
3011
- while (1) switch (_context.prev = _context.next) {
2792
+ return _regenerator().w(function (_context) {
2793
+ while (1) switch (_context.n) {
3012
2794
  case 0:
3013
2795
  input = _ref.input, fetch = _ref.fetch;
3014
2796
  categoryId = input.categoryId;
3015
2797
  if (categoryId) {
3016
- _context.next = 4;
2798
+ _context.n = 1;
3017
2799
  break;
3018
2800
  }
3019
- return _context.abrupt("return", data.categories);
3020
- case 4:
2801
+ return _context.a(2, data.categories);
2802
+ case 1:
3021
2803
  category = data.categories.find(function (category) {
3022
2804
  return category.id === categoryId;
3023
2805
  });
3024
- return _context.abrupt("return", category ? [category] : []);
3025
- case 6:
3026
- case "end":
3027
- return _context.stop();
2806
+ return _context.a(2, category ? [category] : []);
3028
2807
  }
3029
2808
  }, _callee);
3030
2809
  }))();
@@ -3058,15 +2837,15 @@ var handler$7 = {
3058
2837
  query: "use-brands"
3059
2838
  },
3060
2839
  fetcher: function fetcher(_ref) {
3061
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
2840
+ return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
3062
2841
  var vendorsStrings;
3063
- return _regeneratorRuntime().wrap(function _callee$(_context) {
3064
- while (1) switch (_context.prev = _context.next) {
2842
+ return _regenerator().w(function (_context) {
2843
+ while (1) switch (_context.n) {
3065
2844
  case 0:
3066
2845
  vendorsStrings = data.products.map(function (product) {
3067
2846
  return product.vendor;
3068
2847
  });
3069
- return _context.abrupt("return", Array.from(new Set(vendorsStrings).values()).map(function (v) {
2848
+ return _context.a(2, Array.from(new Set(vendorsStrings).values()).map(function (v) {
3070
2849
  var id = v.replace(/\s+/g, "-").toLowerCase();
3071
2850
  return {
3072
2851
  entityId: id,
@@ -3074,9 +2853,6 @@ var handler$7 = {
3074
2853
  path: "brands/" + id
3075
2854
  };
3076
2855
  }));
3077
- case 3:
3078
- case "end":
3079
- return _context.stop();
3080
2856
  }
3081
2857
  }, _callee);
3082
2858
  }))();