@anker-in/ui 0.2.2 → 0.3.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/dist/index.d.mts CHANGED
@@ -3,10 +3,102 @@ import React from 'react';
3
3
  export { ThemeProvider, useTheme } from './theme.mjs';
4
4
  import { ClassValue } from 'clsx';
5
5
 
6
+ interface DemoRoomFilterOption {
7
+ type: string;
8
+ label: string;
9
+ }
10
+ /**
11
+ * DemoRoom 页面的可配置数据类型
12
+ */
13
+ interface DemoRoomPageData {
14
+ /**
15
+ * 页面标题
16
+ */
17
+ title?: string;
18
+ note?: string;
19
+ /**
20
+ * 加载状态文案
21
+ */
22
+ loadingText?: string;
23
+ /**
24
+ * 加载失败文案
25
+ */
26
+ errorTitle?: string;
27
+ machine?: string;
28
+ purpose?: DemoRoomFilterOption[];
29
+ storeType?: DemoRoomFilterOption[];
30
+ /**
31
+ * 位置筛选相关文案
32
+ */
33
+ locationFilter?: {
34
+ allLocations?: string;
35
+ clear?: string;
36
+ country?: string;
37
+ state?: string;
38
+ city?: string;
39
+ noStudiosFound?: string;
40
+ };
41
+ /**
42
+ * 工作室卡片相关文案
43
+ */
44
+ studioCard?: {
45
+ scheduleNow?: string;
46
+ available?: string;
47
+ away?: string;
48
+ };
49
+ /**
50
+ * 地图相关文案
51
+ */
52
+ map?: {
53
+ apiKeyRequired?: string;
54
+ loadingMap?: string;
55
+ scheduleNow?: string;
56
+ available?: string;
57
+ };
58
+ /**
59
+ * 其他配置
60
+ */
61
+ defaultCountry?: string;
62
+ noAvailableTime?: string;
63
+ }
64
+
65
+ interface DemoRoomO2OProps extends React.HTMLAttributes<HTMLDivElement> {
66
+ layoutClassName?: string;
67
+ /**
68
+ * 谷歌地图 API Key
69
+ */
70
+ googleMapsApiKey?: string;
71
+ /**
72
+ * API 配置
73
+ */
74
+ apiConfig: {
75
+ baseUrl: string;
76
+ apiKey: string;
77
+ locale?: string;
78
+ };
79
+ /**
80
+ * 团队编码或品牌站点(二选一)
81
+ */
82
+ teamCode?: string;
83
+ brandWebsite?: string;
84
+ /**
85
+ * Callback when user clicks "Schedule Now" button
86
+ * @param demoRoomCode - The demo room code
87
+ * @param purpose - The currently selected purpose filter value (from the purpose dropdown), empty string when "All" is selected
88
+ */
89
+ onSchedule?: (demoRoomCode: string, purpose?: string) => void;
90
+ /**
91
+ * 页面可配置数据(文案、图标等)
92
+ */
93
+ pageData?: DemoRoomPageData;
94
+ className?: string;
95
+ }
96
+ declare const DemoRoomO2O: React.FC<DemoRoomO2OProps>;
97
+
6
98
  /**
7
99
  * BookingForm 页面的可配置数据类型
8
100
  */
