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