@plasmicpkgs/commerce 0.0.85 → 0.0.87

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,80 +14,64 @@ 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
-
63
53
  function _inheritsLoose(subClass, superClass) {
64
54
  subClass.prototype = Object.create(superClass.prototype);
65
55
  subClass.prototype.constructor = subClass;
66
-
67
56
  _setPrototypeOf(subClass, superClass);
68
57
  }
69
-
70
58
  function _getPrototypeOf(o) {
71
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
59
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
72
60
  return o.__proto__ || Object.getPrototypeOf(o);
73
61
  };
74
62
  return _getPrototypeOf(o);
75
63
  }
76
-
77
64
  function _setPrototypeOf(o, p) {
78
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
65
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
79
66
  o.__proto__ = p;
80
67
  return o;
81
68
  };
82
-
83
69
  return _setPrototypeOf(o, p);
84
70
  }
85
-
86
71
  function _isNativeReflectConstruct() {
87
72
  if (typeof Reflect === "undefined" || !Reflect.construct) return false;
88
73
  if (Reflect.construct.sham) return false;
89
74
  if (typeof Proxy === "function") return true;
90
-
91
75
  try {
92
76
  Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
93
77
  return true;
@@ -95,10 +79,9 @@ function _isNativeReflectConstruct() {
95
79
  return false;
96
80
  }
97
81
  }
98
-
99
82
  function _construct(Parent, args, Class) {
100
83
  if (_isNativeReflectConstruct()) {
101
- _construct = Reflect.construct;
84
+ _construct = Reflect.construct.bind();
102
85
  } else {
103
86
  _construct = function _construct(Parent, args, Class) {
104
87
  var a = [null];
@@ -109,34 +92,25 @@ function _construct(Parent, args, Class) {
109
92
  return instance;
110
93
  };
111
94
  }
112
-
113
95
  return _construct.apply(null, arguments);
114
96
  }
115
-
116
97
  function _isNativeFunction(fn) {
117
98
  return Function.toString.call(fn).indexOf("[native code]") !== -1;
118
99
  }
119
-
120
100
  function _wrapNativeSuper(Class) {
121
101
  var _cache = typeof Map === "function" ? new Map() : undefined;
122
-
123
102
  _wrapNativeSuper = function _wrapNativeSuper(Class) {
124
103
  if (Class === null || !_isNativeFunction(Class)) return Class;
125
-
126
104
  if (typeof Class !== "function") {
127
105
  throw new TypeError("Super expression must either be null or a function");
128
106
  }
129
-
130
107
  if (typeof _cache !== "undefined") {
131
108
  if (_cache.has(Class)) return _cache.get(Class);
132
-
133
109
  _cache.set(Class, Wrapper);
134
110
  }
135
-
136
111
  function Wrapper() {
137
112
  return _construct(Class, arguments, _getPrototypeOf(this).constructor);
138
113
  }
139
-
140
114
  Wrapper.prototype = Object.create(Class.prototype, {
141
115
  constructor: {
142
116
  value: Wrapper,
@@ -147,25 +121,20 @@ function _wrapNativeSuper(Class) {
147
121
  });
148
122
  return _setPrototypeOf(Wrapper, Class);
149
123
  };
150
-
151
124
  return _wrapNativeSuper(Class);
152
125
  }
153
-
154
126
  function _objectWithoutPropertiesLoose(source, excluded) {
155
127
  if (source == null) return {};
156
128
  var target = {};
157
129
  var sourceKeys = Object.keys(source);
158
130
  var key, i;
159
-
160
131
  for (i = 0; i < sourceKeys.length; i++) {
161
132
  key = sourceKeys[i];
162
133
  if (excluded.indexOf(key) >= 0) continue;
163
134
  target[key] = source[key];
164
135
  }
165
-
166
136
  return target;
167
137
  }
168
-
169
138
  function _unsupportedIterableToArray(o, minLen) {
170
139
  if (!o) return;
171
140
  if (typeof o === "string") return _arrayLikeToArray(o, minLen);
@@ -174,19 +143,14 @@ function _unsupportedIterableToArray(o, minLen) {
174
143
  if (n === "Map" || n === "Set") return Array.from(o);
175
144
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
176
145
  }
177
-
178
146
  function _arrayLikeToArray(arr, len) {
179
147
  if (len == null || len > arr.length) len = arr.length;
180
-
181
148
  for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
182
-
183
149
  return arr2;
184
150
  }
185
-
186
151
  function _createForOfIteratorHelperLoose(o, allowArrayLike) {
187
152
  var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
188
153
  if (it) return (it = it.call(o)).next.bind(it);
189
-
190
154
  if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
191
155
  if (it) o = it;
192
156
  var i = 0;
@@ -200,7 +164,6 @@ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
200
164
  };
201
165
  };
202
166
  }
203
-
204
167
  throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
205
168
  }
206
169
 
@@ -215,17 +178,16 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
215
178
  * This source code is licensed under the MIT license found in the
216
179
  * LICENSE file in the root directory of this source tree.
217
180
  */
181
+
218
182
  var runtime = function (exports) {
219
183
 
220
184
  var Op = Object.prototype;
221
185
  var hasOwn = Op.hasOwnProperty;
222
186
  var undefined$1; // More compressible than void 0.
223
-
224
187
  var $Symbol = typeof Symbol === "function" ? Symbol : {};
225
188
  var iteratorSymbol = $Symbol.iterator || "@@iterator";
226
189
  var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
227
190
  var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
228
-
229
191
  function define(obj, key, value) {
230
192
  Object.defineProperty(obj, key, {
231
193
  value: value,
@@ -235,7 +197,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
235
197
  });
236
198
  return obj[key];
237
199
  }
238
-
239
200
  try {
240
201
  // IE 8 has a broken Object.defineProperty that only works on DOM objects.
241
202
  define({}, "");
@@ -244,19 +205,20 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
244
205
  return obj[key] = value;
245
206
  };
246
207
  }
247
-
248
208
  function wrap(innerFn, outerFn, self, tryLocsList) {
249
209
  // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
250
210
  var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
251
211
  var generator = Object.create(protoGenerator.prototype);
252
- var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next,
253
- // .throw, and .return methods.
212
+ var context = new Context(tryLocsList || []);
254
213
 
214
+ // The ._invoke method unifies the implementations of the .next,
215
+ // .throw, and .return methods.
255
216
  generator._invoke = makeInvokeMethod(innerFn, self, context);
256
217
  return generator;
257
218
  }
219
+ exports.wrap = wrap;
258
220
 
259
- exports.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion
221
+ // Try/catch helper to minimize deoptimizations. Returns a completion
260
222
  // record like context.tryEntries[i].completion. This interface could
261
223
  // have been (and was previously) designed to take a closure to be
262
224
  // invoked without arguments, but in all the cases we care about we
@@ -266,7 +228,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
266
228
  // in every case, so we don't have to touch the arguments object. The
267
229
  // only additional allocation required is the completion record, which
268
230
  // has a stable shape and so hopefully should be cheap to allocate.
269
-
270
231
  function tryCatch(fn, obj, arg) {
271
232
  try {
272
233
  return {
@@ -280,46 +241,44 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
280
241
  };
281
242
  }
282
243
  }
283
-
284
244
  var GenStateSuspendedStart = "suspendedStart";
285
245
  var GenStateSuspendedYield = "suspendedYield";
286
246
  var GenStateExecuting = "executing";
287
- var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as
247
+ var GenStateCompleted = "completed";
248
+
249
+ // Returning this object from the innerFn has the same effect as
288
250
  // breaking out of the dispatch switch statement.
251
+ var ContinueSentinel = {};
289
252
 
290
- var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and
253
+ // Dummy constructor functions that we use as the .constructor and
291
254
  // .constructor.prototype properties for functions that return Generator
292
255
  // objects. For full spec compliance, you may wish to configure your
293
256
  // minifier not to mangle the names of these two functions.
294
-
295
257
  function Generator() {}
296
-
297
258
  function GeneratorFunction() {}
259
+ function GeneratorFunctionPrototype() {}
298
260
 
299
- function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that
261
+ // This is a polyfill for %IteratorPrototype% for environments that
300
262
  // don't natively support it.
301
-
302
-
303
263
  var IteratorPrototype = {};
304
264
  define(IteratorPrototype, iteratorSymbol, function () {
305
265
  return this;
306
266
  });
307
267
  var getProto = Object.getPrototypeOf;
308
268
  var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
309
-
310
269
  if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
311
270
  // This environment has a native %IteratorPrototype%; use it instead
312
271
  // of the polyfill.
313
272
  IteratorPrototype = NativeIteratorPrototype;
314
273
  }
315
-
316
274
  var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
317
275
  GeneratorFunction.prototype = GeneratorFunctionPrototype;
318
276
  define(Gp, "constructor", GeneratorFunctionPrototype);
319
277
  define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
320
- GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"); // Helper for defining the .next, .throw, and .return methods of the
321
- // Iterator interface in terms of a single ._invoke method.
278
+ GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
322
279
 
280
+ // Helper for defining the .next, .throw, and .return methods of the
281
+ // Iterator interface in terms of a single ._invoke method.
323
282
  function defineIteratorMethods(prototype) {
324
283
  ["next", "throw", "return"].forEach(function (method) {
325
284
  define(prototype, method, function (arg) {
@@ -327,14 +286,13 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
327
286
  });
328
287
  });
329
288
  }
330
-
331
289
  exports.isGeneratorFunction = function (genFun) {
332
290
  var ctor = typeof genFun === "function" && genFun.constructor;
333
- return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can
291
+ return ctor ? ctor === GeneratorFunction ||
292
+ // For the native GeneratorFunction constructor, the best we can
334
293
  // do is to check its .name property.
335
294
  (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
336
295
  };
337
-
338
296
  exports.mark = function (genFun) {
339
297
  if (Object.setPrototypeOf) {
340
298
  Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
@@ -342,31 +300,27 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
342
300
  genFun.__proto__ = GeneratorFunctionPrototype;
343
301
  define(genFun, toStringTagSymbol, "GeneratorFunction");
344
302
  }
345
-
346
303
  genFun.prototype = Object.create(Gp);
347
304
  return genFun;
348
- }; // Within the body of any async function, `await x` is transformed to
305
+ };
306
+
307
+ // Within the body of any async function, `await x` is transformed to
349
308
  // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
350
309
  // `hasOwn.call(value, "__await")` to determine if the yielded value is
351
310
  // meant to be awaited.
352
-
353
-
354
311
  exports.awrap = function (arg) {
355
312
  return {
356
313
  __await: arg
357
314
  };
358
315
  };
359
-
360
316
  function AsyncIterator(generator, PromiseImpl) {
361
317
  function invoke(method, arg, resolve, reject) {
362
318
  var record = tryCatch(generator[method], generator, arg);
363
-
364
319
  if (record.type === "throw") {
365
320
  reject(record.arg);
366
321
  } else {
367
322
  var result = record.arg;
368
323
  var value = result.value;
369
-
370
324
  if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
371
325
  return PromiseImpl.resolve(value.__await).then(function (value) {
372
326
  invoke("next", value, resolve, reject);
@@ -374,7 +328,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
374
328
  invoke("throw", err, resolve, reject);
375
329
  });
376
330
  }
377
-
378
331
  return PromiseImpl.resolve(value).then(function (unwrapped) {
379
332
  // When a yielded Promise is resolved, its final value becomes
380
333
  // the .value of the Promise<{value,done}> result for the
@@ -388,17 +341,15 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
388
341
  });
389
342
  }
390
343
  }
391
-
392
344
  var previousPromise;
393
-
394
345
  function enqueue(method, arg) {
395
346
  function callInvokeWithMethodAndArg() {
396
347
  return new PromiseImpl(function (resolve, reject) {
397
348
  invoke(method, arg, resolve, reject);
398
349
  });
399
350
  }
400
-
401
- return previousPromise = // If enqueue has been called before, then we want to wait until
351
+ return previousPromise =
352
+ // If enqueue has been called before, then we want to wait until
402
353
  // all previous Promises have been resolved before calling invoke,
403
354
  // so that results are always delivered in the correct order. If
404
355
  // enqueue has not been called before, then it is important to
@@ -410,24 +361,25 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
410
361
  // execute code before the first await. Since we implement simple
411
362
  // async functions in terms of async generators, it is especially
412
363
  // important to get this right, even though it requires care.
413
- previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later
364
+ previousPromise ? previousPromise.then(callInvokeWithMethodAndArg,
365
+ // Avoid propagating failures to Promises returned by later
414
366
  // invocations of the iterator.
415
367
  callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
416
- } // Define the unified helper method that is used to implement .next,
417
- // .throw, and .return (see defineIteratorMethods).
418
-
368
+ }
419
369
 
370
+ // Define the unified helper method that is used to implement .next,
371
+ // .throw, and .return (see defineIteratorMethods).
420
372
  this._invoke = enqueue;
421
373
  }
