@anker-in/ui 0.1.2 → 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) {
@@ -1861,21 +1949,38 @@ var DemoRoom = ({
1861
1949
  ] });
1862
1950
  };
1863
1951
  DemoRoom.displayName = "DemoRoom";
1864
- var swiperModules;
1952
+ var Navigation;
1953
+ var Pagination;
1954
+ var Autoplay;
1955
+ var swiperVersion = "11+";
1865
1956
  try {
1866
- swiperModules = __require("swiper/modules");
1957
+ const modules = __require("swiper/modules");
1958
+ Navigation = modules.Navigation;
1959
+ Pagination = modules.Pagination;
1960
+ Autoplay = modules.Autoplay;
1961
+ swiperVersion = "11+";
1867
1962
  } catch (e) {
1868
1963
  try {
1869
1964
  const SwiperCore = __require("swiper");
1870
- swiperModules = SwiperCore;
1965
+ const SwiperNavigation = __require("swiper/modules/navigation");
1966
+ const SwiperPagination = __require("swiper/modules/pagination");
1967
+ const SwiperAutoplay = __require("swiper/modules/autoplay");
1968
+ const SwiperClass = SwiperCore.default || SwiperCore;
1969
+ if (SwiperClass && SwiperClass.use) {
1970
+ SwiperClass.use([
1971
+ SwiperNavigation.default || SwiperNavigation,
1972
+ SwiperPagination.default || SwiperPagination,
1973
+ SwiperAutoplay.default || SwiperAutoplay
1974
+ ]);
1975
+ }
1976
+ Navigation = SwiperNavigation.default || SwiperNavigation;
1977
+ Pagination = SwiperPagination.default || SwiperPagination;
1978
+ Autoplay = SwiperAutoplay.default || SwiperAutoplay;
1979
+ swiperVersion = "8";
1871
1980
  } catch (e2) {
1872
- console.warn("Failed to load swiper modules");
1873
- swiperModules = {};
1981
+ console.warn("Failed to load swiper modules:", e2);
1874
1982
  }
1875
1983
  }
