@burdenoff/microfe-kadaikodi 2026.1124.1 → 2026.1126.1
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/kadaikodi/components/AppointmentSettingsSection.d.ts +13 -0
- package/dist/kadaikodi/components/AppointmentSettingsSection.js +206 -0
- package/dist/kadaikodi/components/AppointmentSettingsSection.js.map +1 -0
- package/dist/kadaikodi/components/AppointmentSlotPicker.d.ts +19 -0
- package/dist/kadaikodi/components/AppointmentSlotPicker.js +106 -0
- package/dist/kadaikodi/components/AppointmentSlotPicker.js.map +1 -0
- package/dist/kadaikodi/components/ProviderAppointmentQueue.d.ts +15 -0
- package/dist/kadaikodi/components/ProviderAppointmentQueue.js +179 -0
- package/dist/kadaikodi/components/ProviderAppointmentQueue.js.map +1 -0
- package/dist/kadaikodi/hooks/useAppointmentsApi.d.ts +122 -0
- package/dist/kadaikodi/hooks/useAppointmentsApi.js +184 -0
- package/dist/kadaikodi/hooks/useAppointmentsApi.js.map +1 -0
- package/dist/kadaikodi/hooks/useKadaikodiApi.d.ts +3 -0
- package/dist/kadaikodi/hooks/useKadaikodiApi.js +5 -4
- package/dist/kadaikodi/hooks/useKadaikodiApi.js.map +1 -1
- package/dist/kadaikodi/pages/cart-owner/CartOwnerDashboard.js +97 -94
- package/dist/kadaikodi/pages/cart-owner/CartOwnerDashboard.js.map +1 -1
- package/dist/kadaikodi/pages/cart-owner/CartServiceConfigPage.js +172 -170
- package/dist/kadaikodi/pages/cart-owner/CartServiceConfigPage.js.map +1 -1
- package/dist/kadaikodi/pages/cart-owner/OrderManagementPage.js +250 -241
- package/dist/kadaikodi/pages/cart-owner/OrderManagementPage.js.map +1 -1
- package/dist/kadaikodi/pages/customer/BookingDetailsPage.d.ts +3 -1
- package/dist/kadaikodi/pages/customer/BookingDetailsPage.js +317 -178
- package/dist/kadaikodi/pages/customer/BookingDetailsPage.js.map +1 -1
- package/dist/kadaikodi/pages/customer/DirectServiceBookingPage.d.ts +3 -3
- package/dist/kadaikodi/pages/customer/DirectServiceBookingPage.js +307 -338
- package/dist/kadaikodi/pages/customer/DirectServiceBookingPage.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service appointment hooks (BOFF-3965).
|
|
3
|
+
*
|
|
4
|
+
* Slot availability, booking, reschedule/cancel and the provider appointment
|
|
5
|
+
* queue all come from wspace-kadaikodi-svc; nothing here computes slots on the
|
|
6
|
+
* client. Every appointment is paired with an order, so mutations also
|
|
7
|
+
* invalidate the order caches the existing pages read.
|
|
8
|
+
*
|
|
9
|
+
* @module kadaikodi/hooks
|
|
10
|
+
*/
|
|
11
|
+
export type AppointmentStatus = 'BOOKED' | 'CONFIRMED' | 'IN_PROGRESS' | 'COMPLETED' | 'CANCELLED' | 'NO_SHOW';
|
|
12
|
+
/** Statuses a provider can move an appointment to. */
|
|
13
|
+
export type ProviderAppointmentStatus = Exclude<AppointmentStatus, 'BOOKED'>;
|
|
14
|
+
export type AppointmentTiming = 'SCHEDULED' | 'COME_NOW';
|
|
15
|
+
export interface ServiceAppointment {
|
|
16
|
+
id: string;
|
|
17
|
+
providerId: string;
|
|
18
|
+
offeringId: string;
|
|
19
|
+
customerId: string;
|
|
20
|
+
orderId: string | null;
|
|
21
|
+
timing: AppointmentTiming;
|
|
22
|
+
status: AppointmentStatus;
|
|
23
|
+
scheduledAt: string;
|
|
24
|
+
endsAt: string;
|
|
25
|
+
durationMinutes: number;
|
|
26
|
+
serviceAddress: Record<string, unknown> | null;
|
|
27
|
+
contactPhone: string | null;
|
|
28
|
+
notes: string | null;
|
|
29
|
+
rescheduleCount: number;
|
|
30
|
+
cancellationReason: string | null;
|
|
31
|
+
offering: {
|
|
32
|
+
id: string;
|
|
33
|
+
name: string;
|
|
34
|
+
price: number;
|
|
35
|
+
} | null;
|
|
36
|
+
}
|
|
37
|
+
export interface AppointmentSlot {
|
|
38
|
+
startsAt: string;
|
|
39
|
+
endsAt: string;
|
|
40
|
+
available: boolean;
|
|
41
|
+
remainingCapacity: number;
|
|
42
|
+
}
|
|
43
|
+
export interface AvailableSlots {
|
|
44
|
+
date: string;
|
|
45
|
+
timezone: string;
|
|
46
|
+
durationMinutes: number;
|
|
47
|
+
slots: AppointmentSlot[];
|
|
48
|
+
nextAvailableAt: string | null;
|
|
49
|
+
}
|
|
50
|
+
export interface AppointmentSettings {
|
|
51
|
+
providerId: string;
|
|
52
|
+
slotIntervalMinutes: number;
|
|
53
|
+
capacityPerSlot: number;
|
|
54
|
+
bufferMinutes: number;
|
|
55
|
+
minLeadMinutes: number;
|
|
56
|
+
advanceBookingDays: number;
|
|
57
|
+
cancellationCutoffHours: number;
|
|
58
|
+
autoConfirm: boolean;
|
|
59
|
+
timezone: string;
|
|
60
|
+
blackoutDates: string[];
|
|
61
|
+
isCustomized: boolean;
|
|
62
|
+
bookableDays: string[];
|
|
63
|
+
}
|
|
64
|
+
export type AppointmentSettingsInput = Partial<Omit<AppointmentSettings, 'providerId' | 'isCustomized' | 'bookableDays'>>;
|
|
65
|
+
export interface BookAppointmentInput {
|
|
66
|
+
offeringId: string;
|
|
67
|
+
timing: AppointmentTiming;
|
|
68
|
+
scheduledAt?: string;
|
|
69
|
+
serviceAddress?: Record<string, unknown>;
|
|
70
|
+
contactPhone?: string;
|
|
71
|
+
notes?: string;
|
|
72
|
+
paymentMethod?: string;
|
|
73
|
+
}
|
|
74
|
+
/** Statuses that still occupy the provider's calendar. */
|
|
75
|
+
export declare const ACTIVE_APPOINTMENT_STATUSES: readonly AppointmentStatus[];
|
|
76
|
+
/**
|
|
77
|
+
* Format an instant in the provider's timezone so customers and providers see
|
|
78
|
+
* the same wall-clock time regardless of the device timezone.
|
|
79
|
+
*/
|
|
80
|
+
export declare const formatAppointmentTime: (iso: string, timezone: string, options?: Intl.DateTimeFormatOptions) => string;
|
|
81
|
+
/**
|
|
82
|
+
* One-line service address for display (street, landmark, instructions as
|
|
83
|
+
* sent by DirectServiceBookingPage, plus area/city when present), or null.
|
|
84
|
+
*/
|
|
85
|
+
export declare const formatServiceAddress: (address: Record<string, unknown> | null) => string | null;
|
|
86
|
+
/**
|
|
87
|
+
* Whether the customer may still cancel or reschedule, mirroring the service
|
|
88
|
+
* rule: a scheduled booking (BOOKED or CONFIRMED) until `cancellationCutoffHours`
|
|
89
|
+
* before its start; a come-now request only while it is unconfirmed and its
|
|
90
|
+
* window has not ended.
|
|
91
|
+
*/
|
|
92
|
+
export declare const customerCanChangeAppointment: (appointment: Pick<ServiceAppointment, "status" | "timing" | "scheduledAt" | "endsAt">, cancellationCutoffHours: number, now: number) => boolean;
|
|
93
|
+
/** Calendar date (`YYYY-MM-DD`) of `instant` in `timezone`. */
|
|
94
|
+
export declare const calendarDateIn: (timezone: string, instant?: Date) => string;
|
|
95
|
+
export declare const useAppointmentSettings: (providerId?: string) => import('@tanstack/react-query').UseQueryResult<AppointmentSettings, Error>;
|
|
96
|
+
export declare const useAvailableSlots: (offeringId?: string, date?: string) => import('@tanstack/react-query').UseQueryResult<AvailableSlots, Error>;
|
|
97
|
+
/** The appointment booked with an order, or null when the order is not a service booking. */
|
|
98
|
+
export declare const useOrderAppointment: (orderId?: string) => import('@tanstack/react-query').UseQueryResult<ServiceAppointment | null, Error>;
|
|
99
|
+
/**
|
|
100
|
+
* Every active (BOOKED, CONFIRMED, IN_PROGRESS) appointment of a provider,
|
|
101
|
+
* soonest first. Queried per status with no date bound, so overdue bookings
|
|
102
|
+
* from earlier days (e.g. a service that ran past midnight) stay manageable.
|
|
103
|
+
*/
|
|
104
|
+
export declare const useProviderAppointments: (providerId?: string) => import('@tanstack/react-query').UseQueryResult<ServiceAppointment[], Error>;
|
|
105
|
+
export declare const useBookAppointment: () => import('@tanstack/react-query').UseMutationResult<ServiceAppointment, Error, BookAppointmentInput, unknown>;
|
|
106
|
+
export declare const useRescheduleAppointment: () => import('@tanstack/react-query').UseMutationResult<ServiceAppointment, Error, {
|
|
107
|
+
id: string;
|
|
108
|
+
scheduledAt: string;
|
|
109
|
+
}, unknown>;
|
|
110
|
+
export declare const useCancelAppointment: () => import('@tanstack/react-query').UseMutationResult<ServiceAppointment, Error, {
|
|
111
|
+
id: string;
|
|
112
|
+
reason?: string;
|
|
113
|
+
}, unknown>;
|
|
114
|
+
export declare const useUpdateAppointmentStatus: () => import('@tanstack/react-query').UseMutationResult<ServiceAppointment, Error, {
|
|
115
|
+
id: string;
|
|
116
|
+
status: ProviderAppointmentStatus;
|
|
117
|
+
reason?: string;
|
|
118
|
+
}, unknown>;
|
|
119
|
+
export declare const useUpsertAppointmentSettings: () => import('@tanstack/react-query').UseMutationResult<AppointmentSettings, Error, {
|
|
120
|
+
providerId: string;
|
|
121
|
+
input: AppointmentSettingsInput;
|
|
122
|
+
}, unknown>;
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { useKadaikodi as e } from "../context/KadaikodiContext.js";
|
|
2
|
+
import "../context/index.js";
|
|
3
|
+
import { kadaikodiQuery as t } from "./useKadaikodiApi.js";
|
|
4
|
+
import { useMutation as n, useQuery as r, useQueryClient as i } from "@tanstack/react-query";
|
|
5
|
+
// src/kadaikodi/hooks/useAppointmentsApi.ts
|
|
6
|
+
var a = "\n id providerId offeringId customerId orderId timing status scheduledAt endsAt durationMinutes\n serviceAddress contactPhone notes rescheduleCount cancellationReason\n offering { id name price }\n", o = "\n providerId slotIntervalMinutes capacityPerSlot bufferMinutes minLeadMinutes advanceBookingDays\n cancellationCutoffHours autoConfirm timezone blackoutDates isCustomized bookableDays\n", s = [
|
|
7
|
+
"BOOKED",
|
|
8
|
+
"CONFIRMED",
|
|
9
|
+
"IN_PROGRESS"
|
|
10
|
+
], c = (e, t, n = {
|
|
11
|
+
hour: "numeric",
|
|
12
|
+
minute: "2-digit"
|
|
13
|
+
}) => new Date(e).toLocaleString("en-IN", {
|
|
14
|
+
...n,
|
|
15
|
+
timeZone: t
|
|
16
|
+
}), l = (e) => {
|
|
17
|
+
if (!e) return null;
|
|
18
|
+
let t = [
|
|
19
|
+
"street",
|
|
20
|
+
"area",
|
|
21
|
+
"city",
|
|
22
|
+
"landmark",
|
|
23
|
+
"instructions"
|
|
24
|
+
].map((t) => e[t]).filter((e) => typeof e == "string" && e.trim().length > 0).map((e) => e.trim());
|
|
25
|
+
return t.length > 0 ? t.join(", ") : null;
|
|
26
|
+
}, u = (e, t, n) => e.status !== "BOOKED" && e.status !== "CONFIRMED" ? !1 : e.timing === "COME_NOW" ? e.status === "BOOKED" && n < new Date(e.endsAt).getTime() : n <= new Date(e.scheduledAt).getTime() - t * 36e5, d = (e, t = /* @__PURE__ */ new Date()) => new Intl.DateTimeFormat("en-CA", {
|
|
27
|
+
timeZone: e,
|
|
28
|
+
year: "numeric",
|
|
29
|
+
month: "2-digit",
|
|
30
|
+
day: "2-digit"
|
|
31
|
+
}).format(t), f = 3e4, p = 3e4, m = 100, h = 20, g = (n) => {
|
|
32
|
+
let { apiGatewayUrl: i } = e();
|
|
33
|
+
return r({
|
|
34
|
+
queryKey: [
|
|
35
|
+
"kadaikodi",
|
|
36
|
+
"appointment-settings",
|
|
37
|
+
n
|
|
38
|
+
],
|
|
39
|
+
queryFn: async () => (await t(`query AppointmentSettings($providerId: ID!) {
|
|
40
|
+
kadaikodiAppointmentSettings(providerId: $providerId) { ${o} }
|
|
41
|
+
}`, { providerId: n }, i)).kadaikodiAppointmentSettings,
|
|
42
|
+
enabled: !!n
|
|
43
|
+
});
|
|
44
|
+
}, _ = (n, i) => {
|
|
45
|
+
let { apiGatewayUrl: a } = e();
|
|
46
|
+
return r({
|
|
47
|
+
queryKey: [
|
|
48
|
+
"kadaikodi",
|
|
49
|
+
"appointment-slots",
|
|
50
|
+
n,
|
|
51
|
+
i
|
|
52
|
+
],
|
|
53
|
+
queryFn: async () => (await t("query AvailableSlots($offeringId: ID!, $date: String!) {\n kadaikodiListAvailableSlots(offeringId: $offeringId, date: $date) {\n date timezone durationMinutes nextAvailableAt\n slots { startsAt endsAt available remainingCapacity }\n }\n }", {
|
|
54
|
+
offeringId: n,
|
|
55
|
+
date: i
|
|
56
|
+
}, a)).kadaikodiListAvailableSlots,
|
|
57
|
+
enabled: !!(n && i)
|
|
58
|
+
});
|
|
59
|
+
}, v = (n) => {
|
|
60
|
+
let { apiGatewayUrl: i } = e();
|
|
61
|
+
return r({
|
|
62
|
+
queryKey: [
|
|
63
|
+
"kadaikodi",
|
|
64
|
+
"order-appointment",
|
|
65
|
+
n
|
|
66
|
+
],
|
|
67
|
+
queryFn: async () => (await t(`query OrderAppointment($id: ID!) {
|
|
68
|
+
kadaikodiOrder(id: $id) { id appointment { ${a} } }
|
|
69
|
+
}`, { id: n }, i)).kadaikodiOrder?.appointment ?? null,
|
|
70
|
+
enabled: !!n,
|
|
71
|
+
refetchInterval: (e) => {
|
|
72
|
+
let t = e.state.data;
|
|
73
|
+
return t && s.includes(t.status) ? p : !1;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}, y = (n) => {
|
|
77
|
+
let { apiGatewayUrl: i } = e();
|
|
78
|
+
return r({
|
|
79
|
+
queryKey: [
|
|
80
|
+
"kadaikodi",
|
|
81
|
+
"provider-appointments",
|
|
82
|
+
n
|
|
83
|
+
],
|
|
84
|
+
queryFn: async () => {
|
|
85
|
+
let e = [];
|
|
86
|
+
for (let r of s) for (let o = 0; o < h; o++) {
|
|
87
|
+
let s = (await t(`query ProviderAppointments($providerId: ID!, $status: KadaikodiAppointmentStatus, $pagination: KadaikodiPaginationInput) {
|
|
88
|
+
kadaikodiProviderAppointments(providerId: $providerId, status: $status, pagination: $pagination) {
|
|
89
|
+
${a}
|
|
90
|
+
}
|
|
91
|
+
}`, {
|
|
92
|
+
providerId: n,
|
|
93
|
+
status: r,
|
|
94
|
+
pagination: {
|
|
95
|
+
limit: m,
|
|
96
|
+
offset: o * m
|
|
97
|
+
}
|
|
98
|
+
}, i)).kadaikodiProviderAppointments;
|
|
99
|
+
if (e.push(...s), s.length < m) break;
|
|
100
|
+
}
|
|
101
|
+
let r = (e) => s.indexOf(e), o = /* @__PURE__ */ new Map();
|
|
102
|
+
for (let t of e) {
|
|
103
|
+
let e = o.get(t.id);
|
|
104
|
+
(!e || r(t.status) > r(e.status)) && o.set(t.id, t);
|
|
105
|
+
}
|
|
106
|
+
return [...o.values()].sort((e, t) => new Date(e.scheduledAt).getTime() - new Date(t.scheduledAt).getTime());
|
|
107
|
+
},
|
|
108
|
+
enabled: !!n,
|
|
109
|
+
refetchInterval: f
|
|
110
|
+
});
|
|
111
|
+
}, b = () => {
|
|
112
|
+
let e = i();
|
|
113
|
+
return () => {
|
|
114
|
+
for (let t of [
|
|
115
|
+
"appointment-slots",
|
|
116
|
+
"order-appointment",
|
|
117
|
+
"provider-appointments",
|
|
118
|
+
"orders",
|
|
119
|
+
"order"
|
|
120
|
+
]) e.invalidateQueries({ queryKey: ["kadaikodi", t] });
|
|
121
|
+
};
|
|
122
|
+
}, x = () => {
|
|
123
|
+
let { apiGatewayUrl: r } = e(), i = b();
|
|
124
|
+
return n({
|
|
125
|
+
mutationFn: async (e) => (await t(`mutation BookAppointment($input: KadaikodiBookAppointmentInput!) {
|
|
126
|
+
kadaikodiBookAppointment(input: $input) { ${a} }
|
|
127
|
+
}`, { input: e }, r)).kadaikodiBookAppointment,
|
|
128
|
+
onSuccess: i
|
|
129
|
+
});
|
|
130
|
+
}, S = () => {
|
|
131
|
+
let { apiGatewayUrl: r } = e(), i = b();
|
|
132
|
+
return n({
|
|
133
|
+
mutationFn: async ({ id: e, scheduledAt: n }) => (await t(`mutation RescheduleAppointment($id: ID!, $scheduledAt: DateTime!) {
|
|
134
|
+
kadaikodiRescheduleAppointment(id: $id, scheduledAt: $scheduledAt) { ${a} }
|
|
135
|
+
}`, {
|
|
136
|
+
id: e,
|
|
137
|
+
scheduledAt: n
|
|
138
|
+
}, r)).kadaikodiRescheduleAppointment,
|
|
139
|
+
onSuccess: i
|
|
140
|
+
});
|
|
141
|
+
}, C = () => {
|
|
142
|
+
let { apiGatewayUrl: r } = e(), i = b();
|
|
143
|
+
return n({
|
|
144
|
+
mutationFn: async ({ id: e, reason: n }) => (await t(`mutation CancelAppointment($id: ID!, $reason: String) {
|
|
145
|
+
kadaikodiCancelAppointment(id: $id, reason: $reason) { ${a} }
|
|
146
|
+
}`, {
|
|
147
|
+
id: e,
|
|
148
|
+
reason: n
|
|
149
|
+
}, r)).kadaikodiCancelAppointment,
|
|
150
|
+
onSuccess: i
|
|
151
|
+
});
|
|
152
|
+
}, w = () => {
|
|
153
|
+
let { apiGatewayUrl: r } = e(), i = b();
|
|
154
|
+
return n({
|
|
155
|
+
mutationFn: async ({ id: e, status: n, reason: i }) => (await t(`mutation UpdateAppointmentStatus($id: ID!, $status: KadaikodiAppointmentProviderStatus!, $reason: String) {
|
|
156
|
+
kadaikodiUpdateAppointmentStatus(id: $id, status: $status, reason: $reason) { ${a} }
|
|
157
|
+
}`, {
|
|
158
|
+
id: e,
|
|
159
|
+
status: n,
|
|
160
|
+
reason: i
|
|
161
|
+
}, r)).kadaikodiUpdateAppointmentStatus,
|
|
162
|
+
onSuccess: i
|
|
163
|
+
});
|
|
164
|
+
}, T = () => {
|
|
165
|
+
let r = i(), { apiGatewayUrl: a } = e();
|
|
166
|
+
return n({
|
|
167
|
+
mutationFn: async ({ providerId: e, input: n }) => (await t(`mutation UpsertAppointmentSettings($providerId: ID!, $input: KadaikodiAppointmentSettingsInput!) {
|
|
168
|
+
kadaikodiUpsertAppointmentSettings(providerId: $providerId, input: $input) { ${o} }
|
|
169
|
+
}`, {
|
|
170
|
+
providerId: e,
|
|
171
|
+
input: n
|
|
172
|
+
}, a)).kadaikodiUpsertAppointmentSettings,
|
|
173
|
+
onSuccess: (e) => {
|
|
174
|
+
r.setQueryData([
|
|
175
|
+
"kadaikodi",
|
|
176
|
+
"appointment-settings",
|
|
177
|
+
e.providerId
|
|
178
|
+
], e), r.invalidateQueries({ queryKey: ["kadaikodi", "appointment-slots"] });
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
export { s as ACTIVE_APPOINTMENT_STATUSES, d as calendarDateIn, u as customerCanChangeAppointment, c as formatAppointmentTime, l as formatServiceAddress, g as useAppointmentSettings, _ as useAvailableSlots, x as useBookAppointment, C as useCancelAppointment, v as useOrderAppointment, y as useProviderAppointments, S as useRescheduleAppointment, w as useUpdateAppointmentStatus, T as useUpsertAppointmentSettings };
|
|
183
|
+
|
|
184
|
+
//# sourceMappingURL=useAppointmentsApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAppointmentsApi.js","names":["APPOINTMENT_FIELDS","SETTINGS_FIELDS","ACTIVE_APPOINTMENT_STATUSES","formatAppointmentTime","iso","options","timezone","formatServiceAddress","address","parts","key","value","customerCanChangeAppointment","appointment","now","cancellationCutoffHours","calendarDateIn","instant","PROVIDER_QUEUE_POLL_MS","ACTIVE_APPOINTMENT_POLL_MS","PROVIDER_QUEUE_PAGE_SIZE","PROVIDER_QUEUE_MAX_PAGES","useAppointmentSettings","useKadaikodi","useQuery","providerId","kadaikodiQuery","apiGatewayUrl","useAvailableSlots","offeringId","date","useOrderAppointment","orderId","query","useProviderAppointments","appointments","status","page","rows","rank","byId","seen","a","b","useInvalidateAppointments","queryClient","useQueryClient","useBookAppointment","invalidate","useMutation","useRescheduleAppointment","useCancelAppointment","useUpdateAppointmentStatus","useUpsertAppointmentSettings","settings"],"sources":["../../../src/kadaikodi/hooks/useAppointmentsApi.ts"],"sourcesContent":["/**\n * Service appointment hooks (BOFF-3965).\n *\n * Slot availability, booking, reschedule/cancel and the provider appointment\n * queue all come from wspace-kadaikodi-svc; nothing here computes slots on the\n * client. Every appointment is paired with an order, so mutations also\n * invalidate the order caches the existing pages read.\n *\n * @module kadaikodi/hooks\n */\n\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\n\nimport { useKadaikodi } from '../context';\nimport { kadaikodiQuery } from './useKadaikodiApi';\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport type AppointmentStatus =\n 'BOOKED' | 'CONFIRMED' | 'IN_PROGRESS' | 'COMPLETED' | 'CANCELLED' | 'NO_SHOW';\n\n/** Statuses a provider can move an appointment to. */\nexport type ProviderAppointmentStatus = Exclude<AppointmentStatus, 'BOOKED'>;\n\nexport type AppointmentTiming = 'SCHEDULED' | 'COME_NOW';\n\nexport interface ServiceAppointment {\n id: string;\n providerId: string;\n offeringId: string;\n customerId: string;\n orderId: string | null;\n timing: AppointmentTiming;\n status: AppointmentStatus;\n scheduledAt: string;\n endsAt: string;\n durationMinutes: number;\n serviceAddress: Record<string, unknown> | null;\n contactPhone: string | null;\n notes: string | null;\n rescheduleCount: number;\n cancellationReason: string | null;\n offering: { id: string; name: string; price: number } | null;\n}\n\nexport interface AppointmentSlot {\n startsAt: string;\n endsAt: string;\n available: boolean;\n remainingCapacity: number;\n}\n\nexport interface AvailableSlots {\n date: string;\n timezone: string;\n durationMinutes: number;\n slots: AppointmentSlot[];\n nextAvailableAt: string | null;\n}\n\nexport interface AppointmentSettings {\n providerId: string;\n slotIntervalMinutes: number;\n capacityPerSlot: number;\n bufferMinutes: number;\n minLeadMinutes: number;\n advanceBookingDays: number;\n cancellationCutoffHours: number;\n autoConfirm: boolean;\n timezone: string;\n blackoutDates: string[];\n isCustomized: boolean;\n bookableDays: string[];\n}\n\nexport type AppointmentSettingsInput = Partial<\n Omit<AppointmentSettings, 'providerId' | 'isCustomized' | 'bookableDays'>\n>;\n\nexport interface BookAppointmentInput {\n offeringId: string;\n timing: AppointmentTiming;\n scheduledAt?: string;\n serviceAddress?: Record<string, unknown>;\n contactPhone?: string;\n notes?: string;\n paymentMethod?: string;\n}\n\nconst APPOINTMENT_FIELDS = `\n id providerId offeringId customerId orderId timing status scheduledAt endsAt durationMinutes\n serviceAddress contactPhone notes rescheduleCount cancellationReason\n offering { id name price }\n`;\n\nconst SETTINGS_FIELDS = `\n providerId slotIntervalMinutes capacityPerSlot bufferMinutes minLeadMinutes advanceBookingDays\n cancellationCutoffHours autoConfirm timezone blackoutDates isCustomized bookableDays\n`;\n\n/** Statuses that still occupy the provider's calendar. */\nexport const ACTIVE_APPOINTMENT_STATUSES: readonly AppointmentStatus[] = [\n 'BOOKED',\n 'CONFIRMED',\n 'IN_PROGRESS',\n];\n\n/**\n * Format an instant in the provider's timezone so customers and providers see\n * the same wall-clock time regardless of the device timezone.\n */\nexport const formatAppointmentTime = (\n iso: string,\n timezone: string,\n options: Intl.DateTimeFormatOptions = { hour: 'numeric', minute: '2-digit' }\n): string => new Date(iso).toLocaleString('en-IN', { ...options, timeZone: timezone });\n\n/**\n * One-line service address for display (street, landmark, instructions as\n * sent by DirectServiceBookingPage, plus area/city when present), or null.\n */\nexport const formatServiceAddress = (address: Record<string, unknown> | null): string | null => {\n if (!address) return null;\n const parts = ['street', 'area', 'city', 'landmark', 'instructions']\n .map((key) => address[key])\n .filter((value): value is string => typeof value === 'string' && value.trim().length > 0)\n .map((value) => value.trim());\n return parts.length > 0 ? parts.join(', ') : null;\n};\n\n/**\n * Whether the customer may still cancel or reschedule, mirroring the service\n * rule: a scheduled booking (BOOKED or CONFIRMED) until `cancellationCutoffHours`\n * before its start; a come-now request only while it is unconfirmed and its\n * window has not ended.\n */\nexport const customerCanChangeAppointment = (\n appointment: Pick<ServiceAppointment, 'status' | 'timing' | 'scheduledAt' | 'endsAt'>,\n cancellationCutoffHours: number,\n now: number\n): boolean => {\n if (appointment.status !== 'BOOKED' && appointment.status !== 'CONFIRMED') return false;\n if (appointment.timing === 'COME_NOW') {\n return appointment.status === 'BOOKED' && now < new Date(appointment.endsAt).getTime();\n }\n const cutoff = new Date(appointment.scheduledAt).getTime() - cancellationCutoffHours * 3_600_000;\n return now <= cutoff;\n};\n\n/** Calendar date (`YYYY-MM-DD`) of `instant` in `timezone`. */\nexport const calendarDateIn = (timezone: string, instant: Date = new Date()): string =>\n // en-CA formats dates as YYYY-MM-DD.\n new Intl.DateTimeFormat('en-CA', {\n timeZone: timezone,\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n }).format(instant);\n\n/** How often the provider queue polls for new bookings while it is open. */\nconst PROVIDER_QUEUE_POLL_MS = 30_000;\n/** How often a customer's active appointment is refreshed while it is on screen. */\nconst ACTIVE_APPOINTMENT_POLL_MS = 30_000;\n/** Page size for the provider queue (the service's maximum page size). */\nconst PROVIDER_QUEUE_PAGE_SIZE = 100;\n/** Upper bound on pages fetched per status and refresh (2,000 active appointments). */\nconst PROVIDER_QUEUE_MAX_PAGES = 20;\n\n// ============================================================================\n// Queries\n// ============================================================================\n\nexport const useAppointmentSettings = (providerId?: string) => {\n const { apiGatewayUrl } = useKadaikodi();\n return useQuery({\n queryKey: ['kadaikodi', 'appointment-settings', providerId],\n queryFn: async () => {\n const result = await kadaikodiQuery<{ kadaikodiAppointmentSettings: AppointmentSettings }>(\n `query AppointmentSettings($providerId: ID!) {\n kadaikodiAppointmentSettings(providerId: $providerId) { ${SETTINGS_FIELDS} }\n }`,\n { providerId },\n apiGatewayUrl\n );\n return result.kadaikodiAppointmentSettings;\n },\n enabled: Boolean(providerId),\n });\n};\n\nexport const useAvailableSlots = (offeringId?: string, date?: string) => {\n const { apiGatewayUrl } = useKadaikodi();\n return useQuery({\n queryKey: ['kadaikodi', 'appointment-slots', offeringId, date],\n queryFn: async () => {\n const result = await kadaikodiQuery<{ kadaikodiListAvailableSlots: AvailableSlots }>(\n `query AvailableSlots($offeringId: ID!, $date: String!) {\n kadaikodiListAvailableSlots(offeringId: $offeringId, date: $date) {\n date timezone durationMinutes nextAvailableAt\n slots { startsAt endsAt available remainingCapacity }\n }\n }`,\n { offeringId, date },\n apiGatewayUrl\n );\n return result.kadaikodiListAvailableSlots;\n },\n enabled: Boolean(offeringId && date),\n });\n};\n\n/** The appointment booked with an order, or null when the order is not a service booking. */\nexport const useOrderAppointment = (orderId?: string) => {\n const { apiGatewayUrl } = useKadaikodi();\n return useQuery({\n queryKey: ['kadaikodi', 'order-appointment', orderId],\n queryFn: async () => {\n const result = await kadaikodiQuery<{\n kadaikodiOrder: { id: string; appointment: ServiceAppointment | null } | null;\n }>(\n `query OrderAppointment($id: ID!) {\n kadaikodiOrder(id: $id) { id appointment { ${APPOINTMENT_FIELDS} } }\n }`,\n { id: orderId },\n apiGatewayUrl\n );\n return result.kadaikodiOrder?.appointment ?? null;\n },\n enabled: Boolean(orderId),\n // While the appointment is still active the provider may confirm, start,\n // cancel or complete it from another session: poll so the status and the\n // customer's actions stay current. Finished or non-appointment orders stop.\n refetchInterval: (query) => {\n const appointment = query.state.data;\n return appointment && ACTIVE_APPOINTMENT_STATUSES.includes(appointment.status)\n ? ACTIVE_APPOINTMENT_POLL_MS\n : false;\n },\n });\n};\n\n/**\n * Every active (BOOKED, CONFIRMED, IN_PROGRESS) appointment of a provider,\n * soonest first. Queried per status with no date bound, so overdue bookings\n * from earlier days (e.g. a service that ran past midnight) stay manageable.\n */\nexport const useProviderAppointments = (providerId?: string) => {\n const { apiGatewayUrl } = useKadaikodi();\n return useQuery({\n queryKey: ['kadaikodi', 'provider-appointments', providerId],\n queryFn: async () => {\n const appointments: ServiceAppointment[] = [];\n for (const status of ACTIVE_APPOINTMENT_STATUSES) {\n // Walk every page (the service caps a page at 100 rows).\n for (let page = 0; page < PROVIDER_QUEUE_MAX_PAGES; page++) {\n const result = await kadaikodiQuery<{\n kadaikodiProviderAppointments: ServiceAppointment[];\n }>(\n `query ProviderAppointments($providerId: ID!, $status: KadaikodiAppointmentStatus, $pagination: KadaikodiPaginationInput) {\n kadaikodiProviderAppointments(providerId: $providerId, status: $status, pagination: $pagination) {\n ${APPOINTMENT_FIELDS}\n }\n }`,\n {\n providerId,\n status,\n pagination: {\n limit: PROVIDER_QUEUE_PAGE_SIZE,\n offset: page * PROVIDER_QUEUE_PAGE_SIZE,\n },\n },\n apiGatewayUrl\n );\n const rows = result.kadaikodiProviderAppointments;\n appointments.push(...rows);\n if (rows.length < PROVIDER_QUEUE_PAGE_SIZE) break;\n }\n }\n // An appointment can advance (e.g. BOOKED -> CONFIRMED) between the\n // per-status requests and appear twice; keep the most advanced record.\n const rank = (status: AppointmentStatus): number =>\n ACTIVE_APPOINTMENT_STATUSES.indexOf(status);\n const byId = new Map<string, ServiceAppointment>();\n for (const appointment of appointments) {\n const seen = byId.get(appointment.id);\n if (!seen || rank(appointment.status) > rank(seen.status)) {\n byId.set(appointment.id, appointment);\n }\n }\n return [...byId.values()].sort(\n (a, b) => new Date(a.scheduledAt).getTime() - new Date(b.scheduledAt).getTime()\n );\n },\n enabled: Boolean(providerId),\n // Poll so incoming bookings appear without a reload.\n refetchInterval: PROVIDER_QUEUE_POLL_MS,\n });\n};\n\n// ============================================================================\n// Mutations\n// ============================================================================\n\nconst useInvalidateAppointments = () => {\n const queryClient = useQueryClient();\n return () => {\n for (const key of [\n 'appointment-slots',\n 'order-appointment',\n 'provider-appointments',\n 'orders',\n 'order',\n ]) {\n void queryClient.invalidateQueries({ queryKey: ['kadaikodi', key] });\n }\n };\n};\n\nexport const useBookAppointment = () => {\n const { apiGatewayUrl } = useKadaikodi();\n const invalidate = useInvalidateAppointments();\n return useMutation({\n mutationFn: async (input: BookAppointmentInput) => {\n const result = await kadaikodiQuery<{ kadaikodiBookAppointment: ServiceAppointment }>(\n `mutation BookAppointment($input: KadaikodiBookAppointmentInput!) {\n kadaikodiBookAppointment(input: $input) { ${APPOINTMENT_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.kadaikodiBookAppointment;\n },\n onSuccess: invalidate,\n });\n};\n\nexport const useRescheduleAppointment = () => {\n const { apiGatewayUrl } = useKadaikodi();\n const invalidate = useInvalidateAppointments();\n return useMutation({\n mutationFn: async ({ id, scheduledAt }: { id: string; scheduledAt: string }) => {\n const result = await kadaikodiQuery<{ kadaikodiRescheduleAppointment: ServiceAppointment }>(\n `mutation RescheduleAppointment($id: ID!, $scheduledAt: DateTime!) {\n kadaikodiRescheduleAppointment(id: $id, scheduledAt: $scheduledAt) { ${APPOINTMENT_FIELDS} }\n }`,\n { id, scheduledAt },\n apiGatewayUrl\n );\n return result.kadaikodiRescheduleAppointment;\n },\n onSuccess: invalidate,\n });\n};\n\nexport const useCancelAppointment = () => {\n const { apiGatewayUrl } = useKadaikodi();\n const invalidate = useInvalidateAppointments();\n return useMutation({\n mutationFn: async ({ id, reason }: { id: string; reason?: string }) => {\n const result = await kadaikodiQuery<{ kadaikodiCancelAppointment: ServiceAppointment }>(\n `mutation CancelAppointment($id: ID!, $reason: String) {\n kadaikodiCancelAppointment(id: $id, reason: $reason) { ${APPOINTMENT_FIELDS} }\n }`,\n { id, reason },\n apiGatewayUrl\n );\n return result.kadaikodiCancelAppointment;\n },\n onSuccess: invalidate,\n });\n};\n\nexport const useUpdateAppointmentStatus = () => {\n const { apiGatewayUrl } = useKadaikodi();\n const invalidate = useInvalidateAppointments();\n return useMutation({\n mutationFn: async ({\n id,\n status,\n reason,\n }: {\n id: string;\n status: ProviderAppointmentStatus;\n reason?: string;\n }) => {\n const result = await kadaikodiQuery<{ kadaikodiUpdateAppointmentStatus: ServiceAppointment }>(\n `mutation UpdateAppointmentStatus($id: ID!, $status: KadaikodiAppointmentProviderStatus!, $reason: String) {\n kadaikodiUpdateAppointmentStatus(id: $id, status: $status, reason: $reason) { ${APPOINTMENT_FIELDS} }\n }`,\n { id, status, reason },\n apiGatewayUrl\n );\n return result.kadaikodiUpdateAppointmentStatus;\n },\n onSuccess: invalidate,\n });\n};\n\nexport const useUpsertAppointmentSettings = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useKadaikodi();\n return useMutation({\n mutationFn: async ({\n providerId,\n input,\n }: {\n providerId: string;\n input: AppointmentSettingsInput;\n }) => {\n const result = await kadaikodiQuery<{\n kadaikodiUpsertAppointmentSettings: AppointmentSettings;\n }>(\n `mutation UpsertAppointmentSettings($providerId: ID!, $input: KadaikodiAppointmentSettingsInput!) {\n kadaikodiUpsertAppointmentSettings(providerId: $providerId, input: $input) { ${SETTINGS_FIELDS} }\n }`,\n { providerId, input },\n apiGatewayUrl\n );\n return result.kadaikodiUpsertAppointmentSettings;\n },\n onSuccess: (settings) => {\n queryClient.setQueryData(\n ['kadaikodi', 'appointment-settings', settings.providerId],\n settings\n );\n void queryClient.invalidateQueries({ queryKey: ['kadaikodi', 'appointment-slots'] });\n },\n });\n};\n"],"mappings":"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"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { MockCart, MockOrder, InvestmentOpportunity, Investment, DashboardStats, AdminAnalytics, WorkerTask, WorkerSchedule, WorkerStats } from '../types';
|
|
2
|
+
export declare const kadaikodiQuery: <TData>(query: string, variables: Record<string, unknown>, baseUrl?: string) => Promise<TData>;
|
|
2
3
|
export interface KadaikodiOfferingRow {
|
|
3
4
|
id: string;
|
|
4
5
|
providerId: string;
|
|
@@ -141,6 +142,8 @@ export declare const useRankedOfferings: () => import('@tanstack/react-query').U
|
|
|
141
142
|
export declare const useOrders: (input?: {
|
|
142
143
|
providerId?: string;
|
|
143
144
|
customerId?: string;
|
|
145
|
+
/** Leave out service appointment bookings (BOFF-3965); they have their own queue. */
|
|
146
|
+
excludeAppointments?: boolean;
|
|
144
147
|
}) => import('@tanstack/react-query').UseQueryResult<MockOrder[], Error>;
|
|
145
148
|
export declare const useOrder: (id?: string, options?: {
|
|
146
149
|
pollWhileActive?: boolean;
|
|
@@ -273,10 +273,11 @@ var ee = [
|
|
|
273
273
|
"kadaikodi",
|
|
274
274
|
"orders",
|
|
275
275
|
t.providerId,
|
|
276
|
-
t.customerId
|
|
276
|
+
t.customerId,
|
|
277
|
+
t.excludeAppointments ?? !1
|
|
277
278
|
],
|
|
278
|
-
queryFn: async () => (await u(`query Orders($providerId: String, $customerId: String, $pagination: KadaikodiPaginationInput) {
|
|
279
|
-
kadaikodiListOrders(providerId: $providerId, customerId: $customerId, pagination: $pagination) {
|
|
279
|
+
queryFn: async () => (await u(`query Orders($providerId: String, $customerId: String, $excludeAppointments: Boolean, $pagination: KadaikodiPaginationInput) {
|
|
280
|
+
kadaikodiListOrders(providerId: $providerId, customerId: $customerId, excludeAppointments: $excludeAppointments, pagination: $pagination) {
|
|
280
281
|
${x}
|
|
281
282
|
}
|
|
282
283
|
}`, {
|
|
@@ -770,6 +771,6 @@ var ee = [
|
|
|
770
771
|
s
|
|
771
772
|
]);
|
|
772
773
|
};
|
|
773
|
-
export { H as useAddAddress, q as useAddPaymentMethod, M as useAdminAnalytics, ce as useAwardLoyaltyPoints, be as useCreateInvestmentOpportunity, pe as useCreateOffering, de as useCreatePaymentIntent, ge as useCreateProvider, _e as useCreateProviderWorker, $ as useCreateReview, j as useDashboardStats, W as useDeleteAddress, Se as useDeleteOffering, he as useInvest, N as useInvestmentOpportunities, P as useInvestments, Te as useKadaikodiApi, se as useListLoyaltyTransactions, oe as useLoyaltyAccountByCustomerId, V as useMyAddresses, Y as useMyFavoriteProviderIds, re as useMyLoyaltyAccount, ie as useMyLoyaltyTransactions, K as useMyPaymentMethods, T as useOfferings, A as useOrder, k as useOrders, ue as usePlaceOrder, w as useProvider, F as useProviderWorkers, C as useProviders, O as useRankedOfferings, ae as useRedeemLoyaltyPoints, ne as useRemovePaymentMethod, le as useReviews, G as useSetDefaultAddress, J as useSetDefaultPaymentMethod, X as useToggleFavorite, U as useUpdateAddress, me as useUpdateOffering, fe as useUpdateOrderStatus, xe as useUpdateProvider, we as useUpdateProviderWorker, Ce as useUpdateWorkerTask, ve as useUpdateWorkerTaskStatus, ye as useWorkerClockInOut, R as useWorkerSchedules, L as useWorkerStats, I as useWorkerTasks };
|
|
774
|
+
export { u as kadaikodiQuery, H as useAddAddress, q as useAddPaymentMethod, M as useAdminAnalytics, ce as useAwardLoyaltyPoints, be as useCreateInvestmentOpportunity, pe as useCreateOffering, de as useCreatePaymentIntent, ge as useCreateProvider, _e as useCreateProviderWorker, $ as useCreateReview, j as useDashboardStats, W as useDeleteAddress, Se as useDeleteOffering, he as useInvest, N as useInvestmentOpportunities, P as useInvestments, Te as useKadaikodiApi, se as useListLoyaltyTransactions, oe as useLoyaltyAccountByCustomerId, V as useMyAddresses, Y as useMyFavoriteProviderIds, re as useMyLoyaltyAccount, ie as useMyLoyaltyTransactions, K as useMyPaymentMethods, T as useOfferings, A as useOrder, k as useOrders, ue as usePlaceOrder, w as useProvider, F as useProviderWorkers, C as useProviders, O as useRankedOfferings, ae as useRedeemLoyaltyPoints, ne as useRemovePaymentMethod, le as useReviews, G as useSetDefaultAddress, J as useSetDefaultPaymentMethod, X as useToggleFavorite, U as useUpdateAddress, me as useUpdateOffering, fe as useUpdateOrderStatus, xe as useUpdateProvider, we as useUpdateProviderWorker, Ce as useUpdateWorkerTask, ve as useUpdateWorkerTaskStatus, ye as useWorkerClockInOut, R as useWorkerSchedules, L as useWorkerStats, I as useWorkerTasks };
|
|
774
775
|
|
|
775
776
|
//# sourceMappingURL=useKadaikodiApi.js.map
|