feeef 0.9.7 → 0.11.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/build/index.js +655 -3
- package/build/index.js.map +1 -1
- package/build/src/ai/ai_calculator.d.ts +3 -0
- package/build/src/core/batch.d.ts +63 -0
- package/build/src/core/entities/finance.d.ts +355 -0
- package/build/src/core/entities/inventory.d.ts +80 -0
- package/build/src/core/entities/store.d.ts +102 -0
- package/build/src/core/models_catalog.d.ts +53 -0
- package/build/src/feeef/feeef.d.ts +10 -0
- package/build/src/feeef/repositories/finance.d.ts +156 -0
- package/build/src/feeef/repositories/inventory.d.ts +159 -0
- package/build/src/feeef/repositories/orders.d.ts +16 -0
- package/build/src/feeef/repositories/repository.d.ts +34 -0
- package/build/src/feeef/repositories/transfers.d.ts +1 -1
- package/build/src/feeef/services/integrations.d.ts +16 -0
- package/build/src/index.d.ts +6 -0
- package/package.json +4 -3
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* Canonical `aiModels.billing` keys — keep in sync: backend `configs_controller.ts`,
|
|
10
10
|
* feeef `lib/core/app_config.dart`, admins_dashboard `src/lib/hooks/useOptions.ts`.
|
|
11
11
|
*/
|
|
12
|
+
import { ModelsCatalogConfig } from '../core/models_catalog.js';
|
|
12
13
|
/** Fallback DZD per USD when `aiModels.exchangeRate` is missing (mirror backend). */
|
|
13
14
|
export declare const FALLBACK_AI_EXCHANGE_RATE = 260;
|
|
14
15
|
export interface RetailMarkupBilling {
|
|
@@ -141,6 +142,8 @@ export interface AiCalculatorConfig {
|
|
|
141
142
|
referenceImageCost?: number;
|
|
142
143
|
resolutionCosts?: Record<string, number>;
|
|
143
144
|
models?: AiModelConfig[];
|
|
145
|
+
/** Optional model catalog (`models` option): allows pricing.prompt/completion to price text models without aiModels rows. */
|
|
146
|
+
modelsCatalog?: ModelsCatalogConfig;
|
|
144
147
|
/** Optional `aiModels.billing` overrides (merged over [mergeAiModelsBilling] defaults). */
|
|
145
148
|
billing?: AIModelsBilling | null;
|
|
146
149
|
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types for AIP-style batch operations (`:batchDelete`, `:batchUpdate`, …).
|
|
3
|
+
*
|
|
4
|
+
* Repositories override {@link ModelRepository.deleteMany} / `updateMany` / `createMany`
|
|
5
|
+
* when the API supports them. HTTP 200 does not mean all items succeeded — always
|
|
6
|
+
* inspect `summary` and `failedRequests`.
|
|
7
|
+
*/
|
|
8
|
+
export interface BatchRpcStatus {
|
|
9
|
+
code: string;
|
|
10
|
+
message: string;
|
|
11
|
+
details?: unknown;
|
|
12
|
+
}
|
|
13
|
+
export interface BatchSummary {
|
|
14
|
+
total: number;
|
|
15
|
+
succeeded: number;
|
|
16
|
+
failed: number;
|
|
17
|
+
}
|
|
18
|
+
export declare function batchSummaryHasFailures(summary: BatchSummary): boolean;
|
|
19
|
+
export declare function batchSummaryAllFailed(summary: BatchSummary): boolean;
|
|
20
|
+
export interface BatchResult<T = void> {
|
|
21
|
+
resources?: T[];
|
|
22
|
+
failedRequests: Record<string, BatchRpcStatus>;
|
|
23
|
+
summary: BatchSummary;
|
|
24
|
+
code?: string;
|
|
25
|
+
message?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface BatchDeleteRequest {
|
|
28
|
+
projectId: string;
|
|
29
|
+
names: string[];
|
|
30
|
+
returnPartialSuccess?: boolean;
|
|
31
|
+
requestId?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface BatchUpdateManyRequest {
|
|
34
|
+
projectId: string;
|
|
35
|
+
names: string[];
|
|
36
|
+
updateMask: string[];
|
|
37
|
+
returnPartialSuccess?: boolean;
|
|
38
|
+
requestId?: string;
|
|
39
|
+
/** Hoisted patch fields (storageClass, warehouseId, …). */
|
|
40
|
+
fields?: Record<string, unknown>;
|
|
41
|
+
}
|
|
42
|
+
export interface BatchCreateManyRequest {
|
|
43
|
+
projectId: string;
|
|
44
|
+
items: Record<string, unknown>[];
|
|
45
|
+
returnPartialSuccess?: boolean;
|
|
46
|
+
requestId?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface BatchReleaseRequest {
|
|
49
|
+
projectId: string;
|
|
50
|
+
names: string[];
|
|
51
|
+
returnPartialSuccess?: boolean;
|
|
52
|
+
requestId?: string;
|
|
53
|
+
toJson?(): Record<string, unknown>;
|
|
54
|
+
}
|
|
55
|
+
export declare function parseBatchRpcStatus(json: Record<string, unknown>): BatchRpcStatus;
|
|
56
|
+
export declare function parseBatchSummary(json: Record<string, unknown>): BatchSummary;
|
|
57
|
+
/**
|
|
58
|
+
* Parses batch API response from success or 400 ABORTED body.
|
|
59
|
+
*/
|
|
60
|
+
export declare function parseBatchResult<T = void>(data: unknown, resourceFromJson?: (json: Record<string, unknown>) => T): BatchResult<T>;
|
|
61
|
+
export declare function batchDeleteBody(request: BatchDeleteRequest): Record<string, unknown>;
|
|
62
|
+
export declare function batchUpdateManyBody(request: BatchUpdateManyRequest): Record<string, unknown>;
|
|
63
|
+
export declare function batchReleaseBody(request: BatchReleaseRequest): Record<string, unknown>;
|
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Finance module entities (Phase 1: procurement). Project-scoped, mirroring the
|
|
3
|
+
* backend Lucid models. Money values are returned as numbers (decimal(14,2)).
|
|
4
|
+
*/
|
|
5
|
+
export type PurchaseOrderStatus = 'draft' | 'sent' | 'partial' | 'received' | 'cancelled';
|
|
6
|
+
export type PurchaseReceiptStatus = 'draft' | 'posted' | 'voided';
|
|
7
|
+
export interface Supplier {
|
|
8
|
+
id: string;
|
|
9
|
+
projectId: string;
|
|
10
|
+
name: string;
|
|
11
|
+
code?: string | null;
|
|
12
|
+
phone?: string | null;
|
|
13
|
+
email?: string | null;
|
|
14
|
+
taxId?: string | null;
|
|
15
|
+
address?: Record<string, any> | null;
|
|
16
|
+
paymentTerms?: string | null;
|
|
17
|
+
metadata?: Record<string, any>;
|
|
18
|
+
createdAt: string;
|
|
19
|
+
updatedAt: string;
|
|
20
|
+
deletedAt?: string | null;
|
|
21
|
+
}
|
|
22
|
+
export interface CreateSupplierInput {
|
|
23
|
+
projectId: string;
|
|
24
|
+
name: string;
|
|
25
|
+
code?: string;
|
|
26
|
+
phone?: string;
|
|
27
|
+
email?: string;
|
|
28
|
+
taxId?: string;
|
|
29
|
+
address?: Record<string, any>;
|
|
30
|
+
paymentTerms?: string;
|
|
31
|
+
metadata?: Record<string, any>;
|
|
32
|
+
}
|
|
33
|
+
export interface UpdateSupplierInput {
|
|
34
|
+
name?: string;
|
|
35
|
+
code?: string | null;
|
|
36
|
+
phone?: string | null;
|
|
37
|
+
email?: string | null;
|
|
38
|
+
taxId?: string | null;
|
|
39
|
+
address?: Record<string, any> | null;
|
|
40
|
+
paymentTerms?: string | null;
|
|
41
|
+
metadata?: Record<string, any>;
|
|
42
|
+
}
|
|
43
|
+
export interface PurchaseOrderItem {
|
|
44
|
+
sku: string;
|
|
45
|
+
productId?: string | null;
|
|
46
|
+
variantPath?: string;
|
|
47
|
+
qtyOrdered: number;
|
|
48
|
+
qtyReceived?: number;
|
|
49
|
+
unitCost: number;
|
|
50
|
+
warehouseId?: string | null;
|
|
51
|
+
batch?: string | null;
|
|
52
|
+
}
|
|
53
|
+
export interface PurchaseOrder {
|
|
54
|
+
id: string;
|
|
55
|
+
projectId: string;
|
|
56
|
+
supplierId: string;
|
|
57
|
+
status: PurchaseOrderStatus;
|
|
58
|
+
reference?: string | null;
|
|
59
|
+
expectedAt?: string | null;
|
|
60
|
+
notes?: string | null;
|
|
61
|
+
items: PurchaseOrderItem[];
|
|
62
|
+
currency?: string | null;
|
|
63
|
+
subtotal: number;
|
|
64
|
+
createdByUserId?: string | null;
|
|
65
|
+
createdAt: string;
|
|
66
|
+
updatedAt: string;
|
|
67
|
+
}
|
|
68
|
+
export interface CreatePurchaseOrderInput {
|
|
69
|
+
projectId: string;
|
|
70
|
+
supplierId: string;
|
|
71
|
+
reference?: string;
|
|
72
|
+
expectedAt?: string;
|
|
73
|
+
notes?: string;
|
|
74
|
+
items?: PurchaseOrderItem[];
|
|
75
|
+
currency?: string;
|
|
76
|
+
}
|
|
77
|
+
export interface UpdatePurchaseOrderInput {
|
|
78
|
+
reference?: string | null;
|
|
79
|
+
expectedAt?: string | null;
|
|
80
|
+
notes?: string | null;
|
|
81
|
+
items?: PurchaseOrderItem[];
|
|
82
|
+
currency?: string | null;
|
|
83
|
+
}
|
|
84
|
+
export interface PurchaseReceiptLine {
|
|
85
|
+
id: string;
|
|
86
|
+
purchaseReceiptId: string;
|
|
87
|
+
lineNo: number;
|
|
88
|
+
sku: string;
|
|
89
|
+
productId?: string | null;
|
|
90
|
+
variantPath: string;
|
|
91
|
+
batch: string;
|
|
92
|
+
inventoryObjectId?: string | null;
|
|
93
|
+
qtyReceived: number;
|
|
94
|
+
unitCost: number;
|
|
95
|
+
lineTotal: number;
|
|
96
|
+
poLineIndex?: number | null;
|
|
97
|
+
createdAt: string;
|
|
98
|
+
}
|
|
99
|
+
export interface PurchaseReceipt {
|
|
100
|
+
id: string;
|
|
101
|
+
projectId: string;
|
|
102
|
+
supplierId: string;
|
|
103
|
+
purchaseOrderId?: string | null;
|
|
104
|
+
warehouseId?: string | null;
|
|
105
|
+
status: PurchaseReceiptStatus;
|
|
106
|
+
reference?: string | null;
|
|
107
|
+
receivedAt: string;
|
|
108
|
+
postedAt?: string | null;
|
|
109
|
+
voidedAt?: string | null;
|
|
110
|
+
notes?: string | null;
|
|
111
|
+
totalCost: number;
|
|
112
|
+
isPosted?: boolean;
|
|
113
|
+
createdByUserId?: string | null;
|
|
114
|
+
createdAt: string;
|
|
115
|
+
updatedAt: string;
|
|
116
|
+
lines?: PurchaseReceiptLine[];
|
|
117
|
+
}
|
|
118
|
+
export interface PurchaseReceiptLineInput {
|
|
119
|
+
sku: string;
|
|
120
|
+
productId?: string | null;
|
|
121
|
+
variantPath?: string;
|
|
122
|
+
batch?: string | null;
|
|
123
|
+
qtyReceived: number;
|
|
124
|
+
unitCost: number;
|
|
125
|
+
poLineIndex?: number | null;
|
|
126
|
+
}
|
|
127
|
+
export interface CreatePurchaseReceiptInput {
|
|
128
|
+
projectId: string;
|
|
129
|
+
supplierId: string;
|
|
130
|
+
purchaseOrderId?: string | null;
|
|
131
|
+
warehouseId?: string | null;
|
|
132
|
+
reference?: string;
|
|
133
|
+
receivedAt?: string;
|
|
134
|
+
notes?: string;
|
|
135
|
+
lines: PurchaseReceiptLineInput[];
|
|
136
|
+
}
|
|
137
|
+
export type FinancialAccountType = 'cash' | 'bank' | 'ewallet';
|
|
138
|
+
export type SupplierBillStatus = 'draft' | 'open' | 'partial' | 'paid' | 'void';
|
|
139
|
+
export type ExpenseStatus = 'draft' | 'recorded' | 'voided';
|
|
140
|
+
export interface FinancialAccount {
|
|
141
|
+
id: string;
|
|
142
|
+
projectId: string;
|
|
143
|
+
name: string;
|
|
144
|
+
type: FinancialAccountType;
|
|
145
|
+
currency?: string | null;
|
|
146
|
+
openingBalance: number;
|
|
147
|
+
isDefault: boolean;
|
|
148
|
+
metadata?: Record<string, any>;
|
|
149
|
+
/** Present on `show` (derived). */
|
|
150
|
+
balance?: number;
|
|
151
|
+
createdAt: string;
|
|
152
|
+
updatedAt: string;
|
|
153
|
+
deletedAt?: string | null;
|
|
154
|
+
}
|
|
155
|
+
export interface CreateFinancialAccountInput {
|
|
156
|
+
projectId: string;
|
|
157
|
+
name: string;
|
|
158
|
+
type?: FinancialAccountType;
|
|
159
|
+
currency?: string;
|
|
160
|
+
openingBalance?: number;
|
|
161
|
+
isDefault?: boolean;
|
|
162
|
+
metadata?: Record<string, any>;
|
|
163
|
+
}
|
|
164
|
+
export interface UpdateFinancialAccountInput {
|
|
165
|
+
name?: string;
|
|
166
|
+
type?: FinancialAccountType;
|
|
167
|
+
currency?: string | null;
|
|
168
|
+
openingBalance?: number;
|
|
169
|
+
isDefault?: boolean;
|
|
170
|
+
metadata?: Record<string, any>;
|
|
171
|
+
}
|
|
172
|
+
export interface SupplierBill {
|
|
173
|
+
id: string;
|
|
174
|
+
projectId: string;
|
|
175
|
+
supplierId: string;
|
|
176
|
+
purchaseReceiptId?: string | null;
|
|
177
|
+
reference?: string | null;
|
|
178
|
+
billDate: string;
|
|
179
|
+
dueDate?: string | null;
|
|
180
|
+
currency?: string | null;
|
|
181
|
+
totalAmount: number;
|
|
182
|
+
paidAmount: number;
|
|
183
|
+
balanceDue?: number;
|
|
184
|
+
status: SupplierBillStatus;
|
|
185
|
+
notes?: string | null;
|
|
186
|
+
createdByUserId?: string | null;
|
|
187
|
+
createdAt: string;
|
|
188
|
+
updatedAt: string;
|
|
189
|
+
payments?: SupplierPayment[];
|
|
190
|
+
}
|
|
191
|
+
export interface CreateSupplierBillInput {
|
|
192
|
+
projectId: string;
|
|
193
|
+
supplierId: string;
|
|
194
|
+
purchaseReceiptId?: string | null;
|
|
195
|
+
reference?: string;
|
|
196
|
+
billDate: string;
|
|
197
|
+
dueDate?: string | null;
|
|
198
|
+
currency?: string;
|
|
199
|
+
totalAmount: number;
|
|
200
|
+
notes?: string;
|
|
201
|
+
}
|
|
202
|
+
export interface SupplierPayment {
|
|
203
|
+
id: string;
|
|
204
|
+
projectId: string;
|
|
205
|
+
supplierBillId: string;
|
|
206
|
+
financialAccountId: string;
|
|
207
|
+
amount: number;
|
|
208
|
+
paidAt: string;
|
|
209
|
+
method?: string | null;
|
|
210
|
+
reference?: string | null;
|
|
211
|
+
createdByUserId?: string | null;
|
|
212
|
+
createdAt: string;
|
|
213
|
+
updatedAt: string;
|
|
214
|
+
}
|
|
215
|
+
export interface PaySupplierBillInput {
|
|
216
|
+
projectId: string;
|
|
217
|
+
financialAccountId: string;
|
|
218
|
+
amount: number;
|
|
219
|
+
paidAt?: string | null;
|
|
220
|
+
method?: string | null;
|
|
221
|
+
reference?: string | null;
|
|
222
|
+
allowOverpay?: boolean;
|
|
223
|
+
}
|
|
224
|
+
export interface CustomerPayment {
|
|
225
|
+
id: string;
|
|
226
|
+
projectId: string;
|
|
227
|
+
orderId: string;
|
|
228
|
+
financialAccountId: string;
|
|
229
|
+
amount: number;
|
|
230
|
+
receivedAt: string;
|
|
231
|
+
method?: string | null;
|
|
232
|
+
reference?: string | null;
|
|
233
|
+
createdByUserId?: string | null;
|
|
234
|
+
createdAt: string;
|
|
235
|
+
updatedAt: string;
|
|
236
|
+
}
|
|
237
|
+
export interface CollectCustomerPaymentInput {
|
|
238
|
+
projectId: string;
|
|
239
|
+
financialAccountId: string;
|
|
240
|
+
amount: number;
|
|
241
|
+
receivedAt?: string | null;
|
|
242
|
+
method?: string | null;
|
|
243
|
+
reference?: string | null;
|
|
244
|
+
allowOverpay?: boolean;
|
|
245
|
+
}
|
|
246
|
+
export interface Receivable {
|
|
247
|
+
orderId: string;
|
|
248
|
+
storeId: string;
|
|
249
|
+
total: number;
|
|
250
|
+
paid: number;
|
|
251
|
+
balanceDue: number;
|
|
252
|
+
status: string;
|
|
253
|
+
deliveryStatus: string;
|
|
254
|
+
codInTransit: boolean;
|
|
255
|
+
}
|
|
256
|
+
export interface ExpenseCategory {
|
|
257
|
+
id: string;
|
|
258
|
+
projectId: string;
|
|
259
|
+
name: string;
|
|
260
|
+
parentId?: string | null;
|
|
261
|
+
metadata?: Record<string, any>;
|
|
262
|
+
createdAt: string;
|
|
263
|
+
updatedAt: string;
|
|
264
|
+
deletedAt?: string | null;
|
|
265
|
+
}
|
|
266
|
+
export interface CreateExpenseCategoryInput {
|
|
267
|
+
projectId: string;
|
|
268
|
+
name: string;
|
|
269
|
+
parentId?: string | null;
|
|
270
|
+
metadata?: Record<string, any>;
|
|
271
|
+
}
|
|
272
|
+
export interface UpdateExpenseCategoryInput {
|
|
273
|
+
name?: string;
|
|
274
|
+
parentId?: string | null;
|
|
275
|
+
metadata?: Record<string, any>;
|
|
276
|
+
}
|
|
277
|
+
export interface Expense {
|
|
278
|
+
id: string;
|
|
279
|
+
projectId: string;
|
|
280
|
+
categoryId?: string | null;
|
|
281
|
+
supplierId?: string | null;
|
|
282
|
+
financialAccountId?: string | null;
|
|
283
|
+
amount: number;
|
|
284
|
+
currency?: string | null;
|
|
285
|
+
spentAt: string;
|
|
286
|
+
paymentMethod?: string | null;
|
|
287
|
+
status: ExpenseStatus;
|
|
288
|
+
reference?: string | null;
|
|
289
|
+
note?: string | null;
|
|
290
|
+
attachments: any[];
|
|
291
|
+
createdByUserId?: string | null;
|
|
292
|
+
createdAt: string;
|
|
293
|
+
updatedAt: string;
|
|
294
|
+
deletedAt?: string | null;
|
|
295
|
+
}
|
|
296
|
+
export interface CreateExpenseInput {
|
|
297
|
+
projectId: string;
|
|
298
|
+
categoryId?: string | null;
|
|
299
|
+
supplierId?: string | null;
|
|
300
|
+
financialAccountId?: string | null;
|
|
301
|
+
amount: number;
|
|
302
|
+
currency?: string;
|
|
303
|
+
spentAt: string;
|
|
304
|
+
paymentMethod?: string | null;
|
|
305
|
+
status?: ExpenseStatus;
|
|
306
|
+
reference?: string | null;
|
|
307
|
+
note?: string | null;
|
|
308
|
+
attachments?: any[];
|
|
309
|
+
}
|
|
310
|
+
export interface UpdateExpenseInput {
|
|
311
|
+
categoryId?: string | null;
|
|
312
|
+
supplierId?: string | null;
|
|
313
|
+
financialAccountId?: string | null;
|
|
314
|
+
amount?: number;
|
|
315
|
+
currency?: string | null;
|
|
316
|
+
spentAt?: string;
|
|
317
|
+
paymentMethod?: string | null;
|
|
318
|
+
status?: ExpenseStatus;
|
|
319
|
+
reference?: string | null;
|
|
320
|
+
note?: string | null;
|
|
321
|
+
attachments?: any[];
|
|
322
|
+
}
|
|
323
|
+
export interface FinanceOverview {
|
|
324
|
+
cash: number;
|
|
325
|
+
inventoryValuation: number;
|
|
326
|
+
accountsReceivable: number;
|
|
327
|
+
accountsPayable: number;
|
|
328
|
+
netPosition: number;
|
|
329
|
+
}
|
|
330
|
+
export interface AgingResult {
|
|
331
|
+
buckets: {
|
|
332
|
+
label: string;
|
|
333
|
+
amount: number;
|
|
334
|
+
}[];
|
|
335
|
+
total: number;
|
|
336
|
+
}
|
|
337
|
+
export interface CashPosition {
|
|
338
|
+
accounts: {
|
|
339
|
+
id: string;
|
|
340
|
+
name: string;
|
|
341
|
+
type: FinancialAccountType;
|
|
342
|
+
currency?: string | null;
|
|
343
|
+
balance: number;
|
|
344
|
+
}[];
|
|
345
|
+
total: number;
|
|
346
|
+
}
|
|
347
|
+
export interface PnlReport {
|
|
348
|
+
from: string | null;
|
|
349
|
+
to: string | null;
|
|
350
|
+
revenue: number;
|
|
351
|
+
cogs: number;
|
|
352
|
+
grossProfit: number;
|
|
353
|
+
expenses: number;
|
|
354
|
+
netProfit: number;
|
|
355
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
export interface Project {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
createdAt: string;
|
|
5
|
+
updatedAt: string;
|
|
6
|
+
}
|
|
7
|
+
export interface InventoryWarehouse {
|
|
8
|
+
id: string;
|
|
9
|
+
projectId: string;
|
|
10
|
+
name: string;
|
|
11
|
+
code: string;
|
|
12
|
+
metadata?: Record<string, any>;
|
|
13
|
+
createdAt: string;
|
|
14
|
+
updatedAt: string;
|
|
15
|
+
}
|
|
16
|
+
export interface InventoryObject {
|
|
17
|
+
id: string;
|
|
18
|
+
projectId: string;
|
|
19
|
+
namespace: string;
|
|
20
|
+
sku: string;
|
|
21
|
+
batch: string;
|
|
22
|
+
warehouseId?: string;
|
|
23
|
+
storageClass: string;
|
|
24
|
+
key: string;
|
|
25
|
+
quantityOnHand: number;
|
|
26
|
+
quantityReserved: number;
|
|
27
|
+
quantityAvailable: number;
|
|
28
|
+
receivedAt: string;
|
|
29
|
+
metadata?: Record<string, any>;
|
|
30
|
+
createdAt: string;
|
|
31
|
+
updatedAt: string;
|
|
32
|
+
}
|
|
33
|
+
export interface InventoryMovement {
|
|
34
|
+
id: string;
|
|
35
|
+
projectId: string;
|
|
36
|
+
objectId: string;
|
|
37
|
+
type: 'in' | 'out' | 'adjust' | 'reserve' | 'release' | 'consume';
|
|
38
|
+
quantityDelta: number;
|
|
39
|
+
balanceAfter: number;
|
|
40
|
+
reason?: string;
|
|
41
|
+
correlationRef?: string;
|
|
42
|
+
metadata?: Record<string, any>;
|
|
43
|
+
createdAt: string;
|
|
44
|
+
}
|
|
45
|
+
export interface InventoryReservation {
|
|
46
|
+
id: string;
|
|
47
|
+
projectId: string;
|
|
48
|
+
holderRef: string;
|
|
49
|
+
metadata?: Record<string, any>;
|
|
50
|
+
createdAt: string;
|
|
51
|
+
expiresAt?: string;
|
|
52
|
+
}
|
|
53
|
+
export interface InventoryAlias {
|
|
54
|
+
id: string;
|
|
55
|
+
projectId: string;
|
|
56
|
+
namespace: string;
|
|
57
|
+
sku: string;
|
|
58
|
+
alias: string;
|
|
59
|
+
createdAt: string;
|
|
60
|
+
}
|
|
61
|
+
export interface InventoryReceiveInput {
|
|
62
|
+
projectId: string;
|
|
63
|
+
namespace: string;
|
|
64
|
+
sku: string;
|
|
65
|
+
batch?: string;
|
|
66
|
+
quantity: number;
|
|
67
|
+
warehouseId?: string;
|
|
68
|
+
storageClass?: string;
|
|
69
|
+
metadata?: Record<string, any>;
|
|
70
|
+
}
|
|
71
|
+
export interface InventoryDeltaInput {
|
|
72
|
+
objectId: string;
|
|
73
|
+
quantityDelta: number;
|
|
74
|
+
}
|
|
75
|
+
export interface InventoryApplyDeltasInput {
|
|
76
|
+
projectId: string;
|
|
77
|
+
deltas: InventoryDeltaInput[];
|
|
78
|
+
reason: string;
|
|
79
|
+
correlationRef?: string;
|
|
80
|
+
}
|
|
@@ -45,6 +45,8 @@ export interface StoreEntity {
|
|
|
45
45
|
members?: Record<string, StoreMember>;
|
|
46
46
|
/** Active full-site template (`store_templates.id`) when set. */
|
|
47
47
|
templateId?: string | null;
|
|
48
|
+
/** Linked inventory project ID for stock management. */
|
|
49
|
+
projectId?: string | null;
|
|
48
50
|
}
|
|
49
51
|
export declare const generatePublicStoreIntegrations: (integrations: StoreIntegrations | null | undefined) => PublicStoreIntegrations | null;
|
|
50
52
|
export declare const generatePublicStoreIntegrationCustomFields: (customFields: any | null | undefined) => PublicCustomFieldsIntegration | null | undefined;
|
|
@@ -247,6 +249,51 @@ export interface CreateStoreInviteInput {
|
|
|
247
249
|
expiresAt?: string;
|
|
248
250
|
metadata?: Record<string, any>;
|
|
249
251
|
}
|
|
252
|
+
/** How order sync handles line items with no inventory bucket for their SKU. */
|
|
253
|
+
export type MissingInventoryBucketPolicy = 'ignore' | 'reject';
|
|
254
|
+
/** When an order field equals `equals`, apply the parent lifecycle list (reserve / release / consume). */
|
|
255
|
+
export interface InventoryLifecycleRule {
|
|
256
|
+
id: string;
|
|
257
|
+
dimension: PixelStatusDimension;
|
|
258
|
+
equals: string;
|
|
259
|
+
}
|
|
260
|
+
export interface InventoryIntegration {
|
|
261
|
+
reserve_on: OrderStatus[];
|
|
262
|
+
unreserve_on: OrderStatus[];
|
|
263
|
+
consume_on: OrderStatus[];
|
|
264
|
+
reserve_rules?: InventoryLifecycleRule[];
|
|
265
|
+
unreserve_rules?: InventoryLifecycleRule[];
|
|
266
|
+
consume_rules?: InventoryLifecycleRule[];
|
|
267
|
+
/**
|
|
268
|
+
* `ignore` — skip untracked SKUs and continue the order save.
|
|
269
|
+
* `reject` — block the order with a stock validation error.
|
|
270
|
+
* @default ignore
|
|
271
|
+
*/
|
|
272
|
+
missing_bucket_policy?: MissingInventoryBucketPolicy;
|
|
273
|
+
}
|
|
274
|
+
export type FinancePdfPaperSize = 'a4' | 'letter' | 'a5' | 'legal';
|
|
275
|
+
/** Layout and content options for finance PDF documents. */
|
|
276
|
+
export interface FinancePdfSettings {
|
|
277
|
+
paperSize: FinancePdfPaperSize;
|
|
278
|
+
showQrCode: boolean;
|
|
279
|
+
showLogo: boolean;
|
|
280
|
+
showStoreContact: boolean;
|
|
281
|
+
showSupplierDetails: boolean;
|
|
282
|
+
showDocumentId: boolean;
|
|
283
|
+
showFooter: boolean;
|
|
284
|
+
showStatusBadge: boolean;
|
|
285
|
+
showSignatureLines: boolean;
|
|
286
|
+
showPaymentHistory: boolean;
|
|
287
|
+
footerNote: string;
|
|
288
|
+
}
|
|
289
|
+
/** Order → finance behavior: when revenue/COGS are recognized for an order. */
|
|
290
|
+
export interface FinanceIntegration {
|
|
291
|
+
/** Order statuses at which revenue + COGS are recognized (receivable opens). */
|
|
292
|
+
recognize_on: OrderStatus[];
|
|
293
|
+
/** Cash-basis metrics cutoff — payments/expenses before this are ignored. */
|
|
294
|
+
activated_at?: string | null;
|
|
295
|
+
pdf?: FinancePdfSettings;
|
|
296
|
+
}
|
|
250
297
|
export interface StoreConfigs {
|
|
251
298
|
currencies: StoreCurrencyConfig[];
|
|
252
299
|
selectedCurrency: string;
|
|
@@ -257,6 +304,8 @@ export interface StoreConfigs {
|
|
|
257
304
|
customStatusMappings?: CustomStatusMapping[];
|
|
258
305
|
/** Feature flag to enable custom statuses across the app */
|
|
259
306
|
customStatusEnabled?: boolean;
|
|
307
|
+
inventory_integration?: InventoryIntegration;
|
|
308
|
+
finance_integration?: FinanceIntegration;
|
|
260
309
|
}
|
|
261
310
|
export interface CustomStatusMapping {
|
|
262
311
|
/** The custom status name (e.g., "not_respond", "phone_closed_1") */
|
|
@@ -523,6 +572,24 @@ export interface ZrexpressIntegration {
|
|
|
523
572
|
/** Additional metadata for the integration */
|
|
524
573
|
metadata?: Record<string, any>;
|
|
525
574
|
}
|
|
575
|
+
/**
|
|
576
|
+
* MDM Express (api.mdm.express) — `x-api-key` and/or Bearer JWT, MDM store `trackingId` (`mdmStoreId` on orders),
|
|
577
|
+
* and MDM seller id (`mdmSellerId`) for service-fees.
|
|
578
|
+
*/
|
|
579
|
+
export interface MdmExpressIntegration {
|
|
580
|
+
id: string;
|
|
581
|
+
apiKey?: string;
|
|
582
|
+
bearerToken?: string;
|
|
583
|
+
/** Store tracking id (e.g. STR-…) — `storeId` on `POST /api/v2/orders`. */
|
|
584
|
+
mdmStoreId: string;
|
|
585
|
+
/** Seller id (e.g. SLR-…) — `GET /api/sellers/{id}/service-fees`. */
|
|
586
|
+
mdmSellerId?: string;
|
|
587
|
+
active: boolean;
|
|
588
|
+
silentMode?: boolean;
|
|
589
|
+
autoSend?: boolean;
|
|
590
|
+
webhookSecret?: string | null;
|
|
591
|
+
metadata?: Record<string, any>;
|
|
592
|
+
}
|
|
526
593
|
export declare enum SecurityTreatment {
|
|
527
594
|
block = "block",
|
|
528
595
|
warning = "warning",
|
|
@@ -713,8 +780,21 @@ export interface StoreIntegrations {
|
|
|
713
780
|
noest?: any;
|
|
714
781
|
zimou?: ZimouIntegration;
|
|
715
782
|
zrexpress?: ZrexpressIntegration;
|
|
783
|
+
mdmExpress?: MdmExpressIntegration;
|
|
716
784
|
security?: SecurityIntegration;
|
|
717
785
|
dispatcher?: DispatcherIntegration;
|
|
786
|
+
inventory?: StoreInventoryIntegration;
|
|
787
|
+
finance?: StoreFinanceIntegration;
|
|
788
|
+
}
|
|
789
|
+
/** Marketplace inventory module (billing + active toggle). */
|
|
790
|
+
export interface StoreInventoryIntegration {
|
|
791
|
+
active: boolean;
|
|
792
|
+
metadata?: Record<string, any>;
|
|
793
|
+
}
|
|
794
|
+
/** Finance module (procurement + accounting) billing + active toggle. */
|
|
795
|
+
export interface StoreFinanceIntegration {
|
|
796
|
+
active: boolean;
|
|
797
|
+
metadata?: Record<string, any>;
|
|
718
798
|
}
|
|
719
799
|
export declare enum StoreSubscriptionStatus {
|
|
720
800
|
active = "active",
|
|
@@ -724,8 +804,26 @@ export declare enum StoreSubscriptionType {
|
|
|
724
804
|
free = "free",
|
|
725
805
|
premium = "premium",
|
|
726
806
|
vip = "vip",
|
|
807
|
+
ultra = "ultra",
|
|
727
808
|
custom = "custom"
|
|
728
809
|
}
|
|
810
|
+
/** Per-integration billing lifecycle (stored on store.subscription.integrations). */
|
|
811
|
+
export declare enum IntegrationBillingStatus {
|
|
812
|
+
active = "active",
|
|
813
|
+
grace = "grace",
|
|
814
|
+
past_due = "past_due",
|
|
815
|
+
canceled = "canceled"
|
|
816
|
+
}
|
|
817
|
+
export interface StoreIntegrationSubscription {
|
|
818
|
+
startAt: DateTime;
|
|
819
|
+
expiresAt: DateTime | null;
|
|
820
|
+
status: IntegrationBillingStatus;
|
|
821
|
+
/** Price snapshot from last successful charge (DZD). */
|
|
822
|
+
price: number;
|
|
823
|
+
autoRenew: boolean;
|
|
824
|
+
failedAttempts: number;
|
|
825
|
+
nextRetryAt: DateTime | null;
|
|
826
|
+
}
|
|
729
827
|
export interface StoreSubscription {
|
|
730
828
|
type: StoreSubscriptionType;
|
|
731
829
|
name: string;
|
|
@@ -736,6 +834,8 @@ export interface StoreSubscription {
|
|
|
736
834
|
consumed: number;
|
|
737
835
|
remaining: number;
|
|
738
836
|
metadata: Record<string, any>;
|
|
837
|
+
/** Per-integration paid subscriptions (billing only; credentials stay in store.integrations). */
|
|
838
|
+
integrations?: Record<string, StoreIntegrationSubscription>;
|
|
739
839
|
}
|
|
740
840
|
/**
|
|
741
841
|
* Input data for creating a new store
|
|
@@ -763,6 +863,7 @@ export interface StoreCreateInput {
|
|
|
763
863
|
tiktokPixelIds?: string[];
|
|
764
864
|
googleAnalyticsId?: string;
|
|
765
865
|
googleTagsId?: string;
|
|
866
|
+
projectId?: string;
|
|
766
867
|
}
|
|
767
868
|
/**
|
|
768
869
|
* Input data for updating an existing store
|
|
@@ -791,6 +892,7 @@ export interface StoreUpdateInput {
|
|
|
791
892
|
googleAnalyticsId?: string;
|
|
792
893
|
googleTagsId?: string;
|
|
793
894
|
integrations?: StoreIntegrations;
|
|
895
|
+
projectId?: string;
|
|
794
896
|
}
|
|
795
897
|
/**
|
|
796
898
|
* Store summary data
|