@plasmicpkgs/commerce-saleor 0.0.49 → 0.0.51

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.
@@ -19,64 +19,52 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
19
19
  reject(error);
20
20
  return;
21
21
  }
22
-
23
22
  if (info.done) {
24
23
  resolve(value);
25
24
  } else {
26
25
  Promise.resolve(value).then(_next, _throw);
27
26
  }
28
27
  }
29
-
30
28
  function _asyncToGenerator(fn) {
31
29
  return function () {
32
30
  var self = this,
33
- args = arguments;
31
+ args = arguments;
34
32
  return new Promise(function (resolve, reject) {
35
33
  var gen = fn.apply(self, args);
36
-
37
34
  function _next(value) {
38
35
  asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
39
36
  }
40
-
41
37
  function _throw(err) {
42
38
  asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
43
39
  }
44
-
45
40
  _next(undefined);
46
41
  });
47
42
  };
48
43
  }
49
-
50
44
  function _extends() {
51
- _extends = Object.assign || function (target) {
45
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
52
46
  for (var i = 1; i < arguments.length; i++) {
53
47
  var source = arguments[i];
54
-
55
48
  for (var key in source) {
56
49
  if (Object.prototype.hasOwnProperty.call(source, key)) {
57
50
  target[key] = source[key];
58
51
  }
59
52
  }
60
53
  }
61
-
62
54
  return target;
63
55
  };
64
-
65
56
  return _extends.apply(this, arguments);
66
57
  }
67
-
68
58
  function _objectWithoutPropertiesLoose(source, excluded) {
69
59
  if (source == null) return {};
70
60
  var target = {};
71
61
  var sourceKeys = Object.keys(source);
72
62
  var key, i;
73
-
74
63
  for (i = 0; i < sourceKeys.length; i++) {
75
64
  key = sourceKeys[i];
76
65
  if (excluded.indexOf(key) >= 0) continue;
77
66
  target[key] = source[key];
78
67
  }
79
-
80
68
  return target;
81
69
  }
82
70
 
@@ -91,17 +79,16 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
91
79
  * This source code is licensed under the MIT license found in the
92
80
  * LICENSE file in the root directory of this source tree.
93
81
  */
82
+
94
83
  var runtime = function (exports) {
95
84
 
96
85
  var Op = Object.prototype;
97
86
  var hasOwn = Op.hasOwnProperty;
98
87
  var undefined$1; // More compressible than void 0.
99
-
100
88
  var $Symbol = typeof Symbol === "function" ? Symbol : {};
101
89
  var iteratorSymbol = $Symbol.iterator || "@@iterator";
102
90
  var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
103
91
  var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
104
-
105
92
  function define(obj, key, value) {
106
93
  Object.defineProperty(obj, key, {
107
94
  value: value,
@@ -111,7 +98,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
111
98
  });
112
99
  return obj[key];
113
100
  }
114
-
115
101
  try {
116
102
  // IE 8 has a broken Object.defineProperty that only works on DOM objects.
117
103
  define({}, "");
@@ -120,19 +106,20 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
120
106
  return obj[key] = value;
121
107
  };
122
108
  }
123
-
124
109
  function wrap(innerFn, outerFn, self, tryLocsList) {
125
110
  // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
126
111
  var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
127
112
  var generator = Object.create(protoGenerator.prototype);
128
- var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next,
129
- // .throw, and .return methods.
113
+ var context = new Context(tryLocsList || []);
130
114
 
115
+ // The ._invoke method unifies the implementations of the .next,
116
+ // .throw, and .return methods.
131
117
  generator._invoke = makeInvokeMethod(innerFn, self, context);
132
118
  return generator;
133
119
  }
120
+ exports.wrap = wrap;
134
121
 
135
- exports.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion
122
+ // Try/catch helper to minimize deoptimizations. Returns a completion
136
123
  // record like context.tryEntries[i].completion. This interface could
137
124
  // have been (and was previously) designed to take a closure to be
138
125
  // invoked without arguments, but in all the cases we care about we
@@ -142,7 +129,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
142
129
  // in every case, so we don't have to touch the arguments object. The
143
130
  // only additional allocation required is the completion record, which
144
131
  // has a stable shape and so hopefully should be cheap to allocate.
145
-
146
132
  function tryCatch(fn, obj, arg) {
147
133
  try {
148
134
  return {
@@ -156,46 +142,44 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
156
142
  };
157
143
  }
158
144
  }
159
-
160
145
  var GenStateSuspendedStart = "suspendedStart";
161
146
  var GenStateSuspendedYield = "suspendedYield";
162
147
  var GenStateExecuting = "executing";
163
- var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as
148
+ var GenStateCompleted = "completed";
149
+
150
+ // Returning this object from the innerFn has the same effect as
164
151
  // breaking out of the dispatch switch statement.
152
+ var ContinueSentinel = {};
165
153
 
166
- var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and
154
+ // Dummy constructor functions that we use as the .constructor and
167
155
  // .constructor.prototype properties for functions that return Generator
168
156
  // objects. For full spec compliance, you may wish to configure your
169
157
  // minifier not to mangle the names of these two functions.
170
-
171
158
  function Generator() {}
172
-
173
159
  function GeneratorFunction() {}
160
+ function GeneratorFunctionPrototype() {}
174
161
 
175
- function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that
162
+ // This is a polyfill for %IteratorPrototype% for environments that
176
163
  // don't natively support it.
177
-
178
-
179
164
  var IteratorPrototype = {};
180
165
  define(IteratorPrototype, iteratorSymbol, function () {
181
166
  return this;
182
167
  });
183
168
  var getProto = Object.getPrototypeOf;
184
169
  var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
185
-
186
170
  if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
187
171
  // This environment has a native %IteratorPrototype%; use it instead
188
172
  // of the polyfill.
189
173
  IteratorPrototype = NativeIteratorPrototype;
190
174
  }
191
-
192
175
  var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
193
176
  GeneratorFunction.prototype = GeneratorFunctionPrototype;
194
177
  define(Gp, "constructor", GeneratorFunctionPrototype);
195
178
  define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
196
- GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"); // Helper for defining the .next, .throw, and .return methods of the
197
- // Iterator interface in terms of a single ._invoke method.
179
+ GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
198
180
 
181
+ // Helper for defining the .next, .throw, and .return methods of the
182
+ // Iterator interface in terms of a single ._invoke method.
199
183
  function defineIteratorMethods(prototype) {
200
184
  ["next", "throw", "return"].forEach(function (method) {
201
185
  define(prototype, method, function (arg) {
@@ -203,14 +187,13 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
203
187
  });
204
188
  });
205
189
  }
206
-
207
190
  exports.isGeneratorFunction = function (genFun) {
208
191
  var ctor = typeof genFun === "function" && genFun.constructor;
209
- return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can
192
+ return ctor ? ctor === GeneratorFunction ||
193
+ // For the native GeneratorFunction constructor, the best we can
210
194
  // do is to check its .name property.
211
195
  (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
212
196
  };
213
-
214
197
  exports.mark = function (genFun) {
215
198
  if (Object.setPrototypeOf) {
216
199
  Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
@@ -218,31 +201,27 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
218
201
  genFun.__proto__ = GeneratorFunctionPrototype;
219
202
  define(genFun, toStringTagSymbol, "GeneratorFunction");
220
203
  }
221
-
222
204
  genFun.prototype = Object.create(Gp);
223
205
  return genFun;
224
- }; // Within the body of any async function, `await x` is transformed to
206
+ };
207
+
208
+ // Within the body of any async function, `await x` is transformed to
225
209
  // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
226
210
  // `hasOwn.call(value, "__await")` to determine if the yielded value is
227
211
  // meant to be awaited.
228
-
229
-
230
212
  exports.awrap = function (arg) {
231
213
  return {
232
214
  __await: arg
233
215
  };
234
216
  };
235
-
236
217
  function AsyncIterator(generator, PromiseImpl) {
237
218
  function invoke(method, arg, resolve, reject) {
238
219
  var record = tryCatch(generator[method], generator, arg);
239
-
240
220
  if (record.type === "throw") {
241
221
  reject(record.arg);
242
222
  } else {
243
223
  var result = record.arg;
244
224
  var value = result.value;
245
-
246
225
  if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
247
226
  return PromiseImpl.resolve(value.__await).then(function (value) {
248
227
  invoke("next", value, resolve, reject);
@@ -250,7 +229,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
250
229
  invoke("throw", err, resolve, reject);
251
230
  });
252
231
  }
253
-
254
232
  return PromiseImpl.resolve(value).then(function (unwrapped) {
255
233
  // When a yielded Promise is resolved, its final value becomes
256
234
  // the .value of the Promise<{value,done}> result for the
@@ -264,17 +242,15 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
264
242
  });
265
243
  }
266
244
  }
267
-
268
245
  var previousPromise;
269
-
270
246
  function enqueue(method, arg) {
271
247
  function callInvokeWithMethodAndArg() {
272
248
  return new PromiseImpl(function (resolve, reject) {
273
249
  invoke(method, arg, resolve, reject);
274
250
  });
275
251
  }
276
-
277
- return previousPromise = // If enqueue has been called before, then we want to wait until
252
+ return previousPromise =
253
+ // If enqueue has been called before, then we want to wait until
278
254
  // all previous Promises have been resolved before calling invoke,
279
255
  // so that results are always delivered in the correct order. If
280
256
  // enqueue has not been called before, then it is important to
@@ -286,24 +262,25 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
286
262
  // execute code before the first await. Since we implement simple
287
263
  // async functions in terms of async generators, it is especially
288
264
  // important to get this right, even though it requires care.
289
- previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later
265
+ previousPromise ? previousPromise.then(callInvokeWithMethodAndArg,
266
+ // Avoid propagating failures to Promises returned by later
290
267
  // invocations of the iterator.
291
268
  callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
292
- } // Define the unified helper method that is used to implement .next,
293
- // .throw, and .return (see defineIteratorMethods).
294
-
269
+ }
295
270
 
