@anker-in/ui 0.1.3 → 0.1.4

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/index.d.mts CHANGED
@@ -100,14 +100,29 @@ interface CreateBookingRequest {
100
100
  interface Booking {
101
101
  booking_id: number;
102
102
  demoroom_code: string;
103
+ demoroom_name?: string;
104
+ address?: string;
105
+ equipment?: string;
106
+ latitude?: number;
107
+ longitude?: number;
108
+ timezone?: string;
103
109
  booking_date: string;
104
- booking_time: string;
110
+ booking_time?: string;
111
+ time_slot?: string;
105
112
  customer_name: string;
106
113
  customer_email: string;
114
+ phone_code?: string;
115
+ phone_number?: string;
107
116
  status: BookingStatus;
108
117
  cancel_token: string;
109
118
  created_at: string;
110
119
  }
120
+ interface GetBookingResponse {
121
+ booking: Booking;
122
+ }
123
+ interface CancelBookingResponse {
124
+ booking: Booking;
125
+ }
111
126
  declare enum ApiErrorCode {
112
127
  SUCCESS = 0,
113
128
  PARAM_ERROR = 1001,
@@ -175,10 +190,17 @@ declare class DemoRoomApiClient {
175
190
  */
176
191
  createBooking(data: CreateBookingRequest): Promise<Booking>;
177
192
  /**
178
- * 根据 token 获取预约信息
179
- * @param token 预约 token
193
+ * 根据 token 获取预约详情(支持多语言)
194
+ * @param token 预约凭证 (cancel_token)
195
+ * @param locale 语言偏好(可选,也可以通过 Accept-Language Header)
180
196
  */
181
- getBooking(token: string): Promise<Booking>;
197
+ getBooking(token: string, locale?: string): Promise<Booking>;
198
+ /**
199
+ * 取消预约(支持多语言邮件通知)
200
+ * @param token 预约凭证 (cancel_token)
201
+ * @param locale 语言偏好(可选,用于邮件通知)
202
+ */
203
+ cancelBooking(token: string, locale?: string): Promise<Booking>;
182
204
  }
183
205
  declare function createDemoRoomApi(config: DemoRoomApiConfig): DemoRoomApiClient;
184
206
 
@@ -226,7 +248,7 @@ interface BookingSuccessProps {
226
248
  bookingData?: Booking;
227
249
  token?: string;
228
250
  apiConfig?: DemoRoomApiConfig;
229
- onBackToHome?: () => void;
251
+ onScheduleAgain?: () => void;
230
252
  className?: string;
231
253
  }
232
254
  declare const BookingSuccess: React.FC<BookingSuccessProps>;
@@ -277,7 +299,22 @@ declare function useCreateBooking(client: DemoRoomApiClient): {
277
299
  loading: boolean;
278
300
  error: ApiError | null;
279
301
  };
302
+ /**
303
+ * 获取预约详情 Hook
304
+ */
305
+ declare function useBooking(client: DemoRoomApiClient, token: string, locale?: string, options?: {
306
+ enabled?: boolean;
307
+ }): UseApiState<Booking>;
308
+ /**
309
+ * 取消预约 Hook
310
+ */
311
+ declare function useCancelBooking(client: DemoRoomApiClient): {
312
+ cancelBooking: (token: string, locale?: string) => Promise<Booking>;
313
+ data: Booking | null;
314
+ loading: boolean;
315
+ error: ApiError | null;
316
+ };
280
317
 
281
318
  declare function cn(...inputs: ClassValue[]): string;
282
319
 
283
- export { ApiError, ApiErrorCode, type ApiResponse, type Booking, BookingForm, type BookingFormProps, type BookingStatus, BookingSuccess, type BookingSuccessProps, type CreateBookingRequest, DemoRoomApiClient, type DemoRoomApiConfig, type DemoRoom as DemoRoomData, DemoRoomDetail, type DemoRoomDetailProps, type DemoRoomStatus, type DemoRoomType, type GetDemoRoomsResponse, type GetTimeslotsResponse, type Question, type QuestionOption, type QuestionType, type Questionnaire, type Timeslot, type TimeslotStatus, cn, createDemoRoomApi, useCreateBooking, useDemoRoom, useDemoRooms, useQuestionnaire, useTimeslots };
320
+ export { ApiError, ApiErrorCode, type ApiResponse, type Booking, BookingForm, type BookingFormProps, type BookingStatus, BookingSuccess, type BookingSuccessProps, type CancelBookingResponse, type CreateBookingRequest, DemoRoomApiClient, type DemoRoomApiConfig, type DemoRoom as DemoRoomData, DemoRoomDetail, type DemoRoomDetailProps, type DemoRoomStatus, type DemoRoomType, type GetBookingResponse, type GetDemoRoomsResponse, type GetTimeslotsResponse, type Question, type QuestionOption, type QuestionType, type Questionnaire, type Timeslot, type TimeslotStatus, cn, createDemoRoomApi, useBooking, useCancelBooking, useCreateBooking, useDemoRoom, useDemoRooms, useQuestionnaire, useTimeslots };
package/dist/index.d.ts CHANGED
@@ -100,14 +100,29 @@ interface CreateBookingRequest {
100
100
  interface Booking {
101
101
  booking_id: number;
102
102
  demoroom_code: string;
103
+ demoroom_name?: string;
104
+ address?: string;
105
+ equipment?: string;
106
+ latitude?: number;
107
+ longitude?: number;
108
+ timezone?: string;
103
109
  booking_date: string;
104
- booking_time: string;
110
+ booking_time?: string;
111
+ time_slot?: string;
105
112
  customer_name: string;
106
113
  customer_email: string;
114
+ phone_code?: string;
115
+ phone_number?: string;
107
116
  status: BookingStatus;
108
117
  cancel_token: string;
109
118
  created_at: string;
110
119
  }
120
+ interface GetBookingResponse {
121
+ booking: Booking;
122
+ }
123
+ interface CancelBookingResponse {
124
+ booking: Booking;
125
+ }
111
126
  declare enum ApiErrorCode {
112
127
  SUCCESS = 0,
113
128
  PARAM_ERROR = 1001,
@@ -175,10 +190,17 @@ declare class DemoRoomApiClient {
175
190
  */
176
191
  createBooking(data: CreateBookingRequest): Promise<Booking>;
177
192
  /**
178
- * 根据 token 获取预约信息
179
- * @param token 预约 token
193
+ * 根据 token 获取预约详情(支持多语言)
194
+ * @param token 预约凭证 (cancel_token)
195
+ * @param locale 语言偏好(可选,也可以通过 Accept-Language Header)
180
196
  */
181
- getBooking(token: string): Promise<Booking>;
197
+ getBooking(token: string, locale?: string): Promise<Booking>;
198
+ /**
199
+ * 取消预约(支持多语言邮件通知)
200
+ * @param token 预约凭证 (cancel_token)
201
+ * @param locale 语言偏好(可选,用于邮件通知)
202
+ */
203
+ cancelBooking(token: string, locale?: string): Promise<Booking>;
182
204
  }
183
205
  declare function createDemoRoomApi(config: DemoRoomApiConfig): DemoRoomApiClient;
184
206
 
@@ -226,7 +248,7 @@ interface BookingSuccessProps {
226
248
  bookingData?: Booking;
227
249
  token?: string;
228
250
  apiConfig?: DemoRoomApiConfig;
229
- onBackToHome?: () => void;
251
+ onScheduleAgain?: () => void;
230
252
  className?: string;
231
253
  }
232
254
  declare const BookingSuccess: React.FC<BookingSuccessProps>;
@@ -277,7 +299,22 @@ declare function useCreateBooking(client: DemoRoomApiClient): {
277
299
  loading: boolean;
278
300
  error: ApiError | null;
279
301
  };
302
+ /**
303
+ * 获取预约详情 Hook
304
+ */
305
+ declare function useBooking(client: DemoRoomApiClient, token: string, locale?: string, options?: {
306
+ enabled?: boolean;
307
+ }): UseApiState<Booking>;
308
+ /**
309
+ * 取消预约 Hook
310
+ */
311
+ declare function useCancelBooking(client: DemoRoomApiClient): {
312
+ cancelBooking: (token: string, locale?: string) => Promise<Booking>;
313
+ data: Booking | null;
314
+ loading: boolean;
315
+ error: ApiError | null;
316
+ };
280
317
 
281
318
  declare function cn(...inputs: ClassValue[]): string;
282
319
 
283
- export { ApiError, ApiErrorCode, type ApiResponse, type Booking, BookingForm, type BookingFormProps, type BookingStatus, BookingSuccess, type BookingSuccessProps, type CreateBookingRequest, DemoRoomApiClient, type DemoRoomApiConfig, type DemoRoom as DemoRoomData, DemoRoomDetail, type DemoRoomDetailProps, type DemoRoomStatus, type DemoRoomType, type GetDemoRoomsResponse, type GetTimeslotsResponse, type Question, type QuestionOption, type QuestionType, type Questionnaire, type Timeslot, type TimeslotStatus, cn, createDemoRoomApi, useCreateBooking, useDemoRoom, useDemoRooms, useQuestionnaire, useTimeslots };
320
+ export { ApiError, ApiErrorCode, type ApiResponse, type Booking, BookingForm, type BookingFormProps, type BookingStatus, BookingSuccess, type BookingSuccessProps, type CancelBookingResponse, type CreateBookingRequest, DemoRoomApiClient, type DemoRoomApiConfig, type DemoRoom as DemoRoomData, DemoRoomDetail, type DemoRoomDetailProps, type DemoRoomStatus, type DemoRoomType, type GetBookingResponse, type GetDemoRoomsResponse, type GetTimeslotsResponse, type Question, type QuestionOption, type QuestionType, type Questionnaire, type Timeslot, type TimeslotStatus, cn, createDemoRoomApi, useBooking, useCancelBooking, useCreateBooking, useDemoRoom, useDemoRooms, useQuestionnaire, useTimeslots };
package/dist/index.js CHANGED
@@ -1040,6 +1040,66 @@ function useCreateBooking(client) {
1040
1040
  createBooking
1041
1041
  };
1042
1042
  }
1043
+ function useBooking(client, token, locale, options) {
1044
+ const [state, setState] = React2.useState({
1045
+ data: null,
1046
+ loading: true,
1047
+ error: null
1048
+ });
1049
+ const enabled = options?.enabled !== false;
1050
+ React2.useEffect(() => {
1051
+ if (!enabled || !token) return;
1052
+ let cancelled = false;
1053
+ const fetchData = async () => {
1054
+ setState((prev) => ({ ...prev, loading: true, error: null }));
1055
+ try {
1056
+ const data = await client.getBooking(token, locale);
1057
+ if (!cancelled) {
1058
+ setState({ data, loading: false, error: null });
1059
+ }
1060
+ } catch (error) {
1061
+ if (!cancelled) {
1062
+ setState({
1063
+ data: null,
1064
+ loading: false,
1065
+ error: error instanceof ApiError ? error : new ApiError(1006, "Unknown error")
1066
+ });
1067
+ }
1068
+ }
1069
+ };
1070
+ fetchData();
1071
+ return () => {
1072
+ cancelled = true;
1073
+ };
1074
+ }, [client, token, locale, enabled]);
1075
+ return state;
1076
+ }
1077
+ function useCancelBooking(client) {
1078
+ const [state, setState] = React2.useState({
1079
+ data: null,
1080
+ loading: false,
1081
+ error: null
1082
+ });
1083
+ const cancelBooking = React2.useCallback(
1084
+ async (token, locale) => {
1085
+ setState({ data: null, loading: true, error: null });
1086
+ try {
1087
+ const result = await client.cancelBooking(token, locale);
1088
+ setState({ data: result, loading: false, error: null });
1089
+ return result;
1090
+ } catch (error) {
1091
+ const apiError = error instanceof ApiError ? error : new ApiError(1006, "Unknown error");
1092
+ setState({ data: null, loading: false, error: apiError });
1093
+ throw apiError;
1094
+ }
1095
+ },
1096
+ [client]
1097
+ );
1098
+ return {
1099
+ ...state,
1100
+ cancelBooking
1101
+ };
1102
+ }
1043
1103
  var AntdMobileIsolated = ({
1044
1104
  children,
1045
1105
  className,
@@ -1811,11 +1871,39 @@ var DemoRoomApiClient = class {
1811
1871
  });
1812
1872
  }
1813
1873
  /**
1814
- * 根据 token 获取预约信息
1815
- * @param token 预约 token
1874
+ * 根据 token 获取预约详情(支持多语言)
1875
+ * @param token 预约凭证 (cancel_token)
1876
+ * @param locale 语言偏好(可选,也可以通过 Accept-Language Header)
1877
+ */
1878
+ async getBooking(token, locale) {
1879
+ const headers = {};
1880
+ if (locale) {
1881
+ headers["Accept-Language"] = locale;
1882
+ }
1883
+ const response = await this.request(
1884
+ `/api/v1/store/bookings/${token}`,
1885
+ { headers }
1886
+ );
1887
+ return response.booking;
1888
+ }
1889
+ /**
1890
+ * 取消预约(支持多语言邮件通知)
1891
+ * @param token 预约凭证 (cancel_token)
1892
+ * @param locale 语言偏好(可选,用于邮件通知)
1816
1893
  */
1817
- async getBooking(token) {
1818
- return this.request(`/api/v1/store/bookings/${token}`);
1894
+ async cancelBooking(token, locale) {
1895
+ const headers = {};
1896
+ if (locale) {
1897
+ headers["Accept-Language"] = locale;
1898
+ }
1899
+ const response = await this.request(
1900
+ `/api/v1/store/bookings/${token}/cancel`,
1901
+ {
1902
+ method: "POST",
1903
+ headers
1904
+ }
1905
+ );
1906
+ return response.booking;
1819
1907
  }
1820
1908
  };
1821
1909
  function createDemoRoomApi(config) {
@@ -2239,7 +2327,7 @@ var QuestionnaireForm = ({
2239
2327
  }
2240
2328
  );
2241
2329
  case "radio":
2242
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-3", children: question.options?.map((option) => /* @__PURE__ */ jsxRuntime.jsxs(
2330
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-3", children: question?.options?.map((option) => /* @__PURE__ */ jsxRuntime.jsxs(
2243
2331
  "label",
2244
2332
  {
2245
2333
  className: "flex items-center gap-3 cursor-pointer group",
@@ -2261,7 +2349,7 @@ var QuestionnaireForm = ({
2261
2349
  option.value || option.label
2262
2350
  )) });
2263
2351
  case "checkbox":
2264
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-3", children: question.options?.map((option) => {
2352
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-3", children: question?.options?.map((option) => {
2265
2353
  const optionValue = option.value || option.label;
2266
2354
  const isChecked = (responses[questionId] || []).includes(
2267
2355
  optionValue
@@ -2320,7 +2408,7 @@ var QuestionnaireForm = ({
2320
2408
  }
2321
2409
  };
2322
2410
  return /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleSubmit, className: cn("space-y-6", className), children: [
2323
- questions.map((question) => {
2411
+ questions?.map((question) => {
2324
2412
  const questionId = getQuestionId(question);
2325
2413
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
2326
2414
  /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "block", children: [
@@ -2806,12 +2894,13 @@ var BookingSuccess = ({
2806
2894
  bookingData: initialBookingData,
2807
2895
  token,
2808
2896
  apiConfig,
2809
- onBackToHome,
2897
+ onScheduleAgain,
2810
2898
  className
2811
2899
  }) => {
2812
2900
  const [bookingData, setBookingData] = React2.useState(initialBookingData || null);
2813
2901
  const [loading, setLoading] = React2.useState(false);
2814
2902
  const [error, setError] = React2.useState(null);
2903
+ const [isCancelled, setIsCancelled] = React2.useState(false);
2815
2904
  React2.useEffect(() => {
2816
2905
  if (token && apiConfig && !initialBookingData) {
2817
2906
  const fetchBookingData = async () => {
@@ -2819,8 +2908,9 @@ var BookingSuccess = ({
2819
2908
  setError(null);
2820
2909
  try {
2821
2910
  const apiClient = createDemoRoomApi(apiConfig);
2822
- const booking = await apiClient.getBooking(token);
2911
+ const booking = await apiClient.getBooking(token, apiConfig.locale);
2823
2912
  setBookingData(booking);
2913
+ setIsCancelled(booking.status === "cancelled");
2824
2914
  } catch (err) {
2825
2915
  console.error("Failed to fetch booking data:", err);
2826
2916
  setError("Failed to load booking information");
@@ -2832,140 +2922,115 @@ var BookingSuccess = ({
2832
2922
  }
2833
2923
  }, [token, apiConfig, initialBookingData]);
2834
2924
  if (loading) {
2835
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `min-h-screen bg-[#F5F5F5] py-12 px-6 ${className || ""}`, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "max-w-2xl mx-auto text-center", children: [
2836
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "animate-spin w-16 h-16 mx-auto mb-4 border-4 border-[#3ADB67] border-t-transparent rounded-full" }),
2837
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xl text-gray-600", children: "Loading booking information..." })
2838
- ] }) });
2925
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `min-h-screen bg-white py-12 px-6 ${className || ""}`, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-3xl mx-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "animate-pulse space-y-6", children: [
2926
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-8 bg-gray-200 rounded w-1/3" }),
2927
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-24 bg-gray-200 rounded" }),
2928
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
2929
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-20 bg-gray-200 rounded" }),
2930
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-20 bg-gray-200 rounded" }),
2931
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-20 bg-gray-200 rounded" })
2932
+ ] })
2933
+ ] }) }) });
2839
2934
  }
2840
2935
  if (error || !bookingData) {
2841
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `min-h-screen bg-[#F5F5F5] py-12 px-6 ${className || ""}`, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-2xl mx-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-white rounded-[12px] border border-red-200 p-8 text-center", children: [
2842
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-16 h-16 mx-auto mb-4 rounded-full bg-red-100 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
2843
- "svg",
2844
- {
2845
- width: "32",
2846
- height: "32",
2847
- viewBox: "0 0 24 24",
2848
- fill: "none",
2849
- xmlns: "http://www.w3.org/2000/svg",
2850
- children: /* @__PURE__ */ jsxRuntime.jsx(
2851
- "path",
2852
- {
2853
- d: "M12 8V12M12 16H12.01M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z",
2854
- stroke: "#EF4444",
2855
- strokeWidth: "2",
2856
- strokeLinecap: "round",
2857
- strokeLinejoin: "round"
2858
- }
2859
- )
2860
- }
2861
- ) }),
2936
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `min-h-screen bg-white py-12 px-6 ${className || ""}`, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-3xl mx-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center py-12", children: [
2937
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-6xl mb-4", children: "\u274C" }),
2862
2938
  /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-2xl font-bold text-gray-900 mb-2", children: error || "Booking Not Found" }),
