@merkaly/api 0.28.0 → 0.28.2

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.
@@ -0,0 +1,47 @@
1
+ import type { PaymentAccountBalance, PaymentAccountStatus } from '../../integration/payment';
2
+ import type { SupplierConnectionStatus } from '../../integration/supplier';
3
+ import type { OrderSaleAttentionEnum } from '../../order/sale';
4
+ import type { OrderSaleStatusEnum } from '../../order/sale';
5
+ import type { OrderSaleAttentionSummary } from '../../order/sale';
6
+ export interface DashboardHomeDay {
7
+ date: string;
8
+ orders: number;
9
+ revenue: number;
10
+ }
11
+ export interface DashboardHomePeriod {
12
+ days: number;
13
+ from: Date;
14
+ to: Date;
15
+ orders: number;
16
+ revenue: number;
17
+ profit: number;
18
+ margin: number | null;
19
+ withoutCost: number;
20
+ series: DashboardHomeDay[];
21
+ }
22
+ export interface DashboardHomeSale {
23
+ _id: string;
24
+ number: string;
25
+ createdAt: Date;
26
+ customer: string | null;
27
+ total: number;
28
+ profit: number | null;
29
+ status: OrderSaleStatusEnum;
30
+ attention: OrderSaleAttentionEnum | null;
31
+ }
32
+ export interface DashboardHomeIntegrations {
33
+ supplier: SupplierConnectionStatus | null;
34
+ payment: PaymentAccountStatus | null;
35
+ balance: PaymentAccountBalance | null;
36
+ failures: ('supplier' | 'payment' | 'balance')[];
37
+ }
38
+ export interface DashboardHomeOnboarding {
39
+ products: number;
40
+ sales: number;
41
+ }
42
+ export interface DashboardHome {
43
+ attention: OrderSaleAttentionSummary;
44
+ recent: DashboardHomeSale[];
45
+ integrations: DashboardHomeIntegrations;
46
+ onboarding: DashboardHomeOnboarding;
47
+ }
@@ -0,0 +1,2 @@
1
+ export * from './home';
2
+ export * from './period.request.validator';
@@ -0,0 +1 @@
1
+ export * from './period.request.validator.js';
@@ -0,0 +1,5 @@
1
+ import { AbstractRequestValidator } from '../../abstract.validator.js';
2
+ export declare const DASHBOARD_PERIOD_DAYS: readonly [7, 30, 90];
3
+ export declare class DashboardPeriodRequestValidator extends AbstractRequestValidator {
4
+ days?: (typeof DASHBOARD_PERIOD_DAYS)[number];
5
+ }
@@ -0,0 +1,23 @@
1
+ import 'reflect-metadata';
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ import * as class_transformer_1 from "class-transformer";
12
+ import * as class_validator_1 from "class-validator";
13
+ import * as abstract_validator_1 from '../../abstract.validator.js';
14
+ export const DASHBOARD_PERIOD_DAYS = [7, 30, 90];
15
+ export class DashboardPeriodRequestValidator extends abstract_validator_1.AbstractRequestValidator {
16
+ days = 30;
17
+ }
18
+ __decorate([
19
+ (0, class_validator_1.IsIn)(DASHBOARD_PERIOD_DAYS),
20
+ (0, class_validator_1.IsOptional)(),
21
+ (0, class_transformer_1.Type)(() => Number),
22
+ __metadata("design:type", Object)
23
+ ], DashboardPeriodRequestValidator.prototype, "days", void 0);
package/dist/index.d.ts CHANGED
@@ -15,6 +15,7 @@ export * from './account/user';
15
15
  export * from './assets/asset';
16
16
  export * from './contact/customer';
17
17
  export * from './contact/vendor';
18
+ export * from './dashboard/home';
18
19
  export * from './finance/payment';
19
20
  export * from './integration/supplier';
20
21
  export * from './integration/payment';
package/dist/index.js CHANGED
@@ -7,6 +7,7 @@ export * from './account/user/index.js';
7
7
  export * from './assets/asset/index.js';
8
8
  export * from './contact/customer/index.js';
9
9
  export * from './contact/vendor/index.js';
10
+ export * from './dashboard/home/index.js';
10
11
  export * from './finance/payment/index.js';
11
12
  export * from './integration/supplier/index.js';
12
13
  export * from './integration/payment/index.js';
@@ -6,5 +6,6 @@ export declare enum OrderSaleAttentionEnum {
6
6
  PAYMENT_TO_CONFIRM = "PAYMENT_TO_CONFIRM",
7
7
  SHIPMENT_DELAYED = "SHIPMENT_DELAYED"
8
8
  }
9
+ export declare const SALE_ACTIONABLE_ATTENTIONS: readonly OrderSaleAttentionEnum[];
9
10
  export declare const SALE_SHIPMENT_DELAY_DAYS = 7;
10
11
  export declare const SALE_PAYMENT_CONFIRM_DAYS = 7;
@@ -7,5 +7,12 @@ export var OrderSaleAttentionEnum;
7
7
  OrderSaleAttentionEnum["PAYMENT_TO_CONFIRM"] = "PAYMENT_TO_CONFIRM";
8
8
  OrderSaleAttentionEnum["SHIPMENT_DELAYED"] = "SHIPMENT_DELAYED";
9
9
  })(OrderSaleAttentionEnum || (OrderSaleAttentionEnum = {}));
10
+ export const SALE_ACTIONABLE_ATTENTIONS = [
11
+ OrderSaleAttentionEnum.SUPPLIER_ORDER_FAILED,
12
+ OrderSaleAttentionEnum.SUPPLIER_PAYMENT_PENDING,
13
+ OrderSaleAttentionEnum.SHIPMENT_EXCEPTION,
14
+ OrderSaleAttentionEnum.TO_ORDER,
15
+ OrderSaleAttentionEnum.PAYMENT_TO_CONFIRM,
16
+ ];
10
17
  export const SALE_SHIPMENT_DELAY_DAYS = 7;
11
18
  export const SALE_PAYMENT_CONFIRM_DAYS = 7;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@merkaly/api",
3
- "version": "0.28.0",
3
+ "version": "0.28.2",
4
4
  "type": "module",
5
5
  "description": "Shared TypeScript interfaces and enums for Merkaly API",
6
6
  "repository": {