@plasmicpkgs/commerce 0.0.1 → 0.0.2

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.
Files changed (116) hide show
  1. package/README.md +1 -0
  2. package/dist/api/endpoints/cart.d.ts +4 -0
  3. package/dist/api/endpoints/catalog/products.d.ts +4 -0
  4. package/dist/api/index.d.ts +75 -0
  5. package/dist/api/operations.d.ts +130 -0
  6. package/dist/api/utils/errors.d.ts +10 -0
  7. package/dist/api/utils/is-allowed-method.d.ts +3 -0
  8. package/dist/api/utils/is-allowed-operation.d.ts +6 -0
  9. package/dist/api/utils/types.d.ts +34 -0
  10. package/dist/cart/use-add-item.d.ts +5 -6
  11. package/dist/cart/use-cart.d.ts +5 -6
  12. package/dist/cart/use-remove-item.d.ts +5 -6
  13. package/dist/cart/use-update-item.d.ts +5 -6
  14. package/dist/commerce.cjs.development.js +1851 -0
  15. package/dist/commerce.cjs.development.js.map +1 -0
  16. package/dist/commerce.cjs.production.min.js +2 -0
  17. package/dist/commerce.cjs.production.min.js.map +1 -0
  18. package/dist/commerce.d.ts +37 -0
  19. package/dist/commerce.esm.js +1828 -0
  20. package/dist/commerce.esm.js.map +1 -0
  21. package/dist/contexts.d.ts +10 -7
  22. package/dist/index.d.ts +21 -71
  23. package/dist/index.js +7 -28
  24. package/dist/product/use-price.d.ts +26 -26
  25. package/dist/product/use-search.d.ts +6 -6
  26. package/dist/registerAddToCartButton.d.ts +10 -0
  27. package/dist/registerProductCollection.d.ts +13 -11
  28. package/dist/registerProductMedia.d.ts +12 -0
  29. package/dist/registerProductPrice.d.ts +9 -0
  30. package/dist/registerProductQuantity.d.ts +11 -0
  31. package/dist/registerProductTextField.d.ts +10 -0
  32. package/dist/registerProductVariantPicker.d.ts +9 -0
  33. package/dist/registerUseCart.d.ts +9 -0
  34. package/dist/registerable.d.ts +4 -4
  35. package/dist/types/cart.d.ts +157 -157
  36. package/dist/types/checkout.d.ts +57 -57
  37. package/dist/types/common.d.ts +13 -13
  38. package/dist/types/customer/address.d.ts +110 -110
  39. package/dist/types/customer/card.d.ts +113 -113
  40. package/dist/types/customer/index.d.ts +24 -24
  41. package/dist/types/index.d.ts +12 -12
  42. package/dist/types/login.d.ts +27 -27
  43. package/dist/types/logout.d.ts +17 -17
  44. package/dist/types/page.d.ts +24 -24
  45. package/dist/types/product.d.ts +102 -99
  46. package/dist/types/signup.d.ts +23 -23
  47. package/dist/types/site.d.ts +17 -17
  48. package/dist/types/wishlist.d.ts +83 -83
  49. package/dist/utils/default-fetcher.d.ts +4 -4
  50. package/dist/utils/define-property.d.ts +21 -21
  51. package/dist/utils/errors.d.ts +27 -27
  52. package/dist/utils/get-product-price.d.ts +2 -0
  53. package/dist/utils/types.d.ts +95 -94
  54. package/dist/utils/use-data.d.ts +12 -12
  55. package/dist/utils/use-hook.d.ts +6 -6
  56. package/package.json +13 -13
  57. package/dist/auth/use-login.d.ts +0 -6
  58. package/dist/auth/use-login.js +0 -9
  59. package/dist/auth/use-logout.d.ts +0 -6
  60. package/dist/auth/use-logout.js +0 -9
  61. package/dist/auth/use-signup.d.ts +0 -6
  62. package/dist/auth/use-signup.js +0 -9
  63. package/dist/cart/use-add-item.js +0 -9
  64. package/dist/cart/use-cart.js +0 -18
  65. package/dist/cart/use-remove-item.js +0 -9
  66. package/dist/cart/use-update-item.js +0 -9
  67. package/dist/checkout/use-checkout.d.ts +0 -6
  68. package/dist/checkout/use-checkout.js +0 -18
  69. package/dist/checkout/use-submit-checkout.d.ts +0 -6
  70. package/dist/checkout/use-submit-checkout.js +0 -9
  71. package/dist/contexts.js +0 -46
  72. package/dist/customer/address/use-add-item.d.ts +0 -6
  73. package/dist/customer/address/use-add-item.js +0 -9
  74. package/dist/customer/address/use-addresses.d.ts +0 -6
  75. package/dist/customer/address/use-addresses.js +0 -18
  76. package/dist/customer/address/use-remove-item.d.ts +0 -6
  77. package/dist/customer/address/use-remove-item.js +0 -9
  78. package/dist/customer/address/use-update-item.d.ts +0 -6
  79. package/dist/customer/address/use-update-item.js +0 -9
  80. package/dist/customer/card/use-add-item.d.ts +0 -6
  81. package/dist/customer/card/use-add-item.js +0 -9
  82. package/dist/customer/card/use-cards.d.ts +0 -6
  83. package/dist/customer/card/use-cards.js +0 -18
  84. package/dist/customer/card/use-remove-item.d.ts +0 -6
  85. package/dist/customer/card/use-remove-item.js +0 -9
  86. package/dist/customer/card/use-update-item.d.ts +0 -6
  87. package/dist/customer/card/use-update-item.js +0 -9
  88. package/dist/customer/use-customer.d.ts +0 -6
  89. package/dist/customer/use-customer.js +0 -9
  90. package/dist/product/use-price.js +0 -33
  91. package/dist/product/use-search.js +0 -9
  92. package/dist/registerProductCollection.js +0 -42
  93. package/dist/registerProductImage.d.ts +0 -13
  94. package/dist/registerProductImage.js +0 -37
  95. package/dist/registerable.js +0 -0
  96. package/dist/tsconfig.tsbuildinfo +0 -2970
  97. package/dist/types/cart.js +0 -0
  98. package/dist/types/checkout.js +0 -0
  99. package/dist/types/common.js +0 -0
  100. package/dist/types/customer/address.js +0 -0
  101. package/dist/types/customer/card.js +0 -0
  102. package/dist/types/customer/index.js +0 -2
  103. package/dist/types/index.js +0 -11
  104. package/dist/types/login.js +0 -0
  105. package/dist/types/logout.js +0 -0
  106. package/dist/types/page.js +0 -0
  107. package/dist/types/product.js +0 -0
  108. package/dist/types/signup.js +0 -0
  109. package/dist/types/site.js +0 -0
  110. package/dist/types/wishlist.js +0 -0
  111. package/dist/utils/default-fetcher.js +0 -3
  112. package/dist/utils/define-property.js +0 -4
  113. package/dist/utils/errors.js +0 -24
  114. package/dist/utils/types.js +0 -0
  115. package/dist/utils/use-data.js +0 -43
  116. package/dist/utils/use-hook.js +0 -37