2863
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base text-gray-600 mb-6", children: "We couldn't find your booking information. Please check your booking confirmation email or contact support." }),
2864
- onBackToHome && /* @__PURE__ */ jsxRuntime.jsx(
2939
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base text-gray-600 mb-6", children: "We couldn't find your booking information." }),
2940
+ onScheduleAgain && /* @__PURE__ */ jsxRuntime.jsx(
2865
2941
  "button",
2866
2942
  {
2867
- onClick: onBackToHome,
2868
- className: "px-6 py-3 rounded-full bg-[#3ADB67] text-white font-medium text-base hover:bg-[#2FC257] transition-colors focus:outline-none focus:ring-2 focus:ring-[#3ADB67] focus:ring-offset-2",
2869
- children: "Back to Home"
2943
+ onClick: onScheduleAgain,
2944
+ className: "px-6 py-3 bg-black text-white rounded-full font-medium hover:bg-gray-800 transition-colors",
2945
+ children: "Schedule Again"
2870
2946
  }
2871
2947
  )
2872
2948
  ] }) }) });
2873
2949
  }
2874
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `min-h-screen bg-[#F5F5F5] py-12 px-6 ${className || ""}`, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "max-w-2xl mx-auto", children: [
2875
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center mb-8", children: [
2876
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-20 h-20 mx-auto mb-6 rounded-full bg-[#3ADB67] flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
2877
- "svg",
2950
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `min-h-screen bg-white py-12 px-6 ${className || ""}`, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "max-w-3xl mx-auto", children: [
2951
+ /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-[40px] font-bold text-gray-900 mb-8", children: "Your Appointment" }),
2952
+ isCancelled ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-gray-50 rounded-lg p-6 mb-8 flex items-center justify-between", children: [
2953
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base text-gray-700", children: "This appointment has been canceled." }),
2954
+ onScheduleAgain && /* @__PURE__ */ jsxRuntime.jsx(
2955
+ "button",
2878
2956
  {
2879
- width: "48",
2880
- height: "48",
2881
- viewBox: "0 0 32 32",
2882
- fill: "none",
2883
- xmlns: "http://www.w3.org/2000/svg",
2884
- children: /* @__PURE__ */ jsxRuntime.jsx(
2885
- "path",
2886
- {
2887
- d: "M26.6667 8L12 22.6667L5.33334 16",
2888
- stroke: "white",
2889
- strokeWidth: "3",
2890
- strokeLinecap: "round",
2891
- strokeLinejoin: "round"
2892
- }
2893
- )
2957
+ onClick: onScheduleAgain,
2958
+ className: "px-6 py-3 bg-black text-white rounded-full font-medium hover:bg-gray-800 transition-colors whitespace-nowrap",
2959
+ children: "Schedule again"
2894
2960
  }
2895
- ) }),
2896
- /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-[48px] font-bold text-gray-900 mb-4", children: "Booking Confirmed!" }),
2897
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xl text-gray-600", children: "Your demo room booking has been successfully confirmed." })
2898
- ] }),
2899
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-white rounded-[12px] border border-[#E4E5E6] p-8 mb-6", children: [
2900
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-2xl font-bold text-gray-900 mb-6", children: "Booking Details" }),
2901
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
2902
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between items-start py-3 border-b border-gray-100", children: [
2903
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-base text-gray-600 font-medium", children: "Booking ID" }),
2904
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-base text-gray-900 font-semibold", children: bookingData.booking_id })
2905
- ] }),
2906
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between items-start py-3 border-b border-gray-100", children: [
2907
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-base text-gray-600 font-medium", children: "Date" }),
2908
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-base text-gray-900 font-semibold", children: bookingData.booking_date })
2909
- ] }),
2910
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between items-start py-3 border-b border-gray-100", children: [
2911
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-base text-gray-600 font-medium", children: "Time" }),
2912
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-base text-gray-900 font-semibold", children: bookingData.booking_time })
2913
- ] }),
2914
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between items-start py-3 border-b border-gray-100", children: [
2915
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-base text-gray-600 font-medium", children: "Status" }),
2916
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-flex items-center px-3 py-1 rounded-full text-sm font-medium bg-[#3ADB67] bg-opacity-10 text-[#3ADB67]", children: bookingData.status })
2917
- ] }),
2918
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between items-start py-3", children: [
2919
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-base text-gray-600 font-medium", children: "Email" }),
2920
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-base text-gray-900 font-semibold", children: bookingData.customer_email })
2921
- ] })
2922
- ] })
2923
- ] }),
2924
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-blue-50 border border-blue-200 rounded-[12px] p-6 mb-8", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-3", children: [
2925
- /* @__PURE__ */ jsxRuntime.jsx(
2926
- "svg",
2927
- {
2928
- className: "w-6 h-6 text-blue-600 flex-shrink-0 mt-0.5",
2929
- fill: "none",
2930
- viewBox: "0 0 24 24",
2931
- stroke: "currentColor",
2932
- children: /* @__PURE__ */ jsxRuntime.jsx(
2933
- "path",
2961
+ )
2962
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-green-50 rounded-lg p-6 mb-8 flex items-center justify-between border border-green-200", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
2963
+ /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "w-6 h-6 text-green-600", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) }),
2964
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base text-gray-700", children: "Your appointment has been confirmed." })
2965
+ ] }) }),
2966
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-8", children: [
2967
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
2968
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-lg font-semibold text-gray-900 mb-3", children: "Location" }),
2969
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
2970
+ bookingData.demoroom_name && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base font-medium text-gray-900", children: bookingData.demoroom_name }),
2971
+ bookingData.address && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base text-gray-600", children: bookingData.address }),
2972
+ bookingData.latitude && bookingData.longitude && /* @__PURE__ */ jsxRuntime.jsx(
2973
+ "a",
2934
2974
  {
2935
- strokeLinecap: "round",
2936
- strokeLinejoin: "round",
2937
- strokeWidth: 2,
2938
- d: "M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"
2975
+ href: `https://www.google.com/maps/search/?api=1&query=${bookingData.latitude},${bookingData.longitude}`,
2976
+ target: "_blank",
2977
+ rel: "noopener noreferrer",
2978
+ className: "inline-flex items-center gap-1 text-base text-blue-600 hover:text-blue-700 hover:underline",
2979
+ children: "Open in Google Maps \u2197"
2939
2980
  }
2940
2981
  )
