@szymonpiatek/nextwordpress 0.0.6 → 0.0.7

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.
package/dist/index.cjs CHANGED
@@ -727,7 +727,8 @@ function createWooCommerceFetcher(config) {
727
727
  return { ...query, consumer_key: config.consumerKey, consumer_secret: config.consumerSecret };
728
728
  }
729
729
  function buildUrl2(path, query) {
730
- return `${config.serverURL}${path}?${toQueryString(withAuth(query))}`;
730
+ const base = typeof window !== "undefined" && config.clientURL ? config.clientURL : config.serverURL;
731
+ return `${base}${path}?${toQueryString(withAuth(query))}`;
731
732
  }
732
733
  async function wcFetch(path, query, tags = ["woocommerce"], options) {
733
734
  const url = buildUrl2(path, query);
@@ -1211,6 +1212,725 @@ function createCustomersQueries(fetcher) {
1211
1212
  };
1212
1213
  }
1213
1214
 
1215
+ // src/integrations/restApi/woocommerce/payment_gateways/queries.ts
1216
+ function createPaymentGatewaysQueries(fetcher) {
1217
+ const { wcFetch, wcFetchGraceful } = fetcher;
1218
+ async function getPaymentGateways() {
1219
+ return wcFetchGraceful(
1220
+ "/wp-json/wc/v3/payment_gateways",
1221
+ [],
1222
+ void 0,
1223
+ ["woocommerce", "payment_gateways"]
1224
+ );
1225
+ }
1226
+ async function getEnabledPaymentGateways() {
1227
+ const gateways = await wcFetchGraceful(
1228
+ "/wp-json/wc/v3/payment_gateways",
1229
+ [],
1230
+ void 0,
1231
+ ["woocommerce", "payment_gateways"]
1232
+ );
1233
+ return gateways.filter((g) => g.enabled);
1234
+ }
1235
+ async function getPaymentGatewayById(id) {
1236
+ return wcFetch(
1237
+ `/wp-json/wc/v3/payment_gateways/${id}`,
1238
+ void 0,
1239
+ ["woocommerce", "payment_gateways", `payment_gateway-${id}`]
1240
+ );
1241
+ }
1242
+ return {
1243
+ getPaymentGateways,
1244
+ getEnabledPaymentGateways,
1245
+ getPaymentGatewayById
1246
+ };
1247
+ }
1248
+
1249
+ // src/integrations/restApi/woocommerce/order_notes/queries.ts
1250
+ function createOrderNotesQueries(fetcher) {
1251
+ const { wcFetch, wcFetchGraceful, wcMutate } = fetcher;
1252
+ async function getNotesByOrderId(orderId) {
1253
+ return wcFetchGraceful(
1254
+ `/wp-json/wc/v3/orders/${orderId}/notes`,
1255
+ [],
1256
+ void 0,
1257
+ ["woocommerce", "order_notes", `order-${orderId}-notes`]
1258
+ );
1259
+ }
1260
+ async function getOrderNoteById(orderId, noteId) {
1261
+ return wcFetch(
1262
+ `/wp-json/wc/v3/orders/${orderId}/notes/${noteId}`,
1263
+ void 0,
1264
+ ["woocommerce", "order_notes", `order-${orderId}-note-${noteId}`]
1265
+ );
1266
+ }
1267
+ async function createOrderNote(orderId, input) {
1268
+ return wcMutate(
1269
+ `/wp-json/wc/v3/orders/${orderId}/notes`,
1270
+ input,
1271
+ "POST"
1272
+ );
1273
+ }
1274
+ async function deleteOrderNote(orderId, noteId, force = true) {
1275
+ return wcMutate(
1276
+ `/wp-json/wc/v3/orders/${orderId}/notes/${noteId}`,
1277
+ { force },
1278
+ "DELETE"
1279
+ );
1280
+ }
1281
+ return {
1282
+ getNotesByOrderId,
1283
+ getOrderNoteById,
1284
+ createOrderNote,
1285
+ deleteOrderNote
1286
+ };
1287
+ }
1288
+
1289
+ // src/integrations/restApi/woocommerce/order_refunds/queries.ts
1290
+ function createOrderRefundsQueries(fetcher) {
1291
+ const { wcFetch, wcFetchGraceful, wcMutate } = fetcher;
1292
+ async function getRefundsByOrderId(orderId) {
1293
+ return wcFetchGraceful(
1294
+ `/wp-json/wc/v3/orders/${orderId}/refunds`,
1295
+ [],
1296
+ void 0,
1297
+ ["woocommerce", "order_refunds", `order-${orderId}-refunds`]
1298
+ );
1299
+ }
1300
+ async function getOrderRefundById(orderId, refundId) {
1301
+ return wcFetch(
1302
+ `/wp-json/wc/v3/orders/${orderId}/refunds/${refundId}`,
1303
+ void 0,
1304
+ ["woocommerce", "order_refunds", `order-${orderId}-refund-${refundId}`]
1305
+ );
1306
+ }
1307
+ async function createOrderRefund(orderId, input) {
1308
+ return wcMutate(
1309
+ `/wp-json/wc/v3/orders/${orderId}/refunds`,
1310
+ input,
1311
+ "POST"
1312
+ );
1313
+ }
1314
+ async function deleteOrderRefund(orderId, refundId, force = true) {
1315
+ return wcMutate(
1316
+ `/wp-json/wc/v3/orders/${orderId}/refunds/${refundId}`,
1317
+ { force },
1318
+ "DELETE"
1319
+ );
1320
+ }
1321
+ return {
1322
+ getRefundsByOrderId,
1323
+ getOrderRefundById,
1324
+ createOrderRefund,
1325
+ deleteOrderRefund
1326
+ };
1327
+ }
1328
+
1329
+ // src/integrations/restApi/woocommerce/product_attributes/queries.ts
1330
+ function createProductAttributesQueries(fetcher) {
1331
+ const { wcFetch, wcFetchGraceful, wcMutate } = fetcher;
1332
+ async function getProductAttributes() {
1333
+ return wcFetchGraceful(
1334
+ "/wp-json/wc/v3/products/attributes",
1335
+ [],
1336
+ void 0,
1337
+ ["woocommerce", "product_attributes"]
1338
+ );
1339
+ }
1340
+ async function getProductAttributeById(id) {
1341
+ return wcFetch(
1342
+ `/wp-json/wc/v3/products/attributes/${id}`,
1343
+ void 0,
1344
+ ["woocommerce", "product_attributes", `attribute-${id}`]
1345
+ );
1346
+ }
1347
+ async function createProductAttribute(input) {
1348
+ return wcMutate("/wp-json/wc/v3/products/attributes", input, "POST");
1349
+ }
1350
+ async function updateProductAttribute(id, input) {
1351
+ return wcMutate(
1352
+ `/wp-json/wc/v3/products/attributes/${id}`,
1353
+ input,
1354
+ "PUT"
1355
+ );
1356
+ }
1357
+ async function deleteProductAttribute(id, force = true) {
1358
+ return wcMutate(
1359
+ `/wp-json/wc/v3/products/attributes/${id}`,
1360
+ { force },
1361
+ "DELETE"
1362
+ );
1363
+ }
1364
+ async function getAttributeTerms(attributeId) {
1365
+ return wcFetchGraceful(
1366
+ `/wp-json/wc/v3/products/attributes/${attributeId}/terms`,
1367
+ [],
1368
+ void 0,
1369
+ ["woocommerce", "attribute_terms", `attribute-${attributeId}-terms`]
1370
+ );
1371
+ }
1372
+ async function getAttributeTermById(attributeId, termId) {
1373
+ return wcFetch(
1374
+ `/wp-json/wc/v3/products/attributes/${attributeId}/terms/${termId}`,
1375
+ void 0,
1376
+ ["woocommerce", "attribute_terms", `attribute-${attributeId}-term-${termId}`]
1377
+ );
1378
+ }
1379
+ async function createAttributeTerm(attributeId, input) {
1380
+ return wcMutate(
1381
+ `/wp-json/wc/v3/products/attributes/${attributeId}/terms`,
1382
+ input,
1383
+ "POST"
1384
+ );
1385
+ }
1386
+ async function updateAttributeTerm(attributeId, termId, input) {
1387
+ return wcMutate(
1388
+ `/wp-json/wc/v3/products/attributes/${attributeId}/terms/${termId}`,
1389
+ input,
1390
+ "PUT"
1391
+ );
1392
+ }
1393
+ async function deleteAttributeTerm(attributeId, termId, force = true) {
1394
+ return wcMutate(
1395
+ `/wp-json/wc/v3/products/attributes/${attributeId}/terms/${termId}`,
1396
+ { force },
1397
+ "DELETE"
1398
+ );
1399
+ }
1400
+ return {
1401
+ getProductAttributes,
1402
+ getProductAttributeById,
1403
+ createProductAttribute,
1404
+ updateProductAttribute,
1405
+ deleteProductAttribute,
1406
+ getAttributeTerms,
1407
+ getAttributeTermById,
1408
+ createAttributeTerm,
1409
+ updateAttributeTerm,
1410
+ deleteAttributeTerm
1411
+ };
1412
+ }
1413
+
1414
+ // src/integrations/restApi/woocommerce/product_reviews/queries.ts
1415
+ function createProductReviewsQueries(fetcher) {
1416
+ const { wcFetch, wcFetchGraceful, wcMutate } = fetcher;
1417
+ async function getProductReviews(params) {
1418
+ return wcFetchGraceful(
1419
+ "/wp-json/wc/v3/products/reviews",
1420
+ [],
1421
+ params,
1422
+ ["woocommerce", "product_reviews"]
1423
+ );
1424
+ }
1425
+ async function getProductReviewsByProductId(productId) {
1426
+ return wcFetchGraceful(
1427
+ "/wp-json/wc/v3/products/reviews",
1428
+ [],
1429
+ { product: [productId] },
1430
+ ["woocommerce", "product_reviews", `reviews-product-${productId}`]
1431
+ );
1432
+ }
1433
+ async function getProductReviewById(id) {
1434
+ return wcFetch(
1435
+ `/wp-json/wc/v3/products/reviews/${id}`,
1436
+ void 0,
1437
+ ["woocommerce", "product_reviews", `review-${id}`]
1438
+ );
1439
+ }
1440
+ async function createProductReview(input) {
1441
+ return wcMutate("/wp-json/wc/v3/products/reviews", input, "POST");
1442
+ }
1443
+ async function updateProductReview(id, input) {
1444
+ return wcMutate(`/wp-json/wc/v3/products/reviews/${id}`, input, "PUT");
1445
+ }
1446
+ async function deleteProductReview(id, force = true) {
1447
+ return wcMutate(
1448
+ `/wp-json/wc/v3/products/reviews/${id}`,
1449
+ { force },
1450
+ "DELETE"
1451
+ );
1452
+ }
1453
+ return {
1454
+ getProductReviews,
1455
+ getProductReviewsByProductId,
1456
+ getProductReviewById,
1457
+ createProductReview,
1458
+ updateProductReview,
1459
+ deleteProductReview
1460
+ };
1461
+ }
1462
+
1463
+ // src/integrations/restApi/woocommerce/shipping_classes/queries.ts
1464
+ function createShippingClassesQueries(fetcher) {
1465
+ const { wcFetch, wcFetchGraceful, wcMutate } = fetcher;
1466
+ async function getShippingClasses() {
1467
+ return wcFetchGraceful(
1468
+ "/wp-json/wc/v3/products/shipping_classes",
1469
+ [],
1470
+ void 0,
1471
+ ["woocommerce", "shipping_classes"]
1472
+ );
1473
+ }
1474
+ async function getShippingClassById(id) {
1475
+ return wcFetch(
1476
+ `/wp-json/wc/v3/products/shipping_classes/${id}`,
1477
+ void 0,
1478
+ ["woocommerce", "shipping_classes", `shipping-class-${id}`]
1479
+ );
1480
+ }
1481
+ async function createShippingClass(input) {
1482
+ return wcMutate("/wp-json/wc/v3/products/shipping_classes", input, "POST");
1483
+ }
1484
+ async function updateShippingClass(id, input) {
1485
+ return wcMutate(
1486
+ `/wp-json/wc/v3/products/shipping_classes/${id}`,
1487
+ input,
1488
+ "PUT"
1489
+ );
1490
+ }
1491
+ async function deleteShippingClass(id, force = true) {
1492
+ return wcMutate(
1493
+ `/wp-json/wc/v3/products/shipping_classes/${id}`,
1494
+ { force },
1495
+ "DELETE"
1496
+ );
1497
+ }
1498
+ return {
1499
+ getShippingClasses,
1500
+ getShippingClassById,
1501
+ createShippingClass,
1502
+ updateShippingClass,
1503
+ deleteShippingClass
1504
+ };
1505
+ }
1506
+
1507
+ // src/integrations/restApi/woocommerce/taxes/queries.ts
1508
+ function createTaxesQueries(fetcher) {
1509
+ const { wcFetch, wcFetchGraceful, wcMutate } = fetcher;
1510
+ async function getTaxRates(params) {
1511
+ return wcFetchGraceful(
1512
+ "/wp-json/wc/v3/taxes",
1513
+ [],
1514
+ params,
1515
+ ["woocommerce", "tax_rates"]
1516
+ );
1517
+ }
1518
+ async function getTaxRateById(id) {
1519
+ return wcFetch(
1520
+ `/wp-json/wc/v3/taxes/${id}`,
1521
+ void 0,
1522
+ ["woocommerce", "tax_rates", `tax-rate-${id}`]
1523
+ );
1524
+ }
1525
+ async function createTaxRate(input) {
1526
+ return wcMutate("/wp-json/wc/v3/taxes", input, "POST");
1527
+ }
1528
+ async function updateTaxRate(id, input) {
1529
+ return wcMutate(`/wp-json/wc/v3/taxes/${id}`, input, "PUT");
1530
+ }
1531
+ async function deleteTaxRate(id, force = true) {
1532
+ return wcMutate(
1533
+ `/wp-json/wc/v3/taxes/${id}`,
1534
+ { force },
1535
+ "DELETE"
1536
+ );
1537
+ }
1538
+ async function getTaxClasses() {
1539
+ return wcFetchGraceful(
1540
+ "/wp-json/wc/v3/taxes/classes",
1541
+ [],
1542
+ void 0,
1543
+ ["woocommerce", "tax_classes"]
1544
+ );
1545
+ }
1546
+ async function createTaxClass(input) {
1547
+ return wcMutate("/wp-json/wc/v3/taxes/classes", input, "POST");
1548
+ }
1549
+ async function deleteTaxClass(slug, force = true) {
1550
+ return wcMutate(
1551
+ `/wp-json/wc/v3/taxes/classes/${slug}`,
1552
+ { force },
1553
+ "DELETE"
1554
+ );
1555
+ }
1556
+ return {
1557
+ getTaxRates,
1558
+ getTaxRateById,
1559
+ createTaxRate,
1560
+ updateTaxRate,
1561
+ deleteTaxRate,
1562
+ getTaxClasses,
1563
+ createTaxClass,
1564
+ deleteTaxClass
1565
+ };
1566
+ }
1567
+
1568
+ // src/integrations/restApi/woocommerce/shipping/queries.ts
1569
+ function createShippingQueries(fetcher) {
1570
+ const { wcFetch, wcFetchGraceful, wcMutate } = fetcher;
1571
+ async function getShippingZones() {
1572
+ return wcFetchGraceful(
1573
+ "/wp-json/wc/v3/shipping/zones",
1574
+ [],
1575
+ void 0,
1576
+ ["woocommerce", "shipping_zones"]
1577
+ );
1578
+ }
1579
+ async function getShippingZoneById(id) {
1580
+ return wcFetch(
1581
+ `/wp-json/wc/v3/shipping/zones/${id}`,
1582
+ void 0,
1583
+ ["woocommerce", "shipping_zones", `zone-${id}`]
1584
+ );
1585
+ }
1586
+ async function createShippingZone(input) {
1587
+ return wcMutate("/wp-json/wc/v3/shipping/zones", input, "POST");
1588
+ }
1589
+ async function updateShippingZone(id, input) {
1590
+ return wcMutate(`/wp-json/wc/v3/shipping/zones/${id}`, input, "PUT");
1591
+ }
1592
+ async function deleteShippingZone(id, force = true) {
1593
+ return wcMutate(
1594
+ `/wp-json/wc/v3/shipping/zones/${id}`,
1595
+ { force },
1596
+ "DELETE"
1597
+ );
1598
+ }
1599
+ async function getShippingZoneLocations(zoneId) {
1600
+ return wcFetchGraceful(
1601
+ `/wp-json/wc/v3/shipping/zones/${zoneId}/locations`,
1602
+ [],
1603
+ void 0,
1604
+ ["woocommerce", "shipping_zone_locations", `zone-${zoneId}-locations`]
1605
+ );
1606
+ }
1607
+ async function updateShippingZoneLocations(zoneId, locations) {
1608
+ return wcMutate(
1609
+ `/wp-json/wc/v3/shipping/zones/${zoneId}/locations`,
1610
+ locations,
1611
+ "PUT"
1612
+ );
1613
+ }
1614
+ async function getShippingZoneMethods(zoneId) {
1615
+ return wcFetchGraceful(
1616
+ `/wp-json/wc/v3/shipping/zones/${zoneId}/methods`,
1617
+ [],
1618
+ void 0,
1619
+ ["woocommerce", "shipping_zone_methods", `zone-${zoneId}-methods`]
1620
+ );
1621
+ }
1622
+ async function getShippingZoneMethodById(zoneId, instanceId) {
1623
+ return wcFetch(
1624
+ `/wp-json/wc/v3/shipping/zones/${zoneId}/methods/${instanceId}`,
1625
+ void 0,
1626
+ ["woocommerce", "shipping_zone_methods", `zone-${zoneId}-method-${instanceId}`]
1627
+ );
1628
+ }
1629
+ async function createShippingZoneMethod(zoneId, input) {
1630
+ return wcMutate(
1631
+ `/wp-json/wc/v3/shipping/zones/${zoneId}/methods`,
1632
+ input,
1633
+ "POST"
1634
+ );
1635
+ }
1636
+ async function updateShippingZoneMethod(zoneId, instanceId, input) {
1637
+ return wcMutate(
1638
+ `/wp-json/wc/v3/shipping/zones/${zoneId}/methods/${instanceId}`,
1639
+ input,
1640
+ "PUT"
1641
+ );
1642
+ }
1643
+ async function deleteShippingZoneMethod(zoneId, instanceId, force = true) {
1644
+ return wcMutate(
1645
+ `/wp-json/wc/v3/shipping/zones/${zoneId}/methods/${instanceId}`,
1646
+ { force },
1647
+ "DELETE"
1648
+ );
1649
+ }
1650
+ async function getShippingMethods() {
1651
+ return wcFetchGraceful(
1652
+ "/wp-json/wc/v3/shipping_methods",
1653
+ [],
1654
+ void 0,
1655
+ ["woocommerce", "shipping_methods"]
1656
+ );
1657
+ }
1658
+ async function getShippingMethodById(id) {
1659
+ return wcFetch(
1660
+ `/wp-json/wc/v3/shipping_methods/${id}`,
1661
+ void 0,
1662
+ ["woocommerce", "shipping_methods", `shipping-method-${id}`]
1663
+ );
1664
+ }
1665
+ return {
1666
+ getShippingZones,
1667
+ getShippingZoneById,
1668
+ createShippingZone,
1669
+ updateShippingZone,
1670
+ deleteShippingZone,
1671
+ getShippingZoneLocations,
1672
+ updateShippingZoneLocations,
1673
+ getShippingZoneMethods,
1674
+ getShippingZoneMethodById,
1675
+ createShippingZoneMethod,
1676
+ updateShippingZoneMethod,
1677
+ deleteShippingZoneMethod,
1678
+ getShippingMethods,
1679
+ getShippingMethodById
1680
+ };
1681
+ }
1682
+
1683
+ // src/integrations/restApi/woocommerce/webhooks/queries.ts
1684
+ function createWebhooksQueries(fetcher) {
1685
+ const { wcFetch, wcFetchGraceful, wcMutate } = fetcher;
1686
+ async function getWebhooks(params) {
1687
+ return wcFetchGraceful(
1688
+ "/wp-json/wc/v3/webhooks",
1689
+ [],
1690
+ params,
1691
+ ["woocommerce", "webhooks"]
1692
+ );
1693
+ }
1694
+ async function getWebhookById(id) {
1695
+ return wcFetch(
1696
+ `/wp-json/wc/v3/webhooks/${id}`,
1697
+ void 0,
1698
+ ["woocommerce", "webhooks", `webhook-${id}`]
1699
+ );
1700
+ }
1701
+ async function createWebhook(input) {
1702
+ return wcMutate("/wp-json/wc/v3/webhooks", input, "POST");
1703
+ }
1704
+ async function updateWebhook(id, input) {
1705
+ return wcMutate(`/wp-json/wc/v3/webhooks/${id}`, input, "PUT");
1706
+ }
1707
+ async function deleteWebhook(id, force = true) {
1708
+ return wcMutate(
1709
+ `/wp-json/wc/v3/webhooks/${id}`,
1710
+ { force },
1711
+ "DELETE"
1712
+ );
1713
+ }
1714
+ return {
1715
+ getWebhooks,
1716
+ getWebhookById,
1717
+ createWebhook,
1718
+ updateWebhook,
1719
+ deleteWebhook
1720
+ };
1721
+ }
1722
+
1723
+ // src/integrations/restApi/woocommerce/settings/queries.ts
1724
+ function createSettingsQueries(fetcher) {
1725
+ const { wcFetch, wcFetchGraceful, wcMutate } = fetcher;
1726
+ async function getSettingGroups() {
1727
+ return wcFetchGraceful(
1728
+ "/wp-json/wc/v3/settings",
1729
+ [],
1730
+ void 0,
1731
+ ["woocommerce", "settings"]
1732
+ );
1733
+ }
1734
+ async function getSettingOptions(groupId) {
1735
+ return wcFetchGraceful(
1736
+ `/wp-json/wc/v3/settings/${groupId}`,
1737
+ [],
1738
+ void 0,
1739
+ ["woocommerce", "settings", `settings-${groupId}`]
1740
+ );
1741
+ }
1742
+ async function getSettingOption(groupId, optionId) {
1743
+ return wcFetch(
1744
+ `/wp-json/wc/v3/settings/${groupId}/${optionId}`,
1745
+ void 0,
1746
+ ["woocommerce", "settings", `settings-${groupId}-${optionId}`]
1747
+ );
1748
+ }
1749
+ async function updateSettingOption(groupId, optionId, value) {
1750
+ return wcMutate(
1751
+ `/wp-json/wc/v3/settings/${groupId}/${optionId}`,
1752
+ { value },
1753
+ "PUT"
1754
+ );
1755
+ }
1756
+ return {
1757
+ getSettingGroups,
1758
+ getSettingOptions,
1759
+ getSettingOption,
1760
+ updateSettingOption
1761
+ };
1762
+ }
1763
+
1764
+ // src/integrations/restApi/woocommerce/reports/queries.ts
1765
+ function createReportsQueries(fetcher) {
1766
+ const { wcFetchGraceful } = fetcher;
1767
+ async function getSalesReport(params) {
1768
+ return wcFetchGraceful(
1769
+ "/wp-json/wc/v3/reports/sales",
1770
+ [],
1771
+ params,
1772
+ ["woocommerce", "reports", "sales"]
1773
+ );
1774
+ }
1775
+ async function getTopSellers(params) {
1776
+ return wcFetchGraceful(
1777
+ "/wp-json/wc/v3/reports/top_sellers",
1778
+ [],
1779
+ params,
1780
+ ["woocommerce", "reports", "top_sellers"]
1781
+ );
1782
+ }
1783
+ async function getOrdersTotals() {
1784
+ return wcFetchGraceful(
1785
+ "/wp-json/wc/v3/reports/orders/totals",
1786
+ [],
1787
+ void 0,
1788
+ ["woocommerce", "reports", "orders_totals"]
1789
+ );
1790
+ }
1791
+ async function getProductsTotals() {
1792
+ return wcFetchGraceful(
1793
+ "/wp-json/wc/v3/reports/products/totals",
1794
+ [],
1795
+ void 0,
1796
+ ["woocommerce", "reports", "products_totals"]
1797
+ );
1798
+ }
1799
+ async function getCustomersTotals() {
1800
+ return wcFetchGraceful(
1801
+ "/wp-json/wc/v3/reports/customers/totals",
1802
+ [],
1803
+ void 0,
1804
+ ["woocommerce", "reports", "customers_totals"]
1805
+ );
1806
+ }
1807
+ async function getCouponsTotals() {
1808
+ return wcFetchGraceful(
1809
+ "/wp-json/wc/v3/reports/coupons/totals",
1810
+ [],
1811
+ void 0,
1812
+ ["woocommerce", "reports", "coupons_totals"]
1813
+ );
1814
+ }
1815
+ async function getReviewsTotals() {
1816
+ return wcFetchGraceful(
1817
+ "/wp-json/wc/v3/reports/reviews/totals",
1818
+ [],
1819
+ void 0,
1820
+ ["woocommerce", "reports", "reviews_totals"]
1821
+ );
1822
+ }
1823
+ return {
1824
+ getSalesReport,
1825
+ getTopSellers,
1826
+ getOrdersTotals,
1827
+ getProductsTotals,
1828
+ getCustomersTotals,
1829
+ getCouponsTotals,
1830
+ getReviewsTotals
1831
+ };
1832
+ }
1833
+
1834
+ // src/integrations/restApi/woocommerce/data/queries.ts
1835
+ function createDataQueries(fetcher) {
1836
+ const { wcFetch, wcFetchGraceful, wcMutate } = fetcher;
1837
+ async function getCurrencies() {
1838
+ return wcFetchGraceful(
1839
+ "/wp-json/wc/v3/data/currencies",
1840
+ [],
1841
+ void 0,
1842
+ ["woocommerce", "data", "currencies"]
1843
+ );
1844
+ }
1845
+ async function getCurrentCurrency() {
1846
+ return wcFetch(
1847
+ "/wp-json/wc/v3/data/currencies/current",
1848
+ void 0,
1849
+ ["woocommerce", "data", "currency_current"]
1850
+ );
1851
+ }
1852
+ async function getCurrencyByCode(code) {
1853
+ return wcFetch(
1854
+ `/wp-json/wc/v3/data/currencies/${code.toUpperCase()}`,
1855
+ void 0,
1856
+ ["woocommerce", "data", `currency-${code}`]
1857
+ );
1858
+ }
1859
+ async function getContinents() {
1860
+ return wcFetchGraceful(
1861
+ "/wp-json/wc/v3/data/continents",
1862
+ [],
1863
+ void 0,
1864
+ ["woocommerce", "data", "continents"]
1865
+ );
1866
+ }
1867
+ async function getContinentByCode(code) {
1868
+ return wcFetch(
1869
+ `/wp-json/wc/v3/data/continents/${code.toUpperCase()}`,
1870
+ void 0,
1871
+ ["woocommerce", "data", `continent-${code}`]
1872
+ );
1873
+ }
1874
+ async function getCountries() {
1875
+ return wcFetchGraceful(
1876
+ "/wp-json/wc/v3/data/countries",
1877
+ [],
1878
+ void 0,
1879
+ ["woocommerce", "data", "countries"]
1880
+ );
1881
+ }
1882
+ async function getCountryByCode(code) {
1883
+ return wcFetch(
1884
+ `/wp-json/wc/v3/data/countries/${code.toUpperCase()}`,
1885
+ void 0,
1886
+ ["woocommerce", "data", `country-${code}`]
1887
+ );
1888
+ }
1889
+ async function getTimeZones() {
1890
+ return wcFetchGraceful(
1891
+ "/wp-json/wc/v3/data/time_zones",
1892
+ {},
1893
+ void 0,
1894
+ ["woocommerce", "data", "time_zones"]
1895
+ );
1896
+ }
1897
+ async function getSystemStatus() {
1898
+ return wcFetch(
1899
+ "/wp-json/wc/v3/system_status",
1900
+ void 0,
1901
+ ["woocommerce", "system_status"]
1902
+ );
1903
+ }
1904
+ async function getSystemStatusTools() {
1905
+ return wcFetchGraceful(
1906
+ "/wp-json/wc/v3/system_status/tools",
1907
+ [],
1908
+ void 0,
1909
+ ["woocommerce", "system_status_tools"]
1910
+ );
1911
+ }
1912
+ async function runSystemStatusTool(toolId) {
1913
+ return wcMutate(
1914
+ `/wp-json/wc/v3/system_status/tools/${toolId}`,
1915
+ {},
1916
+ "PUT"
1917
+ );
1918
+ }
1919
+ return {
1920
+ getCurrencies,
1921
+ getCurrentCurrency,
1922
+ getCurrencyByCode,
1923
+ getContinents,
1924
+ getContinentByCode,
1925
+ getCountries,
1926
+ getCountryByCode,
1927
+ getTimeZones,
1928
+ getSystemStatus,
1929
+ getSystemStatusTools,
1930
+ runSystemStatusTool
1931
+ };
1932
+ }
1933
+
1214
1934
  // src/integrations/restApi/woocommerce/index.ts
