@anker-in/ui 0.2.3 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/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,15 @@ 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
+ manager_hash?: string;
258
+ }
259
+ interface DemoRoomPodConfig {
260
+ questionnaire_id?: number;
261
+ }
161
262
  interface DemoRoom {
162
263
  code: string;
163
264
  name: string;
@@ -166,6 +267,13 @@ interface DemoRoom {
166
267
  address: string;
167
268
  location?: DemoRoomLocation;
168
269
  type: DemoRoomType;
270
+ purpose?: string;
271
+ purpose_type?: string;
272
+ storeType?: string;
273
+ store_type?: string;
274
+ contact?: DemoRoomContract;
275
+ business_types?: string[];
276
+ pod_config?: DemoRoomPodConfig;
169
277
  capacity: number;
170
278
  status: DemoRoomStatus;
171
279
  timezone: string;
@@ -215,6 +323,21 @@ interface CreateBookingRequest {
215
323
  customer_phone_code: string;
216
324
  customer_phone_number: string;
217
325
  has_booked_before?: number;
326
+ purpose?: string;
327
+ purpose_type?: string;
328
+ pod_design_id?: string;
329
+ design_id?: string;
330
+ }
331
+ interface CreateBookingResponse {
332
+ booking_id: string;
333
+ demoroom_code: string;
334
+ booking_date: string;
335
+ booking_time: string;
336
+ customer_name: string;
337
+ customer_email: string;
338
+ status: string;
339
+ cancel_token?: string;
340
+ created_at?: string;
218
341
  }
219
342
  interface Booking {
220
343
  booking_id: number;
@@ -235,6 +358,22 @@ interface Booking {
235
358
  status: BookingStatus;
236
359
  cancel_token: string;
237
360
  created_at: string;
361
+ purposeNote?: Record<string, string>;
362
+ pod_data?: {
363
+ design_name?: string;
364
+ design_image?: string;
365
+ status?: string;
366
+ };
367
+ /** 业务类型 */
368
+ business_type?: string;
369
+ /** 设计项目ID */
370
+ design_project_id?: string;
371
+ /** 打印状态 */
372
+ print_status?: string;
373
+ /** 时段ID(编辑预约时用于定位当前已预约的时段) */
374
+ timeslot_id?: number;
375
+ /** 问卷填写答案(编辑预约时用于回填表单) */
376
+ questionnaire_response?: Record<string, any>;
238
377
  }
239
378
  interface GetBookingResponse {
240
379
  booking: Booking;
@@ -242,6 +381,38 @@ interface GetBookingResponse {
242
381
  interface CancelBookingResponse {
243
382
  booking: Booking;
244
383
  }
384
+ interface EditBookingRequest {
385
+ timeslot_id?: number;
386
+ questionnaire_id?: number;
387
+ questionnaire_response?: Record<string, any>;
388
+ customer_name?: string;
389
+ customer_email?: string;
390
+ customer_phone_code?: string;
391
+ customer_phone_number?: string;
392
+ business_type?: string;
393
+ design_session_id?: string;
394
+ }
395
+ interface CheckinBookingRequest {
396
+ booking_token: string;
397
+ }
398
+ interface CheckinBookingResponse {
399
+ booking: Booking;
400
+ }
401
+ interface GetBookingDesignRequest {
402
+ booking_token?: string;
403
+ demoroom_code?: string;
404
+ session_id?: string;
405
+ }
406
+ interface BookingDesign {
407
+ id: number;
408
+ project_id: string;
409
+ material: string;
410
+ thumb_url: string;
411
+ order_code: string;
412
+ pickup_time: number;
413
+ asset_status: number;
414
+ session_id: string;
415
+ }
245
416
  declare enum ApiErrorCode {
246
417
  SUCCESS = 0,
247
418
  PARAM_ERROR = 1001,
@@ -271,11 +442,13 @@ declare class DemoRoomApiClient {
271
442
  * 获取门店列表
272
443
  * @param params.team_code 团队编码
273
444
  * @param params.brand_website 品牌站点
445
+ * @param params.business_type 业务类型(可选)
274
446
  * @param params.locale 语言偏好(可选)
275
447
  */
276
448
  getDemoRooms(params: {
277
449
  team_code?: string;
278
450
  brand_website?: string;
451
+ business_type?: string;
279
452
  locale?: string;
280
453
  }): Promise<DemoRoom[]>;
281
454
  /**
@@ -290,11 +463,13 @@ declare class DemoRoomApiClient {
290
463
  * @param params.start_date 开始日期 (YYYY-MM-DD)
291
464
  * @param params.end_date 结束日期 (YYYY-MM-DD)
292
465
  * @param params.timezone 时区(可选)
466
+ * @param params.business_type 预约用途类型(可选,如 'pod')
293
467
  */
294
468
  getTimeslots(code: string, params: {
295
469
  start_date: string;
296
470
  end_date: string;
297
471
  timezone?: string;
472
+ business_type?: string;
298
473
  }): Promise<GetTimeslotsResponse>;
299
474
  /**
300
475
  * 查询门店问卷
@@ -320,6 +495,24 @@ declare class DemoRoomApiClient {
320
495
  * @param locale 语言偏好(可选,用于邮件通知)
321
496
  */
322
497
  cancelBooking(token: string, locale?: string): Promise<Booking>;
498
+ /**
499
+ * 编辑预约
500
+ * @param token 预约凭证 (cancel_token)
501
+ * @param data 编辑数据
502
+ */
503
+ editBooking(token: string, data: EditBookingRequest): Promise<CreateBookingResponse>;
504
+ /**
505
+ * 签到预约(模式1:精确签到)
506
+ * @param data 签到数据
507
+ */
508
+ checkinBooking(data: CheckinBookingRequest): Promise<Booking>;
509
+ /**
510
+ * 查询 POD 作品信息
511
+ * 模式1(优先):通过 booking_token 精确查询
512
+ * 模式2:通过 demoroom_code + session_id 查询(MIR 跳回时预约尚未创建的场景)
513
+ * @param params 查询参数
514
+ */
515
+ getBookingDesign(params: GetBookingDesignRequest): Promise<BookingDesign>;
323
516
  }
324
517
  declare function createDemoRoomApi(config: DemoRoomApiConfig): DemoRoomApiClient;
325
518
 
@@ -333,10 +526,243 @@ interface BookingSuccessProps {
333
526
  /**
334
527
  * 页面可配置数据(文案、图标等)
335
528
  */
336
- pageData?: BookingSuccessPageData;
529
+ pageData?: BookingSuccessPageData$1;
337
530
  }
338
531
  declare const BookingSuccess: React.FC<BookingSuccessProps>;
339
532
 
533
+ interface BookingPurposePodContent {
534
+ title?: string;
535
+ description?: string;
536
+ subTitle?: string;
537
+ image?: string;
538
+ defaultImg?: string;
539
+ imageAlt?: string;
540
+ buttonText?: string;
541
+ btnText?: string;
542
+ buttonLink?: string;
543
+ btnIcon?: string;
544
+ /** 编辑设计按钮文案(URL 中存在 design_id 时使用,即访客已在 MIR 完成过设计) */
545
+ btnEditText?: string;
546
+ /** 编辑设计按钮图标(URL 中存在 design_id 时使用) */
547
+ btnEditIcon?: string;
548
+ /** 编辑设计跳转链接(URL 中存在 design_id 时使用) */
549
+ buttonEditLink?: string;
550
+ }
551
+ interface BookingPurposeDataItem {
552
+ type?: string;
553
+ label?: string;
554
+ purposeNote?: string;
555
+ podContent?: BookingPurposePodContent;
556
+ }
557
+ interface BookingPurposeDataConfig {
558
+ title?: string;
559
+ list?: BookingPurposeDataItem[] | Record<string, BookingPurposeDataItem>;
560
+ purposeNote?: Record<string, string>;
561
+ podContent?: BookingPurposePodContent;
562
+ }
563
+ type BookingPurposeData = BookingPurposeDataItem[] | Record<string, BookingPurposeDataItem> | BookingPurposeDataConfig;
564
+ /**
565
+ * BookingForm 页面的可配置数据类型
566
+ */
567
+ interface BookingFormPageData {
568
+ /**
569
+ * Purpose selector title
570
+ */
571
+ purposeLabel?: string;
572
+ /**
573
+ * Visit purpose selector and Print on Demand content
574
+ */
575
+ purposeData?: BookingPurposeData;
576
+ /**
577
+ * DemoRoomDetail 相关文案
578
+ */
579
+ demoRoomDetail?: {
580
+ loadingText?: string;
581
+ errorTitle?: string;
582
+ openInGoogleMaps?: string;
583
+ demoRoomImages?: string;
584
+ };
585
+ /**
586
+ * DateTimePicker 相关文案
587
+ */
588
+ dateTimePicker?: {
589
+ scheduleYourVisit?: string;
590
+ timeSlot?: string;
591
+ loadingTimeSlots?: string;
592
+ failedToLoadTimeSlots?: string;
593
+ noAvailableTimeSlots?: string;
594
+ full?: string;
595
+ spotsLeft?: string;
596
+ fillOutForm?: string;
597
+ loadingQuestionnaire?: string;
598
+ bookingFailed?: string;
599
+ timezone?: string;
600
+ };
601
+ /**
602
+ * QuestionnaireForm 相关文案
603
+ */
604
+ questionnaireForm?: {
605
+ submit?: string;
606
+ submitting?: string;
607
+ countryCodes?: Array<{
608
+ code?: string;
609
+ country?: string;
610
+ }>;
611
+ emailDescription?: string;
612
+ dealsType?: string;
613
+ agrees?: string[];
614
+ };
615
+ }
616
+ /**
617
+ * BookingSuccess 页面的可配置数据类型
618
+ */
619
+ interface BookingSuccessPageData {
620
+ /**
621
+ * 页面标题
622
+ */
623
+ yourAppointment?: string;
624
+ /**
625
+ * 取消状态横幅文案
626
+ */
627
+ appointmentCanceled?: string;
628
+ /**
629
+ * 重新预约按钮
630
+ */
631
+ scheduleAgain?: string;
632
+ /**
633
+ * 位置标题
634
+ */
635
+ location?: string;
636
+ /**
637
+ * 地图链接文案
638
+ */
639
+ openInGoogleMaps?: string;
640
+ /**
641
+ * 日期时间标题
642
+ */
643
+ dateAndTime?: string;
644
+ /**
645
+ * 活动标题
646
+ */
647
+ event?: string;
648
+ /**
649
+ * Demo Room 标题
650
+ */
651
+ demoRoom?: string;
652
+ /**
653
+ * 访客信息标题
654
+ */
655
+ visitorInfo?: string;
656
+ /**
657
+ * 没有提供电话
658
+ */
659
+ noPhoneProvided?: string;
660
+ /**
661
+ * 访问目的标题
662
+ */
663
+ purposeOfVisit?: string;
664
+ /**
665
+ * 取消预约按钮
666
+ */
667
+ cancelAppointment?: string;
668
+ /**
669
+ * 编辑预约按钮
670
+ */
671
+ editAppointment?: string;
672
+ purposeNote?: any;
673
+ /**
674
+ * 取消确认对话框
675
+ */
676
+ cancelDialog?: {
677
+ title?: string;
678
+ description?: string;
679
+ backButton?: string;
680
+ confirmButton?: string;
681
+ canceling?: string;
682
+ };
683
+ /**
684
+ * 取消错误信息
685
+ */
686
+ cancelError?: string;
687
+ /**
688
+ * Print on Demand 设计信息模块文案
689
+ */
690
+ podData?: {
691
+ /** "Your Design" 标签前缀文案 */
692
+ yourDesign?: string;
693
+ /** 打印状态对应的描述文案,key 为状态值(如 noStart / printed) */
694
+ status?: Record<string, string>;
695
+ /** 二维码标题 */
696
+ QRCodeTitle?: string;
697
+ /** 二维码副标题 */
698
+ QRCodeSubTitle?: string;
699
+ /** 添加到钱包按钮文案 */
700
+ btnToWallet?: string;
701
+ /** 打印按钮文案 */
702
+ btnToPrint?: string;
703
+ };
704
+ }
705
+
706
+ interface BookingFormO2OProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onSubmit'> {
707
+ layoutClassName?: string;
708
+ handleBookingSuccess?: (token?: string) => void;
709
+ /**
710
+ * 问卷提交时的回调函数(可用于订阅操作等)
711
+ */
712
+ onQuestionnaireSubmit?: (responses: Record<string, any>) => void | Promise<void>;
713
+ /**
714
+ * API 配置
715
+ */
716
+ apiConfig: {
717
+ baseUrl: string;
718
+ apiKey: string;
719
+ locale?: string;
720
+ };
721
+ /**
722
+ * 门店代码(可选,可以从 URL 参数或 props 传入)
723
+ */
724
+ demoRoomCode?: string;
725
+ /**
726
+ * 编辑预约时使用的 token
727
+ */
728
+ token?: string;
729
+ /**
730
+ * 初始选中的 purpose 类型(可从 URL 参数 business_type 传入)
731
+ */
732
+ initialBusinessType?: string;
733
+ /**
734
+ * 时区(可选)
735
+ */
736
+ timezone?: string;
737
+ /**
738
+ * 页面可配置数据(文案、图标等)
739
+ */
740
+ pageData?: BookingFormPageData;
741
+ }
742
+ declare const BookingFormO2O: React.FC<BookingFormO2OProps>;
743
+
744
+ interface BookingSuccessO2OProps {
745
+ bookingData?: Booking;
746
+ token?: string;
747
+ apiConfig?: DemoRoomApiConfig;
748
+ onScheduleAgain?: (demoRoomCode: string) => void;
749
+ onCancelSuccess?: (booking: Booking) => void;
750
+ /**
751
+ * 编辑预约回调函数,由使用方实现具体编辑逻辑
752
+ */
753
+ onEditBooking?: (token: string, code: string, businessType?: string) => void;
754
+ /**
755
+ * 添加到钱包回调函数
756
+ */
757
+ onAddToWallet?: (booking: Booking) => void;
758
+ className?: string;
759
+ /**
760
+ * 页面可配置数据(文案、图标等)
761
+ */
762
+ pageData?: BookingSuccessPageData;
763
+ }
764
+ declare const BookingSuccessO2O: React.FC<BookingSuccessO2OProps>;
765
+
340
766
  interface UseApiState<T> {
341
767
  data: T | null;
342
768
  loading: boolean;
@@ -348,6 +774,7 @@ interface UseApiState<T> {
348
774
  declare function useDemoRooms(client: DemoRoomApiClient, params: {
349
775
  team_code?: string;
350
776
  brand_website?: string;
777
+ business_type?: string;
351
778
  locale?: string;
352
779
  }, options?: {
353
780
  enabled?: boolean;
@@ -365,6 +792,7 @@ declare function useTimeslots(client: DemoRoomApiClient, code: string, params: {
365
792
  start_date: string;
366
793
  end_date: string;
367
794
  timezone?: string;
795
+ business_type?: string;
368
796
  }, options?: {
369
797
  enabled?: boolean;
370
798
  }): UseApiState<GetTimeslotsResponse>;
@@ -398,7 +826,33 @@ declare function useCancelBooking(client: DemoRoomApiClient): {
398
826
  loading: boolean;
399
827
  error: ApiError | null;
400
828
  };
829
+ /**
830
+ * 编辑预约 Hook
831
+ */
832
+ declare function useEditBooking(client: DemoRoomApiClient): {
833
+ editBooking: (token: string, data: EditBookingRequest) => Promise<CreateBookingResponse>;
834
+ data: CreateBookingResponse | null;
835
+ loading: boolean;
836
+ error: ApiError | null;
837
+ };
838
+ /**
839
+ * 签到预约 Hook(模式1:精确签到)
840
+ */
841
+ declare function useCheckinBooking(client: DemoRoomApiClient): {
842
+ checkinBooking: (data: CheckinBookingRequest) => Promise<Booking>;
843
+ data: Booking | null;
844
+ loading: boolean;
845
+ error: ApiError | null;
846
+ };
847
+ /**
848
+ * 查询 POD 作品信息 Hook
849
+ * 模式1(优先):通过 booking_token 精确查询
850
+ * 模式2:通过 demoroom_code + session_id 查询(MIR 跳回时预约尚未创建的场景)
851
+ */
852
+ declare function useBookingDesign(client: DemoRoomApiClient, params: GetBookingDesignRequest, options?: {
853
+ enabled?: boolean;
854
+ }): UseApiState<BookingDesign>;
401
855
 
402
856
  declare function cn(...inputs: ClassValue[]): string;
403
857
 
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 };
858
+ 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 GetBookingDesignRequest, 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 };