@plasmicpkgs/commerce-commercetools 0.0.33 → 0.0.34

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.
@@ -14,49 +14,40 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
14
14
  reject(error);
15
15
  return;
16
16
  }
17
-
18
17
  if (info.done) {
19
18
  resolve(value);
20
19
  } else {
21
20
  Promise.resolve(value).then(_next, _throw);
22
21
  }
23
22
  }
24
-
25
23
  function _asyncToGenerator(fn) {
26
24
  return function () {
27
25
  var self = this,
28
- args = arguments;
26
+ args = arguments;
29
27
  return new Promise(function (resolve, reject) {
30
28
  var gen = fn.apply(self, args);
31
-
32
29
  function _next(value) {
33
30
  asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
34
31
  }
35
-
36
32
  function _throw(err) {
37
33
  asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
38
34
  }
39
-
40
35
  _next(undefined);
41
36
  });
42
37
  };
43
38
  }
44
-
45
39
  function _extends() {
46
- _extends = Object.assign || function (target) {
40
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
47
41
  for (var i = 1; i < arguments.length; i++) {
48
42
  var source = arguments[i];
49
-
50
43
  for (var key in source) {
51
44
  if (Object.prototype.hasOwnProperty.call(source, key)) {
52
45
  target[key] = source[key];
53
46
  }
54
47
  }
55
48
  }
56
-
57
49
  return target;
58
50
  };
59
-
60
51
  return _extends.apply(this, arguments);
61
52
  }
62
53
 
@@ -71,17 +62,16 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
71
62
  * This source code is licensed under the MIT license found in the
72
63
  * LICENSE file in the root directory of this source tree.
73
64
  */
65
+
74
66
  var runtime = function (exports) {
75
67
 
76
68
  var Op = Object.prototype;
77
69
  var hasOwn = Op.hasOwnProperty;
78
70
  var undefined$1; // More compressible than void 0.
79
-
80
71
  var $Symbol = typeof Symbol === "function" ? Symbol : {};
81
72
  var iteratorSymbol = $Symbol.iterator || "@@iterator";
82
73
  var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
83
74
  var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
84
-
85
75
  function define(obj, key, value) {
86
76
  Object.defineProperty(obj, key, {
87
77
  value: value,
@@ -91,7 +81,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
91
81
  });
92
82
  return obj[key];
93
83
  }
94
-
95
84
  try {
96
85
  // IE 8 has a broken Object.defineProperty that only works on DOM objects.
97
86
  define({}, "");
@@ -100,19 +89,20 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
100
89
  return obj[key] = value;
101
90
  };
102
91
  }
103
-
104
92
  function wrap(innerFn, outerFn, self, tryLocsList) {
105
93
  // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
106
94
  var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
107
95
  var generator = Object.create(protoGenerator.prototype);
108
- var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next,
109
- // .throw, and .return methods.
96
+ var context = new Context(tryLocsList || []);
110
97
 
98
+ // The ._invoke method unifies the implementations of the .next,
99
+ // .throw, and .return methods.
111
100
  generator._invoke = makeInvokeMethod(innerFn, self, context);
112
101
  return generator;
113
102
  }
103
+ exports.wrap = wrap;
114
104
 
115
- exports.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion
105
+ // Try/catch helper to minimize deoptimizations. Returns a completion
116
106
  // record like context.tryEntries[i].completion. This interface could
117
107
  // have been (and was previously) designed to take a closure to be
118
108
  // invoked without arguments, but in all the cases we care about we
@@ -122,7 +112,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
122
112
  // in every case, so we don't have to touch the arguments object. The
123
113
  // only additional allocation required is the completion record, which
124
114
  // has a stable shape and so hopefully should be cheap to allocate.
125
-
126
115
  function tryCatch(fn, obj, arg) {
127
116
  try {
128
117
  return {
@@ -136,46 +125,44 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
136
125
  };
137
126
  }
138
127
  }
139
-
140
128
  var GenStateSuspendedStart = "suspendedStart";
141
129
  var GenStateSuspendedYield = "suspendedYield";
142
130
  var GenStateExecuting = "executing";
143
- var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as
131
+ var GenStateCompleted = "completed";
132
+
133
+ // Returning this object from the innerFn has the same effect as
144
134
  // breaking out of the dispatch switch statement.
135
+ var ContinueSentinel = {};
145
136
 
146
- var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and
137
+ // Dummy constructor functions that we use as the .constructor and
147
138
  // .constructor.prototype properties for functions that return Generator
148
139
  // objects. For full spec compliance, you may wish to configure your
149
140
  // minifier not to mangle the names of these two functions.
150
-
151
141
  function Generator() {}
152
-
153
142
  function GeneratorFunction() {}
143
+ function GeneratorFunctionPrototype() {}
154
144
 
155
- function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that
145
+ // This is a polyfill for %IteratorPrototype% for environments that
156
146
  // don't natively support it.
157
-
158
-
159
147
  var IteratorPrototype = {};
160
148
  define(IteratorPrototype, iteratorSymbol, function () {
161
149
  return this;
162
150
  });
163
151
  var getProto = Object.getPrototypeOf;
164
152
  var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
165
-
166
153
  if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
167
154
  // This environment has a native %IteratorPrototype%; use it instead
168
155
  // of the polyfill.
169
156
  IteratorPrototype = NativeIteratorPrototype;
170
157
  }
171
-
172
158
  var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
173
159
  GeneratorFunction.prototype = GeneratorFunctionPrototype;
174
160
  define(Gp, "constructor", GeneratorFunctionPrototype);
175
161
  define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
176
- GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"); // Helper for defining the .next, .throw, and .return methods of the
177
- // Iterator interface in terms of a single ._invoke method.
162
+ GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
178
163
 
164
+ // Helper for defining the .next, .throw, and .return methods of the
165
+ // Iterator interface in terms of a single ._invoke method.
179
166
  function defineIteratorMethods(prototype) {
180
167
  ["next", "throw", "return"].forEach(function (method) {
181
168
  define(prototype, method, function (arg) {
@@ -183,14 +170,13 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
183
170
  });
184
171
  });
185
172
  }
