@koma-app/core 0.1.1 → 0.1.3
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/client.d.ts +7 -1
- package/dist/client.js +4 -0
- package/dist/types.d.ts +30 -0
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AccountSummary, AgendaCourse, CancellationResult, CardProduct, CheckoutIdentity, ClientInfo, CreditPaymentResult, PaymentIntentInfo, PublicCourse, Studio, TrialEligibility } from "./types.js";
|
|
1
|
+
import type { AccountSummary, AgendaCourse, CancellationResult, CardProduct, CheckoutIdentity, ClientInfo, CreditPaymentResult, PaymentIntentInfo, PublicCourse, Studio, TrialEligibility, WaitlistJoinResult } from "./types.js";
|
|
2
2
|
export type KomaClientOptions = {
|
|
3
3
|
/** Préfixe des routes storefront. Défaut `/api/v1` (site proxifié en même origine, cookie de session). */
|
|
4
4
|
baseUrl?: string;
|
|
@@ -48,6 +48,12 @@ export declare function createKomaClient(options?: KomaClientOptions): {
|
|
|
48
48
|
payWithCredit: (slug: string, name?: string) => Promise<CreditPaymentResult>;
|
|
49
49
|
/** Demande d'annulation (session requise) ; le studio finalise depuis le BO. */
|
|
50
50
|
requestCancellation: (slug: string) => Promise<CancellationResult>;
|
|
51
|
+
/** Rejoint la liste d'attente d'un cours complet (session + crédit valable requis ; rien n'est débité avant l'inscription). */
|
|
52
|
+
joinWaitlist: (slug: string, name?: string) => Promise<WaitlistJoinResult>;
|
|
53
|
+
/** Quitte la liste d'attente. */
|
|
54
|
+
leaveWaitlist: (slug: string) => Promise<{
|
|
55
|
+
success: true;
|
|
56
|
+
}>;
|
|
51
57
|
contact: (data: {
|
|
52
58
|
name: string;
|
|
53
59
|
email: string;
|
package/dist/client.js
CHANGED
|
@@ -68,6 +68,10 @@ export function createKomaClient(options = {}) {
|
|
|
68
68
|
payWithCredit: (slug, name) => post("/pay/credit", name ? { slug, name } : { slug }),
|
|
69
69
|
/** Demande d'annulation (session requise) ; le studio finalise depuis le BO. */
|
|
70
70
|
requestCancellation: (slug) => post(`/courses/${enc(slug)}/cancel`),
|
|
71
|
+
/** Rejoint la liste d'attente d'un cours complet (session + crédit valable requis ; rien n'est débité avant l'inscription). */
|
|
72
|
+
joinWaitlist: (slug, name) => post(`/courses/${enc(slug)}/waitlist`, name ? { name } : {}),
|
|
73
|
+
/** Quitte la liste d'attente. */
|
|
74
|
+
leaveWaitlist: (slug) => request("DELETE", `/courses/${enc(slug)}/waitlist`),
|
|
71
75
|
contact: (data) => post("/contact", data),
|
|
72
76
|
};
|
|
73
77
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -28,10 +28,16 @@ export type AgendaCourse = {
|
|
|
28
28
|
createdAt: string;
|
|
29
29
|
spotsLeft: number;
|
|
30
30
|
full: boolean;
|
|
31
|
+
/** Liste d'attente possible si le cours est complet (API ≥ 13/10/2026). Le nombre en attente n'est jamais public. */
|
|
32
|
+
waitlistOpen?: boolean;
|
|
31
33
|
myRegistered: boolean;
|
|
34
|
+
/** Sa position sur la liste d'attente (1 = la prochaine place), null si absente de la liste (API ≥ 13/10/2026). */
|
|
35
|
+
myWaitlistPosition?: number | null;
|
|
32
36
|
};
|
|
33
37
|
export type MyReservation = {
|
|
34
38
|
createdAt: string;
|
|
39
|
+
/** Moyen de paiement de la résa. « credit » : l'annulation dans le délai est immédiate (API ≥ 04/10/2026). */
|
|
40
|
+
paymentMethod?: "onsite" | "card" | "credit";
|
|
35
41
|
cancellationRequestedAt: string | null;
|
|
36
42
|
};
|
|
37
43
|
export type MyCredits = {
|
|
@@ -78,10 +84,25 @@ export type AccountReservation = {
|
|
|
78
84
|
paymentMethod: PaymentMethod;
|
|
79
85
|
cancellationRequestedAt: string | null;
|
|
80
86
|
};
|
|
87
|
+
/** Liste d'attente du compte connecté : la position seulement (API ≥ 13/10/2026). */
|
|
88
|
+
export type AccountWaitlistEntry = {
|
|
89
|
+
courseSlug: string;
|
|
90
|
+
courseKind: string;
|
|
91
|
+
courseTitle: string;
|
|
92
|
+
startsAt: string;
|
|
93
|
+
endsAt: string | null;
|
|
94
|
+
locationName: string;
|
|
95
|
+
position: number;
|
|
96
|
+
};
|
|
81
97
|
export type AccountSummary = {
|
|
82
98
|
email: string;
|
|
83
99
|
cards: AccountCard[];
|
|
84
100
|
reservations: AccountReservation[];
|
|
101
|
+
waitlist?: AccountWaitlistEntry[];
|
|
102
|
+
};
|
|
103
|
+
export type WaitlistJoinResult = {
|
|
104
|
+
success: true;
|
|
105
|
+
position: number;
|
|
85
106
|
};
|
|
86
107
|
/** Identité saisie au paiement : un seul champ « Prénom et nom » + email (décision du 26/09). */
|
|
87
108
|
export type CheckoutIdentity = {
|
|
@@ -102,7 +123,16 @@ export type CreditPaymentResult = {
|
|
|
102
123
|
creditsLeft: number;
|
|
103
124
|
nextExpiresAt: string | null;
|
|
104
125
|
};
|
|
126
|
+
/** `cancelled: true` : résa par crédit annulée tout de suite, crédit rendu. Sinon, demande transmise au studio. */
|
|
105
127
|
export type CancellationResult = {
|
|
106
128
|
success: true;
|
|
129
|
+
cancelled: true;
|
|
130
|
+
recredit: {
|
|
131
|
+
extended: boolean;
|
|
132
|
+
expiresAt: string;
|
|
133
|
+
} | null;
|
|
134
|
+
} | {
|
|
135
|
+
success: true;
|
|
136
|
+
cancelled?: false;
|
|
107
137
|
cancellationRequestedAt: string;
|
|
108
138
|
};
|
package/package.json
CHANGED