@plasmicpkgs/commerce-shopify 0.0.90 → 0.0.92

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.
@@ -20,64 +20,52 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
20
20
  reject(error);
21
21
  return;
22
22
  }
23
-
24
23
  if (info.done) {
25
24
  resolve(value);
26
25
  } else {
27
26
  Promise.resolve(value).then(_next, _throw);
28
27
  }
29
28
  }
30
-
31
29
  function _asyncToGenerator(fn) {
32
30
  return function () {
33
31
  var self = this,
34
- args = arguments;
32
+ args = arguments;
35
33
  return new Promise(function (resolve, reject) {
36
34
  var gen = fn.apply(self, args);
37
-
38
35
  function _next(value) {
39
36
  asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
40
37
  }
41
-
42
38
  function _throw(err) {
43
39
  asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
44
40
  }
45
-
46
41
  _next(undefined);
47
42
  });
48
43
  };
49
44
  }
50
-
51
45
  function _extends() {
52
- _extends = Object.assign || function (target) {
46
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
53
47
  for (var i = 1; i < arguments.length; i++) {
54
48
  var source = arguments[i];
55
-
56
49
  for (var key in source) {
57
50
  if (Object.prototype.hasOwnProperty.call(source, key)) {
58
51
  target[key] = source[key];
59
52
  }
60
53
  }
61
54
  }
62
-
63
55
  return target;
64
56
  };
65
-
66
57
  return _extends.apply(this, arguments);
67
58
  }
68
-
69
59
  function _objectWithoutPropertiesLoose(source, excluded) {
70
60
  if (source == null) return {};
71
61
  var target = {};
72
62
  var sourceKeys = Object.keys(source);
73
63
  var key, i;
74
-
75
64
  for (i = 0; i < sourceKeys.length; i++) {
76
65
  key = sourceKeys[i];
77
66
  if (excluded.indexOf(key) >= 0) continue;
78
67
  target[key] = source[key];
79
68
  }
80
-
81
69
  return target;
82
70
  }
83
71
 
@@ -92,17 +80,16 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
92
80
  * This source code is licensed under the MIT license found in the
93
81
  * LICENSE file in the root directory of this source tree.
94
82
  */
83
+
95
84
  var runtime = function (exports) {
96
85
 
97
86
  var Op = Object.prototype;
98
87
  var hasOwn = Op.hasOwnProperty;
99
88
  var undefined$1; // More compressible than void 0.
100
-
101
89
  var $Symbol = typeof Symbol === "function" ? Symbol : {};
102
90
  var iteratorSymbol = $Symbol.iterator || "@@iterator";
103
91
  var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
104
92
  var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
105
-
106
93
  function define(obj, key, value) {
107
94
  Object.defineProperty(obj, key, {
108
95
  value: value,
@@ -112,7 +99,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
112
99
  });
113
100
  return obj[key];
114
101
  }
115
-
116
102
  try {
117
103
  // IE 8 has a broken Object.defineProperty that only works on DOM objects.
118
104
  define({}, "");
@@ -121,19 +107,20 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
121
107
  return obj[key] = value;
122
108
  };
123
109
  }
124
-
125
110
  function wrap(innerFn, outerFn, self, tryLocsList) {
126
111
  // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
127
112
  var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
128
113
  var generator = Object.create(protoGenerator.prototype);
129
- var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next,
130
- // .throw, and .return methods.
114
+ var context = new Context(tryLocsList || []);
131
115
 
116
+ // The ._invoke method unifies the implementations of the .next,
117
+ // .throw, and .return methods.
132
118
  generator._invoke = makeInvokeMethod(innerFn, self, context);
133
119
  return generator;
134
120
  }
121
+ exports.wrap = wrap;
135
122
 
136
- exports.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion
123
+ // Try/catch helper to minimize deoptimizations. Returns a completion
137
124
  // record like context.tryEntries[i].completion. This interface could
138
125
  // have been (and was previously) designed to take a closure to be
139
126
  // invoked without arguments, but in all the cases we care about we
@@ -143,7 +130,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
143
130
  // in every case, so we don't have to touch the arguments object. The
144
131
  // only additional allocation required is the completion record, which
145
132
  // has a stable shape and so hopefully should be cheap to allocate.
146
-
147
133
  function tryCatch(fn, obj, arg) {
148
134
  try {
149
135
  return {
@@ -157,46 +143,44 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
157
143
  };
158
144
  }
159
145
  }
160
-
161
146
  var GenStateSuspendedStart = "suspendedStart";
162
147
  var GenStateSuspendedYield = "suspendedYield";
163
148
  var GenStateExecuting = "executing";
164
- var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as
149
+ var GenStateCompleted = "completed";
150
+
151
+ // Returning this object from the innerFn has the same effect as
165
152
  // breaking out of the dispatch switch statement.
153
+ var ContinueSentinel = {};
166
154
 
167
- var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and
155
+ // Dummy constructor functions that we use as the .constructor and
168
156
  // .constructor.prototype properties for functions that return Generator
169
157
  // objects. For full spec compliance, you may wish to configure your
170
158
  // minifier not to mangle the names of these two functions.
171
-
172
159
  function Generator() {}
173
-
174
160
  function GeneratorFunction() {}
161
+ function GeneratorFunctionPrototype() {}
175
162
 
176
- function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that
163
+ // This is a polyfill for %IteratorPrototype% for environments that
177
164
  // don't natively support it.
178
-
179
-
180
165
  var IteratorPrototype = {};
181
166
  define(IteratorPrototype, iteratorSymbol, function () {
182
167
  return this;
183
168
  });
184
169
  var getProto = Object.getPrototypeOf;
185
170
  var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
186
-
187
171
  if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
188
172
  // This environment has a native %IteratorPrototype%; use it instead
189
173
  // of the polyfill.
190
174
  IteratorPrototype = NativeIteratorPrototype;
191
175
  }
192
-
193
176
  var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
194
177
  GeneratorFunction.prototype = GeneratorFunctionPrototype;
195
178
  define(Gp, "constructor", GeneratorFunctionPrototype);
196
179
  define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
197
- GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"); // Helper for defining the .next, .throw, and .return methods of the
198
- // Iterator interface in terms of a single ._invoke method.
180
+ GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
199
181
 
182
+ // Helper for defining the .next, .throw, and .return methods of the
183
+ // Iterator interface in terms of a single ._invoke method.
200
184
  function defineIteratorMethods(prototype) {
201
185
  ["next", "throw", "return"].forEach(function (method) {
202
186
  define(prototype, method, function (arg) {
@@ -204,14 +188,13 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
204
188
  });
205
189
  });
206
190
  }
207
-
208
191
  exports.isGeneratorFunction = function (genFun) {
209
192
  var ctor = typeof genFun === "function" && genFun.constructor;
210
- return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can
193
+ return ctor ? ctor === GeneratorFunction ||
194
+ // For the native GeneratorFunction constructor, the best we can
211
195
  // do is to check its .name property.
212
196
  (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
213
197
  };
214
-
215
198
  exports.mark = function (genFun) {
216
199
  if (Object.setPrototypeOf) {
217
200
  Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
@@ -219,31 +202,27 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
219
202
  genFun.__proto__ = GeneratorFunctionPrototype;
220
203
  define(genFun, toStringTagSymbol, "GeneratorFunction");
221
204
  }
222
-
223
205
  genFun.prototype = Object.create(Gp);
224
206
  return genFun;
225
- }; // Within the body of any async function, `await x` is transformed to
207
+ };
208
+
209
+ // Within the body of any async function, `await x` is transformed to
226
210
  // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
227
211
  // `hasOwn.call(value, "__await")` to determine if the yielded value is
228
212
  // meant to be awaited.
229
-
230
-
231
213
  exports.awrap = function (arg) {
232
214
  return {
233
215
  __await: arg
234
216
  };
235
217
  };
236
-
237
218
  function AsyncIterator(generator, PromiseImpl) {
238
219
  function invoke(method, arg, resolve, reject) {
239
220
  var record = tryCatch(generator[method], generator, arg);
240
-
241
221
  if (record.type === "throw") {
242
222
  reject(record.arg);
243
223
  } else {
244
224
  var result = record.arg;
245
225
  var value = result.value;
246
-
247
226
  if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
248
227
  return PromiseImpl.resolve(value.__await).then(function (value) {
249
228
  invoke("next", value, resolve, reject);
@@ -251,7 +230,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
251
230
  invoke("throw", err, resolve, reject);
252
231
  });
253
232
  }
254
-
255
233
  return PromiseImpl.resolve(value).then(function (unwrapped) {
256
234
  // When a yielded Promise is resolved, its final value becomes
257
235
  // the .value of the Promise<{value,done}> result for the
@@ -265,17 +243,15 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
265
243
  });
266
244
  }
267
245
  }
268
-
269
246
  var previousPromise;
270
-
271
247
  function enqueue(method, arg) {
272
248
  function callInvokeWithMethodAndArg() {
273
249
  return new PromiseImpl(function (resolve, reject) {
274
250
  invoke(method, arg, resolve, reject);
275
251
  });
276
252
  }
277
-
278
- return previousPromise = // If enqueue has been called before, then we want to wait until
253
+ return previousPromise =
254
+ // If enqueue has been called before, then we want to wait until
279
255
  // all previous Promises have been resolved before calling invoke,
280
256
  // so that results are always delivered in the correct order. If
281
257
  // enqueue has not been called before, then it is important to
@@ -287,24 +263,25 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
287
263
  // execute code before the first await. Since we implement simple
288
264
  // async functions in terms of async generators, it is especially
289
265
  // important to get this right, even though it requires care.
290
- previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later
266
+ previousPromise ? previousPromise.then(callInvokeWithMethodAndArg,
267
+ // Avoid propagating failures to Promises returned by later
291
268
  // invocations of the iterator.
292
269
  callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
293
- } // Define the unified helper method that is used to implement .next,
294
- // .throw, and .return (see defineIteratorMethods).
295
-
270
+ }
296
271
 
272
+ // Define the unified helper method that is used to implement .next,
273
+ // .throw, and .return (see defineIteratorMethods).
297
274
  this._invoke = enqueue;
298
275
  }
299
-
300
276
  defineIteratorMethods(AsyncIterator.prototype);
301
277
  define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
302
278
  return this;
303
279
  });
304
- exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of
280
+ exports.AsyncIterator = AsyncIterator;
281
+
282
+ // Note that simple async functions are implemented on top of
305
283
  // AsyncIterator objects; they just return a Promise for the value of
306
284
  // the final result produced by the iterator.
307
-
308
285
  exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
309
286
  if (PromiseImpl === void 0) PromiseImpl = Promise;
310
287
  var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
