@ibiliaze/global-vars 1.207.0 → 1.209.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.
|
@@ -709,13 +709,6 @@ export interface RoleBase<Id, TDate> {
|
|
|
709
709
|
createdAt?: TDate;
|
|
710
710
|
updatedAt?: TDate;
|
|
711
711
|
}
|
|
712
|
-
export interface SaleItemBase<Id> {
|
|
713
|
-
itemId: Id;
|
|
714
|
-
itemName: string;
|
|
715
|
-
itemType: 'product' | 'ticket' | 'project';
|
|
716
|
-
amount: number;
|
|
717
|
-
quantity: number;
|
|
718
|
-
}
|
|
719
712
|
export interface ItemBase<Id, TDate> {
|
|
720
713
|
_id?: Id;
|
|
721
714
|
cartId: string;
|
|
@@ -731,48 +724,32 @@ export interface ItemBase<Id, TDate> {
|
|
|
731
724
|
createdAt?: TDate;
|
|
732
725
|
updatedAt?: TDate;
|
|
733
726
|
}
|
|
727
|
+
export interface SaleItemBase<Id> {
|
|
728
|
+
itemId: Id;
|
|
729
|
+
itemName: string;
|
|
730
|
+
itemType: 'product' | 'ticket' | 'project';
|
|
731
|
+
amount: number;
|
|
732
|
+
quantity: number;
|
|
733
|
+
}
|
|
734
734
|
export interface SaleBase<Id, TDate> {
|
|
735
735
|
_id?: Id;
|
|
736
|
-
customerId: Id;
|
|
737
|
-
email: string;
|
|
738
|
-
saleName?: string;
|
|
739
|
-
name?: string;
|
|
740
|
-
surname?: string;
|
|
741
|
-
tel?: string;
|
|
742
|
-
address?: string;
|
|
743
|
-
promoCode?: string;
|
|
744
|
-
promoDiscount?: string;
|
|
745
736
|
subscription: boolean;
|
|
746
737
|
orderId: string;
|
|
738
|
+
promoCodeId?: Id;
|
|
747
739
|
newClient?: boolean;
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
740
|
+
customer: Pick<CustomerBase<Id, TDate>, '_id' | 'name' | 'surname' | 'email' | 'tel'>;
|
|
741
|
+
item?: Pick<ItemBase<Id, TDate>, '_id' | 'name' | 'quantity' | 'price'>;
|
|
742
|
+
category?: Pick<EventCategoryBase<Id>, 'categoryId' | 'name' | 'price' | 'color'>;
|
|
743
|
+
event?: Pick<EventBase<Id, TDate>, '_id' | 'name' | 'date'>;
|
|
744
|
+
section?: Pick<SectionBase<Id, TDate>, '_id' | 'name' | 'area' | 'block' | 'gate' | 'venueId'>;
|
|
745
|
+
seat?: Pick<SeatBase<Id, TDate>, '_id' | 'name'>;
|
|
746
|
+
occupance?: Pick<OccupanceBase<Id, TDate>, '_id'>;
|
|
747
|
+
season?: Pick<SeasonBase<Id, TDate>, '_id' | 'name'>;
|
|
748
|
+
flow?: Pick<FlowBase<Id, TDate>, '_id' | 'name' | 'type'>;
|
|
749
|
+
product?: Pick<ProductBase<Id, TDate>, '_id' | 'productName' | 'price'>;
|
|
751
750
|
createdAt?: TDate;
|
|
752
751
|
updatedAt?: TDate;
|
|
753
752
|
}
|
|
754
|
-
export interface SaleInsightData {
|
|
755
|
-
period: string;
|
|
756
|
-
salesData: {
|
|
757
|
-
[key: string]: number;
|
|
758
|
-
} | null;
|
|
759
|
-
expensesData: {
|
|
760
|
-
[key: string]: number;
|
|
761
|
-
} | null;
|
|
762
|
-
totalSales: number | null;
|
|
763
|
-
totalExpenses: number | null;
|
|
764
|
-
numberOfSalesData: {
|
|
765
|
-
[key: string]: number;
|
|
766
|
-
} | null;
|
|
767
|
-
numberOfExpensesData: {
|
|
768
|
-
[key: string]: number;
|
|
769
|
-
} | null;
|
|
770
|
-
growthData: {
|
|
771
|
-
[key: string]: number;
|
|
772
|
-
} | null;
|
|
773
|
-
numberOfSales: number | null;
|
|
774
|
-
numberOfExpenses: number | null;
|
|
775
|
-
}
|
|
776
753
|
export interface SectionBase<Id, TDate> {
|
|
777
754
|
_id?: Id;
|
|
778
755
|
name: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SaleBase
|
|
1
|
+
import type { SaleBase } from '../inputsDefault';
|
|
2
2
|
import type { SaleCustomer, SaleFlows, SalePayments, SalePerformanceBase, SaleRevenue, SaleSectors } from '../sale';
|
|
3
3
|
export declare const saleRoleDefs: <TId, TDate>() => readonly [{
|
|
4
4
|
readonly method: "post";
|
|
@@ -142,19 +142,6 @@ export declare const saleRoleDefs: <TId, TDate>() => readonly [{
|
|
|
142
142
|
readonly response_404: {
|
|
143
143
|
message: string;
|
|
144
144
|
};
|
|
145
|
-
}, {
|
|
146
|
-
readonly method: "get";
|
|
147
|
-
readonly path: "/sale/insight/:period/:date";
|
|
148
|
-
readonly role: "getSaleInsightByPeriodDate";
|
|
149
|
-
readonly name: "Get sale insights";
|
|
150
|
-
readonly response_200: SaleInsightData;
|
|
151
|
-
readonly response_400: {
|
|
152
|
-
message: string;
|
|
153
|
-
};
|
|
154
|
-
readonly response_500: {
|
|
155
|
-
message: string;
|
|
156
|
-
error: string;
|
|
157
|
-
};
|
|
158
145
|
}, {
|
|
159
146
|
readonly method: "put";
|
|
160
147
|
readonly path: "/sale/:id";
|
|
@@ -91,15 +91,6 @@ const saleRoleDefs = () => {
|
|
|
91
91
|
response_200: {},
|
|
92
92
|
response_404: {},
|
|
93
93
|
},
|
|
94
|
-
{
|
|
95
|
-
method: 'get',
|
|
96
|
-
path: '/sale/insight/:period/:date',
|
|
97
|
-
role: 'getSaleInsightByPeriodDate',
|
|
98
|
-
name: 'Get sale insights',
|
|
99
|
-
response_200: {},
|
|
100
|
-
response_400: {},
|
|
101
|
-
response_500: {},
|
|
102
|
-
},
|
|
103
94
|
{
|
|
104
95
|
method: 'put',
|
|
105
96
|
path: '/sale/:id',
|
|
@@ -1734,19 +1734,6 @@ export declare const apis: <TId, TDate>() => readonly [{
|
|
|
1734
1734
|
readonly response_404: {
|
|
1735
1735
|
message: string;
|
|
1736
1736
|
};
|
|
1737
|
-
}, {
|
|
1738
|
-
readonly method: "get";
|
|
1739
|
-
readonly path: "/sale/insight/:period/:date";
|
|
1740
|
-
readonly role: "getSaleInsightByPeriodDate";
|
|
1741
|
-
readonly name: "Get sale insights";
|
|
1742
|
-
readonly response_200: import("./inputsDefault").SaleInsightData;
|
|
1743
|
-
readonly response_400: {
|
|
1744
|
-
message: string;
|
|
1745
|
-
};
|
|
1746
|
-
readonly response_500: {
|
|
1747
|
-
message: string;
|
|
1748
|
-
error: string;
|
|
1749
|
-
};
|
|
1750
1737
|
}, {
|
|
1751
1738
|
readonly method: "put";
|
|
1752
1739
|
readonly path: "/sale/:id";
|
|
@@ -4382,19 +4369,6 @@ declare const allApis: readonly [{
|
|
|
4382
4369
|
readonly response_404: {
|
|
4383
4370
|
message: string;
|
|
4384
4371
|
};
|
|
4385
|
-
}, {
|
|
4386
|
-
readonly method: "get";
|
|
4387
|
-
readonly path: "/sale/insight/:period/:date";
|
|
4388
|
-
readonly role: "getSaleInsightByPeriodDate";
|
|
4389
|
-
readonly name: "Get sale insights";
|
|
4390
|
-
readonly response_200: import("./inputsDefault").SaleInsightData;
|
|
4391
|
-
readonly response_400: {
|
|
4392
|
-
message: string;
|
|
4393
|
-
};
|
|
4394
|
-
readonly response_500: {
|
|
4395
|
-
message: string;
|
|
4396
|
-
error: string;
|
|
4397
|
-
};
|
|
4398
4372
|
}, {
|
|
4399
4373
|
readonly method: "put";
|
|
4400
4374
|
readonly path: "/sale/:id";
|
package/dist/ticketops/sale.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { DayOfWeek } from '../globals';
|
|
2
|
+
import { SaleBase } from './inputsDefault';
|
|
3
|
+
export declare function getPrice<TId, Tdate>({ sale }: {
|
|
4
|
+
sale: SaleBase<TId, Tdate>;
|
|
5
|
+
}): number;
|
|
2
6
|
export type SaleRevenue = {
|
|
3
7
|
totalTicketsSold: number;
|
|
4
8
|
numberofEvents: number;
|
|
@@ -24,7 +28,7 @@ export type SalePerformanceBase<TDate> = {
|
|
|
24
28
|
name: string;
|
|
25
29
|
ticketsSold: number;
|
|
26
30
|
}[];
|
|
27
|
-
occupancy:
|
|
31
|
+
occupancy: number;
|
|
28
32
|
}[];
|
|
29
33
|
};
|
|
30
34
|
export type SegmentType = 'New customers' | 'Returning (2–3 events)' | 'Frequent (4+ events)' | 'Corporate accounts';
|
|
@@ -33,7 +37,7 @@ export type SaleCustomer = {
|
|
|
33
37
|
uniqueCustomersRateVsLastMonth: number;
|
|
34
38
|
repeatCustomers: number;
|
|
35
39
|
repeatCustomersRate: number;
|
|
36
|
-
averageTicketsPerCustomer:
|
|
40
|
+
averageTicketsPerCustomer: number;
|
|
37
41
|
segments: {
|
|
38
42
|
type: SegmentType;
|
|
39
43
|
customers: number;
|
package/dist/ticketops/sale.js
CHANGED
|
@@ -1,2 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPrice = getPrice;
|
|
4
|
+
function getPrice({ sale }) {
|
|
5
|
+
try {
|
|
6
|
+
let price = 0;
|
|
7
|
+
if (sale?.product?.price)
|
|
8
|
+
price = sale?.product?.price;
|
|
9
|
+
if (sale?.category?.price)
|
|
10
|
+
price = sale?.category?.price;
|
|
11
|
+
if (sale?.item?.price)
|
|
12
|
+
price = sale?.item?.price;
|
|
13
|
+
return price;
|
|
14
|
+
}
|
|
15
|
+
catch (e) {
|
|
16
|
+
console.error(e);
|
|
17
|
+
return 0;
|
|
18
|
+
}
|
|
19
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ibiliaze/global-vars",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.209.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"scripts": {
|
|
23
23
|
"build": "tsc",
|
|
24
24
|
"pub": "npm publish --access public",
|
|
25
|
-
"git": "git add .; git commit -m 'changes'; git tag -a v1.
|
|
25
|
+
"git": "git add .; git commit -m 'changes'; git tag -a v1.209.0 -m 'v1.209.0'; git push origin v1.209.0; git push",
|
|
26
26
|
"push": "npm run build; npm run git; npm run pub"
|
|
27
27
|
},
|
|
28
28
|
"author": "Ibi Hasanli",
|