@viridial/shared 1.0.25 → 1.0.27
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/api/billing.service.d.ts +82 -0
- package/dist/api/billing.service.d.ts.map +1 -0
- package/dist/api/billing.service.js +152 -0
- package/dist/api/stats.service.d.ts +11 -0
- package/dist/api/stats.service.d.ts.map +1 -0
- package/dist/api/stats.service.js +14 -0
- package/dist/constants/api.constants.d.ts +29 -0
- package/dist/constants/api.constants.d.ts.map +1 -1
- package/dist/constants/api.constants.js +31 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/types/billing.types.d.ts +63 -0
- package/dist/types/billing.types.d.ts.map +1 -0
- package/dist/types/billing.types.js +4 -0
- package/dist/types/stats.types.d.ts +38 -0
- package/dist/types/stats.types.d.ts.map +1 -0
- package/dist/types/stats.types.js +4 -0
- package/package.json +1 -1
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { Subscription, Invoice, Plan, BillingStats, SubscriptionCreate, SubscriptionUpdate } from '../types/billing.types';
|
|
2
|
+
/**
|
|
3
|
+
* Service de gestion de la facturation
|
|
4
|
+
*/
|
|
5
|
+
export declare const billingService: {
|
|
6
|
+
/**
|
|
7
|
+
* Récupérer toutes les abonnements
|
|
8
|
+
* Note: Le backend n'a pas d'endpoint GET /api/billing/subscriptions
|
|
9
|
+
* On utilise /expiring avec une date très lointaine comme workaround
|
|
10
|
+
*/
|
|
11
|
+
getAllSubscriptions(params?: {
|
|
12
|
+
organizationId?: number;
|
|
13
|
+
status?: string;
|
|
14
|
+
page?: number;
|
|
15
|
+
size?: number;
|
|
16
|
+
}): Promise<Subscription[]>;
|
|
17
|
+
/**
|
|
18
|
+
* Récupérer un abonnement par ID
|
|
19
|
+
*/
|
|
20
|
+
getSubscriptionById(id: number): Promise<Subscription>;
|
|
21
|
+
/**
|
|
22
|
+
* Récupérer l'abonnement actif d'une organisation
|
|
23
|
+
*/
|
|
24
|
+
getActiveSubscriptionByOrganization(organizationId: number): Promise<Subscription>;
|
|
25
|
+
/**
|
|
26
|
+
* Créer un abonnement
|
|
27
|
+
*/
|
|
28
|
+
createSubscription(data: SubscriptionCreate): Promise<Subscription>;
|
|
29
|
+
/**
|
|
30
|
+
* Mettre à jour un abonnement
|
|
31
|
+
*/
|
|
32
|
+
updateSubscription(id: number, data: SubscriptionUpdate): Promise<Subscription>;
|
|
33
|
+
/**
|
|
34
|
+
* Annuler un abonnement
|
|
35
|
+
*/
|
|
36
|
+
cancelSubscription(id: number, cancelledBy: number): Promise<Subscription>;
|
|
37
|
+
/**
|
|
38
|
+
* Renouveler un abonnement
|
|
39
|
+
*/
|
|
40
|
+
renewSubscription(id: number): Promise<Subscription>;
|
|
41
|
+
/**
|
|
42
|
+
* Récupérer les abonnements expirant bientôt
|
|
43
|
+
*/
|
|
44
|
+
getExpiringSubscriptions(days?: number): Promise<Subscription[]>;
|
|
45
|
+
/**
|
|
46
|
+
* Récupérer toutes les factures
|
|
47
|
+
*/
|
|
48
|
+
getAllInvoices(params?: {
|
|
49
|
+
organizationId?: number;
|
|
50
|
+
subscriptionId?: number;
|
|
51
|
+
status?: string;
|
|
52
|
+
page?: number;
|
|
53
|
+
size?: number;
|
|
54
|
+
}): Promise<Invoice[]>;
|
|
55
|
+
/**
|
|
56
|
+
* Récupérer une facture par ID
|
|
57
|
+
*/
|
|
58
|
+
getInvoiceById(id: number): Promise<Invoice>;
|
|
59
|
+
/**
|
|
60
|
+
* Récupérer les factures d'un abonnement
|
|
61
|
+
*/
|
|
62
|
+
getInvoicesBySubscription(subscriptionId: number): Promise<Invoice[]>;
|
|
63
|
+
/**
|
|
64
|
+
* Marquer une facture comme payée
|
|
65
|
+
*/
|
|
66
|
+
markInvoiceAsPaid(id: number): Promise<Invoice>;
|
|
67
|
+
/**
|
|
68
|
+
* Récupérer les statistiques de facturation
|
|
69
|
+
* Note: Le backend n'a pas d'endpoint stats dédié
|
|
70
|
+
* Les stats sont calculées côté frontend depuis les abonnements
|
|
71
|
+
*/
|
|
72
|
+
getStats(): Promise<BillingStats>;
|
|
73
|
+
/**
|
|
74
|
+
* Récupérer tous les plans
|
|
75
|
+
*/
|
|
76
|
+
getAllPlans(): Promise<Plan[]>;
|
|
77
|
+
/**
|
|
78
|
+
* Récupérer un plan par ID
|
|
79
|
+
*/
|
|
80
|
+
getPlanById(id: number): Promise<Plan>;
|
|
81
|
+
};
|
|
82
|
+
//# sourceMappingURL=billing.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.service.d.ts","sourceRoot":"","sources":["../../api/billing.service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAE/H;;GAEG;AACH,eAAO,MAAM,cAAc;IACzB;;;;OAIG;iCACgC;QACjC,cAAc,CAAC,EAAE,MAAM,CAAA;QACvB,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,IAAI,CAAC,EAAE,MAAM,CAAA;KACd,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAwB3B;;OAEG;4BAC2B,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAK5D;;OAEG;wDACuD,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAOxF;;OAEG;6BAC4B,kBAAkB,GAAG,OAAO,CAAC,YAAY,CAAC;IAKzE;;OAEG;2BAC0B,MAAM,QAAQ,kBAAkB,GAAG,OAAO,CAAC,YAAY,CAAC;IAKrF;;OAEG;2BAC0B,MAAM,eAAe,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAQhF;;OAEG;0BACyB,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAK1D;;OAEG;oCACmC,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAStE;;OAEG;4BAC2B;QAC5B,cAAc,CAAC,EAAE,MAAM,CAAA;QACvB,cAAc,CAAC,EAAE,MAAM,CAAA;QACvB,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,IAAI,CAAC,EAAE,MAAM,CAAA;KACd,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAKtB;;OAEG;uBACsB,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKlD;;OAEG;8CAC6C,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAO3E;;OAEG;0BACyB,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKrD;;;;OAIG;gBACe,OAAO,CAAC,YAAY,CAAC;IA8BvC;;OAEG;mBACkB,OAAO,CAAC,IAAI,EAAE,CAAC;IAKpC;;OAEG;oBACmB,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAI7C,CAAA"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { httpClient } from './http.client';
|
|
2
|
+
import { API_ENDPOINTS } from '../constants/api.constants';
|
|
3
|
+
/**
|
|
4
|
+
* Service de gestion de la facturation
|
|
5
|
+
*/
|
|
6
|
+
export const billingService = {
|
|
7
|
+
/**
|
|
8
|
+
* Récupérer toutes les abonnements
|
|
9
|
+
* Note: Le backend n'a pas d'endpoint GET /api/billing/subscriptions
|
|
10
|
+
* On utilise /expiring avec une date très lointaine comme workaround
|
|
11
|
+
*/
|
|
12
|
+
async getAllSubscriptions(params) {
|
|
13
|
+
// Workaround: utiliser /expiring avec une date très lointaine pour obtenir tous les abonnements
|
|
14
|
+
// TODO: Créer un endpoint GET /api/billing/subscriptions dans le backend
|
|
15
|
+
const futureDate = new Date();
|
|
16
|
+
futureDate.setFullYear(futureDate.getFullYear() + 100); // 100 ans dans le futur
|
|
17
|
+
const response = await httpClient.get(API_ENDPOINTS.BILLING.SUBSCRIPTIONS.EXPIRING, { params: { date: futureDate.toISOString() } });
|
|
18
|
+
let subscriptions = response.data || [];
|
|
19
|
+
// Filtrer par status si fourni
|
|
20
|
+
if (params?.status) {
|
|
21
|
+
subscriptions = subscriptions.filter(s => s.status === params.status);
|
|
22
|
+
}
|
|
23
|
+
// Filtrer par organizationId si fourni
|
|
24
|
+
if (params?.organizationId) {
|
|
25
|
+
subscriptions = subscriptions.filter(s => s.organizationId === params.organizationId);
|
|
26
|
+
}
|
|
27
|
+
return subscriptions;
|
|
28
|
+
},
|
|
29
|
+
/**
|
|
30
|
+
* Récupérer un abonnement par ID
|
|
31
|
+
*/
|
|
32
|
+
async getSubscriptionById(id) {
|
|
33
|
+
const response = await httpClient.get(API_ENDPOINTS.BILLING.SUBSCRIPTIONS.BY_ID(id));
|
|
34
|
+
return response.data;
|
|
35
|
+
},
|
|
36
|
+
/**
|
|
37
|
+
* Récupérer l'abonnement actif d'une organisation
|
|
38
|
+
*/
|
|
39
|
+
async getActiveSubscriptionByOrganization(organizationId) {
|
|
40
|
+
const response = await httpClient.get(API_ENDPOINTS.BILLING.SUBSCRIPTIONS.ACTIVE_BY_ORGANIZATION(organizationId));
|
|
41
|
+
return response.data;
|
|
42
|
+
},
|
|
43
|
+
/**
|
|
44
|
+
* Créer un abonnement
|
|
45
|
+
*/
|
|
46
|
+
async createSubscription(data) {
|
|
47
|
+
const response = await httpClient.post(API_ENDPOINTS.BILLING.SUBSCRIPTIONS.BASE, data);
|
|
48
|
+
return response.data;
|
|
49
|
+
},
|
|
50
|
+
/**
|
|
51
|
+
* Mettre à jour un abonnement
|
|
52
|
+
*/
|
|
53
|
+
async updateSubscription(id, data) {
|
|
54
|
+
const response = await httpClient.put(API_ENDPOINTS.BILLING.SUBSCRIPTIONS.BY_ID(id), data);
|
|
55
|
+
return response.data;
|
|
56
|
+
},
|
|
57
|
+
/**
|
|
58
|
+
* Annuler un abonnement
|
|
59
|
+
*/
|
|
60
|
+
async cancelSubscription(id, cancelledBy) {
|
|
61
|
+
const response = await httpClient.post(API_ENDPOINTS.BILLING.SUBSCRIPTIONS.CANCEL(id), { cancelledBy });
|
|
62
|
+
return response.data;
|
|
63
|
+
},
|
|
64
|
+
/**
|
|
65
|
+
* Renouveler un abonnement
|
|
66
|
+
*/
|
|
67
|
+
async renewSubscription(id) {
|
|
68
|
+
const response = await httpClient.post(API_ENDPOINTS.BILLING.SUBSCRIPTIONS.RENEW(id));
|
|
69
|
+
return response.data;
|
|
70
|
+
},
|
|
71
|
+
/**
|
|
72
|
+
* Récupérer les abonnements expirant bientôt
|
|
73
|
+
*/
|
|
74
|
+
async getExpiringSubscriptions(days) {
|
|
75
|
+
const params = days ? { days } : {};
|
|
76
|
+
const response = await httpClient.get(API_ENDPOINTS.BILLING.SUBSCRIPTIONS.EXPIRING, { params });
|
|
77
|
+
return response.data || [];
|
|
78
|
+
},
|
|
79
|
+
/**
|
|
80
|
+
* Récupérer toutes les factures
|
|
81
|
+
*/
|
|
82
|
+
async getAllInvoices(params) {
|
|
83
|
+
const response = await httpClient.get(API_ENDPOINTS.BILLING.INVOICES.BASE, { params });
|
|
84
|
+
return response.data || [];
|
|
85
|
+
},
|
|
86
|
+
/**
|
|
87
|
+
* Récupérer une facture par ID
|
|
88
|
+
*/
|
|
89
|
+
async getInvoiceById(id) {
|
|
90
|
+
const response = await httpClient.get(API_ENDPOINTS.BILLING.INVOICES.BY_ID(id));
|
|
91
|
+
return response.data;
|
|
92
|
+
},
|
|
93
|
+
/**
|
|
94
|
+
* Récupérer les factures d'un abonnement
|
|
95
|
+
*/
|
|
96
|
+
async getInvoicesBySubscription(subscriptionId) {
|
|
97
|
+
const response = await httpClient.get(API_ENDPOINTS.BILLING.INVOICES.BY_SUBSCRIPTION(subscriptionId));
|
|
98
|
+
return response.data || [];
|
|
99
|
+
},
|
|
100
|
+
/**
|
|
101
|
+
* Marquer une facture comme payée
|
|
102
|
+
*/
|
|
103
|
+
async markInvoiceAsPaid(id) {
|
|
104
|
+
const response = await httpClient.post(API_ENDPOINTS.BILLING.INVOICES.MARK_PAID(id));
|
|
105
|
+
return response.data;
|
|
106
|
+
},
|
|
107
|
+
/**
|
|
108
|
+
* Récupérer les statistiques de facturation
|
|
109
|
+
* Note: Le backend n'a pas d'endpoint stats dédié
|
|
110
|
+
* Les stats sont calculées côté frontend depuis les abonnements
|
|
111
|
+
*/
|
|
112
|
+
async getStats() {
|
|
113
|
+
// Calculer les stats depuis tous les abonnements
|
|
114
|
+
const subscriptions = await this.getAllSubscriptions();
|
|
115
|
+
const activeSubscriptions = subscriptions.filter(s => s.status === 'ACTIVE').length;
|
|
116
|
+
const pendingPayments = subscriptions.filter(s => s.status === 'PENDING').length;
|
|
117
|
+
const now = new Date();
|
|
118
|
+
const currentMonth = now.getMonth();
|
|
119
|
+
const currentYear = now.getFullYear();
|
|
120
|
+
const monthlyRevenue = subscriptions
|
|
121
|
+
.filter(s => {
|
|
122
|
+
if (s.status !== 'ACTIVE')
|
|
123
|
+
return false;
|
|
124
|
+
const startDate = new Date(s.startDate);
|
|
125
|
+
return startDate.getMonth() === currentMonth && startDate.getFullYear() === currentYear;
|
|
126
|
+
})
|
|
127
|
+
.reduce((sum, s) => sum + (s.amount || 0), 0);
|
|
128
|
+
const totalRevenue = subscriptions
|
|
129
|
+
.filter(s => s.status === 'ACTIVE')
|
|
130
|
+
.reduce((sum, s) => sum + (s.amount || 0), 0);
|
|
131
|
+
return {
|
|
132
|
+
activeSubscriptions,
|
|
133
|
+
pendingPayments,
|
|
134
|
+
monthlyRevenue,
|
|
135
|
+
totalRevenue
|
|
136
|
+
};
|
|
137
|
+
},
|
|
138
|
+
/**
|
|
139
|
+
* Récupérer tous les plans
|
|
140
|
+
*/
|
|
141
|
+
async getAllPlans() {
|
|
142
|
+
const response = await httpClient.get(API_ENDPOINTS.BILLING.PLANS.BASE);
|
|
143
|
+
return response.data || [];
|
|
144
|
+
},
|
|
145
|
+
/**
|
|
146
|
+
* Récupérer un plan par ID
|
|
147
|
+
*/
|
|
148
|
+
async getPlanById(id) {
|
|
149
|
+
const response = await httpClient.get(API_ENDPOINTS.BILLING.PLANS.BY_ID(id));
|
|
150
|
+
return response.data;
|
|
151
|
+
}
|
|
152
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service pour les statistiques optimisées
|
|
3
|
+
*/
|
|
4
|
+
import type { DashboardStats } from '../types/stats.types';
|
|
5
|
+
export declare const statsService: {
|
|
6
|
+
/**
|
|
7
|
+
* Récupère toutes les statistiques du dashboard en une seule requête optimisée
|
|
8
|
+
*/
|
|
9
|
+
getDashboardStats(): Promise<DashboardStats>;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=stats.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stats.service.d.ts","sourceRoot":"","sources":["../../api/stats.service.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAE1D,eAAO,MAAM,YAAY;IACvB;;OAEG;yBACwB,OAAO,CAAC,cAAc,CAAC;CAInD,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service pour les statistiques optimisées
|
|
3
|
+
*/
|
|
4
|
+
import { httpClient } from './http.client';
|
|
5
|
+
import { API_ENDPOINTS } from '../constants/api.constants';
|
|
6
|
+
export const statsService = {
|
|
7
|
+
/**
|
|
8
|
+
* Récupère toutes les statistiques du dashboard en une seule requête optimisée
|
|
9
|
+
*/
|
|
10
|
+
async getDashboardStats() {
|
|
11
|
+
const response = await httpClient.get(API_ENDPOINTS.PROPERTIES.STATS);
|
|
12
|
+
return response.data;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
@@ -15,6 +15,7 @@ export declare const API_ENDPOINTS: {
|
|
|
15
15
|
readonly SEARCH: "/api/properties/search";
|
|
16
16
|
readonly BY_ID: (id: number) => string;
|
|
17
17
|
readonly FEATURES: (id: number) => string;
|
|
18
|
+
readonly STATS: "/api/properties/stats/dashboard";
|
|
18
19
|
};
|
|
19
20
|
readonly USERS: {
|
|
20
21
|
readonly BASE: "/api/identity/users";
|
|
@@ -39,6 +40,34 @@ export declare const API_ENDPOINTS: {
|
|
|
39
40
|
readonly UPLOAD: "/api/documents/upload";
|
|
40
41
|
readonly DOWNLOAD: (id: number) => string;
|
|
41
42
|
};
|
|
43
|
+
readonly BILLING: {
|
|
44
|
+
readonly BASE: "/api/billing";
|
|
45
|
+
readonly STATS: "/api/billing/stats";
|
|
46
|
+
readonly SUBSCRIPTIONS: {
|
|
47
|
+
readonly BASE: "/api/billing/subscriptions";
|
|
48
|
+
readonly BY_ID: (id: number) => string;
|
|
49
|
+
readonly BY_ORGANIZATION: (organizationId: number) => string;
|
|
50
|
+
readonly ACTIVE_BY_ORGANIZATION: (organizationId: number) => string;
|
|
51
|
+
readonly CANCEL: (id: number) => string;
|
|
52
|
+
readonly RENEW: (id: number) => string;
|
|
53
|
+
readonly EXPIRING: "/api/billing/subscriptions/expiring";
|
|
54
|
+
};
|
|
55
|
+
readonly INVOICES: {
|
|
56
|
+
readonly BASE: "/api/billing/invoices";
|
|
57
|
+
readonly BY_ID: (id: number) => string;
|
|
58
|
+
readonly BY_NUMBER: (invoiceNumber: string) => string;
|
|
59
|
+
readonly BY_SUBSCRIPTION: (subscriptionId: number) => string;
|
|
60
|
+
readonly MARK_PAID: (id: number) => string;
|
|
61
|
+
readonly UPDATE_STATUS: (id: number) => string;
|
|
62
|
+
readonly OVERDUE: "/api/billing/invoices/overdue";
|
|
63
|
+
};
|
|
64
|
+
readonly PLANS: {
|
|
65
|
+
readonly BASE: "/api/billing/plans";
|
|
66
|
+
readonly BY_ID: (id: number) => string;
|
|
67
|
+
readonly BY_NAME: (name: string) => string;
|
|
68
|
+
readonly DEFAULT: "/api/billing/plans/default";
|
|
69
|
+
};
|
|
70
|
+
};
|
|
42
71
|
};
|
|
43
72
|
/**
|
|
44
73
|
* Get API base URL from environment
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.constants.d.ts","sourceRoot":"","sources":["../../constants/api.constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;6BAcV,MAAM;gCACH,MAAM
|
|
1
|
+
{"version":3,"file":"api.constants.d.ts","sourceRoot":"","sources":["../../constants/api.constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;6BAcV,MAAM;gCACH,MAAM;;;;;6BAMT,MAAM;;;;gCAIH,MAAM;;;;6BAKT,MAAM;sCACG,MAAM;;sCAEN,MAAM;;;;;;6BAOf,MAAM;;gCAEH,MAAM;;;;;;;iCAQP,MAAM;uDACgB,MAAM;8DACC,MAAM;kCAClC,MAAM;iCACP,MAAM;;;;;iCAKN,MAAM;gDACS,MAAM;uDACC,MAAM;qCACxB,MAAM;yCACF,MAAM;;;;;iCAKd,MAAM;qCACF,MAAM;;;;CAIlB,CAAA;AAEV;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,SAAS,CAAA"}
|
|
@@ -16,7 +16,8 @@ export const API_ENDPOINTS = {
|
|
|
16
16
|
BASE: '/api/properties',
|
|
17
17
|
SEARCH: '/api/properties/search',
|
|
18
18
|
BY_ID: (id) => `/api/properties/${id}`,
|
|
19
|
-
FEATURES: (id) => `/api/properties/${id}/features
|
|
19
|
+
FEATURES: (id) => `/api/properties/${id}/features`,
|
|
20
|
+
STATS: '/api/properties/stats/dashboard'
|
|
20
21
|
},
|
|
21
22
|
// Users
|
|
22
23
|
USERS: {
|
|
@@ -43,6 +44,35 @@ export const API_ENDPOINTS = {
|
|
|
43
44
|
BY_ID: (id) => `/api/documents/${id}`,
|
|
44
45
|
UPLOAD: '/api/documents/upload',
|
|
45
46
|
DOWNLOAD: (id) => `/api/documents/${id}/download`
|
|
47
|
+
},
|
|
48
|
+
// Billing
|
|
49
|
+
BILLING: {
|
|
50
|
+
BASE: '/api/billing',
|
|
51
|
+
STATS: '/api/billing/stats',
|
|
52
|
+
SUBSCRIPTIONS: {
|
|
53
|
+
BASE: '/api/billing/subscriptions',
|
|
54
|
+
BY_ID: (id) => `/api/billing/subscriptions/${id}`,
|
|
55
|
+
BY_ORGANIZATION: (organizationId) => `/api/billing/subscriptions/organization/${organizationId}`,
|
|
56
|
+
ACTIVE_BY_ORGANIZATION: (organizationId) => `/api/billing/subscriptions/organization/${organizationId}/active`,
|
|
57
|
+
CANCEL: (id) => `/api/billing/subscriptions/${id}/cancel`,
|
|
58
|
+
RENEW: (id) => `/api/billing/subscriptions/${id}/renew`,
|
|
59
|
+
EXPIRING: '/api/billing/subscriptions/expiring'
|
|
60
|
+
},
|
|
61
|
+
INVOICES: {
|
|
62
|
+
BASE: '/api/billing/invoices',
|
|
63
|
+
BY_ID: (id) => `/api/billing/invoices/${id}`,
|
|
64
|
+
BY_NUMBER: (invoiceNumber) => `/api/billing/invoices/number/${invoiceNumber}`,
|
|
65
|
+
BY_SUBSCRIPTION: (subscriptionId) => `/api/billing/invoices/subscription/${subscriptionId}`,
|
|
66
|
+
MARK_PAID: (id) => `/api/billing/invoices/${id}/mark-paid`,
|
|
67
|
+
UPDATE_STATUS: (id) => `/api/billing/invoices/${id}/status`,
|
|
68
|
+
OVERDUE: '/api/billing/invoices/overdue'
|
|
69
|
+
},
|
|
70
|
+
PLANS: {
|
|
71
|
+
BASE: '/api/billing/plans',
|
|
72
|
+
BY_ID: (id) => `/api/billing/plans/${id}`,
|
|
73
|
+
BY_NAME: (name) => `/api/billing/plans/name/${name}`,
|
|
74
|
+
DEFAULT: '/api/billing/plans/default'
|
|
75
|
+
}
|
|
46
76
|
}
|
|
47
77
|
};
|
|
48
78
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ export { propertyService } from './api/property.service';
|
|
|
7
7
|
export { userService } from './api/user.service';
|
|
8
8
|
export { organizationService } from './api/organization.service';
|
|
9
9
|
export { documentService } from './api/document.service';
|
|
10
|
+
export { statsService } from './api/stats.service';
|
|
11
|
+
export { billingService } from './api/billing.service';
|
|
10
12
|
export type { Organization, OrganizationCreate, OrganizationUpdate, OrganizationSearchParams, Team, TeamCreate, TeamUpdate, OrganizationUser } from './api/organization.service';
|
|
11
13
|
export { useAuthStore } from './stores/auth.store';
|
|
12
14
|
export { useUserStore } from './stores/user.store';
|
|
@@ -18,6 +20,8 @@ export type * from './types/property.types';
|
|
|
18
20
|
export type * from './types/property-feature.types';
|
|
19
21
|
export type * from './types/user.types';
|
|
20
22
|
export type * from './types/document.types';
|
|
23
|
+
export type * from './types/stats.types';
|
|
24
|
+
export type * from './types/billing.types';
|
|
21
25
|
export { PropertyType, PropertyStatus } from './types/property.types';
|
|
22
26
|
export { tokenUtils } from './utils/token.utils';
|
|
23
27
|
export { API_ENDPOINTS, API_BASE_URL } from './constants/api.constants';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,YAAY,EACV,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,EAClB,wBAAwB,EACxB,IAAI,EACJ,UAAU,EACV,UAAU,EACV,gBAAgB,EACjB,MAAM,4BAA4B,CAAA;AAGnC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,C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C,CAAA;AACnD,mBAAmB,oBAAoB,CAAA;AACvC,mBAAmB,wBAAwB,CAAA;AAC3C,mBAAmB,qBAAqB,CAAA;AACxC,mBAAmB,uBAAuB,CAAA;AAG1C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAGrE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAGhD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAGvE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,8 @@ export { propertyService } from './api/property.service';
|
|
|
8
8
|
export { userService } from './api/user.service';
|
|
9
9
|
export { organizationService } from './api/organization.service';
|
|
10
10
|
export { documentService } from './api/document.service';
|
|
11
|
+
export { statsService } from './api/stats.service';
|
|
12
|
+
export { billingService } from './api/billing.service';
|
|
11
13
|
// Stores
|
|
12
14
|
export { useAuthStore } from './stores/auth.store';
|
|
13
15
|
export { useUserStore } from './stores/user.store';
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types pour le module de facturation
|
|
3
|
+
*/
|
|
4
|
+
export interface Subscription {
|
|
5
|
+
id: number;
|
|
6
|
+
planId: number;
|
|
7
|
+
planName?: string;
|
|
8
|
+
organizationId: number;
|
|
9
|
+
organizationName?: string;
|
|
10
|
+
organizationEmail?: string;
|
|
11
|
+
status: 'ACTIVE' | 'PENDING' | 'CANCELLED' | 'EXPIRED';
|
|
12
|
+
startDate: string;
|
|
13
|
+
endDate: string;
|
|
14
|
+
trialEndDate?: string;
|
|
15
|
+
autoRenew?: boolean;
|
|
16
|
+
cancelledAt?: string;
|
|
17
|
+
cancelledBy?: number;
|
|
18
|
+
active?: boolean;
|
|
19
|
+
amount?: number;
|
|
20
|
+
}
|
|
21
|
+
export interface Invoice {
|
|
22
|
+
id: number;
|
|
23
|
+
subscriptionId: number;
|
|
24
|
+
invoiceNumber: string;
|
|
25
|
+
organizationId: number;
|
|
26
|
+
amount: number;
|
|
27
|
+
taxAmount: number;
|
|
28
|
+
totalAmount: number;
|
|
29
|
+
currency: string;
|
|
30
|
+
status: 'DRAFT' | 'PENDING' | 'PAID' | 'OVERDUE' | 'CANCELLED';
|
|
31
|
+
dueDate: string;
|
|
32
|
+
paidAt?: string;
|
|
33
|
+
billingPeriodStart?: string;
|
|
34
|
+
billingPeriodEnd?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface Plan {
|
|
37
|
+
id: number;
|
|
38
|
+
name: string;
|
|
39
|
+
description?: string;
|
|
40
|
+
price: number;
|
|
41
|
+
currency: string;
|
|
42
|
+
billingCycle: 'MONTHLY' | 'YEARLY';
|
|
43
|
+
features?: string[];
|
|
44
|
+
quotas?: Record<string, number>;
|
|
45
|
+
active: boolean;
|
|
46
|
+
}
|
|
47
|
+
export interface BillingStats {
|
|
48
|
+
activeSubscriptions: number;
|
|
49
|
+
pendingPayments: number;
|
|
50
|
+
monthlyRevenue: number;
|
|
51
|
+
totalRevenue: number;
|
|
52
|
+
}
|
|
53
|
+
export interface SubscriptionCreate {
|
|
54
|
+
planId: number;
|
|
55
|
+
organizationId: number;
|
|
56
|
+
}
|
|
57
|
+
export interface SubscriptionUpdate {
|
|
58
|
+
status?: 'ACTIVE' | 'PENDING' | 'CANCELLED' | 'EXPIRED';
|
|
59
|
+
endDate?: string;
|
|
60
|
+
autoRenew?: boolean;
|
|
61
|
+
active?: boolean;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=billing.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.types.d.ts","sourceRoot":"","sources":["../../types/billing.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,C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AC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,MAAM,EAAE,OAAO,CAAA;CAChB;AAED,MAAM,WAAW,YAAY;IAC3B,mBAAmB,EAAE,MAAM,CAAA;IAC3B,eAAe,EAAE,MAAM,CAAA;IACvB,cAAc,EAAE,MAAM,CAAA;IACtB,YAAY,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAA;IACd,cAAc,EAAE,MAAM,CAAA;CACvB;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,CAAA;IACvD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types pour les statistiques du dashboard
|
|
3
|
+
*/
|
|
4
|
+
export interface DashboardStats {
|
|
5
|
+
propertyStats: PropertyStats;
|
|
6
|
+
userStats: DashboardUserStats;
|
|
7
|
+
organizationStats: OrganizationStats;
|
|
8
|
+
}
|
|
9
|
+
export interface PropertyStats {
|
|
10
|
+
total: number;
|
|
11
|
+
available: number;
|
|
12
|
+
sold: number;
|
|
13
|
+
rented: number;
|
|
14
|
+
published: number;
|
|
15
|
+
draft: number;
|
|
16
|
+
pending: number;
|
|
17
|
+
averagePrice: number;
|
|
18
|
+
averageSurface: number;
|
|
19
|
+
newThisMonth: number;
|
|
20
|
+
newThisWeek: number;
|
|
21
|
+
byType: Record<string, number>;
|
|
22
|
+
byStatus: Record<string, number>;
|
|
23
|
+
byCity: Record<string, number>;
|
|
24
|
+
}
|
|
25
|
+
export interface DashboardUserStats {
|
|
26
|
+
total: number;
|
|
27
|
+
active: number;
|
|
28
|
+
inactive: number;
|
|
29
|
+
newThisMonth: number;
|
|
30
|
+
newThisWeek: number;
|
|
31
|
+
}
|
|
32
|
+
export interface OrganizationStats {
|
|
33
|
+
total: number;
|
|
34
|
+
active: number;
|
|
35
|
+
newThisMonth: number;
|
|
36
|
+
newThisWeek: number;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=stats.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stats.types.d.ts","sourceRoot":"","sources":["../../types/stats.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,cAAc;IAC7B,aAAa,EAAE,aAAa,CAAA;IAC5B,SAAS,EAAE,kBAAkB,CAAA;IAC7B,iBAAiB,EAAE,iBAAiB,CAAA;CACrC;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,EAAE,MAAM,CAAA;IACpB,cAAc,EAAE,MAAM,CAAA;IACtB,YAAY,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC9B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC/B;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,YAAY,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,YAAY,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;CACpB"}
|