@plasmicpkgs/commerce-shopify 0.0.251 → 0.0.252

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.
@@ -77,306 +77,113 @@ function _objectWithoutPropertiesLoose(r, e) {
77
77
  }
78
78
  return t;
79
79
  }
80
- function _regeneratorRuntime() {
81
- _regeneratorRuntime = function () {
82
- return e;
83
- };
84
- var t,
85
- e = {},
86
- r = Object.prototype,
87
- n = r.hasOwnProperty,
88
- o = Object.defineProperty || function (t, e, r) {
89
- t[e] = r.value;
90
- },
91
- i = "function" == typeof Symbol ? Symbol : {},
92
- a = i.iterator || "@@iterator",
93
- c = i.asyncIterator || "@@asyncIterator",
94
- u = i.toStringTag || "@@toStringTag";
95
- function define(t, e, r) {
96
- return Object.defineProperty(t, e, {
97
- value: r,
98
- enumerable: !0,
99
- configurable: !0,
100
- writable: !0
101
- }), t[e];
102
- }
103
- try {
104
- define({}, "");
105
- } catch (t) {
106
- define = function (t, e, r) {
107
- return t[e] = r;
108
- };
109
- }
110
- function wrap(t, e, r, n) {
111
- var i = e && e.prototype instanceof Generator ? e : Generator,
112
- a = Object.create(i.prototype),
113
- c = new Context(n || []);
114
- return o(a, "_invoke", {
115
- value: makeInvokeMethod(t, r, c)
116
- }), a;
117
- }
118
- function tryCatch(t, e, r) {
119
- try {
120
- return {
121
- type: "normal",
122
- arg: t.call(e, r)
123
- };
124
- } catch (t) {
125
- return {
126
- type: "throw",
127
- arg: t
128
- };
129
- }
130
- }
131
- e.wrap = wrap;
132
- var h = "suspendedStart",
133
- l = "suspendedYield",
134
- f = "executing",
135
- s = "completed",
136
- y = {};
137
- function Generator() {}
138
- function GeneratorFunction() {}
139
- function GeneratorFunctionPrototype() {}
140
- var p = {};
141
- define(p, a, function () {
142
- return this;
143
- });
144
- var d = Object.getPrototypeOf,
145
- v = d && d(d(values([])));
146
- v && v !== r && n.call(v, a) && (p = v);
147
- var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
148
- function defineIteratorMethods(t) {
149
- ["next", "throw", "return"].forEach(function (e) {
150
- define(t, e, function (t) {
151
- return this._invoke(e, t);
152
- });
153
- });
154
- }
155
- function AsyncIterator(t, e) {
156
- function invoke(r, o, i, a) {
157
- var c = tryCatch(t[r], t, o);
158
- if ("throw" !== c.type) {
159
- var u = c.arg,
160
- h = u.value;
161
- return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
162
- invoke("next", t, i, a);
163
- }, function (t) {
164
- invoke("throw", t, i, a);
165
- }) : e.resolve(h).then(function (t) {
166
- u.value = t, i(u);
167
- }, function (t) {
168
- return invoke("throw", t, i, a);
169
- });
170
- }
171
- a(c.arg);
172
- }
173
- var r;
174
- o(this, "_invoke", {
175
- value: function (t, n) {
176
- function callInvokeWithMethodAndArg() {
177
- return new e(function (e, r) {
178
- invoke(t, n, e, r);
179
- });
80
+ function _regenerator() {
81
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
82
+ var e,
83
+ t,
84
+ r = "function" == typeof Symbol ? Symbol : {},
85
+ n = r.iterator || "@@iterator",
86
+ o = r.toStringTag || "@@toStringTag";
87
+ function i(r, n, o, i) {
88
+ var c = n && n.prototype instanceof Generator ? n : Generator,
89
+ u = Object.create(c.prototype);
90
+ return _regeneratorDefine(u, "_invoke", function (r, n, o) {
91
+ var i,
92
+ c,
93
+ u,
94
+ f = 0,
95
+ p = o || [],
96
+ y = !1,
97
+ G = {
98
+ p: 0,
99
+ n: 0,
100
+ v: e,
101
+ a: d,
102
+ f: d.bind(e, 4),
103
+ d: function (t, r) {
104
+ return i = t, c = 0, u = e, G.n = r, a;
105
+ }
106
+ };
107
+ function d(r, n) {
108
+ for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
109
+ var o,
110
+ i = p[t],
111
+ d = G.p,
112
+ l = i[2];
113
+ 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));
180
114
  }
181
- return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
115
+ if (o || r > 1) return a;
116
+ throw y = !0, n;
182
117
  }
183
- });
184
- }
185
- function makeInvokeMethod(e, r, n) {
186
- var o = h;
187
- return function (i, a) {
188
- if (o === f) throw Error("Generator is already running");
189
- if (o === s) {
190
- if ("throw" === i) throw a;
118
+ return function (o, p, l) {
119
+ if (f > 1) throw TypeError("Generator is already running");
120
+ for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
121
+ i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
122
+ try {
123
+ if (f = 2, i) {
124
+ if (c || (o = "next"), t = i[o]) {
125
+ if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
126
+ if (!t.done) return t;
127
+ u = t.value, c < 2 && (c = 0);
128
+ } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
129
+ i = e;
130
+ } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
131
+ } catch (t) {
132
+ i = e, c = 1, u = t;
133
+ } finally {
134
+ f = 1;
135
+ }
136
+ }
191
137
  return {
192
138
  value: t,
193
- done: !0
139
+ done: y
194
140
  };
195
- }
196
- for (n.method = i, n.arg = a;;) {
197
- var c = n.delegate;
198
- if (c) {
199
- var u = maybeInvokeDelegate(c, n);
200
- if (u) {
201
- if (u === y) continue;
202
- return u;
203
- }
204
- }
205
- if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
206
- if (o === h) throw o = s, n.arg;
207
- n.dispatchException(n.arg);
208
- } else "return" === n.method && n.abrupt("return", n.arg);
209
- o = f;
210
- var p = tryCatch(e, r, n);
211
- if ("normal" === p.type) {
212
- if (o = n.done ? s : l, p.arg === y) continue;
213
- return {
214
- value: p.arg,
215
- done: n.done
216
- };
217
- }
218
- "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
219
- }
220
- };
221
- }
222
- function maybeInvokeDelegate(e, r) {
223
- var n = r.method,
224
- o = e.iterator[n];
225
- 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;
226
- var i = tryCatch(o, e.iterator, r.arg);
227
- if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
228
- var a = i.arg;
229
- 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);
230
- }
231
- function pushTryEntry(t) {
232
- var e = {
233
- tryLoc: t[0]
234
- };
235
- 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
236
- }
237
- function resetTryEntry(t) {
238
- var e = t.completion || {};
239
- e.type = "normal", delete e.arg, t.completion = e;
240
- }
241
- function Context(t) {
242
- this.tryEntries = [{
243
- tryLoc: "root"
244
- }], t.forEach(pushTryEntry, this), this.reset(!0);
141
+ };
142
+ }(r, o, i), !0), u;
245
143
  }
