@plasmicpkgs/commerce-local 0.0.159 → 0.0.160

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.
@@ -2226,6 +2226,307 @@ var data = {
2226
2226
  products: products
2227
2227
  };
2228
2228
 
2229
+ function _regeneratorRuntime() {
2230
+ _regeneratorRuntime = function () {
2231
+ return e;
2232
+ };
2233
+ var t,
2234
+ e = {},
2235
+ r = Object.prototype,
2236
+ n = r.hasOwnProperty,
2237
+ o = Object.defineProperty || function (t, e, r) {
2238
+ t[e] = r.value;
2239
+ },
2240
+ i = "function" == typeof Symbol ? Symbol : {},
2241
+ a = i.iterator || "@@iterator",
2242
+ c = i.asyncIterator || "@@asyncIterator",
2243
+ u = i.toStringTag || "@@toStringTag";
2244
+ function define(t, e, r) {
2245
+ return Object.defineProperty(t, e, {
2246
+ value: r,
2247
+ enumerable: !0,
2248
+ configurable: !0,
2249
+ writable: !0
2250
+ }), t[e];
2251
+ }
2252
+ try {
2253
+ define({}, "");
2254
+ } catch (t) {
2255
+ define = function (t, e, r) {
2256
+ return t[e] = r;
2257
+ };
2258
+ }
2259
+ function wrap(t, e, r, n) {
2260
+ var i = e && e.prototype instanceof Generator ? e : Generator,
2261
+ a = Object.create(i.prototype),
2262
+ c = new Context(n || []);
2263
+ return o(a, "_invoke", {
2264
+ value: makeInvokeMethod(t, r, c)
2265
+ }), a;
2266
+ }
2267
+ function tryCatch(t, e, r) {
2268
+ try {
2269
+ return {
2270
+ type: "normal",
2271
+ arg: t.call(e, r)
2272
+ };
2273
+ } catch (t) {
2274
+ return {
2275
+ type: "throw",
2276
+ arg: t
2277
+ };
2278
+ }
2279
+ }
2280
+ e.wrap = wrap;
2281
+ var h = "suspendedStart",
2282
+ l = "suspendedYield",
2283
+ f = "executing",
2284
+ s = "completed",
2285
+ y = {};
2286
+ function Generator() {}
2287
+ function GeneratorFunction() {}
2288
+ function GeneratorFunctionPrototype() {}
2289
+ var p = {};
2290
+ define(p, a, function () {
2291
+ return this;
2292
+ });
2293
+ var d = Object.getPrototypeOf,
2294
+ v = d && d(d(values([])));
2295
+ v && v !== r && n.call(v, a) && (p = v);
2296
+ var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
2297
+ function defineIteratorMethods(t) {
2298
+ ["next", "throw", "return"].forEach(function (e) {
2299
+ define(t, e, function (t) {
2300
+ return this._invoke(e, t);
2301
+ });
2302
+ });
2303
+ }
2304
+ function AsyncIterator(t, e) {
2305
+ function invoke(r, o, i, a) {
2306
+ var c = tryCatch(t[r], t, o);
2307
+ if ("throw" !== c.type) {
2308
+ var u = c.arg,
2309
+ h = u.value;
2310
+ return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
2311
+ invoke("next", t, i, a);
2312
+ }, function (t) {
2313
+ invoke("throw", t, i, a);
2314
+ }) : e.resolve(h).then(function (t) {
2315
+ u.value = t, i(u);
2316
+ }, function (t) {
2317
+ return invoke("throw", t, i, a);
2318
+ });
2319
+ }
2320
+ a(c.arg);
2321
+ }
2322
+ var r;
2323
+ o(this, "_invoke", {
2324
+ value: function (t, n) {
2325
+ function callInvokeWithMethodAndArg() {
2326
+ return new e(function (e, r) {
2327
+ invoke(t, n, e, r);
2328
+ });
2329
+ }
2330
+ return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
2331
+ }
2332
+ });
2333
+ }
2334
+ function makeInvokeMethod(e, r, n) {
2335
+ var o = h;
2336
+ return function (i, a) {
2337
+ if (o === f) throw new Error("Generator is already running");
2338
+ if (o === s) {
2339
+ if ("throw" === i) throw a;
2340
+ return {
2341
+ value: t,
2342
+ done: !0
2343
+ };
2344
+ }
2345
+ for (n.method = i, n.arg = a;;) {
2346
+ var c = n.delegate;
2347
+ if (c) {
2348
+ var u = maybeInvokeDelegate(c, n);
2349
+ if (u) {
2350
+ if (u === y) continue;
2351
+ return u;
2352
+ }
2353
+ }
2354
+ if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
2355
+ if (o === h) throw o = s, n.arg;
2356
+ n.dispatchException(n.arg);
2357
+ } else "return" === n.method && n.abrupt("return", n.arg);
2358
+ o = f;
2359
+ var p = tryCatch(e, r, n);
2360
+ if ("normal" === p.type) {
2361
+ if (o = n.done ? s : l, p.arg === y) continue;
2362
+ return {
2363
+ value: p.arg,
2364
+ done: n.done
2365
+ };
2366
+ }
2367
+ "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
2368
+ }
2369
+ };
2370
+ }
2371
+ function maybeInvokeDelegate(e, r) {
2372
+ var n = r.method,
2373
+ o = e.iterator[n];
2374
+ 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;
2375
+ var i = tryCatch(o, e.iterator, r.arg);
2376
+ if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
2377
+ var a = i.arg;
2378
+ 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);
2379
+ }
2380
+ function pushTryEntry(t) {
2381
+ var e = {
2382
+ tryLoc: t[0]
2383
+ };
2384
+ 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
2385
+ }
2386
+ function resetTryEntry(t) {
2387
+ var e = t.completion || {};
2388
+ e.type = "normal", delete e.arg, t.completion = e;
2389
+ }
2390
+ function Context(t) {
2391
+ this.tryEntries = [{
2392
+ tryLoc: "root"
2393
+ }], t.forEach(pushTryEntry, this), this.reset(!0);
2394
+ }
2395
+ function values(e) {
2396
+ if (e || "" === e) {
2397
+ var r = e[a];
2398
+ if (r) return r.call(e);
2399
+ if ("function" == typeof e.next) return e;
2400
+ if (!isNaN(e.length)) {
2401
+ var o = -1,
2402
+ i = function next() {
2403
+ for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
2404
+ return next.value = t, next.done = !0, next;
2405
+ };
2406
+ return i.next = i;
2407
+ }
2408
+ }
2409
+ throw new TypeError(typeof e + " is not iterable");
2410
+ }
2411
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
2412
+ value: GeneratorFunctionPrototype,
2413
+ configurable: !0
2414
+ }), o(GeneratorFunctionPrototype, "constructor", {
2415
+ value: GeneratorFunction,
2416
+ configurable: !0
2417
+ }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
2418
+ var e = "function" == typeof t && t.constructor;
2419
+ return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
2420
+ }, e.mark = function (t) {
2421
+ return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
2422
+ }, e.awrap = function (t) {
2423
+ return {
2424
+ __await: t
2425
+ };
2426
+ }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
2427
+ return this;
2428
+ }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
2429
+ void 0 === i && (i = Promise);
2430
+ var a = new AsyncIterator(wrap(t, r, n, o), i);
2431
+ return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
2432
+ return t.done ? t.value : a.next();
2433
+ });
2434
+ }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
2435
+ return this;
2436
+ }), define(g, "toString", function () {
2437
+ return "[object Generator]";
2438
+ }), e.keys = function (t) {
2439
+ var e = Object(t),
2440
+ r = [];
2441
+ for (var n in e) r.push(n);
2442
+ return r.reverse(), function next() {
2443
+ for (; r.length;) {
2444
+ var t = r.pop();
2445
+ if (t in e) return next.value = t, next.done = !1, next;
2446
+ }
2447
+ return next.done = !0, next;
2448
+ };
2449
+ }, e.values = values, Context.prototype = {
2450
+ constructor: Context,
2451
+ reset: function (e) {
2452
+ 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);
2453
+ },
2454
+ stop: function () {
2455
+ this.done = !0;
2456
+ var t = this.tryEntries[0].completion;
2457
+ if ("throw" === t.type) throw t.arg;
2458
+ return this.rval;
2459
+ },
2460
+ dispatchException: function (e) {
2461
+ if (this.done) throw e;
2462
+ var r = this;
2463
+ function handle(n, o) {
2464
+ return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
2465
+ }
2466
+ for (var o = this.tryEntries.length - 1; o >= 0; --o) {
2467
+ var i = this.tryEntries[o],
2468
+ a = i.completion;
2469
+ if ("root" === i.tryLoc) return handle("end");
2470
+ if (i.tryLoc <= this.prev) {
2471
+ var c = n.call(i, "catchLoc"),
2472
+ u = n.call(i, "finallyLoc");
2473
+ if (c && u) {
2474
+ if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
2475
+ if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
2476
+ } else if (c) {
2477
+ if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
2478
+ } else {
2479
+ if (!u) throw new Error("try statement without catch or finally");
2480
+ if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
2481
+ }
2482
+ }
2483
+ }
2484
+ },
2485
+ abrupt: function (t, e) {
2486
+ for (var r = this.tryEntries.length - 1; r >= 0; --r) {
2487
+ var o = this.tryEntries[r];
2488
+ if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
2489
+ var i = o;
2490
+ break;
2491
+ }
2492
+ }
2493
+ i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
2494
+ var a = i ? i.completion : {};
2495
+ return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
2496
+ },
2497
+ complete: function (t, e) {
2498
+ if ("throw" === t.type) throw t.arg;
2499
+ 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;
2500
+ },
2501
+ finish: function (t) {
2502
+ for (var e = this.tryEntries.length - 1; e >= 0; --e) {
2503
+ var r = this.tryEntries[e];
2504
+ if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
2505
+ }
2506
+ },
2507
+ catch: function (t) {
2508
+ for (var e = this.tryEntries.length - 1; e >= 0; --e) {
2509
+ var r = this.tryEntries[e];
2510
+ if (r.tryLoc === t) {
2511
+ var n = r.completion;
2512
+ if ("throw" === n.type) {
2513
+ var o = n.arg;
2514
+ resetTryEntry(r);
2515
+ }
2516
+ return o;
2517
+ }
2518
+ }
2519
+ throw new Error("illegal catch attempt");
2520
+ },
2521
+ delegateYield: function (e, r, n) {
2522
+ return this.delegate = {
2523
+ iterator: values(e),
2524
+ resultName: r,
2525
+ nextLoc: n
2526
+ }, "next" === this.method && (this.arg = t), y;
2527
+ }
2528
+ }, e;
2529
+ }
2229
2530
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
2230
2531
  try {
2231
2532
  var info = gen[key](arg);
@@ -2302,699 +2603,37 @@ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
2302
2603
  throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2303
2604
  }