1215
1935
  function createWooCommerceClient(config) {
1216
1936
  const fetcher = createWooCommerceFetcher(config);
@@ -1222,9 +1942,21 @@ function createWooCommerceClient(config) {
1222
1942
  ...createTagsQueries2(fetcher),
1223
1943
  ...createTagsMutations2(fetcher),
1224
1944
  ...createOrdersQueries(fetcher),
1945
+ ...createOrderNotesQueries(fetcher),
1946
+ ...createOrderRefundsQueries(fetcher),
1947
+ ...createProductAttributesQueries(fetcher),
1948
+ ...createProductReviewsQueries(fetcher),
1949
+ ...createShippingClassesQueries(fetcher),
1950
+ ...createTaxesQueries(fetcher),
1951
+ ...createShippingQueries(fetcher),
1952
+ ...createWebhooksQueries(fetcher),
1953
+ ...createSettingsQueries(fetcher),
1954
+ ...createReportsQueries(fetcher),
1955
+ ...createDataQueries(fetcher),
1225
1956
  ...createCouponsQueries(fetcher),
1226
1957
  ...createCouponsMutations(fetcher),
1227
- ...createCustomersQueries(fetcher)
1958
+ ...createCustomersQueries(fetcher),
1959
+ ...createPaymentGatewaysQueries(fetcher)
1228
1960
  };
1229
1961
  }
1230
1962