@@ -0,0 +1,1851 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
+
7
+ var registerComponent = _interopDefault(require('@plasmicapp/host/registerComponent'));
8
+ var React = require('react');
9
+ var React__default = _interopDefault(React);
10
+ var reactHookForm = require('react-hook-form');
11
+ var useSWR = _interopDefault(require('swr'));
12
+ var host = require('@plasmicapp/host');
13
+ var Cookies = _interopDefault(require('js-cookie'));
14
+
15
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
16
+ try {
17
+ var info = gen[key](arg);
18
+ var value = info.value;
19
+ } catch (error) {
20
+ reject(error);
21
+ return;
22
+ }
23
+
24
+ if (info.done) {
25
+ resolve(value);
26
+ } else {
27
+ Promise.resolve(value).then(_next, _throw);
28
+ }
29
+ }
30
+
31
+ function _asyncToGenerator(fn) {
32
+ return function () {
33
+ var self = this,
34
+ args = arguments;
35
+ return new Promise(function (resolve, reject) {
36
+ var gen = fn.apply(self, args);
37
+
38
+ function _next(value) {
39
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
40
+ }
41
+
42
+ function _throw(err) {
43
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
44
+ }
45
+
46
+ _next(undefined);
47
+ });
48
+ };
49
+ }
50
+
51
+ function _extends() {
52
+ _extends = Object.assign || function (target) {
53
+ for (var i = 1; i < arguments.length; i++) {
54
+ var source = arguments[i];
55
+
56
+ for (var key in source) {
57
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
58
+ target[key] = source[key];
59
+ }
60
+ }
61
+ }
62
+
63
+ return target;
64
+ };
65
+
66
+ return _extends.apply(this, arguments);
67
+ }
68
+
69
+ function _inheritsLoose(subClass, superClass) {
70
+ subClass.prototype = Object.create(superClass.prototype);
71
+ subClass.prototype.constructor = subClass;
72
+
73
+ _setPrototypeOf(subClass, superClass);
74
+ }
75
+
76
+ function _getPrototypeOf(o) {
77
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
78
+ return o.__proto__ || Object.getPrototypeOf(o);
79
+ };
80
+ return _getPrototypeOf(o);
81
+ }
82
+
83
+ function _setPrototypeOf(o, p) {
84
+ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
85
+ o.__proto__ = p;
86
+ return o;
87
+ };
88
+
89
+ return _setPrototypeOf(o, p);
90
+ }
91
+
92
+ function _isNativeReflectConstruct() {
93
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
94
+ if (Reflect.construct.sham) return false;
95
+ if (typeof Proxy === "function") return true;
96
+
97
+ try {
98
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
99
+ return true;
100
+ } catch (e) {
101
+ return false;
102
+ }
103
+ }
104
+
105
+ function _construct(Parent, args, Class) {
106
+ if (_isNativeReflectConstruct()) {
107
+ _construct = Reflect.construct;
108
+ } else {
109
+ _construct = function _construct(Parent, args, Class) {
110
+ var a = [null];
111
+ a.push.apply(a, args);
112
+ var Constructor = Function.bind.apply(Parent, a);
113
+ var instance = new Constructor();
114
+ if (Class) _setPrototypeOf(instance, Class.prototype);
115
+ return instance;
116
+ };
117
+ }
118
+
119
+ return _construct.apply(null, arguments);
120
+ }
121
+
122
+ function _isNativeFunction(fn) {
123
+ return Function.toString.call(fn).indexOf("[native code]") !== -1;
124
+ }
125
+
126
+ function _wrapNativeSuper(Class) {
127
+ var _cache = typeof Map === "function" ? new Map() : undefined;
128
+
129
+ _wrapNativeSuper = function _wrapNativeSuper(Class) {
130
+ if (Class === null || !_isNativeFunction(Class)) return Class;
131
+
132
+ if (typeof Class !== "function") {
133
+ throw new TypeError("Super expression must either be null or a function");
134
+ }
135
+
136
+ if (typeof _cache !== "undefined") {
137
+ if (_cache.has(Class)) return _cache.get(Class);
138
+
139
+ _cache.set(Class, Wrapper);
140
+ }
141
+
142
+ function Wrapper() {
143
+ return _construct(Class, arguments, _getPrototypeOf(this).constructor);
144
+ }
145
+
146
+ Wrapper.prototype = Object.create(Class.prototype, {
147
+ constructor: {
148
+ value: Wrapper,
149
+ enumerable: false,
150
+ writable: true,
151
+ configurable: true
152
+ }
153
+ });
154
+ return _setPrototypeOf(Wrapper, Class);
155
+ };
156
+
157
+ return _wrapNativeSuper(Class);
158
+ }
159
+
160
+ function _objectWithoutPropertiesLoose(source, excluded) {
161
+ if (source == null) return {};
162
+ var target = {};
163
+ var sourceKeys = Object.keys(source);
164
+ var key, i;
165
+
166
+ for (i = 0; i < sourceKeys.length; i++) {
167
+ key = sourceKeys[i];
168
+ if (excluded.indexOf(key) >= 0) continue;
169
+ target[key] = source[key];
170
+ }
171
+
172
+ return target;
173
+ }
174
+
175
+ function createCommonjsModule(fn, module) {
176
+ return module = { exports: {} }, fn(module, module.exports), module.exports;
177
+ }
178
+
179
+ var runtime_1 = createCommonjsModule(function (module) {
180
+ /**
181
+ * Copyright (c) 2014-present, Facebook, Inc.
182
+ *
183
+ * This source code is licensed under the MIT license found in the
184
+ * LICENSE file in the root directory of this source tree.
185
+ */
186
+
187
+ var runtime = (function (exports) {
188
+
189
+ var Op = Object.prototype;
190
+ var hasOwn = Op.hasOwnProperty;
191
+ var undefined$1; // More compressible than void 0.
192
+ var $Symbol = typeof Symbol === "function" ? Symbol : {};
193
+ var iteratorSymbol = $Symbol.iterator || "@@iterator";
194
+ var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
195
+ var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
196
+
197
+ function define(obj, key, value) {
198
+ Object.defineProperty(obj, key, {
199
+ value: value,
200
+ enumerable: true,
201
+ configurable: true,
202
+ writable: true
203
+ });
204
+ return obj[key];
205
+ }
206
+ try {
207
+ // IE 8 has a broken Object.defineProperty that only works on DOM objects.
208
+ define({}, "");
209
+ } catch (err) {
210
+ define = function(obj, key, value) {
211
+ return obj[key] = value;
212
+ };
213
+ }
214
+
215
+ function wrap(innerFn, outerFn, self, tryLocsList) {
216
+ // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
217
+ var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
218
+ var generator = Object.create(protoGenerator.prototype);
219
+ var context = new Context(tryLocsList || []);
220
+
221
+ // The ._invoke method unifies the implementations of the .next,
222
+ // .throw, and .return methods.
223
+ generator._invoke = makeInvokeMethod(innerFn, self, context);
224
+
225
+ return generator;
226
+ }
227
+ exports.wrap = wrap;
228
+
229
+ // Try/catch helper to minimize deoptimizations. Returns a completion
230
+ // record like context.tryEntries[i].completion. This interface could
231
+ // have been (and was previously) designed to take a closure to be
232
+ // invoked without arguments, but in all the cases we care about we
233
+ // already have an existing method we want to call, so there's no need
234
+ // to create a new function object. We can even get away with assuming
235
+ // the method takes exactly one argument, since that happens to be true
236
+ // in every case, so we don't have to touch the arguments object. The
237
+ // only additional allocation required is the completion record, which
238
+ // has a stable shape and so hopefully should be cheap to allocate.
239
+ function tryCatch(fn, obj, arg) {
240
+ try {
241
+ return { type: "normal", arg: fn.call(obj, arg) };
242
+ } catch (err) {
243
+ return { type: "throw", arg: err };
244
+ }
245
+ }
246
+
247
+ var GenStateSuspendedStart = "suspendedStart";
248
+ var GenStateSuspendedYield = "suspendedYield";
249
+ var GenStateExecuting = "executing";
250
+ var GenStateCompleted = "completed";
251
+
252
+ // Returning this object from the innerFn has the same effect as
253
+ // breaking out of the dispatch switch statement.
254
+ var ContinueSentinel = {};
255
+
256
+ // Dummy constructor functions that we use as the .constructor and
257
+ // .constructor.prototype properties for functions that return Generator
258
+ // objects. For full spec compliance, you may wish to configure your
259
+ // minifier not to mangle the names of these two functions.
260
+ function Generator() {}
261
+ function GeneratorFunction() {}
262
+ function GeneratorFunctionPrototype() {}
263
+
264
+ // This is a polyfill for %IteratorPrototype% for environments that
265
+ // don't natively support it.
266
+ var IteratorPrototype = {};
267
+ IteratorPrototype[iteratorSymbol] = function () {
268
+ return this;
269
+ };
270
+
271
+ var getProto = Object.getPrototypeOf;
272
+ var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
273
+ if (NativeIteratorPrototype &&
274
+ NativeIteratorPrototype !== Op &&
275
+ hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
276
+ // This environment has a native %IteratorPrototype%; use it instead
277
+ // of the polyfill.
278
+ IteratorPrototype = NativeIteratorPrototype;
279
+ }
280
+
281
+ var Gp = GeneratorFunctionPrototype.prototype =
282
+ Generator.prototype = Object.create(IteratorPrototype);
283
+ GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
284
+ GeneratorFunctionPrototype.constructor = GeneratorFunction;
285
+ GeneratorFunction.displayName = define(
286
+ GeneratorFunctionPrototype,
287
+ toStringTagSymbol,
288
+ "GeneratorFunction"
289
+ );
290
+
291
+ // Helper for defining the .next, .throw, and .return methods of the
292
+ // Iterator interface in terms of a single ._invoke method.
293
+ function defineIteratorMethods(prototype) {
294
+ ["next", "throw", "return"].forEach(function(method) {
295
+ define(prototype, method, function(arg) {
296
+ return this._invoke(method, arg);
297
+ });
298
+ });
299
+ }
300
+
301
+ exports.isGeneratorFunction = function(genFun) {
302
+ var ctor = typeof genFun === "function" && genFun.constructor;
303
+ return ctor
304
+ ? ctor === GeneratorFunction ||
305
+ // For the native GeneratorFunction constructor, the best we can
306
+ // do is to check its .name property.
307
+ (ctor.displayName || ctor.name) === "GeneratorFunction"
308
+ : false;
309
+ };
310
+
311
+ exports.mark = function(genFun) {
312
+ if (Object.setPrototypeOf) {
313
+ Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
314
+ } else {
315
+ genFun.__proto__ = GeneratorFunctionPrototype;
316
+ define(genFun, toStringTagSymbol, "GeneratorFunction");
317
+ }
318
+ genFun.prototype = Object.create(Gp);
319
+ return genFun;
320
+ };
321
+
322
+ // Within the body of any async function, `await x` is transformed to
323
+ // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
324
+ // `hasOwn.call(value, "__await")` to determine if the yielded value is
325
+ // meant to be awaited.
326
+ exports.awrap = function(arg) {
327
+ return { __await: arg };
328
+ };
329
+
330
+ function AsyncIterator(generator, PromiseImpl) {
331
+ function invoke(method, arg, resolve, reject) {
332
+ var record = tryCatch(generator[method], generator, arg);
333
+ if (record.type === "throw") {
334
+ reject(record.arg);
335
+ } else {
336
+ var result = record.arg;
337
+ var value = result.value;
338
+ if (value &&
339
+ typeof value === "object" &&
340
+ hasOwn.call(value, "__await")) {
341
+ return PromiseImpl.resolve(value.__await).then(function(value) {
342
+ invoke("next", value, resolve, reject);
343
+ }, function(err) {
344
+ invoke("throw", err, resolve, reject);
345
+ });
346
+ }
347
+
348
+ return PromiseImpl.resolve(value).then(function(unwrapped) {
349
+ // When a yielded Promise is resolved, its final value becomes
350
+ // the .value of the Promise<{value,done}> result for the
351
+ // current iteration.
352
+ result.value = unwrapped;
353
+ resolve(result);
354
+ }, function(error) {
355
+ // If a rejected Promise was yielded, throw the rejection back
356
+ // into the async generator function so it can be handled there.
357
+ return invoke("throw", error, resolve, reject);
358
+ });
359
+ }
360
+ }
361
+
362
+ var previousPromise;
363
+
364
+ function enqueue(method, arg) {
365
+ function callInvokeWithMethodAndArg() {
366
+ return new PromiseImpl(function(resolve, reject) {
367
+ invoke(method, arg, resolve, reject);
368
+ });
369
+ }
370
+
371
+ return previousPromise =
372
+ // If enqueue has been called before, then we want to wait until
373
+ // all previous Promises have been resolved before calling invoke,
374
+ // so that results are always delivered in the correct order. If
375
+ // enqueue has not been called before, then it is important to
376
+ // call invoke immediately, without waiting on a callback to fire,
377
+ // so that the async generator function has the opportunity to do
378
+ // any necessary setup in a predictable way. This predictability
379
+ // is why the Promise constructor synchronously invokes its
380
+ // executor callback, and why async functions synchronously
381
+ // execute code before the first await. Since we implement simple
382
+ // async functions in terms of async generators, it is especially
383
+ // important to get this right, even though it requires care.
384
+ previousPromise ? previousPromise.then(
385
+ callInvokeWithMethodAndArg,
386
+ // Avoid propagating failures to Promises returned by later
387
+ // invocations of the iterator.
388
+ callInvokeWithMethodAndArg
389
+ ) : callInvokeWithMethodAndArg();
390
+ }
391
+
392
+ // Define the unified helper method that is used to implement .next,
393
+ // .throw, and .return (see defineIteratorMethods).
394
+ this._invoke = enqueue;
395
+ }
396
+
397
+ defineIteratorMethods(AsyncIterator.prototype);
398
+ AsyncIterator.prototype[asyncIteratorSymbol] = function () {
399
+ return this;
400
+ };
401
+ exports.AsyncIterator = AsyncIterator;
402
+
403
+ // Note that simple async functions are implemented on top of
404
+ // AsyncIterator objects; they just return a Promise for the value of
405
+ // the final result produced by the iterator.
406
+ exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
407
+ if (PromiseImpl === void 0) PromiseImpl = Promise;
408
+
409
+ var iter = new AsyncIterator(
410
+ wrap(innerFn, outerFn, self, tryLocsList),
411
+ PromiseImpl
412
+ );
413
+
414
+ return exports.isGeneratorFunction(outerFn)
415
+ ? iter // If outerFn is a generator, return the full iterator.
416
+ : iter.next().then(function(result) {
417
+ return result.done ? result.value : iter.next();
418
+ });
419
+ };
420
+
421
+ function makeInvokeMethod(innerFn, self, context) {
422
+ var state = GenStateSuspendedStart;
423
+
424
+ return function invoke(method, arg) {
425
+ if (state === GenStateExecuting) {
426
+ throw new Error("Generator is already running");
427
+ }
428
+
429
+ if (state === GenStateCompleted) {
430
+ if (method === "throw") {
431
+ throw arg;
432
+ }
433
+
434
+ // Be forgiving, per 25.3.3.3.3 of the spec:
435
+ // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
436
+ return doneResult();
437
+ }
438
+
439
+ context.method = method;
440
+ context.arg = arg;
441
+
442
+ while (true) {
443
+ var delegate = context.delegate;
444
+ if (delegate) {
445
+ var delegateResult = maybeInvokeDelegate(delegate, context);
446
+ if (delegateResult) {
447
+ if (delegateResult === ContinueSentinel) continue;
448
+ return delegateResult;
449
+ }
450
+ }
451
+
452
+ if (context.method === "next") {
453
+ // Setting context._sent for legacy support of Babel's
454
+ // function.sent implementation.
455
+ context.sent = context._sent = context.arg;
456
+
457
+ } else if (context.method === "throw") {
458
+ if (state === GenStateSuspendedStart) {
459
+ state = GenStateCompleted;
460
+ throw context.arg;
461
+ }
462
+
463
+ context.dispatchException(context.arg);
464
+
465
+ } else if (context.method === "return") {
466
+ context.abrupt("return", context.arg);
467
+ }
468
+
469
+ state = GenStateExecuting;
470
+
471
+ var record = tryCatch(innerFn, self, context);
472
+ if (record.type === "normal") {
473
+ // If an exception is thrown from innerFn, we leave state ===
474
+ // GenStateExecuting and loop back for another invocation.
475
+ state = context.done
476
+ ? GenStateCompleted
477
+ : GenStateSuspendedYield;
478
+
479
+ if (record.arg === ContinueSentinel) {
480
+ continue;
481
+ }
482
+
483
+ return {
484
+ value: record.arg,
485
+ done: context.done
486
+ };
487
+
488
+ } else if (record.type === "throw") {
489
+ state = GenStateCompleted;
490
+ // Dispatch the exception by looping back around to the
491
+ // context.dispatchException(context.arg) call above.
492
+ context.method = "throw";
493
+ context.arg = record.arg;
494
+ }
495
+ }
496
+ };
497
+ }
498
+
499
+ // Call delegate.iterator[context.method](context.arg) and handle the
500
+ // result, either by returning a { value, done } result from the
501
+ // delegate iterator, or by modifying context.method and context.arg,
502
+ // setting context.delegate to null, and returning the ContinueSentinel.
503
+ function maybeInvokeDelegate(delegate, context) {
504
+ var method = delegate.iterator[context.method];
505
+ if (method === undefined$1) {
506
+ // A .throw or .return when the delegate iterator has no .throw
507
+ // method always terminates the yield* loop.
508
+ context.delegate = null;
509
+
510
+ if (context.method === "throw") {
511
+ // Note: ["return"] must be used for ES3 parsing compatibility.
512
+ if (delegate.iterator["return"]) {
513
+ // If the delegate iterator has a return method, give it a
514
+ // chance to clean up.
515
+ context.method = "return";
516
+ context.arg = undefined$1;
517
+ maybeInvokeDelegate(delegate, context);
518
+
519
+ if (context.method === "throw") {
520
+ // If maybeInvokeDelegate(context) changed context.method from
521
+ // "return" to "throw", let that override the TypeError below.
522
+ return ContinueSentinel;
523
+ }
524
+ }
525
+
526
+ context.method = "throw";
527
+ context.arg = new TypeError(
528
+ "The iterator does not provide a 'throw' method");
529
+ }
530
+
531
+ return ContinueSentinel;
532
+ }
533
+
534
+ var record = tryCatch(method, delegate.iterator, context.arg);
535
+
536
+ if (record.type === "throw") {
537
+ context.method = "throw";
538
+ context.arg = record.arg;
539
+ context.delegate = null;
540
+ return ContinueSentinel;
541
+ }
542
+
543
+ var info = record.arg;
544
+
545
+ if (! info) {
546
+ context.method = "throw";
547
+ context.arg = new TypeError("iterator result is not an object");
548
+ context.delegate = null;
549
+ return ContinueSentinel;
550
+ }
551
+
552
+ if (info.done) {
553
+ // Assign the result of the finished delegate to the temporary
554
+ // variable specified by delegate.resultName (see delegateYield).
555
+ context[delegate.resultName] = info.value;
556
+
557
+ // Resume execution at the desired location (see delegateYield).
558
+ context.next = delegate.nextLoc;
559
+
560
+ // If context.method was "throw" but the delegate handled the
561
+ // exception, let the outer generator proceed normally. If
562
+ // context.method was "next", forget context.arg since it has been
563
+ // "consumed" by the delegate iterator. If context.method was
564
+ // "return", allow the original .return call to continue in the
565
+ // outer generator.
566
+ if (context.method !== "return") {
567
+ context.method = "next";
568
+ context.arg = undefined$1;
569
+ }
570
+
571
+ } else {
572
+ // Re-yield the result returned by the delegate method.
573
+ return info;
574
+ }
575
+
576
+ // The delegate iterator is finished, so forget it and continue with
577
+ // the outer generator.
578
+ context.delegate = null;
579
+ return ContinueSentinel;
580
+ }
581
+
582
+ // Define Generator.prototype.{next,throw,return} in terms of the
583
+ // unified ._invoke helper method.
584
+ defineIteratorMethods(Gp);
585
+
586
+ define(Gp, toStringTagSymbol, "Generator");
587
+
588
+ // A Generator should always return itself as the iterator object when the
589
+ // @@iterator function is called on it. Some browsers' implementations of the
590
+ // iterator prototype chain incorrectly implement this, causing the Generator
591
+ // object to not be returned from this call. This ensures that doesn't happen.
592
+ // See https://github.com/facebook/regenerator/issues/274 for more details.
593
+ Gp[iteratorSymbol] = function() {
594
+ return this;
595
+ };
596
+
597
+ Gp.toString = function() {
598
+ return "[object Generator]";
599
+ };
600
+
601
+ function pushTryEntry(locs) {
602
+ var entry = { tryLoc: locs[0] };
603
+
604
+ if (1 in locs) {
605
+ entry.catchLoc = locs[1];
606
+ }
607
+
608
+ if (2 in locs) {
609
+ entry.finallyLoc = locs[2];
610
+ entry.afterLoc = locs[3];
611
+ }
612
+
613
+ this.tryEntries.push(entry);
614
+ }
615
+
616
+ function resetTryEntry(entry) {
617
+ var record = entry.completion || {};
618
+ record.type = "normal";
619
+ delete record.arg;
620
+ entry.completion = record;
621
+ }
622
+
623
+ function Context(tryLocsList) {
624
+ // The root entry object (effectively a try statement without a catch
625
+ // or a finally block) gives us a place to store values thrown from
626
+ // locations where there is no enclosing try statement.
627
+ this.tryEntries = [{ tryLoc: "root" }];
628
+ tryLocsList.forEach(pushTryEntry, this);
629
+ this.reset(true);
630
+ }
631
+
632
+ exports.keys = function(object) {
633
+ var keys = [];
634
+ for (var key in object) {
635
+ keys.push(key);
636
+ }
637
+ keys.reverse();
638
+
639
+ // Rather than returning an object with a next method, we keep
640
+ // things simple and return the next function itself.
641
+ return function next() {
642
+ while (keys.length) {
643
+ var key = keys.pop();
644
+ if (key in object) {
645
+ next.value = key;
646
+ next.done = false;
647
+ return next;
648
+ }
649
+ }
650
+
651
+ // To avoid creating an additional object, we just hang the .value
652
+ // and .done properties off the next function object itself. This
653
+ // also ensures that the minifier will not anonymize the function.
654
+ next.done = true;
655
+ return next;
656
+ };
657
+ };
658
+
659
+ function values(iterable) {
660
+ if (iterable) {
661
+ var iteratorMethod = iterable[iteratorSymbol];
662
+ if (iteratorMethod) {
663
+ return iteratorMethod.call(iterable);
664
+ }
665
+
666
+ if (typeof iterable.next === "function") {
667
+ return iterable;
668
+ }
669
+
670
+ if (!isNaN(iterable.length)) {
671
+ var i = -1, next = function next() {
672
+ while (++i < iterable.length) {
673
+ if (hasOwn.call(iterable, i)) {
674
+ next.value = iterable[i];
675
+ next.done = false;
676
+ return next;
677
+ }
678
+ }
679
+
680
+ next.value = undefined$1;
681
+ next.done = true;
682
+
683
+ return next;
684
+ };
685
+
686
+ return next.next = next;
687
+ }
688
+ }
689
+
690
+ // Return an iterator with no values.
691
+ return { next: doneResult };
692
+ }
693
+ exports.values = values;
694
+
695
+ function doneResult() {
696
+ return { value: undefined$1, done: true };
697
+ }
698
+
699
+ Context.prototype = {
700
+ constructor: Context,
701
+
702
+ reset: function(skipTempReset) {
703
+ this.prev = 0;
704
+ this.next = 0;
705
+ // Resetting context._sent for legacy support of Babel's
706
+ // function.sent implementation.
707
+ this.sent = this._sent = undefined$1;
708
+ this.done = false;
709
+ this.delegate = null;
710
+
711
+ this.method = "next";
712
+ this.arg = undefined$1;
713
+
714
+ this.tryEntries.forEach(resetTryEntry);
715
+
716
+ if (!skipTempReset) {
717
+ for (var name in this) {
718
+ // Not sure about the optimal order of these conditions:
719
+ if (name.charAt(0) === "t" &&
720
+ hasOwn.call(this, name) &&
721
+ !isNaN(+name.slice(1))) {
722
+ this[name] = undefined$1;
723
+ }
724
+ }
725
+ }
726
+ },
727
+
728
+ stop: function() {
729
+ this.done = true;
730
+
731
+ var rootEntry = this.tryEntries[0];
732
+ var rootRecord = rootEntry.completion;
733
+ if (rootRecord.type === "throw") {
734
+ throw rootRecord.arg;
735
+ }
736
+
737
+ return this.rval;
738
+ },
739
+
740
+ dispatchException: function(exception) {
741
+ if (this.done) {
742
+ throw exception;
743
+ }
744
+
745
+ var context = this;
746
+ function handle(loc, caught) {
747
+ record.type = "throw";
748
+ record.arg = exception;
749
+ context.next = loc;
750
+
751
+ if (caught) {
752
+ // If the dispatched exception was caught by a catch block,
753
+ // then let that catch block handle the exception normally.
754
+ context.method = "next";
755
+ context.arg = undefined$1;
756
+ }
757
+
758
+ return !! caught;
759
+ }
760
+
761
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
762
+ var entry = this.tryEntries[i];
763
+ var record = entry.completion;
764
+
765
+ if (entry.tryLoc === "root") {
766
+ // Exception thrown outside of any try block that could handle
767
+ // it, so set the completion value of the entire function to
768
+ // throw the exception.
769
+ return handle("end");
770
+ }
771
+
772
+ if (entry.tryLoc <= this.prev) {
773
+ var hasCatch = hasOwn.call(entry, "catchLoc");
774
+ var hasFinally = hasOwn.call(entry, "finallyLoc");
775
+
776
+ if (hasCatch && hasFinally) {
777
+ if (this.prev < entry.catchLoc) {
778
+ return handle(entry.catchLoc, true);
779
+ } else if (this.prev < entry.finallyLoc) {
780
+ return handle(entry.finallyLoc);
781
+ }
782
+
783
+ } else if (hasCatch) {
784
+ if (this.prev < entry.catchLoc) {
785
+ return handle(entry.catchLoc, true);
786
+ }
787
+
788
+ } else if (hasFinally) {
789
+ if (this.prev < entry.finallyLoc) {
790
+ return handle(entry.finallyLoc);
791
+ }
792
+
793
+ } else {
794
+ throw new Error("try statement without catch or finally");
795
+ }
796
+ }
797
+ }
798
+ },
799
+
800
+ abrupt: function(type, arg) {
801
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
802
+ var entry = this.tryEntries[i];
803
+ if (entry.tryLoc <= this.prev &&
804
+ hasOwn.call(entry, "finallyLoc") &&
805
+ this.prev < entry.finallyLoc) {
806
+ var finallyEntry = entry;
807
+ break;
808
+ }
809
+ }
810
+
811
+ if (finallyEntry &&
812
+ (type === "break" ||
813
+ type === "continue") &&
814
+ finallyEntry.tryLoc <= arg &&
815
+ arg <= finallyEntry.finallyLoc) {
816
+ // Ignore the finally entry if control is not jumping to a
817
+ // location outside the try/catch block.
818
+ finallyEntry = null;
819
+ }
820
+
821
+ var record = finallyEntry ? finallyEntry.completion : {};
822
+ record.type = type;
823
+ record.arg = arg;
824
+
825
+ if (finallyEntry) {
826
+ this.method = "next";
827
+ this.next = finallyEntry.finallyLoc;
828
+ return ContinueSentinel;
829
+ }
830
+
831
+ return this.complete(record);
832
+ },
833
+
834
+ complete: function(record, afterLoc) {
835
+ if (record.type === "throw") {
836
+ throw record.arg;
837
+ }
838
+
839
+ if (record.type === "break" ||
840
+ record.type === "continue") {
841
+ this.next = record.arg;
842
+ } else if (record.type === "return") {
843
+ this.rval = this.arg = record.arg;
844
+ this.method = "return";
845
+ this.next = "end";
846
+ } else if (record.type === "normal" && afterLoc) {
847
+ this.next = afterLoc;
848
+ }
849
+
850
+ return ContinueSentinel;
851
+ },
852
+
853
+ finish: function(finallyLoc) {
854
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
855
+ var entry = this.tryEntries[i];
856
+ if (entry.finallyLoc === finallyLoc) {
857
+ this.complete(entry.completion, entry.afterLoc);
858
+ resetTryEntry(entry);
859
+ return ContinueSentinel;
860
+ }
861
+ }
862
+ },
863
+
864
+ "catch": function(tryLoc) {
865
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
866
+ var entry = this.tryEntries[i];
867
+ if (entry.tryLoc === tryLoc) {
868
+ var record = entry.completion;
869
+ if (record.type === "throw") {
870
+ var thrown = record.arg;
871
+ resetTryEntry(entry);
872
+ }
873
+ return thrown;
874
+ }
875
+ }
876
+
877
+ // The context.catch method must only be called with a location
878
+ // argument that corresponds to a known catch block.
879
+ throw new Error("illegal catch attempt");
880
+ },
881
+
882
+ delegateYield: function(iterable, resultName, nextLoc) {
883
+ this.delegate = {
884
+ iterator: values(iterable),
885
+ resultName: resultName,
886
+ nextLoc: nextLoc
887
+ };
888
+
889
+ if (this.method === "next") {
890
+ // Deliberately forget the last sent value so that we don't
891
+ // accidentally pass it on to the delegate.
892
+ this.arg = undefined$1;
893
+ }
894
+
895
+ return ContinueSentinel;
896
+ }
897
+ };
898
+
899
+ // Regardless of whether this script is executing as a CommonJS module
900
+ // or not, return the runtime object so that we can declare the variable
901
+ // regeneratorRuntime in the outer scope, which allows this module to be
902
+ // injected easily by `bin/regenerator --include-runtime script.js`.
903
+ return exports;
904
+
905
+ }(
906
+ // If this script is executing as a CommonJS module, use module.exports
907
+ // as the regeneratorRuntime namespace. Otherwise create a new empty
908
+ // object. Either way, the resulting object will be used to initialize
909
+ // the regeneratorRuntime variable at the top of this file.
910
+ module.exports
911
+ ));
912
+
913
+ try {
914
+ regeneratorRuntime = runtime;
915
+ } catch (accidentalStrictMode) {
916
+ // This module should not be running in strict mode, so the above
917
+ // assignment should always work unless something is misconfigured. Just
918
+ // in case runtime.js accidentally runs in strict mode, we can escape
919
+ // strict mode using a global Function call. This could conceivably fail
920
+ // if a Content Security Policy forbids using Function, but in that case
921
+ // the proper solution is to fix the accidental strict mode problem. If
922
+ // you've misconfigured your bundler to force strict mode and applied a
923
+ // CSP to forbid Function, and you're not willing to fix either of those
924
+ // problems, please detail your unique predicament in a GitHub issue.
925
+ Function("r", "regeneratorRuntime = r")(runtime);
926
+ }
927
+ });
928
+
929
+ var ProductContext = /*#__PURE__*/React__default.createContext(undefined);
930
+ function ProductProvider(_ref) {
931
+ var product = _ref.product,
932
+ children = _ref.children;
933
+ var methods = reactHookForm.useForm();
934
+ return React__default.createElement(ProductContext.Provider, {
935
+ value: product,
936
+ key: product.id
937
+ }, React__default.createElement(reactHookForm.FormProvider, Object.assign({}, methods), children));
938
+ }
939
+ function useProduct() {
940
+ return React.useContext(ProductContext);
941
+ }
942
+
943
+ var Commerce = /*#__PURE__*/React.createContext({});
944
+ function CoreCommerceProvider(_ref) {
945
+ var provider = _ref.provider,
946
+ children = _ref.children;
947
+ var providerRef = React.useRef(provider); // TODO: Remove the fetcherRef
948
+
949
+ var fetcherRef = React.useRef(provider.fetcher); // If the parent re-renders this provider will re-render every
950
+ // consumer unless we memoize the config
951
+
952
+ var _providerRef$current = providerRef.current,
953
+ locale = _providerRef$current.locale,
954
+ cartCookie = _providerRef$current.cartCookie;
955
+ var cfg = React.useMemo(function () {
956
+ return {
957
+ providerRef: providerRef,
958
+ fetcherRef: fetcherRef,
959
+ locale: locale,
960
+ cartCookie: cartCookie
961
+ };
962
+ }, [locale, cartCookie]);
963
+ return React__default.createElement(Commerce.Provider, {
964
+ value: cfg
965
+ }, children);
966
+ }
967
+ function getCommerceProvider(provider) {
968
+ return function CommerceProvider(_ref2) {
969
+ var children = _ref2.children,
970
+ props = _objectWithoutPropertiesLoose(_ref2, ["children"]);
971
+
972
+ return React__default.createElement(CoreCommerceProvider, {
973
+ provider: _extends({}, provider, props)
974
+ }, children);
975
+ };
976
+ }
977
+ function useCommerce() {
978
+ return React.useContext(Commerce);
979
+ }
980
+
981
+ /*
982
+ Forked from https://github.com/vercel/commerce/tree/main/packages/commerce/src
983
+ Changes: None
984
+ */
985
+ // Taken from https://fettblog.eu/typescript-assertion-signatures/
986
+ function defineProperty(obj, prop, val) {
987
+ Object.defineProperty(obj, prop, val);
988
+ }
989
+
990
+ var CommerceError = /*#__PURE__*/function (_Error) {
991
+ _inheritsLoose(CommerceError, _Error);
992
+
993
+ function CommerceError(_ref) {
994
+ var _this;
995
+
996
+ var message = _ref.message,
997
+ code = _ref.code,
998
+ errors = _ref.errors;
999
+ var error = message ? _extends({
1000
+ message: message
1001
+ }, code ? {
1002
+ code: code
1003
+ } : {}) : errors[0];
1004
+ _this = _Error.call(this, error.message) || this;
1005
+ _this.errors = message ? [error] : errors;
1006
+ if (error.code) _this.code = error.code;
1007
+ return _this;
1008
+ }
1009
+
1010
+ return CommerceError;
1011
+ }( /*#__PURE__*/_wrapNativeSuper(Error)); // Used for errors that come from a bad implementation of the hooks
1012
+
1013
+ var ValidationError = /*#__PURE__*/function (_CommerceError) {
1014
+ _inheritsLoose(ValidationError, _CommerceError);
1015
+
1016
+ function ValidationError(options) {
1017
+ var _this2;
1018
+
1019
+ _this2 = _CommerceError.call(this, options) || this;
1020
+ _this2.code = 'validation_error';
1021
+ return _this2;
1022
+ }
1023
+
1024
+ return ValidationError;
1025
+ }(CommerceError);
1026
+ var FetcherError = /*#__PURE__*/function (_CommerceError2) {
1027
+ _inheritsLoose(FetcherError, _CommerceError2);
1028
+
1029
+ function FetcherError(options) {
1030
+ var _this3;
1031
+
1032
+ _this3 = _CommerceError2.call(this, options) || this;
1033
+ _this3.status = options.status;
1034
+ return _this3;
1035
+ }
1036
+
1037
+ return FetcherError;
1038
+ }(CommerceError);
1039
+
1040
+ var useData = function useData(options, input, fetcherFn, swrOptions) {
1041
+ var hookInput = Array.isArray(input) ? input : Object.entries(input);
1042
+
1043
+ var fetcher = /*#__PURE__*/function () {
1044
+ var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(url, query, method) {
1045
+ var _len,
1046
+ args,
1047
+ _key,
1048
+ _args = arguments;
1049
+
1050
+ return runtime_1.wrap(function _callee$(_context) {
1051
+ while (1) {
1052
+ switch (_context.prev = _context.next) {
1053
+ case 0:
1054
+ _context.prev = 0;
1055
+
1056
+ for (_len = _args.length, args = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
1057
+ args[_key - 3] = _args[_key];
1058
+ }
1059
+
1060
+ _context.next = 4;
1061
+ return options.fetcher({
1062
+ options: {
1063
+ url: url,
1064
+ query: query,
1065
+ method: method
1066
+ },
1067
+ // Transform the input array into an object
1068
+ input: args.reduce(function (obj, val, i) {
1069
+ obj[hookInput[i][0]] = val;
1070
+ return obj;
1071
+ }, {}),
1072
+ fetch: fetcherFn
1073
+ });
1074
+
1075
+ case 4:
1076
+ return _context.abrupt("return", _context.sent);
1077
+
1078
+ case 7:
1079
+ _context.prev = 7;
1080
+ _context.t0 = _context["catch"](0);
1081
+
1082
+ // SWR will not log errors, but any error that's not an instance
1083
+ // of CommerceError is not welcomed by this hook
1084
+ if (!(_context.t0 instanceof CommerceError)) {
1085
+ console.error(_context.t0);
1086
+ }
1087
+
1088
+ throw _context.t0;
1089
+
1090
+ case 11:
1091
+ case "end":
1092
+ return _context.stop();
1093
+ }
1094
+ }
1095
+ }, _callee, null, [[0, 7]]);
1096
+ }));
1097
+
1098
+ return function fetcher(_x, _x2, _x3) {
1099
+ return _ref.apply(this, arguments);
1100
+ };
1101
+ }();
1102
+
1103
+ var response = useSWR(function () {
1104
+ var opts = options.fetchOptions;
1105
+ return opts ? [opts.url, opts.query, opts.method].concat(hookInput.map(function (e) {
1106
+ return e[1];
1107
+ })) : null;
1108
+ }, fetcher, swrOptions);
1109
+
1110
+ if (!('isLoading' in response)) {
1111
+ defineProperty(response, 'isLoading', {
1112
+ get: function get() {
1113
+ return response.data === undefined;
1114
+ },
1115
+ enumerable: true
1116
+ });
1117
+ }
1118
+
1119
+ return response;
1120
+ };
1121
+
1122
+ /*
1123
+ Forked from https://github.com/vercel/commerce/tree/main/packages/commerce/src
1124
+ Changes: None
1125
+ */
1126
+ function useFetcher() {
1127
+ var _providerRef$current$;
1128
+
1129
+ var _useCommerce = useCommerce(),
1130
+ providerRef = _useCommerce.providerRef,
1131
+ fetcherRef = _useCommerce.fetcherRef;
1132
+
1133
+ return (_providerRef$current$ = providerRef.current.fetcher) != null ? _providerRef$current$ : fetcherRef.current;
1134
+ }
1135
+ function useHook(fn) {
1136
+ var _useCommerce2 = useCommerce(),
1137
+ providerRef = _useCommerce2.providerRef;
1138
+
1139
+ var provider = providerRef.current;
1140
+ return fn(provider);
1141
+ }
1142
+ function useSWRHook(hook) {
1143
+ var fetcher = useFetcher();
1144
+ return hook.useHook({
1145
+ useData: function useData$1(ctx) {
1146
+ var _ctx$input;
1147
+
1148
+ var response = useData(hook, (_ctx$input = ctx == null ? void 0 : ctx.input) != null ? _ctx$input : [], fetcher, ctx == null ? void 0 : ctx.swrOptions);
1149
+
1150
+ return response;
1151
+ }
1152
+ });
1153
+ }
1154
+ function useMutationHook(hook) {
1155
+ var fetcher = useFetcher();
1156
+ return hook.useHook({
1157
+ fetch: React.useCallback(function (_temp) {
1158
+ var _ref = _temp === void 0 ? {} : _temp,
1159
+ input = _ref.input;
1160
+
1161
+ return hook.fetcher({
1162
+ input: input,
1163
+ options: hook.fetchOptions,
1164
+ fetch: fetcher
1165
+ });
1166
+ }, [fetcher, hook.fetchOptions])
1167
+ });
1168
+ }
1169
+
1170
+ var SWRFetcher = function SWRFetcher(_ref) {
1171
+ var options = _ref.options,
1172
+ fetch = _ref.fetch;
1173
+ return fetch(options);
1174
+ };
1175
+ var mutationFetcher = function mutationFetcher(_ref2) {
1176
+ var input = _ref2.input,
1177
+ options = _ref2.options,
1178
+ fetch = _ref2.fetch;
1179
+ return fetch(_extends({}, options, {
1180
+ body: input
1181
+ }));
1182
+ };
1183
+
1184
+ var fetcher = mutationFetcher;
1185
+
1186
+ var fn = function fn(provider) {
1187
+ var _provider$cart;
1188
+
1189
+ return (_provider$cart = provider.cart) == null ? void 0 : _provider$cart.useAddItem;
1190
+ };
1191
+
1192
+ var useAddItem = function useAddItem() {
1193
+ var hook = useHook(fn);
1194
+ return useMutationHook(_extends({
1195
+ fetcher: fetcher
1196
+ }, hook)).apply(void 0, arguments);
1197
+ };
1198
+
1199
+ var addToCartButtonMeta = {
1200
+ name: "plasmic-commerce-add-to-cart-button",
1201
+ displayName: "Add To Cart Button",
1202
+ props: {
1203
+ children: {
1204
+ type: "slot",
1205
+ defaultValue: [{
1206
+ type: "button",
1207
+ value: "Add To Cart"
1208
+ }]
1209
+ }
1210
+ },
1211
+ importPath: "commerce-providers/commerce",
1212
+ importName: "AddToCartButton"
1213
+ };
1214
+
1215
+ function AddToCartButton(props) {
1216
+ var children = props.children;
1217
+ var product = useProduct();
1218
+ var form = reactHookForm.useFormContext();
1219
+ var addItem = useAddItem();
1220
+
1221
+ var addToCart = /*#__PURE__*/function () {
1222
+ var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
1223
+ var _form$getValues$Produ;
1224
+
1225
+ var quantity, variantId;
1226
+ return runtime_1.wrap(function _callee$(_context) {
1227
+ while (1) {
1228
+ switch (_context.prev = _context.next) {
1229
+ case 0:
1230
+ quantity = (_form$getValues$Produ = +form.getValues()["ProductQuantity"]) != null ? _form$getValues$Produ : 1;
1231
+
1232
+ if (!(isNaN(quantity) || quantity < 1)) {
1233
+ _context.next = 3;
1234
+ break;
1235
+ }
1236
+
1237
+ throw new CommerceError({
1238
+ message: 'The item quantity has to be a valid integer greater than 0'
1239
+ });
1240
+
1241
+ case 3:
1242
+ if (!product) {
1243
+ _context.next = 7;
1244
+ break;
1245
+ }
1246
+
1247
+ variantId = form.getValues()["ProductVariant"];
1248
+ _context.next = 7;
1249
+ return addItem({
1250
+ productId: product.id,
1251
+ variantId: variantId,
1252
+ quantity: quantity
1253
+ });
1254
+
1255
+ case 7:
1256
+ case "end":
1257
+ return _context.stop();
1258
+ }
1259
+ }
1260
+ }, _callee);
1261
+ }));
1262
+
1263
+ return function addToCart() {
1264
+ return _ref.apply(this, arguments);
1265
+ };
1266
+ }();
1267
+
1268
+ return React__default.isValidElement(children) ? React__default.cloneElement(children, {
1269
+ onClick: function onClick(e) {
1270
+ if (children.props.onClick && typeof children.props.onClick === "function") {
1271
+ children.props.onClick(e);
1272
+ }
1273
+
1274
+ addToCart();
1275
+ }
1276
+ }) : null;
1277
+ }
1278
+
1279
+ function registerAddToCartButton(loader, customAddToCartButtonMeta) {
1280
+ var doRegisterComponent = function doRegisterComponent() {
1281
+ return loader ? loader.registerComponent.apply(loader, arguments) : registerComponent.apply(void 0, arguments);
1282
+ };
1283
+
1284
+ doRegisterComponent(AddToCartButton, customAddToCartButtonMeta != null ? customAddToCartButtonMeta : addToCartButtonMeta);
1285
+ }
1286
+
1287
+ var fetcher$1 = SWRFetcher;
1288
+
1289
+ var fn$1 = function fn(provider) {
1290
+ var _provider$products;
1291
+
1292
+ return (_provider$products = provider.products) == null ? void 0 : _provider$products.useSearch;
1293
+ };
1294
+
1295
+ var useSearch = function useSearch(input) {
1296
+ var hook = useHook(fn$1);
1297
+ console.log("dale", "commerce", input);
1298
+ return useSWRHook(_extends({
1299
+ fetcher: fetcher$1
1300
+ }, hook))(input);
1301
+ };
1302
+
1303
+ var productCollectionMeta = {
1304
+ name: "plasmic-commerce-product-collection",
1305
+ displayName: "Product Collection",
1306
+ props: {
1307
+ children: {
1308
+ type: "slot",
1309
+ defaultValue: [{
1310
+ type: "vbox",
1311
+ children: [{
1312
+ type: "component",
1313
+ name: "plasmic-commerce-product-text-field",
1314
+ props: {
1315
+ field: "name"
1316
+ }
1317
+ }, {
1318
+ type: "component",
1319
+ name: "plasmic-commerce-product-media"
1320
+ }],
1321
+ styles: {
1322
+ width: "100%"
1323
+ }
1324
+ }]
1325
+ },
1326
+ count: "number",
1327
+ categoryId: "string",
1328
+ brandId: "string"
1329
+ },
1330
+ defaultStyles: {
1331
+ display: "grid",
1332
+ gridTemplateColumns: "1fr 1fr 1fr 1fr"
1333
+ },
1334
+ importPath: "commerce-providers/commerce",
1335
+ importName: "ProductCollection"
1336
+ };
1337
+
1338
+ function ProductCollection(props) {
1339
+ var className = props.className,
1340
+ children = props.children,
1341
+ count = props.count,
1342
+ categoryId = props.categoryId,
1343
+ brandId = props.brandId;
1344
+
1345
+ var _useSearch = useSearch({
1346
+ categoryId: categoryId,
1347
+ brandId: brandId,
1348
+ count: count
1349
+ }),
1350
+ data = _useSearch.data;
1351
+
1352
+ return React__default.createElement("div", {
1353
+ className: className
1354
+ }, data == null ? void 0 : data.products.map(function (product, i) {
1355
+ return React__default.createElement(ProductProvider, {
1356
+ product: product,
1357
+ key: product.id
1358
+ }, host.repeatedElement(i === 0, children));
1359
+ }));
1360
+ }
1361
+
1362
+ function registerProductCollection(loader, customProductCollectionMeta) {
1363
+ var doRegisterComponent = function doRegisterComponent() {
1364
+ return loader ? loader.registerComponent.apply(loader, arguments) : registerComponent.apply(void 0, arguments);
1365
+ };
1366
+
1367
+ doRegisterComponent(ProductCollection, customProductCollectionMeta != null ? customProductCollectionMeta : productCollectionMeta);
1368
+ }
1369
+
1370
+ var placeholderImage = "https://static1.plasmic.app/commerce/lightweight-jacket-0.png";
1371
+ var productMediaMeta = {
1372
+ name: "plasmic-commerce-product-media",
1373
+ displayName: "Product Media",
1374
+ props: {
1375
+ children: "slot",
1376
+ style: "object",
1377
+ mediaIndex: "number"
1378
+ },
1379
+ importPath: "commerce-providers/commerce",
1380
+ importName: "ProductMedia"
1381
+ };
1382
+ function ProductMedia(props) {
1383
+ var _image$url;
1384
+
1385
+ var className = props.className,
1386
+ style = props.style,
1387
+ _props$mediaIndex = props.mediaIndex,
1388
+ mediaIndex = _props$mediaIndex === void 0 ? 0 : _props$mediaIndex;
1389
+ var product = useProduct();
1390
+ var image = product == null ? void 0 : product.images[mediaIndex];
1391
+ return React__default.createElement("img", {
1392
+ alt: (product == null ? void 0 : product.name) || 'Product Image',
1393
+ src: product ? (_image$url = image == null ? void 0 : image.url) != null ? _image$url : "" : placeholderImage,
1394
+ loading: 'lazy',
1395
+ className: className,
1396
+ style: style
1397
+ });
1398
+ }
1399
+ function registerProductMedia(loader, customProductMediaMeta) {
1400
+ var doRegisterComponent = function doRegisterComponent() {
1401
+ return loader ? loader.registerComponent.apply(loader, arguments) : registerComponent.apply(void 0, arguments);
1402
+ };
1403
+
1404
+ doRegisterComponent(ProductMedia, customProductMediaMeta != null ? customProductMediaMeta : productMediaMeta);
1405
+ }
1406
+
1407
+ /*
1408
+ Forked from https://github.com/vercel/commerce/tree/main/packages/commerce/src
1409
+ Changes: None
1410
+ */
1411
+ function formatPrice(_ref) {
1412
+ var amount = _ref.amount,
1413
+ currencyCode = _ref.currencyCode,
1414
+ locale = _ref.locale;
1415
+ var formatCurrency = new Intl.NumberFormat(locale, {
1416
+ style: 'currency',
1417
+ currency: currencyCode
1418
+ });
1419
+ return formatCurrency.format(amount);
1420
+ }
1421
+ function formatVariantPrice(_ref2) {
1422
+ var amount = _ref2.amount,
1423
+ baseAmount = _ref2.baseAmount,
1424
+ currencyCode = _ref2.currencyCode,
1425
+ locale = _ref2.locale;
1426
+ var hasDiscount = baseAmount > amount;
1427
+ var formatDiscount = new Intl.NumberFormat(locale, {
1428
+ style: 'percent'
1429
+ });
1430
+ var discount = hasDiscount ? formatDiscount.format((baseAmount - amount) / baseAmount) : null;
1431
+ var price = formatPrice({
1432
+ amount: amount,
1433
+ currencyCode: currencyCode,
1434
+ locale: locale
1435
+ });
1436
+ var basePrice = hasDiscount ? formatPrice({
1437
+ amount: baseAmount,
1438
+ currencyCode: currencyCode,
1439
+ locale: locale
1440
+ }) : null;
1441
+ return {
1442
+ price: price,
1443
+ basePrice: basePrice,
1444
+ discount: discount
1445
+ };
1446
+ }
1447
+ function usePrice(data) {
1448
+ var _ref3 = data != null ? data : {},
1449
+ amount = _ref3.amount,
1450
+ baseAmount = _ref3.baseAmount,
1451
+ currencyCode = _ref3.currencyCode;
1452
+
1453
+ var _useCommerce = useCommerce(),
1454
+ locale = _useCommerce.locale;
1455
+
1456
+ var value = React.useMemo(function () {
1457
+ if (typeof amount !== 'number' || !currencyCode) return '';
1458
+ return baseAmount ? formatVariantPrice({
1459
+ amount: amount,
1460
+ baseAmount: baseAmount,
1461
+ currencyCode: currencyCode,
1462
+ locale: locale
1463
+ }) : formatPrice({
1464
+ amount: amount,
1465
+ currencyCode: currencyCode,
1466
+ locale: locale
1467
+ });
1468
+ }, [amount, baseAmount, currencyCode]);
1469
+ return typeof value === 'string' ? {
1470
+ price: value
1471
+ } : value;
1472
+ }
1473
+
1474
+ var getProductPrice = function getProductPrice(product, variantId) {
1475
+ var _product$variants$fin, _product$variants$fin2;
1476
+
1477
+ return (_product$variants$fin = (_product$variants$fin2 = product.variants.find(function (variant) {
1478
+ return variant.id === variantId;
1479
+ })) == null ? void 0 : _product$variants$fin2.price) != null ? _product$variants$fin : product.price.value;
1480
+ };
1481
+
1482
+ var productPriceMeta = {
1483
+ name: "plasmic-commerce-product-price",
1484
+ displayName: "Product Price",
1485
+ props: {},
1486
+ importPath: "commerce-providers/commerce",
1487
+ importName: "ProductPrice"
1488
+ };
1489
+ function ProductPrice(props) {
1490
+ var className = props.className;
1491
+ var product = useProduct();
1492
+ var form = reactHookForm.useFormContext();
1493
+ var watchProductVariant = form.watch("ProductVariant", product == null ? void 0 : product.variants[0].id);
1494
+
1495
+ var _usePrice = usePrice({
1496
+ amount: product ? getProductPrice(product, watchProductVariant) : 0,
1497
+ currencyCode: product ? product.price.currencyCode : 'USD'
1498
+ }),
1499
+ price = _usePrice.price;
1500
+
1501
+ return React__default.createElement("span", {
1502
+ className: className
1503
+ }, price);
1504
+ }
1505
+ function registerProductPrice(loader, customProductPriceMeta) {
1506
+ var doRegisterComponent = function doRegisterComponent() {
1507
+ return loader ? loader.registerComponent.apply(loader, arguments) : registerComponent.apply(void 0, arguments);
1508
+ };
1509
+
1510
+ doRegisterComponent(ProductPrice, customProductPriceMeta != null ? customProductPriceMeta : productPriceMeta);
1511
+ }
1512
+
1513
+ var productQuantityMeta = {
1514
+ name: "plasmic-commerce-product-quantity",
1515
+ displayName: "Product Quantity",
1516
+ props: {
1517
+ children: {
1518
+ type: "slot",
1519
+ defaultValue: [{
1520
+ type: "input",
1521
+ attrs: {
1522
+ value: "1"
1523
+ }
1524
+ }]
1525
+ }
1526
+ },
1527
+ importPath: "commerce-providers/commerce",
1528
+ importName: "ProductQuantity"
1529
+ };
1530
+ function ProductQuantity(props) {
1531
+ var className = props.className,
1532
+ children = props.children;
1533
+ var form = reactHookForm.useFormContext();
1534
+ return React__default.createElement("div", {
1535
+ className: className
1536
+ }, React__default.createElement(reactHookForm.Controller, {
1537
+ name: "ProductQuantity",
1538
+ defaultValue: 1,
1539
+ control: form == null ? void 0 : form.control,
1540
+ render: function render(_ref) {
1541
+ var field = _ref.field;
1542
+ return React__default.isValidElement(children) ? React__default.cloneElement(children, _extends({}, children.props, field, {
1543
+ name: "ProductQuantity"
1544
+ })) : React__default.createElement(React__default.Fragment, null);
1545
+ }
1546
+ }));
1547
+ }
1548
+ function registerProductQuantity(loader, customProductQuantityMeta) {
1549
+ var doRegisterComponent = function doRegisterComponent() {
1550
+ return loader ? loader.registerComponent.apply(loader, arguments) : registerComponent.apply(void 0, arguments);
1551
+ };
1552
+
1553
+ doRegisterComponent(ProductQuantity, customProductQuantityMeta != null ? customProductQuantityMeta : productQuantityMeta);
1554
+ }
1555
+
1556
+ var productTextFieldMeta = {
1557
+ name: "plasmic-commerce-product-text-field",
1558
+ displayName: "Product Text Field",
1559
+ props: {
1560
+ field: {
1561
+ type: "choice",
1562
+ options: ["id", "name", "description", "sku", "slug", "path"]
1563
+ }
1564
+ },
1565
+ importPath: "commerce-providers/commerce",
1566
+ importName: "ProductTextField"
1567
+ };
1568
+ function ProductTextField(props) {
1569
+ var className = props.className,
1570
+ field = props.field;
1571
+ var product = useProduct();
1572
+
1573
+ if (!product) {
1574
+ return React__default.createElement("span", {
1575
+ className: className
1576
+ }, "Fake Product Field");
1577
+ }
1578
+
1579
+ if (!field) {
1580
+ return React__default.createElement("span", {
1581
+ className: className
1582
+ }, "Unknown Product Field");
1583
+ }
1584
+
1585
+ var value;
1586
+
1587
+ if (field === "description") {
1588
+ return product.descriptionHtml ? React__default.createElement("div", {
1589
+ className: className,
1590
+ dangerouslySetInnerHTML: {
1591
+ __html: product.descriptionHtml
1592
+ }
1593
+ }) : React__default.createElement("div", {
1594
+ className: className
1595
+ }, product.description);
1596
+ } else {
1597
+ value = product[field];
1598
+ }
1599
+
1600
+ return React__default.createElement("span", {
1601
+ className: className
1602
+ }, value);
1603
+ }
1604
+ function registerTextField(loader, customProductTextFieldMeta) {
1605
+ var doRegisterComponent = function doRegisterComponent() {
1606
+ return loader ? loader.registerComponent.apply(loader, arguments) : registerComponent.apply(void 0, arguments);
1607
+ };
1608
+
1609
+ doRegisterComponent(ProductTextField, customProductTextFieldMeta != null ? customProductTextFieldMeta : productTextFieldMeta);
1610
+ }
1611
+
1612
+ var productVariantPickerMeta = {
1613
+ name: "plasmic-commerce-product-variant-picker",
1614
+ displayName: "Product Variant Picker",
1615
+ props: {},
1616
+ importPath: "commerce-providers/commerce",
1617
+ importName: "ProductVariantPicker"
1618
+ };
1619
+ function ProductVariantPicker(props) {
1620
+ var className = props.className;
1621
+ var product = useProduct();
1622
+ var form = reactHookForm.useFormContext();
1623
+ return React__default.createElement(reactHookForm.Controller, {
1624
+ name: "ProductVariant",
1625
+ control: form == null ? void 0 : form.control,
1626
+ defaultValue: product == null ? void 0 : product.variants[0].id,
1627
+ render: function render(_ref) {
1628
+ var _product$variants$map;
1629
+
1630
+ var field = _ref.field;
1631
+ return React__default.createElement("select", Object.assign({
1632
+ className: className
1633
+ }, field), (_product$variants$map = product == null ? void 0 : product.variants.map(function (variant) {
1634
+ return React__default.createElement("option", {
1635
+ value: variant.id
1636
+ }, variant.name);
1637
+ })) != null ? _product$variants$map : React__default.createElement("option", null, "Fake Product Variant"));
1638
+ }
1639
+ });
1640
+ }
1641
+ function registerProductVariantPicker(loader, customProductVariantPickerMeta) {
1642
+ var doRegisterComponent = function doRegisterComponent() {
1643
+ return loader ? loader.registerComponent.apply(loader, arguments) : registerComponent.apply(void 0, arguments);
1644
+ };
1645
+
1646
+ doRegisterComponent(ProductVariantPicker, customProductVariantPickerMeta != null ? customProductVariantPickerMeta : productVariantPickerMeta);
1647
+ }
1648
+
1649
+ var fetcher$2 = /*#__PURE__*/function () {
1650
+ var _ref2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(_ref) {
1651
+ var options, cartId, fetch;
1652
+ return runtime_1.wrap(function _callee$(_context) {
1653
+ while (1) {
1654
+ switch (_context.prev = _context.next) {
1655
+ case 0:
1656
+ options = _ref.options, cartId = _ref.input.cartId, fetch = _ref.fetch;
1657
+
1658
+ if (!cartId) {
1659
+ _context.next = 7;
1660
+ break;
1661
+ }
1662
+
1663
+ _context.next = 4;
1664
+ return fetch(options);
1665
+
1666
+ case 4:
1667
+ _context.t0 = _context.sent;
1668
+ _context.next = 8;
1669
+ break;
1670
+
1671
+ case 7:
1672
+ _context.t0 = null;
1673
+
1674
+ case 8:
1675
+ return _context.abrupt("return", _context.t0);
1676
+
1677
+ case 9:
1678
+ case "end":
1679
+ return _context.stop();
1680
+ }
1681
+ }
1682
+ }, _callee);
1683
+ }));
1684
+
1685
+ return function fetcher(_x) {
1686
+ return _ref2.apply(this, arguments);
1687
+ };
1688
+ }();
1689
+
1690
+ var fn$2 = function fn(provider) {
1691
+ var _provider$cart;
1692
+
1693
+ return (_provider$cart = provider.cart) == null ? void 0 : _provider$cart.useCart;
1694
+ };
1695
+
1696
+ var useCart = function useCart(input) {
1697
+ var _hook$fetcher;
1698
+
1699
+ var hook = useHook(fn$2);
1700
+
1701
+ var _useCommerce = useCommerce(),
1702
+ cartCookie = _useCommerce.cartCookie;
1703
+
1704
+ var fetcherFn = (_hook$fetcher = hook.fetcher) != null ? _hook$fetcher : fetcher$2;
1705
+
1706
+ var wrapper = function wrapper(context) {
1707
+ context.input.cartId = Cookies.get(cartCookie);
1708
+ return fetcherFn(context);
1709
+ };
1710
+
1711
+ return useSWRHook(_extends({}, hook, {
1712
+ fetcher: wrapper
1713
+ }))(input);
1714
+ };
1715
+
1716
+ var useCartMeta = {
1717
+ name: "plasmic-commerce-use-cart",
1718
+ displayName: "Use Cart",
1719
+ props: {
1720
+ field: {
1721
+ type: "choice",
1722
+ options: ["Size", "Total Price"]
1723
+ }
1724
+ },
1725
+ importPath: "commerce-providers/commerce",
1726
+ importName: "UseCart"
1727
+ };
1728
+
1729
+ function UseCartComponent(props) {
1730
+ var _data$totalPrice, _data$currency$code;
1731
+
1732
+ var className = props.className,
1733
+ field = props.field;
1734
+
1735
+ var _useCart = useCart(),
1736
+ data = _useCart.data;
1737
+
1738
+ var _usePrice = usePrice({
1739
+ amount: (_data$totalPrice = data == null ? void 0 : data.totalPrice) != null ? _data$totalPrice : 0,
1740
+ currencyCode: (_data$currency$code = data == null ? void 0 : data.currency.code) != null ? _data$currency$code : "USD"
1741
+ }),
1742
+ price = _usePrice.price;
1743
+
1744
+ if (!field) {
1745
+ return React__default.createElement("p", null, "You must set the field prop");
1746
+ }
1747
+
1748
+ var value;
1749
+
1750
+ if (field === "Size") {
1751
+ var _data$lineItems$lengt;
1752
+
1753
+ value = "" + ((_data$lineItems$lengt = data == null ? void 0 : data.lineItems.length) != null ? _data$lineItems$lengt : 0);
1754
+ } else if (field === "Total Price") {
1755
+ value = "" + price;
1756
+ }
1757
+
1758
+ return React__default.createElement("span", {
1759
+ className: className
1760
+ }, value);
1761
+ }
1762
+
1763
+ function registerUseCart(loader, customUseCartMeta) {
1764
+ var doRegisterComponent = function doRegisterComponent() {
1765
+ return loader ? loader.registerComponent.apply(loader, arguments) : registerComponent.apply(void 0, arguments);
1766
+ };
1767
+
1768
+ doRegisterComponent(UseCartComponent, customUseCartMeta != null ? customUseCartMeta : useCartMeta);
1769
+ }
1770
+
1771
+ var x = function x() {
1772
+ return 2;
1773
+ };
1774
+
1775
+
1776
+
1777
+ var product = {
1778
+ __proto__: null
1779
+ };
1780
+
1781
+ var fetcher$3 = mutationFetcher;
1782
+
1783
+ var fn$3 = function fn(provider) {
1784
+ var _provider$cart;
1785
+
1786
+ return (_provider$cart = provider.cart) == null ? void 0 : _provider$cart.useRemoveItem;
1787
+ };
1788
+
1789
+ var useRemoveItem = function useRemoveItem(input) {
1790
+ var hook = useHook(fn$3);
1791
+ return useMutationHook(_extends({
1792
+ fetcher: fetcher$3
1793
+ }, hook))(input);
1794
+ };
1795
+
1796
+ var fetcher$4 = mutationFetcher;
1797
+
1798
+ var fn$4 = function fn(provider) {
1799
+ var _provider$cart;
1800
+
1801
+ return (_provider$cart = provider.cart) == null ? void 0 : _provider$cart.useUpdateItem;
1802
+ };
1803
+
1804
+ var useUpdateItem = function useUpdateItem(input) {
1805
+ var hook = useHook(fn$4);
1806
+ return useMutationHook(_extends({
1807
+ fetcher: fetcher$4
1808
+ }, hook))(input);
1809
+ };
1810
+
1811
+
1812
+
1813
+ var cart = {
1814
+ __proto__: null
1815
+ };
1816
+
1817
+
1818
+
1819
+ var site = {
1820
+ __proto__: null
1821
+ };
1822
+
1823
+ function registerAll(loader) {
1824
+ registerProductCollection(loader);
1825
+ registerTextField(loader);
1826
+ registerProductPrice(loader);
1827
+ registerProductMedia(loader);
1828
+ registerUseCart(loader);
1829
+ registerAddToCartButton(loader);
1830
+ registerProductQuantity(loader);
1831
+ registerProductVariantPicker(loader);
1832
+ }
1833
+
1834
+ exports.CartType = cart;
1835
+ exports.CommerceError = CommerceError;
1836
+ exports.CoreCommerceProvider = CoreCommerceProvider;
1837
+ exports.FetcherError = FetcherError;
1838
+ exports.ProductTypes = product;
1839
+ exports.SiteTypes = site;
1840
+ exports.ValidationError = ValidationError;
1841
+ exports.fetcher = fetcher$1;
1842
+ exports.getCommerceProvider = getCommerceProvider;
1843
+ exports.registerAll = registerAll;
1844
+ exports.useAddItem = useAddItem;
1845
+ exports.useCart = useCart;
1846
+ exports.useCommerce = useCommerce;
1847
+ exports.useRemoveItem = useRemoveItem;
1848
+ exports.useSearch = useSearch;
1849
+ exports.useUpdateItem = useUpdateItem;
1850
+ exports.x = x;
1851
+ //# sourceMappingURL=commerce.cjs.development.js.map