246
- function values(e) {
247
- if (e || "" === e) {
248
- var r = e[a];
249
- if (r) return r.call(e);
250
- if ("function" == typeof e.next) return e;
251
- if (!isNaN(e.length)) {
252
- var o = -1,
253
- i = function next() {
254
- for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
255
- return next.value = t, next.done = !0, next;
256
- };
257
- return i.next = i;
258
- }
259
- }
260
- throw new TypeError(typeof e + " is not iterable");
144
+ var a = {};
145
+ function Generator() {}
146
+ function GeneratorFunction() {}
147
+ function GeneratorFunctionPrototype() {}
148
+ t = Object.getPrototypeOf;
149
+ var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
150
+ return this;
151
+ }), t),
152
+ u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
153
+ function f(e) {
154
+ return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
261
155
  }
262
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
263
- value: GeneratorFunctionPrototype,
264
- configurable: !0
265
- }), o(GeneratorFunctionPrototype, "constructor", {
266
- value: GeneratorFunction,
267
- configurable: !0
268
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
269
- var e = "function" == typeof t && t.constructor;
270
- return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
271
- }, e.mark = function (t) {
272
- return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
273
- }, e.awrap = function (t) {
274
- return {
275
- __await: t
276
- };
277
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
156
+ 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 () {
278
157
  return this;
279
- }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
280
- void 0 === i && (i = Promise);
281
- var a = new AsyncIterator(wrap(t, r, n, o), i);
282
- return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
283
- return t.done ? t.value : a.next();
284
- });
285
- }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
286
- return this;
287
- }), define(g, "toString", function () {
158
+ }), _regeneratorDefine(u, "toString", function () {
288
159
  return "[object Generator]";
289
- }), e.keys = function (t) {
290
- var e = Object(t),
291
- r = [];
292
- for (var n in e) r.push(n);
293
- return r.reverse(), function next() {
294
- for (; r.length;) {
295
- var t = r.pop();
296
- if (t in e) return next.value = t, next.done = !1, next;
297
- }
298
- return next.done = !0, next;
160
+ }), (_regenerator = function () {
161
+ return {
162
+ w: i,
163
+ m: f
299
164
  };
300
- }, e.values = values, Context.prototype = {
301
- constructor: Context,
302
- reset: function (e) {
303
- 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);
304
- },
305
- stop: function () {
306
- this.done = !0;
307
- var t = this.tryEntries[0].completion;
308
- if ("throw" === t.type) throw t.arg;
309
- return this.rval;
310
- },
311
- dispatchException: function (e) {
312
- if (this.done) throw e;
313
- var r = this;
314
- function handle(n, o) {
315
- return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
316
- }
317
- for (var o = this.tryEntries.length - 1; o >= 0; --o) {
318
- var i = this.tryEntries[o],
319
- a = i.completion;
320
- if ("root" === i.tryLoc) return handle("end");
321
- if (i.tryLoc <= this.prev) {
322
- var c = n.call(i, "catchLoc"),
323
- u = n.call(i, "finallyLoc");
324
- if (c && u) {
325
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
326
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
327
- } else if (c) {
328
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
329
- } else {
330
- if (!u) throw Error("try statement without catch or finally");
331
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
332
- }
333
- }
334
- }
335
- },
336
- abrupt: function (t, e) {
337
- for (var r = this.tryEntries.length - 1; r >= 0; --r) {
338
- var o = this.tryEntries[r];
339
- if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
340
- var i = o;
341
- break;
342
- }
343
- }
344
- i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
345
- var a = i ? i.completion : {};
346
- return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
347
- },
348
- complete: function (t, e) {
349
- if ("throw" === t.type) throw t.arg;
350
- 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;
351
- },
352
- finish: function (t) {
353
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
354
- var r = this.tryEntries[e];
355
- if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
356
- }
357
- },
358
- catch: function (t) {
359
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
360
- var r = this.tryEntries[e];
361
- if (r.tryLoc === t) {
362
- var n = r.completion;
363
- if ("throw" === n.type) {
364
- var o = n.arg;
365
- resetTryEntry(r);
366
- }
367
- return o;
368
- }
369
- }
370
- throw Error("illegal catch attempt");
371
- },
372
- delegateYield: function (e, r, n) {
373
- return this.delegate = {
374
- iterator: values(e),
375
- resultName: r,
376
- nextLoc: n
377
- }, "next" === this.method && (this.arg = t), y;
165
+ })();
166
+ }
167
+ function _regeneratorDefine(e, r, n, t) {
168
+ var i = Object.defineProperty;
169
+ try {
170
+ i({}, "", {});
171
+ } catch (e) {
172
+ i = 0;
173
+ }
174
+ _regeneratorDefine = function (e, r, n, t) {
175
+ function o(r, n) {
176
+ _regeneratorDefine(e, r, function (e) {
177
+ return this._invoke(r, n, e);
178
+ });
378
179
  }
379
- }, e;
180
+ r ? i ? i(e, r, {
181
+ value: n,
182
+ enumerable: !t,
183
+ configurable: !t,
184
+ writable: !t
185
+ }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
186
+ }, _regeneratorDefine(e, r, n, t);
380
187
  }