186
-
187
173
  exports.isGeneratorFunction = function (genFun) {
188
174
  var ctor = typeof genFun === "function" && genFun.constructor;
189
- return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can
175
+ return ctor ? ctor === GeneratorFunction ||
176
+ // For the native GeneratorFunction constructor, the best we can
190
177
  // do is to check its .name property.
191
178
  (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
192
179
  };
193
-
194
180
  exports.mark = function (genFun) {
195
181
  if (Object.setPrototypeOf) {
196
182
  Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
@@ -198,31 +184,27 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
198
184
  genFun.__proto__ = GeneratorFunctionPrototype;
199
185
  define(genFun, toStringTagSymbol, "GeneratorFunction");
200
186
  }
201
-
202
187
  genFun.prototype = Object.create(Gp);
203
188
  return genFun;
204
- }; // Within the body of any async function, `await x` is transformed to
189
+ };
190
+
191
+ // Within the body of any async function, `await x` is transformed to
205
192
  // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
206
193
  // `hasOwn.call(value, "__await")` to determine if the yielded value is
207
194
  // meant to be awaited.
208
-
209
-
210
195
  exports.awrap = function (arg) {
211
196
  return {
212
197
  __await: arg
213
198
  };
214
199
  };
215
-
216
200
  function AsyncIterator(generator, PromiseImpl) {
217
201
  function invoke(method, arg, resolve, reject) {
218
202
  var record = tryCatch(generator[method], generator, arg);
219
-
220
203
  if (record.type === "throw") {
221
204
  reject(record.arg);
222
205
  } else {
223
206
  var result = record.arg;
224
207
  var value = result.value;
225
-
226
208
  if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
227
209
  return PromiseImpl.resolve(value.__await).then(function (value) {
228
210
  invoke("next", value, resolve, reject);
@@ -230,7 +212,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
230
212
  invoke("throw", err, resolve, reject);
231
213
  });
232
214
  }
233
-
234
215
  return PromiseImpl.resolve(value).then(function (unwrapped) {
235
216
  // When a yielded Promise is resolved, its final value becomes
236
217
  // the .value of the Promise<{value,done}> result for the
@@ -244,17 +225,15 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
244
225
  });
245
226
  }
246
227
  }
247
-
248
228
  var previousPromise;
249
-
250
229
  function enqueue(method, arg) {
251
230
  function callInvokeWithMethodAndArg() {
252
231
  return new PromiseImpl(function (resolve, reject) {
253
232
  invoke(method, arg, resolve, reject);
254
233
  });
255
234
  }
256
-
257
- return previousPromise = // If enqueue has been called before, then we want to wait until
235
+ return previousPromise =
236
+ // If enqueue has been called before, then we want to wait until
258
237
  // all previous Promises have been resolved before calling invoke,
259
238
  // so that results are always delivered in the correct order. If
260
239
  // enqueue has not been called before, then it is important to
@@ -266,24 +245,25 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
266
245
  // execute code before the first await. Since we implement simple
267
246
  // async functions in terms of async generators, it is especially
268
247
  // important to get this right, even though it requires care.
269
- previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later
248
+ previousPromise ? previousPromise.then(callInvokeWithMethodAndArg,
249
+ // Avoid propagating failures to Promises returned by later
270
250
  // invocations of the iterator.
271
251
  callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
272
- } // Define the unified helper method that is used to implement .next,
273
- // .throw, and .return (see defineIteratorMethods).
274
-
252
+ }
275
253
 
254
+ // Define the unified helper method that is used to implement .next,
255
+ // .throw, and .return (see defineIteratorMethods).
276
256
  this._invoke = enqueue;
277
257
  }
278
-
279
258
  defineIteratorMethods(AsyncIterator.prototype);
280
259
  define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
281
260
  return this;
282
261
  });
283
- exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of
262
+ exports.AsyncIterator = AsyncIterator;
263
+
264
+ // Note that simple async functions are implemented on top of
284
265
  // AsyncIterator objects; they just return a Promise for the value of
285
266
  // the final result produced by the iterator.
286
-
287
267
  exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
288
268
  if (PromiseImpl === void 0) PromiseImpl = Promise;
289
269
  var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
@@ -292,39 +272,32 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
292
272
  return result.done ? result.value : iter.next();
293
273
  });
294
274
  };
295
-
296
275
  function makeInvokeMethod(innerFn, self, context) {
297
276
  var state = GenStateSuspendedStart;
298
277
  return function invoke(method, arg) {
299
278
  if (state === GenStateExecuting) {
300
279
  throw new Error("Generator is already running");
301
280
  }
302
-
303
281
  if (state === GenStateCompleted) {
304
282
  if (method === "throw") {
305
283
  throw arg;
306
- } // Be forgiving, per 25.3.3.3.3 of the spec:
307
- // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
308
-
284
+ }
309
285
 
286
+ // Be forgiving, per 25.3.3.3.3 of the spec:
287
+ // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
310
288
  return doneResult();
311
289
  }
312
-
313
290
  context.method = method;
314
291
  context.arg = arg;
315
-
316
292
  while (true) {
317
293
  var delegate = context.delegate;
318
-
319
294
  if (delegate) {
320
295
  var delegateResult = maybeInvokeDelegate(delegate, context);
321
-
322
296
  if (delegateResult) {
323
297
  if (delegateResult === ContinueSentinel) continue;
324
298
  return delegateResult;
325
299
  }
326
300
  }
327
-
328
301
  if (context.method === "next") {
329
302
  // Setting context._sent for legacy support of Babel's
330
303
  // function.sent implementation.
@@ -334,51 +307,44 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
334
307
  state = GenStateCompleted;
335
308
  throw context.arg;
336
309
  }
337
-
338
310
  context.dispatchException(context.arg);
339
311
  } else if (context.method === "return") {
340
312
  context.abrupt("return", context.arg);
341
313
  }
342
-
343
314
  state = GenStateExecuting;
344
315
  var record = tryCatch(innerFn, self, context);
345
-
346
316
  if (record.type === "normal") {
347
317
  // If an exception is thrown from innerFn, we leave state ===
348
318
  // GenStateExecuting and loop back for another invocation.
349
319
  state = context.done ? GenStateCompleted : GenStateSuspendedYield;
350
-
351
320
  if (record.arg === ContinueSentinel) {
352
321
  continue;
353
322
  }
354
-
355
323
  return {
356
324
  value: record.arg,
357
325
  done: context.done
358
326
  };
359
327
  } else if (record.type === "throw") {
360
- state = GenStateCompleted; // Dispatch the exception by looping back around to the
328
+ state = GenStateCompleted;
329
+ // Dispatch the exception by looping back around to the
361
330
  // context.dispatchException(context.arg) call above.
362
-
363
331
  context.method = "throw";
364
332
  context.arg = record.arg;
365
333
  }
366
334
  }
