@plasmicpkgs/commerce-shopify 0.0.168 → 0.0.171

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.
@@ -377,7 +377,6 @@ function _objectWithoutPropertiesLoose(source, excluded) {
377
377
  return target;
378
378
  }
379
379
 
380
- var _getAsyncError, _ref;
381
380
  function getError(errors, status) {
382
381
  var _errors;
383
382
  errors = (_errors = errors) != null ? _errors : [{
@@ -389,58 +388,65 @@ function getError(errors, status) {
389
388
  });
390
389
  }
391
390
  function getAsyncError(_x) {
392
- return (_getAsyncError = _getAsyncError || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(res) {
391
+ return _getAsyncError.apply(this, arguments);
392
+ }
393
+ function _getAsyncError() {
394
+ _getAsyncError = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(res) {
393
395
  var data;
394
- return _regeneratorRuntime().wrap(function _callee$(_context) {
395
- while (1) switch (_context.prev = _context.next) {
396
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
397
+ while (1) switch (_context2.prev = _context2.next) {
396
398
  case 0:
397
- _context.next = 2;
399
+ _context2.next = 2;
398
400
  return res.json();
399
401
  case 2:
400
- data = _context.sent;
401
- return _context.abrupt("return", getError(data.errors, res.status));
402
+ data = _context2.sent;
403
+ return _context2.abrupt("return", getError(data.errors, res.status));
402
404
  case 4:
403
405
  case "end":
404
- return _context.stop();
406
+ return _context2.stop();
405
407
  }
406
- }, _callee);
407
- }))).apply(this, arguments);
408
+ }, _callee2);
409
+ }));
410
+ return _getAsyncError.apply(this, arguments);
408
411
  }
409
- var handleFetchResponse = function handleFetchResponse(_x2) {
410
- return (_ref = _ref || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(res) {
412
+ var handleFetchResponse = /*#__PURE__*/function () {
413
+ var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(res) {
411
414
  var _yield$res$json, data, errors;
412
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
413
- while (1) switch (_context2.prev = _context2.next) {
415
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
416
+ while (1) switch (_context.prev = _context.next) {
414
417
  case 0:
415
418
  if (!res.ok) {
416
- _context2.next = 9;
419
+ _context.next = 9;
417
420
  break;
418
421
  }
419
- _context2.next = 3;
422
+ _context.next = 3;
420
423
  return res.json();
421
424
  case 3:
422
- _yield$res$json = _context2.sent;
425
+ _yield$res$json = _context.sent;
423
426
  data = _yield$res$json.data;
424
427
  errors = _yield$res$json.errors;
425
428
  if (!(errors && errors.length)) {
426
- _context2.next = 8;
429
+ _context.next = 8;
427
430
  break;
428
431
  }
429
432
  throw getError(errors, res.status);
430
433
  case 8:
431
- return _context2.abrupt("return", data);
434
+ return _context.abrupt("return", data);
432
435
  case 9:
433
- _context2.next = 11;
436
+ _context.next = 11;
434
437
  return getAsyncError(res);
435
438
  case 11:
436
- throw _context2.sent;
439
+ throw _context.sent;
437
440
  case 12:
438
441
  case "end":
439
- return _context2.stop();
442
+ return _context.stop();
440
443
  }
441
- }, _callee2);
442
- }))).apply(this, arguments);
443
- };
444
+ }, _callee);
445
+ }));
446
+ return function handleFetchResponse(_x2) {
447
+ return _ref.apply(this, arguments);
448
+ };
449
+ }();
444
450
 
445
451
  /*
446
452
  Forked from https://github.com/vercel/commerce/tree/main/packages/shopify/src
@@ -526,9 +532,8 @@ var getCheckoutQuery = /* GraphQL */"\n query getCheckout($checkoutId: ID!) {\n
526
532
  */
527
533
  var checkoutCreateMutation = /* GraphQL */"\n mutation checkoutCreate($input: CheckoutCreateInput = {}) {\n checkoutCreate(input: $input) {\n checkoutUserErrors {\n code\n field\n message\n }\n checkout {\n ...checkoutDetails\n }\n }\n }\n\n " + checkoutDetailsFragment + "\n";
528
534
 
529
- var _ref$1;
530
- var checkoutCreate = function checkoutCreate(_x, _x2) {
531
- return (_ref$1 = _ref$1 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(fetch, lineItems) {
535
+ var checkoutCreate = /*#__PURE__*/function () {
536
+ var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(fetch, lineItems) {
532
537
  var _yield$fetch, checkoutCreate, checkout, checkoutId, options;
533
538
  return _regeneratorRuntime().wrap(function _callee$(_context) {
534
539
  while (1) switch (_context.prev = _context.next) {
@@ -564,8 +569,11 @@ var checkoutCreate = function checkoutCreate(_x, _x2) {
564
569
  return _context.stop();
565
570
  }
566
571
  }, _callee);
567
- }))).apply(this, arguments);
568
- };
572
+ }));
573
+ return function checkoutCreate(_x, _x2) {
574
+ return _ref.apply(this, arguments);
575
+ };
576
+ }();
569
577
 
