@plasmicpkgs/commerce-saleor 0.0.207 → 0.0.208

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.
@@ -47,306 +47,113 @@ function _objectWithoutPropertiesLoose(r, e) {
47
47
  }
48
48
  return t;
49
49
  }
50
- function _regeneratorRuntime() {
51
- _regeneratorRuntime = function () {
52
- return e;
53
- };
54
- var t,
55
- e = {},
56
- r = Object.prototype,
57
- n = r.hasOwnProperty,
58
- o = Object.defineProperty || function (t, e, r) {
59
- t[e] = r.value;
60
- },
61
- i = "function" == typeof Symbol ? Symbol : {},
62
- a = i.iterator || "@@iterator",
63
- c = i.asyncIterator || "@@asyncIterator",
64
- u = i.toStringTag || "@@toStringTag";
65
- function define(t, e, r) {
66
- return Object.defineProperty(t, e, {
67
- value: r,
68
- enumerable: !0,
69
- configurable: !0,
70
- writable: !0
71
- }), t[e];
72
- }
73
- try {
74
- define({}, "");
75
- } catch (t) {
76
- define = function (t, e, r) {
77
- return t[e] = r;
78
- };
79
- }
80
- function wrap(t, e, r, n) {
81
- var i = e && e.prototype instanceof Generator ? e : Generator,
82
- a = Object.create(i.prototype),
83
- c = new Context(n || []);
84
- return o(a, "_invoke", {
85
- value: makeInvokeMethod(t, r, c)
86
- }), a;
87
- }
88
- function tryCatch(t, e, r) {
89
- try {
90
- return {
91
- type: "normal",
92
- arg: t.call(e, r)
93
- };
94
- } catch (t) {
95
- return {
96
- type: "throw",
97
- arg: t
98
- };
99
- }
100
- }
101
- e.wrap = wrap;
102
- var h = "suspendedStart",
103
- l = "suspendedYield",
104
- f = "executing",
105
- s = "completed",
106
- y = {};
107
- function Generator() {}
108
- function GeneratorFunction() {}
109
- function GeneratorFunctionPrototype() {}
110
- var p = {};
111
- define(p, a, function () {
112
- return this;
113
- });
114
- var d = Object.getPrototypeOf,
115
- v = d && d(d(values([])));
116
- v && v !== r && n.call(v, a) && (p = v);
117
- var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
118
- function defineIteratorMethods(t) {
119
- ["next", "throw", "return"].forEach(function (e) {
120
- define(t, e, function (t) {
121
- return this._invoke(e, t);
122
- });
123
- });
124
- }
125
- function AsyncIterator(t, e) {
126
- function invoke(r, o, i, a) {
127
- var c = tryCatch(t[r], t, o);
128
- if ("throw" !== c.type) {
129
- var u = c.arg,
130
- h = u.value;
131
- return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
132
- invoke("next", t, i, a);
133
- }, function (t) {
134
- invoke("throw", t, i, a);
135
- }) : e.resolve(h).then(function (t) {
136
- u.value = t, i(u);
137
- }, function (t) {
138
- return invoke("throw", t, i, a);
139
- });
140
- }
141
- a(c.arg);
142
- }
143
- var r;
144
- o(this, "_invoke", {
145
- value: function (t, n) {
146
- function callInvokeWithMethodAndArg() {
147
- return new e(function (e, r) {
148
- invoke(t, n, e, r);
149
- });
50
+ function _regenerator() {
51
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
52
+ var e,
53
+ t,
54
+ r = "function" == typeof Symbol ? Symbol : {},
55
+ n = r.iterator || "@@iterator",
56
+ o = r.toStringTag || "@@toStringTag";
57
+ function i(r, n, o, i) {
58
+ var c = n && n.prototype instanceof Generator ? n : Generator,
59
+ u = Object.create(c.prototype);
60
+ return _regeneratorDefine(u, "_invoke", function (r, n, o) {
61
+ var i,
62
+ c,
63
+ u,
64
+ f = 0,
65
+ p = o || [],
66
+ y = !1,
67
+ G = {
68
+ p: 0,
69
+ n: 0,
70
+ v: e,
71
+ a: d,
72
+ f: d.bind(e, 4),
73
+ d: function (t, r) {
74
+ return i = t, c = 0, u = e, G.n = r, a;
75
+ }
76
+ };
77
+ function d(r, n) {
78
+ for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
79
+ var o,
80
+ i = p[t],
81
+ d = G.p,
82
+ l = i[2];
83
+ r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
150
84
  }
151
- return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
85
+ if (o || r > 1) return a;
86
+ throw y = !0, n;
152
87
  }
153
- });
154
- }
155
- function makeInvokeMethod(e, r, n) {
156
- var o = h;
157
- return function (i, a) {
158
- if (o === f) throw Error("Generator is already running");
159
- if (o === s) {
160
- if ("throw" === i) throw a;
88
+ return function (o, p, l) {
89
+ if (f > 1) throw TypeError("Generator is already running");
90
+ for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
91
+ i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
92
+ try {
93
+ if (f = 2, i) {
94
+ if (c || (o = "next"), t = i[o]) {
95
+ if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
96
+ if (!t.done) return t;
97
+ u = t.value, c < 2 && (c = 0);
98
+ } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
99
+ i = e;
100
+ } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
101
+ } catch (t) {
102
+ i = e, c = 1, u = t;
103
+ } finally {
104
+ f = 1;
105
+ }
106
+ }
161
107
  return {
162
108
  value: t,
163
- done: !0
109
+ done: y
164
110
  };
165
- }
166
- for (n.method = i, n.arg = a;;) {
167
- var c = n.delegate;
168
- if (c) {
169
- var u = maybeInvokeDelegate(c, n);
170
- if (u) {
171
- if (u === y) continue;
172
- return u;
173
- }
174
- }
175
- if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
176
- if (o === h) throw o = s, n.arg;
177
- n.dispatchException(n.arg);
178
- } else "return" === n.method && n.abrupt("return", n.arg);
179
- o = f;
180
- var p = tryCatch(e, r, n);
181
- if ("normal" === p.type) {
182
- if (o = n.done ? s : l, p.arg === y) continue;
183
- return {
184
- value: p.arg,
185
- done: n.done
186
- };
187
- }
188
- "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
189
- }
190
- };
191
- }
192
- function maybeInvokeDelegate(e, r) {
193
- var n = r.method,
194
- o = e.iterator[n];
195
- if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
196
- var i = tryCatch(o, e.iterator, r.arg);
197
- if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
198
- var a = i.arg;
199
- return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
200
- }
201
- function pushTryEntry(t) {
202
- var e = {
203
- tryLoc: t[0]
204
- };
205
- 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
206
- }
207
- function resetTryEntry(t) {
208
- var e = t.completion || {};
209
- e.type = "normal", delete e.arg, t.completion = e;
210
- }
211
- function Context(t) {
212
- this.tryEntries = [{
213
- tryLoc: "root"
214
- }], t.forEach(pushTryEntry, this), this.reset(!0);
111
+ };
112
+ }(r, o, i), !0), u;
215
113
  }