2941
- }
2942
- ),
2982
+ ] })
2983
+ ] }),
2943
2984
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
2944
- /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-base font-semibold text-blue-900 mb-1", children: "Confirmation Email Sent" }),
2945
- /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-blue-800", children: [
2946
- "A confirmation email has been sent to ",
2947
- /* @__PURE__ */ jsxRuntime.jsx("strong", { children: bookingData.customer_email }),
2948
- " with all the booking details and instructions."
2985
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-lg font-semibold text-gray-900 mb-3", children: "Date and Time" }),
2986
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-base text-gray-900", children: [
2987
+ bookingData.booking_date,
2988
+ bookingData.time_slot && `, ${bookingData.time_slot}`,
2989
+ !bookingData.time_slot && bookingData.booking_time && `, ${bookingData.booking_time}`
2990
+ ] })
2991
+ ] }),
2992
+ bookingData.equipment && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
2993
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-lg font-semibold text-gray-900 mb-3", children: "Event" }),
2994
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base text-gray-900", children: bookingData.equipment })
2995
+ ] }),
2996
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
2997
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-lg font-semibold text-gray-900 mb-3", children: "Demo Room" }),
2998
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base text-gray-900", children: bookingData.demoroom_code })
2999
+ ] }),
3000
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
3001
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-lg font-semibold text-gray-900 mb-3", children: "Visitor Info" }),
3002
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
3003
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base text-gray-900", children: bookingData.customer_name }),
3004
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-base text-gray-600", children: [
3005
+ /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "w-5 h-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsxRuntime.jsx(
3006
+ "path",
3007
+ {
3008
+ strokeLinecap: "round",
3009
+ strokeLinejoin: "round",
3010
+ strokeWidth: 2,
3011
+ d: "M3 5a2 2 0 012-2h3.28a1 1 0 01.948.684l1.498 4.493a1 1 0 01-.502 1.21l-2.257 1.13a11.042 11.042 0 005.516 5.516l1.13-2.257a1 1 0 011.21-.502l4.493 1.498a1 1 0 01.684.949V19a2 2 0 01-2 2h-1C9.716 21 3 14.284 3 6V5z"
3012
+ }
3013
+ ) }),
3014
+ bookingData.phone_code && bookingData.phone_number ? /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
3015
+ bookingData.phone_code,
3016
+ " ",
3017
+ bookingData.phone_number
3018
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { children: "No phone provided" })
3019
+ ] }),
3020
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-base text-gray-600", children: [
3021
+ /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "w-5 h-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsxRuntime.jsx(
3022
+ "path",
3023
+ {
3024
+ strokeLinecap: "round",
3025
+ strokeLinejoin: "round",
3026
+ strokeWidth: 2,
3027
+ d: "M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"
3028
+ }
3029
+ ) }),
3030
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: bookingData.customer_email })
3031
+ ] })
2949
3032
  ] })
