@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.
@@ -370,7 +370,6 @@ function _objectWithoutPropertiesLoose(source, excluded) {
370
370
  return target;
371
371
  }
372
372
 
373
- var _getAsyncError, _ref;
374
373
  function getError(errors, status) {
375
374
  var _errors;
376
375
  errors = (_errors = errors) != null ? _errors : [{
@@ -382,58 +381,65 @@ function getError(errors, status) {
382
381
  });
383
382
  }
384
383
  function getAsyncError(_x) {
385
- return (_getAsyncError = _getAsyncError || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(res) {
384
+ return _getAsyncError.apply(this, arguments);
385
+ }
386
+ function _getAsyncError() {
387
+ _getAsyncError = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(res) {
386
388
  var data;
387
- return _regeneratorRuntime().wrap(function _callee$(_context) {
388
- while (1) switch (_context.prev = _context.next) {
389
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
390
+ while (1) switch (_context2.prev = _context2.next) {
389
391
  case 0:
390
- _context.next = 2;
392
+ _context2.next = 2;
391
393
  return res.json();
392
394
  case 2:
393
- data = _context.sent;
394
- return _context.abrupt("return", getError(data.errors, res.status));
395
+ data = _context2.sent;
396
+ return _context2.abrupt("return", getError(data.errors, res.status));
395
397
  case 4:
396
398
  case "end":
397
- return _context.stop();
399
+ return _context2.stop();
398
400
  }
399
- }, _callee);
400
- }))).apply(this, arguments);
401
+ }, _callee2);
402
+ }));
403
+ return _getAsyncError.apply(this, arguments);
401
404
  }
402
- var handleFetchResponse = function handleFetchResponse(_x2) {
403
- return (_ref = _ref || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(res) {
405
+ var handleFetchResponse = /*#__PURE__*/function () {
406
+ var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(res) {
404
407
  var _yield$res$json, data, errors;
405
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
406
- while (1) switch (_context2.prev = _context2.next) {
408
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
409
+ while (1) switch (_context.prev = _context.next) {
407
410
  case 0:
408
411
  if (!res.ok) {
409
- _context2.next = 9;
412
+ _context.next = 9;
410
413
  break;
411
414
  }
412
- _context2.next = 3;
415
+ _context.next = 3;
413
416
  return res.json();
414
417
  case 3:
415
- _yield$res$json = _context2.sent;
418
+ _yield$res$json = _context.sent;
416
419
  data = _yield$res$json.data;
417
420
  errors = _yield$res$json.errors;
418
421
  if (!(errors && errors.length)) {
419
- _context2.next = 8;
422
+ _context.next = 8;
420
423
  break;
421
424
  }
422
425
  throw getError(errors, res.status);
423
426
  case 8:
424
- return _context2.abrupt("return", data);
427
+ return _context.abrupt("return", data);
425
428
  case 9:
426
- _context2.next = 11;
429
+ _context.next = 11;
427
430
  return getAsyncError(res);
428
431
  case 11:
429
- throw _context2.sent;
432
+ throw _context.sent;
430
433
  case 12:
431
434
  case "end":
432
- return _context2.stop();
435
+ return _context.stop();
433
436
  }
434
- }, _callee2);
435
- }))).apply(this, arguments);
436
- };
437
+ }, _callee);
438
+ }));
439
+ return function handleFetchResponse(_x2) {
440
+ return _ref.apply(this, arguments);
441
+ };
442
+ }();
437
443
 
438
444
  /*
439
445
  Forked from https://github.com/vercel/commerce/tree/main/packages/shopify/src
@@ -519,9 +525,8 @@ var getCheckoutQuery = /* GraphQL */"\n query getCheckout($checkoutId: ID!) {\n
519
525
  */
520
526
  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";
521
527
 
522
- var _ref$1;
523
- var checkoutCreate = function checkoutCreate(_x, _x2) {
524
- return (_ref$1 = _ref$1 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(fetch, lineItems) {
528
+ var checkoutCreate = /*#__PURE__*/function () {
529
+ var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(fetch, lineItems) {
525
530
  var _yield$fetch, checkoutCreate, checkout, checkoutId, options;
526
531
  return _regeneratorRuntime().wrap(function _callee$(_context) {
527
532
  while (1) switch (_context.prev = _context.next) {
@@ -557,8 +562,11 @@ var checkoutCreate = function checkoutCreate(_x, _x2) {
557
562
  return _context.stop();
558
563
  }
559
564
  }, _callee);
560
- }))).apply(this, arguments);
561
- };
565
+ }));
566
+ return function checkoutCreate(_x, _x2) {
567
+ return _ref.apply(this, arguments);
568
+ };
569
+ }();
562
570
 
