@anker-in/ui 0.3.9 → 0.3.10
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 +91 -1
- package/dist/index.d.ts +91 -1
- package/dist/index.js +387 -151
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +387 -151
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -723,6 +723,88 @@ interface BookingSuccessPageData {
|
|
|
723
723
|
};
|
|
724
724
|
}
|
|
725
725
|
|
|
726
|
+
/**
|
|
727
|
+
* BookingFormO2O 埋点回调相关类型定义
|
|
728
|
+
*
|
|
729
|
+
* 组件库与 GA4 / window.dataLayer 解耦:
|
|
730
|
+
* 组件仅通过 trackCallbacks 暴露用户交互时机与上下文,
|
|
731
|
+
* 具体 dataLayer.push 由业务侧(oneanker / eufymake)统一实现。
|
|
732
|
+
*/
|
|
733
|
+
/** 问卷表单字段类型(含底部协议复选框 agreement) */
|
|
734
|
+
type BookingFormO2OFormFieldType = 'text' | 'email' | 'tel' | 'phone' | 'textarea' | 'radio' | 'radio_with_other' | 'checkbox' | 'select' | 'agreement';
|
|
735
|
+
/** 问卷表单字段埋点上下文(onFormFieldChange 回调参数) */
|
|
736
|
+
interface BookingFormO2OFormFieldContext {
|
|
737
|
+
/** 当前步骤(1-based,按从上到下顺序:可见问题 1..N,协议复选框 N+1..N+M) */
|
|
738
|
+
stepIndex: number;
|
|
739
|
+
/** 当前表单总步数(visibleQuestions.length + agrees.length) */
|
|
740
|
+
totalSteps: number;
|
|
741
|
+
/** 字段标识(question.key || question.id || `agreement-${index}`) */
|
|
742
|
+
fieldId: string;
|
|
743
|
+
/** 步骤名称(question.label;协议项为去除 HTML 标签后的纯文本) */
|
|
744
|
+
fieldLabel: string;
|
|
745
|
+
/** 字段类型 */
|
|
746
|
+
fieldType: BookingFormO2OFormFieldType;
|
|
747
|
+
/**
|
|
748
|
+
* 用户填写或选择的值:
|
|
749
|
+
* - text/email/textarea: 字符串
|
|
750
|
+
* - tel/phone: 带区号字符串,如 "+49 12345678"
|
|
751
|
+
* - radio/select: 选项展示文案 option.label(便于数分阅读,勿传 option1 等内部 key)
|
|
752
|
+
* - checkbox: 当前已勾选的 option.label 数组
|
|
753
|
+
* - agreement: boolean
|
|
754
|
+
*/
|
|
755
|
+
value: string | string[] | boolean;
|
|
756
|
+
}
|
|
757
|
+
/** BookingFormO2O 埋点交互回调集合(均为可选,完全向后兼容) */
|
|
758
|
+
interface BookingFormO2OTrackCallbacks {
|
|
759
|
+
/** 模块1:点击 Google Maps 链接 */
|
|
760
|
+
onGoogleMapsClick?: (ctx: {
|
|
761
|
+
demoRoomName: string;
|
|
762
|
+
url: string;
|
|
763
|
+
}) => void;
|
|
764
|
+
/** 模块1:用户主动切换轮播图(箭头/圆点/手势滑动,不含 autoplay) */
|
|
765
|
+
onImageSlideChange?: (ctx: {
|
|
766
|
+
/** 用户切换方式:PC 左右箭头 prev/next、底部小圆点 pagination、移动端滑动 swipe */
|
|
767
|
+
trigger: 'prev' | 'next' | 'pagination' | 'swipe';
|
|
768
|
+
/** 0-based,取 swiper.realIndex(loop 模式下的真实索引) */
|
|
769
|
+
activeIndex: number;
|
|
770
|
+
/** 切换后当前展示图片 URL */
|
|
771
|
+
imageUrl: string;
|
|
772
|
+
}) => void;
|
|
773
|
+
/** 模块2:点击跳转 POD 设计页按钮 */
|
|
774
|
+
onPodDesignClick?: (ctx: {
|
|
775
|
+
buttonText: string;
|
|
776
|
+
url: string;
|
|
777
|
+
isEditMode: boolean;
|
|
778
|
+
}) => void;
|
|
779
|
+
/** 模块3:点击日历顶部切换月份 < / > */
|
|
780
|
+
onMonthChange?: (ctx: {
|
|
781
|
+
direction: 'left' | 'right';
|
|
782
|
+
month: string;
|
|
783
|
+
}) => void;
|
|
784
|
+
/** 模块3:点击时间槽卡片右上角切换日期 < / > */
|
|
785
|
+
onDateStepClick?: (ctx: {
|
|
786
|
+
direction: 'left' | 'right';
|
|
787
|
+
date: string;
|
|
788
|
+
}) => void;
|
|
789
|
+
/** 模块3:点击日历格子选择具体日期 */
|
|
790
|
+
onDateSelect?: (ctx: {
|
|
791
|
+
date: string;
|
|
792
|
+
}) => void;
|
|
793
|
+
/** 模块3:点击选择可用时间槽 */
|
|
794
|
+
onTimeslotSelect?: (ctx: {
|
|
795
|
+
slotId: number;
|
|
796
|
+
label: string;
|
|
797
|
+
}) => void;
|
|
798
|
+
/** 模块4:首次与问卷表单互动(页面生命周期仅触发一次) */
|
|
799
|
+
onFormStart?: () => void;
|
|
800
|
+
/** 模块4:完成单个字段填写 / 选择 / 协议勾选 */
|
|
801
|
+
onFormFieldChange?: (ctx: BookingFormO2OFormFieldContext) => void;
|
|
802
|
+
/** 模块4:点击提交按钮且表单校验通过 */
|
|
803
|
+
onFormSubmit?: (ctx: {
|
|
804
|
+
responses: Record<string, any>;
|
|
805
|
+
}) => void;
|
|
806
|
+
}
|
|
807
|
+
|
|
726
808
|
interface BookingFormO2OProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onSubmit'> {
|
|
727
809
|
layoutClassName?: string;
|
|
728
810
|
handleBookingSuccess?: (token?: string) => void;
|
|
@@ -762,6 +844,14 @@ interface BookingFormO2OProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
|
|
|
762
844
|
* 页面可配置数据(文案、图标等)
|
|
763
845
|
*/
|
|
764
846
|
pageData?: BookingFormPageData;
|
|
847
|
+
/**
|
|
848
|
+
* 跳转 POD 设计页时附加的 ref 参数(如 "book-demoroom_Design")
|
|
849
|
+
*/
|
|
850
|
+
podDesignRef?: string;
|
|
851
|
+
/**
|
|
852
|
+
* 埋点交互回调集合
|
|
853
|
+
*/
|
|
854
|
+
trackCallbacks?: BookingFormO2OTrackCallbacks;
|
|
765
855
|
}
|
|
766
856
|
declare const BookingFormO2O: React.FC<BookingFormO2OProps>;
|
|
767
857
|
|
|
@@ -880,4 +970,4 @@ declare function useBookingDesign(client: DemoRoomApiClient, params: GetBookingD
|
|
|
880
970
|
|
|
881
971
|
declare function cn(...inputs: ClassValue[]): string;
|
|
882
972
|
|
|
883
|
-
export { ApiError, ApiErrorCode, type ApiResponse, type Booking, type BookingDesign, BookingForm, BookingFormO2O, type BookingFormO2OProps, type BookingFormProps, type BookingQuestionnaireItem, 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 };
|
|
973
|
+
export { ApiError, ApiErrorCode, type ApiResponse, type Booking, type BookingDesign, BookingForm, BookingFormO2O, type BookingFormO2OFormFieldContext, type BookingFormO2OFormFieldType, type BookingFormO2OProps, type BookingFormO2OTrackCallbacks, type BookingFormProps, type BookingQuestionnaireItem, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -723,6 +723,88 @@ interface BookingSuccessPageData {
|
|
|
723
723
|
};
|
|
724
724
|
}
|
|
725
725
|
|
|
726
|
+
/**
|
|
727
|
+
* BookingFormO2O 埋点回调相关类型定义
|
|
728
|
+
*
|
|
729
|
+
* 组件库与 GA4 / window.dataLayer 解耦:
|
|
730
|
+
* 组件仅通过 trackCallbacks 暴露用户交互时机与上下文,
|
|
731
|
+
* 具体 dataLayer.push 由业务侧(oneanker / eufymake)统一实现。
|
|
732
|
+
*/
|
|
733
|
+
/** 问卷表单字段类型(含底部协议复选框 agreement) */
|
|
734
|
+
type BookingFormO2OFormFieldType = 'text' | 'email' | 'tel' | 'phone' | 'textarea' | 'radio' | 'radio_with_other' | 'checkbox' | 'select' | 'agreement';
|
|
735
|
+
/** 问卷表单字段埋点上下文(onFormFieldChange 回调参数) */
|
|
736
|
+
interface BookingFormO2OFormFieldContext {
|
|
737
|
+
/** 当前步骤(1-based,按从上到下顺序:可见问题 1..N,协议复选框 N+1..N+M) */
|
|
738
|
+
stepIndex: number;
|
|
739
|
+
/** 当前表单总步数(visibleQuestions.length + agrees.length) */
|
|
740
|
+
totalSteps: number;
|
|
741
|
+
/** 字段标识(question.key || question.id || `agreement-${index}`) */
|
|
742
|
+
fieldId: string;
|
|
743
|
+
/** 步骤名称(question.label;协议项为去除 HTML 标签后的纯文本) */
|
|
744
|
+
fieldLabel: string;
|
|
745
|
+
/** 字段类型 */
|
|
746
|
+
fieldType: BookingFormO2OFormFieldType;
|
|
747
|
+
/**
|
|
748
|
+
* 用户填写或选择的值:
|
|
749
|
+
* - text/email/textarea: 字符串
|
|
750
|
+
* - tel/phone: 带区号字符串,如 "+49 12345678"
|
|
751
|
+
* - radio/select: 选项展示文案 option.label(便于数分阅读,勿传 option1 等内部 key)
|
|
752
|
+
* - checkbox: 当前已勾选的 option.label 数组
|
|
753
|
+
* - agreement: boolean
|
|
754
|
+
*/
|
|
755
|
+
value: string | string[] | boolean;
|
|
756
|
+
}
|
|
757
|
+
/** BookingFormO2O 埋点交互回调集合(均为可选,完全向后兼容) */
|
|
758
|
+
interface BookingFormO2OTrackCallbacks {
|
|
759
|
+
/** 模块1:点击 Google Maps 链接 */
|
|
760
|
+
onGoogleMapsClick?: (ctx: {
|
|
761
|
+
demoRoomName: string;
|
|
762
|
+
url: string;
|
|
763
|
+
}) => void;
|
|
764
|
+
/** 模块1:用户主动切换轮播图(箭头/圆点/手势滑动,不含 autoplay) */
|
|
765
|
+
onImageSlideChange?: (ctx: {
|
|
766
|
+
/** 用户切换方式:PC 左右箭头 prev/next、底部小圆点 pagination、移动端滑动 swipe */
|
|
767
|
+
trigger: 'prev' | 'next' | 'pagination' | 'swipe';
|
|
768
|
+
/** 0-based,取 swiper.realIndex(loop 模式下的真实索引) */
|
|
769
|
+
activeIndex: number;
|
|
770
|
+
/** 切换后当前展示图片 URL */
|
|
771
|
+
imageUrl: string;
|
|
772
|
+
}) => void;
|
|
773
|
+
/** 模块2:点击跳转 POD 设计页按钮 */
|
|
774
|
+
onPodDesignClick?: (ctx: {
|
|
775
|
+
buttonText: string;
|
|
776
|
+
url: string;
|
|
777
|
+
isEditMode: boolean;
|
|
778
|
+
}) => void;
|
|
779
|
+
/** 模块3:点击日历顶部切换月份 < / > */
|
|
780
|
+
onMonthChange?: (ctx: {
|
|
781
|
+
direction: 'left' | 'right';
|
|
782
|
+
month: string;
|
|
783
|
+
}) => void;
|
|
784
|
+
/** 模块3:点击时间槽卡片右上角切换日期 < / > */
|
|
785
|
+
onDateStepClick?: (ctx: {
|
|
786
|
+
direction: 'left' | 'right';
|
|
787
|
+
date: string;
|
|
788
|
+
}) => void;
|
|
789
|
+
/** 模块3:点击日历格子选择具体日期 */
|
|
790
|
+
onDateSelect?: (ctx: {
|
|
791
|
+
date: string;
|
|
792
|
+
}) => void;
|
|
793
|
+
/** 模块3:点击选择可用时间槽 */
|
|
794
|
+
onTimeslotSelect?: (ctx: {
|
|
795
|
+
slotId: number;
|
|
796
|
+
label: string;
|
|
797
|
+
}) => void;
|
|
798
|
+
/** 模块4:首次与问卷表单互动(页面生命周期仅触发一次) */
|
|
799
|
+
onFormStart?: () => void;
|
|
800
|
+
/** 模块4:完成单个字段填写 / 选择 / 协议勾选 */
|
|
801
|
+
onFormFieldChange?: (ctx: BookingFormO2OFormFieldContext) => void;
|
|
802
|
+
/** 模块4:点击提交按钮且表单校验通过 */
|
|
803
|
+
onFormSubmit?: (ctx: {
|
|
804
|
+
responses: Record<string, any>;
|
|
805
|
+
}) => void;
|
|
806
|
+
}
|
|
807
|
+
|
|
726
808
|
interface BookingFormO2OProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onSubmit'> {
|
|
727
809
|
layoutClassName?: string;
|
|
728
810
|
handleBookingSuccess?: (token?: string) => void;
|
|
@@ -762,6 +844,14 @@ interface BookingFormO2OProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
|
|
|
762
844
|
* 页面可配置数据(文案、图标等)
|
|
763
845
|
*/
|
|
764
846
|
pageData?: BookingFormPageData;
|
|
847
|
+
/**
|
|
848
|
+
* 跳转 POD 设计页时附加的 ref 参数(如 "book-demoroom_Design")
|
|
849
|
+
*/
|
|
850
|
+
podDesignRef?: string;
|
|
851
|
+
/**
|
|
852
|
+
* 埋点交互回调集合
|
|
853
|
+
*/
|
|
854
|
+
trackCallbacks?: BookingFormO2OTrackCallbacks;
|
|
765
855
|
}
|
|
766
856
|
declare const BookingFormO2O: React.FC<BookingFormO2OProps>;
|
|
767
857
|
|
|
@@ -880,4 +970,4 @@ declare function useBookingDesign(client: DemoRoomApiClient, params: GetBookingD
|
|
|
880
970
|
|
|
881
971
|
declare function cn(...inputs: ClassValue[]): string;
|
|
882
972
|
|
|
883
|
-
export { ApiError, ApiErrorCode, type ApiResponse, type Booking, type BookingDesign, BookingForm, BookingFormO2O, type BookingFormO2OProps, type BookingFormProps, type BookingQuestionnaireItem, 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 };
|
|
973
|
+
export { ApiError, ApiErrorCode, type ApiResponse, type Booking, type BookingDesign, BookingForm, BookingFormO2O, type BookingFormO2OFormFieldContext, type BookingFormO2OFormFieldType, type BookingFormO2OProps, type BookingFormO2OTrackCallbacks, type BookingFormProps, type BookingQuestionnaireItem, 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 };
|