271
+ // Define the unified helper method that is used to implement .next,
272
+ // .throw, and .return (see defineIteratorMethods).
296
273
  this._invoke = enqueue;
297
274
  }
298
-
299
275
  defineIteratorMethods(AsyncIterator.prototype);
300
276
  define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
301
277
  return this;
302
278
  });
303
- exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of
279
+ exports.AsyncIterator = AsyncIterator;
280
+
281
+ // Note that simple async functions are implemented on top of
304
282
  // AsyncIterator objects; they just return a Promise for the value of
305
283
  // the final result produced by the iterator.
306
-
307
284
  exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
308
285
  if (PromiseImpl === void 0) PromiseImpl = Promise;
309
286
  var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
@@ -312,39 +289,32 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
312
289
  return result.done ? result.value : iter.next();
313
290
  });
314
291
  };
315
-
316
292
  function makeInvokeMethod(innerFn, self, context) {
317
293
  var state = GenStateSuspendedStart;
318
294
  return function invoke(method, arg) {
319
295
  if (state === GenStateExecuting) {
320
296
  throw new Error("Generator is already running");
321
297
  }
322
-
323
298
  if (state === GenStateCompleted) {
324
299
  if (method === "throw") {
325
300
  throw arg;
326
- } // Be forgiving, per 25.3.3.3.3 of the spec:
327
- // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
328
-
301
+ }
329
302
 
303
+ // Be forgiving, per 25.3.3.3.3 of the spec:
304
+ // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
330
305
  return doneResult();
331
306
  }
332
-
333
307
  context.method = method;
334
308
  context.arg = arg;
335
-
336
309
  while (true) {
337
310
  var delegate = context.delegate;
338
-
339
311
  if (delegate) {
340
312
  var delegateResult = maybeInvokeDelegate(delegate, context);
341
-
342
313
  if (delegateResult) {
343
314
  if (delegateResult === ContinueSentinel) continue;
344
315
  return delegateResult;
345
316
  }
346
317
  }
347
-
348
318
  if (context.method === "next") {
349
319
  // Setting context._sent for legacy support of Babel's
350
320
  // function.sent implementation.
@@ -354,51 +324,44 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
354
324
  state = GenStateCompleted;
355
325
  throw context.arg;
356
326
  }
357
-
358
327
  context.dispatchException(context.arg);
359
328
  } else if (context.method === "return") {
360
329
  context.abrupt("return", context.arg);
361
330
  }
362
-
363
331
  state = GenStateExecuting;
364
332
  var record = tryCatch(innerFn, self, context);
365
-
366
333
  if (record.type === "normal") {
367
334
  // If an exception is thrown from innerFn, we leave state ===
368
335
  // GenStateExecuting and loop back for another invocation.
369
336
  state = context.done ? GenStateCompleted : GenStateSuspendedYield;
370
-
371
337
  if (record.arg === ContinueSentinel) {
372
338
  continue;
373
339
  }
374
-
375
340
  return {
376
341
  value: record.arg,
377
342
  done: context.done
378
343
  };
379
344
  } else if (record.type === "throw") {
380
- state = GenStateCompleted; // Dispatch the exception by looping back around to the
345
+ state = GenStateCompleted;
346
+ // Dispatch the exception by looping back around to the
381
347
  // context.dispatchException(context.arg) call above.
382
-
383
348
  context.method = "throw";
384
349
  context.arg = record.arg;
385
350
  }
386
351
  }
387
352
  };
388
- } // Call delegate.iterator[context.method](context.arg) and handle the
353
+ }
354
+
355
+ // Call delegate.iterator[context.method](context.arg) and handle the
389
356
  // result, either by returning a { value, done } result from the
390
357
  // delegate iterator, or by modifying context.method and context.arg,
391
358
  // setting context.delegate to null, and returning the ContinueSentinel.
392
-
393
-
394
359
  function maybeInvokeDelegate(delegate, context) {
395
360
  var method = delegate.iterator[context.method];
396
-
397
361
  if (method === undefined$1) {
398
362
  // A .throw or .return when the delegate iterator has no .throw
399
363
  // method always terminates the yield* loop.
400
364
  context.delegate = null;
401
-
402
365
  if (context.method === "throw") {
403
366
  // Note: ["return"] must be used for ES3 parsing compatibility.
404
367
  if (delegate.iterator["return"]) {
@@ -407,51 +370,45 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
407
370
  context.method = "return";
408
371
  context.arg = undefined$1;
409
372
  maybeInvokeDelegate(delegate, context);
410
-
411
373
  if (context.method === "throw") {
412
374
  // If maybeInvokeDelegate(context) changed context.method from
413
375
  // "return" to "throw", let that override the TypeError below.
414
376
  return ContinueSentinel;
415
377
  }
416
378
  }
417
-
418
379
  context.method = "throw";
419
380
  context.arg = new TypeError("The iterator does not provide a 'throw' method");
420
381
  }
421
-
422
382
  return ContinueSentinel;
423
383
  }
424
-
425
384
  var record = tryCatch(method, delegate.iterator, context.arg);
426
-
427
385
  if (record.type === "throw") {
428
386
  context.method = "throw";
429
387
  context.arg = record.arg;
430
388
  context.delegate = null;
431
389
  return ContinueSentinel;
432
390
  }
433
-
434
391
  var info = record.arg;
435
-
436
392
  if (!info) {
437
393
  context.method = "throw";
438
394
  context.arg = new TypeError("iterator result is not an object");
439
395
  context.delegate = null;
440
396
  return ContinueSentinel;
441
397
  }
442
-
443
398
  if (info.done) {
444
399
  // Assign the result of the finished delegate to the temporary
445
400
  // variable specified by delegate.resultName (see delegateYield).
446
- context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield).
401
+ context[delegate.resultName] = info.value;
402
+
403
+ // Resume execution at the desired location (see delegateYield).
404
+ context.next = delegate.nextLoc;
447
405
 
448
- context.next = delegate.nextLoc; // If context.method was "throw" but the delegate handled the
406
+ // If context.method was "throw" but the delegate handled the
449
407
  // exception, let the outer generator proceed normally. If
450
408
  // context.method was "next", forget context.arg since it has been
451
409
  // "consumed" by the delegate iterator. If context.method was
452
410
  // "return", allow the original .return call to continue in the
453
411
  // outer generator.
454
-
455
412
  if (context.method !== "return") {
456
413
  context.method = "next";
457
414
  context.arg = undefined$1;
@@ -459,54 +416,49 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
459
416
  } else {
460
417
  // Re-yield the result returned by the delegate method.
461
418
  return info;
462
- } // The delegate iterator is finished, so forget it and continue with
463
- // the outer generator.
464
-
419
+ }
465
420
 
421
+ // The delegate iterator is finished, so forget it and continue with
422
+ // the outer generator.
466
423
  context.delegate = null;
467
424
  return ContinueSentinel;
468
- } // Define Generator.prototype.{next,throw,return} in terms of the
469
- // unified ._invoke helper method.
470
-
425
+ }
471
426
 
427
+ // Define Generator.prototype.{next,throw,return} in terms of the
428
+ // unified ._invoke helper method.
472
429
  defineIteratorMethods(Gp);
473
- define(Gp, toStringTagSymbol, "Generator"); // A Generator should always return itself as the iterator object when the
430
+ define(Gp, toStringTagSymbol, "Generator");
431
+
432
+ // A Generator should always return itself as the iterator object when the
474
433
  // @@iterator function is called on it. Some browsers' implementations of the
475
434
  // iterator prototype chain incorrectly implement this, causing the Generator
476
435
  // object to not be returned from this call. This ensures that doesn't happen.
477
436
  // See https://github.com/facebook/regenerator/issues/274 for more details.
478
-
479
437
  define(Gp, iteratorSymbol, function () {
480
438
  return this;
481
439
  });
482
440
  define(Gp, "toString", function () {
483
441
  return "[object Generator]";
484
442
  });
485
-
486
443
  function pushTryEntry(locs) {
487
444
  var entry = {
488
445
  tryLoc: locs[0]
489
446
  };
490
-
491
447
  if (1 in locs) {
492
448
  entry.catchLoc = locs[1];
493
449
  }
494
-
495
450
  if (2 in locs) {
496
451
  entry.finallyLoc = locs[2];
497
452
  entry.afterLoc = locs[3];
498
453
  }
499
-
500
454
  this.tryEntries.push(entry);
501
455
  }
502
-
503
456
  function resetTryEntry(entry) {
504
457
  var record = entry.completion || {};
505
458
  record.type = "normal";
506
459
  delete record.arg;
507
460
  entry.completion = record;
508
461
  }
509
-
510
462
  function Context(tryLocsList) {
511
463
  // The root entry object (effectively a try statement without a catch
512
464
  // or a finally block) gives us a place to store values thrown from
@@ -517,97 +469,84 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
517
469
  tryLocsList.forEach(pushTryEntry, this);
518
470
  this.reset(true);
519
471
  }
