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