2304
2605
 
2305
- function createCommonjsModule(fn, module) {
2306
- return module = { exports: {} }, fn(module, module.exports), module.exports;
2307
- }
2308
-
2309
- var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
2310
- /**
2311
- * Copyright (c) 2014-present, Facebook, Inc.
2312
- *
2313
- * This source code is licensed under the MIT license found in the
2314
- * LICENSE file in the root directory of this source tree.
2315
- */
2316
-
2317
- var runtime = function (exports) {
2318
-
2319
- var Op = Object.prototype;
2320
- var hasOwn = Op.hasOwnProperty;
2321
- var undefined$1; // More compressible than void 0.
2322
- var $Symbol = typeof Symbol === "function" ? Symbol : {};
2323
- var iteratorSymbol = $Symbol.iterator || "@@iterator";
2324
- var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
2325
- var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
2326
- function define(obj, key, value) {
2327
- Object.defineProperty(obj, key, {
2328
- value: value,
2329
- enumerable: true,
2330
- configurable: true,
2331
- writable: true
2332
- });
2333
- return obj[key];
2334
- }
2335
- try {
2336
- // IE 8 has a broken Object.defineProperty that only works on DOM objects.
2337
- define({}, "");
2338
- } catch (err) {
2339
- define = function define(obj, key, value) {
2340
- return obj[key] = value;
2341
- };
2342
- }
2343
- function wrap(innerFn, outerFn, self, tryLocsList) {
2344
- // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
2345
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
2346
- var generator = Object.create(protoGenerator.prototype);
2347
- var context = new Context(tryLocsList || []);
2348
-
2349
- // The ._invoke method unifies the implementations of the .next,
2350
- // .throw, and .return methods.
2351
- generator._invoke = makeInvokeMethod(innerFn, self, context);
2352
- return generator;
2353
- }
2354
- exports.wrap = wrap;
2355
-
2356
- // Try/catch helper to minimize deoptimizations. Returns a completion
2357
- // record like context.tryEntries[i].completion. This interface could
2358
- // have been (and was previously) designed to take a closure to be
2359
- // invoked without arguments, but in all the cases we care about we
2360
- // already have an existing method we want to call, so there's no need
2361
- // to create a new function object. We can even get away with assuming
2362
- // the method takes exactly one argument, since that happens to be true
2363
- // in every case, so we don't have to touch the arguments object. The
2364
- // only additional allocation required is the completion record, which
2365
- // has a stable shape and so hopefully should be cheap to allocate.
2366
- function tryCatch(fn, obj, arg) {
2367
- try {
2368
- return {
2369
- type: "normal",
2370
- arg: fn.call(obj, arg)
2371
- };
2372
- } catch (err) {
2373
- return {
2374
- type: "throw",
2375
- arg: err
2376
- };
2377
- }
2378
- }
2379
- var GenStateSuspendedStart = "suspendedStart";
2380
- var GenStateSuspendedYield = "suspendedYield";
2381
- var GenStateExecuting = "executing";
2382
- var GenStateCompleted = "completed";
2383
-
2384
- // Returning this object from the innerFn has the same effect as
2385
- // breaking out of the dispatch switch statement.
2386
- var ContinueSentinel = {};
2387
-
2388
- // Dummy constructor functions that we use as the .constructor and
2389
- // .constructor.prototype properties for functions that return Generator
2390
- // objects. For full spec compliance, you may wish to configure your
2391
- // minifier not to mangle the names of these two functions.
2392
- function Generator() {}
2393
- function GeneratorFunction() {}
2394
- function GeneratorFunctionPrototype() {}
2395
-
2396
- // This is a polyfill for %IteratorPrototype% for environments that
2397
- // don't natively support it.
2398
- var IteratorPrototype = {};
2399
- define(IteratorPrototype, iteratorSymbol, function () {
2400
- return this;
2401
- });
2402
- var getProto = Object.getPrototypeOf;
2403
- var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
2404
- if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
2405
- // This environment has a native %IteratorPrototype%; use it instead
2406
- // of the polyfill.
2407
- IteratorPrototype = NativeIteratorPrototype;
2408
- }
2409
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
2410
- GeneratorFunction.prototype = GeneratorFunctionPrototype;
2411
- define(Gp, "constructor", GeneratorFunctionPrototype);
2412
- define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
2413
- GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
2414
-
2415
- // Helper for defining the .next, .throw, and .return methods of the
2416
- // Iterator interface in terms of a single ._invoke method.
2417
- function defineIteratorMethods(prototype) {
2418
- ["next", "throw", "return"].forEach(function (method) {
2419
- define(prototype, method, function (arg) {
2420
- return this._invoke(method, arg);
2421
- });
2422
- });
2423
- }
2424
- exports.isGeneratorFunction = function (genFun) {
2425
- var ctor = typeof genFun === "function" && genFun.constructor;
2426
- return ctor ? ctor === GeneratorFunction ||
2427
- // For the native GeneratorFunction constructor, the best we can
2428
- // do is to check its .name property.
2429
- (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
2430
- };
2431
- exports.mark = function (genFun) {
2432
- if (Object.setPrototypeOf) {
2433
- Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
2434
- } else {
2435
- genFun.__proto__ = GeneratorFunctionPrototype;
2436
- define(genFun, toStringTagSymbol, "GeneratorFunction");
2437
- }
2438
- genFun.prototype = Object.create(Gp);
2439
- return genFun;
2440
- };
2441
-
2442
- // Within the body of any async function, `await x` is transformed to
2443
- // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
2444
- // `hasOwn.call(value, "__await")` to determine if the yielded value is
2445
- // meant to be awaited.
2446
- exports.awrap = function (arg) {
2447
- return {
2448
- __await: arg
2449
- };
2450
- };
2451
- function AsyncIterator(generator, PromiseImpl) {
2452
- function invoke(method, arg, resolve, reject) {
2453
- var record = tryCatch(generator[method], generator, arg);
2454
- if (record.type === "throw") {
2455
- reject(record.arg);
2456
- } else {
2457
- var result = record.arg;
2458
- var value = result.value;
2459
- if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
2460
- return PromiseImpl.resolve(value.__await).then(function (value) {
2461
- invoke("next", value, resolve, reject);
2462
- }, function (err) {
2463
- invoke("throw", err, resolve, reject);
2464
- });
2465
- }
2466
- return PromiseImpl.resolve(value).then(function (unwrapped) {
2467
- // When a yielded Promise is resolved, its final value becomes
2468
- // the .value of the Promise<{value,done}> result for the
2469
- // current iteration.
2470
- result.value = unwrapped;
2471
- resolve(result);
2472
- }, function (error) {
2473
- // If a rejected Promise was yielded, throw the rejection back
2474
- // into the async generator function so it can be handled there.
2475
- return invoke("throw", error, resolve, reject);
2476
- });
2477
- }
2478
- }
2479
- var previousPromise;
2480
- function enqueue(method, arg) {
2481
- function callInvokeWithMethodAndArg() {
2482
- return new PromiseImpl(function (resolve, reject) {
2483
- invoke(method, arg, resolve, reject);
2484
- });
2485
- }
2486
- return previousPromise =
2487
- // If enqueue has been called before, then we want to wait until
2488
- // all previous Promises have been resolved before calling invoke,
2489
- // so that results are always delivered in the correct order. If
2490
- // enqueue has not been called before, then it is important to
2491
- // call invoke immediately, without waiting on a callback to fire,
2492
- // so that the async generator function has the opportunity to do
2493
- // any necessary setup in a predictable way. This predictability
2494
- // is why the Promise constructor synchronously invokes its
2495
- // executor callback, and why async functions synchronously
2496
- // execute code before the first await. Since we implement simple
2497
- // async functions in terms of async generators, it is especially
2498
- // important to get this right, even though it requires care.
2499
- previousPromise ? previousPromise.then(callInvokeWithMethodAndArg,
2500
- // Avoid propagating failures to Promises returned by later
2501
- // invocations of the iterator.
2502
- callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
2503
- }
2504
-
2505
- // Define the unified helper method that is used to implement .next,
2506
- // .throw, and .return (see defineIteratorMethods).
2507
- this._invoke = enqueue;
2508
- }
2509
- defineIteratorMethods(AsyncIterator.prototype);
2510
- define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
2511
- return this;
2512
- });
2513
- exports.AsyncIterator = AsyncIterator;
2514
-
2515
- // Note that simple async functions are implemented on top of
2516
- // AsyncIterator objects; they just return a Promise for the value of
2517
- // the final result produced by the iterator.
2518
- exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
2519
- if (PromiseImpl === void 0) PromiseImpl = Promise;
2520
- var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
2521
- return exports.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator.
2522
- : iter.next().then(function (result) {
2523
- return result.done ? result.value : iter.next();
2524
- });
2525
- };
2526
- function makeInvokeMethod(innerFn, self, context) {
2527
- var state = GenStateSuspendedStart;
2528
- return function invoke(method, arg) {
2529
- if (state === GenStateExecuting) {
2530
- throw new Error("Generator is already running");
2531
- }
2532
- if (state === GenStateCompleted) {
2533
- if (method === "throw") {
2534
- throw arg;
2535
- }
2536
-
2537
- // Be forgiving, per 25.3.3.3.3 of the spec:
2538
- // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
2539
- return doneResult();
2540
- }
2541
- context.method = method;
2542
- context.arg = arg;
2543
- while (true) {
2544
- var delegate = context.delegate;
2545
- if (delegate) {
2546
- var delegateResult = maybeInvokeDelegate(delegate, context);
2547
- if (delegateResult) {
2548
- if (delegateResult === ContinueSentinel) continue;
2549
- return delegateResult;
2550
- }
2551
- }
2552
- if (context.method === "next") {
2553
- // Setting context._sent for legacy support of Babel's
2554
- // function.sent implementation.
2555
- context.sent = context._sent = context.arg;
2556
- } else if (context.method === "throw") {
2557
- if (state === GenStateSuspendedStart) {
2558
- state = GenStateCompleted;
2559
- throw context.arg;
2560
- }
2561
- context.dispatchException(context.arg);
2562
- } else if (context.method === "return") {
2563
- context.abrupt("return", context.arg);
2564
- }
2565
- state = GenStateExecuting;
2566
- var record = tryCatch(innerFn, self, context);
2567
- if (record.type === "normal") {
2568
- // If an exception is thrown from innerFn, we leave state ===
2569
- // GenStateExecuting and loop back for another invocation.
2570
- state = context.done ? GenStateCompleted : GenStateSuspendedYield;
2571
- if (record.arg === ContinueSentinel) {
2572
- continue;
2573
- }
2574
- return {
2575
- value: record.arg,
2576
- done: context.done
2577
- };
2578
- } else if (record.type === "throw") {
2579
- state = GenStateCompleted;
2580
- // Dispatch the exception by looping back around to the
2581
- // context.dispatchException(context.arg) call above.
2582
- context.method = "throw";
2583
- context.arg = record.arg;
2584
- }
2585
- }
2586
- };
2587
- }
2588
-
2589
- // Call delegate.iterator[context.method](context.arg) and handle the
2590
- // result, either by returning a { value, done } result from the
2591
- // delegate iterator, or by modifying context.method and context.arg,
2592
- // setting context.delegate to null, and returning the ContinueSentinel.
2593
- function maybeInvokeDelegate(delegate, context) {
2594
- var method = delegate.iterator[context.method];
2595
- if (method === undefined$1) {
2596
- // A .throw or .return when the delegate iterator has no .throw
2597
- // method always terminates the yield* loop.
2598
- context.delegate = null;
2599
- if (context.method === "throw") {
2600
- // Note: ["return"] must be used for ES3 parsing compatibility.
2601
- if (delegate.iterator["return"]) {
2602
- // If the delegate iterator has a return method, give it a
2603
- // chance to clean up.
2604
- context.method = "return";
2605
- context.arg = undefined$1;
2606
- maybeInvokeDelegate(delegate, context);
2607
- if (context.method === "throw") {
2608
- // If maybeInvokeDelegate(context) changed context.method from
2609
- // "return" to "throw", let that override the TypeError below.
2610
- return ContinueSentinel;
2611
- }
2612
- }
2613
- context.method = "throw";
2614
- context.arg = new TypeError("The iterator does not provide a 'throw' method");
2615
- }
2616
- return ContinueSentinel;
2617
- }
2618
- var record = tryCatch(method, delegate.iterator, context.arg);
2619
- if (record.type === "throw") {
2620
- context.method = "throw";
2621
- context.arg = record.arg;
2622
- context.delegate = null;
2623
- return ContinueSentinel;
2624
- }
2625
- var info = record.arg;
2626
- if (!info) {
2627
- context.method = "throw";
2628
- context.arg = new TypeError("iterator result is not an object");
2629
- context.delegate = null;
2630
- return ContinueSentinel;
2631
- }
2632
- if (info.done) {
2633
- // Assign the result of the finished delegate to the temporary
2634
- // variable specified by delegate.resultName (see delegateYield).
2635
- context[delegate.resultName] = info.value;
2636
-
2637
- // Resume execution at the desired location (see delegateYield).
2638
- context.next = delegate.nextLoc;
2639
-
2640
- // If context.method was "throw" but the delegate handled the
2641
- // exception, let the outer generator proceed normally. If
2642
- // context.method was "next", forget context.arg since it has been
2643
- // "consumed" by the delegate iterator. If context.method was
2644
- // "return", allow the original .return call to continue in the
2645
- // outer generator.
2646
- if (context.method !== "return") {
2647
- context.method = "next";
2648
- context.arg = undefined$1;
2649
- }
2650
- } else {
2651
- // Re-yield the result returned by the delegate method.
2652
- return info;
2653
- }
2654
-
2655
- // The delegate iterator is finished, so forget it and continue with
2656
- // the outer generator.
2657
- context.delegate = null;
2658
- return ContinueSentinel;
2659
- }
2660
-
2661
- // Define Generator.prototype.{next,throw,return} in terms of the
2662
- // unified ._invoke helper method.
2663
- defineIteratorMethods(Gp);
2664
- define(Gp, toStringTagSymbol, "Generator");
2665
-
2666
- // A Generator should always return itself as the iterator object when the
2667
- // @@iterator function is called on it. Some browsers' implementations of the
2668
- // iterator prototype chain incorrectly implement this, causing the Generator
2669
- // object to not be returned from this call. This ensures that doesn't happen.
2670
- // See https://github.com/facebook/regenerator/issues/274 for more details.
2671
- define(Gp, iteratorSymbol, function () {
2672
- return this;
2673
- });
2674
- define(Gp, "toString", function () {
2675
- return "[object Generator]";
2676
- });
2677
- function pushTryEntry(locs) {
2678
- var entry = {
2679
- tryLoc: locs[0]
2680
- };
2681
- if (1 in locs) {
2682
- entry.catchLoc = locs[1];
2683
- }
2684
- if (2 in locs) {
2685
- entry.finallyLoc = locs[2];
2686
- entry.afterLoc = locs[3];
2687
- }
2688
- this.tryEntries.push(entry);
2689
- }
2690
- function resetTryEntry(entry) {
2691
- var record = entry.completion || {};
2692
- record.type = "normal";
2693
- delete record.arg;
2694
- entry.completion = record;
2695
- }
2696
- function Context(tryLocsList) {
2697
- // The root entry object (effectively a try statement without a catch
2698
- // or a finally block) gives us a place to store values thrown from
2699
- // locations where there is no enclosing try statement.
2700
- this.tryEntries = [{
2701
- tryLoc: "root"
2702
- }];
2703
- tryLocsList.forEach(pushTryEntry, this);
2704
- this.reset(true);
2705
- }
2706
- exports.keys = function (object) {
2707
- var keys = [];
2708
- for (var key in object) {
2709
- keys.push(key);
2710
- }
2711
- keys.reverse();
2712
-
2713
- // Rather than returning an object with a next method, we keep
2714
- // things simple and return the next function itself.
2715
- return function next() {
2716
- while (keys.length) {
2717
- var key = keys.pop();
2718
- if (key in object) {
2719
- next.value = key;
2720
- next.done = false;
2721
- return next;
2722
- }
2723
- }
2724
-
2725
- // To avoid creating an additional object, we just hang the .value
2726
- // and .done properties off the next function object itself. This
2727
- // also ensures that the minifier will not anonymize the function.
2728
- next.done = true;
2729
- return next;
2730
- };
2731
- };
2732
- function values(iterable) {
2733
- if (iterable) {
2734
- var iteratorMethod = iterable[iteratorSymbol];
2735
- if (iteratorMethod) {
2736
- return iteratorMethod.call(iterable);
2737
- }
2738
- if (typeof iterable.next === "function") {
2739
- return iterable;
2740
- }
2741
- if (!isNaN(iterable.length)) {
2742
- var i = -1,
2743
- next = function next() {
2744
- while (++i < iterable.length) {
2745
- if (hasOwn.call(iterable, i)) {
2746
- next.value = iterable[i];
2747
- next.done = false;
2748
- return next;
2749
- }
2750
- }
2751
- next.value = undefined$1;
2752
- next.done = true;
2753
- return next;
2754
- };
2755
- return next.next = next;
2756
- }
2757
- }
2758
-
2759
- // Return an iterator with no values.
2760
- return {
2761
- next: doneResult
2762
- };
2763
- }
2764
- exports.values = values;
2765
- function doneResult() {
2766
- return {
2767
- value: undefined$1,
2768
- done: true
2769
- };
2770
- }
2771
- Context.prototype = {
2772
- constructor: Context,
2773
- reset: function reset(skipTempReset) {
2774
- this.prev = 0;
2775
- this.next = 0;
2776
- // Resetting context._sent for legacy support of Babel's
2777
- // function.sent implementation.
2778
- this.sent = this._sent = undefined$1;
2779
- this.done = false;
2780
- this.delegate = null;
2781
- this.method = "next";
2782
- this.arg = undefined$1;
2783
- this.tryEntries.forEach(resetTryEntry);
2784
- if (!skipTempReset) {
2785
- for (var name in this) {
2786
- // Not sure about the optimal order of these conditions:
2787
- if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
2788
- this[name] = undefined$1;
2789
- }
2790
- }
2791
- }
2792
- },
2793
- stop: function stop() {
2794
- this.done = true;
2795
- var rootEntry = this.tryEntries[0];
2796
- var rootRecord = rootEntry.completion;
2797
- if (rootRecord.type === "throw") {
2798
- throw rootRecord.arg;
2799
- }
2800
- return this.rval;
2801
- },
2802
- dispatchException: function dispatchException(exception) {
2803
- if (this.done) {
2804
- throw exception;
2805
- }
2806
- var context = this;
2807
- function handle(loc, caught) {
2808
- record.type = "throw";
2809
- record.arg = exception;
2810
- context.next = loc;
2811
- if (caught) {
2812
- // If the dispatched exception was caught by a catch block,
2813
- // then let that catch block handle the exception normally.
2814
- context.method = "next";
2815
- context.arg = undefined$1;
2816
- }
2817
- return !!caught;
2818
- }
2819
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
2820
- var entry = this.tryEntries[i];
2821
- var record = entry.completion;
2822
- if (entry.tryLoc === "root") {
2823
- // Exception thrown outside of any try block that could handle
2824
- // it, so set the completion value of the entire function to
2825
- // throw the exception.
2826
- return handle("end");
2827
- }
2828
- if (entry.tryLoc <= this.prev) {
2829
- var hasCatch = hasOwn.call(entry, "catchLoc");
2830
- var hasFinally = hasOwn.call(entry, "finallyLoc");
2831
- if (hasCatch && hasFinally) {
2832
- if (this.prev < entry.catchLoc) {
2833
- return handle(entry.catchLoc, true);
2834
- } else if (this.prev < entry.finallyLoc) {
2835
- return handle(entry.finallyLoc);
2836
- }
2837
- } else if (hasCatch) {
2838
- if (this.prev < entry.catchLoc) {
2839
- return handle(entry.catchLoc, true);
2840
- }
2841
- } else if (hasFinally) {
2842
- if (this.prev < entry.finallyLoc) {
2843
- return handle(entry.finallyLoc);
2844
- }
2845
- } else {
2846
- throw new Error("try statement without catch or finally");
2847
- }
2848
- }
2849
- }
2850
- },
2851
- abrupt: function abrupt(type, arg) {
2852
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
2853
- var entry = this.tryEntries[i];
2854
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
2855
- var finallyEntry = entry;
2606
+ var _ref;
2607
+ var fetcher = function fetcher() {
2608
+ return (_ref = _ref || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
2609
+ var res, _yield$res$json, data;
2610
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
2611
+ while (1) switch (_context.prev = _context.next) {
2612
+ case 0:
2613
+ console.log('FETCHER');
2614
+ _context.next = 3;
2615
+ return fetch('./data.json');
2616
+ case 3:
2617
+ res = _context.sent;
2618
+ if (!res.ok) {
2619
+ _context.next = 10;
2856
2620
  break;
2857
2621
  }
2858
- }
2859
- if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
2860
- // Ignore the finally entry if control is not jumping to a
2861
- // location outside the try/catch block.
2862
- finallyEntry = null;
2863
- }
2864
- var record = finallyEntry ? finallyEntry.completion : {};
2865
- record.type = type;
2866
- record.arg = arg;
2867
- if (finallyEntry) {
2868
- this.method = "next";
2869
- this.next = finallyEntry.finallyLoc;
2870
- return ContinueSentinel;
2871
- }
2872
- return this.complete(record);
2873
- },
2874
- complete: function complete(record, afterLoc) {
2875
- if (record.type === "throw") {
2876
- throw record.arg;
2877
- }
2878
- if (record.type === "break" || record.type === "continue") {
2879
- this.next = record.arg;
2880
- } else if (record.type === "return") {
2881
- this.rval = this.arg = record.arg;
2882
- this.method = "return";
2883
- this.next = "end";
2884
- } else if (record.type === "normal" && afterLoc) {
2885
- this.next = afterLoc;
2886
- }
2887
- return ContinueSentinel;
2888
- },
2889
- finish: function finish(finallyLoc) {
2890
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
2891
- var entry = this.tryEntries[i];
2892
- if (entry.finallyLoc === finallyLoc) {
2893
- this.complete(entry.completion, entry.afterLoc);
2894
- resetTryEntry(entry);
2895
- return ContinueSentinel;
2896
- }
2897
- }
2898
- },
2899
- "catch": function _catch(tryLoc) {
2900
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
2901
- var entry = this.tryEntries[i];
2902
- if (entry.tryLoc === tryLoc) {
2903
- var record = entry.completion;
2904
- if (record.type === "throw") {
2905
- var thrown = record.arg;
2906
- resetTryEntry(entry);
2907
- }
2908
- return thrown;
2909
- }
2910
- }
2911
-
2912
- // The context.catch method must only be called with a location
2913
- // argument that corresponds to a known catch block.
2914
- throw new Error("illegal catch attempt");
2915
- },
2916
- delegateYield: function delegateYield(iterable, resultName, nextLoc) {
2917
- this.delegate = {
2918
- iterator: values(iterable),
2919
- resultName: resultName,
2920
- nextLoc: nextLoc
2921
- };
2922
- if (this.method === "next") {
2923
- // Deliberately forget the last sent value so that we don't
2924
- // accidentally pass it on to the delegate.
2925
- this.arg = undefined$1;
2926
- }
2927
- return ContinueSentinel;
2928
- }
2929
- };
2930
-
2931
- // Regardless of whether this script is executing as a CommonJS module
2932
- // or not, return the runtime object so that we can declare the variable
2933
- // regeneratorRuntime in the outer scope, which allows this module to be
2934
- // injected easily by `bin/regenerator --include-runtime script.js`.
2935
- return exports;
2936
- }(
2937
- // If this script is executing as a CommonJS module, use module.exports
2938
- // as the regeneratorRuntime namespace. Otherwise create a new empty
2939
- // object. Either way, the resulting object will be used to initialize
2940
- // the regeneratorRuntime variable at the top of this file.
2941
- module.exports );
2942
- try {
2943
- regeneratorRuntime = runtime;
2944
- } catch (accidentalStrictMode) {
2945
- // This module should not be running in strict mode, so the above
2946
- // assignment should always work unless something is misconfigured. Just
2947
- // in case runtime.js accidentally runs in strict mode, in modern engines
2948
- // we can explicitly access globalThis. In older engines we can escape
2949
- // strict mode using a global Function call. This could conceivably fail
2950
- // if a Content Security Policy forbids using Function, but in that case
2951
- // the proper solution is to fix the accidental strict mode problem. If
2952
- // you've misconfigured your bundler to force strict mode and applied a
2953
- // CSP to forbid Function, and you're not willing to fix either of those
2954
- // problems, please detail your unique predicament in a GitHub issue.
2955
- if (typeof globalThis === "object") {
2956
- globalThis.regeneratorRuntime = runtime;
2957
- } else {
2958
- Function("r", "regeneratorRuntime = r")(runtime);
2959
- }
2960
- }
2961
- });
2962
-
2963
- var fetcher = /*#__PURE__*/function () {
2964
- var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
2965
- var res, _yield$res$json, data;
2966
- return runtime_1.wrap(function _callee$(_context) {
2967
- while (1) {
2968
- switch (_context.prev = _context.next) {
2969
- case 0:
2970
- console.log('FETCHER');
2971
- _context.next = 3;
2972
- return fetch('./data.json');
2973
- case 3:
2974
- res = _context.sent;
2975
- if (!res.ok) {
2976
- _context.next = 10;
2977
- break;
2978
- }
2979
- _context.next = 7;
2980
- return res.json();
2981
- case 7:
2982
- _yield$res$json = _context.sent;
2983
- data = _yield$res$json.data;
2984
- return _context.abrupt("return", data);
2985
- case 10:
2986
- throw res;
2987
- case 11:
2988
- case "end":
2989
- return _context.stop();
2990
- }
2622
+ _context.next = 7;
2623
+ return res.json();
2624
+ case 7:
2625
+ _yield$res$json = _context.sent;
2626
+ data = _yield$res$json.data;
2627
+ return _context.abrupt("return", data);
2628
+ case 10:
2629
+ throw res;
2630
+ case 11:
2631
+ case "end":
2632
+ return _context.stop();
2991
2633
  }
2992
2634
  }, _callee);
2993
- }));
2994
- return function fetcher() {
2995
- return _ref.apply(this, arguments);
2996
- };
2997
- }();
2635
+ }))).apply(this, arguments);
2636
+ };
2998
2637
 