570
578
  /*
571
579
  Forked from https://github.com/vercel/commerce/tree/main/packages/shopify/src
@@ -1294,11 +1302,10 @@ var handler$3 = {
1294
1302
  useHook: function useHook(_ref2) {
1295
1303
  var fetch = _ref2.fetch;
1296
1304
  return function () {
1297
- var _addItem;
1298
1305
  var _useCart = commerce.useCart(),
1299
1306
  mutate = _useCart.mutate;
1300
- return React.useCallback(function addItem(_x) {
1301
- return (_addItem = _addItem || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
1307
+ return React.useCallback( /*#__PURE__*/function () {
1308
+ var _addItem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
1302
1309
  var data;
1303
1310
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1304
1311
  while (1) switch (_context2.prev = _context2.next) {
@@ -1318,8 +1325,12 @@ var handler$3 = {
1318
1325
  return _context2.stop();
1319
1326
  }
1320
1327
  }, _callee2);
1321
- }))).apply(this, arguments);
1322
- }, [fetch, mutate]);
1328
+ }));
1329
+ function addItem(_x) {
1330
+ return _addItem.apply(this, arguments);
1331
+ }
1332
+ return addItem;
1333
+ }(), [fetch, mutate]);
1323
1334
  };
1324
1335
  }
1325
1336
  };
@@ -1355,7 +1366,6 @@ var handler$4 = {
1355
1366
  useHook: function useHook(_ref2) {
1356
1367
  var fetch = _ref2.fetch;
1357
1368
  return function (ctx) {
1358
- var _ref3;
1359
1369
  if (ctx === void 0) {
1360
1370
  ctx = {};
1361
1371
  }
@@ -1363,8 +1373,8 @@ var handler$4 = {
1363
1373
  item = _ctx.item;
1364
1374
  var _useCart = commerce.useCart(),
1365
1375
  mutate = _useCart.mutate;
1366
- var removeItem = function removeItem(_x) {
1367
- return (_ref3 = _ref3 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
1376
+ var removeItem = /*#__PURE__*/function () {
1377
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
1368
1378
  var _input$id;
1369
1379
  var itemId, data;
1370
1380
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
@@ -1396,8 +1406,11 @@ var handler$4 = {
1396
1406
  return _context2.stop();
1397
1407
  }
1398
1408
  }, _callee2);
1399
- }))).apply(this, arguments);
1400
- };
1409
+ }));
1410
+ return function removeItem(_x) {
1411
+ return _ref3.apply(this, arguments);
1412
+ };
1413
+ }();
1401
1414
  return React.useCallback(removeItem, [fetch, mutate]);
1402
1415
  };
1403
1416
  }
@@ -1465,7 +1478,7 @@ var handler$5 = {
1465
1478
  useHook: function useHook(_ref2) {
1466
1479
  var fetch = _ref2.fetch;
1467
1480
  return function (ctx) {
1468
- var _ref3, _ctx$wait;
1481
+ var _ctx$wait;
1469
1482
  if (ctx === void 0) {
1470
1483
  ctx = {};
1471
1484
  }
@@ -1473,8 +1486,8 @@ var handler$5 = {
1473
1486
  item = _ctx.item;
1474
1487
  var _useCart = commerce.useCart(),
1475
1488
  mutate = _useCart.mutate;
1476
- return React.useCallback(debounce(function (_x) {
1477
- return (_ref3 = _ref3 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
1489
+ return React.useCallback(debounce( /*#__PURE__*/function () {
1490
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
1478
1491
  var _input$id;
1479
1492
  var itemId, data;
1480
1493
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
@@ -1509,8 +1522,11 @@ var handler$5 = {
1509
1522
  return _context2.stop();
1510
1523
  }
1511
1524
  }, _callee2);
1512
- }))).apply(this, arguments);
1513
- }, (_ctx$wait = ctx.wait) != null ? _ctx$wait : 500), [fetch, mutate]);
1525
+ }));
1526
+ return function (_x) {
1527
+ return _ref3.apply(this, arguments);
1528
+ };
1529
+ }(), (_ctx$wait = ctx.wait) != null ? _ctx$wait : 500), [fetch, mutate]);
1514
1530
  };
1515
1531
  }
1516
1532
  };
@@ -1652,9 +1668,8 @@ var handler$7 = {
1652
1668
 
1653
1669
  var _excluded$1 = ["locale"];
1654
1670
  var getFetcher = function getFetcher(storeDomain, accessToken) {
1655
- var _ref2;
1656
- return function (_x) {
1657
- return (_ref2 = _ref2 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
1671
+ return /*#__PURE__*/function () {
1672
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
1658
1673
  var _ref$url, url, _ref$method, method, variables, query, _ref3, locale, vars;
1659
1674
  return _regeneratorRuntime().wrap(function _callee$(_context) {
1660
1675
  while (1) switch (_context.prev = _context.next) {
@@ -1684,8 +1699,11 @@ var getFetcher = function getFetcher(storeDomain, accessToken) {
1684
1699
  return _context.stop();
1685
1700
  }
1686
1701
  }, _callee);
1687
- }))).apply(this, arguments);
1688
- };
1702
+ }));
1703
+ return function (_x) {
1704
+ return _ref2.apply(this, arguments);
1705
+ };
1706
+ }();
1689
1707
  };
1690
1708
 
1691
1709
  /*