381
188
  function _setPrototypeOf(t, e) {
382
189
  return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
@@ -2560,7 +2367,6 @@ var WeightUnit;
2560
2367
  WeightUnit["Pounds"] = "POUNDS";
2561
2368
  })(WeightUnit || (WeightUnit = {}));
2562
2369
  var TypedDocumentString = /*#__PURE__*/function (_String) {
2563
- _inheritsLoose(TypedDocumentString, _String);
2564
2370
  function TypedDocumentString(value, __meta__) {
2565
2371
  var _this;
2566
2372
  _this = _String.call(this, value) || this;
@@ -2568,6 +2374,7 @@ var TypedDocumentString = /*#__PURE__*/function (_String) {
2568
2374
  _this.__meta__ = __meta__;
2569
2375
  return _this;
2570
2376
  }
2377
+ _inheritsLoose(TypedDocumentString, _String);
2571
2378
  var _proto = TypedDocumentString.prototype;
2572
2379
  _proto.toString = function toString() {
2573
2380
  return this.value;
@@ -2989,24 +2796,24 @@ function normalizeImage(image) {
2989
2796
  }
2990
2797
 
2991
2798
  var cartCreate = /*#__PURE__*/function () {
2992
- var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(fetch, lines) {
2799
+ var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(fetch, lines) {
2993
2800
  var _yield$fetch, cartCreate, cart, options;
2994
- return _regeneratorRuntime().wrap(function _callee$(_context) {
2995
- while (1) switch (_context.prev = _context.next) {
2801
+ return _regenerator().w(function (_context) {
2802
+ while (1) switch (_context.n) {
2996
2803
  case 0:
2997
- _context.next = 2;
2804
+ _context.n = 1;
2998
2805
  return fetch({
2999
2806
  query: createCartMutation.toString(),
3000
2807
  variables: {
3001
2808
  lines: lines
3002
2809
  }
3003
2810
  });
3004
- case 2:
3005
- _yield$fetch = _context.sent;
2811
+ case 1:
2812
+ _yield$fetch = _context.v;
3006
2813
  cartCreate = _yield$fetch.cartCreate;
3007
2814
  cart = cartCreate == null ? void 0 : cartCreate.cart;
3008
2815
  if (!cart) {
3009
- _context.next = 12;
2816
+ _context.n = 2;
3010
2817
  break;
3011
2818
  }
3012
2819
  options = {
@@ -3016,12 +2823,11 @@ var cartCreate = /*#__PURE__*/function () {
3016
2823
  };
3017
2824
  Cookies.set(SHOPIFY_CART_ID_COOKIE, cart.id, options);
3018
2825
  Cookies.set(SHOPIFY_CHECKOUT_URL_COOKIE, cart.checkoutUrl, options);
3019
- return _context.abrupt("return", normalizeCart(cart));
3020
- case 12:
3021
- return _context.abrupt("return", undefined);
3022
- case 13:
3023
- case "end":
3024
- return _context.stop();
2826
+ return _context.a(2, normalizeCart(cart));
2827
+ case 2:
2828
+ return _context.a(2, undefined);
2829
+ case 3:
2830
+ return _context.a(2);
3025
2831
  }
3026
2832
  }, _callee);
3027
2833
  }));
@@ -3045,39 +2851,36 @@ var handler = {
3045
2851
  query: /*#__PURE__*/getCartQuery.toString()
3046
2852
  },
3047
2853
  fetcher: function fetcher(_ref) {
3048
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
2854
+ return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
3049
2855
  var cartId, options, fetch, _yield$fetch, cart;
3050
- return _regeneratorRuntime().wrap(function _callee$(_context) {
3051
- while (1) switch (_context.prev = _context.next) {
2856
+ return _regenerator().w(function (_context) {
2857
+ while (1) switch (_context.n) {
3052
2858
  case 0:
3053
2859
  cartId = _ref.input.cartId, options = _ref.options, fetch = _ref.fetch;
3054
2860
  if (!cartId) {
3055
- _context.next = 13;
2861
+ _context.n = 3;
3056
2862
  break;
3057
2863
  }
3058
- _context.next = 4;
2864
+ _context.n = 1;
3059
2865
  return fetch(_extends({}, options, {
3060
2866
  variables: {
3061
2867
  cartId: cartId
3062
2868
  }
3063
2869
  }));
3064
- case 4:
3065
- _yield$fetch = _context.sent;
2870
+ case 1:
2871
+ _yield$fetch = _context.v;
3066
2872
  cart = _yield$fetch.cart;
3067
2873
  if (cart) {
3068
- _context.next = 12;
2874
+ _context.n = 2;
3069
2875
  break;
3070
2876
  }
3071
2877
  Cookies.remove(SHOPIFY_CART_ID_COOKIE);
3072
2878
  Cookies.remove(SHOPIFY_CHECKOUT_URL_COOKIE);
3073
- return _context.abrupt("return", null);
3074
- case 12:
3075
- return _context.abrupt("return", normalizeCart(cart));
3076
- case 13:
3077
- return _context.abrupt("return", null);
3078
- case 14:
3079
- case "end":
3080
- return _context.stop();
2879
+ return _context.a(2, null);
2880
+ case 2:
2881
+ return _context.a(2, normalizeCart(cart));
2882
+ case 3:
2883
+ return _context.a(2, null);
3081
2884
  }
3082
2885
  }, _callee);
3083
2886
  }))();
@@ -3110,49 +2913,48 @@ var handler$1 = {
3110
2913
  query: /*#__PURE__*/addToCartMutation.toString()
3111
2914
  },
3112
2915
  fetcher: function fetcher(_ref) {
3113
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
2916
+ return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
3114
2917
  var _item$quantity;
3115
2918
  var item, options, fetch, lines, cartId, _yield$fetch, cartLinesAdd;
3116
- return _regeneratorRuntime().wrap(function _callee$(_context) {
3117
- while (1) switch (_context.prev = _context.next) {
2919
+ return _regenerator().w(function (_context) {
2920
+ while (1) switch (_context.n) {
3118
2921
  case 0:
3119
2922
  item = _ref.input, options = _ref.options, fetch = _ref.fetch;
3120
2923
  if (!(item.quantity && (!Number.isInteger(item.quantity) || item.quantity < 1))) {
3121
- _context.next = 3;
2924
+ _context.n = 1;
3122
2925
  break;
3123
2926
  }
3124
2927
  throw new CommerceError({
3125
2928
  message: "The item quantity has to be a valid integer greater than 0"
3126
2929
  });
3127
- case 3:
2930
+ case 1:
3128
2931
  lines = [{
3129
2932
  merchandiseId: item.variantId,
3130
2933
  quantity: (_item$quantity = item.quantity) != null ? _item$quantity : 1
3131
2934
  }];
3132
2935
  cartId = getCartId();
3133
2936
  if (cartId) {
3134
- _context.next = 11;
2937
+ _context.n = 3;
3135
2938
  break;
3136
2939
  }
3137
- _context.next = 8;
2940
+ _context.n = 2;
3138
2941
  return cartCreate(fetch, lines);
3139
- case 8:
3140
- return _context.abrupt("return", _context.sent);
3141
- case 11:
3142
- _context.next = 13;
2942
+ case 2:
2943
+ return _context.a(2, _context.v);
2944
+ case 3:
2945
+ _context.n = 4;
3143
2946
  return fetch(_extends({}, options, {
3144
2947
  variables: {
3145
2948
  cartId: cartId,
3146
2949
  lines: lines
3147
2950
  }
3148
2951
  }));
3149
- case 13:
3150
- _yield$fetch = _context.sent;
2952
+ case 4:
2953
+ _yield$fetch = _context.v;
3151
2954
  cartLinesAdd = _yield$fetch.cartLinesAdd;
3152
- return _context.abrupt("return", normalizeCart(cartLinesAdd == null ? void 0 : cartLinesAdd.cart));
3153
- case 16:
3154
- case "end":
3155
- return _context.stop();
2955
+ return _context.a(2, normalizeCart(cartLinesAdd == null ? void 0 : cartLinesAdd.cart));
2956
+ case 5:
2957
+ return _context.a(2);
3156
2958
  }
3157
2959
  }, _callee);
3158
2960
  }))();
@@ -3163,24 +2965,21 @@ var handler$1 = {
3163
2965
  var _useCart = useCart(),
3164
2966
  mutate = _useCart.mutate;
3165
2967
  return useCallback(/*#__PURE__*/function () {
3166
- var _addItem = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
2968
+ var _addItem = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(input) {
3167
2969
  var data;
3168
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
3169
- while (1) switch (_context2.prev = _context2.next) {
2970
+ return _regenerator().w(function (_context2) {
2971
+ while (1) switch (_context2.n) {
3170
2972
  case 0:
3171
- _context2.next = 2;
2973
+ _context2.n = 1;
3172
2974
  return fetch({
3173
2975
  input: input
3174
2976
  });
3175
- case 2:
3176
- data = _context2.sent;
3177
- _context2.next = 5;
2977
+ case 1:
2978
+ data = _context2.v;
2979
+ _context2.n = 2;
3178
2980
  return mutate(data, false);
3179
- case 5:
3180
- return _context2.abrupt("return", data);
3181
- case 6:
3182
- case "end":
3183
- return _context2.stop();
2981
+ case 2:
2982
+ return _context2.a(2, data);
3184
2983
  }
3185
2984
  }, _callee2);
3186
2985
  }));
@@ -3198,26 +2997,23 @@ var handler$2 = {
3198
2997
  query: /*#__PURE__*/removeFromCartMutation.toString()
3199
2998
  },
3200
2999
  fetcher: function fetcher(_ref) {
3201
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
3000
+ return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
3202
3001
  var itemId, options, fetch, _yield$fetch, cartLinesRemove;
3203
- return _regeneratorRuntime().wrap(function _callee$(_context) {
3204
- while (1) switch (_context.prev = _context.next) {
3002
+ return _regenerator().w(function (_context) {
3003
+ while (1) switch (_context.n) {
3205
3004
  case 0:
3206
3005
  itemId = _ref.input.itemId, options = _ref.options, fetch = _ref.fetch;
3207
- _context.next = 3;
3006
+ _context.n = 1;
3208
3007
  return fetch(_extends({}, options, {
3209
3008
  variables: {
3210
3009
  cartId: getCartId(),
3211
3010
  lineIds: [itemId]
3212
3011
  }
3213
3012
  }));
3214
- case 3:
3215
- _yield$fetch = _context.sent;
3013
+ case 1:
3014
+ _yield$fetch = _context.v;
3216
3015
  cartLinesRemove = _yield$fetch.cartLinesRemove;
3217
- return _context.abrupt("return", normalizeCart(cartLinesRemove == null ? void 0 : cartLinesRemove.cart));
3218
- case 6:
3219
- case "end":
3220
- return _context.stop();
3016
+ return _context.a(2, normalizeCart(cartLinesRemove == null ? void 0 : cartLinesRemove.cart));
3221
3017
  }
3222
3018
  }, _callee);
3223
3019
  }))();
@@ -3233,36 +3029,33 @@ var handler$2 = {
3233
3029
  var _useCart = useCart(),
3234
3030
  mutate = _useCart.mutate;
3235
3031
  var removeItem = /*#__PURE__*/function () {
3236
- var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
3032
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(input) {
3237
3033
  var _input$id;
3238
3034
  var itemId, data;
3239
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
3240
- while (1) switch (_context2.prev = _context2.next) {
3035
+ return _regenerator().w(function (_context2) {
3036
+ while (1) switch (_context2.n) {
3241
3037
  case 0:
3242
3038
  itemId = (_input$id = input == null ? void 0 : input.id) != null ? _input$id : item == null ? void 0 : item.id;
3243
3039
  if (itemId) {
3244
- _context2.next = 3;
3040
+ _context2.n = 1;
3245
3041
  break;
3246
3042
  }
3247
3043
  throw new ValidationError({
3248
3044
  message: "Invalid input used for this operation"
3249
3045
  });
3250
- case 3:
3251
- _context2.next = 5;
3046
+ case 1:
3047
+ _context2.n = 2;
3252
3048
  return fetch({
3253
3049
  input: {
3254
3050
  itemId: itemId
3255
3051
  }
3256
3052
  });
3257
- case 5:
3258
- data = _context2.sent;
3259
- _context2.next = 8;
3053
+ case 2:
3054
+ data = _context2.v;
3055
+ _context2.n = 3;
3260
3056
  return mutate(data, false);
3261
- case 8:
3262
- return _context2.abrupt("return", data);
3263
- case 9:
3264
- case "end":
3265
- return _context2.stop();
3057
+ case 3:
3058
+ return _context2.a(2, data);
3266
3059
  }
3267
3060
  }, _callee2);
3268
3061
  }));
@@ -3280,40 +3073,40 @@ var handler$3 = {
3280
3073
  query: /*#__PURE__*/editCartItemsMutation.toString()
3281
3074
  },
3282
3075
  fetcher: function fetcher(_ref) {
3283
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
3076
+ return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
3284
3077
  var _ref$input, itemId, item, options, fetch, _yield$fetch, cartLinesUpdate;
3285
- return _regeneratorRuntime().wrap(function _callee$(_context) {
3286
- while (1) switch (_context.prev = _context.next) {
3078
+ return _regenerator().w(function (_context) {
3079
+ while (1) switch (_context.n) {
3287
3080
  case 0:
3288
3081
  _ref$input = _ref.input, itemId = _ref$input.itemId, item = _ref$input.item, options = _ref.options, fetch = _ref.fetch;
3289
3082
  if (!Number.isInteger(item.quantity)) {
3290
- _context.next = 6;
3083
+ _context.n = 2;
3291
3084
  break;
3292
3085
  }
3293
3086
  if (!(item.quantity < 1)) {
3294
- _context.next = 4;
3087
+ _context.n = 1;
3295
3088
  break;
3296
3089
  }
3297
- return _context.abrupt("return", handler$2.fetcher({
3090
+ return _context.a(2, handler$2.fetcher({
3298
3091
  options: handler$2.fetchOptions,
3299
3092
  input: {
3300
3093
  itemId: itemId
3301
3094
  },
3302
3095
  fetch: fetch
3303
3096
  }));
3304
- case 4:
3305
- _context.next = 8;
3097
+ case 1:
3098
+ _context.n = 3;
3306
3099
  break;
3307
- case 6:
3100
+ case 2:
3308
3101
  if (!item.quantity) {
3309
- _context.next = 8;
3102
+ _context.n = 3;
3310
3103
  break;
3311
3104
  }
3312
3105
  throw new ValidationError({
3313
3106
  message: "The item quantity has to be a valid integer"
3314
3107
  });
3315
- case 8:
3316
- _context.next = 10;
3108
+ case 3:
3109
+ _context.n = 4;
3317
3110
  return fetch(_extends({}, options, {
3318
3111
  variables: {
3319
3112
  cartId: getCartId(),
@@ -3323,13 +3116,10 @@ var handler$3 = {
3323
3116
  }]
3324
3117
  }
3325
3118
  }));
3326
- case 10:
3327
- _yield$fetch = _context.sent;
3119
+ case 4:
3120
+ _yield$fetch = _context.v;
3328
3121
  cartLinesUpdate = _yield$fetch.cartLinesUpdate;
3329
- return _context.abrupt("return", normalizeCart(cartLinesUpdate == null ? void 0 : cartLinesUpdate.cart));
3330
- case 13:
3331
- case "end":
3332
- return _context.stop();
3122
+ return _context.a(2, normalizeCart(cartLinesUpdate == null ? void 0 : cartLinesUpdate.cart));
3333
3123
  }
3334
3124
  }, _callee);
3335
3125
  }))();
@@ -3346,22 +3136,22 @@ var handler$3 = {
3346
3136
  var _useCart = useCart(),
3347
3137
  mutate = _useCart.mutate;
3348
3138
  return useCallback(debounce(/*#__PURE__*/function () {
3349
- var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
3139
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(input) {
3350
3140
  var _input$id;
3351
3141
  var itemId, data;
3352
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
3353
- while (1) switch (_context2.prev = _context2.next) {
3142
+ return _regenerator().w(function (_context2) {
3143
+ while (1) switch (_context2.n) {
3354
3144
  case 0:
3355
3145
  itemId = (_input$id = input.id) != null ? _input$id : item == null ? void 0 : item.id;
3356
3146
  if (!(!itemId || input.quantity == null)) {
3357
- _context2.next = 3;
3147
+ _context2.n = 1;
3358
3148
  break;
3359
3149
  }
3360
3150
  throw new ValidationError({
3361
3151
  message: "Invalid input used for this operation"
3362
3152
  });
3363
- case 3:
3364
- _context2.next = 5;
3153
+ case 1:
3154
+ _context2.n = 2;
3365
3155
  return fetch({
3366
3156
  input: {
3367
3157
  item: {
@@ -3370,15 +3160,12 @@ var handler$3 = {
3370
3160
  itemId: itemId
3371
3161
  }
3372
3162
  });
3373
- case 5:
3374
- data = _context2.sent;
3375
- _context2.next = 8;
3163
+ case 2:
3164
+ data = _context2.v;
3165
+ _context2.n = 3;
3376
3166
  return mutate(data, false);
3377
- case 8:
3378
- return _context2.abrupt("return", data);
3379
- case 9:
3380
- case "end":
3381
- return _context2.stop();
3167
+ case 3:
3168
+ return _context2.a(2, data);
3382
3169
  }
3383
3170
  }, _callee2);
3384
3171
  }));
@@ -3393,14 +3180,14 @@ var handler$3 = {
3393
3180
  var _excluded$1 = ["locale"];
3394
3181
  var getFetcher = function getFetcher(storeDomain, accessToken) {
3395
3182
  return /*#__PURE__*/function () {
3396
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
3183
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
3397
3184
  var _ref$url, url, _ref$method, method, variables, query, _ref3, locale, vars, res, _yield$res$json, data, errors, _yield$res$json2, _errors;
3398
- return _regeneratorRuntime().wrap(function _callee$(_context) {
3399
- while (1) switch (_context.prev = _context.next) {
3185
+ return _regenerator().w(function (_context) {
3186
+ while (1) switch (_context.n) {
3400
3187
  case 0:
3401
3188
  _ref$url = _ref.url, url = _ref$url === void 0 ? "https://" + storeDomain + "/api/" + shopifyApiVersion + "/graphql.json" : _ref$url, _ref$method = _ref.method, method = _ref$method === void 0 ? "POST" : _ref$method, variables = _ref.variables, query = _ref.query;
3402
3189
  _ref3 = variables != null ? variables : {}, locale = _ref3.locale, vars = _objectWithoutPropertiesLoose(_ref3, _excluded$1);
3403
- _context.next = 4;
3190
+ _context.n = 1;
3404
3191
  return fetch(url, {
3405
3192
  method: method,
3406
3193
  body: JSON.stringify({
@@ -3414,35 +3201,34 @@ var getFetcher = function getFetcher(storeDomain, accessToken) {
3414
3201
  "Accept-Language": locale
3415
3202
  })
3416
3203
  });
3417
- case 4:
3418
- res = _context.sent;
3204
+ case 1:
3205
+ res = _context.v;
3419
3206
  if (!res.ok) {
3420
- _context.next = 16;
3207
+ _context.n = 4;
3421
3208
  break;
3422
3209
  }
3423
- _context.next = 8;
3210
+ _context.n = 2;
3424
3211
  return res.json();
3425
- case 8:
3426
- _yield$res$json = _context.sent;
3212
+ case 2:
3213
+ _yield$res$json = _context.v;
3427
3214
  data = _yield$res$json.data;
3428
3215
  errors = _yield$res$json.errors;
3429
3216
  if (!(errors && errors.length)) {
3430
- _context.next = 13;
3217
+ _context.n = 3;
3431
3218
  break;
3432
3219
  }
3433
3220
  throw getError(errors, res.status);
3434
- case 13:
3435
- return _context.abrupt("return", data);
3436
- case 16:
3437
- _context.next = 18;
3221
+ case 3:
3222
+ return _context.a(2, data);
3223
+ case 4:
3224
+ _context.n = 5;
3438
3225
  return res.json();
3439
- case 18:
3440
- _yield$res$json2 = _context.sent;
3226
+ case 5:
3227
+ _yield$res$json2 = _context.v;
3441
3228
  _errors = _yield$res$json2.errors;
3442
3229
  throw getError(_errors, res.status);
3443
- case 21:
3444
- case "end":
3445
- return _context.stop();
3230
+ case 6:
3231
+ return _context.a(2);
3446
3232
  }
3447
3233
  }, _callee);
3448
3234
  }));
@@ -3452,8 +3238,7 @@ var getFetcher = function getFetcher(storeDomain, accessToken) {
3452
3238
  }();
3453
3239
  };
3454
3240
  function getError(errors, status) {
3455
- var _errors2;
3456
- errors = (_errors2 = errors) != null ? _errors2 : [{
3241
+ errors = errors != null ? errors : [{
3457
3242
  message: "Failed to fetch Shopify API"
3458
3243
  }];
3459
3244
  return new FetcherError({
@@ -3470,54 +3255,51 @@ var handler$4 = {
3470
3255
  query: /*#__PURE__*/getProductQueryBySlug.toString()
3471
3256
  },
3472
3257
  fetcher: function fetcher(_ref) {
3473
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
3258
+ return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
3474
3259
  var input, options, fetch, id, product, data, _data;
3475
- return _regeneratorRuntime().wrap(function _callee$(_context) {
3476
- while (1) switch (_context.prev = _context.next) {
3260
+ return _regenerator().w(function (_context) {
3261
+ while (1) switch (_context.n) {
3477
3262
  case 0:
3478
3263
  input = _ref.input, options = _ref.options, fetch = _ref.fetch;
3479
3264
  id = input.id;
3480
3265
  if (id) {
3481
- _context.next = 4;
3266
+ _context.n = 1;
3482
3267
  break;
3483
3268
  }
3484
- return _context.abrupt("return", null);
3485
- case 4:
3269
+ return _context.a(2, null);
3270
+ case 1:
3486
3271
  product = null;
3487
3272
  if (!id.startsWith("gid://shopify")) {
3488
- _context.next = 12;
3273
+ _context.n = 3;
3489
3274
  break;
3490
3275
  }
3491
- _context.next = 8;
3276
+ _context.n = 2;
3492
3277
  return fetch({
3493
3278
  query: getProductQueryById.toString(),
3494
3279
  variables: {
3495
3280
  id: id
3496
3281
  }
3497
3282
  });
3498
- case 8:
3499
- data = _context.sent;
3283
+ case 2:
3284
+ data = _context.v;
3500
3285
  product = data.product;
3501
- _context.next = 16;
3286
+ _context.n = 5;
3502
3287
  break;
3503
- case 12:
3504
- _context.next = 14;
3288
+ case 3:
3289
+ _context.n = 4;
3505
3290
  return fetch({
3506
3291
  query: options.query,
3507
3292
  variables: {
3508
3293
  slug: id
3509
3294
  }
3510
3295
  });
3511
- case 14:
3512
- _data = _context.sent;
3296
+ case 4:
3297
+ _data = _context.v;
3513
3298
  if (_data.productByHandle) {
3514
3299
  product = _data.productByHandle;
3515
3300
  }
3516
- case 16:
3517
- return _context.abrupt("return", product ? normalizeProduct(product) : null);
3518
- case 17:
3519
- case "end":
3520
- return _context.stop();
3301
+ case 5:
3302
+ return _context.a(2, product ? normalizeProduct(product) : null);
3521
3303
  }
3522
3304
  }, _callee);
3523
3305
  }))();
@@ -3610,21 +3392,21 @@ var handler$5 = {
3610
3392
  query: /*#__PURE__*/getAllProductsQuery.toString()
3611
3393
  },
3612
3394
  fetcher: function fetcher(_ref) {
3613
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
3395
+ return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
3614
3396
  var _products, _products2;
3615
3397
  var input, options, fetch, categoryId, brandId, method, variables, products, _data$node, _data$node2, data, _data$products, _data;
3616
- return _regeneratorRuntime().wrap(function _callee$(_context) {
3617
- while (1) switch (_context.prev = _context.next) {
3398
+ return _regenerator().w(function (_context) {
3399
+ while (1) switch (_context.n) {
3618
3400
  case 0:
3619
3401
  input = _ref.input, options = _ref.options, fetch = _ref.fetch;
3620
3402
  categoryId = input.categoryId, brandId = input.brandId;
3621
3403
  method = options == null ? void 0 : options.method;
3622
3404
  variables = getSearchVariables(input);
3623
3405
  if (!categoryId) {
3624
- _context.next = 11;
3406
+ _context.n = 2;
3625
3407
  break;
3626
3408
  }
3627
- _context.next = 7;
3409
+ _context.n = 1;
3628
3410
  return fetch({
3629
3411
  query: getCollectionProductsQuery.toString(),
3630
3412
  method: method,
@@ -3632,36 +3414,33 @@ var handler$5 = {
3632
3414
  first: undefined
3633
3415
  })
3634
3416
  });
3635
- case 7:
3636
- data = _context.sent;
3417
+ case 1:
3418
+ data = _context.v;
3637
3419
  // filter on client when brandId & categoryId are set since is not available on collection product query
3638
3420
  products = brandId ? (_data$node = data.node) == null || (_data$node = _data$node.products) == null || (_data$node = _data$node.edges) == null ? void 0 : _data$node.filter(function (_ref2) {
3639
3421
  var vendor = _ref2.node.vendor;
3640
3422
  return vendor.replace(/\s+/g, "-").toLowerCase() === ("" + brandId).toLowerCase();
3641
3423
  }).slice(0, input.count) : (_data$node2 = data.node) == null || (_data$node2 = _data$node2.products) == null ? void 0 : _data$node2.edges.slice(0, input.count);
3642
- _context.next = 15;
3424
+ _context.n = 4;
3643
3425
  break;
3644
- case 11:
3645
- _context.next = 13;
3426
+ case 2:
3427
+ _context.n = 3;
3646
3428
  return fetch({
3647
3429
  query: options.query,
3648
3430
  method: method,
3649
3431
  variables: variables
3650
3432
  });
3651
- case 13:
3652
- _data = _context.sent;
3433
+ case 3:
3434
+ _data = _context.v;
3653
3435
  products = (_data$products = _data.products) == null ? void 0 : _data$products.edges;
3654
- case 15:
3655
- return _context.abrupt("return", {
3436
+ case 4:
3437
+ return _context.a(2, {
3656
3438
  products: (_products = products) == null ? void 0 : _products.map(function (_ref3) {
3657
3439
  var node = _ref3.node;
3658
3440
  return normalizeProduct(node);
3659
3441
  }),
3660
3442
  found: !!((_products2 = products) != null && _products2.length)
3661
3443
  });
3662
- case 16:
3663
- case "end":
3664
- return _context.stop();
3665
3444
  }
3666
3445
  }, _callee);
3667
3446
  }))();
@@ -3689,26 +3468,26 @@ var handler$6 = {
3689
3468
  query: /*#__PURE__*/getAllProductVendors.toString()
3690
3469
  },
3691
3470
  fetcher: function fetcher(_ref) {
3692
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
3471
+ return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
3693
3472
  var fetch, data, vendorsStrings;
3694
- return _regeneratorRuntime().wrap(function _callee$(_context) {
3695
- while (1) switch (_context.prev = _context.next) {
3473
+ return _regenerator().w(function (_context) {
3474
+ while (1) switch (_context.n) {
3696
3475
  case 0:
3697
3476
  fetch = _ref.fetch;
3698
- _context.next = 3;
3477
+ _context.n = 1;
3699
3478
  return fetch({
3700
3479
  query: getAllProductVendors.toString(),
3701
3480
  variables: {
3702
3481
  first: 250
3703
3482
  }
3704
3483
  });
3705
- case 3:
3706
- data = _context.sent;
3484
+ case 1:
3485
+ data = _context.v;
3707
3486
  vendorsStrings = data.products.edges.map(function (_ref2) {
3708
3487
  var vendor = _ref2.node.vendor;
3709
3488
  return vendor;
3710
3489
  });
3711
- return _context.abrupt("return", Array.from(new Set(vendorsStrings).values()).map(function (v) {
3490
+ return _context.a(2, Array.from(new Set(vendorsStrings).values()).map(function (v) {
3712
3491
  var id = v.replace(/\s+/g, "-").toLowerCase();
3713
3492
  return {
3714
3493
  entityId: id,
@@ -3716,9 +3495,6 @@ var handler$6 = {
3716
3495
  path: "brands/" + id
3717
3496
  };
3718
3497
  }));
3719
- case 6:
3720
- case "end":
3721
- return _context.stop();
3722
3498
  }
3723
3499
  }, _callee);
3724
3500
  }))();
@@ -3755,32 +3531,32 @@ var handler$7 = {
3755
3531
  query: /*#__PURE__*/getSiteCollectionsQuery.toString()
3756
3532
  },
3757
3533
  fetcher: function fetcher(_ref) {
3758
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
3534
+ return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
3759
3535
  var input, options, fetch, categoryId, _data$collections$edg, _data$collections, data, _data;
3760
- return _regeneratorRuntime().wrap(function _callee$(_context) {
3761
- while (1) switch (_context.prev = _context.next) {
3536
+ return _regenerator().w(function (_context) {
3537
+ while (1) switch (_context.n) {
3762
3538
  case 0:
3763
3539
  input = _ref.input, options = _ref.options, fetch = _ref.fetch;
3764
3540
  categoryId = input.categoryId;
3765
3541
  if (categoryId) {
3766
- _context.next = 9;
3542
+ _context.n = 2;
3767
3543
  break;
3768
3544
  }
3769
- _context.next = 5;
3545
+ _context.n = 1;
3770
3546
  return fetch({
3771
3547
  query: options.query,
3772
3548
  variables: {
3773
3549
  first: 250
3774
3550
  }
3775
3551
  });
3776
- case 5:
3777
- data = _context.sent;
3778
- return _context.abrupt("return", (_data$collections$edg = data == null || (_data$collections = data.collections) == null || (_data$collections = _data$collections.edges) == null ? void 0 : _data$collections.map(function (_ref2) {
3552
+ case 1:
3553
+ data = _context.v;
3554
+ return _context.a(2, (_data$collections$edg = data == null || (_data$collections = data.collections) == null || (_data$collections = _data$collections.edges) == null ? void 0 : _data$collections.map(function (_ref2) {
3779
3555
  var node = _ref2.node;
3780
3556
  return normalizeCategory(node);
3781
3557
  })) != null ? _data$collections$edg : []);
3782
- case 9:
3783
- _context.next = 11;
3558
+ case 2:
3559
+ _context.n = 3;
3784
3560
  return fetch({
3785
3561
  query: getCollectionQueryById.toString(),
3786
3562
  variables: _extends({}, categoryId.startsWith("gid://") ? {
@@ -3789,12 +3565,11 @@ var handler$7 = {
3789
3565
  handle: categoryId
3790
3566
  })
3791
3567
  });
3792
- case 11:
3793
- _data = _context.sent;
3794
- return _context.abrupt("return", !!(_data != null && _data.collection) ? [normalizeCategory(_data == null ? void 0 : _data.collection)] : []);
3795
- case 13:
3796
- case "end":
3797
- return _context.stop();
3568
+ case 3:
3569
+ _data = _context.v;
3570
+ return _context.a(2, !!(_data != null && _data.collection) ? [normalizeCategory(_data == null ? void 0 : _data.collection)] : []);
3571
+ case 4:
3572
+ return _context.a(2);
3798
3573
  }
3799
3574
  }, _callee);
3800
3575
  }))();