367
335
  };
368
- } // Call delegate.iterator[context.method](context.arg) and handle the
336
+ }
337
+
338
+ // Call delegate.iterator[context.method](context.arg) and handle the
369
339
  // result, either by returning a { value, done } result from the
370
340
  // delegate iterator, or by modifying context.method and context.arg,
371
341
  // setting context.delegate to null, and returning the ContinueSentinel.
372
-
373
-
374
342
  function maybeInvokeDelegate(delegate, context) {
375
343
  var method = delegate.iterator[context.method];
376
-
377
344
  if (method === undefined$1) {
378
345
  // A .throw or .return when the delegate iterator has no .throw
379
346
  // method always terminates the yield* loop.
380
347
  context.delegate = null;
381
-
382
348
  if (context.method === "throw") {
383
349
  // Note: ["return"] must be used for ES3 parsing compatibility.
384
350
  if (delegate.iterator["return"]) {
@@ -387,51 +353,45 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
387
353
  context.method = "return";
388
354
  context.arg = undefined$1;
389
355
  maybeInvokeDelegate(delegate, context);
390
-
391
356
  if (context.method === "throw") {
392
357
  // If maybeInvokeDelegate(context) changed context.method from
393
358
  // "return" to "throw", let that override the TypeError below.
394
359
  return ContinueSentinel;
395
360
  }
396
361
  }
397
-
398
362
  context.method = "throw";
399
363
  context.arg = new TypeError("The iterator does not provide a 'throw' method");
400
364
  }
401
-
402
365
  return ContinueSentinel;
403
366
  }
404
-
405
367
  var record = tryCatch(method, delegate.iterator, context.arg);
406
-
407
368
  if (record.type === "throw") {
408
369
  context.method = "throw";
409
370
  context.arg = record.arg;
410
371
  context.delegate = null;
411
372
  return ContinueSentinel;
412
373
  }
413
-
414
374
  var info = record.arg;
415
-
416
375
  if (!info) {
417
376
  context.method = "throw";
418
377
  context.arg = new TypeError("iterator result is not an object");
419
378
  context.delegate = null;
420
379
  return ContinueSentinel;
421
380
  }
422
-
423
381
  if (info.done) {
424
382
  // Assign the result of the finished delegate to the temporary
425
383
  // variable specified by delegate.resultName (see delegateYield).
426
- context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield).
384
+ context[delegate.resultName] = info.value;
385
+
386
+ // Resume execution at the desired location (see delegateYield).
387
+ context.next = delegate.nextLoc;
427
388
 
428
- context.next = delegate.nextLoc; // If context.method was "throw" but the delegate handled the
389
+ // If context.method was "throw" but the delegate handled the
429
390
  // exception, let the outer generator proceed normally. If
430
391
  // context.method was "next", forget context.arg since it has been
431
392
  // "consumed" by the delegate iterator. If context.method was
432
393
  // "return", allow the original .return call to continue in the
433
394
  // outer generator.
434
-
435
395
  if (context.method !== "return") {
436
396
  context.method = "next";
437
397
  context.arg = undefined$1;
@@ -439,54 +399,49 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
439
399
  } else {
440
400
  // Re-yield the result returned by the delegate method.
441
401
  return info;
442
- } // The delegate iterator is finished, so forget it and continue with
443
- // the outer generator.
444
-
402
+ }
445
403
 
404
+ // The delegate iterator is finished, so forget it and continue with
405
+ // the outer generator.
446
406
  context.delegate = null;
447
407
  return ContinueSentinel;
448
- } // Define Generator.prototype.{next,throw,return} in terms of the
449
- // unified ._invoke helper method.
450
-
408
+ }
451
409
 
410
+ // Define Generator.prototype.{next,throw,return} in terms of the
411
+ // unified ._invoke helper method.
452
412
  defineIteratorMethods(Gp);
453
- define(Gp, toStringTagSymbol, "Generator"); // A Generator should always return itself as the iterator object when the
413
+ define(Gp, toStringTagSymbol, "Generator");
414
+
415
+ // A Generator should always return itself as the iterator object when the
454
416
  // @@iterator function is called on it. Some browsers' implementations of the
455
417
  // iterator prototype chain incorrectly implement this, causing the Generator
456
418
  // object to not be returned from this call. This ensures that doesn't happen.
457
419
  // See https://github.com/facebook/regenerator/issues/274 for more details.
458
-
459
420
  define(Gp, iteratorSymbol, function () {
460
421
  return this;
461
422
  });
462
423
  define(Gp, "toString", function () {
463
424
  return "[object Generator]";
464
425
  });
465
-
466
426
  function pushTryEntry(locs) {
467
427
  var entry = {
468
428
  tryLoc: locs[0]
469
429
  };
470
-
471
430
  if (1 in locs) {
472
431
  entry.catchLoc = locs[1];
473
432
  }
474
-
475
433
  if (2 in locs) {
476
434
  entry.finallyLoc = locs[2];
477
435
  entry.afterLoc = locs[3];
478
436
  }
479
-
480
437
  this.tryEntries.push(entry);
481
438
  }
482
-
483
439
  function resetTryEntry(entry) {
484
440
  var record = entry.completion || {};
485
441
  record.type = "normal";
486
442
  delete record.arg;
487
443
  entry.completion = record;
488
444
  }
489
-
490
445
  function Context(tryLocsList) {
491
446
  // The root entry object (effectively a try statement without a catch
492
447
  // or a finally block) gives us a place to store values thrown from
@@ -497,97 +452,84 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
497
452
  tryLocsList.forEach(pushTryEntry, this);
498
453
  this.reset(true);
499
454
  }
500
-
501
455
  exports.keys = function (object) {
502
456
  var keys = [];
503
-
504
457
  for (var key in object) {
505
458
  keys.push(key);
506
459
  }
460
+ keys.reverse();
507
461
 
508
- keys.reverse(); // Rather than returning an object with a next method, we keep
462
+ // Rather than returning an object with a next method, we keep
509
463
  // things simple and return the next function itself.
510
-
511
464
  return function next() {
512
465
  while (keys.length) {
513
466
  var key = keys.pop();
514
-
515
467
  if (key in object) {
516
468
  next.value = key;
517
469
  next.done = false;
518
470
  return next;
519
471
  }
520
- } // To avoid creating an additional object, we just hang the .value
472
+ }
473
+
474
+ // To avoid creating an additional object, we just hang the .value
521
475
  // and .done properties off the next function object itself. This
522
476
  // also ensures that the minifier will not anonymize the function.
523
-
524
-
525
477
  next.done = true;
526
478
  return next;
527
479
  };
