@viridial/shared 1.0.26 → 1.0.28

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,80 @@
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
+ */
9
+ getAllSubscriptions(params?: {
10
+ organizationId?: number;
11
+ status?: string;
12
+ page?: number;
13
+ size?: number;
14
+ }): Promise<Subscription[]>;
15
+ /**
16
+ * Récupérer un abonnement par ID
17
+ */
18
+ getSubscriptionById(id: number): Promise<Subscription>;
19
+ /**
20
+ * Récupérer l'abonnement actif d'une organisation
21
+ */
22
+ getActiveSubscriptionByOrganization(organizationId: number): Promise<Subscription>;
23
+ /**
24
+ * Créer un abonnement
25
+ */
26
+ createSubscription(data: SubscriptionCreate): Promise<Subscription>;
27
+ /**
28
+ * Mettre à jour un abonnement
29
+ */
30
+ updateSubscription(id: number, data: SubscriptionUpdate): Promise<Subscription>;
31
+ /**
32
+ * Annuler un abonnement
33
+ */
34
+ cancelSubscription(id: number, cancelledBy: number): Promise<Subscription>;
35
+ /**
36
+ * Renouveler un abonnement
37
+ */
38
+ renewSubscription(id: number): Promise<Subscription>;
39
+ /**
40
+ * Récupérer les abonnements expirant bientôt
41
+ */
42
+ getExpiringSubscriptions(days?: number): Promise<Subscription[]>;
43
+ /**
44
+ * Récupérer toutes les factures
45
+ */
46
+ getAllInvoices(params?: {
47
+ organizationId?: number;
48
+ subscriptionId?: number;
49
+ status?: string;
50
+ page?: number;
51
+ size?: number;
52
+ }): Promise<Invoice[]>;
53
+ /**
54
+ * Récupérer une facture par ID
55
+ */
56
+ getInvoiceById(id: number): Promise<Invoice>;
57
+ /**
58
+ * Récupérer les factures d'un abonnement
59
+ */
60
+ getInvoicesBySubscription(subscriptionId: number): Promise<Invoice[]>;
61
+ /**
62
+ * Marquer une facture comme payée
63
+ */
64
+ markInvoiceAsPaid(id: number): Promise<Invoice>;
65
+ /**
66
+ * Récupérer les statistiques de facturation
67
+ * Note: Le backend n'a pas d'endpoint stats dédié
68
+ * Les stats sont calculées côté frontend depuis les abonnements
69
+ */
70
+ getStats(): Promise<BillingStats>;
71
+ /**
72
+ * Récupérer tous les plans
73
+ */
74
+ getAllPlans(): Promise<Plan[]>;
75
+ /**
76
+ * Récupérer un plan par ID
77
+ */
78
+ getPlanById(id: number): Promise<Plan>;
79
+ };
80
+ //# 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;;OAEG;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;IAoB3B;;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,146 @@
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
+ */
10
+ async getAllSubscriptions(params) {
11
+ const queryParams = {};
12
+ if (params?.status) {
13
+ queryParams.status = params.status;
14
+ }
15
+ const response = await httpClient.get(API_ENDPOINTS.BILLING.SUBSCRIPTIONS.BASE, { params: queryParams });
16
+ let subscriptions = response.data || [];
17
+ // Filtrer par organizationId côté client si fourni (le backend ne le supporte pas encore)
18
+ if (params?.organizationId) {
19
+ subscriptions = subscriptions.filter(s => s.organizationId === params.organizationId);
20
+ }
21
+ return subscriptions;
22
+ },
23
+ /**
24
+ * Récupérer un abonnement par ID
25
+ */
26
+ async getSubscriptionById(id) {
27
+ const response = await httpClient.get(API_ENDPOINTS.BILLING.SUBSCRIPTIONS.BY_ID(id));
28
+ return response.data;
29
+ },
30
+ /**
31
+ * Récupérer l'abonnement actif d'une organisation
32
+ */
33
+ async getActiveSubscriptionByOrganization(organizationId) {
34
+ const response = await httpClient.get(API_ENDPOINTS.BILLING.SUBSCRIPTIONS.ACTIVE_BY_ORGANIZATION(organizationId));
35
+ return response.data;
36
+ },
37
+ /**
38
+ * Créer un abonnement
39
+ */
40
+ async createSubscription(data) {
41
+ const response = await httpClient.post(API_ENDPOINTS.BILLING.SUBSCRIPTIONS.BASE, data);
42
+ return response.data;
43
+ },
44
+ /**
45
+ * Mettre à jour un abonnement
46
+ */
47
+ async updateSubscription(id, data) {
48
+ const response = await httpClient.put(API_ENDPOINTS.BILLING.SUBSCRIPTIONS.BY_ID(id), data);
49
+ return response.data;
50
+ },
51
+ /**
52
+ * Annuler un abonnement
53
+ */
54
+ async cancelSubscription(id, cancelledBy) {
55
+ const response = await httpClient.post(API_ENDPOINTS.BILLING.SUBSCRIPTIONS.CANCEL(id), { cancelledBy });
56
+ return response.data;
57
+ },
58
+ /**
59
+ * Renouveler un abonnement
60
+ */
61
+ async renewSubscription(id) {
62
+ const response = await httpClient.post(API_ENDPOINTS.BILLING.SUBSCRIPTIONS.RENEW(id));
63
+ return response.data;
64
+ },
65
+ /**
66
+ * Récupérer les abonnements expirant bientôt
67
+ */
68
+ async getExpiringSubscriptions(days) {
69
+ const params = days ? { days } : {};
70
+ const response = await httpClient.get(API_ENDPOINTS.BILLING.SUBSCRIPTIONS.EXPIRING, { params });
71
+ return response.data || [];
72
+ },
73
+ /**
74
+ * Récupérer toutes les factures
75
+ */
76
+ async getAllInvoices(params) {
77
+ const response = await httpClient.get(API_ENDPOINTS.BILLING.INVOICES.BASE, { params });
78
+ return response.data || [];
79
+ },
80
+ /**
81
+ * Récupérer une facture par ID
82
+ */
83
+ async getInvoiceById(id) {
84
+ const response = await httpClient.get(API_ENDPOINTS.BILLING.INVOICES.BY_ID(id));
85
+ return response.data;
86
+ },
87
+ /**
88
+ * Récupérer les factures d'un abonnement
89
+ */
90
+ async getInvoicesBySubscription(subscriptionId) {
91
+ const response = await httpClient.get(API_ENDPOINTS.BILLING.INVOICES.BY_SUBSCRIPTION(subscriptionId));
92
+ return response.data || [];
93
+ },
94
+ /**
95
+ * Marquer une facture comme payée
96
+ */
97
+ async markInvoiceAsPaid(id) {
98
+ const response = await httpClient.post(API_ENDPOINTS.BILLING.INVOICES.MARK_PAID(id));
99
+ return response.data;
100
+ },
101
+ /**
102
+ * Récupérer les statistiques de facturation
103
+ * Note: Le backend n'a pas d'endpoint stats dédié
104
+ * Les stats sont calculées côté frontend depuis les abonnements
105
+ */
106
+ async getStats() {
107
+ // Calculer les stats depuis tous les abonnements
108
+ const subscriptions = await this.getAllSubscriptions();
109
+ const activeSubscriptions = subscriptions.filter(s => s.status === 'ACTIVE').length;
110
+ const pendingPayments = subscriptions.filter(s => s.status === 'PENDING').length;
111
+ const now = new Date();
112
+ const currentMonth = now.getMonth();
113
+ const currentYear = now.getFullYear();
114
+ const monthlyRevenue = subscriptions
115
+ .filter(s => {
116
+ if (s.status !== 'ACTIVE')
117
+ return false;
118
+ const startDate = new Date(s.startDate);
119
+ return startDate.getMonth() === currentMonth && startDate.getFullYear() === currentYear;
120
+ })
121
+ .reduce((sum, s) => sum + (s.amount || 0), 0);
122
+ const totalRevenue = subscriptions
123
+ .filter(s => s.status === 'ACTIVE')
124
+ .reduce((sum, s) => sum + (s.amount || 0), 0);
125
+ return {
126
+ activeSubscriptions,
127
+ pendingPayments,
128
+ monthlyRevenue,
129
+ totalRevenue
130
+ };
131
+ },
132
+ /**
133
+ * Récupérer tous les plans
134
+ */
135
+ async getAllPlans() {
136
+ const response = await httpClient.get(API_ENDPOINTS.BILLING.PLANS.BASE);
137
+ return response.data || [];
138
+ },
139
+ /**
140
+ * Récupérer un plan par ID
141
+ */
142
+ async getPlanById(id) {
143
+ const response = await httpClient.get(API_ENDPOINTS.BILLING.PLANS.BY_ID(id));
144
+ return response.data;
145
+ }
146
+ };
@@ -40,6 +40,34 @@ export declare const API_ENDPOINTS: {
40
40
  readonly UPLOAD: "/api/documents/upload";
41
41
  readonly DOWNLOAD: (id: number) => string;
42
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
+ };
43
71
  };