2999
2638
  var LOCAL_CART_OBJ = "localCartObj";
3000
2639
  var LOCAL_CART_ID = "localCartId";
@@ -3044,18 +2683,16 @@ var handler = {
3044
2683
  query: "use-cart"
3045
2684
  },
3046
2685
  fetcher: function fetcher(_ref) {
3047
- return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
2686
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
3048
2687
  var input, fetch;
3049
- return runtime_1.wrap(function _callee$(_context) {
3050
- while (1) {
3051
- switch (_context.prev = _context.next) {
3052
- case 0:
3053
- input = _ref.input, fetch = _ref.fetch;
3054
- return _context.abrupt("return", getCart(input.cartId));
3055
- case 2:
3056
- case "end":
3057
- return _context.stop();
3058
- }
2688
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
2689
+ while (1) switch (_context.prev = _context.next) {
2690
+ case 0:
2691
+ input = _ref.input, fetch = _ref.fetch;
2692
+ return _context.abrupt("return", getCart(input.cartId));
2693
+ case 2:
2694
+ case "end":
2695
+ return _context.stop();
3059
2696
  }
3060
2697
  }, _callee);
3061
2698
  }))();
@@ -3088,50 +2725,48 @@ var handler$1 = {
3088
2725
  query: "use-add-item"
3089
2726
  },
