@tallyui/connector-woocommerce 3.19.0 → 3.20.0

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.js CHANGED
@@ -1437,7 +1437,8 @@ function createWooOrders() {
1437
1437
  const orders = body.map(toWooStoreOrder);
1438
1438
  const totalPages = headers.get("X-WP-TotalPages");
1439
1439
  const hasMore = totalPages !== null && /^\d+$/.test(totalPages.trim()) ? page < Number.parseInt(totalPages, 10) : orders.length === perPage;
1440
- return { orders, hasMore };
1440
+ const total = headers.get("X-WP-Total");
1441
+ return { orders, hasMore, ...total && /^\d+$/.test(total) ? { total: Number(total) } : {} };
1441
1442
  },
1442
1443
  async getOrders(context, ids) {
1443
1444
  const wanted = [...new Set(ids.filter((id) => /^[1-9]\d*$/.test(id)))];
@@ -1503,6 +1504,7 @@ async function wooStoreSettings(context) {
1503
1504
  calcDiscountsSequentially: (store.woocommerce_calc_discounts_sequentially ?? store.calc_discounts_sequentially) === "yes",
1504
1505
  ...typeof store.shipping_tax_class === "string" ? { shippingTaxClass: store.shipping_tax_class } : {},
1505
1506
  taxClassSlugs: classes.map((row) => row.slug),
1507
+ taxClasses: classes.map((row) => ({ slug: row.slug, name: typeof row.name === "string" && row.name !== "" ? row.name : row.slug })),
1506
1508
  taxRates,
1507
1509
  taxRatesPpm
1508
1510
  };
@@ -1786,7 +1788,7 @@ async function wooReceiptTemplates(context, kind = "receipt") {
1786
1788
  }
1787
1789
 
1788
1790
  // package.json
1789
- var version = "3.19.0";
1791
+ var version = "3.20.0";
1790
1792
 
1791
1793
  // src/index.ts
1792
1794
  import { ConnectorUnauthorizedError as ConnectorUnauthorizedError5 } from "@tallyui/core";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tallyui/connector-woocommerce",
3
- "version": "3.19.0",
3
+ "version": "3.20.0",
4
4
  "type": "module",
5
5
  "description": "WooCommerce connector for Tally UI",
6
6
  "main": "./dist/index.js",
@@ -27,10 +27,10 @@
27
27
  "directory": "connectors/woocommerce"
28
28
  },
29
29
  "peerDependencies": {
30
- "@tallyui/core": "^3.19.0"
30
+ "@tallyui/core": "^3.20.0"
31
31
  },
32
32
  "devDependencies": {
33
- "@tallyui/database": "3.19.0",
33
+ "@tallyui/database": "3.20.0",
34
34
  "rxdb": "17.5.0"
35
35
  },
36
36
  "scripts": {
package/src/orders.ts CHANGED
@@ -180,7 +180,9 @@ export function createWooOrders(): Required<Pick<TallyConnector, 'listOrders' |
180
180
  const hasMore = totalPages !== null && /^\d+$/.test(totalPages.trim())
181
181
  ? page < Number.parseInt(totalPages, 10)
182
182
  : orders.length === perPage;
183
- return { orders, hasMore };
183
+ // X-WP-Total counts every order the query matches.
184
+ const total = headers.get('X-WP-Total');
185
+ return { orders, hasMore, ...(total && /^\d+$/.test(total) ? { total: Number(total) } : {}) };
184
186
  },
185
187
 
186
188
  async getOrders(context: SyncContext, ids: readonly string[]) {
@@ -60,6 +60,7 @@ export async function wooStoreSettings(context: SyncContext): Promise<StoreSetti
60
60
  calcDiscountsSequentially: (store.woocommerce_calc_discounts_sequentially ?? store.calc_discounts_sequentially) === 'yes',
61
61
  ...(typeof store.shipping_tax_class === 'string' ? { shippingTaxClass: store.shipping_tax_class } : {}),
62
62
  taxClassSlugs: classes.map((row) => row.slug),
63
+ taxClasses: classes.map((row) => ({ slug: row.slug, name: typeof row.name === 'string' && row.name !== '' ? row.name : row.slug })),
63
64
  taxRates,
64
65
  taxRatesPpm,
65
66
  };