528
480
  };
529
-
530
481
  function values(iterable) {
531
482
  if (iterable) {
532
483
  var iteratorMethod = iterable[iteratorSymbol];
533
-
534
484
  if (iteratorMethod) {
535
485
  return iteratorMethod.call(iterable);
536
486
  }
537
-
538
487
  if (typeof iterable.next === "function") {
539
488
  return iterable;
540
489
  }
541
-
542
490
  if (!isNaN(iterable.length)) {
543
491
  var i = -1,
544
- next = function next() {
545
- while (++i < iterable.length) {
546
- if (hasOwn.call(iterable, i)) {
547
- next.value = iterable[i];
548
- next.done = false;
549
- return next;
492
+ next = function next() {
493
+ while (++i < iterable.length) {
494
+ if (hasOwn.call(iterable, i)) {
495
+ next.value = iterable[i];
496
+ next.done = false;
497
+ return next;
498
+ }
550
499
  }
551
- }
552
-
553
- next.value = undefined$1;
554
- next.done = true;
555
- return next;
556
- };
557
-
500
+ next.value = undefined$1;
501
+ next.done = true;
502
+ return next;
503
+ };
558
504
  return next.next = next;
559
505
  }
560
- } // Return an iterator with no values.
561
-
506
+ }
562
507
 
508
+ // Return an iterator with no values.
563
509
  return {
564
510
  next: doneResult
565
511
  };
566
512
  }
567
-
568
513
  exports.values = values;
569
-
570
514
  function doneResult() {
571
515
  return {
572
516
  value: undefined$1,
573
517
  done: true
574
518
  };
575
519
  }
576
-
577
520
  Context.prototype = {
578
521
  constructor: Context,
579
522
  reset: function reset(skipTempReset) {
580
523
  this.prev = 0;
581
- this.next = 0; // Resetting context._sent for legacy support of Babel's
524
+ this.next = 0;
525
+ // Resetting context._sent for legacy support of Babel's
582
526
  // function.sent implementation.
583
-
584
527
  this.sent = this._sent = undefined$1;
585
528
  this.done = false;
586
529
  this.delegate = null;
587
530
  this.method = "next";
588
531
  this.arg = undefined$1;
589
532
  this.tryEntries.forEach(resetTryEntry);
590
-
591
533
  if (!skipTempReset) {
592
534
  for (var name in this) {
593
535
  // Not sure about the optimal order of these conditions:
@@ -601,50 +543,40 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
601
543
  this.done = true;
602
544
  var rootEntry = this.tryEntries[0];
603
545
  var rootRecord = rootEntry.completion;
604
-
605
546
  if (rootRecord.type === "throw") {
606
547
  throw rootRecord.arg;
607
548
  }
608
-
609
549
  return this.rval;
610
550
  },
611
551
  dispatchException: function dispatchException(exception) {
612
552
  if (this.done) {
613
553
  throw exception;
614
554
  }
615
-
616
555
  var context = this;
617
-
618
556
  function handle(loc, caught) {
619
557
  record.type = "throw";
620
558
  record.arg = exception;
621
559
  context.next = loc;
622
-
623
560
  if (caught) {
624
561
  // If the dispatched exception was caught by a catch block,
625
562
  // then let that catch block handle the exception normally.
626
563
  context.method = "next";
627
564
  context.arg = undefined$1;
628
565
  }
629
-
630
566
  return !!caught;
631
567
  }
632
-
633
568
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
634
569
  var entry = this.tryEntries[i];
635
570
  var record = entry.completion;
636
-
637
571
  if (entry.tryLoc === "root") {
638
572
  // Exception thrown outside of any try block that could handle
639
573
  // it, so set the completion value of the entire function to
640
574
  // throw the exception.
641
575
  return handle("end");
642
576
  }
643
-
644
577
  if (entry.tryLoc <= this.prev) {
645
578
  var hasCatch = hasOwn.call(entry, "catchLoc");
646
579
  var hasFinally = hasOwn.call(entry, "finallyLoc");
647
-
648
580
  if (hasCatch && hasFinally) {
649
581
  if (this.prev < entry.catchLoc) {
650
582
  return handle(entry.catchLoc, true);
@@ -668,36 +600,30 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
668
600
  abrupt: function abrupt(type, arg) {
669
601
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
670
602
  var entry = this.tryEntries[i];
671
-
672
603
  if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
673
604
  var finallyEntry = entry;
674
605
  break;
675
606
  }
676
607
  }
677
-
678
608
  if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
679
609
  // Ignore the finally entry if control is not jumping to a
680
610
  // location outside the try/catch block.
681
611
  finallyEntry = null;
682
612
  }
683
-
684
613
  var record = finallyEntry ? finallyEntry.completion : {};
685
614
  record.type = type;
686
615
  record.arg = arg;
687
-
688
616
  if (finallyEntry) {
689
617
  this.method = "next";
690
618
  this.next = finallyEntry.finallyLoc;
691
619
  return ContinueSentinel;
692
620
  }
693
-
694
621
  return this.complete(record);
695
622
  },
696
623
  complete: function complete(record, afterLoc) {
697
624
  if (record.type === "throw") {
698
625
  throw record.arg;
699
626
  }
700
-
701
627
  if (record.type === "break" || record.type === "continue") {
702
628
  this.next = record.arg;
703
629
  } else if (record.type === "return") {
@@ -707,13 +633,11 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
707
633
  } else if (record.type === "normal" && afterLoc) {
708
634
  this.next = afterLoc;
709
635
  }
710
-
711
636
  return ContinueSentinel;
712
637
  },
713
638
  finish: function finish(finallyLoc) {
714
639
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
715
640
  var entry = this.tryEntries[i];
716
-
717
641
  if (entry.finallyLoc === finallyLoc) {
718
642
  this.complete(entry.completion, entry.afterLoc);
719
643
  resetTryEntry(entry);
@@ -724,21 +648,18 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
724
648
  "catch": function _catch(tryLoc) {
725
649
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
726
650
  var entry = this.tryEntries[i];
727
-
728
651
  if (entry.tryLoc === tryLoc) {
729
652
  var record = entry.completion;
730
-
731
653
  if (record.type === "throw") {
732
654
  var thrown = record.arg;
733
655
  resetTryEntry(entry);
734
656
  }
735
-
736
657
  return thrown;
737
658
  }
738
- } // The context.catch method must only be called with a location
739
- // argument that corresponds to a known catch block.
740
-
659
+ }
741
660
 
661
+ // The context.catch method must only be called with a location
662
+ // argument that corresponds to a known catch block.
742
663
  throw new Error("illegal catch attempt");
743
664
  },
744
665
  delegateYield: function delegateYield(iterable, resultName, nextLoc) {
@@ -747,27 +668,26 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
747
668
  resultName: resultName,
748
669
  nextLoc: nextLoc
749
670
  };
750
-
751
671
  if (this.method === "next") {
752
672
  // Deliberately forget the last sent value so that we don't
753
673
  // accidentally pass it on to the delegate.
754
674
  this.arg = undefined$1;
755
675
  }
756
-
757
676
  return ContinueSentinel;
758
677
  }
759
- }; // Regardless of whether this script is executing as a CommonJS module
678
+ };
679
+
680
+ // Regardless of whether this script is executing as a CommonJS module
760
681
  // or not, return the runtime object so that we can declare the variable
761
682
  // regeneratorRuntime in the outer scope, which allows this module to be
762
683
  // injected easily by `bin/regenerator --include-runtime script.js`.
763
-
764
684
  return exports;
765
- }( // If this script is executing as a CommonJS module, use module.exports
685
+ }(
686
+ // If this script is executing as a CommonJS module, use module.exports
766
687
  // as the regeneratorRuntime namespace. Otherwise create a new empty
767
688
  // object. Either way, the resulting object will be used to initialize
768
689
  // the regeneratorRuntime variable at the top of this file.
769
690
  module.exports );