3090
2727
  fetcher: function fetcher(_ref) {
3091
- return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
2728
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
3092
2729
  var _item$quantity;
3093
2730
  var item, fetch, lineItem, cart, _iterator, _step, product, variant, _item$quantity2, currentLineItem;
3094
- return runtime_1.wrap(function _callee$(_context) {
3095
- while (1) {
3096
- switch (_context.prev = _context.next) {
3097
- case 0:
3098
- item = _ref.input, fetch = _ref.fetch;
3099
- if (!(item.quantity && (!Number.isInteger(item.quantity) || item.quantity < 1))) {
3100
- _context.next = 3;
3101
- break;
3102
- }
3103
- throw new CommerceError({
3104
- message: "The item quantity has to be a valid integer greater than 0"
2731
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
2732
+ while (1) switch (_context.prev = _context.next) {
2733
+ case 0:
2734
+ item = _ref.input, fetch = _ref.fetch;
2735
+ if (!(item.quantity && (!Number.isInteger(item.quantity) || item.quantity < 1))) {
2736
+ _context.next = 3;
2737
+ break;
2738
+ }
2739
+ throw new CommerceError({
2740
+ message: "The item quantity has to be a valid integer greater than 0"
2741
+ });
2742
+ case 3:
2743
+ lineItem = {
2744
+ variantId: item.variantId,
2745
+ quantity: (_item$quantity = item.quantity) != null ? _item$quantity : 1
2746
+ };
2747
+ cart = getCart();
2748
+ for (_iterator = _createForOfIteratorHelperLoose(data.products); !(_step = _iterator()).done;) {
2749
+ product = _step.value;
2750
+ variant = product.variants.find(function (variant) {
2751
+ return variant.id === item.variantId;
3105
2752
  });
3106
- case 3:
3107
- lineItem = {
3108
- variantId: item.variantId,
3109
- quantity: (_item$quantity = item.quantity) != null ? _item$quantity : 1
3110
- };
3111
- cart = getCart();
3112
- for (_iterator = _createForOfIteratorHelperLoose(data.products); !(_step = _iterator()).done;) {
3113
- product = _step.value;
3114
- variant = product.variants.find(function (variant) {
3115
- return variant.id === item.variantId;
2753
+ if (variant) {
2754
+ cart.totalPrice += variant.price * ((_item$quantity2 = item.quantity) != null ? _item$quantity2 : 1);
2755
+ cart.currency.code = product.price.currencyCode;
2756
+ currentLineItem = cart.lineItems.find(function (item) {
2757
+ return item.variantId === lineItem.variantId;
3116
2758
  });
3117
- if (variant) {
3118
- cart.totalPrice += variant.price * ((_item$quantity2 = item.quantity) != null ? _item$quantity2 : 1);
3119
- cart.currency.code = product.price.currencyCode;
3120
- currentLineItem = cart.lineItems.find(function (item) {
3121
- return item.variantId === lineItem.variantId;
3122
- });
3123
- if (!currentLineItem) {
3124
- cart.lineItems.push(lineItem);
3125
- } else {
3126
- currentLineItem.quantity += lineItem.quantity;
3127
- }
2759
+ if (!currentLineItem) {
2760
+ cart.lineItems.push(lineItem);
2761
+ } else {
2762
+ currentLineItem.quantity += lineItem.quantity;
3128
2763
  }
3129
2764
  }
3130
- return _context.abrupt("return", cartUpdate(cart));
3131
- case 7:
3132
- case "end":
3133
- return _context.stop();
3134
- }
2765
+ }
2766
+ return _context.abrupt("return", cartUpdate(cart));
2767
+ case 7:
2768
+ case "end":
2769
+ return _context.stop();
3135
2770
  }
3136
2771
  }, _callee);
3137
2772
  }))();
@@ -3139,37 +2774,32 @@ var handler$1 = {
3139
2774
  useHook: function useHook(_ref2) {
3140
2775
  var fetch = _ref2.fetch;
3141
2776
  return function () {
2777
+ var _addItem;
3142
2778
  var _useCart = useCart(),
3143
2779
  mutate = _useCart.mutate;
3144
- return useCallback( /*#__PURE__*/function () {
3145
- var _addItem = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(input) {
2780
+ return useCallback(function addItem(_x) {
2781
+ return (_addItem = _addItem || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
3146
2782
  var data;
3147
- return runtime_1.wrap(function _callee2$(_context2) {
3148
- while (1) {
3149
- switch (_context2.prev = _context2.next) {
3150
- case 0:
3151
- _context2.next = 2;
3152
- return fetch({
3153
- input: input
3154
- });
3155
- case 2:
3156
- data = _context2.sent;
3157
- _context2.next = 5;
3158
- return mutate(data, false);
3159
- case 5:
3160
- return _context2.abrupt("return", data);
3161
- case 6:
3162
- case "end":
3163
- return _context2.stop();
3164
- }
2783
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2784
+ while (1) switch (_context2.prev = _context2.next) {
2785
+ case 0:
2786
+ _context2.next = 2;
2787
+ return fetch({
2788
+ input: input
2789
+ });
2790
+ case 2:
2791
+ data = _context2.sent;
2792
+ _context2.next = 5;
2793
+ return mutate(data, false);
2794
+ case 5:
2795
+ return _context2.abrupt("return", data);
2796
+ case 6:
2797
+ case "end":
2798
+ return _context2.stop();
3165
2799
  }
3166
2800
  }, _callee2);
3167
- }));
3168
- function addItem(_x) {
3169
- return _addItem.apply(this, arguments);
3170
- }
3171
- return addItem;
3172
- }(), [fetch, mutate]);
2801
+ }))).apply(this, arguments);
2802
+ }, [fetch, mutate]);
3173
2803
  };
3174
2804
  }
3175
2805
  };
@@ -3179,40 +2809,33 @@ var handler$2 = {
3179
2809
  query: ''
3180
2810
  },
3181
2811
  fetcher: function fetcher(_ref) {
3182
- return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
3183
- return runtime_1.wrap(function _callee$(_context) {
3184
- while (1) {
3185
- switch (_context.prev = _context.next) {
3186
- case 0:
3187
- case 1:
3188
- case "end":
3189
- return _context.stop();
3190
- }
2812
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
2813
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
2814
+ while (1) switch (_context.prev = _context.next) {
2815
+ case 0:
2816
+ case 1:
2817
+ case "end":
2818
+ return _context.stop();
3191
2819
  }
3192
2820
  }, _callee);
3193
2821
  }))();
