@rxdrag/website-lib-core 0.0.127 → 0.0.128

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.
Files changed (138) hide show
  1. package/README.md +1 -1
  2. package/index.ts +1 -1
  3. package/package.json +4 -4
  4. package/src/astro/animation.ts +146 -146
  5. package/src/astro/background.ts +82 -86
  6. package/src/astro/base.ts +7 -0
  7. package/src/astro/business.ts +13 -0
  8. package/src/astro/grid/consts.ts +80 -80
  9. package/src/astro/grid/index.ts +2 -2
  10. package/src/astro/grid/types.ts +35 -35
  11. package/src/astro/image.ts +239 -239
  12. package/src/astro/index.ts +12 -10
  13. package/src/astro/link.ts +20 -21
  14. package/src/astro/media.ts +123 -123
  15. package/src/astro/nav.ts +13 -13
  16. package/src/astro/section/index.ts +7 -12
  17. package/src/component-logic/index.ts +1 -1
  18. package/src/component-logic/link-client.ts +32 -32
  19. package/src/component-logic/link.ts +61 -61
  20. package/src/design-tokens.ts +160 -160
  21. package/src/entify/Entify.ts +533 -530
  22. package/src/entify/IEntify.ts +151 -177
  23. package/src/entify/index.ts +4 -4
  24. package/src/entify/lib/collectCategoryIds.ts +20 -20
  25. package/src/entify/lib/fulltextSearch.ts +63 -62
  26. package/src/entify/lib/langFields.ts +14 -14
  27. package/src/entify/lib/listToTree.ts +23 -23
  28. package/src/entify/lib/newAvatarQueryOptions.ts +4 -4
  29. package/src/entify/lib/newOgImageQueryOptions.ts +5 -5
  30. package/src/entify/lib/newQueryPostOptions.ts +42 -45
  31. package/src/entify/lib/newQueryProductOptions.ts +96 -98
  32. package/src/entify/lib/newQueryProductsMediaOptions.ts +28 -28
  33. package/src/entify/lib/queryAllProducts.ts +40 -40
  34. package/src/entify/lib/queryBulletin.ts +28 -16
  35. package/src/entify/lib/queryEntityList.ts +41 -41
  36. package/src/entify/lib/queryFeaturedProducts.ts +69 -68
  37. package/src/entify/lib/queryLangs.ts +36 -60
  38. package/src/entify/lib/queryLatestPosts.ts +92 -91
  39. package/src/entify/lib/queryOneEntity.ts +63 -63
  40. package/src/entify/lib/queryOneMedia.ts +27 -27
  41. package/src/entify/lib/queryOnePostById.ts +21 -21
  42. package/src/entify/lib/queryOnePostBySlug.ts +40 -39
  43. package/src/entify/lib/queryOnePostCategoryBySlug.ts +35 -35
  44. package/src/entify/lib/queryOneProductById.ts +20 -20
  45. package/src/entify/lib/queryOneProductBySlug.ts +53 -52
  46. package/src/entify/lib/queryOneProductCategoryBySlug.ts +50 -49
  47. package/src/entify/lib/queryOneTheme.ts +54 -72
  48. package/src/entify/lib/queryOneUser.ts +38 -38
  49. package/src/entify/lib/queryPostCategories.ts +67 -67
  50. package/src/entify/lib/queryPostSlugs.ts +37 -37
  51. package/src/entify/lib/queryPosts.ts +175 -174
  52. package/src/entify/lib/queryProductCategories.ts +59 -59
  53. package/src/entify/lib/queryProducts.ts +145 -144
  54. package/src/entify/lib/queryProductsInMenu.ts +45 -45
  55. package/src/entify/lib/queryTagCategories.ts +58 -58
  56. package/src/entify/lib/queryTags.ts +57 -57
  57. package/src/entify/lib/queryUserIds.ts +24 -24
  58. package/src/entify/lib/queryUserPosts.ts +80 -79
  59. package/src/entify/lib/queryWebSiteSettings.ts +28 -28
  60. package/src/entify/lib/queryWebsite.ts +43 -43
  61. package/src/entify/lib/sendEmail.ts +7 -7
  62. package/src/entify/lib/toQueryOptions.ts +19 -19
  63. package/src/entify/lib/upsertEntity.ts +8 -8
  64. package/src/entify/types/index.ts +1 -1
  65. package/src/entify/types/utils.ts +11 -6
  66. package/src/entify/types/variables.ts +5 -6
  67. package/src/entify/view-model/funcs.ts +230 -230
  68. package/src/entify/view-model/index.ts +1 -1
  69. package/src/entify/view-model/models.ts +135 -135
  70. package/src/global.d.ts +7 -7
  71. package/src/index.ts +8 -8
  72. package/src/lib/formatDate.ts +15 -15
  73. package/src/lib/index.ts +3 -3
  74. package/src/lib/pagination.ts +114 -114
  75. package/src/lib/utils.ts +135 -135
  76. package/src/react/components/Analytics/eventHandlers.ts +173 -173
  77. package/src/react/components/Analytics/index.tsx +21 -21
  78. package/src/react/components/Analytics/singleton.ts +214 -214
  79. package/src/react/components/Analytics/tracking.ts +221 -221
  80. package/src/react/components/Analytics/types.ts +60 -60
  81. package/src/react/components/Analytics/utils.ts +95 -95
  82. package/src/react/components/AttachmentIcon/index.tsx +53 -53
  83. package/src/react/components/BackgroundHlsVideoPlayer.tsx +97 -97
  84. package/src/react/components/BackgroundVideoPlayer.tsx +32 -32
  85. package/src/react/components/Bulletin.tsx +30 -30
  86. package/src/react/components/ContactForm/ContactForm.tsx +289 -289
  87. package/src/react/components/ContactForm/Input.tsx +48 -48
  88. package/src/react/components/ContactForm/Input2.tsx +59 -59
  89. package/src/react/components/ContactForm/Submit.tsx +48 -48
  90. package/src/react/components/ContactForm/TelInput.tsx +215 -215
  91. package/src/react/components/ContactForm/Textarea.tsx +48 -48
  92. package/src/react/components/ContactForm/Textarea2.tsx +89 -89
  93. package/src/react/components/ContactForm/funcs.ts +64 -64
  94. package/src/react/components/ContactForm/index.ts +7 -7
  95. package/src/react/components/ContactForm/types.ts +68 -68
  96. package/src/react/components/GoogleConsent/CookieItemPanel.tsx +80 -80
  97. package/src/react/components/GoogleConsent/CumtomizedModal.tsx +148 -148
  98. package/src/react/components/GoogleConsent/GoogleConsent.tsx +100 -100
  99. package/src/react/components/GoogleConsent/gtags.ts +67 -67
  100. package/src/react/components/GoogleConsent/index.ts +2 -2
  101. package/src/react/components/GoogleConsent/types.ts +18 -18
  102. package/src/react/components/GoogleConsent//345/217/202/350/200/203.md +4 -4
  103. package/src/react/components/Icon/index.tsx +19 -19
  104. package/src/react/components/Medias/MainMedia.tsx +257 -257
  105. package/src/react/components/Medias/Thumbnail.tsx +62 -62
  106. package/src/react/components/Medias/VideoPlayer.tsx +114 -114
  107. package/src/react/components/Medias/index.tsx +271 -271
  108. package/src/react/components/ProductCard/ProductCard.tsx +24 -24
  109. package/src/react/components/ProductCard/ProductCta/index.tsx +28 -28
  110. package/src/react/components/ProductCard/ProductCta/style.css +3 -3
  111. package/src/react/components/ProductCard/ProductDescription/index.tsx +12 -12
  112. package/src/react/components/ProductCard/ProductDescription/style.css +5 -5
  113. package/src/react/components/ProductCard/ProductMedia/index.tsx +35 -35
  114. package/src/react/components/ProductCard/ProductMedia/style.css +5 -5
  115. package/src/react/components/ProductCard/ProductTitle/index.tsx +7 -7
  116. package/src/react/components/ProductCard/ProductTitle/style.css +3 -3
  117. package/src/react/components/ProductCard/ProductView.tsx +36 -36
  118. package/src/react/components/ProductCard/index.ts +4 -4
  119. package/src/react/components/ProductCard/useQueryProduct.ts +32 -32
  120. package/src/react/components/ReactModalTrigger.tsx +28 -28
  121. package/src/react/components/ReactVideoPlayer.tsx +29 -52
  122. package/src/react/components/RichTextOutline/index.tsx +75 -75
  123. package/src/react/components/RichTextOutline/useAnchorScroll.ts +23 -23
  124. package/src/react/components/Scroller.tsx +39 -39
  125. package/src/react/components/SearchInput.tsx +21 -21
  126. package/src/react/components/Share/index.tsx +86 -86
  127. package/src/react/components/Share/socials.tsx +79 -77
  128. package/src/react/components/Share//350/265/204/346/226/231.md +7 -7
  129. package/src/react/components/ToTop.tsx +72 -72
  130. package/src/react/components/VideoPlayIcon.tsx +43 -0
  131. package/src/react/components/all.ts +38 -38
  132. package/src/react/components/index.ts +16 -16
  133. package/src/robots.ts +4 -4
  134. package/src/entify/lib/newPageMetaOptions.ts +0 -18
  135. package/src/entify/lib/newQueryPageOptions.ts +0 -14
  136. package/src/entify/lib/queryOneIcon.ts +0 -27
  137. package/src/entify/lib/queryPageBySlug.ts +0 -43
  138. package/src/entify/lib/queryPageByType.ts +0 -44