1876
- var Navigation = swiperModules.Navigation;
1877
- var Pagination = swiperModules.Pagination;
1878
- var Autoplay = swiperModules.Autoplay;
1879
1984
  if (typeof window !== "undefined") {
1880
1985
  try {
1881
1986
  __require("swiper/css");
@@ -2075,7 +2180,7 @@ var DemoRoomDetail = ({
2075
2180
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative h-[400px] rounded-2xl overflow-hidden", children: images.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
2076
2181
  react.Swiper,
2077
2182
  {
2078
- modules: [Navigation, Pagination, Autoplay],
2183
+ ...swiperVersion === "11+" && Navigation && Pagination && Autoplay ? { modules: [Navigation, Pagination, Autoplay] } : {},
2079
2184
  spaceBetween: 0,
2080
2185
  slidesPerView: 1,
2081
2186
  navigation: true,
@@ -2222,7 +2327,7 @@ var QuestionnaireForm = ({
2222
2327
  }
2223
2328
  );
2224
2329
  case "radio":
2225
- 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(
2226
2331
  "label",
2227
2332
  {
2228
2333
  className: "flex items-center gap-3 cursor-pointer group",
@@ -2244,7 +2349,7 @@ var QuestionnaireForm = ({
2244
2349
  option.value || option.label
2245
2350
  )) });
2246
2351
  case "checkbox":
2247
- 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) => {
2248
2353
  const optionValue = option.value || option.label;
2249
2354
  const isChecked = (responses[questionId] || []).includes(
2250
2355
  optionValue
@@ -2303,7 +2408,7 @@ var QuestionnaireForm = ({
2303
2408
  }
2304
2409
  };
2305
2410
  return /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleSubmit, className: cn("space-y-6", className), children: [
2306
- questions.map((question) => {
2411
+ questions?.map((question) => {
2307
2412
  const questionId = getQuestionId(question);
2308
2413
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
2309
2414
  /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "block", children: [
@@ -2789,12 +2894,13 @@ var BookingSuccess = ({
2789
2894
  bookingData: initialBookingData,
2790
2895
  token,
2791
2896
  apiConfig,
2792
- onBackToHome,
2897
+ onScheduleAgain,
2793
2898
  className
2794
2899
  }) => {
2795
2900
  const [bookingData, setBookingData] = React2.useState(initialBookingData || null);
2796
2901
  const [loading, setLoading] = React2.useState(false);
2797
2902
  const [error, setError] = React2.useState(null);
2903
+ const [isCancelled, setIsCancelled] = React2.useState(false);
2798
2904
  React2.useEffect(() => {
2799
2905
  if (token && apiConfig && !initialBookingData) {
2800
2906
  const fetchBookingData = async () => {
@@ -2802,8 +2908,9 @@ var BookingSuccess = ({
2802
2908
  setError(null);
2803
2909
  try {
2804
2910
  const apiClient = createDemoRoomApi(apiConfig);
2805
- const booking = await apiClient.getBooking(token);
2911
+ const booking = await apiClient.getBooking(token, apiConfig.locale);
2806
2912
  setBookingData(booking);
2913
+ setIsCancelled(booking.status === "cancelled");
2807
2914
  } catch (err) {
2808
2915
  console.error("Failed to fetch booking data:", err);
2809
2916
  setError("Failed to load booking information");
@@ -2815,140 +2922,115 @@ var BookingSuccess = ({
2815
2922
  }
2816
2923
  }, [token, apiConfig, initialBookingData]);
2817
2924
  if (loading) {
2818
- 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: [
2819
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "animate-spin w-16 h-16 mx-auto mb-4 border-4 border-[#3ADB67] border-t-transparent rounded-full" }),
2820
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xl text-gray-600", children: "Loading booking information..." })
2821
- ] }) });
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
+ ] }) }) });
2822
2934
  }
2823
2935
  if (error || !bookingData) {
2824
- 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: [
2825
- /* @__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(
2826
- "svg",
2827
- {
2828
- width: "32",
2829
- height: "32",
2830
- viewBox: "0 0 24 24",
2831
- fill: "none",
2832
- xmlns: "http://www.w3.org/2000/svg",
2833
- children: /* @__PURE__ */ jsxRuntime.jsx(
2834
- "path",
2835
- {
2836
- 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",
2837
- stroke: "#EF4444",
2838
- strokeWidth: "2",
2839
- strokeLinecap: "round",
2840
- strokeLinejoin: "round"
2841
- }
2842
- )
2843
- }
2844
- ) }),
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" }),
2845
2938
  /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-2xl font-bold text-gray-900 mb-2", children: error || "Booking Not Found" }),
2846
- /* @__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." }),
2847
- 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(
2848
2941
  "button",
2849
2942
  {
2850
- onClick: onBackToHome,
2851
- 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",
2852
- 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"
2853
2946
  }
2854
2947
  )
2855
2948
  ] }) }) });
2856
2949
  }
2857
- 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: [
2858
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center mb-8", children: [
2859
- /* @__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(
2860
- "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",
2861
2956
  {
2862
- width: "48",
2863
- height: "48",
2864
- viewBox: "0 0 32 32",
2865
- fill: "none",
2866
- xmlns: "http://www.w3.org/2000/svg",
2867
- children: /* @__PURE__ */ jsxRuntime.jsx(
2868
- "path",
2869
- {
2870
- d: "M26.6667 8L12 22.6667L5.33334 16",
2871
- stroke: "white",
2872
- strokeWidth: "3",
2873
- strokeLinecap: "round",
2874
- strokeLinejoin: "round"
2875
- }
2876
- )
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"
2877
2960
  }
2878
- ) }),
2879
- /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-[48px] font-bold text-gray-900 mb-4", children: "Booking Confirmed!" }),
2880
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xl text-gray-600", children: "Your demo room booking has been successfully confirmed." })
2881
- ] }),
2882
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-white rounded-[12px] border border-[#E4E5E6] p-8 mb-6", children: [
2883
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-2xl font-bold text-gray-900 mb-6", children: "Booking Details" }),
2884
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
2885
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between items-start py-3 border-b border-gray-100", children: [
2886
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-base text-gray-600 font-medium", children: "Booking ID" }),
2887
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-base text-gray-900 font-semibold", children: bookingData.booking_id })
2888
- ] }),
2889
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between items-start py-3 border-b border-gray-100", children: [
2890
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-base text-gray-600 font-medium", children: "Date" }),
2891
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-base text-gray-900 font-semibold", children: bookingData.booking_date })
2892
- ] }),
2893
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between items-start py-3 border-b border-gray-100", children: [
2894
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-base text-gray-600 font-medium", children: "Time" }),
2895
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-base text-gray-900 font-semibold", children: bookingData.booking_time })
2896
- ] }),
2897
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between items-start py-3 border-b border-gray-100", children: [
2898
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-base text-gray-600 font-medium", children: "Status" }),
2899
- /* @__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 })
2900
- ] }),
2901
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between items-start py-3", children: [
2902
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-base text-gray-600 font-medium", children: "Email" }),
2903
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-base text-gray-900 font-semibold", children: bookingData.customer_email })
2904
- ] })
2905
- ] })
2906
- ] }),
2907
- /* @__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: [
2908
- /* @__PURE__ */ jsxRuntime.jsx(
2909
- "svg",
2910
- {
2911
- className: "w-6 h-6 text-blue-600 flex-shrink-0 mt-0.5",
2912
- fill: "none",
2913
- viewBox: "0 0 24 24",
2914
- stroke: "currentColor",
2915
- children: /* @__PURE__ */ jsxRuntime.jsx(
2916
- "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",
2917
2974
  {
2918
- strokeLinecap: "round",
2919
- strokeLinejoin: "round",
2920
- strokeWidth: 2,
2921
- 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"
2922
2980
  }
2923
2981
  )
2924
- }
2925
- ),
2982
+ ] })
2983
+ ] }),
2926
2984
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
2927
- /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-base font-semibold text-blue-900 mb-1", children: "Confirmation Email Sent" }),
2928
- /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-blue-800", children: [
2929
- "A confirmation email has been sent to ",
2930
- /* @__PURE__ */ jsxRuntime.jsx("strong", { children: bookingData.customer_email }),
2931
- " 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
+ ] })
2932
3032
  ] })
2933
3033
  ] })
2934
- ] }) }),
2935
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col sm:flex-row gap-4", children: [
2936
- onBackToHome && /* @__PURE__ */ jsxRuntime.jsx(
2937
- "button",
2938
- {
2939
- onClick: onBackToHome,
2940
- 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",
2941
- children: "Back to Home"
2942
- }
2943
- ),
2944
- /* @__PURE__ */ jsxRuntime.jsx(
2945
- "button",
2946
- {
2947
- onClick: () => window.print(),
2948
- 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",
2949
- children: "Print Confirmation"
2950
- }
2951
- )
2952
3034
  ] })
2953
3035
  ] }) });
2954
3036
  };
@@ -3099,6 +3181,8 @@ exports.DemoRoomDetail = DemoRoomDetail;
3099
3181
  exports.ThemeProvider = ThemeProvider;
3100
3182
  exports.cn = cn;
3101
3183
  exports.createDemoRoomApi = createDemoRoomApi;
3184
+ exports.useBooking = useBooking;
3185
+ exports.useCancelBooking = useCancelBooking;
3102
3186
  exports.useCreateBooking = useCreateBooking;
3103
3187
  exports.useDemoRoom = useDemoRoom;
3104
3188
  exports.useDemoRooms = useDemoRooms;