3194
2822
  },
3195
2823
  useHook: function useHook(_ref2) {
3196
2824
  return function () {
3197
- return /*#__PURE__*/function () {
3198
- var _addItem = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
3199
- return runtime_1.wrap(function _callee2$(_context2) {
3200
- while (1) {
3201
- switch (_context2.prev = _context2.next) {
3202
- case 0:
3203
- return _context2.abrupt("return", {});
3204
- case 1:
3205
- case "end":
3206
- return _context2.stop();
3207
- }
2825
+ var _addItem;
2826
+ return function addItem() {
2827
+ return (_addItem = _addItem || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
2828
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2829
+ while (1) switch (_context2.prev = _context2.next) {
2830
+ case 0:
2831
+ return _context2.abrupt("return", {});
2832
+ case 1:
2833
+ case "end":
2834
+ return _context2.stop();
3208
2835
  }
3209
2836
  }, _callee2);
3210
- }));
3211
- function addItem() {
3212
- return _addItem.apply(this, arguments);
3213
- }
3214
- return addItem;
3215
- }();
2837
+ }))).apply(this, arguments);
2838
+ };
3216
2839
  };
3217
2840
  }
3218
2841
  };
@@ -3222,40 +2845,33 @@ var handler$3 = {
3222
2845
  query: ''
3223
2846
  },