770
-
771
691
  try {
772
692
  regeneratorRuntime = runtime;
773
693
  } catch (accidentalStrictMode) {
@@ -790,28 +710,22 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
790
710
  });
791
711
 
792
712
  var getSortVariables = function getSortVariables(sort, isCategory) {
793
-
794
713
  var output = undefined;
795
-
796
714
  switch (sort) {
797
715
  case 'price-asc':
798
716
  output = 'price asc';
799
717
  break;
800
-
801
718
  case 'price-desc':
802
719
  output = 'price desc';
803
720
  break;
804
-
805
721
  case 'trending-desc':
806
722
  // default option
807
723
  output = undefined;
808
724
  break;
809
-
810
725
  case 'latest-desc':
811
726
  output = 'createdAt desc';
812
727
  break;
813
728
  }
814
-
815
729
  return output;
816
730
  };
817
731
 
@@ -861,18 +775,14 @@ var createCart = /*#__PURE__*/function () {
861
775
  method: 'post',
862
776
  body: draft
863
777
  });
864
-
865
778
  case 3:
866
779
  cart = _context.sent;
867
-
868
780
  if (!cart.body) {
869
781
  removeCartCookie();
870
782
  } else {
871
783
  setCartId(cart.body.id);
872
784
  }
873
-
874
785
  return _context.abrupt("return", cart.body);
875
-
876
786
  case 6:
877
787
  case "end":
878
788
  return _context.stop();
@@ -880,7 +790,6 @@ var createCart = /*#__PURE__*/function () {
880
790
  }
881
791
  }, _callee);
882
792
  }));
883
-
884
793
  return function createCart(_x) {
885
794
  return _ref.apply(this, arguments);
886
795
  };
@@ -894,12 +803,10 @@ var getActiveCart = /*#__PURE__*/function () {
894
803
  switch (_context.prev = _context.next) {
895
804
  case 0:
896
805
  cartId = getCartId();
897
-
898
806
  if (!cartId) {
899
807
  _context.next = 7;
900
808
  break;
901
809
  }
902
-
903
810
  _context.next = 4;
904
811
  return fetch({
905
812
  query: 'carts',
@@ -908,28 +815,22 @@ var getActiveCart = /*#__PURE__*/function () {
908
815
  id: cartId
909
816
  }
910
817
  });
911
-
912
818
  case 4:
913
819
  activeCart = _context.sent.body;
914
820
  _context.next = 10;
915
821
  break;
916
-
917
822
  case 7:
918
823
  _context.next = 9;
919
824
  return createCart(fetch);
920
-
921
825
  case 9:
922
826
  activeCart = _context.sent;
923
-
924
827
  case 10:
925
828
  if (!activeCart) {
926
829
  removeCartCookie();
927
830
  } else {
928
831
  setCartId(activeCart.id);
929
832
  }
930
-
931
833
  return _context.abrupt("return", activeCart);
932
-
933
834
  case 12:
934
835
  case "end":
935
836
  return _context.stop();
@@ -937,7 +838,6 @@ var getActiveCart = /*#__PURE__*/function () {
937
838
  }
938
839
  }, _callee);
939
840
  }));
940
-
941
841
  return function getActiveCart(_x) {
942
842
  return _ref.apply(this, arguments);
943
843
  };
@@ -957,11 +857,9 @@ var dedup = function dedup(xs) {
957
857
  };
958
858
 
959
859
  var currencyCode = 'USD';
960
-
961
860
  var stringify = function stringify(value) {
962
861
  return typeof value === 'string' ? value : JSON.stringify(value);
963
862
  };
964
-
965
863
  var money = function money(price) {
966
864
  return price ? {
967
865
  value: price.centAmount / 100,
@@ -971,7 +869,6 @@ var money = function money(price) {
971
869
  currencyCode: currencyCode
972
870
  };
973
871
  };
974
-
975
872
  var normalizeProductOption = function normalizeProductOption(option) {
976
873
  return {
977
874
  __typename: 'MultipleChoiceOption',
@@ -991,7 +888,6 @@ var normalizeProductOption = function normalizeProductOption(option) {
991
888
  })
992
889
  };
993
890
  };