563
571
  /*
564
572
  Forked from https://github.com/vercel/commerce/tree/main/packages/shopify/src
@@ -1287,11 +1295,10 @@ var handler$3 = {
1287
1295
  useHook: function useHook(_ref2) {
1288
1296
  var fetch = _ref2.fetch;
1289
1297
  return function () {
1290
- var _addItem;
1291
1298
  var _useCart = useCart(),
1292
1299
  mutate = _useCart.mutate;
1293
- return useCallback(function addItem(_x) {
1294
- return (_addItem = _addItem || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
1300
+ return useCallback( /*#__PURE__*/function () {
1301
+ var _addItem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
1295
1302
  var data;
1296
1303
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1297
1304
  while (1) switch (_context2.prev = _context2.next) {
@@ -1311,8 +1318,12 @@ var handler$3 = {
1311
1318
  return _context2.stop();
1312
1319
  }
1313
1320
  }, _callee2);
1314
- }))).apply(this, arguments);
1315
- }, [fetch, mutate]);
1321
+ }));
1322
+ function addItem(_x) {
1323
+ return _addItem.apply(this, arguments);
1324
+ }
1325
+ return addItem;
1326
+ }(), [fetch, mutate]);
1316
1327
  };
1317
1328
  }
1318
1329
  };
@@ -1348,7 +1359,6 @@ var handler$4 = {
1348
1359
  useHook: function useHook(_ref2) {
1349
1360
  var fetch = _ref2.fetch;
1350
1361
  return function (ctx) {
1351
- var _ref3;
1352
1362
  if (ctx === void 0) {
1353
1363
  ctx = {};
1354
1364
  }
@@ -1356,8 +1366,8 @@ var handler$4 = {
1356
1366
  item = _ctx.item;
1357
1367
  var _useCart = useCart(),
1358
1368
  mutate = _useCart.mutate;
1359
- var removeItem = function removeItem(_x) {
1360
- return (_ref3 = _ref3 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
1369
+ var removeItem = /*#__PURE__*/function () {
1370
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
1361
1371
  var _input$id;
1362
1372
  var itemId, data;
1363
1373
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
@@ -1389,8 +1399,11 @@ var handler$4 = {
1389
1399
  return _context2.stop();
1390
1400
  }
1391
1401
  }, _callee2);
1392
- }))).apply(this, arguments);
1393
- };
1402
+ }));
1403
+ return function removeItem(_x) {
1404
+ return _ref3.apply(this, arguments);
1405
+ };
1406
+ }();
1394
1407
  return useCallback(removeItem, [fetch, mutate]);
1395
1408
  };
1396
1409
  }
@@ -1458,7 +1471,7 @@ var handler$5 = {
1458
1471
  useHook: function useHook(_ref2) {
1459
1472
  var fetch = _ref2.fetch;
1460
1473
  return function (ctx) {
1461
- var _ref3, _ctx$wait;
1474
+ var _ctx$wait;
1462
1475
  if (ctx === void 0) {
1463
1476
  ctx = {};
1464
1477
  }
@@ -1466,8 +1479,8 @@ var handler$5 = {
1466
1479
  item = _ctx.item;
1467
1480
  var _useCart = useCart(),
1468
1481
  mutate = _useCart.mutate;
1469
- return useCallback(debounce(function (_x) {
1470
- return (_ref3 = _ref3 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
1482
+ return useCallback(debounce( /*#__PURE__*/function () {
1483
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
1471
1484
  var _input$id;
1472
1485
  var itemId, data;
1473
1486
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
@@ -1502,8 +1515,11 @@ var handler$5 = {
1502
1515
  return _context2.stop();
1503
1516
  }
1504
1517
  }, _callee2);
1505
- }))).apply(this, arguments);
1506
- }, (_ctx$wait = ctx.wait) != null ? _ctx$wait : 500), [fetch, mutate]);
1518
+ }));
1519
+ return function (_x) {
1520
+ return _ref3.apply(this, arguments);
1521
+ };
1522
+ }(), (_ctx$wait = ctx.wait) != null ? _ctx$wait : 500), [fetch, mutate]);
1507
1523
  };
1508
1524
  }
1509
1525
  };
@@ -1645,9 +1661,8 @@ var handler$7 = {
1645
1661
 
1646
1662
  var _excluded$1 = ["locale"];
1647
1663
  var getFetcher = function getFetcher(storeDomain, accessToken) {
1648
- var _ref2;
1649
- return function (_x) {
1650
- return (_ref2 = _ref2 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
1664
+ return /*#__PURE__*/function () {
1665
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
1651
1666
  var _ref$url, url, _ref$method, method, variables, query, _ref3, locale, vars;
1652
1667
  return _regeneratorRuntime().wrap(function _callee$(_context) {
1653
1668
  while (1) switch (_context.prev = _context.next) {
@@ -1677,8 +1692,11 @@ var getFetcher = function getFetcher(storeDomain, accessToken) {
1677
1692
  return _context.stop();
1678
1693
  }
1679
1694
  }, _callee);
1680
- }))).apply(this, arguments);
1681
- };
1695
+ }));
1696
+ return function (_x) {
1697
+ return _ref2.apply(this, arguments);
1698
+ };
1699
+ }();
1682
1700
  };
1683
1701
 
1684
1702
  /*