520
-
521
472
  exports.keys = function (object) {
522
473
  var keys = [];
523
-
524
474
  for (var key in object) {
525
475
  keys.push(key);
526
476
  }
477
+ keys.reverse();
527
478
 
528
- keys.reverse(); // Rather than returning an object with a next method, we keep
479
+ // Rather than returning an object with a next method, we keep
529
480
  // things simple and return the next function itself.
530
-
531
481
  return function next() {
532
482
  while (keys.length) {
533
483
  var key = keys.pop();
534
-
535
484
  if (key in object) {
536
485
  next.value = key;
537
486
  next.done = false;
538
487
  return next;
539
488
  }
540
- } // To avoid creating an additional object, we just hang the .value
489
+ }
490
+
491
+ // To avoid creating an additional object, we just hang the .value
541
492
  // and .done properties off the next function object itself. This
542
493
  // also ensures that the minifier will not anonymize the function.
543
-
544
-
545
494
  next.done = true;
546
495
  return next;
547
496
  };
548
497
  };
549
-
550
498
  function values(iterable) {
551
499
  if (iterable) {
552
500
  var iteratorMethod = iterable[iteratorSymbol];
553
-
554
501
  if (iteratorMethod) {
555
502
  return iteratorMethod.call(iterable);
556
503
  }
557
-
558
504
  if (typeof iterable.next === "function") {
559
505
  return iterable;
560
506
  }
561
-
562
507
  if (!isNaN(iterable.length)) {
563
508
  var i = -1,
564
- next = function next() {
565
- while (++i < iterable.length) {
566
- if (hasOwn.call(iterable, i)) {
567
- next.value = iterable[i];
568
- next.done = false;
569
- return next;
509
+ next = function next() {
510
+ while (++i < iterable.length) {
511
+ if (hasOwn.call(iterable, i)) {
512
+ next.value = iterable[i];
513
+ next.done = false;
514
+ return next;
515
+ }
570
516
  }
571
- }
572
-
573
- next.value = undefined$1;
574
- next.done = true;
575
- return next;
576
- };
577
-
517
+ next.value = undefined$1;
518
+ next.done = true;
519
+ return next;
520
+ };
578
521
  return next.next = next;
579
522
  }
580
- } // Return an iterator with no values.
581
-
523
+ }
582
524
 
525
+ // Return an iterator with no values.
583
526
  return {
584
527
  next: doneResult
585
528
  };
586
529
  }
587
-
588
530
  exports.values = values;
589
-
590
531
  function doneResult() {
591
532
  return {
592
533
  value: undefined$1,
593
534
  done: true
594
535
  };
595
536
  }
596
-
597
537
  Context.prototype = {
598
538
  constructor: Context,
599
539
  reset: function reset(skipTempReset) {
600
540
  this.prev = 0;
601
- this.next = 0; // Resetting context._sent for legacy support of Babel's
541
+ this.next = 0;
542
+ // Resetting context._sent for legacy support of Babel's
602
543
  // function.sent implementation.
603
-
604
544
  this.sent = this._sent = undefined$1;
605
545
  this.done = false;
606
546
  this.delegate = null;
607
547
  this.method = "next";
608
548
  this.arg = undefined$1;
609
549
  this.tryEntries.forEach(resetTryEntry);
610
-
611
550
  if (!skipTempReset) {
612
551
  for (var name in this) {
613
552
  // Not sure about the optimal order of these conditions:
@@ -621,50 +560,40 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
621
560
  this.done = true;
622
561
  var rootEntry = this.tryEntries[0];
623
562
  var rootRecord = rootEntry.completion;
624
-
625
563
  if (rootRecord.type === "throw") {
626
564
  throw rootRecord.arg;
627
565
  }
628
-
629
566
  return this.rval;
630
567
  },
631
568
  dispatchException: function dispatchException(exception) {
632
569
  if (this.done) {
633
570
  throw exception;
634
571
  }
635
-
636
572
  var context = this;
637
-
638
573
  function handle(loc, caught) {
639
574
  record.type = "throw";
640
575
  record.arg = exception;
641
576
  context.next = loc;
642
-
643
577
  if (caught) {
644
578
  // If the dispatched exception was caught by a catch block,
645
579
  // then let that catch block handle the exception normally.
646
580
  context.method = "next";
647
581
  context.arg = undefined$1;
648
582
  }
649
-
650
583
  return !!caught;
651
584
  }
652
-
653
585
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
654
586
  var entry = this.tryEntries[i];
655
587
  var record = entry.completion;
656
-
657
588
  if (entry.tryLoc === "root") {
658
589
  // Exception thrown outside of any try block that could handle
659
590
  // it, so set the completion value of the entire function to
660
591
  // throw the exception.
661
592
  return handle("end");
662
593
  }
663
-
664
594
  if (entry.tryLoc <= this.prev) {
665
595
  var hasCatch = hasOwn.call(entry, "catchLoc");
666
596
  var hasFinally = hasOwn.call(entry, "finallyLoc");
667
-
668
597
  if (hasCatch && hasFinally) {
669
598
  if (this.prev < entry.catchLoc) {
670
599
  return handle(entry.catchLoc, true);
@@ -688,36 +617,30 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
688
617
  abrupt: function abrupt(type, arg) {
689
618
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
690
619
  var entry = this.tryEntries[i];
691
-
692
620
  if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
693
621
  var finallyEntry = entry;
694
622
  break;
695
623
  }
696
624
  }
697
-
698
625
  if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
699
626
  // Ignore the finally entry if control is not jumping to a
700
627
  // location outside the try/catch block.
701
628
  finallyEntry = null;
702
629
  }
703
-
704
630
  var record = finallyEntry ? finallyEntry.completion : {};
705
631
  record.type = type;
706
632
  record.arg = arg;
707
-
708
633
  if (finallyEntry) {
709
634
  this.method = "next";
710
635
  this.next = finallyEntry.finallyLoc;
711
636
  return ContinueSentinel;
712
637
  }
713
-
714
638
  return this.complete(record);
715
639
  },
716
640
  complete: function complete(record, afterLoc) {
717
641
  if (record.type === "throw") {
718
642
  throw record.arg;
719
643
  }
720
-
721
644
  if (record.type === "break" || record.type === "continue") {
722
645
  this.next = record.arg;
723
646
  } else if (record.type === "return") {
@@ -727,13 +650,11 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
727
650
  } else if (record.type === "normal" && afterLoc) {
728
651
  this.next = afterLoc;
729
652
  }
730
-
731
653
  return ContinueSentinel;
732
654
  },
733
655
  finish: function finish(finallyLoc) {
734
656
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
735
657
  var entry = this.tryEntries[i];
736
-
737
658
  if (entry.finallyLoc === finallyLoc) {
738
659
  this.complete(entry.completion, entry.afterLoc);
739
660
  resetTryEntry(entry);
@@ -744,21 +665,18 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
744
665
  "catch": function _catch(tryLoc) {
745
666
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
746
667
  var entry = this.tryEntries[i];
747
-
748
668
  if (entry.tryLoc === tryLoc) {
749
669
  var record = entry.completion;
750
-
751
670
  if (record.type === "throw") {
752
671
  var thrown = record.arg;
753
672
  resetTryEntry(entry);
754
673
  }
755
-
756
674
  return thrown;
757
675
  }
758
- } // The context.catch method must only be called with a location
759
- // argument that corresponds to a known catch block.
760
-
676
+ }
761
677
 
678
+ // The context.catch method must only be called with a location
679
+ // argument that corresponds to a known catch block.
762
680
  throw new Error("illegal catch attempt");
763
681
  },
764
682
  delegateYield: function delegateYield(iterable, resultName, nextLoc) {
@@ -767,27 +685,26 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
767
685
  resultName: resultName,
768
686
  nextLoc: nextLoc
769
687
  };
770
-
771
688
  if (this.method === "next") {
772
689
  // Deliberately forget the last sent value so that we don't
773
690
  // accidentally pass it on to the delegate.
774
691
  this.arg = undefined$1;
775
692
  }
776
-
777
693
  return ContinueSentinel;
778
694
  }
779
- }; // Regardless of whether this script is executing as a CommonJS module
695
+ };
696
+
697
+ // Regardless of whether this script is executing as a CommonJS module
780
698
  // or not, return the runtime object so that we can declare the variable
781
699
  // regeneratorRuntime in the outer scope, which allows this module to be
782
700
  // injected easily by `bin/regenerator --include-runtime script.js`.
783
-
784
701
  return exports;
785
- }( // If this script is executing as a CommonJS module, use module.exports
702
+ }(
703
+ // If this script is executing as a CommonJS module, use module.exports
786
704
  // as the regeneratorRuntime namespace. Otherwise create a new empty
787
705
  // object. Either way, the resulting object will be used to initialize
788
706
  // the regeneratorRuntime variable at the top of this file.
789
707
  module.exports );