@@ -313,39 +290,32 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
313
290
  return result.done ? result.value : iter.next();
314
291
  });
315
292
  };
316
-
317
293
  function makeInvokeMethod(innerFn, self, context) {
318
294
  var state = GenStateSuspendedStart;
319
295
  return function invoke(method, arg) {
320
296
  if (state === GenStateExecuting) {
321
297
  throw new Error("Generator is already running");
322
298
  }
323
-
324
299
  if (state === GenStateCompleted) {
325
300
  if (method === "throw") {
326
301
  throw arg;
327
- } // Be forgiving, per 25.3.3.3.3 of the spec:
328
- // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
329
-
302
+ }
330
303
 
304
+ // Be forgiving, per 25.3.3.3.3 of the spec:
305
+ // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
331
306
  return doneResult();
332
307
  }
333
-
334
308
  context.method = method;
335
309
  context.arg = arg;
336
-
337
310
  while (true) {
338
311
  var delegate = context.delegate;
339
-
340
312
  if (delegate) {
341
313
  var delegateResult = maybeInvokeDelegate(delegate, context);
342
-
343
314
  if (delegateResult) {
344
315
  if (delegateResult === ContinueSentinel) continue;
345
316
  return delegateResult;
346
317
  }
347
318
  }
348
-
349
319
  if (context.method === "next") {
350
320
  // Setting context._sent for legacy support of Babel's
351
321
  // function.sent implementation.
@@ -355,51 +325,44 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
355
325
  state = GenStateCompleted;
356
326
  throw context.arg;
357
327
  }
358
-
359
328
  context.dispatchException(context.arg);
360
329
  } else if (context.method === "return") {
361
330
  context.abrupt("return", context.arg);
362
331
  }
363
-
364
332
  state = GenStateExecuting;
365
333
  var record = tryCatch(innerFn, self, context);
366
-
367
334
  if (record.type === "normal") {
368
335
  // If an exception is thrown from innerFn, we leave state ===
369
336
  // GenStateExecuting and loop back for another invocation.
370
337
  state = context.done ? GenStateCompleted : GenStateSuspendedYield;
371
-
372
338
  if (record.arg === ContinueSentinel) {
373
339
  continue;
374
340
  }
375
-
376
341
  return {
377
342
  value: record.arg,
378
343
  done: context.done
379
344
  };
380
345
  } else if (record.type === "throw") {
381
- state = GenStateCompleted; // Dispatch the exception by looping back around to the
346
+ state = GenStateCompleted;
347
+ // Dispatch the exception by looping back around to the
382
348
  // context.dispatchException(context.arg) call above.
383
-
384
349
  context.method = "throw";
385
350
  context.arg = record.arg;
386
351
  }
387
352
  }
388
353
  };
389
- } // Call delegate.iterator[context.method](context.arg) and handle the
354
+ }
355
+
356
+ // Call delegate.iterator[context.method](context.arg) and handle the
390
357
  // result, either by returning a { value, done } result from the
391
358
  // delegate iterator, or by modifying context.method and context.arg,
392
359
  // setting context.delegate to null, and returning the ContinueSentinel.
393
-
394
-
395
360
  function maybeInvokeDelegate(delegate, context) {
396
361
  var method = delegate.iterator[context.method];
397
-
398
362
  if (method === undefined$1) {
399
363
  // A .throw or .return when the delegate iterator has no .throw
400
364
  // method always terminates the yield* loop.
401
365
  context.delegate = null;
402
-
403
366
  if (context.method === "throw") {
404
367
  // Note: ["return"] must be used for ES3 parsing compatibility.
405
368
  if (delegate.iterator["return"]) {
@@ -408,51 +371,45 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
408
371
  context.method = "return";
409
372
  context.arg = undefined$1;
410
373
  maybeInvokeDelegate(delegate, context);
411
-
412
374
  if (context.method === "throw") {
413
375
  // If maybeInvokeDelegate(context) changed context.method from
414
376
  // "return" to "throw", let that override the TypeError below.
415
377
  return ContinueSentinel;
416
378
  }
417
379
  }
418
-
419
380
  context.method = "throw";
420
381
  context.arg = new TypeError("The iterator does not provide a 'throw' method");
421
382
  }
422
-
423
383
  return ContinueSentinel;
424
384
  }
425
-
426
385
  var record = tryCatch(method, delegate.iterator, context.arg);
427
-
428
386
  if (record.type === "throw") {
429
387
  context.method = "throw";
430
388
  context.arg = record.arg;
431
389
  context.delegate = null;
432
390
  return ContinueSentinel;
433
391
  }
434
-
435
392
  var info = record.arg;
436
-
437
393
  if (!info) {
438
394
  context.method = "throw";
439
395
  context.arg = new TypeError("iterator result is not an object");
440
396
  context.delegate = null;
441
397
  return ContinueSentinel;
442
398
  }
443
-
444
399
  if (info.done) {
445
400
  // Assign the result of the finished delegate to the temporary
446
401
  // variable specified by delegate.resultName (see delegateYield).
447
- context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield).
402
+ context[delegate.resultName] = info.value;
403
+
404
+ // Resume execution at the desired location (see delegateYield).
405
+ context.next = delegate.nextLoc;
448
406
 
449
- context.next = delegate.nextLoc; // If context.method was "throw" but the delegate handled the
407
+ // If context.method was "throw" but the delegate handled the
450
408
  // exception, let the outer generator proceed normally. If
451
409
  // context.method was "next", forget context.arg since it has been
452
410
  // "consumed" by the delegate iterator. If context.method was
453
411
  // "return", allow the original .return call to continue in the
454
412
  // outer generator.
455
-
456
413
  if (context.method !== "return") {
457
414
  context.method = "next";
458
415
  context.arg = undefined$1;
@@ -460,54 +417,49 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
460
417
  } else {
461
418
  // Re-yield the result returned by the delegate method.
462
419
  return info;
463
- } // The delegate iterator is finished, so forget it and continue with
464
- // the outer generator.
465
-
420
+ }
466
421
 
422
+ // The delegate iterator is finished, so forget it and continue with
423
+ // the outer generator.
467
424
  context.delegate = null;
468
425
  return ContinueSentinel;
469
- } // Define Generator.prototype.{next,throw,return} in terms of the
470
- // unified ._invoke helper method.
471
-
426
+ }
472
427
 
428
+ // Define Generator.prototype.{next,throw,return} in terms of the
429
+ // unified ._invoke helper method.
473
430
  defineIteratorMethods(Gp);
474
- define(Gp, toStringTagSymbol, "Generator"); // A Generator should always return itself as the iterator object when the
431
+ define(Gp, toStringTagSymbol, "Generator");
432
+
433
+ // A Generator should always return itself as the iterator object when the
475
434
  // @@iterator function is called on it. Some browsers' implementations of the
476
435
  // iterator prototype chain incorrectly implement this, causing the Generator
477
436
  // object to not be returned from this call. This ensures that doesn't happen.
478
437
  // See https://github.com/facebook/regenerator/issues/274 for more details.
479
-
480
438
  define(Gp, iteratorSymbol, function () {
481
439
  return this;
482
440
  });
483
441
  define(Gp, "toString", function () {
484
442
  return "[object Generator]";
485
443
  });
486
-
487
444
  function pushTryEntry(locs) {
488
445
  var entry = {
489
446
  tryLoc: locs[0]
490
447
  };
491
-
492
448
  if (1 in locs) {
493
449
  entry.catchLoc = locs[1];
494
450
  }
495
-
496
451
  if (2 in locs) {
497
452
  entry.finallyLoc = locs[2];
498
453
  entry.afterLoc = locs[3];
499
454
  }
500
-
501
455
  this.tryEntries.push(entry);
502
456
  }
503
-
504
457
  function resetTryEntry(entry) {
505
458
  var record = entry.completion || {};
506
459
  record.type = "normal";
507
460
  delete record.arg;
508
461
  entry.completion = record;
509
462
  }
510
-
511
463
  function Context(tryLocsList) {
512
464
  // The root entry object (effectively a try statement without a catch
513
465
  // or a finally block) gives us a place to store values thrown from
@@ -518,97 +470,84 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
518
470
  tryLocsList.forEach(pushTryEntry, this);
519
471
  this.reset(true);
520
472
  }
521
-
522
473
  exports.keys = function (object) {
523
474
  var keys = [];
524
-
525
475
  for (var key in object) {
526
476
  keys.push(key);
527
477
  }
478
+ keys.reverse();
528
479
 
529
- keys.reverse(); // Rather than returning an object with a next method, we keep
480
+ // Rather than returning an object with a next method, we keep
530
481
  // things simple and return the next function itself.
531
-
532
482
  return function next() {
533
483
  while (keys.length) {
534
484
  var key = keys.pop();
535
-
536
485
  if (key in object) {
537
486
  next.value = key;
538
487
  next.done = false;
539
488
  return next;
540
489
  }
541
- } // To avoid creating an additional object, we just hang the .value
490
+ }
491
+
492
+ // To avoid creating an additional object, we just hang the .value
542
493
  // and .done properties off the next function object itself. This
543
494
  // also ensures that the minifier will not anonymize the function.
544
-
545
-
546
495
  next.done = true;
547
496
  return next;
548
497
  };
549
498
  };
550
-
551
499
  function values(iterable) {
552
500
  if (iterable) {
553
501
  var iteratorMethod = iterable[iteratorSymbol];
554
-
555
502
  if (iteratorMethod) {
556
503
  return iteratorMethod.call(iterable);
557
504
  }
558
-
559
505
  if (typeof iterable.next === "function") {
560
506
  return iterable;
561
507
  }
562
-
563
508
  if (!isNaN(iterable.length)) {
564
509
  var i = -1,
565
- next = function next() {
566
- while (++i < iterable.length) {
567
- if (hasOwn.call(iterable, i)) {
568
- next.value = iterable[i];
569
- next.done = false;
570
- return next;
510
+ next = function next() {
511
+ while (++i < iterable.length) {
512
+ if (hasOwn.call(iterable, i)) {
513
+ next.value = iterable[i];
514
+ next.done = false;
515
+ return next;
516
+ }
571
517
  }
572
- }
573
-
574
- next.value = undefined$1;
575
- next.done = true;
576
- return next;
577
- };
578
-
518
+ next.value = undefined$1;
519
+ next.done = true;
520
+ return next;
521
+ };
579
522
  return next.next = next;
580
523
  }
581
- } // Return an iterator with no values.
582
-
524
+ }
583
525
 
526
+ // Return an iterator with no values.
584
527
  return {
585
528
  next: doneResult
586
529
  };
587
530
  }
588
-
589
531
  exports.values = values;