422
-
423
374
  defineIteratorMethods(AsyncIterator.prototype);
424
375
  define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
425
376
  return this;
426
377
  });
427
- exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of
378
+ exports.AsyncIterator = AsyncIterator;
379
+
380
+ // Note that simple async functions are implemented on top of
428
381
  // AsyncIterator objects; they just return a Promise for the value of
429
382
  // the final result produced by the iterator.
430
-
431
383
  exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
432
384
  if (PromiseImpl === void 0) PromiseImpl = Promise;
433
385
  var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
@@ -436,39 +388,32 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
436
388
  return result.done ? result.value : iter.next();
437
389
  });
438
390
  };
439
-
440
391
  function makeInvokeMethod(innerFn, self, context) {
441
392
  var state = GenStateSuspendedStart;
442
393
  return function invoke(method, arg) {
443
394
  if (state === GenStateExecuting) {
444
395
  throw new Error("Generator is already running");
445
396
  }
446
-
447
397
  if (state === GenStateCompleted) {
448
398
  if (method === "throw") {
449
399
  throw arg;
450
- } // Be forgiving, per 25.3.3.3.3 of the spec:
451
- // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
452
-
400
+ }
453
401
 
402
+ // Be forgiving, per 25.3.3.3.3 of the spec:
403
+ // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
454
404
  return doneResult();
455
405
  }
456
-
457
406
  context.method = method;
458
407
  context.arg = arg;
459
-
460
408
  while (true) {
461
409
  var delegate = context.delegate;
462
-
463
410
  if (delegate) {
464
411
  var delegateResult = maybeInvokeDelegate(delegate, context);
465
-
466
412
  if (delegateResult) {
467
413
  if (delegateResult === ContinueSentinel) continue;
468
414
  return delegateResult;
469
415
  }
470
416
  }
471
-
472
417
  if (context.method === "next") {
473
418
  // Setting context._sent for legacy support of Babel's
474
419
  // function.sent implementation.
@@ -478,51 +423,44 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
478
423
  state = GenStateCompleted;
479
424
  throw context.arg;
480
425
  }
481
-
482
426
  context.dispatchException(context.arg);
483
427
  } else if (context.method === "return") {
484
428
  context.abrupt("return", context.arg);
485
429
  }
486
-
487
430
  state = GenStateExecuting;
488
431
  var record = tryCatch(innerFn, self, context);
489
-
490
432
  if (record.type === "normal") {
491
433
  // If an exception is thrown from innerFn, we leave state ===
492
434
  // GenStateExecuting and loop back for another invocation.
493
435
  state = context.done ? GenStateCompleted : GenStateSuspendedYield;
494
-
495
436
  if (record.arg === ContinueSentinel) {
496
437
  continue;
497
438
  }
498
-
499
439
  return {
500
440
  value: record.arg,
501
441
  done: context.done
502
442
  };
503
443
  } else if (record.type === "throw") {
504
- state = GenStateCompleted; // Dispatch the exception by looping back around to the
444
+ state = GenStateCompleted;
445
+ // Dispatch the exception by looping back around to the
505
446
  // context.dispatchException(context.arg) call above.
506
-
507
447
  context.method = "throw";
508
448
  context.arg = record.arg;
509
449
  }
510
450
  }
511
451
  };
512
- } // Call delegate.iterator[context.method](context.arg) and handle the
452
+ }
453
+
454
+ // Call delegate.iterator[context.method](context.arg) and handle the
513
455
  // result, either by returning a { value, done } result from the
514
456
  // delegate iterator, or by modifying context.method and context.arg,
515
457
  // setting context.delegate to null, and returning the ContinueSentinel.
516
-
517
-
518
458
  function maybeInvokeDelegate(delegate, context) {
519
459
  var method = delegate.iterator[context.method];
520
-
521
460
  if (method === undefined$1) {
522
461
  // A .throw or .return when the delegate iterator has no .throw
523
462
  // method always terminates the yield* loop.
524
463
  context.delegate = null;
525
-
526
464
  if (context.method === "throw") {
527
465
  // Note: ["return"] must be used for ES3 parsing compatibility.
528
466
  if (delegate.iterator["return"]) {
@@ -531,51 +469,45 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
531
469
  context.method = "return";
532
470
  context.arg = undefined$1;
533
471
  maybeInvokeDelegate(delegate, context);
534
-
535
472
  if (context.method === "throw") {
536
473
  // If maybeInvokeDelegate(context) changed context.method from
537
474
  // "return" to "throw", let that override the TypeError below.
538
475
  return ContinueSentinel;
539
476
  }
540
477
  }
541
-
542
478
  context.method = "throw";
543
479
  context.arg = new TypeError("The iterator does not provide a 'throw' method");
544
480
  }
545
-
546
481
  return ContinueSentinel;
547
482
  }
548
-
549
483
  var record = tryCatch(method, delegate.iterator, context.arg);
550
-
551
484
  if (record.type === "throw") {
552
485
  context.method = "throw";
553
486
  context.arg = record.arg;
554
487
  context.delegate = null;
555
488
  return ContinueSentinel;
556
489
  }
557
-
558
490
  var info = record.arg;
559
-
560
491
  if (!info) {
561
492
  context.method = "throw";
562
493
  context.arg = new TypeError("iterator result is not an object");
563
494
  context.delegate = null;
564
495
  return ContinueSentinel;
565
496
  }
566
-
567
497
  if (info.done) {
568
498
  // Assign the result of the finished delegate to the temporary
569
499
  // variable specified by delegate.resultName (see delegateYield).
570
- context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield).
500
+ context[delegate.resultName] = info.value;
501
+
502
+ // Resume execution at the desired location (see delegateYield).
503
+ context.next = delegate.nextLoc;
571
504
 
572
- context.next = delegate.nextLoc; // If context.method was "throw" but the delegate handled the
505
+ // If context.method was "throw" but the delegate handled the
573
506
  // exception, let the outer generator proceed normally. If
574
507
  // context.method was "next", forget context.arg since it has been
575
508
  // "consumed" by the delegate iterator. If context.method was
576
509
  // "return", allow the original .return call to continue in the
577
510
  // outer generator.
578
-
579
511
  if (context.method !== "return") {
580
512
  context.method = "next";
581
513
  context.arg = undefined$1;
@@ -583,54 +515,49 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
583
515
  } else {
584
516
  // Re-yield the result returned by the delegate method.
585
517
  return info;
586
- } // The delegate iterator is finished, so forget it and continue with
587
- // the outer generator.
588
-
518
+ }
589
519
 
520
+ // The delegate iterator is finished, so forget it and continue with
521
+ // the outer generator.
590
522
  context.delegate = null;
591
523
  return ContinueSentinel;
592
- } // Define Generator.prototype.{next,throw,return} in terms of the
593
- // unified ._invoke helper method.
594
-
524
+ }
595
525
 
526
+ // Define Generator.prototype.{next,throw,return} in terms of the
527
+ // unified ._invoke helper method.
596
528
  defineIteratorMethods(Gp);
597
- define(Gp, toStringTagSymbol, "Generator"); // A Generator should always return itself as the iterator object when the
529
+ define(Gp, toStringTagSymbol, "Generator");
530
+
531
+ // A Generator should always return itself as the iterator object when the
598
532
  // @@iterator function is called on it. Some browsers' implementations of the
599
533
  // iterator prototype chain incorrectly implement this, causing the Generator
600
534
  // object to not be returned from this call. This ensures that doesn't happen.
601
535
  // See https://github.com/facebook/regenerator/issues/274 for more details.
602
-
603
536
  define(Gp, iteratorSymbol, function () {
604
537
  return this;
605
538
  });
606
539
  define(Gp, "toString", function () {
607
540
  return "[object Generator]";
608
541
  });
609
-
610
542
  function pushTryEntry(locs) {
611
543
  var entry = {
612
544
  tryLoc: locs[0]
613
545
  };
614
-
615
546
  if (1 in locs) {
616
547
  entry.catchLoc = locs[1];
617
548
  }
618
-
619
549
  if (2 in locs) {
620
550
  entry.finallyLoc = locs[2];
621
551
  entry.afterLoc = locs[3];
622
552
  }
623
-
624
553
  this.tryEntries.push(entry);
625
554
  }
626
-
627
555
  function resetTryEntry(entry) {
628
556
  var record = entry.completion || {};
629
557
  record.type = "normal";
630
558
  delete record.arg;
631
559
  entry.completion = record;
632
560
  }
633
-
634
561
  function Context(tryLocsList) {
635
562
  // The root entry object (effectively a try statement without a catch
636
563
  // or a finally block) gives us a place to store values thrown from
@@ -641,97 +568,84 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
641
568
  tryLocsList.forEach(pushTryEntry, this);
642
569
  this.reset(true);
643
570
  }