3224
2847
  fetcher: function fetcher(_ref) {
3225
- return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
3226
- return runtime_1.wrap(function _callee$(_context) {
3227
- while (1) {
3228
- switch (_context.prev = _context.next) {
3229
- case 0:
3230
- case 1:
3231
- case "end":
3232
- return _context.stop();
3233
- }
2848
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
2849
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
2850
+ while (1) switch (_context.prev = _context.next) {
2851
+ case 0:
2852
+ case 1:
2853
+ case "end":
2854
+ return _context.stop();
3234
2855
  }
3235
2856
  }, _callee);
3236
2857
  }))();
3237
2858
  },
3238
2859
  useHook: function useHook(_ref2) {
3239
2860
  return function () {
3240
- return /*#__PURE__*/function () {
3241
- var _removeItem = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(input) {
3242
- return runtime_1.wrap(function _callee2$(_context2) {
3243
- while (1) {
3244
- switch (_context2.prev = _context2.next) {
3245
- case 0:
3246
- return _context2.abrupt("return", {});
3247
- case 1:
3248
- case "end":
3249
- return _context2.stop();
3250
- }
2861
+ var _removeItem;
2862
+ return function removeItem(_x) {
2863
+ return (_removeItem = _removeItem || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
2864
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2865
+ while (1) switch (_context2.prev = _context2.next) {
2866
+ case 0:
2867
+ return _context2.abrupt("return", {});
2868
+ case 1:
2869
+ case "end":
2870
+ return _context2.stop();
3251
2871
  }
3252
2872
  }, _callee2);
3253
- }));
3254
- function removeItem(_x) {
3255
- return _removeItem.apply(this, arguments);
3256
- }
3257
- return removeItem;
3258
- }();
2873
+ }))).apply(this, arguments);
2874
+ };
3259
2875
  };
