@deliverart/sdk-js-stats 2.14.11 → 2.14.14
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/README.md +75 -2
- package/dist/index.cjs +738 -23
- package/dist/index.d.cts +3345 -224
- package/dist/index.d.ts +3345 -224
- package/dist/index.js +694 -23
- package/package.json +7 -5
package/README.md
CHANGED
|
@@ -14,12 +14,18 @@ yarn add @deliverart/sdk-js-stats @deliverart/sdk-js-core
|
|
|
14
14
|
|
|
15
15
|
## What this package exports
|
|
16
16
|
|
|
17
|
-
The package now exposes
|
|
17
|
+
The package now exposes five daily stats families:
|
|
18
18
|
|
|
19
|
+
- `CustomerDailyStats`
|
|
19
20
|
- `CourierDailyStats`
|
|
20
21
|
- `DeliveryDailyStats`
|
|
22
|
+
- `MenuItemDailyStats`
|
|
21
23
|
- `OrderDailyStats`
|
|
22
24
|
|
|
25
|
+
It also exposes a frontend-ready customer analytics endpoint:
|
|
26
|
+
|
|
27
|
+
- `CustomerStatsOverviewResponse`
|
|
28
|
+
|
|
23
29
|
Each family includes:
|
|
24
30
|
|
|
25
31
|
- a Zod model schema and inferred TypeScript type
|
|
@@ -38,6 +44,14 @@ All daily buckets use the point of sale local day, exposed as `YYYY-MM-DD`.
|
|
|
38
44
|
- `GetCourierDailyStatsFromPointOfSale`
|
|
39
45
|
- `GetCourierDailyStatsFromUser`
|
|
40
46
|
|
|
47
|
+
### Customer daily stats
|
|
48
|
+
|
|
49
|
+
- `GetCustomerDailyStats`
|
|
50
|
+
- `GetCustomerDailyStatsDetails`
|
|
51
|
+
- `GetCustomerDailyStatsFromPointOfSale`
|
|
52
|
+
- `GetCustomerDailyStatsFromCustomer`
|
|
53
|
+
- `GetCustomerStatsOverview`
|
|
54
|
+
|
|
41
55
|
### Delivery daily stats
|
|
42
56
|
|
|
43
57
|
- `GetDeliveryDailyStats`
|
|
@@ -50,11 +64,19 @@ All daily buckets use the point of sale local day, exposed as `YYYY-MM-DD`.
|
|
|
50
64
|
- `GetOrderDailyStatsDetails`
|
|
51
65
|
- `GetOrderDailyStatsFromPointOfSale`
|
|
52
66
|
|
|
67
|
+
### Menu item daily stats
|
|
68
|
+
|
|
69
|
+
- `GetMenuItemDailyStats`
|
|
70
|
+
- `GetMenuItemDailyStatsDetails`
|
|
71
|
+
- `GetMenuItemDailyStatsFromPointOfSale`
|
|
72
|
+
- `GetMenuItemDailyStatsFromMenuItem`
|
|
73
|
+
|
|
53
74
|
## Query support
|
|
54
75
|
|
|
55
76
|
The package exposes typed query schemas for the filters currently supported by the API:
|
|
56
77
|
|
|
57
|
-
- exact filters on dimensions such as `pointOfSale`, `courierUser`, `type`, `source`, `partner`, `paymentMethod`, and `planningMode`
|
|
78
|
+
- exact filters on dimensions such as `pointOfSale`, `courierUser`, `menuItem`, `salesMode`, `type`, `orderType`, `source`, `partner`, `paymentMethod`, and `planningMode`
|
|
79
|
+
- exact filters on dimensions such as `customer`, `pointOfSale`, `courierUser`, `menuItem`, `salesMode`, `type`, `orderType`, `source`, `partner`, `paymentMethod`, and `planningMode`
|
|
58
80
|
- date filters such as `day[before]`, `day[strictly_after]`, `calculatedAt[after]`
|
|
59
81
|
- range filters for numeric KPIs such as `ordersCount[gte]`, `deliveryOrdersCount[lte]`, `totalAmount[gt]`
|
|
60
82
|
- sorting via `order[...]`
|
|
@@ -78,6 +100,22 @@ const response = await sdk.call(
|
|
|
78
100
|
)
|
|
79
101
|
```
|
|
80
102
|
|
|
103
|
+
### List customer daily stats for one customer
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
import { GetCustomerDailyStatsFromCustomer } from '@deliverart/sdk-js-stats'
|
|
107
|
+
|
|
108
|
+
const response = await sdk.call(
|
|
109
|
+
new GetCustomerDailyStatsFromCustomer('customer-123', {
|
|
110
|
+
query: {
|
|
111
|
+
source: 'application',
|
|
112
|
+
'day[after]': '2026-04-01',
|
|
113
|
+
'order[totalAmount]': 'desc',
|
|
114
|
+
},
|
|
115
|
+
}),
|
|
116
|
+
)
|
|
117
|
+
```
|
|
118
|
+
|
|
81
119
|
### List delivery daily stats for one point of sale
|
|
82
120
|
|
|
83
121
|
```typescript
|
|
@@ -111,20 +149,55 @@ const response = await sdk.call(
|
|
|
111
149
|
)
|
|
112
150
|
```
|
|
113
151
|
|
|
152
|
+
### List menu item daily stats for one point of sale
|
|
153
|
+
|
|
154
|
+
```typescript
|
|
155
|
+
import { GetMenuItemDailyStatsFromPointOfSale } from '@deliverart/sdk-js-stats'
|
|
156
|
+
|
|
157
|
+
const response = await sdk.call(
|
|
158
|
+
new GetMenuItemDailyStatsFromPointOfSale('pos-123', {
|
|
159
|
+
query: {
|
|
160
|
+
orderType: 'delivery',
|
|
161
|
+
'quantitySold[gte]': 10,
|
|
162
|
+
'order[totalAmount]': 'desc',
|
|
163
|
+
},
|
|
164
|
+
}),
|
|
165
|
+
)
|
|
166
|
+
```
|
|
167
|
+
|
|
114
168
|
### Fetch one daily stats bucket
|
|
115
169
|
|
|
116
170
|
```typescript
|
|
117
171
|
import {
|
|
172
|
+
GetCustomerDailyStatsDetails,
|
|
118
173
|
GetCourierDailyStatsDetails,
|
|
119
174
|
GetDeliveryDailyStatsDetails,
|
|
175
|
+
GetMenuItemDailyStatsDetails,
|
|
120
176
|
GetOrderDailyStatsDetails,
|
|
121
177
|
} from '@deliverart/sdk-js-stats'
|
|
122
178
|
|
|
179
|
+
await sdk.call(new GetCustomerDailyStatsDetails('customer-stats-uuid'))
|
|
123
180
|
await sdk.call(new GetCourierDailyStatsDetails('courier-stats-uuid'))
|
|
124
181
|
await sdk.call(new GetDeliveryDailyStatsDetails('delivery-stats-uuid'))
|
|
182
|
+
await sdk.call(new GetMenuItemDailyStatsDetails('menu-item-stats-uuid'))
|
|
125
183
|
await sdk.call(new GetOrderDailyStatsDetails('order-stats-uuid'))
|
|
126
184
|
```
|
|
127
185
|
|
|
186
|
+
### Fetch customer stats overview
|
|
187
|
+
|
|
188
|
+
```typescript
|
|
189
|
+
import { GetCustomerStatsOverview } from '@deliverart/sdk-js-stats'
|
|
190
|
+
|
|
191
|
+
const overview = await sdk.call(
|
|
192
|
+
new GetCustomerStatsOverview('customer-123', {
|
|
193
|
+
query: {
|
|
194
|
+
'day[after]': '2026-04-01',
|
|
195
|
+
source: 'application',
|
|
196
|
+
},
|
|
197
|
+
}),
|
|
198
|
+
)
|
|
199
|
+
```
|
|
200
|
+
|
|
128
201
|
## License
|
|
129
202
|
|
|
130
203
|
See the main SDK repository for license information.
|