@tallyui/connector-woocommerce 3.13.0 → 3.15.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 +3 -3
- package/package.json +3 -3
- package/src/customers.ts +6 -2
package/dist/index.js
CHANGED
|
@@ -911,8 +911,8 @@ function createWooCustomers(options) {
|
|
|
911
911
|
return {
|
|
912
912
|
async searchCustomers(context, query, options2) {
|
|
913
913
|
const q = query.trim();
|
|
914
|
-
|
|
915
|
-
const params = new URLSearchParams({ search: q, role: "customer", per_page:
|
|
914
|
+
const perPage = String(Math.max(1, Math.min(50, options2?.limit ?? 20)));
|
|
915
|
+
const params = q ? new URLSearchParams({ search: q, role: "customer", per_page: perPage }) : new URLSearchParams({ role: "customer", per_page: perPage, orderby: "last_name", order: "asc" });
|
|
916
916
|
const { body } = await customerRequest(context, `customers?${params}`, { method: "GET" });
|
|
917
917
|
if (!Array.isArray(body)) throw new CustomerServiceError("server", "unexpected response");
|
|
918
918
|
return body.map(toWooCustomer);
|
|
@@ -1552,7 +1552,7 @@ async function readWooCapabilities(context) {
|
|
|
1552
1552
|
}
|
|
1553
1553
|
|
|
1554
1554
|
// package.json
|
|
1555
|
-
var version = "3.
|
|
1555
|
+
var version = "3.15.0";
|
|
1556
1556
|
|
|
1557
1557
|
// src/index.ts
|
|
1558
1558
|
import { ConnectorUnauthorizedError as ConnectorUnauthorizedError4 } from "@tallyui/core";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tallyui/connector-woocommerce",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.15.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.
|
|
30
|
+
"@tallyui/core": "^3.15.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@tallyui/database": "3.
|
|
33
|
+
"@tallyui/database": "3.15.0",
|
|
34
34
|
"rxdb": "17.5.0"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
package/src/customers.ts
CHANGED
|
@@ -92,8 +92,12 @@ export function createWooCustomers(options?: { newId?: () => string }) {
|
|
|
92
92
|
return {
|
|
93
93
|
async searchCustomers(context: SyncContext, query: string, options?: { limit?: number }): Promise<Customer[]> {
|
|
94
94
|
const q = query.trim();
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
const perPage = String(Math.max(1, Math.min(50, options?.limit ?? 20)));
|
|
96
|
+
// An empty query lists the first page in WCPOS v2's customer-picker order, last name ascending; the wcpos/v2
|
|
97
|
+
// customers proxy applies `orderby=last_name` (woocommerce-pos Collection_Rules customer sorts).
|
|
98
|
+
const params = q
|
|
99
|
+
? new URLSearchParams({ search: q, role: 'customer', per_page: perPage })
|
|
100
|
+
: new URLSearchParams({ role: 'customer', per_page: perPage, orderby: 'last_name', order: 'asc' });
|
|
97
101
|
const { body } = await customerRequest(context, `customers?${params}`, { method: 'GET' });
|
|
98
102
|
if (!Array.isArray(body)) throw new CustomerServiceError('server', 'unexpected response');
|
|
99
103
|
return body.map(toWooCustomer);
|