644
-
645
571
  exports.keys = function (object) {
646
572
  var keys = [];
647
-
648
573
  for (var key in object) {
649
574
  keys.push(key);
650
575
  }
576
+ keys.reverse();
651
577
 
652
- keys.reverse(); // Rather than returning an object with a next method, we keep
578
+ // Rather than returning an object with a next method, we keep
653
579
  // things simple and return the next function itself.
654
-
655
580
  return function next() {
656
581
  while (keys.length) {
657
582
  var key = keys.pop();
658
-
659
583
  if (key in object) {
660
584
  next.value = key;
661
585
  next.done = false;
662
586
  return next;
663
587
  }
664
- } // To avoid creating an additional object, we just hang the .value
588
+ }
589
+
590
+ // To avoid creating an additional object, we just hang the .value
665
591
  // and .done properties off the next function object itself. This
666
592
  // also ensures that the minifier will not anonymize the function.
667
-
668
-
669
593
  next.done = true;
670
594
  return next;
671
595
  };
672
596
  };
673
-
674
597
  function values(iterable) {
675
598
  if (iterable) {
676
599
  var iteratorMethod = iterable[iteratorSymbol];
677
-
678
600
  if (iteratorMethod) {
679
601
  return iteratorMethod.call(iterable);
680
602
  }
681
-
682
603
  if (typeof iterable.next === "function") {
683
604
  return iterable;
684
605
  }
685
-
686
606
  if (!isNaN(iterable.length)) {
687
607
  var i = -1,
688
- next = function next() {
689
- while (++i < iterable.length) {
690
- if (hasOwn.call(iterable, i)) {
691
- next.value = iterable[i];
692
- next.done = false;
693
- return next;
608
+ next = function next() {
609
+ while (++i < iterable.length) {
610
+ if (hasOwn.call(iterable, i)) {
611
+ next.value = iterable[i];
612
+ next.done = false;
613
+ return next;
614
+ }
694
615
  }
695
- }
696
-
697
- next.value = undefined$1;
698
- next.done = true;
699
- return next;
700
- };
701
-
616
+ next.value = undefined$1;
617
+ next.done = true;
618
+ return next;
619
+ };
702
620
  return next.next = next;
703
621
  }
704
- } // Return an iterator with no values.
705
-
622
+ }
706
623
 
624
+ // Return an iterator with no values.
707
625
  return {
708
626
  next: doneResult
709
627
  };
710
628
  }
711
-
712
629
  exports.values = values;
713
-
714
630
  function doneResult() {
715
631
  return {
716
632
  value: undefined$1,
717
633
  done: true
718
634
  };
719
635
  }
720
-
721
636
  Context.prototype = {
722
637
  constructor: Context,
723
638
  reset: function reset(skipTempReset) {
724
639
  this.prev = 0;
725
- this.next = 0; // Resetting context._sent for legacy support of Babel's
640
+ this.next = 0;
641
+ // Resetting context._sent for legacy support of Babel's
726
642
  // function.sent implementation.
727
-
728
643
  this.sent = this._sent = undefined$1;
729
644
  this.done = false;
730
645
  this.delegate = null;
731
646
  this.method = "next";
732
647
  this.arg = undefined$1;
733
648
  this.tryEntries.forEach(resetTryEntry);
734
-
735
649
  if (!skipTempReset) {
736
650
  for (var name in this) {
737
651
  // Not sure about the optimal order of these conditions:
@@ -745,50 +659,40 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
745
659
  this.done = true;
746
660
  var rootEntry = this.tryEntries[0];
747
661
  var rootRecord = rootEntry.completion;
748
-
749
662
  if (rootRecord.type === "throw") {
750
663
  throw rootRecord.arg;
751
664
  }
752
-
753
665
  return this.rval;
754
666
  },
755
667
  dispatchException: function dispatchException(exception) {
756
668
  if (this.done) {
757
669
  throw exception;
758
670
  }
759
-
760
671
  var context = this;
761
-
762
672
  function handle(loc, caught) {
763
673
  record.type = "throw";
764
674
  record.arg = exception;
765
675
  context.next = loc;
766
-
767
676
  if (caught) {
768
677
  // If the dispatched exception was caught by a catch block,
769
678
  // then let that catch block handle the exception normally.
770
679
  context.method = "next";
771
680
  context.arg = undefined$1;
772
681
  }
773
-
774
682
  return !!caught;
775
683
  }
776
-
777
684
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
778
685
  var entry = this.tryEntries[i];
779
686
  var record = entry.completion;
780
-
781
687
  if (entry.tryLoc === "root") {
782
688
  // Exception thrown outside of any try block that could handle
783
689
  // it, so set the completion value of the entire function to
784
690
  // throw the exception.
785
691
  return handle("end");
786
692
  }
787
-
788
693
  if (entry.tryLoc <= this.prev) {
789
694
  var hasCatch = hasOwn.call(entry, "catchLoc");
790
695
  var hasFinally = hasOwn.call(entry, "finallyLoc");
791
-
792
696
  if (hasCatch && hasFinally) {
793
697
  if (this.prev < entry.catchLoc) {
794
698
  return handle(entry.catchLoc, true);
@@ -812,36 +716,30 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
812
716
  abrupt: function abrupt(type, arg) {
813
717
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
814
718
  var entry = this.tryEntries[i];
815
-
816
719
  if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
817
720
  var finallyEntry = entry;
818
721
  break;
819
722
  }
820
723
  }
821
-
822
724
  if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
823
725
  // Ignore the finally entry if control is not jumping to a
824
726
  // location outside the try/catch block.
825
727
  finallyEntry = null;
826
728
  }
827
-
828
729
  var record = finallyEntry ? finallyEntry.completion : {};
829
730
  record.type = type;
830
731
  record.arg = arg;
831
-
832
732
  if (finallyEntry) {
833
733
  this.method = "next";
834
734
  this.next = finallyEntry.finallyLoc;
835
735
  return ContinueSentinel;
836
736
  }
837
-
838
737
  return this.complete(record);
839
738
  },
840
739
  complete: function complete(record, afterLoc) {
841
740
  if (record.type === "throw") {
842
741
  throw record.arg;
843
742
  }
844
-
845
743
  if (record.type === "break" || record.type === "continue") {
846
744
  this.next = record.arg;
847
745
  } else if (record.type === "return") {
@@ -851,13 +749,11 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
851
749
  } else if (record.type === "normal" && afterLoc) {
852
750
  this.next = afterLoc;
853
751
  }
854
-
855
752
  return ContinueSentinel;
856
753
  },
857
754
  finish: function finish(finallyLoc) {
858
755
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
859
756
  var entry = this.tryEntries[i];
860
-
861
757
  if (entry.finallyLoc === finallyLoc) {
862
758
  this.complete(entry.completion, entry.afterLoc);
863
759
  resetTryEntry(entry);
@@ -868,21 +764,18 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
868
764
  "catch": function _catch(tryLoc) {
869
765
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
870
766
  var entry = this.tryEntries[i];
871
-
872
767
  if (entry.tryLoc === tryLoc) {
873
768
  var record = entry.completion;
874
-
875
769
  if (record.type === "throw") {
876
770
  var thrown = record.arg;
877
771
  resetTryEntry(entry);
878
772
  }
879
-
880
773
  return thrown;
881
774
  }
882
- } // The context.catch method must only be called with a location
883
- // argument that corresponds to a known catch block.
884
-
775
+ }
885
776
 
777
+ // The context.catch method must only be called with a location
778
+ // argument that corresponds to a known catch block.
886
779
  throw new Error("illegal catch attempt");
887
780
  },
888
781
  delegateYield: function delegateYield(iterable, resultName, nextLoc) {
@@ -891,27 +784,26 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
891
784
  resultName: resultName,
892
785
  nextLoc: nextLoc
893
786
  };
894
-
895
787
  if (this.method === "next") {
896
788
  // Deliberately forget the last sent value so that we don't
897
789
  // accidentally pass it on to the delegate.
898
790
  this.arg = undefined$1;
899
791
  }
900
-
901
792
  return ContinueSentinel;
902
793
  }
903
- }; // Regardless of whether this script is executing as a CommonJS module
794
+ };
795
+
796
+ // Regardless of whether this script is executing as a CommonJS module
904
797
  // or not, return the runtime object so that we can declare the variable
905
798
  // regeneratorRuntime in the outer scope, which allows this module to be
906
799
  // injected easily by `bin/regenerator --include-runtime script.js`.
907
-
908
800
  return exports;
909
- }( // If this script is executing as a CommonJS module, use module.exports
801
+ }(
802
+ // If this script is executing as a CommonJS module, use module.exports
910
803
  // as the regeneratorRuntime namespace. Otherwise create a new empty
911
804
  // object. Either way, the resulting object will be used to initialize
912
805
  // the regeneratorRuntime variable at the top of this file.
913
806
  module.exports );