216
- function values(e) {
217
- if (e || "" === e) {
218
- var r = e[a];
219
- if (r) return r.call(e);
220
- if ("function" == typeof e.next) return e;
221
- if (!isNaN(e.length)) {
222
- var o = -1,
223
- i = function next() {
224
- for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
225
- return next.value = t, next.done = !0, next;
226
- };
227
- return i.next = i;
228
- }
229
- }
230
- throw new TypeError(typeof e + " is not iterable");
114
+ var a = {};
115
+ function Generator() {}
116
+ function GeneratorFunction() {}
117
+ function GeneratorFunctionPrototype() {}
118
+ t = Object.getPrototypeOf;
119
+ var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
120
+ return this;
121
+ }), t),
122
+ u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
123
+ function f(e) {
124
+ return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
231
125
  }
232
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
233
- value: GeneratorFunctionPrototype,
234
- configurable: !0
235
- }), o(GeneratorFunctionPrototype, "constructor", {
236
- value: GeneratorFunction,
237
- configurable: !0
238
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
239
- var e = "function" == typeof t && t.constructor;
240
- return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
241
- }, e.mark = function (t) {
242
- return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
243
- }, e.awrap = function (t) {
244
- return {
245
- __await: t
246
- };
247
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
126
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function () {
248
127
  return this;
249
- }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
250
- void 0 === i && (i = Promise);
251
- var a = new AsyncIterator(wrap(t, r, n, o), i);
252
- return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
253
- return t.done ? t.value : a.next();
254
- });
255
- }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
256
- return this;
257
- }), define(g, "toString", function () {
128
+ }), _regeneratorDefine(u, "toString", function () {
258
129
  return "[object Generator]";
259
- }), e.keys = function (t) {
260
- var e = Object(t),
261
- r = [];
262
- for (var n in e) r.push(n);
263
- return r.reverse(), function next() {
264
- for (; r.length;) {
265
- var t = r.pop();
266
- if (t in e) return next.value = t, next.done = !1, next;
267
- }
268
- return next.done = !0, next;
130
+ }), (_regenerator = function () {
131
+ return {
132
+ w: i,
133
+ m: f
269
134
  };
270
- }, e.values = values, Context.prototype = {
271
- constructor: Context,
272
- reset: function (e) {
273
- if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
274
- },
275
- stop: function () {
276
- this.done = !0;
277
- var t = this.tryEntries[0].completion;
278
- if ("throw" === t.type) throw t.arg;
279
- return this.rval;
280
- },
281
- dispatchException: function (e) {
282
- if (this.done) throw e;
283
- var r = this;
284
- function handle(n, o) {
285
- return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
286
- }
287
- for (var o = this.tryEntries.length - 1; o >= 0; --o) {
288
- var i = this.tryEntries[o],
289
- a = i.completion;
290
- if ("root" === i.tryLoc) return handle("end");
291
- if (i.tryLoc <= this.prev) {
292
- var c = n.call(i, "catchLoc"),
293
- u = n.call(i, "finallyLoc");
294
- if (c && u) {
295
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
296
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
297
- } else if (c) {
298
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
299
- } else {
300
- if (!u) throw Error("try statement without catch or finally");
301
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
302
- }
303
- }
304
- }
305
- },
306
- abrupt: function (t, e) {
307
- for (var r = this.tryEntries.length - 1; r >= 0; --r) {
308
- var o = this.tryEntries[r];
309
- if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
310
- var i = o;
311
- break;
312
- }
313
- }
314
- i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
315
- var a = i ? i.completion : {};
316
- return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
317
- },
318
- complete: function (t, e) {
319
- if ("throw" === t.type) throw t.arg;
320
- return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
321
- },
322
- finish: function (t) {
323
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
324
- var r = this.tryEntries[e];
325
- if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
326
- }
327
- },
328
- catch: function (t) {
329
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
330
- var r = this.tryEntries[e];
331
- if (r.tryLoc === t) {
332
- var n = r.completion;
333
- if ("throw" === n.type) {
334
- var o = n.arg;
335
- resetTryEntry(r);
336
- }
337
- return o;
338
- }
339
- }
340
- throw Error("illegal catch attempt");
341
- },
342
- delegateYield: function (e, r, n) {
343
- return this.delegate = {
344
- iterator: values(e),
345
- resultName: r,
346
- nextLoc: n
347
- }, "next" === this.method && (this.arg = t), y;
135
+ })();
136
+ }
137
+ function _regeneratorDefine(e, r, n, t) {
138
+ var i = Object.defineProperty;
139
+ try {
140
+ i({}, "", {});
141
+ } catch (e) {
142
+ i = 0;
143
+ }
144
+ _regeneratorDefine = function (e, r, n, t) {
145
+ function o(r, n) {
146
+ _regeneratorDefine(e, r, function (e) {
147
+ return this._invoke(r, n, e);
148
+ });
348
149
  }
349
- }, e;
150
+ r ? i ? i(e, r, {
151
+ value: n,
152
+ enumerable: !t,
153
+ configurable: !t,
154
+ writable: !t
155
+ }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
156
+ }, _regeneratorDefine(e, r, n, t);
350
157
  }