590
-
591
532
  function doneResult() {
592
533
  return {
593
534
  value: undefined$1,
594
535
  done: true
595
536
  };
596
537
  }
597
-
598
538
  Context.prototype = {
599
539
  constructor: Context,
600
540
  reset: function reset(skipTempReset) {
601
541
  this.prev = 0;
602
- this.next = 0; // Resetting context._sent for legacy support of Babel's
542
+ this.next = 0;
543
+ // Resetting context._sent for legacy support of Babel's
603
544
  // function.sent implementation.
604
-
605
545
  this.sent = this._sent = undefined$1;
606
546
  this.done = false;
607
547
  this.delegate = null;
608
548
  this.method = "next";
609
549
  this.arg = undefined$1;
610
550
  this.tryEntries.forEach(resetTryEntry);
611
-
612
551
  if (!skipTempReset) {
613
552
  for (var name in this) {
614
553
  // Not sure about the optimal order of these conditions:
@@ -622,50 +561,40 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
622
561
  this.done = true;
623
562
  var rootEntry = this.tryEntries[0];
624
563
  var rootRecord = rootEntry.completion;
625
-
626
564
  if (rootRecord.type === "throw") {
627
565
  throw rootRecord.arg;
628
566
  }
629
-
630
567
  return this.rval;
631
568
  },
632
569
  dispatchException: function dispatchException(exception) {
633
570
  if (this.done) {
634
571
  throw exception;
635
572
  }
636
-
637
573
  var context = this;
638
-
639
574
  function handle(loc, caught) {
640
575
  record.type = "throw";
641
576
  record.arg = exception;
642
577
  context.next = loc;
643
-
644
578
  if (caught) {
645
579
  // If the dispatched exception was caught by a catch block,
646
580
  // then let that catch block handle the exception normally.
647
581
  context.method = "next";
648
582
  context.arg = undefined$1;
649
583
  }
650
-
651
584
  return !!caught;
652
585
  }
653
-
654
586
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
655
587
  var entry = this.tryEntries[i];
656
588
  var record = entry.completion;
657
-
658
589
  if (entry.tryLoc === "root") {
659
590
  // Exception thrown outside of any try block that could handle
660
591
  // it, so set the completion value of the entire function to
661
592
  // throw the exception.
662
593
  return handle("end");
663
594
  }
664
-
665
595
  if (entry.tryLoc <= this.prev) {
666
596
  var hasCatch = hasOwn.call(entry, "catchLoc");
667
597
  var hasFinally = hasOwn.call(entry, "finallyLoc");
668
-
669
598
  if (hasCatch && hasFinally) {
670
599
  if (this.prev < entry.catchLoc) {
671
600
  return handle(entry.catchLoc, true);
@@ -689,36 +618,30 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
689
618
  abrupt: function abrupt(type, arg) {
690
619
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
691
620
  var entry = this.tryEntries[i];
692
-
693
621
  if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
694
622
  var finallyEntry = entry;
695
623
  break;
696
624
  }
697
625
  }
698
-
699
626
  if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
700
627
  // Ignore the finally entry if control is not jumping to a
701
628
  // location outside the try/catch block.
702
629
  finallyEntry = null;
703
630
  }
704
-
705
631
  var record = finallyEntry ? finallyEntry.completion : {};
706
632
  record.type = type;
707
633
  record.arg = arg;
708
-
709
634
  if (finallyEntry) {
710
635
  this.method = "next";
711
636
  this.next = finallyEntry.finallyLoc;
712
637
  return ContinueSentinel;
713
638
  }
714
-
715
639
  return this.complete(record);
716
640
  },
717
641
  complete: function complete(record, afterLoc) {
718
642
  if (record.type === "throw") {
719
643
  throw record.arg;
720
644
  }
721
-
722
645
  if (record.type === "break" || record.type === "continue") {
723
646
  this.next = record.arg;
724
647
  } else if (record.type === "return") {
@@ -728,13 +651,11 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
728
651
  } else if (record.type === "normal" && afterLoc) {
729
652
  this.next = afterLoc;
730
653
  }
731
-
732
654
  return ContinueSentinel;
733
655
  },
734
656
  finish: function finish(finallyLoc) {
735
657
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
736
658
  var entry = this.tryEntries[i];
737
-
738
659
  if (entry.finallyLoc === finallyLoc) {
739
660
  this.complete(entry.completion, entry.afterLoc);
740
661
  resetTryEntry(entry);
@@ -745,21 +666,18 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
745
666
  "catch": function _catch(tryLoc) {
746
667
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
747
668
  var entry = this.tryEntries[i];
748
-
749
669
  if (entry.tryLoc === tryLoc) {
750
670
  var record = entry.completion;
751
-
752
671
  if (record.type === "throw") {
753
672
  var thrown = record.arg;
754
673
  resetTryEntry(entry);
755
674
  }
756
-
757
675
  return thrown;
758
676
  }
759
- } // The context.catch method must only be called with a location
760
- // argument that corresponds to a known catch block.
761
-
677
+ }
762
678
 
679
+ // The context.catch method must only be called with a location
680
+ // argument that corresponds to a known catch block.
763
681
  throw new Error("illegal catch attempt");
764
682
  },
765
683
  delegateYield: function delegateYield(iterable, resultName, nextLoc) {
@@ -768,27 +686,26 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
768
686
  resultName: resultName,
769
687
  nextLoc: nextLoc
770
688
  };
771
-
772
689
  if (this.method === "next") {
773
690
  // Deliberately forget the last sent value so that we don't
774
691
  // accidentally pass it on to the delegate.
775
692
  this.arg = undefined$1;
776
693
  }
777
-
778
694
  return ContinueSentinel;
779
695
  }
780
- }; // Regardless of whether this script is executing as a CommonJS module
696
+ };
697
+
698
+ // Regardless of whether this script is executing as a CommonJS module
781
699
  // or not, return the runtime object so that we can declare the variable
782
700
  // regeneratorRuntime in the outer scope, which allows this module to be
783
701
  // injected easily by `bin/regenerator --include-runtime script.js`.
784
-
785
702
  return exports;
786
- }( // If this script is executing as a CommonJS module, use module.exports
703
+ }(
704
+ // If this script is executing as a CommonJS module, use module.exports
787
705
  // as the regeneratorRuntime namespace. Otherwise create a new empty
788
706
  // object. Either way, the resulting object will be used to initialize
789
707
  // the regeneratorRuntime variable at the top of this file.
790
708
  module.exports );