2950
3033
  ] })
2951
- ] }) }),
2952
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col sm:flex-row gap-4", children: [
2953
- onBackToHome && /* @__PURE__ */ jsxRuntime.jsx(
2954
- "button",
2955
- {
2956
- onClick: onBackToHome,
2957
- className: "flex-1 px-6 py-4 rounded-full bg-[#3ADB67] text-white font-medium text-base hover:bg-[#2FC257] transition-colors focus:outline-none focus:ring-2 focus:ring-[#3ADB67] focus:ring-offset-2",
2958
- children: "Back to Home"
2959
- }
2960
- ),
2961
- /* @__PURE__ */ jsxRuntime.jsx(
2962
- "button",
2963
- {
2964
- onClick: () => window.print(),
2965
- className: "flex-1 px-6 py-4 rounded-full border-2 border-[#3ADB67] text-[#3ADB67] font-medium text-base hover:bg-[#3ADB67] hover:bg-opacity-5 transition-colors focus:outline-none focus:ring-2 focus:ring-[#3ADB67] focus:ring-offset-2",
2966
- children: "Print Confirmation"
2967
- }
2968
- )
2969
3034
  ] })
2970
3035
  ] }) });
2971
3036
  };
@@ -3116,6 +3181,8 @@ exports.DemoRoomDetail = DemoRoomDetail;
3116
3181
  exports.ThemeProvider = ThemeProvider;
3117
3182
  exports.cn = cn;
3118
3183
  exports.createDemoRoomApi = createDemoRoomApi;
3184
+ exports.useBooking = useBooking;
3185
+ exports.useCancelBooking = useCancelBooking;
3119
3186
  exports.useCreateBooking = useCreateBooking;
3120
3187
  exports.useDemoRoom = useDemoRoom;
3121
3188
  exports.useDemoRooms = useDemoRooms;