@nuwah/vertical-sdk 0.0.0-stage → 0.2.0-rc.1
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/LICENSE +17 -0
- package/README.md +229 -2
- package/bin/nuwah-contract-check-rules.d.mts +41 -0
- package/bin/nuwah-contract-check-rules.mjs +333 -0
- package/bin/nuwah-contract-check.mjs +64 -0
- package/dist/accounting.d.ts +1417 -0
- package/dist/accounting.js +274 -0
- package/dist/active-org.d.ts +13 -0
- package/dist/active-org.js +59 -0
- package/dist/actors.d.ts +448 -0
- package/dist/actors.js +143 -0
- package/dist/ai.d.ts +359 -0
- package/dist/ai.js +229 -0
- package/dist/analytics.d.ts +37 -0
- package/dist/analytics.js +8 -0
- package/dist/atlas.d.ts +291 -0
- package/dist/atlas.js +78 -0
- package/dist/audit.d.ts +193 -0
- package/dist/audit.js +26 -0
- package/dist/authentication.d.ts +119 -0
- package/dist/authentication.js +83 -0
- package/dist/awards.d.ts +38 -0
- package/dist/awards.js +10 -0
- package/dist/blueprint/document.d.ts +178 -0
- package/dist/blueprint/document.js +17 -0
- package/dist/blueprint/index.d.ts +3 -0
- package/dist/blueprint/index.js +5 -0
- package/dist/blueprint/manifest.d.ts +105 -0
- package/dist/blueprint/manifest.js +11 -0
- package/dist/blueprint/validate.d.ts +14 -0
- package/dist/blueprint/validate.js +416 -0
- package/dist/bookings-directory.d.ts +118 -0
- package/dist/bookings-directory.js +289 -0
- package/dist/bookings-extra.d.ts +1448 -0
- package/dist/bookings-extra.js +582 -0
- package/dist/bookings.d.ts +1365 -0
- package/dist/bookings.js +305 -0
- package/dist/builder-code.d.ts +164 -0
- package/dist/builder-code.js +12 -0
- package/dist/builder-core-gaps.d.ts +83 -0
- package/dist/builder-core-gaps.js +8 -0
- package/dist/builder-repos.d.ts +73 -0
- package/dist/builder-repos.js +37 -0
- package/dist/builder.d.ts +730 -0
- package/dist/builder.js +105 -0
- package/dist/campaigns.d.ts +105 -0
- package/dist/campaigns.js +25 -0
- package/dist/catalogs.d.ts +188 -0
- package/dist/catalogs.js +36 -0
- package/dist/commerce-ai.d.ts +182 -0
- package/dist/commerce-ai.js +27 -0
- package/dist/connections.d.ts +278 -0
- package/dist/connections.js +96 -0
- package/dist/content-control.d.ts +121 -0
- package/dist/content-control.js +23 -0
- package/dist/contributions.d.ts +560 -0
- package/dist/contributions.js +140 -0
- package/dist/conversation-assist.d.ts +154 -0
- package/dist/conversation-assist.js +51 -0
- package/dist/conversation-info.d.ts +219 -0
- package/dist/conversation-info.js +43 -0
- package/dist/crm.d.ts +533 -0
- package/dist/crm.js +142 -0
- package/dist/dashboards.d.ts +119 -0
- package/dist/dashboards.js +22 -0
- package/dist/delegations.d.ts +161 -0
- package/dist/delegations.js +39 -0
- package/dist/docs.d.ts +289 -0
- package/dist/docs.js +49 -0
- package/dist/documents.d.ts +317 -0
- package/dist/documents.js +84 -0
- package/dist/drafts.d.ts +132 -0
- package/dist/drafts.js +56 -0
- package/dist/engagements.d.ts +133 -0
- package/dist/engagements.js +15 -0
- package/dist/event-stream.d.ts +54 -0
- package/dist/event-stream.js +228 -0
- package/dist/exchanges.d.ts +447 -0
- package/dist/exchanges.js +145 -0
- package/dist/exports.d.ts +113 -0
- package/dist/exports.js +81 -0
- package/dist/feeds.d.ts +228 -0
- package/dist/feeds.js +52 -0
- package/dist/files.d.ts +56 -0
- package/dist/files.js +55 -0
- package/dist/finance-insights.d.ts +41 -0
- package/dist/finance-insights.js +61 -0
- package/dist/fixed-assets.d.ts +155 -0
- package/dist/fixed-assets.js +28 -0
- package/dist/fulfilment-jobs.d.ts +405 -0
- package/dist/fulfilment-jobs.js +76 -0
- package/dist/fulfilment.d.ts +205 -0
- package/dist/fulfilment.js +39 -0
- package/dist/hr.d.ts +350 -0
- package/dist/hr.js +94 -0
- package/dist/http.d.ts +124 -0
- package/dist/http.js +392 -0
- package/dist/inbox.d.ts +206 -0
- package/dist/inbox.js +36 -0
- package/dist/index.d.ts +384 -0
- package/dist/index.js +294 -0
- package/dist/insights.d.ts +176 -0
- package/dist/insights.js +52 -0
- package/dist/inventory.d.ts +797 -0
- package/dist/inventory.js +120 -0
- package/dist/list-query.d.ts +211 -0
- package/dist/list-query.js +158 -0
- package/dist/listings.d.ts +381 -0
- package/dist/listings.js +173 -0
- package/dist/location-sharing.d.ts +83 -0
- package/dist/location-sharing.js +20 -0
- package/dist/marketplace.d.ts +268 -0
- package/dist/marketplace.js +59 -0
- package/dist/matching.d.ts +103 -0
- package/dist/matching.js +22 -0
- package/dist/media.d.ts +221 -0
- package/dist/media.js +239 -0
- package/dist/metrics.d.ts +125 -0
- package/dist/metrics.js +45 -0
- package/dist/moderation.d.ts +240 -0
- package/dist/moderation.js +40 -0
- package/dist/money.d.ts +41 -0
- package/dist/money.js +79 -0
- package/dist/my-data.d.ts +266 -0
- package/dist/my-data.js +32 -0
- package/dist/names.d.ts +14 -0
- package/dist/names.js +17 -0
- package/dist/occasions.d.ts +256 -0
- package/dist/occasions.js +40 -0
- package/dist/onboarding.d.ts +88 -0
- package/dist/onboarding.js +38 -0
- package/dist/pagination.d.ts +204 -0
- package/dist/pagination.js +141 -0
- package/dist/party-baseline-attributes.d.ts +245 -0
- package/dist/party-baseline-attributes.js +36 -0
- package/dist/party.d.ts +401 -0
- package/dist/party.js +56 -0
- package/dist/patient.d.ts +161 -0
- package/dist/patient.js +45 -0
- package/dist/payroll.d.ts +378 -0
- package/dist/payroll.js +60 -0
- package/dist/person-addresses.d.ts +88 -0
- package/dist/person-addresses.js +18 -0
- package/dist/person-cart.d.ts +250 -0
- package/dist/person-cart.js +63 -0
- package/dist/person-chat-assist.d.ts +47 -0
- package/dist/person-chat-assist.js +13 -0
- package/dist/person-data-webhooks.d.ts +72 -0
- package/dist/person-data-webhooks.js +86 -0
- package/dist/person-data.d.ts +212 -0
- package/dist/person-data.js +162 -0
- package/dist/person-locations.d.ts +54 -0
- package/dist/person-locations.js +6 -0
- package/dist/person-messaging.d.ts +405 -0
- package/dist/person-messaging.js +112 -0
- package/dist/person-notifications.d.ts +319 -0
- package/dist/person-notifications.js +164 -0
- package/dist/personalisation.d.ts +21 -0
- package/dist/personalisation.js +8 -0
- package/dist/platform.d.ts +63 -0
- package/dist/platform.js +45 -0
- package/dist/portfolio.d.ts +163 -0
- package/dist/portfolio.js +28 -0
- package/dist/pos.d.ts +743 -0
- package/dist/pos.js +129 -0
- package/dist/procurement.d.ts +664 -0
- package/dist/procurement.js +157 -0
- package/dist/promotions.d.ts +169 -0
- package/dist/promotions.js +39 -0
- package/dist/publications.d.ts +583 -0
- package/dist/publications.js +164 -0
- package/dist/ranking.d.ts +43 -0
- package/dist/ranking.js +34 -0
- package/dist/ratings.d.ts +293 -0
- package/dist/ratings.js +109 -0
- package/dist/reactions.d.ts +123 -0
- package/dist/reactions.js +41 -0
- package/dist/recipient-orders.d.ts +294 -0
- package/dist/recipient-orders.js +73 -0
- package/dist/relationships.d.ts +18 -0
- package/dist/relationships.js +8 -0
- package/dist/reporting.d.ts +107 -0
- package/dist/reporting.js +56 -0
- package/dist/sales.d.ts +270 -0
- package/dist/sales.js +66 -0
- package/dist/shares.d.ts +105 -0
- package/dist/shares.js +27 -0
- package/dist/shop.d.ts +993 -0
- package/dist/shop.js +215 -0
- package/dist/shopping-assistant.d.ts +65 -0
- package/dist/shopping-assistant.js +14 -0
- package/dist/spaces.d.ts +422 -0
- package/dist/spaces.js +118 -0
- package/dist/stored-value.d.ts +754 -0
- package/dist/stored-value.js +177 -0
- package/dist/types.d.ts +83 -0
- package/dist/types.js +2 -0
- package/dist/vault.d.ts +290 -0
- package/dist/vault.js +55 -0
- package/dist/vertical-runtime.d.ts +17 -0
- package/dist/vertical-runtime.js +8 -0
- package/dist/vite/build-manifest-plugin.d.ts +42 -0
- package/dist/vite/build-manifest-plugin.js +42 -0
- package/dist/vite/first-paint-plugin.d.ts +26 -0
- package/dist/vite/first-paint-plugin.js +57 -0
- package/dist/wishlists.d.ts +591 -0
- package/dist/wishlists.js +188 -0
- package/dist/workbench.d.ts +114 -0
- package/dist/workbench.js +22 -0
- package/dist/workspace.d.ts +190 -0
- package/dist/workspace.js +41 -0
- package/package.json +52 -4
- package/templates/extension-image.Dockerfile +38 -0
- package/templates/nuwah-vertical.yml +102 -0
- package/templates/vertical-app/.env.example +34 -0
- package/templates/vertical-app/README.md +108 -0
- package/templates/vertical-app/github/workflows/ci.yml +51 -0
- package/templates/vertical-app/gitignore +5 -0
- package/templates/vertical-app/index.html +12 -0
- package/templates/vertical-app/package.json +28 -0
- package/templates/vertical-app/src/App.tsx +64 -0
- package/templates/vertical-app/src/blueprint/blueprint.ts +45 -0
- package/templates/vertical-app/src/blueprint/screens.ts +15 -0
- package/templates/vertical-app/src/env.d.ts +18 -0
- package/templates/vertical-app/src/index.css +139 -0
- package/templates/vertical-app/src/lib/i18n.ts +5 -0
- package/templates/vertical-app/src/lib/iam.ts +19 -0
- package/templates/vertical-app/src/lib/operations.ts +93 -0
- package/templates/vertical-app/src/lib/router.ts +24 -0
- package/templates/vertical-app/src/lib/sdk.ts +21 -0
- package/templates/vertical-app/src/lib/theme.ts +18 -0
- package/templates/vertical-app/src/lib/words.ts +39 -0
- package/templates/vertical-app/src/main.tsx +25 -0
- package/templates/vertical-app/src/pages/AppScreens.tsx +71 -0
- package/templates/vertical-app/src/pages/AuthCallback.tsx +44 -0
- package/templates/vertical-app/src/pages/Home.tsx +36 -0
- package/templates/vertical-app/tsconfig.json +24 -0
- package/templates/vertical-app/vite.config.ts +23 -0
- package/templates/vertical-ci.yml +192 -0
package/dist/pos.d.ts
ADDED
|
@@ -0,0 +1,743 @@
|
|
|
1
|
+
import type { Http } from './http.js';
|
|
2
|
+
import type { ListQuery, Paginated, Translatable } from './types.js';
|
|
3
|
+
export type SaleStatus = 'cart' | 'completed' | 'voided' | string;
|
|
4
|
+
export type PosTenderMethod = 'cash' | 'card' | 'cliq';
|
|
5
|
+
export interface SaleLine {
|
|
6
|
+
id: string;
|
|
7
|
+
/** `{en, ar}` when the catalog item is loaded, else the line description string. */
|
|
8
|
+
catalog_item_name: Translatable | string;
|
|
9
|
+
sku: string | null;
|
|
10
|
+
quantity: string;
|
|
11
|
+
unit_price: string;
|
|
12
|
+
tax_amount: string;
|
|
13
|
+
line_total: string;
|
|
14
|
+
currency_code: string;
|
|
15
|
+
}
|
|
16
|
+
export interface SalePayment {
|
|
17
|
+
id: string;
|
|
18
|
+
method: PosTenderMethod | string;
|
|
19
|
+
amount: string;
|
|
20
|
+
tendered_amount: string | null;
|
|
21
|
+
change_amount: string | null;
|
|
22
|
+
reference: string | null;
|
|
23
|
+
currency_code: string;
|
|
24
|
+
}
|
|
25
|
+
/** `SaleResource` — from `sales.list` (rows), `sales.get`, `sales.create`. */
|
|
26
|
+
export interface Sale {
|
|
27
|
+
id: string;
|
|
28
|
+
sale_number: string;
|
|
29
|
+
register_id: string | null;
|
|
30
|
+
register_name: string | null;
|
|
31
|
+
shift_id: string | null;
|
|
32
|
+
customer_id: string | null;
|
|
33
|
+
customer_name: string | null;
|
|
34
|
+
subtotal: string;
|
|
35
|
+
discount_total: string;
|
|
36
|
+
tax_total: string;
|
|
37
|
+
grand_total: string;
|
|
38
|
+
paid_total: string;
|
|
39
|
+
change_total: string;
|
|
40
|
+
currency_code: string;
|
|
41
|
+
payment_method: string | null;
|
|
42
|
+
status: SaleStatus;
|
|
43
|
+
created_at: string | null;
|
|
44
|
+
completed_at: string | null;
|
|
45
|
+
/** Present on `get` (whenLoaded). */
|
|
46
|
+
lines?: SaleLine[];
|
|
47
|
+
/** Present on `list` + `get` (whenLoaded). */
|
|
48
|
+
payments?: SalePayment[];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* RAW `PosSale` model returned by mutating actions (addLine/tender/discount/
|
|
52
|
+
* complete/void) — literal DB columns, NOT `SaleResource`.
|
|
53
|
+
*/
|
|
54
|
+
export interface PosSaleRaw {
|
|
55
|
+
id: string;
|
|
56
|
+
sale_number: string;
|
|
57
|
+
status: SaleStatus;
|
|
58
|
+
currency_code: string;
|
|
59
|
+
subtotal: string;
|
|
60
|
+
discount_total: string;
|
|
61
|
+
tax_total: string;
|
|
62
|
+
grand_total: string;
|
|
63
|
+
paid_total: string;
|
|
64
|
+
change_total: string;
|
|
65
|
+
completed_at: string | null;
|
|
66
|
+
created_at: string | null;
|
|
67
|
+
updated_at: string | null;
|
|
68
|
+
lines?: Array<Record<string, unknown>>;
|
|
69
|
+
payments?: Array<Record<string, unknown>>;
|
|
70
|
+
discounts?: Array<Record<string, unknown>>;
|
|
71
|
+
}
|
|
72
|
+
/** RAW `PosRefund` model from `sales.refund`. */
|
|
73
|
+
export interface PosRefundRaw {
|
|
74
|
+
id: string;
|
|
75
|
+
refund_number: string;
|
|
76
|
+
original_sale_id: string;
|
|
77
|
+
status: string;
|
|
78
|
+
reason: string | null;
|
|
79
|
+
refund_subtotal: string;
|
|
80
|
+
refund_tax_total: string;
|
|
81
|
+
refund_total: string;
|
|
82
|
+
tender_method: string;
|
|
83
|
+
currency_code: string;
|
|
84
|
+
processed_at: string | null;
|
|
85
|
+
created_at: string | null;
|
|
86
|
+
updated_at: string | null;
|
|
87
|
+
lines?: Array<Record<string, unknown>>;
|
|
88
|
+
}
|
|
89
|
+
/** Bespoke `sales.receipt` payload (keys differ from the Resource). */
|
|
90
|
+
export interface SaleReceipt {
|
|
91
|
+
sale_number: string;
|
|
92
|
+
completed_at: string | null;
|
|
93
|
+
currency: string;
|
|
94
|
+
subtotal: string;
|
|
95
|
+
discount: string;
|
|
96
|
+
tax: string;
|
|
97
|
+
total: string;
|
|
98
|
+
paid: string;
|
|
99
|
+
change: string;
|
|
100
|
+
lines: Array<{
|
|
101
|
+
description: string;
|
|
102
|
+
quantity: string;
|
|
103
|
+
unit_price: string;
|
|
104
|
+
line_total: string;
|
|
105
|
+
}>;
|
|
106
|
+
payments: Array<{
|
|
107
|
+
method: string;
|
|
108
|
+
amount: string;
|
|
109
|
+
}>;
|
|
110
|
+
}
|
|
111
|
+
export interface SaleListQuery extends ListQuery {
|
|
112
|
+
status?: SaleStatus;
|
|
113
|
+
register_id?: string;
|
|
114
|
+
shift_id?: string;
|
|
115
|
+
date_from?: string;
|
|
116
|
+
date_to?: string;
|
|
117
|
+
}
|
|
118
|
+
export interface CreateSaleInput {
|
|
119
|
+
client_uuid?: string;
|
|
120
|
+
store_id?: string;
|
|
121
|
+
register_id?: string;
|
|
122
|
+
shift_id?: string;
|
|
123
|
+
customer_id?: string;
|
|
124
|
+
currency_code?: string;
|
|
125
|
+
}
|
|
126
|
+
export interface AddSaleLineInput {
|
|
127
|
+
catalog_item_id?: string;
|
|
128
|
+
description?: string;
|
|
129
|
+
quantity: number | string;
|
|
130
|
+
unit_price?: number | string;
|
|
131
|
+
warehouse_id?: string;
|
|
132
|
+
}
|
|
133
|
+
export interface ApplyDiscountInput {
|
|
134
|
+
sale_line_id?: string;
|
|
135
|
+
discount_type: 'percent' | 'amount';
|
|
136
|
+
discount_value: number | string;
|
|
137
|
+
reason_code: string;
|
|
138
|
+
}
|
|
139
|
+
export interface AddTenderInput {
|
|
140
|
+
method: PosTenderMethod;
|
|
141
|
+
amount: number | string;
|
|
142
|
+
tendered_amount?: number | string;
|
|
143
|
+
reference?: string;
|
|
144
|
+
}
|
|
145
|
+
export interface RefundSaleInput {
|
|
146
|
+
reason: string;
|
|
147
|
+
tender_method: PosTenderMethod;
|
|
148
|
+
client_uuid?: string;
|
|
149
|
+
lines: Array<{
|
|
150
|
+
sale_line_id: string;
|
|
151
|
+
quantity: number | string;
|
|
152
|
+
}>;
|
|
153
|
+
}
|
|
154
|
+
export type ShiftStatus = 'open' | 'closed' | string;
|
|
155
|
+
export interface ShiftCashMovement {
|
|
156
|
+
id: string;
|
|
157
|
+
/** `pay_in` | `pay_out` (from movement_type). */
|
|
158
|
+
type: string;
|
|
159
|
+
amount: string;
|
|
160
|
+
currency_code: string | null;
|
|
161
|
+
note: string | null;
|
|
162
|
+
created_by_name: string | null;
|
|
163
|
+
created_at: string | null;
|
|
164
|
+
}
|
|
165
|
+
/** `ShiftResource` — from `shifts.list` (rows) and `shifts.get`. */
|
|
166
|
+
export interface Shift {
|
|
167
|
+
id: string;
|
|
168
|
+
register_id: string;
|
|
169
|
+
status: ShiftStatus;
|
|
170
|
+
register_name: string | null;
|
|
171
|
+
store_name: string | null;
|
|
172
|
+
currency_code: string | null;
|
|
173
|
+
opened_at: string | null;
|
|
174
|
+
opened_by_name: string | null;
|
|
175
|
+
closed_at: string | null;
|
|
176
|
+
opening_float: string | null;
|
|
177
|
+
closing_float: string | null;
|
|
178
|
+
cash_sales_total: string;
|
|
179
|
+
/** Present on `get` (whenLoaded). */
|
|
180
|
+
cash_movements?: ShiftCashMovement[];
|
|
181
|
+
}
|
|
182
|
+
/** RAW `PosShift` model returned by `open`/`close` — literal DB columns. */
|
|
183
|
+
export interface PosShiftRaw {
|
|
184
|
+
id: string;
|
|
185
|
+
register_id: string;
|
|
186
|
+
status: ShiftStatus;
|
|
187
|
+
opened_at: string | null;
|
|
188
|
+
opening_float: string | null;
|
|
189
|
+
closed_at: string | null;
|
|
190
|
+
expected_cash_amount: string | null;
|
|
191
|
+
counted_cash_amount: string | null;
|
|
192
|
+
cash_variance_amount: string | null;
|
|
193
|
+
created_at: string | null;
|
|
194
|
+
updated_at: string | null;
|
|
195
|
+
}
|
|
196
|
+
/** RAW `PosCashMovement` model returned by `cashMovement`. */
|
|
197
|
+
export interface PosCashMovementRaw {
|
|
198
|
+
id: string;
|
|
199
|
+
shift_id: string;
|
|
200
|
+
movement_type: string;
|
|
201
|
+
amount: string;
|
|
202
|
+
reason: string | null;
|
|
203
|
+
occurred_at: string | null;
|
|
204
|
+
created_at: string | null;
|
|
205
|
+
updated_at: string | null;
|
|
206
|
+
}
|
|
207
|
+
/** Bespoke `shifts.xReport` payload. */
|
|
208
|
+
export interface XReport {
|
|
209
|
+
total_sales: number;
|
|
210
|
+
cash_sales: string;
|
|
211
|
+
card_sales: string;
|
|
212
|
+
other_sales: string;
|
|
213
|
+
expected_cash: string;
|
|
214
|
+
sales_total: string;
|
|
215
|
+
}
|
|
216
|
+
export interface OpenShiftInput {
|
|
217
|
+
opening_float?: number | string;
|
|
218
|
+
}
|
|
219
|
+
export interface CloseShiftInput {
|
|
220
|
+
counted_cash_amount: number | string;
|
|
221
|
+
denominations?: Record<string, unknown> | Array<unknown>;
|
|
222
|
+
}
|
|
223
|
+
export interface CashMovementInput {
|
|
224
|
+
movement_type: 'pay_in' | 'pay_out';
|
|
225
|
+
amount: number | string;
|
|
226
|
+
reason?: string;
|
|
227
|
+
}
|
|
228
|
+
export interface CatalogBarcode {
|
|
229
|
+
id: string;
|
|
230
|
+
barcode: string;
|
|
231
|
+
type: string;
|
|
232
|
+
is_primary: boolean;
|
|
233
|
+
}
|
|
234
|
+
/** `CatalogItemResource` — from `catalog.list` (rows) and `catalog.get`. */
|
|
235
|
+
export interface CatalogItem {
|
|
236
|
+
id: string;
|
|
237
|
+
sku: string;
|
|
238
|
+
/** Bilingual object (`Loc::obj`). */
|
|
239
|
+
name: Translatable;
|
|
240
|
+
name_en: string;
|
|
241
|
+
name_ar: string | null;
|
|
242
|
+
unit_of_measure: string;
|
|
243
|
+
is_saleable: boolean;
|
|
244
|
+
synced_at: string | null;
|
|
245
|
+
tax_profile_name?: string | null;
|
|
246
|
+
/** Present on `get` (whenLoaded). */
|
|
247
|
+
barcodes?: CatalogBarcode[];
|
|
248
|
+
}
|
|
249
|
+
/** Bespoke `catalog.lookupBarcode` payload. */
|
|
250
|
+
export interface BarcodeLookupResult {
|
|
251
|
+
id: string;
|
|
252
|
+
inventory_item_id: string | null;
|
|
253
|
+
sku: string;
|
|
254
|
+
name_en: string;
|
|
255
|
+
name_ar: string | null;
|
|
256
|
+
unit_of_measure: string;
|
|
257
|
+
is_saleable: boolean;
|
|
258
|
+
default_tax_profile: {
|
|
259
|
+
id: string;
|
|
260
|
+
name_en: string;
|
|
261
|
+
rate: string;
|
|
262
|
+
is_vat: boolean;
|
|
263
|
+
} | null;
|
|
264
|
+
}
|
|
265
|
+
export interface Register {
|
|
266
|
+
id: string;
|
|
267
|
+
/** Localized string (`Loc::str`). */
|
|
268
|
+
name: string;
|
|
269
|
+
name_en: string | null;
|
|
270
|
+
name_ar: string | null;
|
|
271
|
+
code: string;
|
|
272
|
+
store_id: string;
|
|
273
|
+
status: string;
|
|
274
|
+
store_name?: string;
|
|
275
|
+
current_shift_id?: string | null;
|
|
276
|
+
}
|
|
277
|
+
export interface Store {
|
|
278
|
+
id: string;
|
|
279
|
+
/** Bilingual object (`Loc::obj`). */
|
|
280
|
+
name: Translatable;
|
|
281
|
+
name_en: string;
|
|
282
|
+
name_ar: string | null;
|
|
283
|
+
code: string;
|
|
284
|
+
currency_code: string | null;
|
|
285
|
+
status: string;
|
|
286
|
+
registers_count?: number;
|
|
287
|
+
registers?: Register[];
|
|
288
|
+
}
|
|
289
|
+
export interface CreateStoreInput {
|
|
290
|
+
name?: Translatable;
|
|
291
|
+
name_en?: string;
|
|
292
|
+
name_ar?: string | null;
|
|
293
|
+
code: string;
|
|
294
|
+
currency_code?: string;
|
|
295
|
+
}
|
|
296
|
+
export interface UpdateStoreInput {
|
|
297
|
+
name_en?: string;
|
|
298
|
+
name_ar?: string | null;
|
|
299
|
+
is_active?: boolean;
|
|
300
|
+
}
|
|
301
|
+
export interface CreateRegisterInput {
|
|
302
|
+
name?: Translatable;
|
|
303
|
+
name_en?: string;
|
|
304
|
+
name_ar?: string | null;
|
|
305
|
+
code: string;
|
|
306
|
+
}
|
|
307
|
+
export interface UpdateRegisterInput {
|
|
308
|
+
name_en?: string;
|
|
309
|
+
name_ar?: string | null;
|
|
310
|
+
is_active?: boolean;
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* RAW `PosTaxProfile` model. The tax-profile endpoints ship NO Resource, so every
|
|
314
|
+
* verb returns literal DB columns — and `list` is a BARE ARRAY at the top level
|
|
315
|
+
* (no `{data}` envelope, no pagination).
|
|
316
|
+
*/
|
|
317
|
+
export interface PosTaxProfileRaw {
|
|
318
|
+
id: string;
|
|
319
|
+
name_en: string;
|
|
320
|
+
name_ar: string | null;
|
|
321
|
+
/** A FRACTION, not a percent: `"0.1500"` is 15%. `decimal:4` cast → string. */
|
|
322
|
+
rate: string;
|
|
323
|
+
is_vat: boolean;
|
|
324
|
+
taxable_account_code: string | null;
|
|
325
|
+
nonvat_account_code: string | null;
|
|
326
|
+
is_active: boolean;
|
|
327
|
+
created_at: string | null;
|
|
328
|
+
updated_at: string | null;
|
|
329
|
+
}
|
|
330
|
+
export interface CreateTaxProfileInput {
|
|
331
|
+
name_en: string;
|
|
332
|
+
name_ar?: string | null;
|
|
333
|
+
/** Fraction in [0,1] — the server validates `numeric|min:0|max:1`. */
|
|
334
|
+
rate: number | string;
|
|
335
|
+
is_vat?: boolean;
|
|
336
|
+
taxable_account_code?: string | null;
|
|
337
|
+
nonvat_account_code?: string | null;
|
|
338
|
+
}
|
|
339
|
+
export type UpdateTaxProfileInput = Partial<CreateTaxProfileInput> & {
|
|
340
|
+
is_active?: boolean;
|
|
341
|
+
};
|
|
342
|
+
/** Which customers/sites a price list applies to. */
|
|
343
|
+
export type PriceListScope = 'base' | 'store' | 'channel' | 'customer_group';
|
|
344
|
+
/**
|
|
345
|
+
* The reserved customer-group `scope_id` a MEMBER price list must carry, mirroring
|
|
346
|
+
* `ResolveMemberPriceAction::MEMBERS_GROUP_ID` in core. The constant is the only
|
|
347
|
+
* published way to wire member pricing — no endpoint returns it — so a client that
|
|
348
|
+
* wants to create a member price list has to send this exact uuid.
|
|
349
|
+
*/
|
|
350
|
+
export declare const POS_MEMBERS_PRICE_GROUP_ID = "00000000-0000-7000-8000-00000000c1b0";
|
|
351
|
+
/** A row of `PriceListResource.items` (present on `priceLists.get` only). */
|
|
352
|
+
export interface PriceListItem {
|
|
353
|
+
id: string;
|
|
354
|
+
catalog_item_id: string;
|
|
355
|
+
/** `{en, ar}` when the catalog item is eager-loaded, else null. */
|
|
356
|
+
catalog_item_name: Translatable | null;
|
|
357
|
+
sku: string | null;
|
|
358
|
+
unit_price: string;
|
|
359
|
+
/** The per-item tax override's localized NAME — not its id. */
|
|
360
|
+
tax_profile_override_name: string | null;
|
|
361
|
+
/** The parent LIST's currency, copied onto every row by the Resource. */
|
|
362
|
+
currency_code: string;
|
|
363
|
+
}
|
|
364
|
+
export interface PriceList {
|
|
365
|
+
id: string;
|
|
366
|
+
/** Bilingual object (`Loc::obj`). */
|
|
367
|
+
name: Translatable;
|
|
368
|
+
name_en: string;
|
|
369
|
+
name_ar: string | null;
|
|
370
|
+
scope_type: PriceListScope;
|
|
371
|
+
priority: number;
|
|
372
|
+
currency_code: string;
|
|
373
|
+
prices_are_tax_inclusive: boolean;
|
|
374
|
+
active_from: string | null;
|
|
375
|
+
active_to: string | null;
|
|
376
|
+
/** `active` | `inactive` (from `is_active`). */
|
|
377
|
+
status: string;
|
|
378
|
+
/** Present on `get` (whenLoaded). */
|
|
379
|
+
items?: PriceListItem[];
|
|
380
|
+
}
|
|
381
|
+
export interface CreatePriceListInput {
|
|
382
|
+
name_en: string;
|
|
383
|
+
name_ar?: string | null;
|
|
384
|
+
/** Send it ALWAYS: an omitted code is stored as the server's `SAR` default. */
|
|
385
|
+
currency_code?: string;
|
|
386
|
+
scope_type?: PriceListScope;
|
|
387
|
+
/** Required when `scope_type` is store/channel/customer_group. */
|
|
388
|
+
scope_id?: string | null;
|
|
389
|
+
priority?: number;
|
|
390
|
+
prices_are_tax_inclusive?: boolean;
|
|
391
|
+
}
|
|
392
|
+
/** Scope + currency are absent on purpose — the server's `update` rejects them. */
|
|
393
|
+
export interface UpdatePriceListInput {
|
|
394
|
+
name_en?: string;
|
|
395
|
+
name_ar?: string | null;
|
|
396
|
+
priority?: number;
|
|
397
|
+
prices_are_tax_inclusive?: boolean;
|
|
398
|
+
is_active?: boolean;
|
|
399
|
+
active_from?: string | null;
|
|
400
|
+
active_to?: string | null;
|
|
401
|
+
}
|
|
402
|
+
/** RAW `PosPriceListItem` model returned by `addItem` / `updateItem`. */
|
|
403
|
+
export interface PosPriceListItemRaw {
|
|
404
|
+
id: string;
|
|
405
|
+
price_list_id: string;
|
|
406
|
+
catalog_item_id: string;
|
|
407
|
+
unit_price: string;
|
|
408
|
+
tax_profile_id: string | null;
|
|
409
|
+
created_at: string | null;
|
|
410
|
+
updated_at: string | null;
|
|
411
|
+
}
|
|
412
|
+
/** `addItem` UPSERTS on the (price list, catalog item) pair rather than failing. */
|
|
413
|
+
export interface UpsertPriceListItemInput {
|
|
414
|
+
catalog_item_id: string;
|
|
415
|
+
unit_price: number | string;
|
|
416
|
+
tax_profile_id?: string | null;
|
|
417
|
+
}
|
|
418
|
+
export interface UpdatePriceListItemInput {
|
|
419
|
+
unit_price?: number | string;
|
|
420
|
+
tax_profile_id?: string | null;
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Promotion types the API ACCEPTS. Only `percent` and `amount` are implemented —
|
|
424
|
+
* `PriceCartAction::applyCartPromotions()` matches those two and falls through to
|
|
425
|
+
* a zero discount for `bogo` / `bundle` / `happy_hour`, and it reads only
|
|
426
|
+
* `scope_type = 'cart'` rows, so a `line`-scoped promotion never applies either.
|
|
427
|
+
* A UI that offers the unimplemented combinations ships a control that does nothing.
|
|
428
|
+
*/
|
|
429
|
+
export type PromotionType = 'percent' | 'amount' | 'bogo' | 'bundle' | 'happy_hour';
|
|
430
|
+
export type PromotionScope = 'line' | 'cart';
|
|
431
|
+
export type PromotionStacking = 'best_wins' | 'additive';
|
|
432
|
+
/** RAW `PosPromotionRule` row (eager-loaded by `list`/`get`; never evaluated). */
|
|
433
|
+
export interface PosPromotionRuleRaw {
|
|
434
|
+
id: string;
|
|
435
|
+
promotion_id: string;
|
|
436
|
+
rule_type: string;
|
|
437
|
+
rule_config: Record<string, unknown> | null;
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* RAW `PosPromotion` model. Like tax profiles, the promotion endpoints ship no
|
|
441
|
+
* Resource: `list` is a BARE ARRAY of DB columns with `rules` eager-loaded.
|
|
442
|
+
*/
|
|
443
|
+
export interface PosPromotionRaw {
|
|
444
|
+
id: string;
|
|
445
|
+
name_en: string;
|
|
446
|
+
name_ar: string | null;
|
|
447
|
+
promotion_type: PromotionType;
|
|
448
|
+
scope_type: PromotionScope;
|
|
449
|
+
/** Percent promotions store the PERCENT (`"10.0000"` = 10%), not a fraction. */
|
|
450
|
+
value: string;
|
|
451
|
+
priority: number;
|
|
452
|
+
stacking_mode: PromotionStacking;
|
|
453
|
+
max_discount_amount: string | null;
|
|
454
|
+
is_active: boolean;
|
|
455
|
+
active_from: string | null;
|
|
456
|
+
active_to: string | null;
|
|
457
|
+
conditions: Record<string, unknown> | null;
|
|
458
|
+
created_at: string | null;
|
|
459
|
+
updated_at: string | null;
|
|
460
|
+
rules?: PosPromotionRuleRaw[];
|
|
461
|
+
}
|
|
462
|
+
export interface CreatePromotionInput {
|
|
463
|
+
name_en: string;
|
|
464
|
+
name_ar?: string | null;
|
|
465
|
+
promotion_type: PromotionType;
|
|
466
|
+
scope_type?: PromotionScope;
|
|
467
|
+
value: number | string;
|
|
468
|
+
priority?: number;
|
|
469
|
+
stacking_mode?: PromotionStacking;
|
|
470
|
+
max_discount_amount?: number | string | null;
|
|
471
|
+
active_from?: string | null;
|
|
472
|
+
active_to?: string | null;
|
|
473
|
+
}
|
|
474
|
+
/** `promotion_type` and `scope_type` are create-only — `update` rejects both. */
|
|
475
|
+
export interface UpdatePromotionInput {
|
|
476
|
+
name_en?: string;
|
|
477
|
+
name_ar?: string | null;
|
|
478
|
+
value?: number | string;
|
|
479
|
+
priority?: number;
|
|
480
|
+
stacking_mode?: PromotionStacking;
|
|
481
|
+
max_discount_amount?: number | string | null;
|
|
482
|
+
is_active?: boolean;
|
|
483
|
+
active_from?: string | null;
|
|
484
|
+
active_to?: string | null;
|
|
485
|
+
}
|
|
486
|
+
export interface MemberQuoteLine {
|
|
487
|
+
catalog_item_id: string;
|
|
488
|
+
sku: string;
|
|
489
|
+
/** EN only — the quote carries no Arabic name; join the catalog for one. */
|
|
490
|
+
name_en: string;
|
|
491
|
+
quantity: string;
|
|
492
|
+
/** What a walk-in pays (resolved from a `base`-scoped price list); null when nothing prices it. */
|
|
493
|
+
public_price: string | null;
|
|
494
|
+
/** What a member pays; EQUALS `public_price` when no member list matched. */
|
|
495
|
+
member_price: string | null;
|
|
496
|
+
/**
|
|
497
|
+
* The one actually charged — `member_price` iff `is_member`, else public.
|
|
498
|
+
* NULL (with `price_missing: true`) when nothing prices the item — never a silent 0:
|
|
499
|
+
* ask the cashier for a price.
|
|
500
|
+
*/
|
|
501
|
+
unit_price: string | null;
|
|
502
|
+
/** Null when either side's price is unknown. */
|
|
503
|
+
member_discount: string | null;
|
|
504
|
+
/** Present (and true) only when nothing prices the item for this customer. */
|
|
505
|
+
price_missing?: true;
|
|
506
|
+
/**
|
|
507
|
+
* Present (and true) only when the item's tax profile is configured but missing or
|
|
508
|
+
* inactive: `tax_rate` is null and the item cannot be sold until its tax setup is fixed.
|
|
509
|
+
*/
|
|
510
|
+
tax_unavailable?: true;
|
|
511
|
+
/** Tax FRACTION (`"0.1500"`), from the resolved profile; null when `tax_unavailable`. */
|
|
512
|
+
tax_rate: string | null;
|
|
513
|
+
/** The three line figures are null on a flagged line, which adds nothing to the totals. */
|
|
514
|
+
line_net: string | null;
|
|
515
|
+
line_tax: string | null;
|
|
516
|
+
line_total: string | null;
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* `POST /api/pos/pricing/member-quote` — the cart priced for ONE customer, with the
|
|
520
|
+
* member and public price side by side.
|
|
521
|
+
*
|
|
522
|
+
* `is_member` is POS's STRICTER membership test (`hasActiveMembershipAt`): active
|
|
523
|
+
* status AND today inside `current_period_{starts,ends}_at`. The turnstile asks only
|
|
524
|
+
* for active status, so a member mid-lapse is admitted at the door and quoted the
|
|
525
|
+
* public price here. That disagreement is live in core (see `ReadsMemberAccess`), which
|
|
526
|
+
* is exactly why a till UI should show this flag rather than infer membership itself.
|
|
527
|
+
*
|
|
528
|
+
* Carries NO currency: read it from the shift/store (`ShiftResource.currency_code`,
|
|
529
|
+
* `StoreResource.currency_code`), never from a literal.
|
|
530
|
+
*/
|
|
531
|
+
export interface MemberQuote {
|
|
532
|
+
client_id: string | null;
|
|
533
|
+
is_member: boolean;
|
|
534
|
+
lines: MemberQuoteLine[];
|
|
535
|
+
subtotal: string;
|
|
536
|
+
public_subtotal: string;
|
|
537
|
+
member_savings: string;
|
|
538
|
+
tax_total: string;
|
|
539
|
+
grand_total: string;
|
|
540
|
+
}
|
|
541
|
+
export interface MemberQuoteInput {
|
|
542
|
+
/** A Bookings client uuid. Omit for a walk-in — everything prices as public. */
|
|
543
|
+
client_id?: string | null;
|
|
544
|
+
store_id?: string | null;
|
|
545
|
+
/**
|
|
546
|
+
* An id that no longer exists (an item removed while the cart was open) is a 422 —
|
|
547
|
+
* `errors['items.<index>.catalog_item_id']`, the index into THIS array — never a
|
|
548
|
+
* silently shorter quote. The plain `pricing/quote` answers the same way.
|
|
549
|
+
*/
|
|
550
|
+
items: Array<{
|
|
551
|
+
catalog_item_id: string;
|
|
552
|
+
quantity: number | string;
|
|
553
|
+
}>;
|
|
554
|
+
}
|
|
555
|
+
/** A row of `GET /api/pos/catalog/till` — bespoke, NOT `CatalogItemResource`. */
|
|
556
|
+
export interface TillCatalogItem {
|
|
557
|
+
catalog_item_id: string;
|
|
558
|
+
sku: string;
|
|
559
|
+
name_en: string;
|
|
560
|
+
name_ar: string | null;
|
|
561
|
+
unit_of_measure: string;
|
|
562
|
+
barcode: string | null;
|
|
563
|
+
public_price: string | null;
|
|
564
|
+
member_price: string | null;
|
|
565
|
+
member_discount: string | null;
|
|
566
|
+
/** NULL (with `price_missing: true`) when nothing prices the item — never a silent 0. */
|
|
567
|
+
unit_price: string | null;
|
|
568
|
+
is_member: boolean;
|
|
569
|
+
tax_profile_id: string | null;
|
|
570
|
+
/** Present (and true) only when nothing prices the item for this customer. */
|
|
571
|
+
price_missing?: true;
|
|
572
|
+
}
|
|
573
|
+
export interface TillCatalog {
|
|
574
|
+
is_member: boolean;
|
|
575
|
+
client_id: string | null;
|
|
576
|
+
items: TillCatalogItem[];
|
|
577
|
+
}
|
|
578
|
+
/**
|
|
579
|
+
* What the till does with a catalog item that has no price.
|
|
580
|
+
* - `ask` (the default — simple start): the cashier types a price (0 allowed, a chosen zero),
|
|
581
|
+
* which needs `pos.prices.override`; the line is recorded `price_source: 'manual'` and audited.
|
|
582
|
+
* - `refuse`: an unpriced item cannot be sold until someone gives it a price.
|
|
583
|
+
* Never a silent zero either way.
|
|
584
|
+
*/
|
|
585
|
+
export type PosMissingPriceRule = 'ask' | 'refuse';
|
|
586
|
+
/** Per-tenant POS policy (GET/PUT /api/pos/policy). */
|
|
587
|
+
export interface PosPolicy {
|
|
588
|
+
/** When true, a sale must be tied to a customer before it can be completed. */
|
|
589
|
+
require_customer: boolean;
|
|
590
|
+
/** See {@link PosMissingPriceRule}. */
|
|
591
|
+
missing_price: PosMissingPriceRule;
|
|
592
|
+
}
|
|
593
|
+
/** PUT /api/pos/policy is a partial update: send at least one field; omitted fields keep their value. */
|
|
594
|
+
export type PosPolicyUpdate = Partial<PosPolicy>;
|
|
595
|
+
export declare function createPosNamespace(http: Http): {
|
|
596
|
+
/** Per-tenant POS policy — read (pos.sales.view) / write (pos.sales.manage). */
|
|
597
|
+
policy: {
|
|
598
|
+
/** GET /api/pos/policy */
|
|
599
|
+
get: () => Promise<PosPolicy>;
|
|
600
|
+
/** PUT /api/pos/policy */
|
|
601
|
+
update: (input: PosPolicyUpdate) => Promise<PosPolicy>;
|
|
602
|
+
};
|
|
603
|
+
/**
|
|
604
|
+
* Price configuration. Every verb here needs `pos.pricing.manage` EXCEPT
|
|
605
|
+
* `memberQuote`, which needs only `pos.sales.view` (a cashier may ask the
|
|
606
|
+
* price, not set it). `deactivate` is the server's `destroy`: it flips
|
|
607
|
+
* `is_active`, and the matching `list` returns active rows only.
|
|
608
|
+
*/
|
|
609
|
+
pricing: {
|
|
610
|
+
taxProfiles: {
|
|
611
|
+
/** GET /api/pos/pricing/tax-profiles — a BARE ARRAY, not `{data}`. */
|
|
612
|
+
list: () => Promise<PosTaxProfileRaw[]>;
|
|
613
|
+
/** POST /api/pos/pricing/tax-profiles — returns the RAW model. */
|
|
614
|
+
create: (input: CreateTaxProfileInput) => Promise<PosTaxProfileRaw>;
|
|
615
|
+
/** PUT /api/pos/pricing/tax-profiles/{taxProfile} — returns the RAW model. */
|
|
616
|
+
update: (id: string, input: UpdateTaxProfileInput) => Promise<PosTaxProfileRaw>;
|
|
617
|
+
/** DELETE /api/pos/pricing/tax-profiles/{taxProfile} — marks it inactive (204). */
|
|
618
|
+
deactivate: (id: string) => Promise<void>;
|
|
619
|
+
};
|
|
620
|
+
priceLists: {
|
|
621
|
+
/**
|
|
622
|
+
* GET /api/pos/pricing/price-lists — ACTIVE lists only, priority desc.
|
|
623
|
+
* Laravel's resource-collection envelope; `Paginated` names the
|
|
624
|
+
* `{data, meta}` subset we read (as with sales/shifts/stores).
|
|
625
|
+
*/
|
|
626
|
+
list: (query?: ListQuery) => Promise<Paginated<PriceList>>;
|
|
627
|
+
/** GET /api/pos/pricing/price-lists/{priceList} — includes `items`. */
|
|
628
|
+
get: (id: string) => Promise<PriceList>;
|
|
629
|
+
/** POST /api/pos/pricing/price-lists */
|
|
630
|
+
create: (input: CreatePriceListInput) => Promise<PriceList>;
|
|
631
|
+
/** PUT /api/pos/pricing/price-lists/{priceList} */
|
|
632
|
+
update: (id: string, input: UpdatePriceListInput) => Promise<PriceList>;
|
|
633
|
+
/** DELETE /api/pos/pricing/price-lists/{priceList} — marks it inactive (204). */
|
|
634
|
+
deactivate: (id: string) => Promise<void>;
|
|
635
|
+
/** POST /api/pos/pricing/price-lists/{priceList}/items — UPSERT; RAW model. */
|
|
636
|
+
addItem: (priceListId: string, input: UpsertPriceListItemInput) => Promise<PosPriceListItemRaw>;
|
|
637
|
+
/** PUT /api/pos/pricing/price-lists/{priceList}/items/{item} — RAW model. */
|
|
638
|
+
updateItem: (priceListId: string, itemId: string, input: UpdatePriceListItemInput) => Promise<PosPriceListItemRaw>;
|
|
639
|
+
/** DELETE /api/pos/pricing/price-lists/{priceList}/items/{item} — a REAL delete (204). */
|
|
640
|
+
removeItem: (priceListId: string, itemId: string) => Promise<void>;
|
|
641
|
+
};
|
|
642
|
+
promotions: {
|
|
643
|
+
/** GET /api/pos/pricing/promotions — a BARE ARRAY of RAW rows with `rules`. */
|
|
644
|
+
list: () => Promise<PosPromotionRaw[]>;
|
|
645
|
+
/** GET /api/pos/pricing/promotions/{promotion} */
|
|
646
|
+
get: (id: string) => Promise<PosPromotionRaw>;
|
|
647
|
+
/** POST /api/pos/pricing/promotions */
|
|
648
|
+
create: (input: CreatePromotionInput) => Promise<PosPromotionRaw>;
|
|
649
|
+
/** PUT /api/pos/pricing/promotions/{promotion} */
|
|
650
|
+
update: (id: string, input: UpdatePromotionInput) => Promise<PosPromotionRaw>;
|
|
651
|
+
/** DELETE /api/pos/pricing/promotions/{promotion} — marks it inactive (204). */
|
|
652
|
+
deactivate: (id: string) => Promise<void>;
|
|
653
|
+
};
|
|
654
|
+
/** POST /api/pos/pricing/member-quote — member vs public price for a client. */
|
|
655
|
+
memberQuote: (input: MemberQuoteInput) => Promise<MemberQuote>;
|
|
656
|
+
};
|
|
657
|
+
sales: {
|
|
658
|
+
/** GET /api/pos/sales — paginated `{data, meta}` of SaleResource. */
|
|
659
|
+
list: (query?: SaleListQuery) => Promise<Paginated<Sale>>;
|
|
660
|
+
/** GET /api/pos/sales/{sale} */
|
|
661
|
+
get: (id: string) => Promise<Sale>;
|
|
662
|
+
/** POST /api/pos/sales — opens a cart. */
|
|
663
|
+
create: (input?: CreateSaleInput) => Promise<Sale>;
|
|
664
|
+
/** POST /api/pos/sales/{sale}/lines — returns the RAW PosSale. */
|
|
665
|
+
addLine: (id: string, input: AddSaleLineInput) => Promise<PosSaleRaw>;
|
|
666
|
+
/** PATCH /api/pos/sales/{sale}/lines/{line} — returns the RAW PosSale. */
|
|
667
|
+
updateLine: (id: string, lineId: string, input: {
|
|
668
|
+
quantity: number | string;
|
|
669
|
+
}) => Promise<PosSaleRaw>;
|
|
670
|
+
/** DELETE /api/pos/sales/{sale}/lines/{line} — returns the RAW PosSale. */
|
|
671
|
+
removeLine: (id: string, lineId: string) => Promise<PosSaleRaw>;
|
|
672
|
+
/** POST /api/pos/sales/{sale}/discounts — returns the RAW PosSale. */
|
|
673
|
+
discount: (id: string, input: ApplyDiscountInput) => Promise<PosSaleRaw>;
|
|
674
|
+
/** POST /api/pos/sales/{sale}/payments — tender; returns the RAW PosSale. */
|
|
675
|
+
tender: (id: string, input: AddTenderInput) => Promise<PosSaleRaw>;
|
|
676
|
+
/** POST /api/pos/sales/{sale}/complete — returns the RAW PosSale. */
|
|
677
|
+
complete: (id: string) => Promise<PosSaleRaw>;
|
|
678
|
+
/** POST /api/pos/sales/{sale}/void — returns the RAW PosSale. */
|
|
679
|
+
void: (id: string) => Promise<PosSaleRaw>;
|
|
680
|
+
/** POST /api/pos/sales/{sale}/refunds — returns the RAW PosRefund. */
|
|
681
|
+
refund: (id: string, input: RefundSaleInput) => Promise<PosRefundRaw>;
|
|
682
|
+
/** GET /api/pos/sales/{sale}/receipt */
|
|
683
|
+
receipt: (id: string) => Promise<SaleReceipt>;
|
|
684
|
+
};
|
|
685
|
+
shifts: {
|
|
686
|
+
/** GET /api/pos/shifts — paginated `{data, meta}` of ShiftResource. */
|
|
687
|
+
list: (query?: ListQuery & {
|
|
688
|
+
register_id?: string;
|
|
689
|
+
status?: ShiftStatus;
|
|
690
|
+
}) => Promise<Paginated<Shift>>;
|
|
691
|
+
/** GET /api/pos/shifts/{shift} */
|
|
692
|
+
get: (id: string) => Promise<Shift>;
|
|
693
|
+
/** POST /api/pos/registers/{register}/shifts — opens a shift; returns RAW PosShift. */
|
|
694
|
+
open: (registerId: string, input?: OpenShiftInput) => Promise<PosShiftRaw>;
|
|
695
|
+
/** POST /api/pos/shifts/{shift}/close — returns RAW PosShift. */
|
|
696
|
+
close: (id: string, input: CloseShiftInput) => Promise<PosShiftRaw>;
|
|
697
|
+
/** POST /api/pos/shifts/{shift}/cash-movements — returns RAW PosCashMovement. */
|
|
698
|
+
cashMovement: (id: string, input: CashMovementInput) => Promise<PosCashMovementRaw>;
|
|
699
|
+
/** POST /api/pos/shifts/{shift}/x-report */
|
|
700
|
+
xReport: (id: string) => Promise<XReport>;
|
|
701
|
+
};
|
|
702
|
+
catalog: {
|
|
703
|
+
/** GET /api/pos/catalog — paginated `{data, meta}` of CatalogItemResource. */
|
|
704
|
+
list: (query?: ListQuery) => Promise<Paginated<CatalogItem>>;
|
|
705
|
+
/** GET /api/pos/catalog/{catalogItem} */
|
|
706
|
+
get: (id: string) => Promise<CatalogItem>;
|
|
707
|
+
/**
|
|
708
|
+
* GET /api/pos/catalog/till — saleable items with public + member prices.
|
|
709
|
+
* Bespoke payload (`{is_member, client_id, items}`), NOT the Resource.
|
|
710
|
+
*/
|
|
711
|
+
till: (query?: {
|
|
712
|
+
client_id?: string;
|
|
713
|
+
store_id?: string;
|
|
714
|
+
}) => Promise<TillCatalog>;
|
|
715
|
+
/** GET /api/pos/catalog/barcodes/{barcode} */
|
|
716
|
+
lookupBarcode: (barcode: string) => Promise<BarcodeLookupResult>;
|
|
717
|
+
};
|
|
718
|
+
stores: {
|
|
719
|
+
/** GET /api/pos/stores — paginated `{data, meta}`. */
|
|
720
|
+
list: (query?: ListQuery) => Promise<Paginated<Store>>;
|
|
721
|
+
/** GET /api/pos/stores/{store} */
|
|
722
|
+
get: (id: string) => Promise<Store>;
|
|
723
|
+
/** POST /api/pos/stores */
|
|
724
|
+
create: (input: CreateStoreInput) => Promise<Store>;
|
|
725
|
+
/** PUT /api/pos/stores/{store} */
|
|
726
|
+
update: (id: string, input: UpdateStoreInput) => Promise<Store>;
|
|
727
|
+
/** GET /api/pos/stores/{store}/registers — `{ data }` only (no meta). */
|
|
728
|
+
registers: (storeId: string) => Promise<{
|
|
729
|
+
data: Register[];
|
|
730
|
+
}>;
|
|
731
|
+
/** POST /api/pos/stores/{store}/registers */
|
|
732
|
+
createRegister: (storeId: string, input: CreateRegisterInput) => Promise<Register>;
|
|
733
|
+
};
|
|
734
|
+
registers: {
|
|
735
|
+
/** GET /api/pos/registers — `{ data }` only (no meta). */
|
|
736
|
+
list: () => Promise<{
|
|
737
|
+
data: Register[];
|
|
738
|
+
}>;
|
|
739
|
+
/** PUT /api/pos/registers/{register} */
|
|
740
|
+
update: (id: string, input: UpdateRegisterInput) => Promise<Register>;
|
|
741
|
+
};
|
|
742
|
+
};
|
|
743
|
+
export type PosNamespace = ReturnType<typeof createPosNamespace>;
|