@anker-in/ui 0.1.0
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/README.md +83 -0
- package/dist/DemoRoom-CZyrsxWe.d.mts +30 -0
- package/dist/DemoRoom-CZyrsxWe.d.ts +30 -0
- package/dist/demo-room.css +33 -0
- package/dist/demo-room.css.map +1 -0
- package/dist/demo-room.d.mts +198 -0
- package/dist/demo-room.d.ts +198 -0
- package/dist/demo-room.js +1727 -0
- package/dist/demo-room.js.map +1 -0
- package/dist/demo-room.mjs +1713 -0
- package/dist/demo-room.mjs.map +1 -0
- package/dist/index.css +33 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.mts +283 -0
- package/dist/index.d.ts +283 -0
- package/dist/index.js +3077 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +3052 -0
- package/dist/index.mjs.map +1 -0
- package/dist/styles.css +1 -0
- package/dist/theme.d.mts +126 -0
- package/dist/theme.d.ts +126 -0
- package/dist/theme.js +147 -0
- package/dist/theme.js.map +1 -0
- package/dist/theme.mjs +144 -0
- package/dist/theme.mjs.map +1 -0
- package/package.json +83 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
export { D as DemoRoom, a as DemoRoomProps } from './DemoRoom-CZyrsxWe.js';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export { ThemeProvider, useTheme } from './theme.js';
|
|
4
|
+
import { ClassValue } from 'clsx';
|
|
5
|
+
|
|
6
|
+
interface BookingFormProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onSubmit'> {
|
|
7
|
+
layoutClassName?: string;
|
|
8
|
+
handleBookingSuccess?: (token?: string) => void;
|
|
9
|
+
/**
|
|
10
|
+
* API 配置
|
|
11
|
+
*/
|
|
12
|
+
apiConfig: {
|
|
13
|
+
baseUrl: string;
|
|
14
|
+
apiKey: string;
|
|
15
|
+
locale?: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* 门店代码(可选,可以从 URL 参数或 props 传入)
|
|
19
|
+
*/
|
|
20
|
+
demoRoomCode?: string;
|
|
21
|
+
/**
|
|
22
|
+
* 时区(可选)
|
|
23
|
+
*/
|
|
24
|
+
timezone?: string;
|
|
25
|
+
}
|
|
26
|
+
declare const BookingForm: React.FC<BookingFormProps>;
|
|
27
|
+
|
|
28
|
+
interface ApiResponse<T = any> {
|
|
29
|
+
code: number;
|
|
30
|
+
message: string;
|
|
31
|
+
data: T;
|
|
32
|
+
request_id: string;
|
|
33
|
+
}
|
|
34
|
+
type TimeslotStatus = 'available' | 'full' | 'disabled';
|
|
35
|
+
type DemoRoomType = 'flagship' | 'standard' | 'popup';
|
|
36
|
+
type DemoRoomStatus = 'enabled' | 'disabled';
|
|
37
|
+
type BookingStatus = 'pending' | 'checked_in' | 'completed' | 'cancelled';
|
|
38
|
+
type QuestionType = 'text' | 'email' | 'tel' | 'radio' | 'checkbox' | 'textarea' | 'select';
|
|
39
|
+
interface Timeslot {
|
|
40
|
+
id: number;
|
|
41
|
+
start_time: string;
|
|
42
|
+
end_time: string;
|
|
43
|
+
capacity: number;
|
|
44
|
+
booked_count: number;
|
|
45
|
+
status: TimeslotStatus;
|
|
46
|
+
}
|
|
47
|
+
interface DemoRoom {
|
|
48
|
+
code: string;
|
|
49
|
+
name: string;
|
|
50
|
+
description: string;
|
|
51
|
+
address: string;
|
|
52
|
+
type: DemoRoomType;
|
|
53
|
+
capacity: number;
|
|
54
|
+
status: DemoRoomStatus;
|
|
55
|
+
timezone: string;
|
|
56
|
+
images: string[];
|
|
57
|
+
latitude: number;
|
|
58
|
+
longitude: number;
|
|
59
|
+
questionnaire_id?: number;
|
|
60
|
+
timeslots: Timeslot[];
|
|
61
|
+
}
|
|
62
|
+
interface QuestionOption {
|
|
63
|
+
label: string;
|
|
64
|
+
value?: string;
|
|
65
|
+
}
|
|
66
|
+
interface Question {
|
|
67
|
+
id?: string;
|
|
68
|
+
key?: string;
|
|
69
|
+
type: QuestionType;
|
|
70
|
+
label: string;
|
|
71
|
+
description?: string;
|
|
72
|
+
placeholder?: string;
|
|
73
|
+
hint?: string;
|
|
74
|
+
options?: QuestionOption[];
|
|
75
|
+
required: boolean;
|
|
76
|
+
}
|
|
77
|
+
interface Questionnaire {
|
|
78
|
+
id: number;
|
|
79
|
+
name: string;
|
|
80
|
+
description: string;
|
|
81
|
+
questions: Question[];
|
|
82
|
+
}
|
|
83
|
+
interface GetDemoRoomsResponse {
|
|
84
|
+
demorooms: DemoRoom[];
|
|
85
|
+
}
|
|
86
|
+
interface GetTimeslotsResponse {
|
|
87
|
+
timeslots: Timeslot[];
|
|
88
|
+
timezone: string;
|
|
89
|
+
}
|
|
90
|
+
interface CreateBookingRequest {
|
|
91
|
+
demoroom_code: string;
|
|
92
|
+
timeslot_id: number;
|
|
93
|
+
questionnaire_id?: number;
|
|
94
|
+
questionnaire_response?: Record<string, any>;
|
|
95
|
+
customer_name: string;
|
|
96
|
+
customer_email: string;
|
|
97
|
+
customer_phone_code: string;
|
|
98
|
+
customer_phone_number: string;
|
|
99
|
+
}
|
|
100
|
+
interface Booking {
|
|
101
|
+
booking_id: number;
|
|
102
|
+
demoroom_code: string;
|
|
103
|
+
booking_date: string;
|
|
104
|
+
booking_time: string;
|
|
105
|
+
customer_name: string;
|
|
106
|
+
customer_email: string;
|
|
107
|
+
status: BookingStatus;
|
|
108
|
+
cancel_token: string;
|
|
109
|
+
created_at: string;
|
|
110
|
+
}
|
|
111
|
+
declare enum ApiErrorCode {
|
|
112
|
+
SUCCESS = 0,
|
|
113
|
+
PARAM_ERROR = 1001,
|
|
114
|
+
UNAUTHORIZED = 1002,
|
|
115
|
+
FORBIDDEN = 1003,
|
|
116
|
+
NOT_FOUND = 1004,
|
|
117
|
+
CONFLICT = 1005,
|
|
118
|
+
INTERNAL_ERROR = 1006
|
|
119
|
+
}
|
|
120
|
+
declare class ApiError extends Error {
|
|
121
|
+
code: number;
|
|
122
|
+
request_id?: string;
|
|
123
|
+
constructor(code: number, message: string, request_id?: string);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
interface DemoRoomApiConfig {
|
|
127
|
+
baseUrl: string;
|
|
128
|
+
apiKey: string;
|
|
129
|
+
locale?: string;
|
|
130
|
+
timeout?: number;
|
|
131
|
+
}
|
|
132
|
+
declare class DemoRoomApiClient {
|
|
133
|
+
private config;
|
|
134
|
+
constructor(config: DemoRoomApiConfig);
|
|
135
|
+
private request;
|
|
136
|
+
/**
|
|
137
|
+
* 获取门店列表
|
|
138
|
+
* @param params.team_code 团队编码
|
|
139
|
+
* @param params.brand_website 品牌站点
|
|
140
|
+
* @param params.locale 语言偏好(可选)
|
|
141
|
+
*/
|
|
142
|
+
getDemoRooms(params: {
|
|
143
|
+
team_code?: string;
|
|
144
|
+
brand_website?: string;
|
|
145
|
+
locale?: string;
|
|
146
|
+
}): Promise<DemoRoom[]>;
|
|
147
|
+
/**
|
|
148
|
+
* 获取门店详情
|
|
149
|
+
* @param code 门店编码
|
|
150
|
+
* @param locale 语言偏好(可选)
|
|
151
|
+
*/
|
|
152
|
+
getDemoRoom(code: string, locale?: string): Promise<DemoRoom>;
|
|
153
|
+
/**
|
|
154
|
+
* 查询门店时段
|
|
155
|
+
* @param code 门店编码
|
|
156
|
+
* @param params.start_date 开始日期 (YYYY-MM-DD)
|
|
157
|
+
* @param params.end_date 结束日期 (YYYY-MM-DD)
|
|
158
|
+
* @param params.timezone 时区(可选)
|
|
159
|
+
*/
|
|
160
|
+
getTimeslots(code: string, params: {
|
|
161
|
+
start_date: string;
|
|
162
|
+
end_date: string;
|
|
163
|
+
timezone?: string;
|
|
164
|
+
}): Promise<GetTimeslotsResponse>;
|
|
165
|
+
/**
|
|
166
|
+
* 查询门店问卷
|
|
167
|
+
* @param code 门店编码
|
|
168
|
+
* @param questionnaire_id 问卷ID
|
|
169
|
+
* @param locale 语言偏好(可选)
|
|
170
|
+
*/
|
|
171
|
+
getQuestionnaire(code: string, questionnaire_id: number, locale?: string): Promise<Questionnaire>;
|
|
172
|
+
/**
|
|
173
|
+
* 提交预约
|
|
174
|
+
* @param data 预约数据
|
|
175
|
+
*/
|
|
176
|
+
createBooking(data: CreateBookingRequest): Promise<Booking>;
|
|
177
|
+
/**
|
|
178
|
+
* 根据 token 获取预约信息
|
|
179
|
+
* @param token 预约 token
|
|
180
|
+
*/
|
|
181
|
+
getBooking(token: string): Promise<Booking>;
|
|
182
|
+
}
|
|
183
|
+
declare function createDemoRoomApi(config: DemoRoomApiConfig): DemoRoomApiClient;
|
|
184
|
+
|
|
185
|
+
interface DemoRoomDetailProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
186
|
+
/**
|
|
187
|
+
* API client for fetching demo room details
|
|
188
|
+
*/
|
|
189
|
+
apiClient?: DemoRoomApiClient;
|
|
190
|
+
/**
|
|
191
|
+
* Demo room code to fetch details
|
|
192
|
+
*/
|
|
193
|
+
demoRoomCode?: string;
|
|
194
|
+
/**
|
|
195
|
+
* Locale for API request
|
|
196
|
+
*/
|
|
197
|
+
locale?: string;
|
|
198
|
+
/**
|
|
199
|
+
* Room title (fallback if not using API)
|
|
200
|
+
*/
|
|
201
|
+
title?: string;
|
|
202
|
+
/**
|
|
203
|
+
* Room description paragraphs (fallback if not using API)
|
|
204
|
+
*/
|
|
205
|
+
descriptions?: string[];
|
|
206
|
+
/**
|
|
207
|
+
* Device models available (fallback if not using API)
|
|
208
|
+
*/
|
|
209
|
+
devices?: string;
|
|
210
|
+
/**
|
|
211
|
+
* Room address (fallback if not using API)
|
|
212
|
+
*/
|
|
213
|
+
address?: string;
|
|
214
|
+
/**
|
|
215
|
+
* Google Maps link
|
|
216
|
+
*/
|
|
217
|
+
mapsLink?: string;
|
|
218
|
+
/**
|
|
219
|
+
* Room images (fallback if not using API)
|
|
220
|
+
*/
|
|
221
|
+
images?: string[];
|
|
222
|
+
}
|
|
223
|
+
declare const DemoRoomDetail: React.FC<DemoRoomDetailProps>;
|
|
224
|
+
|
|
225
|
+
interface BookingSuccessProps {
|
|
226
|
+
bookingData?: Booking;
|
|
227
|
+
token?: string;
|
|
228
|
+
apiConfig?: DemoRoomApiConfig;
|
|
229
|
+
onBackToHome?: () => void;
|
|
230
|
+
className?: string;
|
|
231
|
+
}
|
|
232
|
+
declare const BookingSuccess: React.FC<BookingSuccessProps>;
|
|
233
|
+
|
|
234
|
+
interface UseApiState<T> {
|
|
235
|
+
data: T | null;
|
|
236
|
+
loading: boolean;
|
|
237
|
+
error: ApiError | null;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* 获取门店列表 Hook
|
|
241
|
+
*/
|
|
242
|
+
declare function useDemoRooms(client: DemoRoomApiClient, params: {
|
|
243
|
+
team_code?: string;
|
|
244
|
+
brand_website?: string;
|
|
245
|
+
locale?: string;
|
|
246
|
+
}, options?: {
|
|
247
|
+
enabled?: boolean;
|
|
248
|
+
}): UseApiState<DemoRoom[]>;
|
|
249
|
+
/**
|
|
250
|
+
* 获取门店详情 Hook
|
|
251
|
+
*/
|
|
252
|
+
declare function useDemoRoom(client: DemoRoomApiClient, code: string, locale?: string, options?: {
|
|
253
|
+
enabled?: boolean;
|
|
254
|
+
}): UseApiState<DemoRoom>;
|
|
255
|
+
/**
|
|
256
|
+
* 查询门店时段 Hook
|
|
257
|
+
*/
|
|
258
|
+
declare function useTimeslots(client: DemoRoomApiClient, code: string, params: {
|
|
259
|
+
start_date: string;
|
|
260
|
+
end_date: string;
|
|
261
|
+
timezone?: string;
|
|
262
|
+
}, options?: {
|
|
263
|
+
enabled?: boolean;
|
|
264
|
+
}): UseApiState<GetTimeslotsResponse>;
|
|
265
|
+
/**
|
|
266
|
+
* 查询门店问卷 Hook
|
|
267
|
+
*/
|
|
268
|
+
declare function useQuestionnaire(client: DemoRoomApiClient, code: string, questionnaire_id: number | undefined, locale?: string, options?: {
|
|
269
|
+
enabled?: boolean;
|
|
270
|
+
}): UseApiState<Questionnaire>;
|
|
271
|
+
/**
|
|
272
|
+
* 提交预约 Hook
|
|
273
|
+
*/
|
|
274
|
+
declare function useCreateBooking(client: DemoRoomApiClient): {
|
|
275
|
+
createBooking: (data: CreateBookingRequest) => Promise<Booking>;
|
|
276
|
+
data: Booking | null;
|
|
277
|
+
loading: boolean;
|
|
278
|
+
error: ApiError | null;
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
declare function cn(...inputs: ClassValue[]): string;
|
|
282
|
+
|
|
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 };
|