3260
2876
  }
3261
2877
  };
@@ -3280,47 +2896,45 @@ var handler$4 = {
3280
2896
  query: "use-search"
3281
2897
  },
3282
2898
  fetcher: function fetcher(_ref) {
3283
- return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
2899
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
3284
2900
  var input, fetch, search, categoryId, brandId, sort, count, products, category;
3285
- return runtime_1.wrap(function _callee$(_context) {
3286
- while (1) {
3287
- switch (_context.prev = _context.next) {
3288
- case 0:
3289
- input = _ref.input, fetch = _ref.fetch;
3290
- search = input.search, categoryId = input.categoryId, brandId = input.brandId, sort = input.sort, count = input.count;
3291
- products = data.products;
3292
- if (categoryId) {
3293
- category = data.categories.find(function (category) {
3294
- return category.id === categoryId;
3295
- });
3296
- products = data.products.filter(function (product) {
3297
- var _category$products;
3298
- return category == null ? void 0 : (_category$products = category.products) == null ? void 0 : _category$products.includes(product.id);
3299
- });
3300
- }
3301
- if (brandId) {
3302
- products = products.filter(function (product) {
3303
- return product.vendor.replace(/\s+/g, "-").toLowerCase() === ("" + brandId).toLowerCase();
3304
- });
3305
- }
3306
- if (search) {
3307
- products = products.filter(function (product) {
3308
- return product.name.toLowerCase().includes(("" + search).toLowerCase()) || product.slug.toLowerCase().includes(("" + search).toLowerCase());
3309
- });
3310
- }
3311
- if (sort) {
3312
- products = products.sort(function (a, b) {
3313
- return sortProduct(a, b, sort);
3314
- });
3315
- }
3316
- return _context.abrupt("return", {
3317
- products: products.slice(0, count),
3318
- found: products.length > 0
2901
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
2902
+ while (1) switch (_context.prev = _context.next) {
2903
+ case 0:
2904
+ input = _ref.input, fetch = _ref.fetch;
2905
+ search = input.search, categoryId = input.categoryId, brandId = input.brandId, sort = input.sort, count = input.count;
2906
+ products = data.products;
2907
+ if (categoryId) {
2908
+ category = data.categories.find(function (category) {
2909
+ return category.id === categoryId;
3319
2910
  });
3320
- case 8:
3321
- case "end":
3322
- return _context.stop();
3323
- }
2911
+ products = data.products.filter(function (product) {
2912
+ var _category$products;
2913
+ return category == null || (_category$products = category.products) == null ? void 0 : _category$products.includes(product.id);
2914
+ });
2915
+ }
2916
+ if (brandId) {
2917
+ products = products.filter(function (product) {
2918
+ return product.vendor.replace(/\s+/g, "-").toLowerCase() === ("" + brandId).toLowerCase();
2919
+ });
2920
+ }
2921
+ if (search) {
2922
+ products = products.filter(function (product) {
2923
+ return product.name.toLowerCase().includes(("" + search).toLowerCase()) || product.slug.toLowerCase().includes(("" + search).toLowerCase());
2924
+ });
2925
+ }
2926
+ if (sort) {
2927
+ products = products.sort(function (a, b) {
2928
+ return sortProduct(a, b, sort);
2929
+ });
2930
+ }
2931
+ return _context.abrupt("return", {
2932
+ products: products.slice(0, count),
2933
+ found: products.length > 0
2934
+ });
2935
+ case 8:
2936
+ case "end":
2937
+ return _context.stop();
3324
2938
  }
3325
2939
  }, _callee);
3326
2940
  }))();
@@ -3346,22 +2960,20 @@ var handler$5 = {
3346
2960
  query: "use-product"
3347
2961
  },
3348
2962
  fetcher: function fetcher(_ref) {
3349
- return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
2963
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
3350
2964
  var _data$products$find;
3351
2965
  var input, fetch, id;
3352
- return runtime_1.wrap(function _callee$(_context) {
3353
- while (1) {
3354
- switch (_context.prev = _context.next) {
3355
- case 0:
3356
- input = _ref.input, fetch = _ref.fetch;
3357
- id = input.id;
3358
- return _context.abrupt("return", (_data$products$find = data.products.find(function (product) {
3359
- return [product.id, product.slug].includes(id);
3360
- })) != null ? _data$products$find : null);
3361
- case 3:
3362
- case "end":
3363
- return _context.stop();
3364
- }
2966
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
2967
+ while (1) switch (_context.prev = _context.next) {
2968
+ case 0:
2969
+ input = _ref.input, fetch = _ref.fetch;
2970
+ id = input.id;
2971
+ return _context.abrupt("return", (_data$products$find = data.products.find(function (product) {
2972
+ return [product.id, product.slug].includes(id);
2973
+ })) != null ? _data$products$find : null);
2974
+ case 3:
2975
+ case "end":
2976
+ return _context.stop();
3365
2977
  }
3366
2978
  }, _callee);
3367
2979
  }))();