44
72
  /**
45
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;;;;;6BAMT,MAAM;;;;gCAIH,MAAM;;;;6BAKT,MAAM;sCACG,MAAM;;sCAEN,MAAM;;;;;;6BAOf,MAAM;;gCAEH,MAAM;;CAEf,CAAA;AAEV;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,SAAS,CAAA"}
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"}
@@ -44,6 +44,35 @@ export const API_ENDPOINTS = {
44
44
  BY_ID: (id) => `/api/documents/${id}`,
45
45
  UPLOAD: '/api/documents/upload',
46
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
+ }
47
76
  }
48
77
  };
49
78
  /**
package/dist/index.d.ts CHANGED
@@ -8,6 +8,7 @@ export { userService } from './api/user.service';
8
8
  export { organizationService } from './api/organization.service';
9
9
  export { documentService } from './api/document.service';
10
10
  export { statsService } from './api/stats.service';
11
+ export { billingService } from './api/billing.service';
11
12
  export type { Organization, OrganizationCreate, OrganizationUpdate, OrganizationSearchParams, Team, TeamCreate, TeamUpdate, OrganizationUser } from './api/organization.service';
12
13
  export { useAuthStore } from './stores/auth.store';
13
14
  export { useUserStore } from './stores/user.store';
@@ -20,6 +21,7 @@ export type * from './types/property-feature.types';
20
21
  export type * from './types/user.types';
21
22
  export type * from './types/document.types';
22
23
  export type * from './types/stats.types';
24
+ export type * from './types/billing.types';
23
25
  export { PropertyType, PropertyStatus } from './types/property.types';
24
26
  export { tokenUtils } from './utils/token.utils';
25
27
  export { API_ENDPOINTS, API_BASE_URL } from './constants/api.constants';
@@ -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,E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AAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,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,CAAA;AAGlD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAG/C,mBAAmB,mBAAmB,CAAA;AACtC,mBAAmB,oBAAoB,CAAA;AACvC,mBAAmB,wBAAwB,CAAA;AAC3C,mBAAmB,gCAAgC,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
@@ -9,6 +9,7 @@ export { userService } from './api/user.service';
9
9
  export { organizationService } from './api/organization.service';
10
10
  export { documentService } from './api/document.service';
11
11
  export { statsService } from './api/stats.service';
12
+ export { billingService } from './api/billing.service';
12
13
  // Stores
13
14
  export { useAuthStore } from './stores/auth.store';
14
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,CAA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,MAAM,EAAE,CAAA;IACnB,MAAM,CAAC,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,4 @@
1
+ /**
2
+ * Types pour le module de facturation
3
+ */
4
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viridial/shared",
3
- "version": "1.0.26",
3
+ "version": "1.0.28",
4
4
  "type": "module",
5
5
  "description": "Shared modules for Real Estate frontend applications - Vue 3, TypeScript, Pinia, Axios",
6
6
  "main": "./dist/index.js",