@@ -1,48 +1,48 @@
1
- import { forwardRef } from "react";
2
- import { FieldConfig } from "./types";
3
-
4
- export type TextareaProps = Omit<FieldConfig, "feildStyle"> & {
5
- requiredClassName?: string;
6
- value?: string;
7
- onChange?: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
8
- error?: string;
9
- };
10
-
11
- export const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
12
- (props, ref) => {
13
- const {
14
- label,
15
- name,
16
- required,
17
- requiredClassName,
18
- labelClassName,
19
- inputClassName,
20
- rows = 8,
21
- value,
22
- onChange,
23
- error,
24
- ...rest
25
- } = props;
26
-
27
- return (
28
- <div {...rest}>
29
- <label htmlFor={name} className={labelClassName}>
30
- {label}
31
- {required ? <span className={requiredClassName}>*</span> : ""}
32
- </label>
33
- <textarea
34
- ref={ref}
35
- id={name}
36
- name={name}
37
- required={required}
38
- className={inputClassName}
39
- rows={rows}
40
- value={value}
41
- onChange={onChange}
42
- autoComplete={name}
43
- />
44
- {error && <p className="text-red-500 mt-1">{error}</p>}
45
- </div>
46
- );
47
- }
48
- );
1
+ import { forwardRef } from "react";
2
+ import { FieldConfig } from "./types";
3
+
4
+ export type TextareaProps = Omit<FieldConfig, "feildStyle"> & {
5
+ requiredClassName?: string;
6
+ value?: string;
7
+ onChange?: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
8
+ error?: string;
9
+ };
10
+
11
+ export const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
12
+ (props, ref) => {
13
+ const {
14
+ label,
15
+ name,
16
+ required,
17
+ requiredClassName,
18
+ labelClassName,
19
+ inputClassName,
20
+ rows = 8,
21
+ value,
22
+ onChange,
23
+ error,
24
+ ...rest
25
+ } = props;
26
+
27
+ return (
28
+ <div {...rest}>
29
+ <label htmlFor={name} className={labelClassName}>
30
+ {label}
31
+ {required ? <span className={requiredClassName}>*</span> : ""}
32
+ </label>
33
+ <textarea
34
+ ref={ref}
35
+ id={name}
36
+ name={name}
37
+ required={required}
38
+ className={inputClassName}
39
+ rows={rows}
40
+ value={value}
41
+ onChange={onChange}
42
+ autoComplete={name}
43
+ />
44
+ {error && <p className="text-red-500 mt-1">{error}</p>}
45
+ </div>
46
+ );
47
+ }
48
+ );
@@ -1,89 +1,89 @@
1
- import { forwardRef, useRef, useEffect, useState } from "react";
2
- import { TextareaProps } from "./Textarea";
3
-
4
- export const Textarea2 = forwardRef<HTMLTextAreaElement, TextareaProps>(
5
- (props, ref) => {
6
- const {
7
- label,
8
- name,
9
- required,
10
- requiredClassName,
11
- labelClassName,
12
- inputClassName,
13
- className,
14
- rows = 6,
15
- value,
16
- onChange,
17
- error,
18
- ...rest
19
- } = props;
20
-
21
- const [paddingTop, setPaddingTop] = useState("2.5rem");
22
- const labelRef = useRef<HTMLLabelElement>(null);
23
-
24
- useEffect(() => {
25
- const labelEl = labelRef.current;
26
- if (!labelEl) return;
27
-
28
- let rafId = 0;
29
- const measure = () => {
30
- const height = labelEl.getBoundingClientRect().height;
31
- setPaddingTop(`${height + 12}px`);
32
- };
33
-
34
- measure();
35
- rafId = requestAnimationFrame(measure);
36
-
37
- if (typeof ResizeObserver === "undefined") {
38
- return () => {
39
- cancelAnimationFrame(rafId);
40
- };
41
- }
42
-
43
- const ro = new ResizeObserver(() => {
44
- measure();
45
- });
46
- ro.observe(labelEl);
47
-
48
- return () => {
49
- cancelAnimationFrame(rafId);
50
- ro.disconnect();
51
- };
52
- }, [label]);
53
-
54
- return (
55
- <div className={className} {...rest}>
56
- <div className="relative w-full">
57
- <label
58
- ref={labelRef}
59
- htmlFor={name}
60
- className={`absolute left-3 top-2 opacity-70 text-sm pointer-events-none ${
61
- labelClassName || ""
62
- }`}
63
- >
64
- {label}
65
- {required ? <span className={requiredClassName}>*</span> : ""}
66
- </label>
67
- <textarea
68
- ref={ref}
69
- id={name}
70
- name={name}
71
- required={required}
72
- rows={rows}
73
- value={value}
74
- onChange={onChange}
75
- autoComplete={name}
76
- style={{ paddingTop }}
77
- className={`w-full px-3 pb-2 border border-gray-300 rounded-md shadow-sm focus:outline-none
78
- focus:ring-2 focus:ring-primary-300 focus:border-transparent resize-y bg-transparent focus:bg-white transition-colors duration-200 ${
79
- inputClassName || ""
80
- }`}
81
- />
82
- </div>
83
- {error && <p className="text-red-500 mt-1 text-sm">{error}</p>}
84
- </div>
85
- );
86
- }
87
- );
88
-
89
- Textarea2.displayName = "Textarea2";
1
+ import { forwardRef, useRef, useEffect, useState } from "react";
2
+ import { TextareaProps } from "./Textarea";
3
+
4
+ export const Textarea2 = forwardRef<HTMLTextAreaElement, TextareaProps>(
5
+ (props, ref) => {
6
+ const {
7
+ label,
8
+ name,
9
+ required,
10
+ requiredClassName,
11
+ labelClassName,
12
+ inputClassName,
13
+ className,
14
+ rows = 6,
15
+ value,
16
+ onChange,
17
+ error,
18
+ ...rest
19
+ } = props;
20
+
21
+ const [paddingTop, setPaddingTop] = useState("2.5rem");
22
+ const labelRef = useRef<HTMLLabelElement>(null);
23
+
24
+ useEffect(() => {
25
+ const labelEl = labelRef.current;
26
+ if (!labelEl) return;
27
+
28
+ let rafId = 0;
29
+ const measure = () => {
30
+ const height = labelEl.getBoundingClientRect().height;
31
+ setPaddingTop(`${height + 12}px`);
32
+ };
33
+
34
+ measure();
35
+ rafId = requestAnimationFrame(measure);
36
+
37
+ if (typeof ResizeObserver === "undefined") {
38
+ return () => {
39
+ cancelAnimationFrame(rafId);
40
+ };
41
+ }
42
+
43
+ const ro = new ResizeObserver(() => {
44
+ measure();
45
+ });
46
+ ro.observe(labelEl);
47
+
48
+ return () => {
49
+ cancelAnimationFrame(rafId);
50
+ ro.disconnect();
51
+ };
52
+ }, [label]);
53
+
54
+ return (
55
+ <div className={className} {...rest}>
56
+ <div className="relative w-full">
57
+ <label
58
+ ref={labelRef}
59
+ htmlFor={name}
60
+ className={`absolute left-3 top-2 opacity-70 text-sm pointer-events-none ${
61
+ labelClassName || ""
62
+ }`}
63
+ >
64
+ {label}
65
+ {required ? <span className={requiredClassName}>*</span> : ""}
66
+ </label>
67
+ <textarea
68
+ ref={ref}
69
+ id={name}
70
+ name={name}
71
+ required={required}
72
+ rows={rows}
73
+ value={value}
74
+ onChange={onChange}
75
+ autoComplete={name}
76
+ style={{ paddingTop }}
77
+ className={`w-full px-3 pb-2 border border-gray-300 rounded-md shadow-sm focus:outline-none
78
+ focus:ring-2 focus:ring-primary-300 focus:border-transparent resize-y bg-transparent focus:bg-white transition-colors duration-200 ${
79
+ inputClassName || ""
80
+ }`}
81
+ />
82
+ </div>
83
+ {error && <p className="text-red-500 mt-1 text-sm">{error}</p>}
84
+ </div>
85
+ );
86
+ }
87
+ );
88
+
89
+ Textarea2.displayName = "Textarea2";
@@ -1,64 +1,64 @@
1
- /**
2
- * 简单的加密函数,用于生成防机器人的加密字段
3
- * @param value 需要加密的值
4
- * @returns 加密后的字符串
5
- */
6
- export const encrypt = (value: string, formSalt: string): string => {
7
- // 获取当前时间戳,精确到分钟级别(防止频繁变化)
8
- const timestamp = Math.floor(Date.now() / (60 * 1000));
9
-
10
- // 将时间戳与盐值和输入值组合
11
- const dataToEncrypt = `${formSalt}:${timestamp}:${value}`;
12
-
13
- // 使用简单的哈希算法
14
- let hash = 0;
15
- for (let i = 0; i < dataToEncrypt.length; i++) {
16
- const char = dataToEncrypt.charCodeAt(i);
17
- hash = (hash << 5) - hash + char;
18
- hash = hash & hash; // 转换为32位整数
19
- }
20
-
21
- // 转换为16进制字符串并添加时间戳信息
22
- return `${hash.toString(16)}_${timestamp}`;
23
- };
24
-
25
- /**
26
- * 验证加密字段是否有效
27
- * @param encryptedValue 加密后的字符串
28
- * @param originalValue 原始值(如蜜罐字段的值)
29
- * @param maxAgeMinutes 最大有效时间(分钟)
30
- * @returns 是否有效
31
- */
32
- export const verifyEncryption = (
33
- formSalt: string,
34
- encryptedValue: string = "",
35
- originalValue: string = "",
36
- maxAgeMinutes: number = 30
37
- ): boolean => {
38
- // 解析加密值
39
- const parts = encryptedValue.split("_");
40
- if (parts.length !== 2) {
41
- return false; // 格式不正确
42
- }
43
-
44
- const [hashString, timestampString] = parts;
45
- const timestamp = parseInt(timestampString, 10);
46
-
47
- // 验证时间戳是否在有效期内
48
- const currentTimestamp = Math.floor(Date.now() / (60 * 1000));
49
- if (isNaN(timestamp) || currentTimestamp - timestamp > maxAgeMinutes) {
50
- return false; // 时间戳无效或已过期
51
- }
52
-
53
- // 重新计算哈希值
54
- const dataToEncrypt = `${formSalt}:${timestamp}:${originalValue}`;
55
- let hash = 0;
56
- for (let i = 0; i < dataToEncrypt.length; i++) {
57
- const char = dataToEncrypt.charCodeAt(i);
58
- hash = (hash << 5) - hash + char;
59
- hash = hash & hash;
60
- }
61
-
62
- // 比较哈希值
63
- return hashString === hash.toString(16);
64
- };
1
+ /**
2
+ * 简单的加密函数,用于生成防机器人的加密字段
3
+ * @param value 需要加密的值
4
+ * @returns 加密后的字符串
5
+ */
6
+ export const encrypt = (value: string, formSalt: string): string => {
7
+ // 获取当前时间戳,精确到分钟级别(防止频繁变化)
8
+ const timestamp = Math.floor(Date.now() / (60 * 1000));
9
+
10
+ // 将时间戳与盐值和输入值组合
11
+ const dataToEncrypt = `${formSalt}:${timestamp}:${value}`;
12
+
13
+ // 使用简单的哈希算法
14
+ let hash = 0;
15
+ for (let i = 0; i < dataToEncrypt.length; i++) {
16
+ const char = dataToEncrypt.charCodeAt(i);
17
+ hash = (hash << 5) - hash + char;
18
+ hash = hash & hash; // 转换为32位整数
19
+ }
20
+
21
+ // 转换为16进制字符串并添加时间戳信息
22
+ return `${hash.toString(16)}_${timestamp}`;
23
+ };
24
+
25
+ /**
26
+ * 验证加密字段是否有效
27
+ * @param encryptedValue 加密后的字符串
28
+ * @param originalValue 原始值(如蜜罐字段的值)
29
+ * @param maxAgeMinutes 最大有效时间(分钟)
30
+ * @returns 是否有效
31
+ */
32
+ export const verifyEncryption = (
33
+ formSalt: string,
34
+ encryptedValue: string = "",
35
+ originalValue: string = "",
36
+ maxAgeMinutes: number = 30
37
+ ): boolean => {
38
+ // 解析加密值
39
+ const parts = encryptedValue.split("_");
40
+ if (parts.length !== 2) {
41
+ return false; // 格式不正确
42
+ }
43
+
44
+ const [hashString, timestampString] = parts;
45
+ const timestamp = parseInt(timestampString, 10);
46
+
47
+ // 验证时间戳是否在有效期内
48
+ const currentTimestamp = Math.floor(Date.now() / (60 * 1000));
49
+ if (isNaN(timestamp) || currentTimestamp - timestamp > maxAgeMinutes) {
50
+ return false; // 时间戳无效或已过期
51
+ }
52
+
53
+ // 重新计算哈希值
54
+ const dataToEncrypt = `${formSalt}:${timestamp}:${originalValue}`;
55
+ let hash = 0;
56
+ for (let i = 0; i < dataToEncrypt.length; i++) {
57
+ const char = dataToEncrypt.charCodeAt(i);
58
+ hash = (hash << 5) - hash + char;
59
+ hash = hash & hash;
60
+ }
61
+
62
+ // 比较哈希值
63
+ return hashString === hash.toString(16);
64
+ };
@@ -1,7 +1,7 @@
1
- export * from "./ContactForm";
2
- export * from "./FileUpload2";
3
- export * from "./Input";
4
- export * from "./Submit";
5
- export * from "./Textarea";
6
- export * from "./funcs";
7
- export * from "./types";
1
+ export * from "./ContactForm";
2
+ export * from "./FileUpload2";
3
+ export * from "./Input";
4
+ export * from "./Submit";
5
+ export * from "./Textarea";
6
+ export * from "./funcs";
7
+ export * from "./types";
@@ -1,68 +1,68 @@
1
- import { HTMLInputTypeAttribute } from "react";
2
-
3
- export type FieldStyle = "default" | "label-inline" | string;
4
-
5
- export type FieldConfig = {
6
- name: string;
7
- label: string;
8
- controlName?: string;
9
- required?: boolean;
10
- placeholder?: string;
11
- className?: string;
12
- labelClassName?: string;
13
- inputClassName?: string;
14
- rows?: number;
15
- type?: HTMLInputTypeAttribute;
16
- autoFocus?: boolean;
17
- feildStyle?: FieldStyle;
18
- isExtends?: boolean;
19
- };
20
-
21
- export type SubmitConfig = {
22
- containerClassName?: string;
23
- className?: string;
24
- title?: string;
25
- rawHtml?: string;
26
- //rawHtml模式时,用于触发tailwind编译
27
- needClasses?: string;
28
- };
29
-
30
- export type ContactFormProps = {
31
- submit?: SubmitConfig;
32
- actionUrl?: string;
33
- formSalt: string;
34
- className?: string;
35
- classNames?: {
36
- inputContainer?: string;
37
- input?: string;
38
- label?: string;
39
- required?: string;
40
- };
41
- fields: FieldConfig[];
42
- fromCta?: string;
43
- };
44
-
45
- export interface FileAttachment {
46
- id: string;
47
- name: string;
48
- size: number;
49
- url: string;
50
- }
51
-
52
- export interface QuoteRequest {
53
- name?: string;
54
- email?: string;
55
- company?: string;
56
- message?: string;
57
- fromCta?: string;
58
- // 电话或者whatsapp
59
- mobile?: string;
60
- // 蜜罐字段,用于检测机器人
61
- phone: string;
62
- // 一个加密字段,用于防机器人,点击时附加一个加密的字符串
63
- encryptedField?: string;
64
- // 附件文件信息列表(包含 ID, 名称, 大小, URL)
65
- attachments?: FileAttachment[];
66
- extents?: Record<string, unknown>;
67
- [key: string]: unknown;
68
- }
1
+ import { HTMLInputTypeAttribute } from "react";
2
+
3
+ export type FieldStyle = "default" | "label-inline" | string;
4
+
5
+ export type FieldConfig = {
6
+ name: string;
7
+ label: string;
8
+ controlName?: string;
9
+ required?: boolean;
10
+ placeholder?: string;
11
+ className?: string;
12
+ labelClassName?: string;
13
+ inputClassName?: string;
14
+ rows?: number;
15
+ type?: HTMLInputTypeAttribute;
16
+ autoFocus?: boolean;
17
+ feildStyle?: FieldStyle;
18
+ isExtends?: boolean;
19
+ };
20
+
21
+ export type SubmitConfig = {
22
+ containerClassName?: string;
23
+ className?: string;
24
+ title?: string;
25
+ rawHtml?: string;
26
+ //rawHtml模式时,用于触发tailwind编译
27
+ needClasses?: string;
28
+ };
29
+
30
+ export type ContactFormProps = {
31
+ submit?: SubmitConfig;
32
+ actionUrl?: string;
33
+ formSalt: string;
34
+ className?: string;
35
+ classNames?: {
36
+ inputContainer?: string;
37
+ input?: string;
38
+ label?: string;
39
+ required?: string;
40
+ };
41
+ fields: FieldConfig[];
42
+ fromCta?: string;
43
+ };
44
+
45
+ export interface FileAttachment {
46
+ id: string;
47
+ name: string;
48
+ size: number;
49
+ url: string;
50
+ }
51
+
52
+ export interface QuoteRequest {
53
+ name?: string;
54
+ email?: string;
55
+ company?: string;
56
+ message?: string;
57
+ fromCta?: string;
58
+ // 电话或者whatsapp
59
+ mobile?: string;
60
+ // 蜜罐字段,用于检测机器人
61
+ phone: string;
62
+ // 一个加密字段,用于防机器人,点击时附加一个加密的字符串
63
+ encryptedField?: string;
64
+ // 附件文件信息列表(包含 ID, 名称, 大小, URL)
65
+ attachments?: FileAttachment[];
66
+ extents?: Record<string, unknown>;
67
+ [key: string]: unknown;
68
+ }