@merkaly/api 0.38.0 → 0.39.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/dist/dashboard/home/home.d.ts +15 -0
- package/dist/order/purchase/purchase.entity.d.ts +15 -2
- package/dist/order/sale/fulfillment.d.ts +8 -2
- package/dist/order/sale/fulfillment.enum.d.ts +4 -0
- package/dist/order/sale/fulfillment.enum.js +5 -0
- package/dist/order/sale/sale.entity.d.ts +2 -1
- package/dist/order/sale/sale.enum.d.ts +7 -0
- package/dist/order/sale/sale.enum.js +8 -0
- package/package.json +2 -2
|
@@ -7,6 +7,19 @@ export interface DashboardHomeDay {
|
|
|
7
7
|
date: string;
|
|
8
8
|
orders: number;
|
|
9
9
|
revenue: number;
|
|
10
|
+
profit: number;
|
|
11
|
+
}
|
|
12
|
+
export interface DashboardHomePeriodTotals {
|
|
13
|
+
orders: number;
|
|
14
|
+
revenue: number;
|
|
15
|
+
profit: number;
|
|
16
|
+
}
|
|
17
|
+
export interface DashboardHomeTopProduct {
|
|
18
|
+
product: string;
|
|
19
|
+
name: string;
|
|
20
|
+
image: string | null;
|
|
21
|
+
units: number;
|
|
22
|
+
revenue: number;
|
|
10
23
|
}
|
|
11
24
|
export interface DashboardHomePeriod {
|
|
12
25
|
days: number;
|
|
@@ -18,6 +31,8 @@ export interface DashboardHomePeriod {
|
|
|
18
31
|
margin: number | null;
|
|
19
32
|
withoutCost: number;
|
|
20
33
|
series: DashboardHomeDay[];
|
|
34
|
+
previous: DashboardHomePeriodTotals;
|
|
35
|
+
top: DashboardHomeTopProduct[];
|
|
21
36
|
}
|
|
22
37
|
export interface DashboardHomeSale {
|
|
23
38
|
_id: string;
|
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
import { Schema as MongoSchema } from 'mongoose';
|
|
2
2
|
import { ContactVendorEntity } from '../../contact/vendor';
|
|
3
|
-
import { SupplierProviderEnum } from '../../integration/supplier';
|
|
3
|
+
import { SupplierErrorCodeEnum, SupplierProviderEnum } from '../../integration/supplier';
|
|
4
4
|
import { ItemEntity } from '../item';
|
|
5
5
|
import { TransactionEntity } from '../../transaction.entity.js';
|
|
6
6
|
import { OrderPurchaseStatusEnum } from './purchase.enum.js';
|
|
7
7
|
import type { OrderSaleEntity } from '../sale';
|
|
8
|
+
export declare class OrderPurchaseSupplierErrorEntity {
|
|
9
|
+
code: SupplierErrorCodeEnum | null;
|
|
10
|
+
message: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const OrderPurchaseSupplierErrorSchema: MongoSchema<OrderPurchaseSupplierErrorEntity, import("mongoose").Model<OrderPurchaseSupplierErrorEntity, any, any, any, import("mongoose").Document<unknown, any, OrderPurchaseSupplierErrorEntity, any, {}> & OrderPurchaseSupplierErrorEntity & {
|
|
13
|
+
_id: import("mongoose").Types.ObjectId;
|
|
14
|
+
} & {
|
|
15
|
+
__v: number;
|
|
16
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, OrderPurchaseSupplierErrorEntity, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<OrderPurchaseSupplierErrorEntity>, {}, import("mongoose").DefaultSchemaOptions> & import("mongoose").FlatRecord<OrderPurchaseSupplierErrorEntity> & {
|
|
17
|
+
_id: import("mongoose").Types.ObjectId;
|
|
18
|
+
} & {
|
|
19
|
+
__v: number;
|
|
20
|
+
}>;
|
|
8
21
|
export declare class OrderPurchaseSupplierOrderEntity {
|
|
9
22
|
provider: SupplierProviderEnum;
|
|
10
23
|
orderIds: string[];
|
|
@@ -13,7 +26,7 @@ export declare class OrderPurchaseSupplierOrderEntity {
|
|
|
13
26
|
placedAt: Date;
|
|
14
27
|
syncedAt?: Date;
|
|
15
28
|
payExpiryDate?: Date;
|
|
16
|
-
error?:
|
|
29
|
+
error?: OrderPurchaseSupplierErrorEntity | null;
|
|
17
30
|
paidAfterCancelAt?: Date;
|
|
18
31
|
}
|
|
19
32
|
export declare const OrderPurchaseSupplierOrderSchema: MongoSchema<OrderPurchaseSupplierOrderEntity, import("mongoose").Model<OrderPurchaseSupplierOrderEntity, any, any, any, import("mongoose").Document<unknown, any, OrderPurchaseSupplierOrderEntity, any, {}> & OrderPurchaseSupplierOrderEntity & {
|
|
@@ -2,9 +2,9 @@ import type { FinancePaymentStatusEnum } from '../../finance/payment';
|
|
|
2
2
|
import type { FinanceRefundOriginEnum, FinanceRefundStatusEnum } from '../../finance/refund';
|
|
3
3
|
import type { LogisticsShipmentEntity } from '../../logistics/shipment';
|
|
4
4
|
import type { LogisticsBuyerShipment } from '../../logistics/shipment';
|
|
5
|
-
import type { OrderBuyerStageEnum, OrderFulfillmentActionEnum, OrderSaleCostSourceEnum, OrderSaleHistoryEventEnum } from './fulfillment.enum.js';
|
|
5
|
+
import type { OrderBuyerCancellationActionEnum, OrderBuyerStageEnum, OrderFulfillmentActionEnum, OrderSaleCostSourceEnum, OrderSaleHistoryEventEnum } from './fulfillment.enum.js';
|
|
6
6
|
import type { OrderPurchaseStatusEnum } from '../purchase';
|
|
7
|
-
import type { OrderSaleStatusEnum } from './sale.enum.js';
|
|
7
|
+
import type { OrderSaleCancelByEnum, OrderSaleStatusEnum } from './sale.enum.js';
|
|
8
8
|
import type { OrderSaleReceipt } from './receipt.js';
|
|
9
9
|
export interface OrderSaleCosts {
|
|
10
10
|
products: number;
|
|
@@ -31,6 +31,7 @@ export interface OrderSaleHistoryEntry {
|
|
|
31
31
|
purchase?: string;
|
|
32
32
|
status?: OrderPurchaseStatusEnum;
|
|
33
33
|
trackingNumber?: string;
|
|
34
|
+
cancelledBy?: OrderSaleCancelByEnum | null;
|
|
34
35
|
}
|
|
35
36
|
export interface OrderSaleRefundSummary {
|
|
36
37
|
amount: number;
|
|
@@ -87,10 +88,15 @@ export interface OrderBuyerPricing {
|
|
|
87
88
|
fee: number | null;
|
|
88
89
|
buyerTotal: number;
|
|
89
90
|
}
|
|
91
|
+
export interface OrderBuyerCancellation {
|
|
92
|
+
action: OrderBuyerCancellationActionEnum | null;
|
|
93
|
+
until: Date | null;
|
|
94
|
+
}
|
|
90
95
|
export interface OrderBuyerFulfillment {
|
|
91
96
|
status: OrderSaleStatusEnum;
|
|
92
97
|
packages: OrderBuyerPackage[];
|
|
93
98
|
shipments: LogisticsBuyerShipment[];
|
|
94
99
|
orderedAt: Date | null;
|
|
95
100
|
receipt: OrderSaleReceipt;
|
|
101
|
+
cancellation: OrderBuyerCancellation;
|
|
96
102
|
}
|
|
@@ -8,6 +8,10 @@ export declare enum OrderBuyerStageEnum {
|
|
|
8
8
|
CANCELLED = "CANCELLED"
|
|
9
9
|
}
|
|
10
10
|
export declare const BUYER_STAGE_GROUPS: Readonly<Record<OrderBuyerStageEnum, readonly Status[]>>;
|
|
11
|
+
export declare enum OrderBuyerCancellationActionEnum {
|
|
12
|
+
CANCEL = "CANCEL",
|
|
13
|
+
REFUND = "REFUND"
|
|
14
|
+
}
|
|
11
15
|
export declare enum OrderFulfillmentActionEnum {
|
|
12
16
|
PROCURE = "PROCURE",
|
|
13
17
|
PLACE_SUPPLIER_ORDER = "PLACE_SUPPLIER_ORDER",
|
|
@@ -16,6 +16,11 @@ export const BUYER_STAGE_GROUPS = {
|
|
|
16
16
|
[OrderBuyerStageEnum.DELIVERED]: [sale_enum_1.OrderSaleStatusEnum.DELIVERED],
|
|
17
17
|
[OrderBuyerStageEnum.CANCELLED]: [sale_enum_1.OrderSaleStatusEnum.CANCELLED],
|
|
18
18
|
};
|
|
19
|
+
export var OrderBuyerCancellationActionEnum;
|
|
20
|
+
(function (OrderBuyerCancellationActionEnum) {
|
|
21
|
+
OrderBuyerCancellationActionEnum["CANCEL"] = "CANCEL";
|
|
22
|
+
OrderBuyerCancellationActionEnum["REFUND"] = "REFUND";
|
|
23
|
+
})(OrderBuyerCancellationActionEnum || (OrderBuyerCancellationActionEnum = {}));
|
|
19
24
|
export var OrderFulfillmentActionEnum;
|
|
20
25
|
(function (OrderFulfillmentActionEnum) {
|
|
21
26
|
OrderFulfillmentActionEnum["PROCURE"] = "PROCURE";
|
|
@@ -2,7 +2,7 @@ import { Schema as MongoSchema } from 'mongoose';
|
|
|
2
2
|
import { ContactCustomerEntity } from '../../contact/customer';
|
|
3
3
|
import { ItemEntity } from '../item';
|
|
4
4
|
import { TransactionEntity } from '../../transaction.entity.js';
|
|
5
|
-
import { OrderSaleSourceEnum, OrderSaleStatusEnum } from './sale.enum.js';
|
|
5
|
+
import { OrderSaleCancelByEnum, OrderSaleSourceEnum, OrderSaleStatusEnum } from './sale.enum.js';
|
|
6
6
|
import type { OrderPurchaseEntity } from '../purchase';
|
|
7
7
|
export declare class OrderSaleDeliveryRecipientEntity {
|
|
8
8
|
name: string;
|
|
@@ -88,6 +88,7 @@ export declare class OrderSaleEntity extends TransactionEntity<OrderSaleStatusEn
|
|
|
88
88
|
items: ItemEntity[];
|
|
89
89
|
delivery?: OrderSaleDeliveryEntity;
|
|
90
90
|
cancelledAt?: Date | null;
|
|
91
|
+
cancelledBy?: OrderSaleCancelByEnum | null;
|
|
91
92
|
source: OrderSaleSourceEnum;
|
|
92
93
|
readonly purchases: OrderPurchaseEntity[];
|
|
93
94
|
readonly cost: number | null;
|
|
@@ -10,6 +10,13 @@ export declare enum OrderSaleStatusEnum {
|
|
|
10
10
|
}
|
|
11
11
|
export declare const SALE_OPEN_STATUSES: readonly OrderSaleStatusEnum[];
|
|
12
12
|
export declare const SALE_CANCELLABLE_STATUSES: readonly OrderSaleStatusEnum[];
|
|
13
|
+
export declare enum OrderSaleCancelByEnum {
|
|
14
|
+
BUYER = "BUYER",
|
|
15
|
+
MERCHANT = "MERCHANT",
|
|
16
|
+
SUPPLIER = "SUPPLIER"
|
|
17
|
+
}
|
|
18
|
+
export declare const SALE_REFUND_DAYS = 7;
|
|
19
|
+
export declare const SALE_REFUND_MS: number;
|
|
13
20
|
export declare const WITHDRAWAL_HOLD_DAYS = 7;
|
|
14
21
|
export declare const WITHDRAWAL_HOLD_MS: number;
|
|
15
22
|
export declare enum OrderSaleSourceEnum {
|
|
@@ -24,6 +24,14 @@ export const SALE_CANCELLABLE_STATUSES = [
|
|
|
24
24
|
OrderSaleStatusEnum.ORDERED,
|
|
25
25
|
OrderSaleStatusEnum.SUPPLIER_CANCELLED,
|
|
26
26
|
];
|
|
27
|
+
export var OrderSaleCancelByEnum;
|
|
28
|
+
(function (OrderSaleCancelByEnum) {
|
|
29
|
+
OrderSaleCancelByEnum["BUYER"] = "BUYER";
|
|
30
|
+
OrderSaleCancelByEnum["MERCHANT"] = "MERCHANT";
|
|
31
|
+
OrderSaleCancelByEnum["SUPPLIER"] = "SUPPLIER";
|
|
32
|
+
})(OrderSaleCancelByEnum || (OrderSaleCancelByEnum = {}));
|
|
33
|
+
export const SALE_REFUND_DAYS = 7;
|
|
34
|
+
export const SALE_REFUND_MS = SALE_REFUND_DAYS * 86_400_000;
|
|
27
35
|
export const WITHDRAWAL_HOLD_DAYS = 7;
|
|
28
36
|
export const WITHDRAWAL_HOLD_MS = WITHDRAWAL_HOLD_DAYS * 86_400_000;
|
|
29
37
|
export var OrderSaleSourceEnum;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@merkaly/api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.39.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Shared TypeScript interfaces and enums for Merkaly API",
|
|
6
6
|
"repository": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/node": "^26.6.1",
|
|
33
33
|
"changelogen": "^0.6.2",
|
|
34
|
-
"oxlint": "^1.
|
|
34
|
+
"oxlint": "^1.94.0",
|
|
35
35
|
"tsx": "^4.23.0",
|
|
36
36
|
"typescript": "^7.0.2"
|
|
37
37
|
},
|