shopoflex-types 1.0.237 → 1.0.239
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/common.d.ts +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/interBranchRequest.d.ts +50 -0
- package/dist/interBranchRequest.js +26 -0
- package/package.json +1 -1
package/dist/common.d.ts
CHANGED
|
@@ -482,6 +482,8 @@ export interface Vendor {
|
|
|
482
482
|
terminalId: string;
|
|
483
483
|
branchIds: string[];
|
|
484
484
|
}[];
|
|
485
|
+
/** POS-to-POS inter-branch item request settings (opt-in, off by default). */
|
|
486
|
+
posStockTransfer?: import('./interBranchRequest').PosStockTransferSettings;
|
|
485
487
|
getTaxConfig(country?: string): TaxSettings;
|
|
486
488
|
calculateTax(subtotal: number, country?: string): {
|
|
487
489
|
taxAmount: number;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export type InterBranchRequestStatus = 'requested' | 'acknowledged' | 'sent' | 'received' | 'rejected' | 'cancelled';
|
|
2
|
+
export type InterBranchRequestMode = 'transfer' | 'info';
|
|
3
|
+
export interface InterBranchRequestItem {
|
|
4
|
+
productId: string;
|
|
5
|
+
variantId: string;
|
|
6
|
+
name: string;
|
|
7
|
+
variantName?: string;
|
|
8
|
+
isStockTracked: boolean;
|
|
9
|
+
unitCost: number;
|
|
10
|
+
requestedQty: number;
|
|
11
|
+
sentQty?: number;
|
|
12
|
+
receivedQty?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface PosStockTransferSettings {
|
|
15
|
+
enabled: boolean;
|
|
16
|
+
allowedModes: 'info' | 'transfer' | 'both';
|
|
17
|
+
senderBranchIds?: string[];
|
|
18
|
+
}
|
|
19
|
+
/** Branch ids a POS may request FROM, given the setting. A strict whitelist:
|
|
20
|
+
* EMPTY = no branch is selectable (the vendor must explicitly configure sources).
|
|
21
|
+
* Used by the POS to build the target dropdown and by the server to validate the
|
|
22
|
+
* request's toBranchId. */
|
|
23
|
+
export declare function allowedSenderBranchIds(settings: PosStockTransferSettings | null | undefined): string[];
|
|
24
|
+
/** The request modes a POS may create given the vendor setting. Empty = feature
|
|
25
|
+
* disabled → no requests at all. Used by both the POS (to gate the UI) and the
|
|
26
|
+
* server (to validate the create payload). */
|
|
27
|
+
export declare function allowedRequestModes(settings: PosStockTransferSettings | null | undefined): InterBranchRequestMode[];
|
|
28
|
+
export interface InterBranchRequest {
|
|
29
|
+
_id?: string;
|
|
30
|
+
vendorId: string;
|
|
31
|
+
fromBranchId: string;
|
|
32
|
+
toBranchId: string;
|
|
33
|
+
requestNumber?: string;
|
|
34
|
+
mode: InterBranchRequestMode;
|
|
35
|
+
items: InterBranchRequestItem[];
|
|
36
|
+
totalValue?: number;
|
|
37
|
+
status: InterBranchRequestStatus;
|
|
38
|
+
note?: string;
|
|
39
|
+
createdByTerminalId?: string;
|
|
40
|
+
createdByName?: string;
|
|
41
|
+
acknowledgedAt?: string;
|
|
42
|
+
acknowledgedByName?: string;
|
|
43
|
+
sentAt?: string;
|
|
44
|
+
receivedAt?: string;
|
|
45
|
+
receivedByName?: string;
|
|
46
|
+
stockTransferId?: string;
|
|
47
|
+
printCount?: number;
|
|
48
|
+
createdAt?: string;
|
|
49
|
+
updatedAt?: string;
|
|
50
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Inter-branch item requests — shared shapes for the POS-to-POS cross-branch
|
|
3
|
+
// request feature (POS / dashboard / server). A terminal at the REQUESTER branch
|
|
4
|
+
// asks the FULFILLER branch to send items; goods flow fulfiller → requester.
|
|
5
|
+
// Completes the `in_transit`/`received` workflow the StockTransfer model reserved.
|
|
6
|
+
// IDs are strings (JSON), not ObjectIds.
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.allowedSenderBranchIds = allowedSenderBranchIds;
|
|
9
|
+
exports.allowedRequestModes = allowedRequestModes;
|
|
10
|
+
/** Branch ids a POS may request FROM, given the setting. A strict whitelist:
|
|
11
|
+
* EMPTY = no branch is selectable (the vendor must explicitly configure sources).
|
|
12
|
+
* Used by the POS to build the target dropdown and by the server to validate the
|
|
13
|
+
* request's toBranchId. */
|
|
14
|
+
function allowedSenderBranchIds(settings) {
|
|
15
|
+
return (settings?.senderBranchIds || []).map(String);
|
|
16
|
+
}
|
|
17
|
+
/** The request modes a POS may create given the vendor setting. Empty = feature
|
|
18
|
+
* disabled → no requests at all. Used by both the POS (to gate the UI) and the
|
|
19
|
+
* server (to validate the create payload). */
|
|
20
|
+
function allowedRequestModes(settings) {
|
|
21
|
+
if (!settings?.enabled)
|
|
22
|
+
return [];
|
|
23
|
+
if (settings.allowedModes === 'both')
|
|
24
|
+
return ['transfer', 'info'];
|
|
25
|
+
return [settings.allowedModes];
|
|
26
|
+
}
|