790
-
791
708
  try {
792
709
  regeneratorRuntime = runtime;
793
710
  } catch (accidentalStrictMode) {
@@ -814,9 +731,7 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
814
731
  Changes: None
815
732
  */
816
733
  var getSortVariables = function getSortVariables(sort, isCategory) {
817
-
818
734
  var output = {};
819
-
820
735
  switch (sort) {
821
736
  case 'price-asc':
822
737
  output = {
@@ -824,19 +739,16 @@ var getSortVariables = function getSortVariables(sort, isCategory) {
824
739
  direction: 'ASC'
825
740
  };
826
741
  break;
827
-
828
742
  case 'price-desc':
829
743
  output = {
830
744
  field: 'PRICE',
831
745
  direction: 'DESC'
832
746
  };
833
747
  break;
834
-
835
748
  case 'trending-desc':
836
749
  //default
837
750
  output = {};
838
751
  break;
839
-
840
752
  case 'latest-desc':
841
753
  output = {
842
754
  field: 'DATE',
@@ -844,13 +756,11 @@ var getSortVariables = function getSortVariables(sort, isCategory) {
844
756
  };
845
757
  break;
846
758
  }
847
-
848
759
  return output;
849
760
  };
850
761
 
851
762
  function getError(errors, status) {
852
763
  var _errors;
853
-
854
764
  errors = (_errors = errors) != null ? _errors : [{
855
765
  message: 'Failed to fetch Saleor API'
856
766
  }];
@@ -862,7 +772,6 @@ function getError(errors, status) {
862
772
  function getAsyncError(_x) {
863
773
  return _getAsyncError.apply(this, arguments);
864
774
  }
865
-
866
775
  function _getAsyncError() {
867
776
  _getAsyncError = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(res) {
868
777
  var data;
@@ -872,11 +781,9 @@ function _getAsyncError() {
872
781
  case 0:
873
782
  _context2.next = 2;
874
783
  return res.json();
875
-
876
784
  case 2:
877
785
  data = _context2.sent;
878
786
  return _context2.abrupt("return", getError(data.errors, res.status));
879
-
880
787
  case 4:
881
788
  case "end":
882
789
  return _context2.stop();
@@ -886,11 +793,9 @@ function _getAsyncError() {
886
793
  }));
887
794
  return _getAsyncError.apply(this, arguments);
888
795
  }
889
-
890
796
  var handleFetchResponse = /*#__PURE__*/function () {
891
797
  var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(res) {
892
798
  var _yield$res$json, data, errors;
893
-
894
799
  return runtime_1.wrap(function _callee$(_context) {
895
800
  while (1) {
896
801
  switch (_context.prev = _context.next) {
@@ -899,32 +804,24 @@ var handleFetchResponse = /*#__PURE__*/function () {
899
804
  _context.next = 9;
900
805
  break;
901
806
  }
902
-
903
807
  _context.next = 3;
904
808
  return res.json();
905
-
906
809
  case 3:
907
810
  _yield$res$json = _context.sent;
908
811
  data = _yield$res$json.data;
909
812
  errors = _yield$res$json.errors;
910
-
911
813
  if (!(errors && errors.length)) {
912
814
  _context.next = 8;
913
815
  break;
914
816
  }
915
-
916
817
  throw getError(errors, res.status);
917
-
918
818
  case 8:
919
819
  return _context.abrupt("return", data);
920
-
921
820
  case 9:
922
821
  _context.next = 11;
923
822
  return getAsyncError(res);
924
-
925
823
  case 11:
926
824
  throw _context.sent;
927
-
928
825
  case 12:
929
826
  case "end":
930
827
  return _context.stop();
@@ -932,7 +829,6 @@ var handleFetchResponse = /*#__PURE__*/function () {
932
829
  }
933
830
  }, _callee);
934
831
  }));
935
-
936
832
  return function handleFetchResponse(_x2) {
937
833
  return _ref.apply(this, arguments);
938
834
  };
@@ -940,17 +836,15 @@ var handleFetchResponse = /*#__PURE__*/function () {
940
836
 
941
837
  var getSearchVariables = function getSearchVariables(_ref) {
942
838
  var search = _ref.search,
943
- categoryId = _ref.categoryId,
944
- sort = _ref.sort,
945
- count = _ref.count;
946
-
839
+ categoryId = _ref.categoryId,
840
+ sort = _ref.sort,
841
+ count = _ref.count;
947
842
  var sortBy = _extends({
948
843
  field: 'NAME',
949
844
  direction: 'ASC'
950
845
  }, getSortVariables(sort), {
951
846
  channel: 'default-channel'
952
847
  });
953
-
954
848
  return {
955
849
  categoryId: categoryId,
956
850
  filter: {
@@ -965,10 +859,8 @@ var getSearchVariables = function getSearchVariables(_ref) {
965
859
  Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
966
860
  Changes: None
967
861
  */
968
-
969
862
  var getCheckoutId = function getCheckoutId(id) {
970
863
  var _Cookies$get;
971
-
972
864
  var r = ((_Cookies$get = Cookies.get(CHECKOUT_ID_COOKIE)) == null ? void 0 : _Cookies$get.split(':')) || [];
973
865
  return {
974
866
  checkoutId: r[0],
@@ -980,54 +872,41 @@ var getCheckoutId = function getCheckoutId(id) {
980
872
  Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
981
873
  Changes: None
982
874
  */
983
- var ProductConnection =
984
- /* GraphQL */
985
- "\n fragment ProductConnection on ProductCountableConnection {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n id\n name\n description\n slug\n pricing {\n priceRange {\n start {\n net {\n amount\n }\n }\n }\n }\n media {\n url\n alt\n }\n variants {\n id\n name\n attributes {\n attribute {\n name\n }\n values {\n name\n }\n }\n pricing {\n price {\n net {\n amount\n currency\n }\n }\n }\n }\n }\n }\n }\n";
875
+ var ProductConnection = /* GraphQL */"\n fragment ProductConnection on ProductCountableConnection {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n id\n name\n description\n slug\n pricing {\n priceRange {\n start {\n net {\n amount\n }\n }\n }\n }\n media {\n url\n alt\n }\n variants {\n id\n name\n attributes {\n attribute {\n name\n }\n values {\n name\n }\n }\n pricing {\n price {\n net {\n amount\n currency\n }\n }\n }\n }\n }\n }\n }\n";
986
876
 
987
877
  /*
988
878
  Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
989
879
  Changes: None
990
880
  */
991
- var CheckoutDetails =
992
- /* GraphQL */
993
- "\n fragment CheckoutDetails on Checkout {\n id\n token\n created\n totalPrice {\n currency\n gross {\n amount\n }\n }\n subtotalPrice {\n currency\n gross {\n amount\n }\n }\n\n lines {\n id\n variant {\n id\n name\n sku\n product {\n name\n slug\n }\n media {\n url\n }\n pricing {\n price {\n gross {\n amount\n }\n }\n }\n }\n quantity\n totalPrice {\n currency\n gross {\n amount\n }\n }\n }\n }\n";
881
+ var CheckoutDetails = /* GraphQL */"\n fragment CheckoutDetails on Checkout {\n id\n token\n created\n totalPrice {\n currency\n gross {\n amount\n }\n }\n subtotalPrice {\n currency\n gross {\n amount\n }\n }\n\n lines {\n id\n variant {\n id\n name\n sku\n product {\n name\n slug\n }\n media {\n url\n }\n pricing {\n price {\n gross {\n amount\n }\n }\n }\n }\n quantity\n totalPrice {\n currency\n gross {\n amount\n }\n }\n }\n }\n";
994
882
 
995
883
  /*
996
884
  Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
997
885
  Changes: None
998
886
  */
999
- var CheckoutCreate =
1000
- /* GraphQL */
1001
- "\n mutation CheckoutCreate {\n checkoutCreate(input: { email: \"customer@example.com\", lines: [], channel: \"default-channel\" }) {\n errors {\n code\n field\n message\n }\n checkout {\n ...CheckoutDetails\n }\n }\n }\n " + CheckoutDetails + "\n";
887
+ var CheckoutCreate = /* GraphQL */"\n mutation CheckoutCreate {\n checkoutCreate(input: { email: \"customer@example.com\", lines: [], channel: \"default-channel\" }) {\n errors {\n code\n field\n message\n }\n checkout {\n ...CheckoutDetails\n }\n }\n }\n " + CheckoutDetails + "\n";
1002
888
 
1003
889
  /*
1004
890
  Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
1005
891
  Changes: None
1006
892
  */
1007
- var CheckoutLineAdd =
1008
- /* GraphQL */
1009
- "\n mutation CheckoutLineAdd($checkoutId: ID!, $lineItems: [CheckoutLineInput!]!) {\n checkoutLinesAdd(checkoutId: $checkoutId, lines: $lineItems) {\n errors {\n code\n field\n message\n }\n checkout {\n ...CheckoutDetails\n }\n }\n }\n " + CheckoutDetails + "\n";
893
+ var CheckoutLineAdd = /* GraphQL */"\n mutation CheckoutLineAdd($checkoutId: ID!, $lineItems: [CheckoutLineInput!]!) {\n checkoutLinesAdd(checkoutId: $checkoutId, lines: $lineItems) {\n errors {\n code\n field\n message\n }\n checkout {\n ...CheckoutDetails\n }\n }\n }\n " + CheckoutDetails + "\n";
1010
894
 
1011
895
  /*
1012
896
  Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
1013
897
  Changes: None
1014
898
  */
1015
- var CheckoutLineUpdate =
1016
- /* GraphQL */
1017
- "\n mutation CheckoutLineUpdate($checkoutId: ID!, $lineItems: [CheckoutLineInput!]!) {\n checkoutLinesUpdate(checkoutId: $checkoutId, lines: $lineItems) {\n errors {\n code\n field\n message\n }\n checkout {\n ...CheckoutDetails\n }\n }\n }\n " + CheckoutDetails + "\n";
899
+ var CheckoutLineUpdate = /* GraphQL */"\n mutation CheckoutLineUpdate($checkoutId: ID!, $lineItems: [CheckoutLineInput!]!) {\n checkoutLinesUpdate(checkoutId: $checkoutId, lines: $lineItems) {\n errors {\n code\n field\n message\n }\n checkout {\n ...CheckoutDetails\n }\n }\n }\n " + CheckoutDetails + "\n";
1018
900
 
1019
901
  /*
1020
902
  Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
1021
903
  Changes: None
1022
904
  */
1023
- var CheckoutLineDelete =
1024
- /* GraphQL */
1025
- "\n mutation CheckoutLineDelete($checkoutId: ID!, $lineId: ID!) {\n checkoutLineDelete(checkoutId: $checkoutId, lineId: $lineId) {\n errors {\n code\n field\n message\n }\n checkout {\n ...CheckoutDetails\n }\n }\n }\n " + CheckoutDetails + "\n";
905
+ var CheckoutLineDelete = /* GraphQL */"\n mutation CheckoutLineDelete($checkoutId: ID!, $lineId: ID!) {\n checkoutLineDelete(checkoutId: $checkoutId, lineId: $lineId) {\n errors {\n code\n field\n message\n }\n checkout {\n ...CheckoutDetails\n }\n }\n }\n " + CheckoutDetails + "\n";
1026
906
 
1027
907
  var checkoutCreate = /*#__PURE__*/function () {
1028
908
  var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(fetch) {
1029
909
  var _data$checkoutCreate;
1030
-
1031
910
  var data, checkout, checkoutId, checkoutToken, value, options;
1032
911
  return runtime_1.wrap(function _callee$(_context) {
1033
912
  while (1) {
@@ -1037,14 +916,12 @@ var checkoutCreate = /*#__PURE__*/function () {
1037
916
  return fetch({
1038
917
  query: CheckoutCreate
1039
918
  });
1040
-
1041
919
  case 2:
1042
920
  data = _context.sent;
1043
921
  checkout = (_data$checkoutCreate = data.checkoutCreate) == null ? void 0 : _data$checkoutCreate.checkout;
1044
922
  checkoutId = checkout == null ? void 0 : checkout.id;
1045
923
  checkoutToken = checkout == null ? void 0 : checkout.token;
1046
924
  value = checkoutId + ":" + checkoutToken;
1047
-
1048
925
  if (checkoutId) {
1049
926
  options = {
1050
927
  expires: 60 * 60 * 24 * 30,
@@ -1053,9 +930,7 @@ var checkoutCreate = /*#__PURE__*/function () {
1053
930
  };
1054
931
  Cookies.set(CHECKOUT_ID_COOKIE, value, options);
1055
932
  }
1056
-
1057
933
  return _context.abrupt("return", checkout);
1058
-
1059
934
  case 9:
1060
935
  case "end":
1061
936
  return _context.stop();
@@ -1063,30 +938,26 @@ var checkoutCreate = /*#__PURE__*/function () {
1063
938
  }
1064
939
  }, _callee);
1065
940
  }));
1066
-
1067
941
  return function checkoutCreate(_x) {
1068
942
  return _ref.apply(this, arguments);
1069
943
  };
1070
944
  }();
1071
945
 
1072
946
  var _excluded = ["id", "name", "media", "variants", "description", "slug", "pricing"];
1073
-
1074
947
  /*
1075
948
  Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
1076
949
  Changes: None
1077
950
  */
1078
951
  // TODO: Check nextjs-commerce bug if no images are added for a product
1079
952
  var placeholderImg = '/product-img-placeholder.svg';
1080
-
1081
953
  var money = function money(_ref) {
1082
954
  var amount = _ref.amount,
1083
- currency = _ref.currency;
955
+ currency = _ref.currency;
1084
956
  return {
1085
957
  value: +amount,
1086
958
  currencyCode: currency || 'USD'
1087
959
  };
1088
960
  };
1089
-
1090
961
  var normalizeProductOptions = function normalizeProductOptions(options) {
1091
962
  return options == null ? void 0 : options.map(function (option) {
1092
963
  return option == null ? void 0 : option.attributes;
@@ -1105,7 +976,6 @@ var normalizeProductOptions = function normalizeProductOptions(options) {
1105
976
  }) : opt;
1106
977
  });
1107
978
  }
1108
-
1109
979
  return acc.concat({
1110
980
  __typename: 'MultipleChoiceOption',
1111
981
  displayName: x.attribute.name,
@@ -1118,15 +988,13 @@ var normalizeProductOptions = function normalizeProductOptions(options) {
1118
988
  });
1119
989
  }, []);
1120
990
  };
1121
-
1122
991
  var normalizeProductVariants = function normalizeProductVariants(variants) {
1123
992
  return variants == null ? void 0 : variants.map(function (variant) {
1124
993
  var _pricing$price, _money;
1125
-
1126
994
  var id = variant.id,
1127
- sku = variant.sku,
1128
- name = variant.name,
1129
- pricing = variant.pricing;
995
+ sku = variant.sku,
996
+ name = variant.name,
997
+ pricing = variant.pricing;
1130
998
  var price = (pricing == null ? void 0 : (_pricing$price = pricing.price) == null ? void 0 : _pricing$price.net) && ((_money = money(pricing.price.net)) == null ? void 0 : _money.value);
1131
999
  return {
1132
1000
  id: id,
@@ -1139,20 +1007,17 @@ var normalizeProductVariants = function normalizeProductVariants(variants) {
1139
1007
  };
1140
1008
  });
1141
1009
  };
1142
-
1143
1010
  function normalizeProduct(productNode) {
1144
1011
  var _JSON$parse, _JSON$parse$blocks$, _pricing$priceRange, _pricing$priceRange$s;
1145
-
1146
1012
  var id = productNode.id,
1147
- name = productNode.name,
1148
- _productNode$media = productNode.media,
1149
- media = _productNode$media === void 0 ? [] : _productNode$media,
1150
- variants = productNode.variants,
1151
- description = productNode.description,
1152
- slug = productNode.slug,
1153
- pricing = productNode.pricing,
1154
- rest = _objectWithoutPropertiesLoose(productNode, _excluded);
1155
-
1013
+ name = productNode.name,
1014
+ _productNode$media = productNode.media,
1015
+ media = _productNode$media === void 0 ? [] : _productNode$media,
1016
+ variants = productNode.variants,
1017
+ description = productNode.description,
1018
+ slug = productNode.slug,
1019
+ pricing = productNode.pricing,
1020
+ rest = _objectWithoutPropertiesLoose(productNode, _excluded);
1156
1021
  var product = _extends({
1157
1022
  id: id,
1158
1023
  name: name,
@@ -1171,12 +1036,10 @@ function normalizeProduct(productNode) {
1171
1036
  variants: variants && variants.length > 0 ? normalizeProductVariants(variants) : [],
1172
1037
  options: variants && variants.length > 0 ? normalizeProductOptions(variants) : []
1173
1038
  }, rest);
1174
-
1175
1039
  return product;
1176
1040
  }
1177
1041
  function normalizeCart(checkout) {
1178
1042
  var _checkout$totalPrice, _checkout$subtotalPri, _checkout$subtotalPri2, _checkout$subtotalPri3, _checkout$subtotalPri4, _checkout$totalPrice2;
1179
-
1180
1043
  var lines = checkout.lines;
1181
1044
  var lineItems = lines.length > 0 ? lines == null ? void 0 : lines.map(normalizeLineItem) : [];
1182
1045
  return {
@@ -1195,13 +1058,11 @@ function normalizeCart(checkout) {
1195
1058
  discounts: []
1196
1059
  };
1197
1060
  }
1198
-
1199
1061
  function normalizeLineItem(_ref3) {
1200
1062
  var _variant$sku, _variant$pricing, _variant$pricing$pric, _variant$product;
1201
-
1202
1063
  var id = _ref3.id,
1203
- variant = _ref3.variant,
1204
- quantity = _ref3.quantity;
1064
+ variant = _ref3.variant,
1065
+ quantity = _ref3.quantity;
1205
1066
  return {
1206
1067
  id: id,
1207
1068
  variantId: String(variant == null ? void 0 : variant.id),
@@ -1224,11 +1085,10 @@ function normalizeLineItem(_ref3) {
1224
1085
  options: []
1225
1086
  };
1226
1087
  }
1227
-
1228
1088
  var normalizeCategory = function normalizeCategory(_ref4) {
1229
1089
  var name = _ref4.name,
1230
- slug = _ref4.slug,
1231
- id = _ref4.id;
1090
+ slug = _ref4.slug,
1091
+ id = _ref4.id;
1232
1092
  return {
1233
1093
  id: id,
1234
1094
  name: name,
@@ -1246,7 +1106,7 @@ var throwUserErrors = function throwUserErrors(errors) {
1246
1106
  throw new ValidationError({
1247
1107
  errors: errors.map(function (_ref) {
1248
1108
  var code = _ref.code,
1249
- message = _ref.message;
1109
+ message = _ref.message;
1250
1110
  return {
1251
1111
  code: code != null ? code : 'validation_error',
1252
1112
  message: message || ''
@@ -1260,33 +1120,26 @@ var throwUserErrors = function throwUserErrors(errors) {
1260
1120
  Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
1261
1121
  Changes: None
1262
1122
  */
1263
-
1264
1123
  var checkoutToCart = function checkoutToCart(checkoutPayload) {
1265
1124
  var _checkoutPayload$erro;
1266
-
1267
1125
  if (!checkoutPayload) {
1268
1126
  throw new CommerceError({
1269
1127
  message: 'Missing checkout payload from response'
1270
1128
  });
1271
1129
  }
1272
-
1273
1130
  var checkout = checkoutPayload == null ? void 0 : checkoutPayload.checkout;
1274
-
1275
1131
  if ((checkoutPayload == null ? void 0 : (_checkoutPayload$erro = checkoutPayload.errors) == null ? void 0 : _checkoutPayload$erro.length) === 1 && checkoutPayload.errors[0].code === "PRODUCT_UNAVAILABLE_FOR_PURCHASE") {
1276
1132
  console.error(checkoutPayload.errors[0]);
1277
1133
  return undefined;
1278
1134
  }
1279
-
1280
1135
  if (checkoutPayload != null && checkoutPayload.errors) {
1281
1136
  throwUserErrors(checkoutPayload == null ? void 0 : checkoutPayload.errors);
1282
1137
  }
1283
-
1284
1138
  if (!checkout) {
1285
1139
  throw new CommerceError({
1286
1140
  message: 'Missing checkout object from response'
1287
1141
  });
1288
1142
  }
1289
-
1290
1143
  return normalizeCart(checkout);
1291
1144
  };
1292
1145
 
@@ -1302,49 +1155,37 @@ var getToken = function getToken() {
1302
1155
  Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
1303
1156
  Changes: None
1304
1157
  */
1305
- var CollectionMany =
1306
- /* GraphQL */
1307
- "\n query CollectionMany( $channel: String = \"default-channel\") {\n collections(first:100, channel: $channel) {\n edges {\n node {\n id\n name\n slug\n }\n }\n }\n }\n";
1158
+ var CollectionMany = /* GraphQL */"\n query CollectionMany( $channel: String = \"default-channel\") {\n collections(first:100, channel: $channel) {\n edges {\n node {\n id\n name\n slug\n }\n }\n }\n }\n";
1308
1159
 
1309
1160
  /*
1310
1161
  Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
1311
1162
  Changes: None
1312
1163
  */
1313
- var ProductOneBySlug =
1314
- /* GraphQL */
1315
- "\n query ProductOneBySlug($slug: String!, $channel: String = \"default-channel\") {\n product(slug: $slug, channel: $channel) {\n id\n slug\n name\n description\n pricing {\n priceRange {\n start {\n net {\n amount\n }\n }\n }\n }\n variants {\n id\n name\n attributes {\n attribute {\n name\n }\n values {\n name\n }\n }\n pricing {\n price {\n net {\n amount\n currency\n }\n }\n }\n }\n media {\n url\n alt\n }\n }\n }\n";
1164
+ var ProductOneBySlug = /* GraphQL */"\n query ProductOneBySlug($slug: String!, $channel: String = \"default-channel\") {\n product(slug: $slug, channel: $channel) {\n id\n slug\n name\n description\n pricing {\n priceRange {\n start {\n net {\n amount\n }\n }\n }\n }\n variants {\n id\n name\n attributes {\n attribute {\n name\n }\n values {\n name\n }\n }\n pricing {\n price {\n net {\n amount\n currency\n }\n }\n }\n }\n media {\n url\n alt\n }\n }\n }\n";
1316
1165
 
1317
1166
  /*
1318
1167
  Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
1319
1168
  Changes: None
1320
1169
  */
1321
- var ProductMany =
1322
- /* GraphQL */
1323
- "\n query ProductMany(\n $first: Int = 100\n $filter: ProductFilterInput\n $sortBy: ProductOrder\n $channel: String = \"default-channel\"\n ) {\n products(first: $first, channel: $channel, filter: $filter, sortBy: $sortBy) {\n ...ProductConnection\n }\n }\n " + ProductConnection + "\n";
1170
+ var ProductMany = /* GraphQL */"\n query ProductMany(\n $first: Int = 100\n $filter: ProductFilterInput\n $sortBy: ProductOrder\n $channel: String = \"default-channel\"\n ) {\n products(first: $first, channel: $channel, filter: $filter, sortBy: $sortBy) {\n ...ProductConnection\n }\n }\n " + ProductConnection + "\n";
1324
1171
 
1325
1172
  /*
1326
1173
  Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
1327
1174
  Changes: None
1328
1175
  */
1329
- var CollectionOne =
1330
- /* GraphQL */
1331
- "\n query getProductsFromCollection($categoryId: ID!, $first: Int = 100, $channel: String = \"default-channel\") {\n collection(id: $categoryId, channel: $channel) {\n id\n name\n slug\n products(first: $first) {\n ...ProductConnection\n }\n }\n }\n " + ProductConnection + "\n";
1176
+ var CollectionOne = /* GraphQL */"\n query getProductsFromCollection($categoryId: ID!, $first: Int = 100, $channel: String = \"default-channel\") {\n collection(id: $categoryId, channel: $channel) {\n id\n name\n slug\n products(first: $first) {\n ...ProductConnection\n }\n }\n }\n " + ProductConnection + "\n";
1332
1177
 
1333
1178
  /*
1334
1179
  Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
1335
1180
  Changes: None
1336
1181
  */
1337
- var CheckoutOne =
1338
- /* GraphQL */
1339
- "\n query CheckoutOne($checkoutId: UUID!) {\n checkout(token: $checkoutId) {\n ... on Checkout {\n ...CheckoutDetails\n }\n }\n }\n " + CheckoutDetails + "\n";
1182
+ var CheckoutOne = /* GraphQL */"\n query CheckoutOne($checkoutId: UUID!) {\n checkout(token: $checkoutId) {\n ... on Checkout {\n ...CheckoutDetails\n }\n }\n }\n " + CheckoutDetails + "\n";
1340
1183
 
1341
1184
  /*
1342
1185
  Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
1343
1186
  Changes: None
1344
1187
  */
1345
- var getAllProductVendors =
1346
- /* GraphQL */
1347
- "\n query getAllProductVendors($cursor: String, $channel: String = \"default-channel\") {\n products(first:100,channel: $channel, after: $cursor) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n slug\n }\n cursor\n }\n }\n }\n";
1188
+ var getAllProductVendors = /* GraphQL */"\n query getAllProductVendors($cursor: String, $channel: String = \"default-channel\") {\n products(first:100,channel: $channel, after: $cursor) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n slug\n }\n cursor\n }\n }\n }\n";
1348
1189
 
1349
1190
  var handler = {
1350
1191
  fetchOptions: {
@@ -1353,20 +1194,16 @@ var handler = {
1353
1194
  fetcher: function fetcher(_ref) {
1354
1195
  return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
1355
1196
  var _checkout;
1356
-
1357
1197
  var checkoutId, options, fetch, checkout, _checkoutId, data;
1358
-
1359
1198
  return runtime_1.wrap(function _callee$(_context) {
1360
1199
  while (1) {
1361
1200
  switch (_context.prev = _context.next) {
1362
1201
  case 0:
1363
1202
  checkoutId = _ref.input.cartId, options = _ref.options, fetch = _ref.fetch;
1364
-
1365
1203
  if (!checkoutId) {
1366
1204
  _context.next = 7;
1367
1205
  break;
1368
1206
  }
1369
-
1370
1207
  _checkoutId = getCheckoutId().checkoutToken;
1371
1208
  _context.next = 5;
1372
1209
  return fetch(_extends({}, options, {
@@ -1374,26 +1211,20 @@ var handler = {
1374
1211
  checkoutId: _checkoutId
1375
1212
  }
1376
1213
  }));
1377
-
1378
1214
  case 5:
1379
1215
  data = _context.sent;
1380
1216
  checkout = data;
1381
-
1382
1217
  case 7:
1383
1218
  if (!((_checkout = checkout) != null && _checkout.completedAt || !checkoutId)) {
1384
1219
  _context.next = 11;
1385
1220
  break;
1386
1221
  }
1387
-
1388
1222
  _context.next = 10;
1389
1223
  return checkoutCreate(fetch);
1390
-
1391
1224
  case 10:
1392
1225
  checkout = _context.sent;
1393
-
1394
1226
  case 11:
1395
1227
  return _context.abrupt("return", checkoutToCart(checkout));
1396
-
1397
1228
  case 12:
1398
1229
  case "end":
1399
1230
  return _context.stop();
@@ -1415,7 +1246,6 @@ var handler = {
1415
1246
  isEmpty: {
1416
1247
  get: function get() {
1417
1248
  var _response$data$lineIt, _response$data;
1418
-
1419
1249
  return ((_response$data$lineIt = (_response$data = response.data) == null ? void 0 : _response$data.lineItems.length) != null ? _response$data$lineIt : 0) <= 0;
1420
1250
  },
1421
1251
  enumerable: true
@@ -1433,24 +1263,19 @@ var handler$1 = {
1433
1263
  fetcher: function fetcher(_ref) {
1434
1264
  return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
1435
1265
  var _item$quantity;
1436
-
1437
1266
  var item, options, fetch, _yield$fetch, checkoutLinesAdd;
1438
-
1439
1267
  return runtime_1.wrap(function _callee$(_context) {
1440
1268
  while (1) {
1441
1269
  switch (_context.prev = _context.next) {
1442
1270
  case 0:
1443
1271
  item = _ref.input, options = _ref.options, fetch = _ref.fetch;
1444
-
1445
1272
  if (!(item.quantity && (!Number.isInteger(item.quantity) || item.quantity < 1))) {
1446
1273
  _context.next = 3;
1447
1274
  break;
1448
1275
  }
1449
-
1450
1276
  throw new CommerceError({
1451
1277
  message: "The item quantity has to be a valid integer greater than 0"
1452
1278
  });
1453
-
1454
1279
  case 3:
1455
1280
  _context.next = 5;
1456
1281
  return fetch(_extends({}, options, {
@@ -1462,12 +1287,10 @@ var handler$1 = {
1462
1287
  }]
1463
1288
  }
1464
1289
  }));
1465
-
1466
1290
  case 5:
1467
1291
  _yield$fetch = _context.sent;
1468
1292
  checkoutLinesAdd = _yield$fetch.checkoutLinesAdd;
1469
1293
  return _context.abrupt("return", checkoutToCart(checkoutLinesAdd));
1470
-
1471
1294
  case 8:
1472
1295
  case "end":
1473
1296
  return _context.stop();
@@ -1480,8 +1303,7 @@ var handler$1 = {
1480
1303
  var fetch = _ref2.fetch;
1481
1304
  return function () {
1482
1305
  var _useCart = useCart(),
1483
- mutate = _useCart.mutate;
1484
-
1306
+ mutate = _useCart.mutate;
1485
1307
  return useCallback( /*#__PURE__*/function () {
1486
1308
  var _addItem = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(input) {
1487
1309
  var data;
@@ -1493,29 +1315,22 @@ var handler$1 = {
1493
1315
  return fetch({
1494
1316
  input: input
1495
1317
  });
1496
-
1497
1318
  case 2:
1498
1319
  data = _context2.sent;
1499
-
1500
1320
  if (!data) {
1501
1321
  _context2.next = 8;
1502
1322
  break;
1503
1323
  }
1504
-
1505
1324
  _context2.next = 6;
1506
1325
  return mutate(data, false);
1507
-
1508
1326
  case 6:
1509
1327
  _context2.next = 10;
1510
1328
  break;
1511
-
1512
1329
  case 8:
1513
1330
  _context2.next = 10;
1514
1331
  return mutate();
1515
-
1516
1332
  case 10:
1517
1333
  return _context2.abrupt("return", data);
1518
-
1519
1334
  case 11:
1520
1335
  case "end":
1521
1336
  return _context2.stop();
@@ -1523,11 +1338,9 @@ var handler$1 = {
1523
1338
  }
1524
1339
  }, _callee2);
1525
1340
  }));
1526
-
1527
1341
  function addItem(_x) {
1528
1342
  return _addItem.apply(this, arguments);
1529
1343
  }
1530
-
1531
1344
  return addItem;
1532
1345
  }(), [fetch, mutate]);
1533
1346
  };
@@ -1553,11 +1366,9 @@ var handler$2 = {
1553
1366
  lineId: itemId
1554
1367
  }
1555
1368
  }));
1556
-
1557
1369
  case 3:
1558
1370
  data = _context.sent;
1559
1371
  return _context.abrupt("return", checkoutToCart(data.checkoutLineDelete));
1560
-
1561
1372
  case 5:
1562
1373
  case "end":
1563
1374
  return _context.stop();
@@ -1570,8 +1381,7 @@ var handler$2 = {
1570
1381
  var fetch = _ref2.fetch;
1571
1382
  return function () {
1572
1383
  var _useCart = useCart(),
1573
- mutate = _useCart.mutate;
1574
-
1384
+ mutate = _useCart.mutate;
1575
1385
  return useCallback( /*#__PURE__*/function () {
1576
1386
  var _removeItem = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(input) {
1577
1387
  var data;
@@ -1585,15 +1395,12 @@ var handler$2 = {
1585
1395
  itemId: input.id
1586
1396
  }
1587
1397
  });
1588
-
1589
1398
  case 2:
1590
1399
  data = _context2.sent;
1591
1400
  _context2.next = 5;
1592
1401
  return mutate(data, false);
1593
-
1594
1402
  case 5:
1595
1403
  return _context2.abrupt("return", data);
1596
-
1597
1404
  case 6:
1598
1405
  case "end":
1599
1406
  return _context2.stop();
@@ -1601,11 +1408,9 @@ var handler$2 = {
1601
1408
  }
1602
1409
  }, _callee2);
1603
1410
  }));
1604
-
1605
1411
  function removeItem(_x) {
1606
1412
  return _removeItem.apply(this, arguments);
1607
1413
  }
1608
-
1609
1414
  return removeItem;
1610
1415
  }(), [fetch, mutate]);
1611
1416
  };
@@ -1619,23 +1424,19 @@ var handler$3 = {
1619
1424
  fetcher: function fetcher(_ref) {
1620
1425
  return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
1621
1426
  var _ref$input, itemId, item, options, fetch, checkoutId, _yield$fetch, checkoutLinesUpdate;
1622
-
1623
1427
  return runtime_1.wrap(function _callee$(_context) {
1624
1428
  while (1) {
1625
1429
  switch (_context.prev = _context.next) {
1626
1430
  case 0:
1627
1431
  _ref$input = _ref.input, itemId = _ref$input.itemId, item = _ref$input.item, options = _ref.options, fetch = _ref.fetch;
1628
-
1629
1432
  if (!Number.isInteger(item.quantity)) {
1630
1433
  _context.next = 6;
1631
1434
  break;
1632
1435
  }
1633
-
1634
1436
  if (!(item.quantity < 1)) {
1635
1437
  _context.next = 4;
1636
1438
  break;
1637
1439
  }
1638
-
1639
1440
  return _context.abrupt("return", handler$2.fetcher({
1640
1441
  options: handler$2.fetchOptions,
1641
1442
  input: {
@@ -1643,21 +1444,17 @@ var handler$3 = {
1643
1444
  },
1644
1445
  fetch: fetch
1645
1446
  }));
1646
-
1647
1447
  case 4:
1648
1448
  _context.next = 8;
1649
1449
  break;
1650
-
1651
1450
  case 6:
1652
1451
  if (!item.quantity) {
1653
1452
  _context.next = 8;
1654
1453
  break;
1655
1454
  }
1656
-
1657
1455
  throw new ValidationError({
1658
1456
  message: "The item quantity has to be a valid integer"
1659
1457
  });
1660
-
1661
1458
  case 8:
1662
1459
  checkoutId = getCheckoutId().checkoutId;
1663
1460
  _context.next = 11;
@@ -1670,12 +1467,10 @@ var handler$3 = {
1670
1467
  }]
1671
1468
  }
1672
1469
  }));
1673
-
1674
1470
  case 11:
1675
1471
  _yield$fetch = _context.sent;
1676
1472
  checkoutLinesUpdate = _yield$fetch.checkoutLinesUpdate;
1677
1473
  return _context.abrupt("return", checkoutToCart(checkoutLinesUpdate));
1678
-
1679
1474
  case 14:
1680
1475
  case "end":
1681
1476
  return _context.stop();
@@ -1688,21 +1483,16 @@ var handler$3 = {
1688
1483
  var fetch = _ref2.fetch;
1689
1484
  return function (ctx) {
1690
1485
  var _ctx$wait;
1691
-
1692
1486
  if (ctx === void 0) {
1693
1487
  ctx = {};
1694
1488
  }
1695
-
1696
1489
  var _ctx = ctx,
1697
- item = _ctx.item;
1698
-
1490
+ item = _ctx.item;
1699
1491
  var _useCart = useCart(),
1700
- mutate = _useCart.mutate;
1701
-
1492
+ mutate = _useCart.mutate;
1702
1493
  return useCallback(debounce( /*#__PURE__*/function () {
1703
1494
  var _ref3 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(input) {
1704
1495
  var _input$id, _input$productId, _input$productId2;
1705
-
1706
1496
  var itemId, productId, variantId, data;
1707
1497
  return runtime_1.wrap(function _callee2$(_context2) {
1708
1498
  while (1) {
@@ -1711,16 +1501,13 @@ var handler$3 = {
1711
1501
  itemId = (_input$id = input.id) != null ? _input$id : item == null ? void 0 : item.id;
1712
1502
  productId = (_input$productId = input.productId) != null ? _input$productId : item == null ? void 0 : item.productId;
1713
1503
  variantId = (_input$productId2 = input.productId) != null ? _input$productId2 : item == null ? void 0 : item.variantId;
1714
-
1715
1504
  if (!(!itemId || !productId || !variantId)) {
1716
1505
  _context2.next = 5;
1717
1506
  break;
1718
1507
  }
1719
-
1720
1508
  throw new ValidationError({
1721
1509
  message: "Invalid input used for this operation"
1722
1510
  });
1723
-
1724
1511
  case 5:
1725
1512
  _context2.next = 7;
1726
1513
  return fetch({
@@ -1733,15 +1520,12 @@ var handler$3 = {
1733
1520
  itemId: itemId
1734
1521
  }
1735
1522
  });
1736
-
1737
1523
  case 7:
1738
1524
  data = _context2.sent;
1739
1525
  _context2.next = 10;
1740
1526
  return mutate(data, false);
1741
-
1742
1527
  case 10:
1743
1528
  return _context2.abrupt("return", data);
1744
-
1745
1529
  case 11:
1746
1530
  case "end":
1747
1531
  return _context2.stop();
@@ -1749,7 +1533,6 @@ var handler$3 = {
1749
1533
  }
1750
1534
  }, _callee2);
1751
1535
  }));
1752
-
1753
1536
  return function (_x) {
1754
1537
  return _ref3.apply(this, arguments);
1755
1538
  };
@@ -1765,19 +1548,16 @@ var handler$4 = {
1765
1548
  fetcher: function fetcher(_ref) {
1766
1549
  return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
1767
1550
  var input, fetch, categoryId, _data$collections$edg, _data$collections, _data$collections$edg2, data, _data;
1768
-
1769
1551
  return runtime_1.wrap(function _callee$(_context) {
1770
1552
  while (1) {
1771
1553
  switch (_context.prev = _context.next) {
1772
1554
  case 0:
1773
1555
  input = _ref.input, fetch = _ref.fetch;
1774
1556
  categoryId = input.categoryId;
1775
-
1776
1557
  if (categoryId) {
1777
1558
  _context.next = 9;
1778
1559
  break;
1779
1560
  }
1780
-
1781
1561
  _context.next = 5;
1782
1562
  return fetch({
1783
1563
  query: CollectionMany,
@@ -1785,14 +1565,12 @@ var handler$4 = {
1785
1565
  first: 250
1786
1566
  }
1787
1567
  });
1788
-
1789
1568
  case 5:
1790
1569
  data = _context.sent;
1791
1570
  return _context.abrupt("return", (_data$collections$edg = (_data$collections = data.collections) == null ? void 0 : (_data$collections$edg2 = _data$collections.edges) == null ? void 0 : _data$collections$edg2.map(function (_ref2) {
1792
1571
  var node = _ref2.node;
1793
1572
  return normalizeCategory(node);
1794
1573
  })) != null ? _data$collections$edg : []);
1795
-
1796
1574
  case 9:
1797
1575
  _context.next = 11;
1798
1576
  return fetch({
@@ -1801,11 +1579,9 @@ var handler$4 = {
1801
1579
  categoryId: categoryId
1802
1580
  }
1803
1581
  });
1804
-
1805
1582
  case 11:
1806
1583
  _data = _context.sent;
1807
1584
  return _context.abrupt("return", !!(_data != null && _data.collection) ? [normalizeCategory(_data == null ? void 0 : _data.collection)] : []);
1808
-
1809
1585
  case 13:
1810
1586
  case "end":
1811
1587
  return _context.stop();
@@ -1828,7 +1604,6 @@ var handler$4 = {
1828
1604
  isEmpty: {
1829
1605
  get: function get() {
1830
1606
  var _response$data$length, _response$data;
1831
-
1832
1607
  return ((_response$data$length = (_response$data = response.data) == null ? void 0 : _response$data.length) != null ? _response$data$length : 0) <= 0;
1833
1608
  },
1834
1609
  enumerable: true
@@ -1850,7 +1625,6 @@ var handler$5 = {
1850
1625
  switch (_context.prev = _context.next) {
1851
1626
  case 0:
1852
1627
  return _context.abrupt("return", []);
1853
-
1854
1628
  case 2:
1855
1629
  case "end":
1856
1630
  return _context.stop();
@@ -1872,7 +1646,6 @@ var handler$5 = {
1872
1646
  isEmpty: {
1873
1647
  get: function get() {
1874
1648
  var _response$data$length, _response$data;
1875
-
1876
1649
  return ((_response$data$length = (_response$data = response.data) == null ? void 0 : _response$data.length) != null ? _response$data$length : 0) <= 0;
1877
1650
  },
1878
1651
  enumerable: true
@@ -1890,7 +1663,6 @@ var handler$6 = {
1890
1663
  fetcher: function fetcher(_ref) {
1891
1664
  return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
1892
1665
  var input, options, fetch, categoryId, brandId, data, edges, _data$collection$prod, _data$collection, _data$collection$prod2, _data$products$edges, _data$products;
1893
-
1894
1666
  return runtime_1.wrap(function _callee$(_context) {
1895
1667
  while (1) {
1896
1668
  switch (_context.prev = _context.next) {
@@ -1903,12 +1675,11 @@ var handler$6 = {
1903
1675
  method: options == null ? void 0 : options.method,
1904
1676
  variables: getSearchVariables(input)
1905
1677
  });
1906
-
1907
1678
  case 4:
1908
1679
  data = _context.sent;
1909
-
1910
1680
  if (categoryId) {
1911
- edges = (_data$collection$prod = (_data$collection = data.collection) == null ? void 0 : (_data$collection$prod2 = _data$collection.products) == null ? void 0 : _data$collection$prod2.edges) != null ? _data$collection$prod : []; // FIXME @zaiste, no `vendor` in Saleor
1681
+ edges = (_data$collection$prod = (_data$collection = data.collection) == null ? void 0 : (_data$collection$prod2 = _data$collection.products) == null ? void 0 : _data$collection$prod2.edges) != null ? _data$collection$prod : [];
1682
+ // FIXME @zaiste, no `vendor` in Saleor
1912
1683
  // if (brandId) {
1913
1684
  // edges = edges.filter(
1914
1685
  // ({ node: { vendor } }: ProductCountableEdge) =>
@@ -1918,7 +1689,6 @@ var handler$6 = {
1918
1689
  } else {
1919
1690
  edges = (_data$products$edges = (_data$products = data.products) == null ? void 0 : _data$products.edges) != null ? _data$products$edges : [];
1920
1691
  }
1921
-
1922
1692
  return _context.abrupt("return", {
1923
1693
  products: edges.map(function (_ref2) {
1924
1694
  var node = _ref2.node;
@@ -1926,7 +1696,6 @@ var handler$6 = {
1926
1696
  }),
1927
1697
  found: !!edges.length
1928
1698
  });
1929
-
1930
1699
  case 7:
1931
1700
  case "end":
1932
1701
  return _context.stop();
@@ -1941,7 +1710,6 @@ var handler$6 = {
1941
1710
  if (input === void 0) {
1942
1711
  input = {};
1943
1712
  }
1944
-
1945
1713
  return useData({
1946
1714
  input: [["search", input.search], ["categoryId", input.categoryId], ["brandId", input.brandId], ["sort", input.sort], ["count", input.count]],
1947
1715
  swrOptions: _extends({
@@ -1952,9 +1720,7 @@ var handler$6 = {
1952
1720
  }
1953
1721
  };
1954
1722
 
1955
- var ProductOneById =
1956
- /* GraphQL */
1957
- "\n query ProductOneById($id: ID!, $channel: String = \"default-channel\") {\n product(id: $id, channel: $channel) {\n\n slug\n name\n description\n pricing {\n priceRange {\n start {\n net {\n amount\n }\n }\n }\n }\n variants {\n id\n name\n attributes {\n attribute {\n name\n }\n values {\n name\n }\n }\n pricing {\n price {\n net {\n amount\n currency\n }\n }\n }\n }\n media {\n url\n alt\n }\n }\n }";
1723
+ var ProductOneById = /* GraphQL */"\n query ProductOneById($id: ID!, $channel: String = \"default-channel\") {\n product(id: $id, channel: $channel) {\n\n slug\n name\n description\n pricing {\n priceRange {\n start {\n net {\n amount\n }\n }\n }\n }\n variants {\n id\n name\n attributes {\n attribute {\n name\n }\n values {\n name\n }\n }\n pricing {\n price {\n net {\n amount\n currency\n }\n }\n }\n }\n media {\n url\n alt\n }\n }\n }";
1958
1724
 
1959
1725
  var handler$7 = {
1960
1726
  fetchOptions: {
@@ -1969,14 +1735,11 @@ var handler$7 = {
1969
1735
  case 0:
1970
1736
  input = _ref.input, fetch = _ref.fetch;
1971
1737
  id = input.id;
1972
-
1973
1738
  if (id) {
1974
1739
  _context.next = 4;
1975
1740
  break;
1976
1741
  }
1977
-
1978
1742
  return _context.abrupt("return", null);
1979
-
1980
1743
  case 4:
1981
1744
  _context.next = 6;
1982
1745
  return fetch({
@@ -1985,15 +1748,12 @@ var handler$7 = {
1985
1748
  id: id
1986
1749
  }
1987
1750
  });
1988
-
1989
1751
  case 6:
1990
1752
  data = _context.sent;
1991
-
1992
1753
  if (data.product) {
1993
1754
  _context.next = 12;
1994
1755
  break;
1995
1756
  }
1996
-
1997
1757
  _context.next = 10;
1998
1758
  return fetch({
1999
1759
  query: ProductOneBySlug,
@@ -2001,14 +1761,11 @@ var handler$7 = {
2001
1761
  slug: id
2002
1762
  }
2003
1763
  });
2004
-
2005
1764
  case 10:
2006
1765
  response = _context.sent;
2007
1766
  return _context.abrupt("return", response.product ? normalizeProduct(response.product) : null);
2008
-
2009
1767
  case 12:
2010
1768
  return _context.abrupt("return", data.product ? normalizeProduct(data.product) : null);
2011
-
2012
1769
  case 13:
2013
1770
  case "end":
2014
1771
  return _context.stop();
@@ -2023,7 +1780,6 @@ var handler$7 = {
2023
1780
  if (input === void 0) {
2024
1781
  input = {};
2025
1782
  }
2026
-
2027
1783
  return useData({
2028
1784
  input: [["id", input.id]],
2029
1785
  swrOptions: _extends({
@@ -2039,7 +1795,6 @@ var getFetcher = function getFetcher(saleorApiUrl) {
2039
1795
  return /*#__PURE__*/function () {
2040
1796
  var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(_ref) {
2041
1797
  var _ref$url, url, _ref$method, method, query, variables, _ref3, vars, token;
2042
-
2043
1798
  return runtime_1.wrap(function _callee$(_context) {
2044
1799
  while (1) {
2045
1800
  switch (_context.prev = _context.next) {
@@ -2060,11 +1815,9 @@ var getFetcher = function getFetcher(saleorApiUrl) {
2060
1815
  'Content-Type': 'application/json'
2061
1816
  }
2062
1817
  });
2063
-
2064
1818
  case 6:
2065
1819
  _context.t1 = _context.sent;
2066
1820
  return _context.abrupt("return", (0, _context.t0)(_context.t1));
2067
-
2068
1821
  case 8:
2069
1822
  case "end":
2070
1823
  return _context.stop();
@@ -2072,7 +1825,6 @@ var getFetcher = function getFetcher(saleorApiUrl) {
2072
1825
  }
2073
1826
  }, _callee);
2074
1827
  }));
2075
-
2076
1828
  return function (_x) {
2077
1829
  return _ref2.apply(this, arguments);
2078
1830
  };
@@ -2133,7 +1885,7 @@ var commerceProviderMeta = {
2133
1885
  };
2134
1886
  function CommerceProviderComponent(props) {
2135
1887
  var saleorApiUrl = props.saleorApiUrl,
2136
- children = props.children;
1888
+ children = props.children;
2137
1889
  var CommerceProvider = React.useMemo(function () {
2138
1890
  return getCommerceProvider(saleorApiUrl);
2139
1891
  }, [saleorApiUrl]);
@@ -2143,7 +1895,6 @@ function registerCommerceProvider(loader, customCommerceProviderMeta) {
2143
1895
  var doRegisterComponent = function doRegisterComponent() {
2144
1896
  return loader ? loader.registerGlobalContext.apply(loader, arguments) : registerGlobalContext.apply(void 0, arguments);
2145
1897
  };
2146
-
2147
1898
  doRegisterComponent(CommerceProviderComponent, customCommerceProviderMeta != null ? customCommerceProviderMeta : commerceProviderMeta);
2148
1899
  }
2149
1900