994
-
995
891
  var normalizeProductImages = function normalizeProductImages(images) {
996
892
  return images.map(function (image) {
997
893
  return _extends({
@@ -1004,10 +900,8 @@ var normalizeProductImages = function normalizeProductImages(images) {
1004
900
  });
1005
901
  });
1006
902
  };
1007
-
1008
903
  var normalizeProductVariant = function normalizeProductVariant(variant) {
1009
904
  var _variant$prices$find$, _variant$prices, _variant$prices$find, _variant$prices2, _variant$prices2$, _variant$sku, _variant$attributes$m, _variant$attributes;
1010
-
1011
905
  var price = money((_variant$prices$find$ = (_variant$prices = variant.prices) == null ? void 0 : (_variant$prices$find = _variant$prices.find(function (price) {
1012
906
  return price.value.currencyCode === currencyCode;
1013
907
  })) == null ? void 0 : _variant$prices$find.value) != null ? _variant$prices$find$ : (_variant$prices2 = variant.prices) == null ? void 0 : (_variant$prices2$ = _variant$prices2[0]) == null ? void 0 : _variant$prices2$.value).value;
@@ -1026,10 +920,8 @@ var normalizeProductVariant = function normalizeProductVariant(variant) {
1026
920
  listPrice: price
1027
921
  };
1028
922
  };
1029
-
1030
923
  var normalizeProduct = function normalizeProduct(product, locale) {
1031
924
  var _getLocalizedString, _getLocalizedString2, _product$masterVarian, _product$masterVarian2, _product$masterVarian3, _product$masterVarian4, _product$masterVarian5;
1032
-
1033
925
  return {
1034
926
  id: product.id,
1035
927
  name: (_getLocalizedString = getLocalizedString(product.name, locale)) != null ? _getLocalizedString : "",
@@ -1049,7 +941,6 @@ var normalizeProduct = function normalizeProduct(product, locale) {
1049
941
  var groupedAttribute = groupedAttributes.find(function (gAttr) {
1050
942
  return gAttr.name === attribute.name;
1051
943
  });
1052
-
1053
944
  if (groupedAttribute) {
1054
945
  groupedAttribute.value.push(stringify(attribute.value.key));
1055
946
  } else {
@@ -1058,15 +949,12 @@ var normalizeProduct = function normalizeProduct(product, locale) {
1058
949
  value: [stringify(attribute.value.key)]
1059
950
  });
1060
951
  }
1061
-
1062
952
  return groupedAttributes;
1063
953
  }, []).map(normalizeProductOption)
1064
954
  };
1065
955
  };
1066
-
1067
956
  var normalizeLineItem = function normalizeLineItem(lineItem, locale) {
1068
957
  var _getLocalizedString3, _lineItem$variant$att, _lineItem$variant$att2;
1069
-
1070
958
  return {
1071
959
  id: lineItem.id,
1072
960
  variantId: "" + lineItem.variant.id,
@@ -1085,7 +973,6 @@ var normalizeLineItem = function normalizeLineItem(lineItem, locale) {
1085
973
  })) != null ? _lineItem$variant$att : []
1086
974
  };
1087
975
  };