791
-
792
709
  try {
793
710
  regeneratorRuntime = runtime;
794
711
  } catch (accidentalStrictMode) {
@@ -812,7 +729,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
812
729
 
813
730
  function getError(errors, status) {
814
731
  var _errors;
815
-
816
732
  errors = (_errors = errors) != null ? _errors : [{
817
733
  message: 'Failed to fetch Shopify API'
818
734
  }];
@@ -824,7 +740,6 @@ function getError(errors, status) {
824
740
  function getAsyncError(_x) {
825
741
  return _getAsyncError.apply(this, arguments);
826
742
  }
827
-
828
743
  function _getAsyncError() {
829
744
  _getAsyncError = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(res) {
830
745
  var data;
@@ -834,11 +749,9 @@ function _getAsyncError() {
834
749
  case 0:
835
750
  _context2.next = 2;
836
751
  return res.json();
837
-
838
752
  case 2:
839
753
  data = _context2.sent;
840
754
  return _context2.abrupt("return", getError(data.errors, res.status));
841
-
842
755
  case 4:
843
756
  case "end":
844
757
  return _context2.stop();
@@ -848,11 +761,9 @@ function _getAsyncError() {
848
761
  }));
849
762
  return _getAsyncError.apply(this, arguments);
850
763
  }
851
-
852
764
  var handleFetchResponse = /*#__PURE__*/function () {
853
765
  var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(res) {
854
766
  var _yield$res$json, data, errors;
855
-
856
767
  return runtime_1.wrap(function _callee$(_context) {
857
768
  while (1) {
858
769
  switch (_context.prev = _context.next) {
@@ -861,32 +772,24 @@ var handleFetchResponse = /*#__PURE__*/function () {
861
772
  _context.next = 9;
862
773
  break;
863
774
  }
864
-
865
775
  _context.next = 3;
866
776
  return res.json();
867
-
868
777
  case 3:
869
778
  _yield$res$json = _context.sent;
870
779
  data = _yield$res$json.data;
871
780
  errors = _yield$res$json.errors;
872
-
873
781
  if (!(errors && errors.length)) {
874
782
  _context.next = 8;
875
783
  break;
876
784
  }
877
-
878
785
  throw getError(errors, res.status);
879
-
880
786
  case 8:
881
787
  return _context.abrupt("return", data);
882
-
883
788
  case 9:
884
789
  _context.next = 11;
885
790
  return getAsyncError(res);
886
-
887
791
  case 11:
888
792
  throw _context.sent;
889
-
890
793
  case 12:
891
794
  case "end":
892
795
  return _context.stop();
@@ -894,7 +797,6 @@ var handleFetchResponse = /*#__PURE__*/function () {
894
797
  }
895
798
  }, _callee);
896
799
  }));
897
-
898
800
  return function handleFetchResponse(_x2) {
899
801
  return _ref.apply(this, arguments);
900
802
  };
@@ -908,9 +810,7 @@ var getSortVariables = function getSortVariables(sort, isCategory) {
908
810
  if (isCategory === void 0) {
909
811
  isCategory = false;
910
812
  }
911
-
912
813
  var output = {};
913
-
914
814
  switch (sort) {
915
815
  case 'price-asc':
916
816
  output = {
@@ -918,21 +818,18 @@ var getSortVariables = function getSortVariables(sort, isCategory) {
918
818
  reverse: false
919
819
  };
920
820
  break;
921
-
922
821
  case 'price-desc':
923
822
  output = {
924
823
  sortKey: 'PRICE',
925
824
  reverse: true
926
825
  };
927
826
  break;
928
-
929
827
  case 'trending-desc':
930
828
  output = {
931
829
  sortKey: 'BEST_SELLING',
932
830
  reverse: false
933
831
  };
934
832
  break;
935
-
936
833
  case 'latest-desc':
937
834
  output = {
938
835
  sortKey: isCategory ? 'CREATED' : 'CREATED_AT',
@@ -940,28 +837,24 @@ var getSortVariables = function getSortVariables(sort, isCategory) {
940
837
  };
941
838
  break;
942
839
  }
943
-
944
840
  return output;
945
841
  };
946
842
 
947
843
  var getSearchVariables = function getSearchVariables(_ref) {
948
844
  var brandId = _ref.brandId,
949
- search = _ref.search,
950
- categoryId = _ref.categoryId,
951
- sort = _ref.sort,
952
- locale = _ref.locale,
953
- count = _ref.count;
845
+ search = _ref.search,
846
+ categoryId = _ref.categoryId,
847
+ sort = _ref.sort,
848
+ locale = _ref.locale,
849
+ count = _ref.count;
954
850
  var query = "";
955
851
  var searchQuery = search + "*";
956
-
957
852
  if (search) {
958
853
  query += "product_type:" + searchQuery + " OR title:" + searchQuery + " OR tag:" + searchQuery;
959
854
  }
960
-
961
855
  if (brandId) {
962
856
  query += (search ? "AND " : "") + "vendor:" + brandId;
963
857
  }
964
-
965
858
  return _extends({
966
859
  categoryId: categoryId,
967
860
  query: query
@@ -976,7 +869,6 @@ var getSearchVariables = function getSearchVariables(_ref) {
976
869
  Forked from https://github.com/vercel/commerce/tree/main/packages/shopify/src
977
870
  Changes: None
978
871
  */
979
-
980
872
  var getCheckoutId = function getCheckoutId(id) {
981
873
  return id != null ? id : Cookies.get(SHOPIFY_CHECKOUT_ID_COOKIE);
982
874
  };
@@ -985,25 +877,18 @@ var getCheckoutId = function getCheckoutId(id) {
985
877
  Forked from https://github.com/vercel/commerce/tree/main/packages/shopify/src
986
878
  Changes: None
987
879
  */
988
- var checkoutDetailsFragment =
989
- /* GraphQL */
990
- "\n fragment checkoutDetails on Checkout {\n id\n webUrl\n subtotalPriceV2 {\n amount\n currencyCode\n }\n totalTaxV2 {\n amount\n currencyCode\n }\n totalPriceV2 {\n amount\n currencyCode\n }\n completedAt\n createdAt\n taxesIncluded\n lineItems(first: 250) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n id\n title\n variant {\n id\n sku\n title\n selectedOptions {\n name\n value\n }\n image {\n originalSrc\n altText\n width\n height\n }\n priceV2 {\n amount\n currencyCode\n }\n compareAtPriceV2 {\n amount\n currencyCode\n }\n product {\n handle\n }\n }\n quantity\n }\n }\n }\n }\n";
991
- var getCheckoutQuery =
992
- /* GraphQL */
993
- "\n query getCheckout($checkoutId: ID!) {\n node(id: $checkoutId) {\n ...checkoutDetails\n }\n }\n " + checkoutDetailsFragment + "\n";
880
+ var checkoutDetailsFragment = /* GraphQL */"\n fragment checkoutDetails on Checkout {\n id\n webUrl\n subtotalPriceV2 {\n amount\n currencyCode\n }\n totalTaxV2 {\n amount\n currencyCode\n }\n totalPriceV2 {\n amount\n currencyCode\n }\n completedAt\n createdAt\n taxesIncluded\n lineItems(first: 250) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n id\n title\n variant {\n id\n sku\n title\n selectedOptions {\n name\n value\n }\n image {\n originalSrc\n altText\n width\n height\n }\n priceV2 {\n amount\n currencyCode\n }\n compareAtPriceV2 {\n amount\n currencyCode\n }\n product {\n handle\n }\n }\n quantity\n }\n }\n }\n }\n";
881
+ var getCheckoutQuery = /* GraphQL */"\n query getCheckout($checkoutId: ID!) {\n node(id: $checkoutId) {\n ...checkoutDetails\n }\n }\n " + checkoutDetailsFragment + "\n";
994
882
 
995
883
  /*
996
884
  Forked from https://github.com/vercel/commerce/tree/main/packages/shopify/src
997
885
  Changes: None
998
886
  */
999
- var checkoutCreateMutation =
1000
- /* GraphQL */
1001
- "\n mutation checkoutCreate($input: CheckoutCreateInput = {}) {\n checkoutCreate(input: $input) {\n checkoutUserErrors {\n code\n field\n message\n }\n checkout {\n ...checkoutDetails\n }\n }\n }\n\n " + checkoutDetailsFragment + "\n";
887
+ var checkoutCreateMutation = /* GraphQL */"\n mutation checkoutCreate($input: CheckoutCreateInput = {}) {\n checkoutCreate(input: $input) {\n checkoutUserErrors {\n code\n field\n message\n }\n checkout {\n ...checkoutDetails\n }\n }\n }\n\n " + checkoutDetailsFragment + "\n";
1002
888
 
1003
889
  var checkoutCreate = /*#__PURE__*/function () {
1004
890
  var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(fetch, lineItems) {
1005
891
  var _yield$fetch, checkoutCreate, checkout, checkoutId, options;
1006
-
1007
892
  return runtime_1.wrap(function _callee$(_context) {
1008
893
  while (1) {
1009
894
  switch (_context.prev = _context.next) {
@@ -1017,12 +902,10 @@ var checkoutCreate = /*#__PURE__*/function () {
1017
902
  }
1018
903
  }
1019
904
  });
1020
-
1021
905
  case 2:
1022
906
  _yield$fetch = _context.sent;
1023
907
  checkoutCreate = _yield$fetch.checkoutCreate;
1024
908
  checkout = checkoutCreate == null ? void 0 : checkoutCreate.checkout;
1025
-
1026
909
  if (checkout) {
1027
910
  checkoutId = checkout == null ? void 0 : checkout.id;
1028
911
  options = {
@@ -1031,14 +914,11 @@ var checkoutCreate = /*#__PURE__*/function () {
1031
914
  secure: true
1032
915
  };
1033
916
  Cookies.set(SHOPIFY_CHECKOUT_ID_COOKIE, checkoutId, options);
1034
-
1035
917
  if (checkout != null && checkout.webUrl) {
1036
918
  Cookies.set(SHOPIFY_CHECKOUT_URL_COOKIE, checkout.webUrl, options);
1037
919
  }
1038
920
  }
1039
-
1040
921
  return _context.abrupt("return", checkoutCreate);
1041
-
1042
922
  case 7:
1043
923
  case "end":
1044
924
  return _context.stop();
@@ -1046,7 +926,6 @@ var checkoutCreate = /*#__PURE__*/function () {
1046
926
  }
1047
927
  }, _callee);
1048
928
  }));
1049
-
1050
929
  return function checkoutCreate(_x, _x2) {
1051
930
  return _ref.apply(this, arguments);
1052
931
  };
@@ -1212,25 +1091,22 @@ var colorMap = {
1212
1091
  };
1213
1092
 
1214
1093
  var _excluded = ["originalSrc"],
1215
- _excluded2 = ["id", "title", "vendor", "images", "variants", "description", "descriptionHtml", "handle", "priceRange", "options", "metafields"];
1216
-
1094
+ _excluded2 = ["id", "title", "vendor", "images", "variants", "description", "descriptionHtml", "handle", "priceRange", "options", "metafields"];
1217
1095
  var money = function money(_ref) {
1218
1096
  var amount = _ref.amount,
1219
- currencyCode = _ref.currencyCode;
1097
+ currencyCode = _ref.currencyCode;
1220
1098
  return {
1221
1099
  value: +amount,
1222
1100
  currencyCode: currencyCode
1223
1101
  };
1224
1102
  };
1225
-
1226
1103
  var isDefaultOption = function isDefaultOption(selectedOption) {
1227
1104
  return selectedOption.name === "Title";
1228
1105
  };
1229
-
1230
1106
  var normalizeProductOption = function normalizeProductOption(_ref2) {
1231
1107
  var id = _ref2.id,
1232
- displayName = _ref2.name,
1233
- values = _ref2.values;
1108
+ displayName = _ref2.name,
1109
+ values = _ref2.values;
1234
1110
  return {
1235
1111
  __typename: 'MultipleChoiceOption',
1236
1112
  id: id,
@@ -1239,47 +1115,41 @@ var normalizeProductOption = function normalizeProductOption(_ref2) {
1239
1115
  var output = {
1240
1116
  label: value
1241
1117
  };
1242
-
1243
1118
  if (displayName.match(/colou?r/gi)) {
1244
1119
  var mapedColor = colorMap[value.toLowerCase().replace(/ /g, '')];
1245
-
1246
1120
  if (mapedColor) {
1247
1121
  output = _extends({}, output, {
1248
1122
  hexColors: [mapedColor]
1249
1123
  });
1250
1124
  }
1251
1125
  }
1252
-
1253
1126
  return output;
1254
1127
  })
1255
1128
  };
1256
1129
  };
1257
-
1258
1130
  var normalizeProductImages = function normalizeProductImages(_ref3) {
1259
1131
  var edges = _ref3.edges;
1260
1132
  return edges == null ? void 0 : edges.map(function (_ref4) {
1261
1133
  var _ref4$node = _ref4.node,
1262
- url = _ref4$node.originalSrc,
1263
- rest = _objectWithoutPropertiesLoose(_ref4$node, _excluded);
1264
-
1134
+ url = _ref4$node.originalSrc,
1135
+ rest = _objectWithoutPropertiesLoose(_ref4$node, _excluded);
1265
1136
  return _extends({
1266
1137
  url: url
1267
1138
  }, rest);
1268
1139
  });
1269
1140
  };
1270
-
1271
1141
  var normalizeProductVariants = function normalizeProductVariants(_ref5) {
1272
1142
  var edges = _ref5.edges;
1273
1143
  return edges == null ? void 0 : edges.map(function (_ref6) {
1274
1144
  var _ref6$node = _ref6.node,
1275
- id = _ref6$node.id,
1276
- selectedOptions = _ref6$node.selectedOptions,
1277
- sku = _ref6$node.sku,
1278
- title = _ref6$node.title,
1279
- priceV2 = _ref6$node.priceV2,
1280
- compareAtPriceV2 = _ref6$node.compareAtPriceV2,
1281
- requiresShipping = _ref6$node.requiresShipping,
1282
- availableForSale = _ref6$node.availableForSale;
1145
+ id = _ref6$node.id,
1146
+ selectedOptions = _ref6$node.selectedOptions,
1147
+ sku = _ref6$node.sku,
1148
+ title = _ref6$node.title,
1149
+ priceV2 = _ref6$node.priceV2,
1150
+ compareAtPriceV2 = _ref6$node.compareAtPriceV2,
1151
+ requiresShipping = _ref6$node.requiresShipping,
1152
+ availableForSale = _ref6$node.availableForSale;
1283
1153
  return {
1284
1154
  id: id,
1285
1155
  name: selectedOptions.some(function (o) {
@@ -1292,7 +1162,7 @@ var normalizeProductVariants = function normalizeProductVariants(_ref5) {
1292
1162
  availableForSale: availableForSale,
1293
1163
  options: selectedOptions.map(function (_ref7) {
1294
1164
  var name = _ref7.name,
1295
- value = _ref7.value;
1165
+ value = _ref7.value;
1296
1166
  var options = normalizeProductOption({
1297
1167
  id: id,
1298
1168
  name: name,
@@ -1303,20 +1173,18 @@ var normalizeProductVariants = function normalizeProductVariants(_ref5) {
1303
1173
  };
1304
1174
  });
1305
1175
  };
1306
-
1307
1176
  function normalizeProduct(_ref8) {
1308
1177
  var id = _ref8.id,
1309
- name = _ref8.title,
1310
- vendor = _ref8.vendor,
1311
- images = _ref8.images,
1312
- variants = _ref8.variants,
1313
- description = _ref8.description,
1314
- descriptionHtml = _ref8.descriptionHtml,
1315
- handle = _ref8.handle,
1316
- priceRange = _ref8.priceRange,
1317
- options = _ref8.options,
1318
- rest = _objectWithoutPropertiesLoose(_ref8, _excluded2);
1319
-
1178
+ name = _ref8.title,
1179
+ vendor = _ref8.vendor,
1180
+ images = _ref8.images,
1181
+ variants = _ref8.variants,
1182
+ description = _ref8.description,
1183
+ descriptionHtml = _ref8.descriptionHtml,
1184
+ handle = _ref8.handle,
1185
+ priceRange = _ref8.priceRange,
1186
+ options = _ref8.options,
1187
+ rest = _objectWithoutPropertiesLoose(_ref8, _excluded2);
1320
1188
  return _extends({
1321
1189
  id: id,
1322
1190
  name: name,
@@ -1340,7 +1208,6 @@ function normalizeProduct(_ref8) {
1340
1208
  }
1341
1209
  function normalizeCart(checkout) {
1342
1210
  var _checkout$totalPriceV, _checkout$lineItems, _checkout$subtotalPri, _checkout$subtotalPri2, _checkout$totalPriceV2;
1343
-
1344
1211
  return {
1345
1212
  id: checkout.id,
1346
1213
  url: checkout.webUrl,
@@ -1358,15 +1225,13 @@ function normalizeCart(checkout) {
1358
1225
  discounts: []
1359
1226
  };
1360
1227
  }
1361
-
1362
1228
  function normalizeLineItem(_ref9) {
1363
1229
  var _variant$sku, _variant$image, _variant$requiresShip, _variant$priceV, _variant$compareAtPri, _variant$product;
1364
-
1365
1230
  var _ref9$node = _ref9.node,
1366
- id = _ref9$node.id,
1367
- title = _ref9$node.title,
1368
- variant = _ref9$node.variant,
1369
- quantity = _ref9$node.quantity;
1231
+ id = _ref9$node.id,
1232
+ title = _ref9$node.title,
1233
+ variant = _ref9$node.variant,
1234
+ quantity = _ref9$node.quantity;
1370
1235
  return {
1371
1236
  id: id,
1372
1237
  variantId: String(variant == null ? void 0 : variant.id),
@@ -1402,13 +1267,11 @@ export const normalizePage = (
1402
1267
  export const normalizePages = (edges: PageEdge[], locale?: string): Page[] =>
1403
1268
  edges?.map((edge) => normalizePage(edge.node, locale))
1404
1269
  */
1405
-
1406
-
1407
1270
  var normalizeCategory = function normalizeCategory(_ref10) {
1408
1271
  var name = _ref10.title,
1409
- handle = _ref10.handle,
1410
- id = _ref10.id,
1411
- products = _ref10.products;
1272
+ handle = _ref10.handle,
1273
+ id = _ref10.id,
1274
+ products = _ref10.products;
1412
1275
  return {
1413
1276
  id: id,
1414
1277
  name: name,
@@ -1422,23 +1285,20 @@ var normalizeCategory = function normalizeCategory(_ref10) {
1422
1285
  Forked from https://github.com/vercel/commerce/tree/main/packages/shopify/src
1423
1286
  Changes: None
1424
1287
  */
1425
-
1426
1288
  var getCustomMessage = function getCustomMessage(code, message) {
1427
1289
  switch (code) {
1428
1290
  case 'UNIDENTIFIED_CUSTOMER':
1429
1291
  message = 'Cannot find an account that matches the provided credentials';
1430
1292
  break;
1431
1293
  }
1432
-
1433
1294
  return message;
1434
1295
  };
1435
-
1436
1296
  var throwUserErrors = function throwUserErrors(errors) {
1437
1297
  if (errors && errors.length) {
1438
1298
  throw new ValidationError({
1439
1299
  errors: errors.map(function (_ref) {
1440
1300
  var code = _ref.code,
1441
- message = _ref.message;
1301
+ message = _ref.message;
1442
1302
  return {
1443
1303
  code: code != null ? code : 'validation_error',
1444
1304
  message: getCustomMessage(code, message)
@@ -1450,94 +1310,69 @@ var throwUserErrors = function throwUserErrors(errors) {
1450
1310
 
1451
1311
  var checkoutToCart = function checkoutToCart(checkoutPayload) {
1452
1312
  throwUserErrors(checkoutPayload == null ? void 0 : checkoutPayload.checkoutUserErrors);
1453
-
1454
1313
  if (!(checkoutPayload != null && checkoutPayload.checkout)) {
1455
1314
  throw new CommerceError({
1456
1315
  message: 'Missing checkout object from response'
1457
1316
  });
1458
1317
  }
1459
-
1460
1318
  return normalizeCart(checkoutPayload == null ? void 0 : checkoutPayload.checkout);
1461
1319
  };
1462
1320
 
1463
1321
  var simpleProductConnection = "\nfragment simpleProductConnection on ProductConnection {\n edges {\n node {\n id\n }\n }\n}\n";
1464
1322
  var collectionFieldsFragment = "\n fragment collectionFieldsFragment on Collection {\n id\n title\n handle,\n products(first: $first) {\n ...simpleProductConnection\n }\n }\n " + simpleProductConnection + "\n";
1465
- var getCollectionQueryById =
1466
- /* GraphQL */
1467
- "\n query getSiteCollection($id: ID, $handle: String, $first: Int = 1) {\n collection(id: $id, handle: $handle) {\n ...collectionFieldsFragment\n }\n }\n " + collectionFieldsFragment + "\n";
1323
+ var getCollectionQueryById = /* GraphQL */"\n query getSiteCollection($id: ID, $handle: String, $first: Int = 1) {\n collection(id: $id, handle: $handle) {\n ...collectionFieldsFragment\n }\n }\n " + collectionFieldsFragment + "\n";
1468
1324
 
1469
1325
  /*
1470
1326
  Forked from https://github.com/vercel/commerce/tree/main/packages/shopify/src
1471
1327
  Changes: None
1472
1328
  */
1473
-
1474
- var getSiteCollectionsQuery =
1475
- /* GraphQL */
1476
- "\n query getSiteCollections($first: Int!) {\n collections(first: $first) {\n edges {\n node {\n ...collectionFieldsFragment\n }\n }\n }\n }\n\n " + collectionFieldsFragment + "\n";
1329
+ var getSiteCollectionsQuery = /* GraphQL */"\n query getSiteCollections($first: Int!) {\n collections(first: $first) {\n edges {\n node {\n ...collectionFieldsFragment\n }\n }\n }\n }\n\n " + collectionFieldsFragment + "\n";
1477
1330
 
1478
1331
  /*
1479
1332
  Forked from https://github.com/vercel/commerce/tree/main/packages/shopify/src
1480
1333
  Changes: Added query by product id
1481
1334
  */
1482
1335
  var productFieldsFragment = "\n fragment productFields on Product {\n id\n handle\n availableForSale\n title\n productType\n vendor\n description\n descriptionHtml\n options {\n id\n name\n values\n }\n priceRange {\n maxVariantPrice {\n amount\n currencyCode\n }\n minVariantPrice {\n amount\n currencyCode\n }\n }\n variants(first: 250) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n id\n title\n sku\n availableForSale\n requiresShipping\n selectedOptions {\n name\n value\n }\n priceV2 {\n amount\n currencyCode\n }\n compareAtPriceV2 {\n amount\n currencyCode\n }\n }\n }\n }\n images(first: 250) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n originalSrc\n altText\n width\n height\n }\n }\n }\n }\n";
1483
- var getProductQueryBySlug =
1484
- /* GraphQL */
1485
- "\n query getProductBySlug($slug: String!) {\n productByHandle(handle: $slug) {\n ...productFields\n }\n }\n\n " + productFieldsFragment + "\n";
1486
- var getProductQueryById =
1487
- /* GraphQL */
1488
- "\n query getProductById($id: ID!) {\n product(id: $id) {\n ...productFields\n }\n }\n\n " + productFieldsFragment + "\n";
1336
+ var getProductQueryBySlug = /* GraphQL */"\n query getProductBySlug($slug: String!) {\n productByHandle(handle: $slug) {\n ...productFields\n }\n }\n\n " + productFieldsFragment + "\n";
1337
+ var getProductQueryById = /* GraphQL */"\n query getProductById($id: ID!) {\n product(id: $id) {\n ...productFields\n }\n }\n\n " + productFieldsFragment + "\n";
1489
1338
 
1490
1339
  /*
1491
1340
  Forked from https://github.com/vercel/commerce/tree/main/packages/shopify/src
1492
1341
  Changes:
1493
1342
  - Added variants info to the query
1494
1343
  */
1495
- var productConnectionFragment =
1496
- /* GraphQL */
1497
- "\n fragment productConnection on ProductConnection {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n id\n handle\n title\n vendor\n handle\n description\n descriptionHtml\n priceRange {\n minVariantPrice {\n amount\n currencyCode\n }\n }\n options {\n id\n name\n values\n }\n variants(first: 250) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n id\n title\n sku\n availableForSale\n requiresShipping\n selectedOptions {\n name\n value\n }\n priceV2 {\n amount\n currencyCode\n }\n compareAtPriceV2 {\n amount\n currencyCode\n }\n }\n }\n }\n images(first: 250) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n originalSrc\n altText\n width\n height\n }\n }\n }\n }\n }\n }\n";
1498
- var getAllProductsQuery =
1499
- /* GraphQL */
1500
- "\n query getAllProducts(\n $first: Int = 250\n $query: String = \"\"\n $sortKey: ProductSortKeys = RELEVANCE\n $reverse: Boolean = false\n ) {\n products(\n first: $first\n sortKey: $sortKey\n reverse: $reverse\n query: $query\n ) {\n ...productConnection\n }\n }\n\n " + productConnectionFragment + "\n";
1344
+ var productConnectionFragment = /* GraphQL */"\n fragment productConnection on ProductConnection {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n id\n handle\n title\n vendor\n handle\n description\n descriptionHtml\n priceRange {\n minVariantPrice {\n amount\n currencyCode\n }\n }\n options {\n id\n name\n values\n }\n variants(first: 250) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n id\n title\n sku\n availableForSale\n requiresShipping\n selectedOptions {\n name\n value\n }\n priceV2 {\n amount\n currencyCode\n }\n compareAtPriceV2 {\n amount\n currencyCode\n }\n }\n }\n }\n images(first: 250) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n originalSrc\n altText\n width\n height\n }\n }\n }\n }\n }\n }\n";
1345
+ var getAllProductsQuery = /* GraphQL */"\n query getAllProducts(\n $first: Int = 250\n $query: String = \"\"\n $sortKey: ProductSortKeys = RELEVANCE\n $reverse: Boolean = false\n ) {\n products(\n first: $first\n sortKey: $sortKey\n reverse: $reverse\n query: $query\n ) {\n ...productConnection\n }\n }\n\n " + productConnectionFragment + "\n";
1501
1346
 
1502
1347
  /*
1503
1348
  Forked from https://github.com/vercel/commerce/tree/main/packages/shopify/src
1504
1349
  Changes: None
1505
1350
  */
1506
- var getAllProductVendors =
1507
- /* GraphQL */
1508
- "\n query getAllProductVendors($first: Int = 250, $cursor: String) {\n products(first: $first, after: $cursor) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n vendor\n }\n cursor\n }\n }\n }\n";
1351
+ var getAllProductVendors = /* GraphQL */"\n query getAllProductVendors($first: Int = 250, $cursor: String) {\n products(first: $first, after: $cursor) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n vendor\n }\n cursor\n }\n }\n }\n";
1509
1352
 
1510
1353
  /*
1511
1354
  Forked from https://github.com/vercel/commerce/tree/main/packages/shopify/src
1512
1355
  Changes: None
1513
1356
  */
1514
- var getCollectionProductsQuery =
1515
- /* GraphQL */
1516
- "\n query getProductsFromCollection(\n $categoryId: ID!\n $first: Int = 250\n $sortKey: ProductCollectionSortKeys = RELEVANCE\n $reverse: Boolean = false\n ) {\n node(id: $categoryId) {\n id\n ... on Collection {\n products(first: $first, sortKey: $sortKey, reverse: $reverse) {\n ...productConnection\n }\n }\n }\n }\n " + productConnectionFragment + "\n";
1357
+ var getCollectionProductsQuery = /* GraphQL */"\n query getProductsFromCollection(\n $categoryId: ID!\n $first: Int = 250\n $sortKey: ProductCollectionSortKeys = RELEVANCE\n $reverse: Boolean = false\n ) {\n node(id: $categoryId) {\n id\n ... on Collection {\n products(first: $first, sortKey: $sortKey, reverse: $reverse) {\n ...productConnection\n }\n }\n }\n }\n " + productConnectionFragment + "\n";
1517
1358
 
1518
1359
  /*
1519
1360
  Forked from https://github.com/vercel/commerce/tree/main/packages/shopify/src
1520
1361
  Changes: None
1521
1362
  */
1522
- var checkoutLineItemAddMutation =
1523
- /* GraphQL */
1524
- "\n mutation checkoutLineItemAdd(\n $checkoutId: ID!\n $lineItems: [CheckoutLineItemInput!]!\n ) {\n checkoutLineItemsAdd(checkoutId: $checkoutId, lineItems: $lineItems) {\n checkoutUserErrors {\n code\n field\n message\n }\n checkout {\n ...checkoutDetails\n }\n }\n }\n\n " + checkoutDetailsFragment + "\n";
1363
+ var checkoutLineItemAddMutation = /* GraphQL */"\n mutation checkoutLineItemAdd(\n $checkoutId: ID!\n $lineItems: [CheckoutLineItemInput!]!\n ) {\n checkoutLineItemsAdd(checkoutId: $checkoutId, lineItems: $lineItems) {\n checkoutUserErrors {\n code\n field\n message\n }\n checkout {\n ...checkoutDetails\n }\n }\n }\n\n " + checkoutDetailsFragment + "\n";
1525
1364
 
1526
1365
  /*
1527
1366
  Forked from https://github.com/vercel/commerce/tree/main/packages/shopify/src
1528
1367
  Changes: None
1529
1368
  */
1530
- var checkoutLineItemUpdateMutation =
1531
- /* GraphQL */
1532
- "\n mutation checkoutLineItemUpdate(\n $checkoutId: ID!\n $lineItems: [CheckoutLineItemUpdateInput!]!\n ) {\n checkoutLineItemsUpdate(checkoutId: $checkoutId, lineItems: $lineItems) {\n checkoutUserErrors {\n code\n field\n message\n }\n checkout {\n ...checkoutDetails\n }\n }\n }\n\n " + checkoutDetailsFragment + "\n";
1369
+ var checkoutLineItemUpdateMutation = /* GraphQL */"\n mutation checkoutLineItemUpdate(\n $checkoutId: ID!\n $lineItems: [CheckoutLineItemUpdateInput!]!\n ) {\n checkoutLineItemsUpdate(checkoutId: $checkoutId, lineItems: $lineItems) {\n checkoutUserErrors {\n code\n field\n message\n }\n checkout {\n ...checkoutDetails\n }\n }\n }\n\n " + checkoutDetailsFragment + "\n";
1533
1370
 
1534
1371
  /*
1535
1372
  Forked from https://github.com/vercel/commerce/tree/main/packages/shopify/src
1536
1373
  Changes: None
1537
1374
  */
1538
- var checkoutLineItemRemoveMutation =
1539
- /* GraphQL */
1540
- "\n mutation checkoutLineItemRemove($checkoutId: ID!, $lineItemIds: [ID!]!) {\n checkoutLineItemsRemove(\n checkoutId: $checkoutId\n lineItemIds: $lineItemIds\n ) {\n checkoutUserErrors {\n code\n field\n message\n }\n checkout {\n ...checkoutDetails\n }\n }\n }\n " + checkoutDetailsFragment + "\n";
1375
+ var checkoutLineItemRemoveMutation = /* GraphQL */"\n mutation checkoutLineItemRemove($checkoutId: ID!, $lineItemIds: [ID!]!) {\n checkoutLineItemsRemove(\n checkoutId: $checkoutId\n lineItemIds: $lineItemIds\n ) {\n checkoutUserErrors {\n code\n field\n message\n }\n checkout {\n ...checkoutDetails\n }\n }\n }\n " + checkoutDetailsFragment + "\n";
1541
1376
 
1542
1377
  var handler = {
1543
1378
  fetchOptions: {
@@ -1546,9 +1381,7 @@ var handler = {
1546
1381
  fetcher: function fetcher(_ref) {
1547
1382
  return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
1548
1383
  var _products, _products2;
1549
-
1550
1384
  var input, options, fetch, categoryId, brandId, method, variables, products, _data$node, _data$node$products, _data$node$products$e, _data$node2, _data$node2$products, data, _data$products, _data;
1551
-
1552
1385
  return runtime_1.wrap(function _callee$(_context) {
1553
1386
  while (1) {
1554
1387
  switch (_context.prev = _context.next) {
@@ -1557,12 +1390,10 @@ var handler = {
1557
1390
  categoryId = input.categoryId, brandId = input.brandId;
1558
1391
  method = options == null ? void 0 : options.method;
1559
1392
  variables = getSearchVariables(input);
1560
-
1561
1393
  if (!categoryId) {
1562
1394
  _context.next = 11;
1563
1395
  break;
1564
1396
  }
1565
-
1566
1397
  _context.next = 7;
1567
1398
  return fetch({
1568
1399
  query: getCollectionProductsQuery,
@@ -1571,7 +1402,6 @@ var handler = {
1571
1402
  first: undefined
1572
1403
  })
1573
1404
  });
1574
-
1575
1405
  case 7:
1576
1406
  data = _context.sent;
1577
1407
  // filter on client when brandId & categoryId are set since is not available on collection product query
@@ -1581,7 +1411,6 @@ var handler = {
1581
1411
  }).slice(0, input.count) : (_data$node2 = data.node) == null ? void 0 : (_data$node2$products = _data$node2.products) == null ? void 0 : _data$node2$products.edges.slice(0, input.count);
1582
1412
  _context.next = 15;
1583
1413
  break;
1584
-
1585
1414
  case 11:
1586
1415
  _context.next = 13;
1587
1416
  return fetch({
@@ -1589,11 +1418,9 @@ var handler = {
1589
1418
  method: method,
1590
1419
  variables: variables
1591
1420
  });
1592
-
1593
1421
  case 13:
1594
1422
  _data = _context.sent;
1595
1423
  products = (_data$products = _data.products) == null ? void 0 : _data$products.edges;
1596
-
1597
1424
  case 15:
1598
1425
  return _context.abrupt("return", {
1599
1426
  products: (_products = products) == null ? void 0 : _products.map(function (_ref3) {
@@ -1602,7 +1429,6 @@ var handler = {
1602
1429
  }),
1603
1430
  found: !!((_products2 = products) != null && _products2.length)
1604
1431
  });
1605
-
1606
1432
  case 16:
1607
1433
  case "end":
1608
1434
  return _context.stop();
@@ -1617,7 +1443,6 @@ var handler = {
1617
1443
  if (input === void 0) {
1618
1444
  input = {};
1619
1445
  }
1620
-
1621
1446
  return useData({
1622
1447
  input: [['search', input.search], ['categoryId', input.categoryId], ['brandId', input.brandId], ['sort', input.sort], ['locale', input.locale], ['count', input.count]],
1623
1448
  swrOptions: _extends({
@@ -1635,29 +1460,23 @@ var handler$1 = {
1635
1460
  fetcher: function fetcher(_ref) {
1636
1461
  return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
1637
1462
  var input, options, fetch, id, product, data, _data;
1638
-
1639
1463
  return runtime_1.wrap(function _callee$(_context) {
1640
1464
  while (1) {
1641
1465
  switch (_context.prev = _context.next) {
1642
1466
  case 0:
1643
1467
  input = _ref.input, options = _ref.options, fetch = _ref.fetch;
1644
1468
  id = input.id;
1645
-
1646
1469
  if (id) {
1647
1470
  _context.next = 4;
1648
1471
  break;
1649
1472
  }
1650
-
1651
1473
  return _context.abrupt("return", null);
1652
-
1653
1474
  case 4:
1654
1475
  product = null;
1655
-
1656
1476
  if (!id.startsWith("gid://shopify")) {
1657
1477
  _context.next = 12;
1658
1478
  break;
1659
1479
  }
1660
-
1661
1480
  _context.next = 8;
1662
1481
  return fetch({
1663
1482
  query: getProductQueryById,
@@ -1665,13 +1484,11 @@ var handler$1 = {
1665
1484
  id: id
1666
1485
  }
1667
1486
  });
1668
-
1669
1487
  case 8:
1670
1488
  data = _context.sent;
1671
1489
  product = data.product;
1672
1490
  _context.next = 16;
1673
1491
  break;
1674
-
1675
1492
  case 12:
1676
1493
  _context.next = 14;
1677
1494
  return fetch({
@@ -1680,17 +1497,13 @@ var handler$1 = {
1680
1497
  slug: id
1681
1498
  }
1682
1499
  });
1683
-
1684
1500
  case 14:
1685
1501
  _data = _context.sent;
1686
-
1687
1502
  if (_data.productByHandle) {
1688
1503
  product = _data.productByHandle;
1689
1504
  }
1690
-
1691
1505
  case 16:
1692
1506
  return _context.abrupt("return", product ? normalizeProduct(product) : null);
1693
-
1694
1507
  case 17:
1695
1508
  case "end":
1696
1509
  return _context.stop();
@@ -1705,7 +1518,6 @@ var handler$1 = {
1705
1518
  if (input === void 0) {
1706
1519
  input = {};
1707
1520
  }
1708
-
1709
1521
  return useData({
1710
1522
  input: [['id', input.id]],
1711
1523
  swrOptions: _extends({
@@ -1723,46 +1535,37 @@ var handler$2 = {
1723
1535
  fetcher: function fetcher(_ref) {
1724
1536
  return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
1725
1537
  var cartId, options, fetch, _yield$fetch, checkout;
1726
-
1727
1538
  return runtime_1.wrap(function _callee$(_context) {
1728
1539
  while (1) {
1729
1540
  switch (_context.prev = _context.next) {
1730
1541
  case 0:
1731
1542
  cartId = _ref.input.cartId, options = _ref.options, fetch = _ref.fetch;
1732
-
1733
1543
  if (!cartId) {
1734
1544
  _context.next = 13;
1735
1545
  break;
1736
1546
  }
1737
-
1738
1547
  _context.next = 4;
1739
1548
  return fetch(_extends({}, options, {
1740
1549
  variables: {
1741
1550
  checkoutId: cartId
1742
1551
  }
1743
1552
  }));
1744
-
1745
1553
  case 4:
1746
1554
  _yield$fetch = _context.sent;
1747
1555
  checkout = _yield$fetch.node;
1748
-
1749
1556
  if (!(checkout != null && checkout.completedAt)) {
1750
1557
  _context.next = 12;
1751
1558
  break;
1752
1559
  }
1753
-
1754
1560
  Cookies.remove(SHOPIFY_CHECKOUT_ID_COOKIE);
1755
1561
  Cookies.remove(SHOPIFY_CHECKOUT_URL_COOKIE);
1756
1562
  return _context.abrupt("return", null);
1757
-
1758
1563
  case 12:
1759
1564
  return _context.abrupt("return", checkoutToCart({
1760
1565
  checkout: checkout
1761
1566
  }));
1762
-
1763
1567
  case 13:
1764
1568
  return _context.abrupt("return", null);
1765
-
1766
1569
  case 14:
1767
1570
  case "end":
1768
1571
  return _context.stop();
@@ -1784,7 +1587,6 @@ var handler$2 = {
1784
1587
  isEmpty: {
1785
1588
  get: function get() {
1786
1589
  var _response$data$lineIt, _response$data;
1787
-
1788
1590
  return ((_response$data$lineIt = (_response$data = response.data) == null ? void 0 : _response$data.lineItems.length) != null ? _response$data$lineIt : 0) <= 0;
1789
1591
  },
1790
1592
  enumerable: true
@@ -1802,44 +1604,35 @@ var handler$3 = {
1802
1604
  fetcher: function fetcher(_ref) {
1803
1605
  return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
1804
1606
  var _item$quantity;
1805
-
1806
1607
  var item, options, fetch, lineItems, checkoutId, _yield$fetch, checkoutLineItemsAdd;
1807
-
1808
1608
  return runtime_1.wrap(function _callee$(_context) {
1809
1609
  while (1) {
1810
1610
  switch (_context.prev = _context.next) {
1811
1611
  case 0:
1812
1612
  item = _ref.input, options = _ref.options, fetch = _ref.fetch;
1813
-
1814
1613
  if (!(item.quantity && (!Number.isInteger(item.quantity) || item.quantity < 1))) {
1815
1614
  _context.next = 3;
1816
1615
  break;
1817
1616
  }
1818
-
1819
1617
  throw new CommerceError({
1820
1618
  message: 'The item quantity has to be a valid integer greater than 0'
1821
1619
  });
1822
-
1823
1620
  case 3:
1824
1621
  lineItems = [{
1825
1622
  variantId: item.variantId,
1826
1623
  quantity: (_item$quantity = item.quantity) != null ? _item$quantity : 1
1827
1624
  }];
1828
1625
  checkoutId = getCheckoutId();
1829
-
1830
1626
  if (checkoutId) {
1831
1627
  _context.next = 13;
1832
1628
  break;
1833
1629
  }
1834
-
1835
1630
  _context.t0 = checkoutToCart;
1836
1631
  _context.next = 9;
1837
1632
  return checkoutCreate(fetch, lineItems);
1838
-
1839
1633
  case 9:
1840
1634
  _context.t1 = _context.sent;
1841
1635
  return _context.abrupt("return", (0, _context.t0)(_context.t1));
1842
-
1843
1636
  case 13:
1844
1637
  _context.next = 15;
1845
1638
  return fetch(_extends({}, options, {
@@ -1848,12 +1641,10 @@ var handler$3 = {
1848
1641
  lineItems: lineItems
1849
1642
  }
1850
1643
  }));
1851
-
1852
1644
  case 15:
1853
1645
  _yield$fetch = _context.sent;
1854
1646
  checkoutLineItemsAdd = _yield$fetch.checkoutLineItemsAdd;
1855
1647
  return _context.abrupt("return", checkoutToCart(checkoutLineItemsAdd));
1856
-
1857
1648
  case 18:
1858
1649
  case "end":
1859
1650
  return _context.stop();
@@ -1866,8 +1657,7 @@ var handler$3 = {
1866
1657
  var fetch = _ref2.fetch;
1867
1658
  return function () {
1868
1659
  var _useCart = useCart(),
1869
- mutate = _useCart.mutate;
1870
-
1660
+ mutate = _useCart.mutate;
1871
1661
  return useCallback( /*#__PURE__*/function () {
1872
1662
  var _addItem = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(input) {
1873
1663
  var data;
@@ -1879,15 +1669,12 @@ var handler$3 = {
1879
1669
  return fetch({
1880
1670
  input: input
1881
1671
  });
1882
-
1883
1672
  case 2:
1884
1673
  data = _context2.sent;
1885
1674
  _context2.next = 5;
1886
1675
  return mutate(data, false);
1887
-
1888
1676
  case 5:
1889
1677
  return _context2.abrupt("return", data);
1890
-
1891
1678
  case 6:
1892
1679
  case "end":
1893
1680
  return _context2.stop();
@@ -1895,11 +1682,9 @@ var handler$3 = {
1895
1682
  }
1896
1683
  }, _callee2);
1897
1684
  }));
1898
-
1899
1685
  function addItem(_x) {
1900
1686
  return _addItem.apply(this, arguments);
1901
1687
  }
1902
-
1903
1688
  return addItem;
1904
1689
  }(), [fetch, mutate]);
1905
1690
  };
@@ -1925,11 +1710,9 @@ var handler$4 = {
1925
1710
  lineItemIds: [itemId]
1926
1711
  }
1927
1712
  }));
1928
-
1929
1713
  case 3:
1930
1714
  data = _context.sent;
1931
1715
  return _context.abrupt("return", checkoutToCart(data.checkoutLineItemsRemove));
1932
-
1933
1716
  case 5:
1934
1717
  case "end":
1935
1718
  return _context.stop();
@@ -1944,33 +1727,26 @@ var handler$4 = {
1944
1727
  if (ctx === void 0) {
1945
1728
  ctx = {};
1946
1729
  }
1947
-
1948
1730
  var _ctx = ctx,
1949
- item = _ctx.item;
1950
-
1731
+ item = _ctx.item;
1951
1732
  var _useCart = useCart(),
1952
- mutate = _useCart.mutate;
1953
-
1733
+ mutate = _useCart.mutate;
1954
1734
  var removeItem = /*#__PURE__*/function () {
1955
1735
  var _ref3 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(input) {
1956
1736
  var _input$id;
1957
-
1958
1737
  var itemId, data;
1959
1738
  return runtime_1.wrap(function _callee2$(_context2) {
1960
1739
  while (1) {
1961
1740
  switch (_context2.prev = _context2.next) {
1962
1741
  case 0:
1963
1742
  itemId = (_input$id = input == null ? void 0 : input.id) != null ? _input$id : item == null ? void 0 : item.id;
1964
-
1965
1743
  if (itemId) {
1966
1744
  _context2.next = 3;
1967
1745
  break;
1968
1746
  }
1969
-
1970
1747
  throw new ValidationError({
1971
1748
  message: 'Invalid input used for this operation'
1972
1749
  });
1973
-
1974
1750
  case 3:
1975
1751
  _context2.next = 5;
1976
1752
  return fetch({
@@ -1978,15 +1754,12 @@ var handler$4 = {
1978
1754
  itemId: itemId
1979
1755
  }
1980
1756
  });
1981
-
1982
1757
  case 5:
1983
1758
  data = _context2.sent;
1984
1759
  _context2.next = 8;
1985
1760
  return mutate(data, false);
1986
-
1987
1761
  case 8:
1988
1762
  return _context2.abrupt("return", data);
1989
-
1990
1763
  case 9:
1991
1764
  case "end":
1992
1765
  return _context2.stop();
@@ -1994,12 +1767,10 @@ var handler$4 = {
1994
1767
  }
1995
1768
  }, _callee2);
1996
1769
  }));
1997
-
1998
1770
  return function removeItem(_x) {
1999
1771
  return _ref3.apply(this, arguments);
2000
1772
  };
2001
1773
  }();
2002
-
2003
1774
  return useCallback(removeItem, [fetch, mutate]);
2004
1775
  };
2005
1776
  }
@@ -2012,23 +1783,19 @@ var handler$5 = {
2012
1783
  fetcher: function fetcher(_ref) {
2013
1784
  return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
2014
1785
  var _ref$input, itemId, item, options, fetch, _yield$fetch, checkoutLineItemsUpdate;
2015
-
2016
1786
  return runtime_1.wrap(function _callee$(_context) {
2017
1787
  while (1) {
2018
1788
  switch (_context.prev = _context.next) {
2019
1789
  case 0:
2020
1790
  _ref$input = _ref.input, itemId = _ref$input.itemId, item = _ref$input.item, options = _ref.options, fetch = _ref.fetch;
2021
-
2022
1791
  if (!Number.isInteger(item.quantity)) {
2023
1792
  _context.next = 6;
2024
1793
  break;
2025
1794
  }
2026
-
2027
1795
  if (!(item.quantity < 1)) {
2028
1796
  _context.next = 4;
2029
1797
  break;
2030
1798
  }
2031
-
2032
1799
  return _context.abrupt("return", handler$4.fetcher({
2033
1800
  options: handler$4.fetchOptions,
2034
1801
  input: {
@@ -2036,21 +1803,17 @@ var handler$5 = {
2036
1803
  },
2037
1804
  fetch: fetch
2038
1805
  }));
2039
-
2040
1806
  case 4:
2041
1807
  _context.next = 8;
2042
1808
  break;
2043
-
2044
1809
  case 6:
2045
1810
  if (!item.quantity) {
2046
1811
  _context.next = 8;
2047
1812
  break;
2048
1813
  }
2049
-
2050
1814
  throw new ValidationError({
2051
1815
  message: "The item quantity has to be a valid integer"
2052
1816
  });
2053
-
2054
1817
  case 8:
2055
1818
  _context.next = 10;
2056
1819
  return fetch(_extends({}, options, {
@@ -2062,12 +1825,10 @@ var handler$5 = {
2062
1825
  }]
2063
1826
  }
2064
1827
  }));
2065
-
2066
1828
  case 10:
2067
1829
  _yield$fetch = _context.sent;
2068
1830
  checkoutLineItemsUpdate = _yield$fetch.checkoutLineItemsUpdate;
2069
1831
  return _context.abrupt("return", checkoutToCart(checkoutLineItemsUpdate));
2070
-
2071
1832
  case 13:
2072
1833
  case "end":
2073
1834
  return _context.stop();
@@ -2080,21 +1841,16 @@ var handler$5 = {
2080
1841
  var fetch = _ref2.fetch;
2081
1842
  return function (ctx) {
2082
1843
  var _ctx$wait;
2083
-
2084
1844
  if (ctx === void 0) {
2085
1845
  ctx = {};
2086
1846
  }
2087
-
2088
1847
  var _ctx = ctx,
2089
- item = _ctx.item;
2090
-
1848
+ item = _ctx.item;
2091
1849
  var _useCart = useCart(),
2092
- mutate = _useCart.mutate;
2093
-
1850
+ mutate = _useCart.mutate;
2094
1851
  return useCallback(debounce( /*#__PURE__*/function () {
2095
1852
  var _ref3 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(input) {
2096
1853
  var _input$id, _input$productId, _input$productId2;
2097
-
2098
1854
  var itemId, productId, variantId, data;
2099
1855
  return runtime_1.wrap(function _callee2$(_context2) {
2100
1856
  while (1) {
@@ -2103,16 +1859,13 @@ var handler$5 = {
2103
1859
  itemId = (_input$id = input.id) != null ? _input$id : item == null ? void 0 : item.id;
2104
1860
  productId = (_input$productId = input.productId) != null ? _input$productId : item == null ? void 0 : item.productId;
2105
1861
  variantId = (_input$productId2 = input.productId) != null ? _input$productId2 : item == null ? void 0 : item.variantId;
2106
-
2107
1862
  if (!(!itemId || !productId || !variantId)) {
2108
1863
  _context2.next = 5;
2109
1864
  break;
2110
1865
  }
2111
-
2112
1866
  throw new ValidationError({
2113
1867
  message: "Invalid input used for this operation"
2114
1868
  });
2115
-
2116
1869
  case 5:
2117
1870
  _context2.next = 7;
2118
1871
  return fetch({
@@ -2125,15 +1878,12 @@ var handler$5 = {
2125
1878
  itemId: itemId
2126
1879
  }
2127
1880
  });
2128
-
2129
1881
  case 7:
2130
1882
  data = _context2.sent;
2131
1883
  _context2.next = 10;
2132
1884
  return mutate(data, false);
2133
-
2134
1885
  case 10:
2135
1886
  return _context2.abrupt("return", data);
2136
-
2137
1887
  case 11:
2138
1888
  case "end":
2139
1889
  return _context2.stop();
@@ -2141,7 +1891,6 @@ var handler$5 = {
2141
1891
  }
2142
1892
  }, _callee2);
2143
1893
  }));
2144
-
2145
1894
  return function (_x) {
2146
1895
  return _ref3.apply(this, arguments);
2147
1896
  };
@@ -2157,19 +1906,16 @@ var handler$6 = {
2157
1906
  fetcher: function fetcher(_ref) {
2158
1907
  return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
2159
1908
  var input, options, fetch, categoryId, _data$collections$edg, _data$collections, _data$collections$edg2, data, _data;
2160
-
2161
1909
  return runtime_1.wrap(function _callee$(_context) {
2162
1910
  while (1) {
2163
1911
  switch (_context.prev = _context.next) {
2164
1912
  case 0:
2165
1913
  input = _ref.input, options = _ref.options, fetch = _ref.fetch;
2166
1914
  categoryId = input.categoryId;
2167
-
2168
1915
  if (categoryId) {
2169
1916
  _context.next = 9;
2170
1917
  break;
2171
1918
  }
2172
-
2173
1919
  _context.next = 5;
2174
1920
  return fetch({
2175
1921
  query: options.query,
@@ -2177,14 +1923,12 @@ var handler$6 = {
2177
1923
  first: 250
2178
1924
  }
2179
1925
  });
2180
-
2181
1926
  case 5:
2182
1927
  data = _context.sent;
2183
1928
  return _context.abrupt("return", (_data$collections$edg = data == null ? void 0 : (_data$collections = data.collections) == null ? void 0 : (_data$collections$edg2 = _data$collections.edges) == null ? void 0 : _data$collections$edg2.map(function (_ref2) {
2184
1929
  var node = _ref2.node;
2185
1930
  return normalizeCategory(node);
2186
1931
  })) != null ? _data$collections$edg : []);
2187
-
2188
1932
  case 9:
2189
1933
  _context.next = 11;
2190
1934
  return fetch({
@@ -2195,11 +1939,9 @@ var handler$6 = {
2195
1939
  handle: categoryId
2196
1940
  })
2197
1941
  });
2198
-
2199
1942
  case 11:
2200
1943
  _data = _context.sent;
2201
1944
  return _context.abrupt("return", !!(_data != null && _data.collection) ? [normalizeCategory(_data == null ? void 0 : _data.collection)] : []);
2202
-
2203
1945
  case 13:
2204
1946
  case "end":
2205
1947
  return _context.stop();
@@ -2222,7 +1964,6 @@ var handler$6 = {
2222
1964
  isEmpty: {
2223
1965
  get: function get() {
2224
1966
  var _response$data$length, _response$data;
2225
-
2226
1967
  return ((_response$data$length = (_response$data = response.data) == null ? void 0 : _response$data.length) != null ? _response$data$length : 0) <= 0;
2227
1968
  },
2228
1969
  enumerable: true
@@ -2252,7 +1993,6 @@ var handler$7 = {
2252
1993
  first: 250
2253
1994
  }
2254
1995
  });
2255
-
2256
1996
  case 3:
2257
1997
  data = _context.sent;
2258
1998
  vendorsStrings = data.products.edges.map(function (_ref2) {
@@ -2267,7 +2007,6 @@ var handler$7 = {
2267
2007
  path: "brands/" + id
2268
2008
  };
2269
2009
  }));
2270
-
2271
2010
  case 6:
2272
2011
  case "end":
2273
2012
  return _context.stop();
@@ -2289,7 +2028,6 @@ var handler$7 = {
2289
2028
  isEmpty: {
2290
2029
  get: function get() {
2291
2030
  var _response$data$length, _response$data;
2292
-
2293
2031
  return ((_response$data$length = (_response$data = response.data) == null ? void 0 : _response$data.length) != null ? _response$data$length : 0) <= 0;
2294
2032
  },
2295
2033
  enumerable: true
@@ -2305,7 +2043,6 @@ var getFetcher = function getFetcher(storeDomain, accessToken) {
2305
2043
  return /*#__PURE__*/function () {
2306
2044
  var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(_ref) {
2307
2045
  var _ref$url, url, _ref$method, method, variables, query, _ref3, locale, vars;
2308
-
2309
2046
  return runtime_1.wrap(function _callee$(_context) {
2310
2047
  while (1) {
2311
2048
  switch (_context.prev = _context.next) {
@@ -2327,11 +2064,9 @@ var getFetcher = function getFetcher(storeDomain, accessToken) {
2327
2064
  'Accept-Language': locale
2328
2065
  })
2329
2066
  });
2330
-
2331
2067
  case 5:
2332
2068
  _context.t1 = _context.sent;
2333
2069
  return _context.abrupt("return", (0, _context.t0)(_context.t1));
2334
-
2335
2070
  case 7:
2336
2071
  case "end":
2337
2072
  return _context.stop();
@@ -2339,7 +2074,6 @@ var getFetcher = function getFetcher(storeDomain, accessToken) {
2339
2074
  }
2340
2075
  }, _callee);
2341
2076
  }));
2342
-
2343
2077
  return function (_x) {
2344
2078
  return _ref2.apply(this, arguments);
2345
2079
  };
@@ -2405,8 +2139,8 @@ var commerceProviderMeta = {
2405
2139
  };
2406
2140
  function CommerceProviderComponent(props) {
2407
2141
  var storeDomain = props.storeDomain,
2408
- accessToken = props.accessToken,
2409
- children = props.children;
2142
+ accessToken = props.accessToken,
2143
+ children = props.children;
2410
2144
  var CommerceProvider = React.useMemo(function () {
2411
2145
  return getCommerceProvider(storeDomain, accessToken);
2412
2146
  }, [storeDomain, accessToken]);
@@ -2416,7 +2150,6 @@ function registerCommerceProvider(loader, customCommerceProviderMeta) {
2416
2150
  var doRegisterComponent = function doRegisterComponent() {
2417
2151
  return loader ? loader.registerGlobalContext.apply(loader, arguments) : registerGlobalContext.apply(void 0, arguments);
2418
2152
  };
2419
-
2420
2153
  doRegisterComponent(CommerceProviderComponent, customCommerceProviderMeta != null ? customCommerceProviderMeta : commerceProviderMeta);
2421
2154
  }
2422
2155