@viridial/shared 1.0.26 → 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.
@@ -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
+ };
@@ -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":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A;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,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,cAAc,EAAE,MAAM,CAAA;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,CAAA;IACtD,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAA;IACV,cAAc,EAAE,MAAM,CAAA;IACtB,aAAa,EAAE,MAAM,CAAA;IACrB,cAAc,EAAE,MAAM,CAAA;IACtB,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,WAAW,CAAA;IAC9D,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC1B;AAED,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,YAAY,EAAE,SAAS,GAAG,QAAQ,CAAA;IAClC,QAAQ,CAAC,EAAE,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.27",
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",