1088
-
1089
976
  var normalizeCart = function normalizeCart(cart, locale) {
1090
977
  return {
1091
978
  id: cart.id,
@@ -1107,7 +994,6 @@ var normalizeCart = function normalizeCart(cart, locale) {
1107
994
  };
1108
995
  var normalizeCategory = function normalizeCategory(category, locale) {
1109
996
  var _getLocalizedString4, _getLocalizedString5;
1110
-
1111
997
  return {
1112
998
  id: category.id,
1113
999
  name: (_getLocalizedString4 = getLocalizedString(category.name, locale)) != null ? _getLocalizedString4 : "",
@@ -1124,7 +1010,6 @@ var handler = {
1124
1010
  fetcher: function fetcher(_ref) {
1125
1011
  return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
1126
1012
  var _search;
1127
-
1128
1013
  var input, options, fetch, provider, search, categoryId, sort, count, response;
1129
1014
  return runtime_1.wrap(function _callee$(_context) {
1130
1015
  while (1) {
@@ -1144,7 +1029,6 @@ var handler = {
1144
1029
  filters: "categories.id: subtree(\"" + categoryId + "\")"
1145
1030
  } : {})
1146
1031
  }));
1147
-
1148
1032
  case 4:
1149
1033
  response = _context.sent;
1150
1034
  return _context.abrupt("return", {
@@ -1153,7 +1037,6 @@ var handler = {
1153
1037
  }),
1154
1038
  found: response.body.count > 0
1155
1039
  });
1156
-
1157
1040
  case 6:
1158
1041
  case "end":
1159
1042
  return _context.stop();
@@ -1168,7 +1051,6 @@ var handler = {
1168
1051
  if (input === void 0) {
1169
1052
  input = {};
1170
1053
  }
1171
-
1172
1054
  return useData({
1173
1055
  input: [['search', input.search], ['categoryId', input.categoryId], ['brandId', input.brandId], ['sort', input.sort], ['locale', input.locale], ['count', input.count]],
1174
1056
  swrOptions: _extends({
@@ -1193,14 +1075,11 @@ var handler$1 = {
1193
1075
  case 0:
1194
1076
  input = _ref.input, options = _ref.options, fetch = _ref.fetch, provider = _ref.provider;
1195
1077
  id = input.id;
1196
-
1197
1078
  if (id) {
1198
1079
  _context.next = 4;
1199
1080
  break;
1200
1081
  }
1201
-
1202
1082
  return _context.abrupt("return", null);
1203
-
1204
1083
  case 4:
1205
1084
  _context.next = 6;
1206
1085
  return fetch(_extends({}, options, {
@@ -1208,11 +1087,9 @@ var handler$1 = {
1208
1087
  id: id
1209
1088
  }
1210
1089
  }));
1211
-
1212
1090
  case 6:
1213
1091
  product = _context.sent;
1214
1092
  return _context.abrupt("return", product.body ? normalizeProduct(product.body, provider.locale) : null);
1215
-
1216
1093
  case 8:
1217
1094
  case "end":
1218
1095
  return _context.stop();
@@ -1227,7 +1104,6 @@ var handler$1 = {
1227
1104
  if (input === void 0) {
1228
1105
  input = {};
1229
1106
  }
1230
-
1231
1107
  return useData({
1232
1108
  input: [['id', input.id]],
1233
1109
  swrOptions: _extends({
@@ -1253,11 +1129,9 @@ var handler$2 = {
1253
1129
  fetch = _ref.fetch, provider = _ref.provider;
1254
1130
  _context.next = 3;
1255
1131
  return getActiveCart(fetch);
1256
-
1257
1132
  case 3:
1258
1133
  activeCart = _context.sent;
1259
1134
  return _context.abrupt("return", activeCart ? normalizeCart(activeCart, provider.locale) : null);
1260
-
1261
1135
  case 5:
1262
1136
  case "end":
1263
1137
  return _context.stop();
@@ -1279,7 +1153,6 @@ var handler$2 = {
1279
1153
  isEmpty: {
1280
1154
  get: function get() {
1281
1155
  var _response$data$lineIt, _response$data;
1282
-
1283
1156
  return ((_response$data$lineIt = (_response$data = response.data) == null ? void 0 : _response$data.lineItems.length) != null ? _response$data$lineIt : 0) <= 0;
1284
1157
  },
1285
1158
  enumerable: true
@@ -1298,7 +1171,6 @@ var handler$3 = {
1298
1171
  fetcher: function fetcher(_ref) {
1299
1172
  return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
1300
1173
  var _item$quantity;
1301
-
1302
1174
  var item, fetch, provider, activeCart, lineItem, updatedCart;
1303
1175
  return runtime_1.wrap(function _callee$(_context) {
1304
1176
  while (1) {
@@ -1307,17 +1179,13 @@ var handler$3 = {
1307
1179
  item = _ref.input, fetch = _ref.fetch, provider = _ref.provider;
1308
1180
  _context.next = 3;
1309
1181
  return getActiveCart(fetch);
1310
-
1311
1182
  case 3:
1312
1183
  activeCart = _context.sent;
1313
-
1314
1184
  if (!(item.quantity && (!Number.isInteger(item.quantity) || item.quantity < 1) || !activeCart)) {
1315
1185
  _context.next = 6;
1316
1186
  break;
1317
1187
  }
1318
-
1319
1188
  return _context.abrupt("return", undefined);
1320
-
1321
1189
  case 6:
1322
1190
  lineItem = {
1323
1191
  version: activeCart.version,
@@ -1337,18 +1205,14 @@ var handler$3 = {
1337
1205
  },
1338
1206
  body: lineItem
1339
1207
  });
1340
-
1341
1208
  case 9:
1342
1209
  updatedCart = _context.sent;
1343
-
1344
1210
  if (updatedCart.body) {
1345
1211
  setCartId(updatedCart.body.id);
1346
1212
  } else {
1347
1213
  removeCartCookie();
1348
1214
  }
1349
-
1350
1215
  return _context.abrupt("return", updatedCart.body ? normalizeCart(updatedCart.body, provider.locale) : undefined);
1351
-
1352
1216
  case 12:
1353
1217
  case "end":
1354
1218
  return _context.stop();
@@ -1361,8 +1225,7 @@ var handler$3 = {
1361
1225
  var fetch = _ref2.fetch;
1362
1226
  return function () {
1363
1227
  var _useCart = useCart(),
1364
- mutate = _useCart.mutate;
1365
-
1228
+ mutate = _useCart.mutate;
1366
1229
  return useCallback( /*#__PURE__*/function () {
1367
1230
  var _addItem = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(input) {
1368
1231
  var data;
@@ -1374,15 +1237,12 @@ var handler$3 = {
1374
1237
  return fetch({
1375
1238
  input: input
1376
1239
  });
1377
-
1378
1240
  case 2:
1379
1241
  data = _context2.sent;
1380
1242
  _context2.next = 5;
1381
1243
  return mutate(data, false);
1382
-
1383
1244
  case 5:
1384
1245
  return _context2.abrupt("return", data);
1385
-
1386
1246
  case 6:
1387
1247
  case "end":
1388
1248
  return _context2.stop();
@@ -1390,11 +1250,9 @@ var handler$3 = {
1390
1250
  }
1391
1251
  }, _callee2);
1392
1252
  }));
1393
-
1394
1253
  function addItem(_x) {
1395
1254
  return _addItem.apply(this, arguments);
1396
1255
  }
1397
-
1398
1256
  return addItem;
1399
1257
  }(), [fetch, mutate]);
1400
1258
  };
@@ -1415,21 +1273,17 @@ var handler$4 = {
1415
1273
  case 0:
1416
1274
  input = _ref.input, options = _ref.options, fetch = _ref.fetch, provider = _ref.provider;
1417
1275
  categoryId = input.categoryId;
1418
-
1419
1276
  if (categoryId) {
1420
1277
  _context.next = 9;
1421
1278
  break;
1422
1279
  }
1423
-
1424
1280
  _context.next = 5;
1425
1281
  return fetch(_extends({}, options));
1426
-
1427
1282
  case 5:
1428
1283
  categories = _context.sent;
1429
1284
  return _context.abrupt("return", categories.body ? categories.body.results.map(function (category) {
1430
1285
  return normalizeCategory(category, provider.locale);
1431
1286
  }) : []);
1432
-
1433
1287
  case 9:
1434
1288
  _context.next = 11;
1435
1289
  return fetch(_extends({}, options, {
@@ -1437,11 +1291,9 @@ var handler$4 = {
1437
1291
  id: categoryId
1438
1292
  } : {})
1439
1293
  }));
1440
-
1441
1294
  case 11:
1442
1295
  category = _context.sent;
1443
1296
  return _context.abrupt("return", category.body ? [normalizeCategory(category.body, provider.locale)] : []);
1444
-
1445
1297
  case 13:
1446
1298
  case "end":
1447
1299
  return _context.stop();
@@ -1464,7 +1316,6 @@ var handler$4 = {
1464
1316
  isEmpty: {
1465
1317
  get: function get() {
1466
1318
  var _response$data$length, _response$data;
1467
-
1468
1319
  return ((_response$data$length = (_response$data = response.data) == null ? void 0 : _response$data.length) != null ? _response$data$length : 0) <= 0;
1469
1320
  },
1470
1321
  enumerable: true
@@ -1486,7 +1337,6 @@ var handler$5 = {
1486
1337
  switch (_context.prev = _context.next) {
1487
1338
  case 0:
1488
1339
  return _context.abrupt("return", null);
1489
-
1490
1340
  case 2:
1491
1341
  case "end":
1492
1342
  return _context.stop();
@@ -1508,7 +1358,6 @@ var handler$5 = {
1508
1358
  isEmpty: {
1509
1359
  get: function get() {
1510
1360
  var _response$data$length, _response$data;
1511
-
1512
1361
  return ((_response$data$length = (_response$data = response.data) == null ? void 0 : _response$data.length) != null ? _response$data$length : 0) <= 0;
1513
1362
  },
1514
1363
  enumerable: true
@@ -1520,8 +1369,8 @@ var handler$5 = {
1520
1369
  };
1521
1370
 
1522
1371
  var initCommercetoolsSDKClient = function initCommercetoolsSDKClient(creds) {
1523
- var scopes = ["manage_project:" + creds.projectKey]; // Configure authMiddlewareOptions
1524
-
1372
+ var scopes = ["manage_project:" + creds.projectKey];
1373
+ // Configure authMiddlewareOptions
1525
1374
  var authMiddlewareOptions = {
1526
1375
  host: "https://auth." + creds.region + ".commercetools.com",
1527
1376
  projectKey: creds.clientSecret,
@@ -1531,13 +1380,13 @@ var initCommercetoolsSDKClient = function initCommercetoolsSDKClient(creds) {
1531
1380
  },
1532
1381
  scopes: scopes,
1533
1382
  fetch: fetch
1534
- }; // Configure httpMiddlewareOptions
1535
-
1383
+ };
1384
+ // Configure httpMiddlewareOptions
1536
1385
  var httpMiddlewareOptions = {
1537
1386
  host: "https://api." + creds.region + ".commercetools.com",
1538
1387
  fetch: fetch
1539
- }; // Export the ClientBuilder
1540
-
1388
+ };
1389
+ // Export the ClientBuilder
1541
1390
  return new ClientBuilder().withProjectKey(creds.projectKey).withClientCredentialsFlow(authMiddlewareOptions).withHttpMiddleware(httpMiddlewareOptions).build();
1542
1391
  };
1543
1392
 
@@ -1555,21 +1404,17 @@ var getFetcher = function getFetcher(creds) {
1555
1404
  case 0:
1556
1405
  method = _ref.method, variables = _ref.variables, query = _ref.query, body = _ref.body;
1557
1406
  queryBuilder = apiRoot;
1558
-
1559
1407
  if (query) {
1560
1408
  queryBuilder = queryBuilder[query]();
1561
1409
  }
1562
-
1563
1410
  if (variables != null && variables.id) {
1564
1411
  queryBuilder = queryBuilder.withId({
1565
1412
  ID: variables.id
1566
1413
  });
1567
1414
  }
1568
-
1569
1415
  if (variables != null && variables.search) {
1570
1416
  queryBuilder = queryBuilder.search();
1571
1417
  }
1572
-
1573
1418
  _context.next = 7;
1574
1419
  return queryBuilder[method]({
1575
1420
  body: body,
@@ -1584,10 +1429,8 @@ var getFetcher = function getFetcher(creds) {
1584
1429
  where: variables.where
1585
1430
  } : {})
1586
1431
  }).execute();
1587
-
1588
1432
  case 7:
1589
1433
  return _context.abrupt("return", _context.sent);
1590
-
1591
1434
  case 8:
1592
1435
  case "end":
1593
1436
  return _context.stop();
@@ -1595,7 +1438,6 @@ var getFetcher = function getFetcher(creds) {
1595
1438
  }
1596
1439
  }, _callee);
1597
1440
  }));
1598
-
1599
1441
  return function (_x) {
1600
1442
  return _ref2.apply(this, arguments);
1601
1443
  };
@@ -1656,10 +1498,10 @@ var commerceProviderMeta = {
1656
1498
  };
1657
1499
  function CommerceProviderComponent(props) {
1658
1500
  var children = props.children,
1659
- projectKey = props.projectKey,
1660
- clientId = props.clientId,
1661
- clientSecret = props.clientSecret,
1662
- region = props.region;
1501
+ projectKey = props.projectKey,
1502
+ clientId = props.clientId,
1503
+ clientSecret = props.clientSecret,
1504
+ region = props.region;
1663
1505
  var creds = React.useMemo(function () {
1664
1506
  return {
1665
1507
  projectKey: projectKey,
@@ -1668,53 +1510,46 @@ function CommerceProviderComponent(props) {
1668
1510
  region: region
1669
1511
  };
1670
1512
  }, [projectKey, clientId, clientSecret, region]);
1671
-
1672
1513
  var _usePlasmicQueryData = usePlasmicQueryData(JSON.stringify({
1673
- creds: creds
1674
- }) + "locale", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
1675
- var fetcher, project;
1676
- return runtime_1.wrap(function _callee$(_context) {
1677
- while (1) {
1678
- switch (_context.prev = _context.next) {
1679
- case 0:
1680
- fetcher = getFetcher(creds);
1681
- _context.next = 3;
1682
- return fetcher({
1683
- method: "get"
1684
- });
1685
-
1686
- case 3:
1687
- project = _context.sent;
1688
- return _context.abrupt("return", project.body ? project.body.languages[0] : undefined);
1689
-
1690
- case 5:
1691
- case "end":
1692
- return _context.stop();
1514
+ creds: creds
1515
+ }) + "locale", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
1516
+ var fetcher, project;
1517
+ return runtime_1.wrap(function _callee$(_context) {
1518
+ while (1) {
1519
+ switch (_context.prev = _context.next) {
1520
+ case 0:
1521
+ fetcher = getFetcher(creds);
1522
+ _context.next = 3;
1523
+ return fetcher({
1524
+ method: "get"
1525
+ });
1526
+ case 3:
1527
+ project = _context.sent;
1528
+ return _context.abrupt("return", project.body ? project.body.languages[0] : undefined);
1529
+ case 5:
1530
+ case "end":
1531
+ return _context.stop();
1532
+ }
1693
1533
  }
1694
- }
1695
- }, _callee);
1696
- }))),
1697
- locale = _usePlasmicQueryData.data,
1698
- error = _usePlasmicQueryData.error,
1699
- isLoading = _usePlasmicQueryData.isLoading;
1700
-
1534
+ }, _callee);
1535
+ }))),
1536
+ locale = _usePlasmicQueryData.data,
1537
+ error = _usePlasmicQueryData.error,
1538
+ isLoading = _usePlasmicQueryData.isLoading;
1701
1539
  var CommerceProvider = React.useMemo(function () {
1702
1540
  return getCommerceProvider(creds, locale != null ? locale : "");
1703
1541
  }, [creds, locale]);
1704
-
1705
1542
  if (isLoading) {
1706
1543
  return null;
1707
1544
  } else if (error || !locale) {
1708
1545
  throw new Error(error ? error.message : "Project language not found");
1709
1546
  }
1710
-
1711
1547
  return React.createElement(CommerceProvider, null, children);
1712
1548
  }
1713
1549
  function registerCommerceProvider(loader, customCommerceProviderMeta) {
1714
1550
  var doRegisterComponent = function doRegisterComponent() {
1715
1551
  return loader ? loader.registerGlobalContext.apply(loader, arguments) : registerGlobalContext.apply(void 0, arguments);
1716
1552
  };
1717
-
1718
1553
  doRegisterComponent(CommerceProviderComponent, customCommerceProviderMeta != null ? customCommerceProviderMeta : commerceProviderMeta);
1719
1554
  }
1720
1555