@@ -3387,28 +2999,26 @@ var handler$6 = {
3387
2999
  query: "use-categories"
3388
3000
  },
3389
3001
  fetcher: function fetcher(_ref) {
3390
- return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
3002
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
3391
3003
  var input, fetch, categoryId, category;
3392
- return runtime_1.wrap(function _callee$(_context) {
3393
- while (1) {
3394
- switch (_context.prev = _context.next) {
3395
- case 0:
3396
- input = _ref.input, fetch = _ref.fetch;
3397
- categoryId = input.categoryId;
3398
- if (categoryId) {
3399
- _context.next = 4;
3400
- break;
3401
- }
3402
- return _context.abrupt("return", data.categories);
3403
- case 4:
3404
- category = data.categories.find(function (category) {
3405
- return category.id === categoryId;
3406
- });
3407
- return _context.abrupt("return", category ? [category] : []);
3408
- case 6:
3409
- case "end":
3410
- return _context.stop();
3411
- }
3004
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
3005
+ while (1) switch (_context.prev = _context.next) {
3006
+ case 0:
3007
+ input = _ref.input, fetch = _ref.fetch;
3008
+ categoryId = input.categoryId;
3009
+ if (categoryId) {
3010
+ _context.next = 4;
3011
+ break;
3012
+ }
3013
+ return _context.abrupt("return", data.categories);
3014
+ case 4:
3015
+ category = data.categories.find(function (category) {
3016
+ return category.id === categoryId;
3017
+ });
3018
+ return _context.abrupt("return", category ? [category] : []);
3019
+ case 6:
3020
+ case "end":
3021
+ return _context.stop();
3412
3022
  }
3413
3023
  }, _callee);
3414
3024
  }))();
@@ -3442,27 +3052,25 @@ var handler$7 = {
3442
3052
  query: "use-brands"
3443
3053
  },
3444
3054
  fetcher: function fetcher(_ref) {
3445
- return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
3055
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
3446
3056
  var vendorsStrings;
3447
- return runtime_1.wrap(function _callee$(_context) {
3448
- while (1) {
3449
- switch (_context.prev = _context.next) {
3450
- case 0:
3451
- vendorsStrings = data.products.map(function (product) {
3452
- return product.vendor;
3453
- });
3454
- return _context.abrupt("return", Array.from(new Set(vendorsStrings).values()).map(function (v) {
3455
- var id = v.replace(/\s+/g, "-").toLowerCase();
3456
- return {
3457
- entityId: id,
3458
- name: v,
3459
- path: "brands/" + id
3460
- };
3461
- }));
3462
- case 3:
3463
- case "end":
3464
- return _context.stop();
3465
- }
3057
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
3058
+ while (1) switch (_context.prev = _context.next) {
3059
+ case 0:
3060
+ vendorsStrings = data.products.map(function (product) {
3061
+ return product.vendor;
3062
+ });
3063
+ return _context.abrupt("return", Array.from(new Set(vendorsStrings).values()).map(function (v) {
3064
+ var id = v.replace(/\s+/g, "-").toLowerCase();
3065
+ return {
3066
+ entityId: id,
3067
+ name: v,
3068
+ path: "brands/" + id
3069
+ };
3070
+ }));
3071
+ case 3:
3072
+ case "end":
3073
+ return _context.stop();
3466
3074
  }
3467
3075
  }, _callee);
3468
3076
  }))();