914
-
915
807
  try {
916
808
  regeneratorRuntime = runtime;
917
809
  } catch (accidentalStrictMode) {
@@ -967,7 +859,7 @@ var defaultProduct = {
967
859
  var productSelector = "currentProduct";
968
860
  function ProductProvider(_ref) {
969
861
  var product = _ref.product,
970
- children = _ref.children;
862
+ children = _ref.children;
971
863
  var methods = useForm();
972
864
  return React.createElement(DataProvider, {
973
865
  name: productSelector,
@@ -980,11 +872,10 @@ var useProduct = function useProduct() {
980
872
  return product != null ? product : defaultProduct;
981
873
  };
982
874
  var PrimaryCategoryContext = /*#__PURE__*/React.createContext(undefined); //used to render correctly the defaultValueHint in ProductCollection
983
-
984
875
  var categorySelector = "currentCategory";
985
876
  function CategoryProvider(_ref2) {
986
877
  var category = _ref2.category,
987
- children = _ref2.children;
878
+ children = _ref2.children;
988
879
  return React.createElement(DataProvider, {
989
880
  name: categorySelector,
990
881
  data: category,
@@ -1000,8 +891,8 @@ var usePrimaryCategory = function usePrimaryCategory() {
1000
891
  var mediaSelector = "currentMedia";
1001
892
  function ProductMediaProvider(_ref3) {
1002
893
  var mediaIndex = _ref3.mediaIndex,
1003
- onClick = _ref3.onClick,
1004
- children = _ref3.children;
894
+ onClick = _ref3.onClick,
895
+ children = _ref3.children;
1005
896
  return React.createElement(DataProvider, {
1006
897
  name: mediaSelector,
1007
898
  data: mediaIndex,
@@ -1018,15 +909,15 @@ var _excluded = ["children"];
1018
909
  var Commerce = /*#__PURE__*/createContext({});
1019
910
  function CoreCommerceProvider(_ref) {
1020
911
  var provider = _ref.provider,
1021
- children = _ref.children;
1022
- var providerRef = useRef(provider); // TODO: Remove the fetcherRef
1023
-
1024
- var fetcherRef = useRef(provider.fetcher); // If the parent re-renders this provider will re-render every
912
+ children = _ref.children;
913
+ var providerRef = useRef(provider);
914
+ // TODO: Remove the fetcherRef
915
+ var fetcherRef = useRef(provider.fetcher);
916
+ // If the parent re-renders this provider will re-render every
1025
917
  // consumer unless we memoize the config
1026
-
1027
918
  var _providerRef$current = providerRef.current,
1028
- locale = _providerRef$current.locale,
1029
- cartCookie = _providerRef$current.cartCookie;
919
+ locale = _providerRef$current.locale,
920
+ cartCookie = _providerRef$current.cartCookie;
1030
921
  var cfg = useMemo(function () {
1031
922
  return {
1032
923
  providerRef: providerRef,
@@ -1042,8 +933,7 @@ function CoreCommerceProvider(_ref) {
1042
933
  function getCommerceProvider(provider) {
1043
934
  return function CommerceProvider(_ref2) {
1044
935
  var children = _ref2.children,
1045
- props = _objectWithoutPropertiesLoose(_ref2, _excluded);
1046
-
936
+ props = _objectWithoutPropertiesLoose(_ref2, _excluded);
1047
937
  return React.createElement(CoreCommerceProvider, {
1048
938
  provider: _extends({}, provider, props)
1049
939
  }, children);
@@ -1064,13 +954,11 @@ function defineProperty(obj, prop, val) {
1064
954
 
1065
955
  var CommerceError = /*#__PURE__*/function (_Error) {
1066
956
  _inheritsLoose(CommerceError, _Error);
1067
-
1068
957
  function CommerceError(_ref) {
1069
958
  var _this;
1070
-
1071
959
  var message = _ref.message,
1072
- code = _ref.code,
1073
- errors = _ref.errors;
960
+ code = _ref.code,
961
+ errors = _ref.errors;
1074
962
  var error = message ? _extends({
1075
963
  message: message
1076
964
  }, code ? {
@@ -1081,57 +969,46 @@ var CommerceError = /*#__PURE__*/function (_Error) {
1081
969
  if (error.code) _this.code = error.code;
1082
970
  return _this;
1083
971
  }
1084
-
1085
972
  return CommerceError;
1086
- }( /*#__PURE__*/_wrapNativeSuper(Error)); // Used for errors that come from a bad implementation of the hooks
1087
-
973
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
974
+ // Used for errors that come from a bad implementation of the hooks
1088
975
  var ValidationError = /*#__PURE__*/function (_CommerceError) {
1089
976
  _inheritsLoose(ValidationError, _CommerceError);
1090
-
1091
977
  function ValidationError(options) {
1092
978
  var _this2;
1093
-
1094
979
  _this2 = _CommerceError.call(this, options) || this;
1095
980
  _this2.code = 'validation_error';
1096
981
  return _this2;
1097
982
  }
1098
-
1099
983
  return ValidationError;
1100
984
  }(CommerceError);
1101
985
  var FetcherError = /*#__PURE__*/function (_CommerceError2) {
1102
986
  _inheritsLoose(FetcherError, _CommerceError2);
1103
-
1104
987
  function FetcherError(options) {
1105
988
  var _this3;
1106
-
1107
989
  _this3 = _CommerceError2.call(this, options) || this;
1108
990
  _this3.status = options.status;
1109
991
  return _this3;
1110
992
  }
1111
-
1112
993
  return FetcherError;
1113
994
  }(CommerceError);
1114
995
 
1115
996
  var useData = function useData(options, input, fetcherFn, swrOptions, provider) {
1116
997
  var hookInput = Array.isArray(input) ? input : Object.entries(input);
1117
-
1118
998
  var fetcher = /*#__PURE__*/function () {
1119
999
  var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(url, query, method) {
1120
1000
  var _len,
1121
- args,
1122
- _key,
1123
- _args = arguments;
1124
-
1001
+ args,
1002
+ _key,
1003
+ _args = arguments;
1125
1004
  return runtime_1.wrap(function _callee$(_context) {
1126
1005
  while (1) {
1127
1006
  switch (_context.prev = _context.next) {
1128
1007
  case 0:
1129
1008
  _context.prev = 0;
1130
-
1131
1009
  for (_len = _args.length, args = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
1132
1010
  args[_key - 3] = _args[_key];
1133
1011
  }
1134
-
1135
1012
  _context.next = 4;
1136
1013
  return options.fetcher({
1137
1014
  options: {
@@ -1147,22 +1024,17 @@ var useData = function useData(options, input, fetcherFn, swrOptions, provider)
1147
1024
  fetch: fetcherFn,
1148
1025
  provider: provider
1149
1026
  });
1150
-
1151
1027
  case 4:
1152
1028
  return _context.abrupt("return", _context.sent);
1153
-
1154
1029
  case 7:
1155
1030
  _context.prev = 7;
1156
1031
  _context.t0 = _context["catch"](0);
1157
-
1158
1032
  // SWR will not log errors, but any error that's not an instance
1159
1033
  // of CommerceError is not welcomed by this hook
1160
1034
  if (!(_context.t0 instanceof CommerceError)) {
1161
1035
  console.error(_context.t0);
1162
1036
  }
1163
-
1164
1037
  throw _context.t0;
1165
-
1166
1038
  case 11:
1167
1039
  case "end":
1168
1040
  return _context.stop();
@@ -1170,19 +1042,16 @@ var useData = function useData(options, input, fetcherFn, swrOptions, provider)
1170
1042
  }
1171
1043
  }, _callee, null, [[0, 7]]);
1172
1044
  }));
1173
-
1174
1045
  return function fetcher(_x, _x2, _x3) {
1175
1046
  return _ref.apply(this, arguments);
1176
1047
  };
1177
1048
  }();
1178
-
1179
1049
  var response = useMutablePlasmicQueryData(function () {
1180
1050
  var opts = options.fetchOptions;
1181
1051
  return opts ? [opts.url, opts.query, opts.method].concat(hookInput.map(function (e) {
1182
1052
  return e[1];
1183
1053
  })) : null;
1184
1054
  }, fetcher, swrOptions);
1185
-
1186
1055
  if (!("isLoading" in response)) {
1187
1056
  defineProperty(response, "isLoading", {
1188
1057
  get: function get() {
@@ -1191,7 +1060,6 @@ var useData = function useData(options, input, fetcherFn, swrOptions, provider)
1191
1060
  enumerable: true
1192
1061
  });
1193
1062
  }
1194
-
1195
1063
  return response;
1196
1064
  };
1197
1065
 
@@ -1201,23 +1069,19 @@ var useData = function useData(options, input, fetcherFn, swrOptions, provider)
1201
1069
  */
1202
1070
  function useFetcher() {
1203
1071
  var _providerRef$current$;
1204
-
1205
1072
  var _useCommerce = useCommerce(),
1206
- providerRef = _useCommerce.providerRef,
1207
- fetcherRef = _useCommerce.fetcherRef;
1208
-
1073
+ providerRef = _useCommerce.providerRef,
1074
+ fetcherRef = _useCommerce.fetcherRef;
1209
1075
  return (_providerRef$current$ = providerRef.current.fetcher) != null ? _providerRef$current$ : fetcherRef.current;
1210
1076
  }
1211
1077
  function useProvider() {
1212
1078
  var _useCommerce2 = useCommerce(),
1213
- providerRef = _useCommerce2.providerRef;
1214
-
1079
+ providerRef = _useCommerce2.providerRef;
1215
1080
  return providerRef.current;
1216
1081
  }
1217
1082
  function useHook(fn) {
1218
1083
  var _useCommerce3 = useCommerce(),
1219
- providerRef = _useCommerce3.providerRef;
1220
-
1084
+ providerRef = _useCommerce3.providerRef;
1221
1085
  var provider = providerRef.current;
1222
1086
  return fn(provider);
1223
1087
  }
@@ -1227,9 +1091,7 @@ function useSWRHook(hook) {
1227
1091
  return hook.useHook({
1228
1092
  useData: function useData$1(ctx) {
1229
1093
  var _ctx$input;
1230
-
1231
1094
  var response = useData(hook, (_ctx$input = ctx == null ? void 0 : ctx.input) != null ? _ctx$input : [], fetcher, ctx == null ? void 0 : ctx.swrOptions, provider);
1232
-
1233
1095
  return response;
1234
1096
  }
1235
1097
  });
@@ -1240,8 +1102,7 @@ function useMutationHook(hook) {
1240
1102
  return hook.useHook({
1241
1103
  fetch: useCallback(function (_temp) {
1242
1104
  var _ref = _temp === void 0 ? {} : _temp,
1243
- input = _ref.input;
1244
-
1105
+ input = _ref.input;
1245
1106
  return hook.fetcher({
1246
1107
  input: input,
1247
1108
  options: hook.fetchOptions,
@@ -1254,26 +1115,23 @@ function useMutationHook(hook) {
1254
1115
 
1255
1116
  var SWRFetcher = function SWRFetcher(_ref) {
1256
1117
  var options = _ref.options,
1257
- fetch = _ref.fetch;
1118
+ fetch = _ref.fetch;
1258
1119
  return fetch(options);
1259
1120
  };
1260
1121
  var mutationFetcher = function mutationFetcher(_ref2) {
1261
1122
  var input = _ref2.input,
1262
- options = _ref2.options,
1263
- fetch = _ref2.fetch;
1123
+ options = _ref2.options,
1124
+ fetch = _ref2.fetch;
1264
1125
  return fetch(_extends({}, options, {
1265
1126
  body: input
1266
1127
  }));
1267
1128
  };
1268
1129
 
1269
1130
  var fetcher = mutationFetcher;
1270
-
1271
1131
  var fn = function fn(provider) {
1272
1132
  var _provider$cart;
1273
-
1274
1133
  return (_provider$cart = provider.cart) == null ? void 0 : _provider$cart.useAddItem;
1275
1134
  };
1276
-
1277
1135
  var useAddItem = function useAddItem() {
1278
1136
  var hook = useHook(fn);
1279
1137
  return useMutationHook(_extends({
@@ -1301,34 +1159,27 @@ function AddToCartButton(props) {
1301
1159
  var product = useProduct();
1302
1160
  var form = useFormContext();
1303
1161
  var addItem = useAddItem();
1304
-
1305
1162
  var addToCart = /*#__PURE__*/function () {
1306
1163
  var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
1307
1164
  var _form$getValues$Produ;
1308
-
1309
1165
  var quantity, _form$getValues$Produ2, variantId;
1310
-
1311
1166
  return runtime_1.wrap(function _callee$(_context) {
1312
1167
  while (1) {
1313
1168
  switch (_context.prev = _context.next) {
1314
1169
  case 0:
1315
1170
  quantity = +((_form$getValues$Produ = form.getValues()["ProductQuantity"]) != null ? _form$getValues$Produ : 1);
1316
-
1317
1171
  if (!(isNaN(quantity) || quantity < 1)) {
1318
1172
  _context.next = 3;
1319
1173
  break;
1320
1174
  }
1321
-
1322
1175
  throw new CommerceError({
1323
1176
  message: 'The item quantity has to be a valid integer greater than 0'
1324
1177
  });
1325
-
1326
1178
  case 3:
1327
1179
  if (!product) {
1328
1180
  _context.next = 7;
1329
1181
  break;
1330
1182
  }
1331
-
1332
1183
  variantId = (_form$getValues$Produ2 = form.getValues()["ProductVariant"]) != null ? _form$getValues$Produ2 : product.variants[0].id;
1333
1184
  _context.next = 7;
1334
1185
  return addItem({
@@ -1336,7 +1187,6 @@ function AddToCartButton(props) {
1336
1187
  variantId: variantId,
1337
1188
  quantity: quantity
1338
1189
  });
1339
-
1340
1190
  case 7:
1341
1191
  case "end":
1342
1192
  return _context.stop();
@@ -1344,18 +1194,15 @@ function AddToCartButton(props) {
1344
1194
  }
1345
1195
  }, _callee);
1346
1196
  }));
1347
-
1348
1197
  return function addToCart() {
1349
1198
  return _ref.apply(this, arguments);
1350
1199
  };
1351
1200
  }();
1352
-
1353
1201
  return React.isValidElement(children) ? React.cloneElement(children, {
1354
1202
  onClick: function onClick(e) {
1355
1203
  if (children.props.onClick && typeof children.props.onClick === "function") {
1356
1204
  children.props.onClick(e);
1357
1205
  }
1358
-
1359
1206
  addToCart();
1360
1207
  }
1361
1208
  }) : null;
@@ -1364,7 +1211,6 @@ function registerAddToCartButton(loader, customAddToCartButtonMeta) {
1364
1211
  var doRegisterComponent = function doRegisterComponent() {
1365
1212
  return loader ? loader.registerComponent.apply(loader, arguments) : registerComponent.apply(void 0, arguments);
1366
1213
  };
1367
-
1368
1214
  doRegisterComponent(AddToCartButton, customAddToCartButtonMeta != null ? customAddToCartButtonMeta : addToCartButtonMeta);
1369
1215
  }
1370
1216
 
@@ -1376,26 +1222,20 @@ var fetcher$1 = /*#__PURE__*/function () {
1376
1222
  switch (_context.prev = _context.next) {
1377
1223
  case 0:
1378
1224
  options = _ref.options, cartId = _ref.input.cartId, fetch = _ref.fetch;
1379
-
1380
1225
  if (!cartId) {
1381
1226
  _context.next = 7;
1382
1227
  break;
1383
1228
  }
1384
-
1385
1229
  _context.next = 4;
1386
1230
  return fetch(options);
1387
-
1388
1231
  case 4:
1389
1232
  _context.t0 = _context.sent;
1390
1233
  _context.next = 8;
1391
1234
  break;
1392
-
1393
1235
  case 7:
1394
1236
  _context.t0 = null;
1395
-
1396
1237
  case 8:
1397
1238
  return _context.abrupt("return", _context.t0);
1398
-
1399
1239
  case 9:
1400
1240
  case "end":
1401
1241
  return _context.stop();
@@ -1403,33 +1243,24 @@ var fetcher$1 = /*#__PURE__*/function () {
1403
1243
  }
1404
1244
  }, _callee);
1405
1245
  }));
1406
-
1407
1246
  return function fetcher(_x) {
1408
1247
  return _ref2.apply(this, arguments);
1409
1248
  };
1410
1249
  }();
1411
-
1412
1250
  var fn$1 = function fn(provider) {
1413
1251
  var _provider$cart;
1414
-
1415
1252
  return (_provider$cart = provider.cart) == null ? void 0 : _provider$cart.useCart;
1416
1253
  };
1417
-
1418
1254
  var useCart = function useCart(input) {
1419
1255
  var _hook$fetcher;
1420
-
1421
1256
  var hook = useHook(fn$1);
1422
-
1423
1257
  var _useCommerce = useCommerce(),
1424
- cartCookie = _useCommerce.cartCookie;
1425
-
1258
+ cartCookie = _useCommerce.cartCookie;
1426
1259
  var fetcherFn = (_hook$fetcher = hook.fetcher) != null ? _hook$fetcher : fetcher$1;
1427
-
1428
1260
  var wrapper = function wrapper(context) {
1429
1261
  context.input.cartId = Cookies.get(cartCookie);
1430
1262
  return fetcherFn(context);
1431
1263
  };
1432
-
1433
1264
  return useSWRHook(_extends({}, hook, {
1434
1265
  fetcher: wrapper
1435
1266
  }))(input);
@@ -1441,8 +1272,8 @@ var useCart = function useCart(input) {
1441
1272
  */
1442
1273
  function formatPrice(_ref) {
1443
1274
  var amount = _ref.amount,
1444
- currencyCode = _ref.currencyCode,
1445
- locale = _ref.locale;
1275
+ currencyCode = _ref.currencyCode,
1276
+ locale = _ref.locale;
1446
1277
  var formatCurrency = new Intl.NumberFormat(locale, {
1447
1278
  style: 'currency',
1448
1279
  currency: currencyCode
@@ -1451,9 +1282,9 @@ function formatPrice(_ref) {
1451
1282
  }
1452
1283
  function formatVariantPrice(_ref2) {
1453
1284
  var amount = _ref2.amount,
1454
- baseAmount = _ref2.baseAmount,
1455
- currencyCode = _ref2.currencyCode,
1456
- locale = _ref2.locale;
1285
+ baseAmount = _ref2.baseAmount,
1286
+ currencyCode = _ref2.currencyCode,
1287
+ locale = _ref2.locale;
1457
1288
  var hasDiscount = baseAmount > amount;
1458
1289
  var formatDiscount = new Intl.NumberFormat(locale, {
1459
1290
  style: 'percent'
@@ -1477,13 +1308,11 @@ function formatVariantPrice(_ref2) {
1477
1308
  }
1478
1309
  function usePrice(data) {
1479
1310
  var _ref3 = data != null ? data : {},
1480
- amount = _ref3.amount,
1481
- baseAmount = _ref3.baseAmount,
1482
- currencyCode = _ref3.currencyCode;
1483
-
1311
+ amount = _ref3.amount,
1312
+ baseAmount = _ref3.baseAmount,
1313
+ currencyCode = _ref3.currencyCode;
1484
1314
  var _useCommerce = useCommerce(),
1485
- locale = _useCommerce.locale;
1486
-
1315
+ locale = _useCommerce.locale;
1487
1316
  var value = useMemo(function () {
1488
1317
  if (typeof amount !== 'number' || !currencyCode) return '';
1489
1318
  return baseAmount ? formatVariantPrice({
@@ -1521,34 +1350,26 @@ var cartMeta = {
1521
1350
  };
1522
1351
  function CartComponent(props) {
1523
1352
  var _data$totalPrice, _data$currency$code;
1524
-
1525
1353
  var className = props.className,
1526
- field = props.field,
1527
- hideIfIsEmpty = props.hideIfIsEmpty;
1528
-
1354
+ field = props.field,
1355
+ hideIfIsEmpty = props.hideIfIsEmpty;
1529
1356
  var _useCart = useCart(),
1530
- data = _useCart.data;
1531
-
1357
+ data = _useCart.data;
1532
1358
  var _usePrice = usePrice({
1533
- amount: (_data$totalPrice = data == null ? void 0 : data.totalPrice) != null ? _data$totalPrice : 0,
1534
- currencyCode: (_data$currency$code = data == null ? void 0 : data.currency.code) != null ? _data$currency$code : "USD"
1535
- }),
1536
- price = _usePrice.price;
1537
-
1359
+ amount: (_data$totalPrice = data == null ? void 0 : data.totalPrice) != null ? _data$totalPrice : 0,
1360
+ currencyCode: (_data$currency$code = data == null ? void 0 : data.currency.code) != null ? _data$currency$code : "USD"
1361
+ }),
1362
+ price = _usePrice.price;
1538
1363
  if (!field) {
1539
1364
  return React.createElement("p", null, "You must set the field prop");
1540
1365
  }
1541
-
1542
1366
  var value;
1543
-
1544
1367
  if (field === "Size") {
1545
1368
  var _data$lineItems$lengt;
1546
-
1547
1369
  value = (_data$lineItems$lengt = data == null ? void 0 : data.lineItems.length) != null ? _data$lineItems$lengt : 0;
1548
1370
  } else if (field === "Total Price") {
1549
1371
  value = price != null ? price : 0;
1550
1372
  }
1551
-
1552
1373
  return hideIfIsEmpty && value === 0 ? null : React.createElement("span", {
1553
1374
  className: className
1554
1375
  }, value);
@@ -1557,18 +1378,14 @@ function registerCart(loader, customCartMeta) {
1557
1378
  var doRegisterComponent = function doRegisterComponent() {
1558
1379
  return loader ? loader.registerComponent.apply(loader, arguments) : registerComponent.apply(void 0, arguments);
1559
1380
  };
1560
-
1561
1381
  doRegisterComponent(CartComponent, customCartMeta != null ? customCartMeta : cartMeta);
1562
1382
  }
1563
1383
 
1564
1384
  var fetcher$2 = SWRFetcher;
1565
-
1566
1385
  var fn$2 = function fn(provider) {
1567
1386
  var _provider$site;
1568
-
1569
1387
  return (_provider$site = provider.site) == null ? void 0 : _provider$site.useCategories;
1570
1388
  };
1571
-
1572
1389
  var useCategories = function useCategories(input) {
1573
1390
  var hook = useHook(fn$2);
1574
1391
  return useSWRHook(_extends({
@@ -1618,10 +1435,8 @@ var categoryCollectionMeta = {
1618
1435
  type: "choice",
1619
1436
  options: function options(props, ctx) {
1620
1437
  var _ctx$categories$map;
1621
-
1622
1438
  return (_ctx$categories$map = ctx == null ? void 0 : ctx.categories.map(function (category) {
1623
1439
  var _category$depth;
1624
-
1625
1440
  return {
1626
1441
  label: "" + " ".repeat((_category$depth = category.depth) != null ? _category$depth : 0) + category.name,
1627
1442
  value: category.id
@@ -1653,34 +1468,29 @@ var categoryCollectionMeta = {
1653
1468
  };
1654
1469
  function CategoryCollection(props) {
1655
1470
  var _categories$findIndex;
1656
-
1657
1471
  var children = props.children,
1658
- noLayout = props.noLayout,
1659
- noAutoRepeat = props.noAutoRepeat,
1660
- className = props.className,
1661
- loadingMessage = props.loadingMessage,
1662
- emptyMessage = props.emptyMessage,
1663
- selectedCategory = props.category,
1664
- setControlContextData = props.setControlContextData;
1472
+ noLayout = props.noLayout,
1473
+ noAutoRepeat = props.noAutoRepeat,
1474
+ className = props.className,
1475
+ loadingMessage = props.loadingMessage,
1476
+ emptyMessage = props.emptyMessage,
1477
+ selectedCategory = props.category,
1478
+ setControlContextData = props.setControlContextData;
1665
1479
  var inEditor = React.useContext(PlasmicCanvasContext);
1666
-
1667
1480
  var _useCategories = useCategories(),
1668
- allCategories = _useCategories.data,
1669
- isAllCategoriesLoading = _useCategories.isLoading;
1670
-
1481
+ allCategories = _useCategories.data,
1482
+ isAllCategoriesLoading = _useCategories.isLoading;
1671
1483
  var _useCategories2 = useCategories({
1672
- categoryId: selectedCategory,
1673
- addIsEmptyField: !!inEditor
1674
- }),
1675
- categories = _useCategories2.data,
1676
- isLoading = _useCategories2.isLoading;
1677
-
1484
+ categoryId: selectedCategory,
1485
+ addIsEmptyField: !!inEditor
1486
+ }),
1487
+ categories = _useCategories2.data,
1488
+ isLoading = _useCategories2.isLoading;
1678
1489
  if (allCategories) {
1679
1490
  setControlContextData == null ? void 0 : setControlContextData({
1680
1491
  categories: allCategories
1681
1492
  });
1682
1493
  }
1683
-
1684
1494
  var firstCategoryNotEmpty = categories == null ? void 0 : categories.find(function (category) {
1685
1495
  return !category.isEmpty;
1686
1496
  });
@@ -1693,15 +1503,12 @@ function CategoryCollection(props) {
1693
1503
  key: category.id
1694
1504
  }, repeatedElement(i < firstCategoryNotEmptyIndex ? i + 1 : i === firstCategoryNotEmptyIndex ? 0 : i, children));
1695
1505
  });
1696
-
1697
1506
  if ([isAllCategoriesLoading, isLoading].includes(true)) {
1698
1507
  return React.isValidElement(loadingMessage) ? loadingMessage : null;
1699
1508
  }
1700
-
1701
1509
  if (!categories || categories.length === 0) {
1702
1510
  return React.isValidElement(emptyMessage) ? emptyMessage : null;
1703
1511
  }
1704
-
1705
1512
  return React.createElement(DataProvider, {
1706
1513
  name: "categories",
1707
1514
  data: categories
@@ -1715,7 +1522,6 @@ function registerCategoryCollection(loader, customCategoryCollectionMeta) {
1715
1522
  var doRegisterComponent = function doRegisterComponent() {
1716
1523
  return loader ? loader.registerComponent.apply(loader, arguments) : registerComponent.apply(void 0, arguments);
1717
1524
  };
1718
-
1719
1525
  doRegisterComponent(CategoryCollection, customCategoryCollectionMeta != null ? customCategoryCollectionMeta : categoryCollectionMeta);
1720
1526
  }
1721
1527
 
@@ -1733,13 +1539,11 @@ var categoryFieldMeta = {
1733
1539
  };
1734
1540
  function CategoryField(props) {
1735
1541
  var className = props.className,
1736
- field = props.field;
1542
+ field = props.field;
1737
1543
  var category = useCategoryContext();
1738
-
1739
1544
  if (!field) {
1740
1545
  return React.createElement("span", null, "You must set the field prop");
1741
1546
  }
1742
-
1743
1547
  var data = category ? category[field] : "Category field placeholder";
1744
1548
  return React.createElement("span", {
1745
1549
  className: className
@@ -1749,7 +1553,6 @@ function registerCategoryField(loader, customCategoryFieldMeta) {
1749
1553
  var doRegisterComponent = function doRegisterComponent() {
1750
1554
  return loader ? loader.registerComponent.apply(loader, arguments) : registerComponent.apply(void 0, arguments);
1751
1555
  };
1752
-
1753
1556
  doRegisterComponent(CategoryField, customCategoryFieldMeta != null ? customCategoryFieldMeta : categoryFieldMeta);
1754
1557
  }
1755
1558
 
@@ -1769,36 +1572,28 @@ var categoryLinkMeta = {
1769
1572
  };
1770
1573
  function CategoryLink(props) {
1771
1574
  var className = props.className,
1772
- children = props.children,
1773
- linkDest = props.linkDest;
1575
+ children = props.children,
1576
+ linkDest = props.linkDest;
1774
1577
  var category = useCategoryContext();
1775
-
1776
1578
  var resolveLink = function resolveLink(linkDest) {
1777
1579
  var _linkDest$match;
1778
-
1779
1580
  if (!linkDest) {
1780
1581
  return undefined;
1781
1582
  }
1782
-
1783
1583
  var regex = /{[^}]*}/;
1784
1584
  var regexAll = new RegExp(regex, "g");
1785
1585
  var matches = (_linkDest$match = linkDest.match(regexAll)) != null ? _linkDest$match : [];
1786
1586
  var resolvedLink = linkDest;
1787
-
1788
1587
  for (var _iterator = _createForOfIteratorHelperLoose(matches), _step; !(_step = _iterator()).done;) {
1789
1588
  var match = _step.value;
1790
1589
  var field = match.slice(1, -1);
1791
-
1792
1590
  if (!category || !(field in category)) {
1793
1591
  return undefined;
1794
1592
  }
1795
-
1796
1593
  resolvedLink = resolvedLink.replace(regex, category[field]);
1797
1594
  }
1798
-
1799
1595
  return resolvedLink;
1800
1596
  };
1801
-
1802
1597
  return React.createElement("a", {
1803
1598
  className: className,
1804
1599
  href: resolveLink(linkDest),
@@ -1812,7 +1607,6 @@ function registerCategoryLink(loader, customCategoryLinkMeta) {
1812
1607
  var doRegisterComponent = function doRegisterComponent() {
1813
1608
  return loader ? loader.registerComponent.apply(loader, arguments) : registerComponent.apply(void 0, arguments);
1814
1609
  };
1815
-
1816
1610
  doRegisterComponent(CategoryLink, customCategoryLinkMeta != null ? customCategoryLinkMeta : categoryLinkMeta);
1817
1611
  }
1818
1612
 
@@ -1827,10 +1621,9 @@ var categoryMediaMeta = {
1827
1621
  };
1828
1622
  var CategoryMedia = /*#__PURE__*/React.forwardRef(function (props, ref) {
1829
1623
  var _image$url;
1830
-
1831
1624
  var className = props.className,
1832
- _props$mediaIndex = props.mediaIndex,
1833
- mediaIndex = _props$mediaIndex === void 0 ? 0 : _props$mediaIndex;
1625
+ _props$mediaIndex = props.mediaIndex,
1626
+ mediaIndex = _props$mediaIndex === void 0 ? 0 : _props$mediaIndex;
1834
1627
  var category = useCategoryContext();
1835
1628
  var image = category != null && category.images ? category.images[mediaIndex] : undefined;
1836
1629
  return React.createElement("img", {
@@ -1845,18 +1638,14 @@ function registerCategoryMedia(loader, customCategoryMediaMeta) {
1845
1638
  var doRegisterComponent = function doRegisterComponent() {
1846
1639
  return loader ? loader.registerComponent.apply(loader, arguments) : registerComponent.apply(void 0, arguments);
1847
1640
  };
1848
-
1849
1641
  doRegisterComponent(CategoryMedia, customCategoryMediaMeta != null ? customCategoryMediaMeta : categoryMediaMeta);
1850
1642
  }
1851
1643
 
1852
1644
  var fetcher$3 = SWRFetcher;
1853
-
1854
1645
  var fn$3 = function fn(provider) {
1855
1646
  var _provider$products;
1856
-
1857
1647
  return (_provider$products = provider.products) == null ? void 0 : _provider$products.useProduct;
1858
1648
  };
1859
-
1860
1649
  var useProduct$1 = function useProduct(input) {
1861
1650
  var hook = useHook(fn$3);
1862
1651
  return useSWRHook(_extends({
@@ -1865,13 +1654,10 @@ var useProduct$1 = function useProduct(input) {
1865
1654
  };
1866
1655
 
1867
1656
  var fetcher$4 = SWRFetcher;
1868
-
1869
1657
  var fn$4 = function fn(provider) {
1870
1658
  var _provider$products;
1871
-
1872
1659
  return (_provider$products = provider.products) == null ? void 0 : _provider$products.useSearch;
1873
1660
  };
1874
-
1875
1661
  var useSearch = function useSearch(input) {
1876
1662
  var hook = useHook(fn$4);
1877
1663
  return useSWRHook(_extends({
@@ -1912,10 +1698,8 @@ var productBoxMeta = {
1912
1698
  },
1913
1699
  options: function options(props, ctx) {
1914
1700
  var _ctx$products$map;
1915
-
1916
1701
  return (_ctx$products$map = ctx == null ? void 0 : ctx.products.map(function (product) {
1917
1702
  var _product$slug;
1918
-
1919
1703
  return {
1920
1704
  imgUrl: product.images[0].url,
1921
1705
  value: product.id,
@@ -1932,57 +1716,47 @@ var productBoxMeta = {
1932
1716
  };
1933
1717
  function ProductBox(props) {
1934
1718
  var className = props.className,
1935
- children = props.children,
1936
- noLayout = props.noLayout,
1937
- id = props.id,
1938
- setControlContextData = props.setControlContextData;
1939
-
1719
+ children = props.children,
1720
+ noLayout = props.noLayout,
1721
+ id = props.id,
1722
+ setControlContextData = props.setControlContextData;
1940
1723
  var _React$useState = React.useState(""),
1941
- productSearch = _React$useState[0],
1942
- setProductSearch = _React$useState[1];
1943
-
1724
+ productSearch = _React$useState[0],
1725
+ setProductSearch = _React$useState[1];
1944
1726
  var _useSearch = useSearch({
1945
- search: productSearch !== "" ? productSearch : undefined
1946
- }),
1947
- allProducts = _useSearch.data;
1948
-
1727
+ search: productSearch !== "" ? productSearch : undefined
1728
+ }),
1729
+ allProducts = _useSearch.data;
1949
1730
  var onSearch = React.useCallback(debounce(function (value) {
1950
1731
  return setProductSearch(value);
1951
1732
  }, 300), []);
1952
-
1953
1733
  if (allProducts) {
1954
1734
  setControlContextData == null ? void 0 : setControlContextData({
1955
1735
  products: allProducts.products,
1956
1736
  onSearch: onSearch
1957
1737
  });
1958
1738
  }
1959
-
1960
1739
  var _useProduct = useProduct$1({
1961
- id: id
1962
- }),
1963
- data = _useProduct.data,
1964
- error = _useProduct.error,
1965
- isLoading = _useProduct.isLoading;
1966
-
1740
+ id: id
1741
+ }),
1742
+ data = _useProduct.data,
1743
+ error = _useProduct.error,
1744
+ isLoading = _useProduct.isLoading;
1967
1745
  if (!id) {
1968
1746
  return React.createElement("span", null, "You must set the id prop");
1969
1747
  }
1970
-
1971
1748
  if (error) {
1972
1749
  throw new CommerceError({
1973
1750
  message: error.message,
1974
1751
  code: error.code
1975
1752
  });
1976
1753
  }
1977
-
1978
1754
  if (isLoading) {
1979
1755
  return React.createElement("span", null, "Loading...");
1980
1756
  }
1981
-
1982
1757
  if (!data) {
1983
1758
  throw new Error("Product not found!");
1984
1759
  }
1985
-
1986
1760
  var renderedData = React.createElement(ProductProvider, {
1987
1761
  product: data
1988
1762
  }, children);
@@ -1994,18 +1768,14 @@ function registerProductBox(loader, customProductBoxMeta) {
1994
1768
  var doRegisterComponent = function doRegisterComponent() {
1995
1769
  return loader ? loader.registerComponent.apply(loader, arguments) : registerComponent.apply(void 0, arguments);
1996
1770
  };
1997
-
1998
1771
  doRegisterComponent(ProductBox, customProductBoxMeta != null ? customProductBoxMeta : productBoxMeta);
1999
1772
  }
2000
1773
 
2001
1774
  var fetcher$5 = SWRFetcher;
2002
-
2003
1775
  var fn$5 = function fn(provider) {
2004
1776
  var _provider$site;
2005
-
2006
1777
  return (_provider$site = provider.site) == null ? void 0 : _provider$site.useBrands;
2007
1778
  };
2008
-
2009
1779
  var useBrands = function useBrands(input) {
2010
1780
  var hook = useHook(fn$5);
2011
1781
  return useSWRHook(_extends({
@@ -2015,8 +1785,7 @@ var useBrands = function useBrands(input) {
2015
1785
 
2016
1786
  var useCommerceExtraFeatures = function useCommerceExtraFeatures() {
2017
1787
  var _useCommerce = useCommerce(),
2018
- providerRef = _useCommerce.providerRef;
2019
-
1788
+ providerRef = _useCommerce.providerRef;
2020
1789
  return providerRef.current.extraFeatures;
2021
1790
  };
2022
1791
 
@@ -2063,10 +1832,8 @@ var productCollectionMeta = {
2063
1832
  type: "choice",
2064
1833
  options: function options(props, ctx) {
2065
1834
  var _ctx$categories$map;
2066
-
2067
1835
  return (_ctx$categories$map = ctx == null ? void 0 : ctx.categories.map(function (category) {
2068
1836
  var _category$depth;
2069
-
2070
1837
  return {
2071
1838
  label: "" + " ".repeat((_category$depth = category.depth) != null ? _category$depth : 0) + category.name,
2072
1839
  value: category.id
@@ -2075,7 +1842,6 @@ var productCollectionMeta = {
2075
1842
  },
2076
1843
  defaultValueHint: function defaultValueHint(props, ctx) {
2077
1844
  var _ctx$categoryCtx;
2078
-
2079
1845
  return ctx == null ? void 0 : (_ctx$categoryCtx = ctx.categoryCtx) == null ? void 0 : _ctx$categoryCtx.name;
2080
1846
  },
2081
1847
  readOnly: function readOnly(props, ctx) {
@@ -2086,7 +1852,6 @@ var productCollectionMeta = {
2086
1852
  type: "boolean",
2087
1853
  hidden: function hidden(props, ctx) {
2088
1854
  var _ctx$features;
2089
-
2090
1855
  return !(ctx != null && (_ctx$features = ctx.features) != null && _ctx$features.includeSubCategories);
2091
1856
  }
2092
1857
  },
@@ -2094,7 +1859,6 @@ var productCollectionMeta = {
2094
1859
  type: "choice",
2095
1860
  options: function options(props, ctx) {
2096
1861
  var _ctx$brands$map;
2097
-
2098
1862
  return (_ctx$brands$map = ctx == null ? void 0 : ctx.brands.map(function (brand) {
2099
1863
  return {
2100
1864
  label: brand.name,
@@ -2147,46 +1911,39 @@ var productCollectionMeta = {
2147
1911
  };
2148
1912
  function ProductCollection(props) {
2149
1913
  var _categoryCtx$id;
2150
-
2151
1914
  var className = props.className,
2152
- children = props.children,
2153
- count = props.count,
2154
- category = props.category,
2155
- includeSubCategories = props.includeSubCategories,
2156
- brand = props.brand,
2157
- noLayout = props.noLayout,
2158
- noAutoRepeat = props.noAutoRepeat,
2159
- setControlContextData = props.setControlContextData,
2160
- emptyMessage = props.emptyMessage,
2161
- loadingMessage = props.loadingMessage,
2162
- search = props.search,
2163
- sort = props.sort;
2164
-
1915
+ children = props.children,
1916
+ count = props.count,
1917
+ category = props.category,
1918
+ includeSubCategories = props.includeSubCategories,
1919
+ brand = props.brand,
1920
+ noLayout = props.noLayout,
1921
+ noAutoRepeat = props.noAutoRepeat,
1922
+ setControlContextData = props.setControlContextData,
1923
+ emptyMessage = props.emptyMessage,
1924
+ loadingMessage = props.loadingMessage,
1925
+ search = props.search,
1926
+ sort = props.sort;
2165
1927
  var _useCategories = useCategories(),
2166
- categories = _useCategories.data,
2167
- isCategoriesLoading = _useCategories.isLoading;
2168
-
1928
+ categories = _useCategories.data,
1929
+ isCategoriesLoading = _useCategories.isLoading;
2169
1930
  var _useBrands = useBrands(),
2170
- brands = _useBrands.data,
2171
- isBrandsLoading = _useBrands.isLoading;
2172
-
1931
+ brands = _useBrands.data,
1932
+ isBrandsLoading = _useBrands.isLoading;
2173
1933
  var categoryCtx = useCategoryContext();
2174
-
2175
1934
  var _useSearch = useSearch({
2176
- categoryId: (_categoryCtx$id = categoryCtx == null ? void 0 : categoryCtx.id) != null ? _categoryCtx$id : category,
2177
- brandId: brand,
2178
- count: count,
2179
- categories: categories != null ? categories : [],
2180
- includeSubCategories: includeSubCategories,
2181
- search: search,
2182
- sort: sort
2183
- }),
2184
- data = _useSearch.data,
2185
- isSearchLoading = _useSearch.isLoading;
2186
-
1935
+ categoryId: (_categoryCtx$id = categoryCtx == null ? void 0 : categoryCtx.id) != null ? _categoryCtx$id : category,
1936
+ brandId: brand,
1937
+ count: count,
1938
+ categories: categories != null ? categories : [],
1939
+ includeSubCategories: includeSubCategories,
1940
+ search: search,
1941
+ sort: sort
1942
+ }),
1943
+ data = _useSearch.data,
1944
+ isSearchLoading = _useSearch.isLoading;
2187
1945
  var features = useCommerceExtraFeatures();
2188
1946
  var primaryCategory = usePrimaryCategory();
2189
-
2190
1947
  if (categories && brands) {
2191
1948
  setControlContextData == null ? void 0 : setControlContextData({
2192
1949
  categories: categories,
@@ -2195,22 +1952,18 @@ function ProductCollection(props) {
2195
1952
  categoryCtx: primaryCategory
2196
1953
  });
2197
1954
  }
2198
-
2199
1955
  var renderedData = noAutoRepeat ? children : data == null ? void 0 : data.products.map(function (product, i) {
2200
1956
  return React.createElement(ProductProvider, {
2201
1957
  product: product,
2202
1958
  key: product.id
2203
1959
  }, repeatedElement(i, children));
2204
1960
  });
2205
-
2206
1961
  if ([isSearchLoading, isBrandsLoading, isCategoriesLoading].includes(true)) {
2207
1962
  return React.isValidElement(loadingMessage) ? loadingMessage : null;
2208
1963
  }
2209
-
2210
1964
  if (!data || data.products.length === 0) {
2211
1965
  return React.isValidElement(emptyMessage) ? emptyMessage : null;
2212
1966
  }
2213
-
2214
1967
  return React.createElement(DataProvider, {
2215
1968
  name: "products",
2216
1969
  data: data == null ? void 0 : data.products
@@ -2222,7 +1975,6 @@ function registerProductCollection(loader, customProductCollectionMeta) {
2222
1975
  var doRegisterComponent = function doRegisterComponent() {
2223
1976
  return loader ? loader.registerComponent.apply(loader, arguments) : registerComponent.apply(void 0, arguments);
2224
1977
  };
2225
-
2226
1978
  doRegisterComponent(ProductCollection, customProductCollectionMeta != null ? customProductCollectionMeta : productCollectionMeta);
2227
1979
  }
2228
1980
 
@@ -2242,36 +1994,28 @@ var productLinkMeta = {
2242
1994
  };
2243
1995
  function ProductLink(props) {
2244
1996
  var className = props.className,
2245
- children = props.children,
2246
- linkDest = props.linkDest;
1997
+ children = props.children,
1998
+ linkDest = props.linkDest;
2247
1999
  var product = useProduct();
2248
-
2249
2000
  var resolveLink = function resolveLink(linkDest) {
2250
2001
  var _linkDest$match;
2251
-
2252
2002
  if (!linkDest) {
2253
2003
  return undefined;
2254
2004
  }
2255
-
2256
2005
  var regex = /{[^}]*}/;
2257
2006
  var regexAll = new RegExp(regex, "g");
2258
2007
  var matches = (_linkDest$match = linkDest.match(regexAll)) != null ? _linkDest$match : [];
2259
2008
  var resolvedLink = linkDest;
2260
-
2261
2009
  for (var _iterator = _createForOfIteratorHelperLoose(matches), _step; !(_step = _iterator()).done;) {
2262
2010
  var match = _step.value;
2263
2011
  var field = match.slice(1, -1);
2264
-
2265
2012
  if (!product || !(field in product)) {
2266
2013
  return undefined;
2267
2014
  }
2268
-
2269
2015
  resolvedLink = resolvedLink.replace(regex, product[field]);
2270
2016
  }
2271
-
2272
2017
  return resolvedLink;
2273
2018
  };
2274
-
2275
2019
  return React.createElement("a", {
2276
2020
  className: className,
2277
2021
  href: resolveLink(linkDest),
@@ -2285,7 +2029,6 @@ function registerProductLink(loader, customProductLinkMeta) {
2285
2029
  var doRegisterComponent = function doRegisterComponent() {
2286
2030
  return loader ? loader.registerComponent.apply(loader, arguments) : registerComponent.apply(void 0, arguments);
2287
2031
  };
2288
-
2289
2032
  doRegisterComponent(ProductLink, customProductLinkMeta != null ? customProductLinkMeta : productLinkMeta);
2290
2033
  }
2291
2034
 
@@ -2307,11 +2050,10 @@ var productMediaMeta = {
2307
2050
  };
2308
2051
  var ProductMedia = /*#__PURE__*/React.forwardRef(function (props, ref) {
2309
2052
  var _image$url;
2310
-
2311
2053
  var className = props.className,
2312
- _props$mediaIndex = props.mediaIndex,
2313
- mediaIndex = _props$mediaIndex === void 0 ? 0 : _props$mediaIndex,
2314
- setControlContextData = props.setControlContextData;
2054
+ _props$mediaIndex = props.mediaIndex,
2055
+ mediaIndex = _props$mediaIndex === void 0 ? 0 : _props$mediaIndex,
2056
+ setControlContextData = props.setControlContextData;
2315
2057
  var product = useProduct();
2316
2058
  var mediaContext = useProductMediaContext();
2317
2059
  setControlContextData == null ? void 0 : setControlContextData({
@@ -2330,7 +2072,6 @@ function registerProductMedia(loader, customProductMediaMeta) {
2330
2072
  var doRegisterComponent = function doRegisterComponent() {
2331
2073
  return loader ? loader.registerComponent.apply(loader, arguments) : registerComponent.apply(void 0, arguments);
2332
2074
  };
2333
-
2334
2075
  doRegisterComponent(ProductMedia, customProductMediaMeta != null ? customProductMediaMeta : productMediaMeta);
2335
2076
  }
2336
2077
 
@@ -2361,7 +2102,7 @@ var productMediaCollectionMeta = {
2361
2102
  };
2362
2103
  function ProductMediaCollection(props) {
2363
2104
  var media = props.media,
2364
- className = props.className;
2105
+ className = props.className;
2365
2106
  var product = useProduct();
2366
2107
  return React.createElement("div", {
2367
2108
  className: className
@@ -2376,13 +2117,11 @@ function registerProductMediaCollection(loader, customProductMediaCollectionMeta
2376
2117
  var doRegisterComponent = function doRegisterComponent() {
2377
2118
  return loader ? loader.registerComponent.apply(loader, arguments) : registerComponent.apply(void 0, arguments);
2378
2119
  };
2379
-
2380
2120
  doRegisterComponent(ProductMediaCollection, customProductMediaCollectionMeta != null ? customProductMediaCollectionMeta : productMediaCollectionMeta);
2381
2121
  }
2382
2122
 
2383
2123
  var getProductPrice = function getProductPrice(product, variantId) {
2384
2124
  var _product$variants$fin, _product$variants$fin2;
2385
-
2386
2125
  return (_product$variants$fin = (_product$variants$fin2 = product.variants.find(function (variant) {
2387
2126
  return variant.id === variantId;
2388
2127
  })) == null ? void 0 : _product$variants$fin2.price) != null ? _product$variants$fin : product.price.value;
@@ -2397,18 +2136,15 @@ var productPriceMeta = {
2397
2136
  };
2398
2137
  function ProductPriceComponent(props) {
2399
2138
  var _product$price;
2400
-
2401
2139
  var className = props.className;
2402
2140
  var product = useProduct();
2403
2141
  var form = useFormContext();
2404
2142
  var watchProductVariant = form == null ? void 0 : form.watch("ProductVariant", (_product$price = product.price) != null ? _product$price : "");
2405
-
2406
2143
  var _usePrice = usePrice({
2407
- amount: product ? getProductPrice(product, watchProductVariant) : 0,
2408
- currencyCode: product ? product.price.currencyCode : "USD"
2409
- }),
2410
- price = _usePrice.price;
2411
-
2144
+ amount: product ? getProductPrice(product, watchProductVariant) : 0,
2145
+ currencyCode: product ? product.price.currencyCode : "USD"
2146
+ }),
2147
+ price = _usePrice.price;
2412
2148
  return React.createElement("span", {
2413
2149
  className: className
2414
2150
  }, price);
@@ -2417,7 +2153,6 @@ function registerProductPrice(loader, customProductPriceMeta) {
2417
2153
  var doRegisterComponent = function doRegisterComponent() {
2418
2154
  return loader ? loader.registerComponent.apply(loader, arguments) : registerComponent.apply(void 0, arguments);
2419
2155
  };
2420
-
2421
2156
  doRegisterComponent(ProductPriceComponent, customProductPriceMeta != null ? customProductPriceMeta : productPriceMeta);
2422
2157
  }
2423
2158
 
@@ -2440,7 +2175,7 @@ var productQuantityMeta = {
2440
2175
  };
2441
2176
  function ProductQuantity(props) {
2442
2177
  var className = props.className,
2443
- children = props.children;
2178
+ children = props.children;
2444
2179
  var form = useFormContext();
2445
2180
  return React.createElement("div", {
2446
2181
  className: className
@@ -2460,7 +2195,6 @@ function registerProductQuantity(loader, customProductQuantityMeta) {
2460
2195
  var doRegisterComponent = function doRegisterComponent() {
2461
2196
  return loader ? loader.registerComponent.apply(loader, arguments) : registerComponent.apply(void 0, arguments);
2462
2197
  };
2463
-
2464
2198
  doRegisterComponent(ProductQuantity, customProductQuantityMeta != null ? customProductQuantityMeta : productQuantityMeta);
2465
2199
  }
2466
2200
 
@@ -2507,18 +2241,16 @@ var productSliderMeta = {
2507
2241
  };
2508
2242
  function ProductSlider(props) {
2509
2243
  var className = props.className,
2510
- slideContainer = props.slideContainer,
2511
- thumbsContainer = props.thumbsContainer,
2512
- _props$thumbsVisible = props.thumbsVisible,
2513
- thumbsVisible = _props$thumbsVisible === void 0 ? 4 : _props$thumbsVisible,
2514
- _props$slideSelected = props.slideSelected,
2515
- slideSelected = _props$slideSelected === void 0 ? 0 : _props$slideSelected;
2244
+ slideContainer = props.slideContainer,
2245
+ thumbsContainer = props.thumbsContainer,
2246
+ _props$thumbsVisible = props.thumbsVisible,
2247
+ thumbsVisible = _props$thumbsVisible === void 0 ? 4 : _props$thumbsVisible,
2248
+ _props$slideSelected = props.slideSelected,
2249
+ slideSelected = _props$slideSelected === void 0 ? 0 : _props$slideSelected;
2516
2250
  var product = useProduct();
2517
-
2518
2251
  var _React$useState = React.useState(slideSelected),
2519
- selected = _React$useState[0],
2520
- setSelected = _React$useState[1];
2521
-
2252
+ selected = _React$useState[0],
2253
+ setSelected = _React$useState[1];
2522
2254
  var maximumLeft = Math.max(0, product.images.length - thumbsVisible);
2523
2255
  var leftIndex = Math.min(maximumLeft, Math.max(0, selected - 1));
2524
2256
  return React.createElement("div", {
@@ -2545,7 +2277,6 @@ function registerProductSlider(loader, customProductSliderMeta) {
2545
2277
  var doRegisterComponent = function doRegisterComponent() {
2546
2278
  return loader ? loader.registerComponent.apply(loader, arguments) : registerComponent.apply(void 0, arguments);
2547
2279
  };
2548
-
2549
2280
  doRegisterComponent(ProductSlider, customProductSliderMeta != null ? customProductSliderMeta : productSliderMeta);
2550
2281
  }
2551
2282
 
@@ -2563,26 +2294,21 @@ var productTextFieldMeta = {
2563
2294
  };
2564
2295
  function ProductTextField(props) {
2565
2296
  var className = props.className,
2566
- field = props.field;
2297
+ field = props.field;
2567
2298
  var product = useProduct();
2568
-
2569
2299
  if (!product) {
2570
2300
  return React.createElement("span", {
2571
2301
  className: className
2572
2302
  }, "Fake Product Field");
2573
2303
  }
2574
-
2575
2304
  if (!field) {
2576
2305
  return React.createElement("span", {
2577
2306
  className: className
2578
2307
  }, "Unknown Product Field");
2579
2308
  }
2580
-
2581
2309
  var value;
2582
-
2583
2310
  if (field === "description") {
2584
2311
  var _product$descriptionH;
2585
-
2586
2312
  return React.createElement("div", {
2587
2313
  className: className,
2588
2314
  dangerouslySetInnerHTML: {
@@ -2592,7 +2318,6 @@ function ProductTextField(props) {
2592
2318
  } else {
2593
2319
  value = product[field];
2594
2320
  }
2595
-
2596
2321
  return React.createElement("span", {
2597
2322
  className: className
2598
2323
  }, value);
@@ -2601,7 +2326,6 @@ function registerTextField(loader, customProductTextFieldMeta) {
2601
2326
  var doRegisterComponent = function doRegisterComponent() {
2602
2327
  return loader ? loader.registerComponent.apply(loader, arguments) : registerComponent.apply(void 0, arguments);
2603
2328
  };
2604
-
2605
2329
  doRegisterComponent(ProductTextField, customProductTextFieldMeta != null ? customProductTextFieldMeta : productTextFieldMeta);
2606
2330
  }
2607
2331
 
@@ -2614,7 +2338,6 @@ var productVariantPickerMeta = {
2614
2338
  };
2615
2339
  function ProductVariantPicker(props) {
2616
2340
  var _useFormContext, _product$variants$fin;
2617
-
2618
2341
  var className = props.className;
2619
2342
  var product = useProduct();
2620
2343
  var form = (_useFormContext = useFormContext()) != null ? _useFormContext : useForm();
@@ -2626,7 +2349,6 @@ function ProductVariantPicker(props) {
2626
2349
  })) == null ? void 0 : _product$variants$fin.id,
2627
2350
  render: function render(_ref) {
2628
2351
  var _product$variants$map;
2629
-
2630
2352
  var field = _ref.field;
2631
2353
  return React.createElement("select", Object.assign({
2632
2354
  className: className
@@ -2642,18 +2364,14 @@ function registerProductVariantPicker(loader, customProductVariantPickerMeta) {
2642
2364
  var doRegisterComponent = function doRegisterComponent() {
2643
2365
  return loader ? loader.registerComponent.apply(loader, arguments) : registerComponent.apply(void 0, arguments);
2644
2366
  };
2645
-
2646
2367
  doRegisterComponent(ProductVariantPicker, customProductVariantPickerMeta != null ? customProductVariantPickerMeta : productVariantPickerMeta);
2647
2368
  }
2648
2369
 
2649
2370
  var fetcher$6 = mutationFetcher;
2650
-
2651
2371
  var fn$6 = function fn(provider) {
2652
2372
  var _provider$cart;
2653
-
2654
2373
  return (_provider$cart = provider.cart) == null ? void 0 : _provider$cart.useRemoveItem;
2655
2374
  };
2656
-
2657
2375
  var useRemoveItem = function useRemoveItem(input) {
2658
2376
  var hook = useHook(fn$6);
2659
2377
  return useMutationHook(_extends({
@@ -2662,13 +2380,10 @@ var useRemoveItem = function useRemoveItem(input) {
2662
2380
  };
2663
2381
 
2664
2382
  var fetcher$7 = mutationFetcher;
2665
-
2666
2383
  var fn$7 = function fn(provider) {
2667
2384
  var _provider$cart;
2668
-
2669
2385
  return (_provider$cart = provider.cart) == null ? void 0 : _provider$cart.useUpdateItem;
2670
2386
  };
2671
-
2672
2387
  var useUpdateItem = function useUpdateItem(input) {
2673
2388
  var hook = useHook(fn$7);
2674
2389
  return useMutationHook(_extends({