9
- interface BookingFormPageData {
101
+ interface BookingFormPageData$1 {
10
102
  /**
11
103
  * DemoRoomDetail 相关文案
12
104
  */
@@ -43,7 +135,7 @@ interface BookingFormPageData {
43
135
  /**
44
136
  * BookingSuccess 页面的可配置数据类型
45
137
  */
46
- interface BookingSuccessPageData {
138
+ interface BookingSuccessPageData$1 {
47
139
  /**
48
140
  * 页面标题
49
141
  */
@@ -130,7 +222,7 @@ interface BookingFormProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'o
130
222
  /**
131
223
  * 页面可配置数据(文案、图标等)
132
224
  */
133
- pageData?: BookingFormPageData;
225
+ pageData?: BookingFormPageData$1;
134
226
  }
135
227
  declare const BookingForm: React.FC<BookingFormProps>;
136
228
 
@@ -158,6 +250,14 @@ interface DemoRoomLocation {
158
250
  state: string;
159
251
  city: string;
160
252
  }
253
+ interface DemoRoomContract {
254
+ manager_id?: string;
255
+ host_email?: string;
256
+ host_name?: string;
257
+ }
258
+ interface DemoRoomPodConfig {
259
+ questionnaire_id?: number;
260
+ }
161
261
  interface DemoRoom {
162
262
  code: string;
163
263
  name: string;
@@ -166,6 +266,13 @@ interface DemoRoom {
166
266
  address: string;
167
267
  location?: DemoRoomLocation;
168
268
  type: DemoRoomType;
269
+ purpose?: string;
270
+ purpose_type?: string;
271
+ storeType?: string;
272
+ store_type?: string;
273
+ contact?: DemoRoomContract;
274
+ business_types?: string[];
275
+ pod_config?: DemoRoomPodConfig;
169
276
  capacity: number;
170
277
  status: DemoRoomStatus;
171
278
  timezone: string;
@@ -215,6 +322,21 @@ interface CreateBookingRequest {
215
322
  customer_phone_code: string;
216
323
  customer_phone_number: string;
217
324
  has_booked_before?: number;
325
+ purpose?: string;
326
+ purpose_type?: string;
327
+ pod_design_id?: string;
328
+ design_id?: string;
329
+ }
330
+ interface CreateBookingResponse {
331
+ booking_id: string;
332
+ demoroom_code: string;
333
+ booking_date: string;
334
+ booking_time: string;
335
+ customer_name: string;
336
+ customer_email: string;
337
+ status: string;
338
+ cancel_token?: string;
339
+ created_at?: string;
218
340
  }
219
341
  interface Booking {
220
342
  booking_id: number;
@@ -235,6 +357,22 @@ interface Booking {
235
357
  status: BookingStatus;
236
358
  cancel_token: string;
237
359
  created_at: string;
360
+ purposeNote?: Record<string, string>;
361
+ pod_data?: {
362
+ design_name?: string;
363
+ design_image?: string;
364
+ status?: string;
365
+ };
366
+ /** 业务类型 */
367
+ business_type?: string;
368
+ /** 设计项目ID */
369
+ design_project_id?: string;
370
+ /** 打印状态 */
371
+ print_status?: string;
372
+ /** 时段ID(编辑预约时用于定位当前已预约的时段) */
373
+ timeslot_id?: number;
374
+ /** 问卷填写答案(编辑预约时用于回填表单) */
375
+ questionnaire_response?: Record<string, any>;
238
376
  }
239
377
  interface GetBookingResponse {
240
378
  booking: Booking;
@@ -242,6 +380,33 @@ interface GetBookingResponse {
242
380
  interface CancelBookingResponse {
243
381
  booking: Booking;
244
382
  }
383
+ interface EditBookingRequest {
384
+ timeslot_id?: number;
385
+ questionnaire_id?: number;
386
+ questionnaire_response?: Record<string, any>;
387
+ customer_name?: string;
388
+ customer_email?: string;
389
+ customer_phone_code?: string;
390
+ customer_phone_number?: string;
391
+ business_type?: string;
392
+ design_session_id?: string;
393
+ }
394
+ interface CheckinBookingRequest {
395
+ booking_token: string;
396
+ }
397
+ interface CheckinBookingResponse {
398
+ booking: Booking;
399
+ }
400
+ interface BookingDesign {
401
+ id: number;
402
+ project_id: string;
403
+ material: string;
404
+ thumb_url: string;
405
+ order_code: string;
406
+ pickup_time: number;
407
+ asset_status: number;
408
+ session_id: string;
409
+ }
245
410
  declare enum ApiErrorCode {
246
411
  SUCCESS = 0,
247
412
  PARAM_ERROR = 1001,
@@ -271,11 +436,13 @@ declare class DemoRoomApiClient {
271
436
  * 获取门店列表
272
437
  * @param params.team_code 团队编码
273
438
  * @param params.brand_website 品牌站点
439
+ * @param params.business_type 业务类型(可选)
274
440
  * @param params.locale 语言偏好(可选)
275
441
  */
276
442
  getDemoRooms(params: {
277
443
  team_code?: string;
278
444
  brand_website?: string;
445
+ business_type?: string;
279
446
  locale?: string;
280
447
  }): Promise<DemoRoom[]>;
281
448
  /**
@@ -290,11 +457,13 @@ declare class DemoRoomApiClient {
290
457
  * @param params.start_date 开始日期 (YYYY-MM-DD)
291
458
  * @param params.end_date 结束日期 (YYYY-MM-DD)
292
459
  * @param params.timezone 时区(可选)
460
+ * @param params.business_type 预约用途类型(可选,如 'pod')
293
461
  */
294
462
  getTimeslots(code: string, params: {
295
463
  start_date: string;
296
464
  end_date: string;
297
465
  timezone?: string;
466
+ business_type?: string;
298
467
  }): Promise<GetTimeslotsResponse>;
299
468
  /**
300
469
  * 查询门店问卷
@@ -320,6 +489,22 @@ declare class DemoRoomApiClient {
320
489
  * @param locale 语言偏好(可选,用于邮件通知)
321
490
  */
322
491
  cancelBooking(token: string, locale?: string): Promise<Booking>;
492
+ /**
493
+ * 编辑预约
494
+ * @param token 预约凭证 (cancel_token)
495
+ * @param data 编辑数据
496
+ */
497
+ editBooking(token: string, data: EditBookingRequest): Promise<CreateBookingResponse>;
498
+ /**
499
+ * 签到预约(模式1:精确签到)
500
+ * @param data 签到数据
501
+ */
502
+ checkinBooking(data: CheckinBookingRequest): Promise<Booking>;
503
+ /**
504
+ * 查询 POD 作品信息(模式1:精确查询)
505
+ * @param bookingToken 预约凭证
506
+ */
507
+ getBookingDesign(bookingToken: string): Promise<BookingDesign>;
323
508
  }
324
509
  declare function createDemoRoomApi(config: DemoRoomApiConfig): DemoRoomApiClient;
325
510
 
@@ -333,10 +518,237 @@ interface BookingSuccessProps {
333
518
  /**
334
519
  * 页面可配置数据(文案、图标等)
335
520
  */
336
- pageData?: BookingSuccessPageData;
521
+ pageData?: BookingSuccessPageData$1;
337
522
  }
338
523
  declare const BookingSuccess: React.FC<BookingSuccessProps>;
339
524
 
525
+ interface BookingPurposePodContent {
526
+ title?: string;
527
+ description?: string;
528
+ subTitle?: string;
529
+ image?: string;
530
+ defaultImg?: string;
531
+ imageAlt?: string;
532
+ buttonText?: string;
533
+ btnText?: string;
534
+ buttonLink?: string;
535
+ btnIcon?: string;
536
+ }
537
+ interface BookingPurposeDataItem {
538
+ type?: string;
539
+ label?: string;
540
+ purposeNote?: string;
541
+ podContent?: BookingPurposePodContent;
542
+ }
543
+ interface BookingPurposeDataConfig {
544
+ title?: string;
545
+ list?: BookingPurposeDataItem[] | Record<string, BookingPurposeDataItem>;
546
+ purposeNote?: Record<string, string>;
547
+ podContent?: BookingPurposePodContent;
548
+ }
549
+ type BookingPurposeData = BookingPurposeDataItem[] | Record<string, BookingPurposeDataItem> | BookingPurposeDataConfig;
550
+ /**
551
+ * BookingForm 页面的可配置数据类型
552
+ */
553
+ interface BookingFormPageData {
554
+ /**
555
+ * Purpose selector title
556
+ */
557
+ purposeLabel?: string;
558
+ /**
559
+ * Visit purpose selector and Print on Demand content
560
+ */
561
+ purposeData?: BookingPurposeData;
562
+ /**
563
+ * DemoRoomDetail 相关文案
564
+ */
565
+ demoRoomDetail?: {
566
+ loadingText?: string;
567
+ errorTitle?: string;
568
+ openInGoogleMaps?: string;
569
+ demoRoomImages?: string;
570
+ };
571
+ /**
572
+ * DateTimePicker 相关文案
573
+ */
574
+ dateTimePicker?: {
575
+ scheduleYourVisit?: string;
576
+ timeSlot?: string;
577
+ loadingTimeSlots?: string;
578
+ failedToLoadTimeSlots?: string;
579
+ noAvailableTimeSlots?: string;
580
+ full?: string;
581
+ spotsLeft?: string;
582
+ fillOutForm?: string;
583
+ loadingQuestionnaire?: string;
584
+ bookingFailed?: string;
585
+ timezone?: string;
586
+ };
587
+ /**
588
+ * QuestionnaireForm 相关文案
589
+ */
590
+ questionnaireForm?: {
591
+ submit?: string;
592
+ submitting?: string;
593
+ countryCodes?: Array<{
594
+ code?: string;
595
+ country?: string;
596
+ }>;
597
+ emailDescription?: string;
598
+ dealsType?: string;
599
+ agrees?: string[];
600
+ };
601
+ }
602
+ /**
603
+ * BookingSuccess 页面的可配置数据类型
604
+ */
605
+ interface BookingSuccessPageData {
606
+ /**
607
+ * 页面标题
608
+ */
609
+ yourAppointment?: string;
610
+ /**
611
+ * 取消状态横幅文案
612
+ */
613
+ appointmentCanceled?: string;
614
+ /**
615
+ * 重新预约按钮
616
+ */
617
+ scheduleAgain?: string;
618
+ /**
619
+ * 位置标题
620
+ */
621
+ location?: string;
622
+ /**
623
+ * 地图链接文案
624
+ */
625
+ openInGoogleMaps?: string;
626
+ /**
627
+ * 日期时间标题
628
+ */
629
+ dateAndTime?: string;
630
+ /**
631
+ * 活动标题
632
+ */
633
+ event?: string;
634
+ /**
635
+ * Demo Room 标题
636
+ */
637
+ demoRoom?: string;
638
+ /**
639
+ * 访客信息标题
640
+ */
641
+ visitorInfo?: string;
642
+ /**
643
+ * 没有提供电话
644
+ */
645
+ noPhoneProvided?: string;
646
+ /**
647
+ * 访问目的标题
648
+ */
649
+ purposeOfVisit?: string;
650
+ /**
651
+ * 取消预约按钮
652
+ */
653
+ cancelAppointment?: string;
654
+ /**
655
+ * 编辑预约按钮
656
+ */
657
+ editAppointment?: string;
658
+ purposeNote?: any;
659
+ /**
660
+ * 取消确认对话框
661
+ */
662
+ cancelDialog?: {
663
+ title?: string;
664
+ description?: string;
665
+ backButton?: string;
666
+ confirmButton?: string;
667
+ canceling?: string;
668
+ };
669
+ /**
670
+ * 取消错误信息
671
+ */
672
+ cancelError?: string;
673
+ /**
674
+ * Print on Demand 设计信息模块文案
675
+ */
676
+ podData?: {
677
+ /** "Your Design" 标签前缀文案 */
678
+ yourDesign?: string;
679
+ /** 打印状态对应的描述文案,key 为状态值(如 noStart / printed) */
680
+ status?: Record<string, string>;
681
+ /** 二维码标题 */
682
+ QRCodeTitle?: string;
683
+ /** 二维码副标题 */
684
+ QRCodeSubTitle?: string;
685
+ /** 添加到钱包按钮文案 */
686
+ btnToWallet?: string;
687
+ /** 打印按钮文案 */
688
+ btnToPrint?: string;
689
+ };
690
+ }
691
+
692
+ interface BookingFormO2OProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onSubmit'> {
693
+ layoutClassName?: string;
694
+ handleBookingSuccess?: (token?: string) => void;
695
+ /**
696
+ * 问卷提交时的回调函数(可用于订阅操作等)
697
+ */
698
+ onQuestionnaireSubmit?: (responses: Record<string, any>) => void | Promise<void>;
699
+ /**
700
+ * API 配置
701
+ */
702
+ apiConfig: {
703
+ baseUrl: string;
704
+ apiKey: string;
705
+ locale?: string;
706
+ };
707
+ /**
708
+ * 门店代码(可选,可以从 URL 参数或 props 传入)
709
+ */
710
+ demoRoomCode?: string;
711
+ /**
712
+ * 编辑预约时使用的 token
713
+ */
714
+ token?: string;
715
+ /**
716
+ * 初始选中的 purpose 类型(可从 URL 参数 business_type 传入)
717
+ */
718
+ initialBusinessType?: string;
719
+ /**
720
+ * 时区(可选)
721
+ */
722
+ timezone?: string;
723
+ /**
724
+ * 页面可配置数据(文案、图标等)
725
+ */
726
+ pageData?: BookingFormPageData;
727
+ }
728
+ declare const BookingFormO2O: React.FC<BookingFormO2OProps>;
729
+
730
+ interface BookingSuccessO2OProps {
731
+ bookingData?: Booking;
732
+ token?: string;
733
+ apiConfig?: DemoRoomApiConfig;
734
+ onScheduleAgain?: (demoRoomCode: string) => void;
735
+ onCancelSuccess?: (booking: Booking) => void;
736
+ /**
737
+ * 编辑预约回调函数,由使用方实现具体编辑逻辑
738
+ */
739
+ onEditBooking?: (token: string, code: string, businessType?: string) => void;
740
+ /**
741
+ * 添加到钱包回调函数
742
+ */
743
+ onAddToWallet?: (booking: Booking) => void;
744
+ className?: string;
745
+ /**
746
+ * 页面可配置数据(文案、图标等)
747
+ */
748
+ pageData?: BookingSuccessPageData;
749
+ }
750
+ declare const BookingSuccessO2O: React.FC<BookingSuccessO2OProps>;
751
+
340
752
  interface UseApiState<T> {
341
753
  data: T | null;
342
754
  loading: boolean;
@@ -348,6 +760,7 @@ interface UseApiState<T> {
348
760
  declare function useDemoRooms(client: DemoRoomApiClient, params: {
349
761
  team_code?: string;
350
762
  brand_website?: string;
763
+ business_type?: string;
351
764
  locale?: string;
352
765
  }, options?: {
353
766
  enabled?: boolean;
@@ -365,6 +778,7 @@ declare function useTimeslots(client: DemoRoomApiClient, code: string, params: {
365
778
  start_date: string;
366
779
  end_date: string;
367
780
  timezone?: string;
781
+ business_type?: string;
368
782
  }, options?: {
369
783
  enabled?: boolean;
370
784
  }): UseApiState<GetTimeslotsResponse>;
@@ -398,7 +812,33 @@ declare function useCancelBooking(client: DemoRoomApiClient): {
398
812
  loading: boolean;
399
813
  error: ApiError | null;
400
814
  };
815
+ /**
816
+ * 编辑预约 Hook
817
+ */
818
+ declare function useEditBooking(client: DemoRoomApiClient): {
819
+ editBooking: (token: string, data: EditBookingRequest) => Promise<CreateBookingResponse>;
820
+ data: CreateBookingResponse | null;
821
+ loading: boolean;
822
+ error: ApiError | null;
823
+ };
824
+ /**
825
+ * 签到预约 Hook(模式1:精确签到)
826
+ */
827
+ declare function useCheckinBooking(client: DemoRoomApiClient): {
828
+ checkinBooking: (data: CheckinBookingRequest) => Promise<Booking>;
829
+ data: Booking | null;
830
+ loading: boolean;
831
+ error: ApiError | null;
832
+ };
833
+ /**
834
+ * 查询 POD 作品信息 Hook(模式1:精确查询)
835
+ */
836
+ declare function useBookingDesign(client: DemoRoomApiClient, params: {
837
+ booking_token: string;
838
+ }, options?: {
839
+ enabled?: boolean;
840
+ }): UseApiState<BookingDesign>;
401
841
 
402
842
  declare function cn(...inputs: ClassValue[]): string;
403
843
 
404
- 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, 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 };
844
+ export { ApiError, ApiErrorCode, type ApiResponse, type Booking, type BookingDesign, BookingForm, BookingFormO2O, type BookingFormO2OProps, type BookingFormProps, type BookingStatus, BookingSuccess, BookingSuccessO2O, type BookingSuccessO2OProps, type BookingSuccessProps, type CancelBookingResponse, type CheckinBookingRequest, type CheckinBookingResponse, type CreateBookingRequest, type CreateBookingResponse, DemoRoomApiClient, type DemoRoomApiConfig, type DemoRoom as DemoRoomData, DemoRoomO2O, type DemoRoomO2OProps, type DemoRoomStatus, type DemoRoomType, type EditBookingRequest, type GetBookingResponse, type GetDemoRoomsResponse, type GetTimeslotsResponse, type Question, type QuestionOption, type QuestionType, type Questionnaire, type Timeslot, type TimeslotStatus, cn, createDemoRoomApi, useBooking, useBookingDesign, useCancelBooking, useCheckinBooking, useCreateBooking, useDemoRoom, useDemoRooms, useEditBooking, useQuestionnaire, useTimeslots };