351
158
 
352
159
  /*
@@ -390,8 +197,7 @@ var getSortVariables = function getSortVariables(sort, isCategory) {
390
197
  };
391
198
 
392
199
  function getError(errors, status) {
393
- var _errors;
394
- errors = (_errors = errors) != null ? _errors : [{
200
+ errors = errors != null ? errors : [{
395
201
  message: 'Failed to fetch Saleor API'
396
202
  }];
397
203
  return new FetcherError({
@@ -403,55 +209,51 @@ function getAsyncError(_x) {
403
209
  return _getAsyncError.apply(this, arguments);
404
210
  }
405
211
  function _getAsyncError() {
406
- _getAsyncError = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(res) {
212
+ _getAsyncError = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(res) {
407
213
  var data;
408
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
409
- while (1) switch (_context2.prev = _context2.next) {
214
+ return _regenerator().w(function (_context2) {
215
+ while (1) switch (_context2.n) {
410
216
  case 0:
411
- _context2.next = 2;
217
+ _context2.n = 1;
412
218
  return res.json();
413
- case 2:
414
- data = _context2.sent;
415
- return _context2.abrupt("return", getError(data.errors, res.status));
416
- case 4:
417
- case "end":
418
- return _context2.stop();
219
+ case 1:
220
+ data = _context2.v;
221
+ return _context2.a(2, getError(data.errors, res.status));
419
222
  }
420
223
  }, _callee2);
421
224
  }));
422
225
  return _getAsyncError.apply(this, arguments);
423
226
  }
424
227
  var handleFetchResponse = /*#__PURE__*/function () {
425
- var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(res) {
228
+ var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(res) {
426
229
  var _yield$res$json, data, errors;
427
- return _regeneratorRuntime().wrap(function _callee$(_context) {
428
- while (1) switch (_context.prev = _context.next) {
230
+ return _regenerator().w(function (_context) {
231
+ while (1) switch (_context.n) {
429
232
  case 0:
430
233
  if (!res.ok) {
431
- _context.next = 9;
234
+ _context.n = 3;
432
235
  break;
433
236
  }
434
- _context.next = 3;
237
+ _context.n = 1;
435
238
  return res.json();
436
- case 3:
437
- _yield$res$json = _context.sent;
239
+ case 1:
240
+ _yield$res$json = _context.v;
438
241
  data = _yield$res$json.data;
439
242
  errors = _yield$res$json.errors;
440
243
  if (!(errors && errors.length)) {
441
- _context.next = 8;
244
+ _context.n = 2;
442
245
  break;
443
246
  }
444
247
  throw getError(errors, res.status);
445
- case 8:
446
- return _context.abrupt("return", data);
447
- case 9:
448
- _context.next = 11;
248
+ case 2:
249
+ return _context.a(2, data);
250
+ case 3:
251
+ _context.n = 4;
449
252
  return getAsyncError(res);
450
- case 11:
451
- throw _context.sent;
452
- case 12:
453
- case "end":
454
- return _context.stop();
253
+ case 4:
254
+ throw _context.v;
255
+ case 5:
256
+ return _context.a(2);
455
257
  }
456
258
  }, _callee);
457
259
  }));
@@ -531,18 +333,18 @@ var CheckoutLineUpdate = /* GraphQL */"\n mutation CheckoutLineUpdate($checkout
531
333
  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";
532
334
 
533
335
  var checkoutCreate = /*#__PURE__*/function () {
534
- var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(fetch) {
336
+ var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(fetch) {
535
337
  var _data$checkoutCreate;
536
338
  var data, checkout, checkoutId, checkoutToken, value, options;
537
- return _regeneratorRuntime().wrap(function _callee$(_context) {
538
- while (1) switch (_context.prev = _context.next) {
339
+ return _regenerator().w(function (_context) {
340
+ while (1) switch (_context.n) {
539
341
  case 0:
540
- _context.next = 2;
342
+ _context.n = 1;
541
343
  return fetch({
542
344
  query: CheckoutCreate
543
345
  });
544
- case 2:
545
- data = _context.sent;
346
+ case 1:
347
+ data = _context.v;
546
348
  checkout = (_data$checkoutCreate = data.checkoutCreate) == null ? void 0 : _data$checkoutCreate.checkout;
547
349
  checkoutId = checkout == null ? void 0 : checkout.id;
548
350
  checkoutToken = checkout == null ? void 0 : checkout.token;
@@ -555,10 +357,7 @@ var checkoutCreate = /*#__PURE__*/function () {
555
357
  };
556
358
  Cookies.set(CHECKOUT_ID_COOKIE, value, options);
557
359
  }
558
- return _context.abrupt("return", checkout);
559
- case 9:
560
- case "end":
561
- return _context.stop();
360
+ return _context.a(2, checkout);
562
361
  }
563
362
  }, _callee);
564
363
  }));
@@ -817,41 +616,38 @@ var handler = {
817
616
  query: CheckoutOne
818
617
  },
819
618
  fetcher: function fetcher(_ref) {
820
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
619
+ return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
821
620
  var _checkout;
822
621
  var checkoutId, options, fetch, checkout, _checkoutId, data;
823
- return _regeneratorRuntime().wrap(function _callee$(_context) {
824
- while (1) switch (_context.prev = _context.next) {
622
+ return _regenerator().w(function (_context) {
623
+ while (1) switch (_context.n) {
825
624
  case 0:
826
625
  checkoutId = _ref.input.cartId, options = _ref.options, fetch = _ref.fetch;
827
626
  if (!checkoutId) {
828
- _context.next = 7;
627
+ _context.n = 2;
829
628
  break;
830
629
  }
831
630
  _checkoutId = getCheckoutId().checkoutToken;
832
- _context.next = 5;
631
+ _context.n = 1;
833
632
  return fetch(_extends({}, options, {
834
633
  variables: {
835
634
  checkoutId: _checkoutId
836
635
  }
837
636
  }));
838
- case 5:
839
- data = _context.sent;
637
+ case 1:
638
+ data = _context.v;
840
639
  checkout = data;
841
- case 7:
640
+ case 2:
842
641
  if (!((_checkout = checkout) != null && _checkout.completedAt || !checkoutId)) {
843
- _context.next = 11;
642
+ _context.n = 4;
844
643
  break;
845
644
  }
846
- _context.next = 10;
645
+ _context.n = 3;
847
646
  return checkoutCreate(fetch);
848
- case 10:
849
- checkout = _context.sent;
850
- case 11:
851
- return _context.abrupt("return", checkoutToCart(checkout));
852
- case 12:
853
- case "end":
854
- return _context.stop();
647
+ case 3:
648
+ checkout = _context.v;
649
+ case 4:
650
+ return _context.a(2, checkoutToCart(checkout));
855
651
  }
856
652
  }, _callee);
857
653
  }))();
@@ -884,22 +680,22 @@ var handler$1 = {
884
680
  query: CheckoutLineAdd
885
681
  },
886
682
  fetcher: function fetcher(_ref) {
887
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
683
+ return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
888
684
  var _item$quantity;
889
685
  var item, options, fetch, _yield$fetch, checkoutLinesAdd;
890
- return _regeneratorRuntime().wrap(function _callee$(_context) {
891
- while (1) switch (_context.prev = _context.next) {
686
+ return _regenerator().w(function (_context) {
687
+ while (1) switch (_context.n) {
892
688
  case 0:
893
689
  item = _ref.input, options = _ref.options, fetch = _ref.fetch;
894
690
  if (!(item.quantity && (!Number.isInteger(item.quantity) || item.quantity < 1))) {
895
- _context.next = 3;
691
+ _context.n = 1;
896
692
  break;
897
693
  }
898
694
  throw new CommerceError({
899
695
  message: "The item quantity has to be a valid integer greater than 0"
900
696
  });
901
- case 3:
902
- _context.next = 5;
697
+ case 1:
698
+ _context.n = 2;
903
699
  return fetch(_extends({}, options, {
904
700
  variables: {
905
701
  checkoutId: getCheckoutId().checkoutId,
@@ -909,13 +705,10 @@ var handler$1 = {
909
705
  }]
910
706
  }
911
707
  }));
912
- case 5:
913
- _yield$fetch = _context.sent;
708
+ case 2:
709
+ _yield$fetch = _context.v;
914
710
  checkoutLinesAdd = _yield$fetch.checkoutLinesAdd;
915
- return _context.abrupt("return", checkoutToCart(checkoutLinesAdd));
916
- case 8:
917
- case "end":
918
- return _context.stop();
711
+ return _context.a(2, checkoutToCart(checkoutLinesAdd));
919
712
  }
920
713
  }, _callee);
921
714
  }))();
@@ -926,34 +719,31 @@ var handler$1 = {
926
719
  var _useCart = useCart(),
927
720
  mutate = _useCart.mutate;
928
721
  return useCallback(/*#__PURE__*/function () {
929
- var _addItem = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
722
+ var _addItem = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(input) {
930
723
  var data;
931
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
932
- while (1) switch (_context2.prev = _context2.next) {
724
+ return _regenerator().w(function (_context2) {
725
+ while (1) switch (_context2.n) {
933
726
  case 0:
934
- _context2.next = 2;
727
+ _context2.n = 1;
935
728
  return fetch({
936
729
  input: input
937
730
  });
938
- case 2:
939
- data = _context2.sent;
731
+ case 1:
732
+ data = _context2.v;
940
733
  if (!data) {
941
- _context2.next = 8;
734
+ _context2.n = 3;
942
735
  break;
943
736
  }
944
- _context2.next = 6;
737
+ _context2.n = 2;
945
738
  return mutate(data, false);
946
- case 6:
947
- _context2.next = 10;
739
+ case 2:
740
+ _context2.n = 4;
948
741
  break;
949
- case 8:
950
- _context2.next = 10;
742
+ case 3:
743
+ _context2.n = 4;
951
744
  return mutate();
952
- case 10:
953
- return _context2.abrupt("return", data);
954
- case 11:
955
- case "end":
956
- return _context2.stop();
745
+ case 4:
746
+ return _context2.a(2, data);
957
747
  }
958
748
  }, _callee2);
959
749
  }));
@@ -971,25 +761,22 @@ var handler$2 = {
971
761
  query: CheckoutLineDelete
972
762
  },
973
763
  fetcher: function fetcher(_ref) {
974
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
764
+ return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
975
765
  var itemId, options, fetch, data;
976
- return _regeneratorRuntime().wrap(function _callee$(_context) {
977
- while (1) switch (_context.prev = _context.next) {
766
+ return _regenerator().w(function (_context) {
767
+ while (1) switch (_context.n) {
978
768
  case 0:
979
769
  itemId = _ref.input.itemId, options = _ref.options, fetch = _ref.fetch;
980
- _context.next = 3;
770
+ _context.n = 1;
981
771
  return fetch(_extends({}, options, {
982
772
  variables: {
983
773
  checkoutId: getCheckoutId().checkoutId,
984
774
  lineId: itemId
985
775
  }
986
776
  }));
987
- case 3:
988
- data = _context.sent;
989
- return _context.abrupt("return", checkoutToCart(data.checkoutLineDelete));
990
- case 5:
991
- case "end":
992
- return _context.stop();
777
+ case 1:
778
+ data = _context.v;
779
+ return _context.a(2, checkoutToCart(data.checkoutLineDelete));
993
780
  }
994
781
  }, _callee);
995
782
  }))();
@@ -1000,26 +787,23 @@ var handler$2 = {
1000
787
  var _useCart = useCart(),
1001
788
  mutate = _useCart.mutate;
1002
789
  return useCallback(/*#__PURE__*/function () {
1003
- var _removeItem = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
790
+ var _removeItem = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(input) {
1004
791
  var data;
1005
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1006
- while (1) switch (_context2.prev = _context2.next) {
792
+ return _regenerator().w(function (_context2) {
793
+ while (1) switch (_context2.n) {
1007
794
  case 0:
1008
- _context2.next = 2;
795
+ _context2.n = 1;
1009
796
  return fetch({
1010
797
  input: {
1011
798
  itemId: input.id
1012
799
  }
1013
800
  });
1014
- case 2:
1015
- data = _context2.sent;
1016
- _context2.next = 5;
801
+ case 1:
802
+ data = _context2.v;
803
+ _context2.n = 2;
1017
804
  return mutate(data, false);
1018
- case 5:
1019
- return _context2.abrupt("return", data);
1020
- case 6:
1021
- case "end":
1022
- return _context2.stop();
805
+ case 2:
806
+ return _context2.a(2, data);
1023
807
  }
1024
808
  }, _callee2);
1025
809
  }));
@@ -1037,41 +821,41 @@ var handler$3 = {
1037
821
  query: CheckoutLineUpdate
1038
822
  },
1039
823
  fetcher: function fetcher(_ref) {
1040
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
824
+ return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
1041
825
  var _ref$input, itemId, item, options, fetch, checkoutId, _yield$fetch, checkoutLinesUpdate;
1042
- return _regeneratorRuntime().wrap(function _callee$(_context) {
1043
- while (1) switch (_context.prev = _context.next) {
826
+ return _regenerator().w(function (_context) {
827
+ while (1) switch (_context.n) {
1044
828
  case 0:
1045
829
  _ref$input = _ref.input, itemId = _ref$input.itemId, item = _ref$input.item, options = _ref.options, fetch = _ref.fetch;
1046
830
  if (!Number.isInteger(item.quantity)) {
1047
- _context.next = 6;
831
+ _context.n = 2;
1048
832
  break;
1049
833
  }
1050
834
  if (!(item.quantity < 1)) {
1051
- _context.next = 4;
835
+ _context.n = 1;
1052
836
  break;
1053
837
  }
1054
- return _context.abrupt("return", handler$2.fetcher({
838
+ return _context.a(2, handler$2.fetcher({
1055
839
  options: handler$2.fetchOptions,
1056
840
  input: {
1057
841
  itemId: itemId
1058
842
  },
1059
843
  fetch: fetch
1060
844
  }));
1061
- case 4:
1062
- _context.next = 8;
845
+ case 1:
846
+ _context.n = 3;
1063
847
  break;
1064
- case 6:
848
+ case 2:
1065
849
  if (!item.quantity) {
1066
- _context.next = 8;
850
+ _context.n = 3;
1067
851
  break;
1068
852
  }
1069
853
  throw new ValidationError({
1070
854
  message: "The item quantity has to be a valid integer"
1071
855
  });
1072
- case 8:
856
+ case 3:
1073
857
  checkoutId = getCheckoutId().checkoutId;
1074
- _context.next = 11;
858
+ _context.n = 4;
1075
859
  return fetch(_extends({}, options, {
1076
860
  variables: {
1077
861
  checkoutId: checkoutId,
@@ -1081,13 +865,10 @@ var handler$3 = {
1081
865
  }]
1082
866
  }
1083
867
  }));
1084
- case 11:
1085
- _yield$fetch = _context.sent;
868
+ case 4:
869
+ _yield$fetch = _context.v;
1086
870
  checkoutLinesUpdate = _yield$fetch.checkoutLinesUpdate;
1087
- return _context.abrupt("return", checkoutToCart(checkoutLinesUpdate));
1088
- case 14:
1089
- case "end":
1090
- return _context.stop();
871
+ return _context.a(2, checkoutToCart(checkoutLinesUpdate));
1091
872
  }
1092
873
  }, _callee);
1093
874
  }))();
@@ -1104,22 +885,22 @@ var handler$3 = {
1104
885
  var _useCart = useCart(),
1105
886
  mutate = _useCart.mutate;
1106
887
  return useCallback(debounce(/*#__PURE__*/function () {
1107
- var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
888
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(input) {
1108
889
  var _input$id;
1109
890
  var itemId, data;
1110
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1111
- while (1) switch (_context2.prev = _context2.next) {
891
+ return _regenerator().w(function (_context2) {
892
+ while (1) switch (_context2.n) {
1112
893
  case 0:
1113
894
  itemId = (_input$id = input.id) != null ? _input$id : item == null ? void 0 : item.id;
1114
895
  if (itemId) {
1115
- _context2.next = 3;
896
+ _context2.n = 1;
1116
897
  break;
1117
898
  }
1118
899
  throw new ValidationError({
1119
900
  message: "Invalid input used for this operation"
1120
901
  });
1121
- case 3:
1122
- _context2.next = 5;
902
+ case 1:
903
+ _context2.n = 2;
1123
904
  return fetch({
1124
905
  input: {
1125
906
  item: {
@@ -1128,15 +909,12 @@ var handler$3 = {
1128
909
  itemId: itemId
1129
910
  }
1130
911
  });
1131
- case 5:
1132
- data = _context2.sent;
1133
- _context2.next = 8;
912
+ case 2:
913
+ data = _context2.v;
914
+ _context2.n = 3;
1134
915
  return mutate(data, false);
1135
- case 8:
1136
- return _context2.abrupt("return", data);
1137
- case 9:
1138
- case "end":
1139
- return _context2.stop();
916
+ case 3:
917
+ return _context2.a(2, data);
1140
918
  }
1141
919
  }, _callee2);
1142
920
  }));
@@ -1153,44 +931,43 @@ var handler$4 = {
1153
931
  query: CollectionMany
1154
932
  },
1155
933
  fetcher: function fetcher(_ref) {
1156
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
934
+ return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
1157
935
  var input, fetch, categoryId, _data$collections$edg, _data$collections, data, _data;
1158
- return _regeneratorRuntime().wrap(function _callee$(_context) {
1159
- while (1) switch (_context.prev = _context.next) {
936
+ return _regenerator().w(function (_context) {
937
+ while (1) switch (_context.n) {
1160
938
  case 0:
1161
939
  input = _ref.input, fetch = _ref.fetch;
1162
940
  categoryId = input.categoryId;
1163
941
  if (categoryId) {
1164
- _context.next = 9;
942
+ _context.n = 2;
1165
943
  break;
1166
944
  }
1167
- _context.next = 5;
945
+ _context.n = 1;
1168
946
  return fetch({
1169
947
  query: CollectionMany,
1170
948
  variables: {
1171
949
  first: 250
1172
950
  }
1173
951
  });
1174
- case 5:
1175
- data = _context.sent;
1176
- return _context.abrupt("return", (_data$collections$edg = (_data$collections = data.collections) == null || (_data$collections = _data$collections.edges) == null ? void 0 : _data$collections.map(function (_ref2) {
952
+ case 1:
953
+ data = _context.v;
954
+ return _context.a(2, (_data$collections$edg = (_data$collections = data.collections) == null || (_data$collections = _data$collections.edges) == null ? void 0 : _data$collections.map(function (_ref2) {
1177
955
  var node = _ref2.node;
1178
956
  return normalizeCategory(node);
1179
957
  })) != null ? _data$collections$edg : []);
1180
- case 9:
1181
- _context.next = 11;
958
+ case 2:
959
+ _context.n = 3;
1182
960
  return fetch({
1183
961
  query: CollectionOne,
1184
962
  variables: {
1185
963
  categoryId: categoryId
1186
964
  }
1187
965
  });
1188
- case 11:
1189
- _data = _context.sent;
1190
- return _context.abrupt("return", !!(_data != null && _data.collection) ? [normalizeCategory(_data == null ? void 0 : _data.collection)] : []);
1191
- case 13:
1192
- case "end":
1193
- return _context.stop();
966
+ case 3:
967
+ _data = _context.v;
968
+ return _context.a(2, !!(_data != null && _data.collection) ? [normalizeCategory(_data == null ? void 0 : _data.collection)] : []);
969
+ case 4:
970
+ return _context.a(2);
1194
971
  }
1195
972
  }, _callee);
1196
973
  }))();
@@ -1224,14 +1001,11 @@ var handler$5 = {
1224
1001
  query: getAllProductVendors
1225
1002
  },
1226
1003
  fetcher: function fetcher(_ref) {
1227
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1228
- return _regeneratorRuntime().wrap(function _callee$(_context) {
1229
- while (1) switch (_context.prev = _context.next) {
1004
+ return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
1005
+ return _regenerator().w(function (_context) {
1006
+ while (1) switch (_context.n) {
1230
1007
  case 0:
1231
- return _context.abrupt("return", []);
1232
- case 2:
1233
- case "end":
1234
- return _context.stop();
1008
+ return _context.a(2, []);
1235
1009
  }
1236
1010
  }, _callee);
1237
1011
  }))();
@@ -1264,21 +1038,21 @@ var handler$6 = {
1264
1038
  query: ProductMany
1265
1039
  },
1266
1040
  fetcher: function fetcher(_ref) {
1267
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1041
+ return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
1268
1042
  var input, options, fetch, categoryId, brandId, data, edges, _data$collection$prod, _data$collection, _data$products$edges, _data$products;
1269
- return _regeneratorRuntime().wrap(function _callee$(_context) {
1270
- while (1) switch (_context.prev = _context.next) {
1043
+ return _regenerator().w(function (_context) {
1044
+ while (1) switch (_context.n) {
1271
1045
  case 0:
1272
1046
  input = _ref.input, options = _ref.options, fetch = _ref.fetch;
1273
1047
  categoryId = input.categoryId, brandId = input.brandId;
1274
- _context.next = 4;
1048
+ _context.n = 1;
1275
1049
  return fetch({
1276
1050
  query: categoryId ? CollectionOne : options.query,
1277
1051
  method: options == null ? void 0 : options.method,
1278
1052
  variables: getSearchVariables(input)
1279
1053
  });
1280
- case 4:
1281
- data = _context.sent;
1054
+ case 1:
1055
+ data = _context.v;
1282
1056
  if (categoryId) {
1283
1057
  edges = (_data$collection$prod = (_data$collection = data.collection) == null || (_data$collection = _data$collection.products) == null ? void 0 : _data$collection.edges) != null ? _data$collection$prod : [];
1284
1058
  // FIXME @zaiste, no `vendor` in Saleor
@@ -1291,16 +1065,13 @@ var handler$6 = {
1291
1065
  } else {
1292
1066
  edges = (_data$products$edges = (_data$products = data.products) == null ? void 0 : _data$products.edges) != null ? _data$products$edges : [];
1293
1067
  }
1294
- return _context.abrupt("return", {
1068
+ return _context.a(2, {
1295
1069
  products: edges.map(function (_ref2) {
1296
1070
  var node = _ref2.node;
1297
1071
  return normalizeProduct(node);
1298
1072
  }),
1299
1073
  found: !!edges.length
1300
1074
  });
1301
- case 7:
1302
- case "end":
1303
- return _context.stop();
1304
1075
  }
1305
1076
  }, _callee);
1306
1077
  }))();
@@ -1328,47 +1099,44 @@ var handler$7 = {
1328
1099
  query: ProductOneById
1329
1100
  },
1330
1101
  fetcher: function fetcher(_ref) {
1331
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1102
+ return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
1332
1103
  var input, fetch, id, data, response;
1333
- return _regeneratorRuntime().wrap(function _callee$(_context) {
1334
- while (1) switch (_context.prev = _context.next) {
1104
+ return _regenerator().w(function (_context) {
1105
+ while (1) switch (_context.n) {
1335
1106
  case 0:
1336
1107
  input = _ref.input, fetch = _ref.fetch;
1337
1108
  id = input.id;
1338
1109
  if (id) {
1339
- _context.next = 4;
1110
+ _context.n = 1;
1340
1111
  break;
1341
1112
  }
1342
- return _context.abrupt("return", null);
1343
- case 4:
1344
- _context.next = 6;
1113
+ return _context.a(2, null);
1114
+ case 1:
1115
+ _context.n = 2;
1345
1116
  return fetch({
1346
1117
  query: ProductOneById,
1347
1118
  variables: {
1348
1119
  id: id
1349
1120
  }
1350
1121
  });
1351
- case 6:
1352
- data = _context.sent;
1122
+ case 2:
1123
+ data = _context.v;
1353
1124
  if (data.product) {
1354
- _context.next = 12;
1125
+ _context.n = 4;
1355
1126
  break;
1356
1127
  }
1357
- _context.next = 10;
1128
+ _context.n = 3;
1358
1129
  return fetch({
1359
1130
  query: ProductOneBySlug,
1360
1131
  variables: {
1361
1132
  slug: id
1362
1133
  }
1363
1134
  });
1364
- case 10:
1365
- response = _context.sent;
1366
- return _context.abrupt("return", response.product ? normalizeProduct(response.product) : null);
1367
- case 12:
1368
- return _context.abrupt("return", data.product ? normalizeProduct(data.product) : null);
1369
- case 13:
1370
- case "end":
1371
- return _context.stop();
1135
+ case 3:
1136
+ response = _context.v;
1137
+ return _context.a(2, response.product ? normalizeProduct(response.product) : null);
1138
+ case 4:
1139
+ return _context.a(2, data.product ? normalizeProduct(data.product) : null);
1372
1140
  }
1373
1141
  }, _callee);
1374
1142
  }))();
@@ -1392,16 +1160,16 @@ var handler$7 = {
1392
1160
  var _excluded$1 = ["locale"];
1393
1161
  var getFetcher = function getFetcher(saleorApiUrl) {
1394
1162
  return /*#__PURE__*/function () {
1395
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
1396
- var _ref$url, url, _ref$method, method, query, variables, _ref3, vars, token;
1397
- return _regeneratorRuntime().wrap(function _callee$(_context) {
1398
- while (1) switch (_context.prev = _context.next) {
1163
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
1164
+ var _ref$url, url, _ref$method, method, query, variables, _ref3, vars, token, _t;
1165
+ return _regenerator().w(function (_context) {
1166
+ while (1) switch (_context.n) {
1399
1167
  case 0:
1400
1168
  _ref$url = _ref.url, url = _ref$url === void 0 ? saleorApiUrl : _ref$url, _ref$method = _ref.method, method = _ref$method === void 0 ? 'POST' : _ref$method, query = _ref.query, variables = _ref.variables;
1401
1169
  _ref3 = variables != null ? variables : {}, vars = _objectWithoutPropertiesLoose(_ref3, _excluded$1);
1402
1170
  token = getToken();
1403
- _context.t0 = handleFetchResponse;
1404
- _context.next = 6;
1171
+ _t = handleFetchResponse;
1172
+ _context.n = 1;
1405
1173
  return fetch(url, {
1406
1174
  method: method,
1407
1175
  body: JSON.stringify({
@@ -1413,12 +1181,8 @@ var getFetcher = function getFetcher(saleorApiUrl) {
1413
1181
  'Content-Type': 'application/json'
1414
1182
  }
1415
1183
  });
1416
- case 6:
1417
- _context.t1 = _context.sent;
1418
- return _context.abrupt("return", (0, _context.t0)(_context.t1));
1419
- case 8:
1420
- case "end":
1421
- return _context.stop();
1184
+ case 1:
1185
+ return _context.a(2, _t(_context.v));
1422
1186
  }
1423
1187
  }, _callee);
1424
1188
  }));