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