@plasmicpkgs/commerce-local 0.0.86 → 0.0.88
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commerce-local.cjs.development.js +84 -232
- package/dist/commerce-local.cjs.development.js.map +1 -1
- package/dist/commerce-local.cjs.production.min.js +1 -1
- package/dist/commerce-local.cjs.production.min.js.map +1 -1
- package/dist/commerce-local.esm.js +84 -232
- package/dist/commerce-local.esm.js.map +1 -1
- package/package.json +4 -4
|
@@ -2241,52 +2241,42 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
2241
2241
|
reject(error);
|
|
2242
2242
|
return;
|
|
2243
2243
|
}
|
|
2244
|
-
|
|
2245
2244
|
if (info.done) {
|
|
2246
2245
|
resolve(value);
|
|
2247
2246
|
} else {
|
|
2248
2247
|
Promise.resolve(value).then(_next, _throw);
|
|
2249
2248
|
}
|
|
2250
2249
|
}
|
|
2251
|
-
|
|
2252
2250
|
function _asyncToGenerator(fn) {
|
|
2253
2251
|
return function () {
|
|
2254
2252
|
var self = this,
|
|
2255
|
-
|
|
2253
|
+
args = arguments;
|
|
2256
2254
|
return new Promise(function (resolve, reject) {
|
|
2257
2255
|
var gen = fn.apply(self, args);
|
|
2258
|
-
|
|
2259
2256
|
function _next(value) {
|
|
2260
2257
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
2261
2258
|
}
|
|
2262
|
-
|
|
2263
2259
|
function _throw(err) {
|
|
2264
2260
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
2265
2261
|
}
|
|
2266
|
-
|
|
2267
2262
|
_next(undefined);
|
|
2268
2263
|
});
|
|
2269
2264
|
};
|
|
2270
2265
|
}
|
|
2271
|
-
|
|
2272
2266
|
function _extends() {
|
|
2273
|
-
_extends = Object.assign
|
|
2267
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
2274
2268
|
for (var i = 1; i < arguments.length; i++) {
|
|
2275
2269
|
var source = arguments[i];
|
|
2276
|
-
|
|
2277
2270
|
for (var key in source) {
|
|
2278
2271
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
2279
2272
|
target[key] = source[key];
|
|
2280
2273
|
}
|
|
2281
2274
|
}
|
|
2282
2275
|
}
|
|
2283
|
-
|
|
2284
2276
|
return target;
|
|
2285
2277
|
};
|
|
2286
|
-
|
|
2287
2278
|
return _extends.apply(this, arguments);
|
|
2288
2279
|
}
|
|
2289
|
-
|
|
2290
2280
|
function _unsupportedIterableToArray(o, minLen) {
|
|
2291
2281
|
if (!o) return;
|
|
2292
2282
|
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
@@ -2295,19 +2285,14 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
|
2295
2285
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
2296
2286
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
2297
2287
|
}
|
|
2298
|
-
|
|
2299
2288
|
function _arrayLikeToArray(arr, len) {
|
|
2300
2289
|
if (len == null || len > arr.length) len = arr.length;
|
|
2301
|
-
|
|
2302
2290
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
2303
|
-
|
|
2304
2291
|
return arr2;
|
|
2305
2292
|
}
|
|
2306
|
-
|
|
2307
2293
|
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
2308
2294
|
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
2309
2295
|
if (it) return (it = it.call(o)).next.bind(it);
|
|
2310
|
-
|
|
2311
2296
|
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
2312
2297
|
if (it) o = it;
|
|
2313
2298
|
var i = 0;
|
|
@@ -2321,7 +2306,6 @@ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
|
2321
2306
|
};
|
|
2322
2307
|
};
|
|
2323
2308
|
}
|
|
2324
|
-
|
|
2325
2309
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2326
2310
|
}
|
|
2327
2311
|
|
|
@@ -2336,17 +2320,16 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
2336
2320
|
* This source code is licensed under the MIT license found in the
|
|
2337
2321
|
* LICENSE file in the root directory of this source tree.
|
|
2338
2322
|
*/
|
|
2323
|
+
|
|
2339
2324
|
var runtime = function (exports) {
|
|
2340
2325
|
|
|
2341
2326
|
var Op = Object.prototype;
|
|
2342
2327
|
var hasOwn = Op.hasOwnProperty;
|
|
2343
2328
|
var undefined$1; // More compressible than void 0.
|
|
2344
|
-
|
|
2345
2329
|
var $Symbol = typeof Symbol === "function" ? Symbol : {};
|
|
2346
2330
|
var iteratorSymbol = $Symbol.iterator || "@@iterator";
|
|
2347
2331
|
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
|
2348
2332
|
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
2349
|
-
|
|
2350
2333
|
function define(obj, key, value) {
|
|
2351
2334
|
Object.defineProperty(obj, key, {
|
|
2352
2335
|
value: value,
|
|
@@ -2356,7 +2339,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
2356
2339
|
});
|
|
2357
2340
|
return obj[key];
|
|
2358
2341
|
}
|
|
2359
|
-
|
|
2360
2342
|
try {
|
|
2361
2343
|
// IE 8 has a broken Object.defineProperty that only works on DOM objects.
|
|
2362
2344
|
define({}, "");
|
|
@@ -2365,19 +2347,20 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
2365
2347
|
return obj[key] = value;
|
|
2366
2348
|
};
|
|
2367
2349
|
}
|
|
2368
|
-
|
|
2369
2350
|
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
2370
2351
|
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
|
|
2371
2352
|
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
|
|
2372
2353
|
var generator = Object.create(protoGenerator.prototype);
|
|
2373
|
-
var context = new Context(tryLocsList || []);
|
|
2374
|
-
// .throw, and .return methods.
|
|
2354
|
+
var context = new Context(tryLocsList || []);
|
|
2375
2355
|
|
|
2356
|
+
// The ._invoke method unifies the implementations of the .next,
|
|
2357
|
+
// .throw, and .return methods.
|
|
2376
2358
|
generator._invoke = makeInvokeMethod(innerFn, self, context);
|
|
2377
2359
|
return generator;
|
|
2378
2360
|
}
|
|
2361
|
+
exports.wrap = wrap;
|
|
2379
2362
|
|
|
2380
|
-
|
|
2363
|
+
// Try/catch helper to minimize deoptimizations. Returns a completion
|
|
2381
2364
|
// record like context.tryEntries[i].completion. This interface could
|
|
2382
2365
|
// have been (and was previously) designed to take a closure to be
|
|
2383
2366
|
// invoked without arguments, but in all the cases we care about we
|
|
@@ -2387,7 +2370,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
2387
2370
|
// in every case, so we don't have to touch the arguments object. The
|
|
2388
2371
|
// only additional allocation required is the completion record, which
|
|
2389
2372
|
// has a stable shape and so hopefully should be cheap to allocate.
|
|
2390
|
-
|
|
2391
2373
|
function tryCatch(fn, obj, arg) {
|
|
2392
2374
|
try {
|
|
2393
2375
|
return {
|
|
@@ -2401,46 +2383,44 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
2401
2383
|
};
|
|
2402
2384
|
}
|
|
2403
2385
|
}
|
|
2404
|
-
|
|
2405
2386
|
var GenStateSuspendedStart = "suspendedStart";
|
|
2406
2387
|
var GenStateSuspendedYield = "suspendedYield";
|
|
2407
2388
|
var GenStateExecuting = "executing";
|
|
2408
|
-
var GenStateCompleted = "completed";
|
|
2389
|
+
var GenStateCompleted = "completed";
|
|
2390
|
+
|
|
2391
|
+
// Returning this object from the innerFn has the same effect as
|
|
2409
2392
|
// breaking out of the dispatch switch statement.
|
|
2393
|
+
var ContinueSentinel = {};
|
|
2410
2394
|
|
|
2411
|
-
|
|
2395
|
+
// Dummy constructor functions that we use as the .constructor and
|
|
2412
2396
|
// .constructor.prototype properties for functions that return Generator
|
|
2413
2397
|
// objects. For full spec compliance, you may wish to configure your
|
|
2414
2398
|
// minifier not to mangle the names of these two functions.
|
|
2415
|
-
|
|
2416
2399
|
function Generator() {}
|
|
2417
|
-
|
|
2418
2400
|
function GeneratorFunction() {}
|
|
2401
|
+
function GeneratorFunctionPrototype() {}
|
|
2419
2402
|
|
|
2420
|
-
|
|
2403
|
+
// This is a polyfill for %IteratorPrototype% for environments that
|
|
2421
2404
|
// don't natively support it.
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
2405
|
var IteratorPrototype = {};
|
|
2425
2406
|
define(IteratorPrototype, iteratorSymbol, function () {
|
|
2426
2407
|
return this;
|
|
2427
2408
|
});
|
|
2428
2409
|
var getProto = Object.getPrototypeOf;
|
|
2429
2410
|
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
2430
|
-
|
|
2431
2411
|
if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
|
2432
2412
|
// This environment has a native %IteratorPrototype%; use it instead
|
|
2433
2413
|
// of the polyfill.
|
|
2434
2414
|
IteratorPrototype = NativeIteratorPrototype;
|
|
2435
2415
|
}
|
|
2436
|
-
|
|
2437
2416
|
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
2438
2417
|
GeneratorFunction.prototype = GeneratorFunctionPrototype;
|
|
2439
2418
|
define(Gp, "constructor", GeneratorFunctionPrototype);
|
|
2440
2419
|
define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
|
|
2441
|
-
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
|
|
2442
|
-
// Iterator interface in terms of a single ._invoke method.
|
|
2420
|
+
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
|
|
2443
2421
|
|
|
2422
|
+
// Helper for defining the .next, .throw, and .return methods of the
|
|
2423
|
+
// Iterator interface in terms of a single ._invoke method.
|
|
2444
2424
|
function defineIteratorMethods(prototype) {
|
|
2445
2425
|
["next", "throw", "return"].forEach(function (method) {
|
|
2446
2426
|
define(prototype, method, function (arg) {
|
|
@@ -2448,14 +2428,13 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
2448
2428
|
});
|
|
2449
2429
|
});
|
|
2450
2430
|
}
|
|
2451
|
-
|
|
2452
2431
|
exports.isGeneratorFunction = function (genFun) {
|
|
2453
2432
|
var ctor = typeof genFun === "function" && genFun.constructor;
|
|
2454
|
-
return ctor ? ctor === GeneratorFunction ||
|
|
2433
|
+
return ctor ? ctor === GeneratorFunction ||
|
|
2434
|
+
// For the native GeneratorFunction constructor, the best we can
|
|
2455
2435
|
// do is to check its .name property.
|
|
2456
2436
|
(ctor.displayName || ctor.name) === "GeneratorFunction" : false;
|
|
2457
2437
|
};
|
|
2458
|
-
|
|
2459
2438
|
exports.mark = function (genFun) {
|
|
2460
2439
|
if (Object.setPrototypeOf) {
|
|
2461
2440
|
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
|
@@ -2463,31 +2442,27 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
2463
2442
|
genFun.__proto__ = GeneratorFunctionPrototype;
|
|
2464
2443
|
define(genFun, toStringTagSymbol, "GeneratorFunction");
|
|
2465
2444
|
}
|
|
2466
|
-
|
|
2467
2445
|
genFun.prototype = Object.create(Gp);
|
|
2468
2446
|
return genFun;
|
|
2469
|
-
};
|
|
2447
|
+
};
|
|
2448
|
+
|
|
2449
|
+
// Within the body of any async function, `await x` is transformed to
|
|
2470
2450
|
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
|
|
2471
2451
|
// `hasOwn.call(value, "__await")` to determine if the yielded value is
|
|
2472
2452
|
// meant to be awaited.
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
2453
|
exports.awrap = function (arg) {
|
|
2476
2454
|
return {
|
|
2477
2455
|
__await: arg
|
|
2478
2456
|
};
|
|
2479
2457
|
};
|
|
2480
|
-
|
|
2481
2458
|
function AsyncIterator(generator, PromiseImpl) {
|
|
2482
2459
|
function invoke(method, arg, resolve, reject) {
|
|
2483
2460
|
var record = tryCatch(generator[method], generator, arg);
|
|
2484
|
-
|
|
2485
2461
|
if (record.type === "throw") {
|
|
2486
2462
|
reject(record.arg);
|
|
2487
2463
|
} else {
|
|
2488
2464
|
var result = record.arg;
|
|
2489
2465
|
var value = result.value;
|
|
2490
|
-
|
|
2491
2466
|
if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
|
|
2492
2467
|
return PromiseImpl.resolve(value.__await).then(function (value) {
|
|
2493
2468
|
invoke("next", value, resolve, reject);
|
|
@@ -2495,7 +2470,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
2495
2470
|
invoke("throw", err, resolve, reject);
|
|
2496
2471
|
});
|
|
2497
2472
|
}
|
|
2498
|
-
|
|
2499
2473
|
return PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
2500
2474
|
// When a yielded Promise is resolved, its final value becomes
|
|
2501
2475
|
// the .value of the Promise<{value,done}> result for the
|
|
@@ -2509,17 +2483,15 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
2509
2483
|
});
|
|
2510
2484
|
}
|
|
2511
2485
|
}
|
|
2512
|
-
|
|
2513
2486
|
var previousPromise;
|
|
2514
|
-
|
|
2515
2487
|
function enqueue(method, arg) {
|
|
2516
2488
|
function callInvokeWithMethodAndArg() {
|
|
2517
2489
|
return new PromiseImpl(function (resolve, reject) {
|
|
2518
2490
|
invoke(method, arg, resolve, reject);
|
|
2519
2491
|
});
|
|
2520
2492
|
}
|
|
2521
|
-
|
|
2522
|
-
|
|
2493
|
+
return previousPromise =
|
|
2494
|
+
// If enqueue has been called before, then we want to wait until
|
|
2523
2495
|
// all previous Promises have been resolved before calling invoke,
|
|
2524
2496
|
// so that results are always delivered in the correct order. If
|
|
2525
2497
|
// enqueue has not been called before, then it is important to
|
|
@@ -2531,24 +2503,25 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
2531
2503
|
// execute code before the first await. Since we implement simple
|
|
2532
2504
|
// async functions in terms of async generators, it is especially
|
|
2533
2505
|
// important to get this right, even though it requires care.
|
|
2534
|
-
previousPromise ? previousPromise.then(callInvokeWithMethodAndArg,
|
|
2506
|
+
previousPromise ? previousPromise.then(callInvokeWithMethodAndArg,
|
|
2507
|
+
// Avoid propagating failures to Promises returned by later
|
|
2535
2508
|
// invocations of the iterator.
|
|
2536
2509
|
callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
2537
|
-
}
|
|
2538
|
-
// .throw, and .return (see defineIteratorMethods).
|
|
2539
|
-
|
|
2510
|
+
}
|
|
2540
2511
|
|
|
2512
|
+
// Define the unified helper method that is used to implement .next,
|
|
2513
|
+
// .throw, and .return (see defineIteratorMethods).
|
|
2541
2514
|
this._invoke = enqueue;
|
|
2542
2515
|
}
|
|
2543
|
-
|
|
2544
2516
|
defineIteratorMethods(AsyncIterator.prototype);
|
|
2545
2517
|
define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
2546
2518
|
return this;
|
|
2547
2519
|
});
|
|
2548
|
-
exports.AsyncIterator = AsyncIterator;
|
|
2520
|
+
exports.AsyncIterator = AsyncIterator;
|
|
2521
|
+
|
|
2522
|
+
// Note that simple async functions are implemented on top of
|
|
2549
2523
|
// AsyncIterator objects; they just return a Promise for the value of
|
|
2550
2524
|
// the final result produced by the iterator.
|
|
2551
|
-
|
|
2552
2525
|
exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
2553
2526
|
if (PromiseImpl === void 0) PromiseImpl = Promise;
|
|
2554
2527
|
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
@@ -2557,39 +2530,32 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
2557
2530
|
return result.done ? result.value : iter.next();
|
|
2558
2531
|
});
|
|
2559
2532
|
};
|
|
2560
|
-
|
|
2561
2533
|
function makeInvokeMethod(innerFn, self, context) {
|
|
2562
2534
|
var state = GenStateSuspendedStart;
|
|
2563
2535
|
return function invoke(method, arg) {
|
|
2564
2536
|
if (state === GenStateExecuting) {
|
|
2565
2537
|
throw new Error("Generator is already running");
|
|
2566
2538
|
}
|
|
2567
|
-
|
|
2568
2539
|
if (state === GenStateCompleted) {
|
|
2569
2540
|
if (method === "throw") {
|
|
2570
2541
|
throw arg;
|
|
2571
|
-
}
|
|
2572
|
-
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
|
2573
|
-
|
|
2542
|
+
}
|
|
2574
2543
|
|
|
2544
|
+
// Be forgiving, per 25.3.3.3.3 of the spec:
|
|
2545
|
+
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
|
2575
2546
|
return doneResult();
|
|
2576
2547
|
}
|
|
2577
|
-
|
|
2578
2548
|
context.method = method;
|
|
2579
2549
|
context.arg = arg;
|
|
2580
|
-
|
|
2581
2550
|
while (true) {
|
|
2582
2551
|
var delegate = context.delegate;
|
|
2583
|
-
|
|
2584
2552
|
if (delegate) {
|
|
2585
2553
|
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
2586
|
-
|
|
2587
2554
|
if (delegateResult) {
|
|
2588
2555
|
if (delegateResult === ContinueSentinel) continue;
|
|
2589
2556
|
return delegateResult;
|
|
2590
2557
|
}
|
|
2591
2558
|
}
|
|
2592
|
-
|
|
2593
2559
|
if (context.method === "next") {
|
|
2594
2560
|
// Setting context._sent for legacy support of Babel's
|
|
2595
2561
|
// function.sent implementation.
|
|
@@ -2599,51 +2565,44 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
2599
2565
|
state = GenStateCompleted;
|
|
2600
2566
|
throw context.arg;
|
|
2601
2567
|
}
|
|
2602
|
-
|
|
2603
2568
|
context.dispatchException(context.arg);
|
|
2604
2569
|
} else if (context.method === "return") {
|
|
2605
2570
|
context.abrupt("return", context.arg);
|
|
2606
2571
|
}
|
|
2607
|
-
|
|
2608
2572
|
state = GenStateExecuting;
|
|
2609
2573
|
var record = tryCatch(innerFn, self, context);
|
|
2610
|
-
|
|
2611
2574
|
if (record.type === "normal") {
|
|
2612
2575
|
// If an exception is thrown from innerFn, we leave state ===
|
|
2613
2576
|
// GenStateExecuting and loop back for another invocation.
|
|
2614
2577
|
state = context.done ? GenStateCompleted : GenStateSuspendedYield;
|
|
2615
|
-
|
|
2616
2578
|
if (record.arg === ContinueSentinel) {
|
|
2617
2579
|
continue;
|
|
2618
2580
|
}
|
|
2619
|
-
|
|
2620
2581
|
return {
|
|
2621
2582
|
value: record.arg,
|
|
2622
2583
|
done: context.done
|
|
2623
2584
|
};
|
|
2624
2585
|
} else if (record.type === "throw") {
|
|
2625
|
-
state = GenStateCompleted;
|
|
2586
|
+
state = GenStateCompleted;
|
|
2587
|
+
// Dispatch the exception by looping back around to the
|
|
2626
2588
|
// context.dispatchException(context.arg) call above.
|
|
2627
|
-
|
|
2628
2589
|
context.method = "throw";
|
|
2629
2590
|
context.arg = record.arg;
|
|
2630
2591
|
}
|
|
2631
2592
|
}
|
|
2632
2593
|
};
|
|
2633
|
-
}
|
|
2594
|
+
}
|
|
2595
|
+
|
|
2596
|
+
// Call delegate.iterator[context.method](context.arg) and handle the
|
|
2634
2597
|
// result, either by returning a { value, done } result from the
|
|
2635
2598
|
// delegate iterator, or by modifying context.method and context.arg,
|
|
2636
2599
|
// setting context.delegate to null, and returning the ContinueSentinel.
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
2600
|
function maybeInvokeDelegate(delegate, context) {
|
|
2640
2601
|
var method = delegate.iterator[context.method];
|
|
2641
|
-
|
|
2642
2602
|
if (method === undefined$1) {
|
|
2643
2603
|
// A .throw or .return when the delegate iterator has no .throw
|
|
2644
2604
|
// method always terminates the yield* loop.
|
|
2645
2605
|
context.delegate = null;
|
|
2646
|
-
|
|
2647
2606
|
if (context.method === "throw") {
|
|
2648
2607
|
// Note: ["return"] must be used for ES3 parsing compatibility.
|
|
2649
2608
|
if (delegate.iterator["return"]) {
|
|
@@ -2652,51 +2611,45 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
2652
2611
|
context.method = "return";
|
|
2653
2612
|
context.arg = undefined$1;
|
|
2654
2613
|
maybeInvokeDelegate(delegate, context);
|
|
2655
|
-
|
|
2656
2614
|
if (context.method === "throw") {
|
|
2657
2615
|
// If maybeInvokeDelegate(context) changed context.method from
|
|
2658
2616
|
// "return" to "throw", let that override the TypeError below.
|
|
2659
2617
|
return ContinueSentinel;
|
|
2660
2618
|
}
|
|
2661
2619
|
}
|
|
2662
|
-
|
|
2663
2620
|
context.method = "throw";
|
|
2664
2621
|
context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
2665
2622
|
}
|
|
2666
|
-
|
|
2667
2623
|
return ContinueSentinel;
|
|
2668
2624
|
}
|
|
2669
|
-
|
|
2670
2625
|
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
2671
|
-
|
|
2672
2626
|
if (record.type === "throw") {
|
|
2673
2627
|
context.method = "throw";
|
|
2674
2628
|
context.arg = record.arg;
|
|
2675
2629
|
context.delegate = null;
|
|
2676
2630
|
return ContinueSentinel;
|
|
2677
2631
|
}
|
|
2678
|
-
|
|
2679
2632
|
var info = record.arg;
|
|
2680
|
-
|
|
2681
2633
|
if (!info) {
|
|
2682
2634
|
context.method = "throw";
|
|
2683
2635
|
context.arg = new TypeError("iterator result is not an object");
|
|
2684
2636
|
context.delegate = null;
|
|
2685
2637
|
return ContinueSentinel;
|
|
2686
2638
|
}
|
|
2687
|
-
|
|
2688
2639
|
if (info.done) {
|
|
2689
2640
|
// Assign the result of the finished delegate to the temporary
|
|
2690
2641
|
// variable specified by delegate.resultName (see delegateYield).
|
|
2691
|
-
context[delegate.resultName] = info.value;
|
|
2642
|
+
context[delegate.resultName] = info.value;
|
|
2692
2643
|
|
|
2693
|
-
|
|
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
|
|
2694
2648
|
// exception, let the outer generator proceed normally. If
|
|
2695
2649
|
// context.method was "next", forget context.arg since it has been
|
|
2696
2650
|
// "consumed" by the delegate iterator. If context.method was
|
|
2697
2651
|
// "return", allow the original .return call to continue in the
|
|
2698
2652
|
// outer generator.
|
|
2699
|
-
|
|
2700
2653
|
if (context.method !== "return") {
|
|
2701
2654
|
context.method = "next";
|
|
2702
2655
|
context.arg = undefined$1;
|
|
@@ -2704,54 +2657,49 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
2704
2657
|
} else {
|
|
2705
2658
|
// Re-yield the result returned by the delegate method.
|
|
2706
2659
|
return info;
|
|
2707
|
-
}
|
|
2708
|
-
// the outer generator.
|
|
2709
|
-
|
|
2660
|
+
}
|
|
2710
2661
|
|
|
2662
|
+
// The delegate iterator is finished, so forget it and continue with
|
|
2663
|
+
// the outer generator.
|
|
2711
2664
|
context.delegate = null;
|
|
2712
2665
|
return ContinueSentinel;
|
|
2713
|
-
}
|
|
2714
|
-
// unified ._invoke helper method.
|
|
2715
|
-
|
|
2666
|
+
}
|
|
2716
2667
|
|
|
2668
|
+
// Define Generator.prototype.{next,throw,return} in terms of the
|
|
2669
|
+
// unified ._invoke helper method.
|
|
2717
2670
|
defineIteratorMethods(Gp);
|
|
2718
|
-
define(Gp, toStringTagSymbol, "Generator");
|
|
2671
|
+
define(Gp, toStringTagSymbol, "Generator");
|
|
2672
|
+
|
|
2673
|
+
// A Generator should always return itself as the iterator object when the
|
|
2719
2674
|
// @@iterator function is called on it. Some browsers' implementations of the
|
|
2720
2675
|
// iterator prototype chain incorrectly implement this, causing the Generator
|
|
2721
2676
|
// object to not be returned from this call. This ensures that doesn't happen.
|
|
2722
2677
|
// See https://github.com/facebook/regenerator/issues/274 for more details.
|
|
2723
|
-
|
|
2724
2678
|
define(Gp, iteratorSymbol, function () {
|
|
2725
2679
|
return this;
|
|
2726
2680
|
});
|
|
2727
2681
|
define(Gp, "toString", function () {
|
|
2728
2682
|
return "[object Generator]";
|
|
2729
2683
|
});
|
|
2730
|
-
|
|
2731
2684
|
function pushTryEntry(locs) {
|
|
2732
2685
|
var entry = {
|
|
2733
2686
|
tryLoc: locs[0]
|
|
2734
2687
|
};
|
|
2735
|
-
|
|
2736
2688
|
if (1 in locs) {
|
|
2737
2689
|
entry.catchLoc = locs[1];
|
|
2738
2690
|
}
|
|
2739
|
-
|
|
2740
2691
|
if (2 in locs) {
|
|
2741
2692
|
entry.finallyLoc = locs[2];
|
|
2742
2693
|
entry.afterLoc = locs[3];
|
|
2743
2694
|
}
|
|
2744
|
-
|
|
2745
2695
|
this.tryEntries.push(entry);
|
|
2746
2696
|
}
|
|
2747
|
-
|
|
2748
2697
|
function resetTryEntry(entry) {
|
|
2749
2698
|
var record = entry.completion || {};
|
|
2750
2699
|
record.type = "normal";
|
|
2751
2700
|
delete record.arg;
|
|
2752
2701
|
entry.completion = record;
|
|
2753
2702
|
}
|
|
2754
|
-
|
|
2755
2703
|
function Context(tryLocsList) {
|
|
2756
2704
|
// The root entry object (effectively a try statement without a catch
|
|
2757
2705
|
// or a finally block) gives us a place to store values thrown from
|
|
@@ -2762,97 +2710,84 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
2762
2710
|
tryLocsList.forEach(pushTryEntry, this);
|
|
2763
2711
|
this.reset(true);
|
|
2764
2712
|
}
|
|
2765
|
-
|
|
2766
2713
|
exports.keys = function (object) {
|
|
2767
2714
|
var keys = [];
|
|
2768
|
-
|
|
2769
2715
|
for (var key in object) {
|
|
2770
2716
|
keys.push(key);
|
|
2771
2717
|
}
|
|
2718
|
+
keys.reverse();
|
|
2772
2719
|
|
|
2773
|
-
|
|
2720
|
+
// Rather than returning an object with a next method, we keep
|
|
2774
2721
|
// things simple and return the next function itself.
|
|
2775
|
-
|
|
2776
2722
|
return function next() {
|
|
2777
2723
|
while (keys.length) {
|
|
2778
2724
|
var key = keys.pop();
|
|
2779
|
-
|
|
2780
2725
|
if (key in object) {
|
|
2781
2726
|
next.value = key;
|
|
2782
2727
|
next.done = false;
|
|
2783
2728
|
return next;
|
|
2784
2729
|
}
|
|
2785
|
-
}
|
|
2730
|
+
}
|
|
2731
|
+
|
|
2732
|
+
// To avoid creating an additional object, we just hang the .value
|
|
2786
2733
|
// and .done properties off the next function object itself. This
|
|
2787
2734
|
// also ensures that the minifier will not anonymize the function.
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
2735
|
next.done = true;
|
|
2791
2736
|
return next;
|
|
2792
2737
|
};
|
|
2793
2738
|
};
|
|
2794
|
-
|
|
2795
2739
|
function values(iterable) {
|
|
2796
2740
|
if (iterable) {
|
|
2797
2741
|
var iteratorMethod = iterable[iteratorSymbol];
|
|
2798
|
-
|
|
2799
2742
|
if (iteratorMethod) {
|
|
2800
2743
|
return iteratorMethod.call(iterable);
|
|
2801
2744
|
}
|
|
2802
|
-
|
|
2803
2745
|
if (typeof iterable.next === "function") {
|
|
2804
2746
|
return iterable;
|
|
2805
2747
|
}
|
|
2806
|
-
|
|
2807
2748
|
if (!isNaN(iterable.length)) {
|
|
2808
2749
|
var i = -1,
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
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
|
+
}
|
|
2815
2757
|
}
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
return next;
|
|
2821
|
-
};
|
|
2822
|
-
|
|
2758
|
+
next.value = undefined$1;
|
|
2759
|
+
next.done = true;
|
|
2760
|
+
return next;
|
|
2761
|
+
};
|
|
2823
2762
|
return next.next = next;
|
|
2824
2763
|
}
|
|
2825
|
-
}
|
|
2826
|
-
|
|
2764
|
+
}
|
|
2827
2765
|
|
|
2766
|
+
// Return an iterator with no values.
|
|
2828
2767
|
return {
|
|
2829
2768
|
next: doneResult
|
|
2830
2769
|
};
|
|
2831
2770
|
}
|
|
2832
|
-
|
|
2833
2771
|
exports.values = values;
|
|
2834
|
-
|
|
2835
2772
|
function doneResult() {
|
|
2836
2773
|
return {
|
|
2837
2774
|
value: undefined$1,
|
|
2838
2775
|
done: true
|
|
2839
2776
|
};
|
|
2840
2777
|
}
|
|
2841
|
-
|
|
2842
2778
|
Context.prototype = {
|
|
2843
2779
|
constructor: Context,
|
|
2844
2780
|
reset: function reset(skipTempReset) {
|
|
2845
2781
|
this.prev = 0;
|
|
2846
|
-
this.next = 0;
|
|
2782
|
+
this.next = 0;
|
|
2783
|
+
// Resetting context._sent for legacy support of Babel's
|
|
2847
2784
|
// function.sent implementation.
|
|
2848
|
-
|
|
2849
2785
|
this.sent = this._sent = undefined$1;
|
|
2850
2786
|
this.done = false;
|
|
2851
2787
|
this.delegate = null;
|
|
2852
2788
|
this.method = "next";
|
|
2853
2789
|
this.arg = undefined$1;
|
|
2854
2790
|
this.tryEntries.forEach(resetTryEntry);
|
|
2855
|
-
|
|
2856
2791
|
if (!skipTempReset) {
|
|
2857
2792
|
for (var name in this) {
|
|
2858
2793
|
// Not sure about the optimal order of these conditions:
|
|
@@ -2866,50 +2801,40 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
2866
2801
|
this.done = true;
|
|
2867
2802
|
var rootEntry = this.tryEntries[0];
|
|
2868
2803
|
var rootRecord = rootEntry.completion;
|
|
2869
|
-
|
|
2870
2804
|
if (rootRecord.type === "throw") {
|
|
2871
2805
|
throw rootRecord.arg;
|
|
2872
2806
|
}
|
|
2873
|
-
|
|
2874
2807
|
return this.rval;
|
|
2875
2808
|
},
|
|
2876
2809
|
dispatchException: function dispatchException(exception) {
|
|
2877
2810
|
if (this.done) {
|
|
2878
2811
|
throw exception;
|
|
2879
2812
|
}
|
|
2880
|
-
|
|
2881
2813
|
var context = this;
|
|
2882
|
-
|
|
2883
2814
|
function handle(loc, caught) {
|
|
2884
2815
|
record.type = "throw";
|
|
2885
2816
|
record.arg = exception;
|
|
2886
2817
|
context.next = loc;
|
|
2887
|
-
|
|
2888
2818
|
if (caught) {
|
|
2889
2819
|
// If the dispatched exception was caught by a catch block,
|
|
2890
2820
|
// then let that catch block handle the exception normally.
|
|
2891
2821
|
context.method = "next";
|
|
2892
2822
|
context.arg = undefined$1;
|
|
2893
2823
|
}
|
|
2894
|
-
|
|
2895
2824
|
return !!caught;
|
|
2896
2825
|
}
|
|
2897
|
-
|
|
2898
2826
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
2899
2827
|
var entry = this.tryEntries[i];
|
|
2900
2828
|
var record = entry.completion;
|
|
2901
|
-
|
|
2902
2829
|
if (entry.tryLoc === "root") {
|
|
2903
2830
|
// Exception thrown outside of any try block that could handle
|
|
2904
2831
|
// it, so set the completion value of the entire function to
|
|
2905
2832
|
// throw the exception.
|
|
2906
2833
|
return handle("end");
|
|
2907
2834
|
}
|
|
2908
|
-
|
|
2909
2835
|
if (entry.tryLoc <= this.prev) {
|
|
2910
2836
|
var hasCatch = hasOwn.call(entry, "catchLoc");
|
|
2911
2837
|
var hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
2912
|
-
|
|
2913
2838
|
if (hasCatch && hasFinally) {
|
|
2914
2839
|
if (this.prev < entry.catchLoc) {
|
|
2915
2840
|
return handle(entry.catchLoc, true);
|
|
@@ -2933,36 +2858,30 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
2933
2858
|
abrupt: function abrupt(type, arg) {
|
|
2934
2859
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
2935
2860
|
var entry = this.tryEntries[i];
|
|
2936
|
-
|
|
2937
2861
|
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
2938
2862
|
var finallyEntry = entry;
|
|
2939
2863
|
break;
|
|
2940
2864
|
}
|
|
2941
2865
|
}
|
|
2942
|
-
|
|
2943
2866
|
if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
|
|
2944
2867
|
// Ignore the finally entry if control is not jumping to a
|
|
2945
2868
|
// location outside the try/catch block.
|
|
2946
2869
|
finallyEntry = null;
|
|
2947
2870
|
}
|
|
2948
|
-
|
|
2949
2871
|
var record = finallyEntry ? finallyEntry.completion : {};
|
|
2950
2872
|
record.type = type;
|
|
2951
2873
|
record.arg = arg;
|
|
2952
|
-
|
|
2953
2874
|
if (finallyEntry) {
|
|
2954
2875
|
this.method = "next";
|
|
2955
2876
|
this.next = finallyEntry.finallyLoc;
|
|
2956
2877
|
return ContinueSentinel;
|
|
2957
2878
|
}
|
|
2958
|
-
|
|
2959
2879
|
return this.complete(record);
|
|
2960
2880
|
},
|
|
2961
2881
|
complete: function complete(record, afterLoc) {
|
|
2962
2882
|
if (record.type === "throw") {
|
|
2963
2883
|
throw record.arg;
|
|
2964
2884
|
}
|
|
2965
|
-
|
|
2966
2885
|
if (record.type === "break" || record.type === "continue") {
|
|
2967
2886
|
this.next = record.arg;
|
|
2968
2887
|
} else if (record.type === "return") {
|
|
@@ -2972,13 +2891,11 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
2972
2891
|
} else if (record.type === "normal" && afterLoc) {
|
|
2973
2892
|
this.next = afterLoc;
|
|
2974
2893
|
}
|
|
2975
|
-
|
|
2976
2894
|
return ContinueSentinel;
|
|
2977
2895
|
},
|
|
2978
2896
|
finish: function finish(finallyLoc) {
|
|
2979
2897
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
2980
2898
|
var entry = this.tryEntries[i];
|
|
2981
|
-
|
|
2982
2899
|
if (entry.finallyLoc === finallyLoc) {
|
|
2983
2900
|
this.complete(entry.completion, entry.afterLoc);
|
|
2984
2901
|
resetTryEntry(entry);
|
|
@@ -2989,21 +2906,18 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
2989
2906
|
"catch": function _catch(tryLoc) {
|
|
2990
2907
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
2991
2908
|
var entry = this.tryEntries[i];
|
|
2992
|
-
|
|
2993
2909
|
if (entry.tryLoc === tryLoc) {
|
|
2994
2910
|
var record = entry.completion;
|
|
2995
|
-
|
|
2996
2911
|
if (record.type === "throw") {
|
|
2997
2912
|
var thrown = record.arg;
|
|
2998
2913
|
resetTryEntry(entry);
|
|
2999
2914
|
}
|
|
3000
|
-
|
|
3001
2915
|
return thrown;
|
|
3002
2916
|
}
|
|
3003
|
-
}
|
|
3004
|
-
// argument that corresponds to a known catch block.
|
|
3005
|
-
|
|
2917
|
+
}
|
|
3006
2918
|
|
|
2919
|
+
// The context.catch method must only be called with a location
|
|
2920
|
+
// argument that corresponds to a known catch block.
|
|
3007
2921
|
throw new Error("illegal catch attempt");
|
|
3008
2922
|
},
|
|
3009
2923
|
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
@@ -3012,27 +2926,26 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
3012
2926
|
resultName: resultName,
|
|
3013
2927
|
nextLoc: nextLoc
|
|
3014
2928
|
};
|
|
3015
|
-
|
|
3016
2929
|
if (this.method === "next") {
|
|
3017
2930
|
// Deliberately forget the last sent value so that we don't
|
|
3018
2931
|
// accidentally pass it on to the delegate.
|
|
3019
2932
|
this.arg = undefined$1;
|
|
3020
2933
|
}
|
|
3021
|
-
|
|
3022
2934
|
return ContinueSentinel;
|
|
3023
2935
|
}
|
|
3024
|
-
};
|
|
2936
|
+
};
|
|
2937
|
+
|
|
2938
|
+
// Regardless of whether this script is executing as a CommonJS module
|
|
3025
2939
|
// or not, return the runtime object so that we can declare the variable
|
|
3026
2940
|
// regeneratorRuntime in the outer scope, which allows this module to be
|
|
3027
2941
|
// injected easily by `bin/regenerator --include-runtime script.js`.
|
|
3028
|
-
|
|
3029
2942
|
return exports;
|
|
3030
|
-
}(
|
|
2943
|
+
}(
|
|
2944
|
+
// If this script is executing as a CommonJS module, use module.exports
|
|
3031
2945
|
// as the regeneratorRuntime namespace. Otherwise create a new empty
|
|
3032
2946
|
// object. Either way, the resulting object will be used to initialize
|
|
3033
2947
|
// the regeneratorRuntime variable at the top of this file.
|
|
3034
2948
|
module.exports );
|
|
3035
|
-
|
|
3036
2949
|
try {
|
|
3037
2950
|
regeneratorRuntime = runtime;
|
|
3038
2951
|
} catch (accidentalStrictMode) {
|
|
@@ -3057,7 +2970,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
3057
2970
|
var fetcher = /*#__PURE__*/function () {
|
|
3058
2971
|
var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
3059
2972
|
var res, _yield$res$json, data;
|
|
3060
|
-
|
|
3061
2973
|
return runtime_1.wrap(function _callee$(_context) {
|
|
3062
2974
|
while (1) {
|
|
3063
2975
|
switch (_context.prev = _context.next) {
|
|
@@ -3065,26 +2977,20 @@ var fetcher = /*#__PURE__*/function () {
|
|
|
3065
2977
|
console.log('FETCHER');
|
|
3066
2978
|
_context.next = 3;
|
|
3067
2979
|
return fetch('./data.json');
|
|
3068
|
-
|
|
3069
2980
|
case 3:
|
|
3070
2981
|
res = _context.sent;
|
|
3071
|
-
|
|
3072
2982
|
if (!res.ok) {
|
|
3073
2983
|
_context.next = 10;
|
|
3074
2984
|
break;
|
|
3075
2985
|
}
|
|
3076
|
-
|
|
3077
2986
|
_context.next = 7;
|
|
3078
2987
|
return res.json();
|
|
3079
|
-
|
|
3080
2988
|
case 7:
|
|
3081
2989
|
_yield$res$json = _context.sent;
|
|
3082
2990
|
data = _yield$res$json.data;
|
|
3083
2991
|
return _context.abrupt("return", data);
|
|
3084
|
-
|
|
3085
2992
|
case 10:
|
|
3086
2993
|
throw res;
|
|
3087
|
-
|
|
3088
2994
|
case 11:
|
|
3089
2995
|
case "end":
|
|
3090
2996
|
return _context.stop();
|
|
@@ -3092,7 +2998,6 @@ var fetcher = /*#__PURE__*/function () {
|
|
|
3092
2998
|
}
|
|
3093
2999
|
}, _callee);
|
|
3094
3000
|
}));
|
|
3095
|
-
|
|
3096
3001
|
return function fetcher() {
|
|
3097
3002
|
return _ref.apply(this, arguments);
|
|
3098
3003
|
};
|
|
@@ -3124,11 +3029,9 @@ var createCart = function createCart() {
|
|
|
3124
3029
|
};
|
|
3125
3030
|
var getCart = function getCart(cartId) {
|
|
3126
3031
|
var _cartId;
|
|
3127
|
-
|
|
3128
3032
|
cartId = (_cartId = cartId) != null ? _cartId : Cookies.get(LOCAL_CART_ID);
|
|
3129
3033
|
var cartStr = Cookies.get(LOCAL_CART_OBJ);
|
|
3130
3034
|
var cart = cartStr ? JSON.parse(cartStr) : undefined;
|
|
3131
|
-
|
|
3132
3035
|
if (!cart || cart.id !== cartId) {
|
|
3133
3036
|
return createCart();
|
|
3134
3037
|
} else {
|
|
@@ -3156,7 +3059,6 @@ var handler = {
|
|
|
3156
3059
|
case 0:
|
|
3157
3060
|
input = _ref.input, fetch = _ref.fetch;
|
|
3158
3061
|
return _context.abrupt("return", getCart(input.cartId));
|
|
3159
|
-
|
|
3160
3062
|
case 2:
|
|
3161
3063
|
case "end":
|
|
3162
3064
|
return _context.stop();
|
|
@@ -3178,7 +3080,6 @@ var handler = {
|
|
|
3178
3080
|
isEmpty: {
|
|
3179
3081
|
get: function get() {
|
|
3180
3082
|
var _response$data$lineIt, _response$data;
|
|
3181
|
-
|
|
3182
3083
|
return ((_response$data$lineIt = (_response$data = response.data) == null ? void 0 : _response$data.lineItems.length) != null ? _response$data$lineIt : 0) <= 0;
|
|
3183
3084
|
},
|
|
3184
3085
|
enumerable: true
|
|
@@ -3196,44 +3097,36 @@ var handler$1 = {
|
|
|
3196
3097
|
fetcher: function fetcher(_ref) {
|
|
3197
3098
|
return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
3198
3099
|
var _item$quantity;
|
|
3199
|
-
|
|
3200
3100
|
var item, fetch, lineItem, cart, _iterator, _step, product, variant, _item$quantity2, currentLineItem;
|
|
3201
|
-
|
|
3202
3101
|
return runtime_1.wrap(function _callee$(_context) {
|
|
3203
3102
|
while (1) {
|
|
3204
3103
|
switch (_context.prev = _context.next) {
|
|
3205
3104
|
case 0:
|
|
3206
3105
|
item = _ref.input, fetch = _ref.fetch;
|
|
3207
|
-
|
|
3208
3106
|
if (!(item.quantity && (!Number.isInteger(item.quantity) || item.quantity < 1))) {
|
|
3209
3107
|
_context.next = 3;
|
|
3210
3108
|
break;
|
|
3211
3109
|
}
|
|
3212
|
-
|
|
3213
3110
|
throw new commerce.CommerceError({
|
|
3214
3111
|
message: "The item quantity has to be a valid integer greater than 0"
|
|
3215
3112
|
});
|
|
3216
|
-
|
|
3217
3113
|
case 3:
|
|
3218
3114
|
lineItem = {
|
|
3219
3115
|
variantId: item.variantId,
|
|
3220
3116
|
quantity: (_item$quantity = item.quantity) != null ? _item$quantity : 1
|
|
3221
3117
|
};
|
|
3222
3118
|
cart = getCart();
|
|
3223
|
-
|
|
3224
3119
|
for (_iterator = _createForOfIteratorHelperLoose(data.products); !(_step = _iterator()).done;) {
|
|
3225
3120
|
product = _step.value;
|
|
3226
3121
|
variant = product.variants.find(function (variant) {
|
|
3227
3122
|
return variant.id === item.variantId;
|
|
3228
3123
|
});
|
|
3229
|
-
|
|
3230
3124
|
if (variant) {
|
|
3231
3125
|
cart.totalPrice += variant.price * ((_item$quantity2 = item.quantity) != null ? _item$quantity2 : 1);
|
|
3232
3126
|
cart.currency.code = product.price.currencyCode;
|
|
3233
3127
|
currentLineItem = cart.lineItems.find(function (item) {
|
|
3234
3128
|
return item.variantId === lineItem.variantId;
|
|
3235
3129
|
});
|
|
3236
|
-
|
|
3237
3130
|
if (!currentLineItem) {
|
|
3238
3131
|
cart.lineItems.push(lineItem);
|
|
3239
3132
|
} else {
|
|
@@ -3241,9 +3134,7 @@ var handler$1 = {
|
|
|
3241
3134
|
}
|
|
3242
3135
|
}
|
|
3243
3136
|
}
|
|
3244
|
-
|
|
3245
3137
|
return _context.abrupt("return", cartUpdate(cart));
|
|
3246
|
-
|
|
3247
3138
|
case 7:
|
|
3248
3139
|
case "end":
|
|
3249
3140
|
return _context.stop();
|
|
@@ -3256,8 +3147,7 @@ var handler$1 = {
|
|
|
3256
3147
|
var fetch = _ref2.fetch;
|
|
3257
3148
|
return function () {
|
|
3258
3149
|
var _useCart = commerce.useCart(),
|
|
3259
|
-
|
|
3260
|
-
|
|
3150
|
+
mutate = _useCart.mutate;
|
|
3261
3151
|
return React.useCallback( /*#__PURE__*/function () {
|
|
3262
3152
|
var _addItem = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(input) {
|
|
3263
3153
|
var data;
|
|
@@ -3269,15 +3159,12 @@ var handler$1 = {
|
|
|
3269
3159
|
return fetch({
|
|
3270
3160
|
input: input
|
|
3271
3161
|
});
|
|
3272
|
-
|
|
3273
3162
|
case 2:
|
|
3274
3163
|
data = _context2.sent;
|
|
3275
3164
|
_context2.next = 5;
|
|
3276
3165
|
return mutate(data, false);
|
|
3277
|
-
|
|
3278
3166
|
case 5:
|
|
3279
3167
|
return _context2.abrupt("return", data);
|
|
3280
|
-
|
|
3281
3168
|
case 6:
|
|
3282
3169
|
case "end":
|
|
3283
3170
|
return _context2.stop();
|
|
@@ -3285,11 +3172,9 @@ var handler$1 = {
|
|
|
3285
3172
|
}
|
|
3286
3173
|
}, _callee2);
|
|
3287
3174
|
}));
|
|
3288
|
-
|
|
3289
3175
|
function addItem(_x) {
|
|
3290
3176
|
return _addItem.apply(this, arguments);
|
|
3291
3177
|
}
|
|
3292
|
-
|
|
3293
3178
|
return addItem;
|
|
3294
3179
|
}(), [fetch, mutate]);
|
|
3295
3180
|
};
|
|
@@ -3306,7 +3191,6 @@ var handler$2 = {
|
|
|
3306
3191
|
while (1) {
|
|
3307
3192
|
switch (_context.prev = _context.next) {
|
|
3308
3193
|
case 0:
|
|
3309
|
-
|
|
3310
3194
|
case 1:
|
|
3311
3195
|
case "end":
|
|
3312
3196
|
return _context.stop();
|
|
@@ -3324,7 +3208,6 @@ var handler$2 = {
|
|
|
3324
3208
|
switch (_context2.prev = _context2.next) {
|
|
3325
3209
|
case 0:
|
|
3326
3210
|
return _context2.abrupt("return", {});
|
|
3327
|
-
|
|
3328
3211
|
case 1:
|
|
3329
3212
|
case "end":
|
|
3330
3213
|
return _context2.stop();
|
|
@@ -3332,11 +3215,9 @@ var handler$2 = {
|
|
|
3332
3215
|
}
|
|
3333
3216
|
}, _callee2);
|
|
3334
3217
|
}));
|
|
3335
|
-
|
|
3336
3218
|
function addItem() {
|
|
3337
3219
|
return _addItem.apply(this, arguments);
|
|
3338
3220
|
}
|
|
3339
|
-
|
|
3340
3221
|
return addItem;
|
|
3341
3222
|
}();
|
|
3342
3223
|
};
|
|
@@ -3353,7 +3234,6 @@ var handler$3 = {
|
|
|
3353
3234
|
while (1) {
|
|
3354
3235
|
switch (_context.prev = _context.next) {
|
|
3355
3236
|
case 0:
|
|
3356
|
-
|
|
3357
3237
|
case 1:
|
|
3358
3238
|
case "end":
|
|
3359
3239
|
return _context.stop();
|
|
@@ -3371,7 +3251,6 @@ var handler$3 = {
|
|
|
3371
3251
|
switch (_context2.prev = _context2.next) {
|
|
3372
3252
|
case 0:
|
|
3373
3253
|
return _context2.abrupt("return", {});
|
|
3374
|
-
|
|
3375
3254
|
case 1:
|
|
3376
3255
|
case "end":
|
|
3377
3256
|
return _context2.stop();
|
|
@@ -3379,11 +3258,9 @@ var handler$3 = {
|
|
|
3379
3258
|
}
|
|
3380
3259
|
}, _callee2);
|
|
3381
3260
|
}));
|
|
3382
|
-
|
|
3383
3261
|
function removeItem(_x) {
|
|
3384
3262
|
return _removeItem.apply(this, arguments);
|
|
3385
3263
|
}
|
|
3386
|
-
|
|
3387
3264
|
return removeItem;
|
|
3388
3265
|
}();
|
|
3389
3266
|
};
|
|
@@ -3394,16 +3271,12 @@ var sortProduct = function sortProduct(a, b, sortKey) {
|
|
|
3394
3271
|
switch (sortKey) {
|
|
3395
3272
|
case "price-asc":
|
|
3396
3273
|
return a.price.value < b.price.value ? -1 : 1;
|
|
3397
|
-
|
|
3398
3274
|
case "price-desc":
|
|
3399
3275
|
return a.price.value < b.price.value ? 1 : -1;
|
|
3400
|
-
|
|
3401
3276
|
case "trending-desc":
|
|
3402
3277
|
return a.id.localeCompare(b.id);
|
|
3403
|
-
|
|
3404
3278
|
case "latest-desc":
|
|
3405
3279
|
return a.id.localeCompare(b.id) * -1;
|
|
3406
|
-
|
|
3407
3280
|
default:
|
|
3408
3281
|
return 0;
|
|
3409
3282
|
}
|
|
@@ -3423,41 +3296,34 @@ var handler$4 = {
|
|
|
3423
3296
|
input = _ref.input, fetch = _ref.fetch;
|
|
3424
3297
|
search = input.search, categoryId = input.categoryId, brandId = input.brandId, sort = input.sort, count = input.count;
|
|
3425
3298
|
products = data.products;
|
|
3426
|
-
|
|
3427
3299
|
if (categoryId) {
|
|
3428
3300
|
category = data.categories.find(function (category) {
|
|
3429
3301
|
return category.id === categoryId;
|
|
3430
3302
|
});
|
|
3431
3303
|
products = data.products.filter(function (product) {
|
|
3432
3304
|
var _category$products;
|
|
3433
|
-
|
|
3434
3305
|
return category == null ? void 0 : (_category$products = category.products) == null ? void 0 : _category$products.includes(product.id);
|
|
3435
3306
|
});
|
|
3436
3307
|
}
|
|
3437
|
-
|
|
3438
3308
|
if (brandId) {
|
|
3439
3309
|
products = products.filter(function (product) {
|
|
3440
3310
|
return product.vendor.replace(/\s+/g, "-").toLowerCase() === ("" + brandId).toLowerCase();
|
|
3441
3311
|
});
|
|
3442
3312
|
}
|
|
3443
|
-
|
|
3444
3313
|
if (search) {
|
|
3445
3314
|
products = products.filter(function (product) {
|
|
3446
3315
|
return product.name.toLowerCase().includes(("" + search).toLowerCase()) || product.slug.toLowerCase().includes(("" + search).toLowerCase());
|
|
3447
3316
|
});
|
|
3448
3317
|
}
|
|
3449
|
-
|
|
3450
3318
|
if (sort) {
|
|
3451
3319
|
products = products.sort(function (a, b) {
|
|
3452
3320
|
return sortProduct(a, b, sort);
|
|
3453
3321
|
});
|
|
3454
3322
|
}
|
|
3455
|
-
|
|
3456
3323
|
return _context.abrupt("return", {
|
|
3457
3324
|
products: products.slice(0, count),
|
|
3458
3325
|
found: products.length > 0
|
|
3459
3326
|
});
|
|
3460
|
-
|
|
3461
3327
|
case 8:
|
|
3462
3328
|
case "end":
|
|
3463
3329
|
return _context.stop();
|
|
@@ -3472,7 +3338,6 @@ var handler$4 = {
|
|
|
3472
3338
|
if (input === void 0) {
|
|
3473
3339
|
input = {};
|
|
3474
3340
|
}
|
|
3475
|
-
|
|
3476
3341
|
return useData({
|
|
3477
3342
|
input: [["search", input.search], ["prefixSearch", input.prefixSearch], ["categoryId", input.categoryId], ["brandId", input.brandId], ["sort", input.sort], ["locale", input.locale], ["count", input.count]],
|
|
3478
3343
|
swrOptions: _extends({
|
|
@@ -3490,7 +3355,6 @@ var handler$5 = {
|
|
|
3490
3355
|
fetcher: function fetcher(_ref) {
|
|
3491
3356
|
return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
3492
3357
|
var _data$products$find;
|
|
3493
|
-
|
|
3494
3358
|
var input, fetch, id;
|
|
3495
3359
|
return runtime_1.wrap(function _callee$(_context) {
|
|
3496
3360
|
while (1) {
|
|
@@ -3501,7 +3365,6 @@ var handler$5 = {
|
|
|
3501
3365
|
return _context.abrupt("return", (_data$products$find = data.products.find(function (product) {
|
|
3502
3366
|
return [product.id, product.slug].includes(id);
|
|
3503
3367
|
})) != null ? _data$products$find : null);
|
|
3504
|
-
|
|
3505
3368
|
case 3:
|
|
3506
3369
|
case "end":
|
|
3507
3370
|
return _context.stop();
|
|
@@ -3516,7 +3379,6 @@ var handler$5 = {
|
|
|
3516
3379
|
if (input === void 0) {
|
|
3517
3380
|
input = {};
|
|
3518
3381
|
}
|
|
3519
|
-
|
|
3520
3382
|
return useData({
|
|
3521
3383
|
input: [["id", input.id]],
|
|
3522
3384
|
swrOptions: _extends({
|
|
@@ -3540,20 +3402,16 @@ var handler$6 = {
|
|
|
3540
3402
|
case 0:
|
|
3541
3403
|
input = _ref.input, fetch = _ref.fetch;
|
|
3542
3404
|
categoryId = input.categoryId;
|
|
3543
|
-
|
|
3544
3405
|
if (categoryId) {
|
|
3545
3406
|
_context.next = 4;
|
|
3546
3407
|
break;
|
|
3547
3408
|
}
|
|
3548
|
-
|
|
3549
3409
|
return _context.abrupt("return", data.categories);
|
|
3550
|
-
|
|
3551
3410
|
case 4:
|
|
3552
3411
|
category = data.categories.find(function (category) {
|
|
3553
3412
|
return category.id === categoryId;
|
|
3554
3413
|
});
|
|
3555
3414
|
return _context.abrupt("return", category ? [category] : []);
|
|
3556
|
-
|
|
3557
3415
|
case 6:
|
|
3558
3416
|
case "end":
|
|
3559
3417
|
return _context.stop();
|
|
@@ -3576,7 +3434,6 @@ var handler$6 = {
|
|
|
3576
3434
|
isEmpty: {
|
|
3577
3435
|
get: function get() {
|
|
3578
3436
|
var _response$data$length, _response$data;
|
|
3579
|
-
|
|
3580
3437
|
return ((_response$data$length = (_response$data = response.data) == null ? void 0 : _response$data.length) != null ? _response$data$length : 0) <= 0;
|
|
3581
3438
|
},
|
|
3582
3439
|
enumerable: true
|
|
@@ -3609,7 +3466,6 @@ var handler$7 = {
|
|
|
3609
3466
|
path: "brands/" + id
|
|
3610
3467
|
};
|
|
3611
3468
|
}));
|
|
3612
|
-
|
|
3613
3469
|
case 3:
|
|
3614
3470
|
case "end":
|
|
3615
3471
|
return _context.stop();
|
|
@@ -3631,7 +3487,6 @@ var handler$7 = {
|
|
|
3631
3487
|
isEmpty: {
|
|
3632
3488
|
get: function get() {
|
|
3633
3489
|
var _response$data$length, _response$data;
|
|
3634
|
-
|
|
3635
3490
|
return ((_response$data$length = (_response$data = response.data) == null ? void 0 : _response$data.length) != null ? _response$data$length : 0) <= 0;
|
|
3636
3491
|
},
|
|
3637
3492
|
enumerable: true
|
|
@@ -3682,16 +3537,13 @@ var commerceProviderMeta = {
|
|
|
3682
3537
|
importPath: "@plasmicpkgs/commerce-local",
|
|
3683
3538
|
importName: "CommerceProviderComponent"
|
|
3684
3539
|
};
|
|
3685
|
-
|
|
3686
3540
|
function CommerceProviderComponent(props) {
|
|
3687
3541
|
return React__default.createElement(CommerceProvider, null, props.children);
|
|
3688
3542
|
}
|
|
3689
|
-
|
|
3690
3543
|
function registerCommerceProvider(loader, customCommerceProviderMeta) {
|
|
3691
3544
|
var doRegisterComponent = function doRegisterComponent() {
|
|
3692
3545
|
return loader ? loader.registerGlobalContext.apply(loader, arguments) : registerGlobalContext.apply(void 0, arguments);
|
|
3693
3546
|
};
|
|
3694
|
-
|
|
3695
3547
|
doRegisterComponent(CommerceProviderComponent, customCommerceProviderMeta != null ? customCommerceProviderMeta : commerceProviderMeta);
|
|
3696
3548
|
}
|
|
3697
3549
|
|