@pisell/private-materials 3.4.76 → 3.4.77

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 (164) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +2 -2
  6. package/build/lowcode/preview.js +7 -7
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +9 -9
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +10 -10
  11. package/es/components/booking/forms/sendModal/useSendModal.d.ts +1 -0
  12. package/es/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.d.ts +0 -1
  13. package/es/components/booking/info/hooks/useInfoHolder.d.ts +1 -0
  14. package/es/components/booking/utils.d.ts +2 -2
  15. package/es/components/eftpos/hooks.d.ts +0 -1
  16. package/es/components/eftposPay/amount.d.ts +1 -1
  17. package/es/components/eftposPay/device.d.ts +1 -1
  18. package/es/components/eftposPay/hooks.d.ts +2 -2
  19. package/es/components/eftposPay/store/index.d.ts +5 -5
  20. package/es/components/eftposPay/tyro/hooks.d.ts +0 -1
  21. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +1 -0
  22. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/DayItem/index.d.ts +0 -1
  23. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/index.d.ts +0 -1
  24. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/index.d.ts +0 -1
  25. package/es/components/shoppingCart/components/Empty/index.d.ts +1 -0
  26. package/es/hooks/useTranslationOriginal.d.ts +1 -0
  27. package/es/hooks/useTranslationOriginal.js +10 -0
  28. package/es/index.d.ts +3 -0
  29. package/es/index.js +3 -0
  30. package/es/plus/clientCard/index.d.ts +7 -0
  31. package/es/plus/clientCard/index.js +462 -0
  32. package/es/plus/clientCard/index.less +515 -0
  33. package/es/plus/clientCard/line/index.d.ts +9 -0
  34. package/es/plus/clientCard/line/index.js +157 -0
  35. package/es/plus/clientCard/line/index.less +142 -0
  36. package/es/plus/clientCard/locales.d.ts +18 -0
  37. package/es/plus/clientCard/locales.js +17 -0
  38. package/es/plus/clientCard/types.d.ts +135 -0
  39. package/es/plus/clientCard/types.js +1 -0
  40. package/es/plus/clientCard/utils.d.ts +8 -0
  41. package/es/plus/clientCard/utils.js +59 -0
  42. package/es/plus/clinetSearch/Add/BirthdayField/index.d.ts +3 -0
  43. package/es/plus/clinetSearch/Add/BirthdayField/index.js +277 -0
  44. package/es/plus/clinetSearch/Add/GenderField/index.d.ts +3 -0
  45. package/es/plus/clinetSearch/Add/GenderField/index.js +18 -0
  46. package/es/plus/clinetSearch/Add/PhoneField/index.d.ts +3 -0
  47. package/es/plus/clinetSearch/Add/PhoneField/index.js +52 -0
  48. package/es/plus/clinetSearch/Add/PhoneField/serve.d.ts +2 -0
  49. package/es/plus/clinetSearch/Add/PhoneField/serve.js +166 -0
  50. package/es/plus/clinetSearch/Add/index.d.ts +18 -0
  51. package/es/plus/clinetSearch/Add/index.js +213 -0
  52. package/es/plus/clinetSearch/Add/index.less +30 -0
  53. package/es/plus/clinetSearch/InfiniteScroll/InfiniteScroll.d.ts +5 -0
  54. package/es/plus/clinetSearch/InfiniteScroll/InfiniteScroll.js +265 -0
  55. package/es/plus/clinetSearch/InfiniteScroll/index.d.ts +2 -0
  56. package/es/plus/clinetSearch/InfiniteScroll/index.js +1 -0
  57. package/es/plus/clinetSearch/InfiniteScroll/types.d.ts +46 -0
  58. package/es/plus/clinetSearch/InfiniteScroll/types.js +1 -0
  59. package/es/plus/clinetSearch/index.d.ts +18 -0
  60. package/es/plus/clinetSearch/index.js +234 -0
  61. package/es/plus/clinetSearch/index.less +95 -0
  62. package/es/plus/clinetSearch/locales.d.ts +108 -0
  63. package/es/plus/clinetSearch/locales.js +107 -0
  64. package/es/plus/clinetSearch/serve.d.ts +1 -0
  65. package/es/plus/clinetSearch/serve.js +31 -0
  66. package/es/plus/clinetSearch/types.d.ts +70 -0
  67. package/es/plus/clinetSearch/types.js +1 -0
  68. package/es/plus/walletEditor/components/ImageUpload/index.d.ts +1 -1
  69. package/es/plus/walletPassGallery/components/passDetail/index.d.ts +2 -0
  70. package/es/plus/walletPassGallery/components/passDetail/index.js +104 -39
  71. package/es/plus/walletPassGallery/components/timelineSection/index.d.ts +2 -0
  72. package/es/plus/walletPassGallery/components/timelineSection/index.js +19 -2
  73. package/es/plus/walletPassGallery/index.d.ts +4 -0
  74. package/es/plus/walletPassGallery/index.js +121 -42
  75. package/es/plus/walletPassGallery/serve.d.ts +3 -1
  76. package/es/plus/walletPassGallery/serve.js +13 -13
  77. package/es/pro/Selector/Selector.d.ts +1 -1
  78. package/es/pro/pisellPhoneKeyboard/index.d.ts +13 -0
  79. package/es/pro/pisellPhoneKeyboard/index.js +210 -0
  80. package/es/pro/pisellPhoneKeyboard/index.less +157 -0
  81. package/es/pro/pisellPhoneKeyboard/locales.d.ts +12 -0
  82. package/es/pro/pisellPhoneKeyboard/locales.js +11 -0
  83. package/lib/components/booking/forms/sendModal/useSendModal.d.ts +1 -0
  84. package/lib/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.d.ts +0 -1
  85. package/lib/components/booking/info/hooks/useInfoHolder.d.ts +1 -0
  86. package/lib/components/booking/utils.d.ts +2 -2
  87. package/lib/components/eftpos/hooks.d.ts +0 -1
  88. package/lib/components/eftposPay/amount.d.ts +1 -1
  89. package/lib/components/eftposPay/device.d.ts +1 -1
  90. package/lib/components/eftposPay/hooks.d.ts +2 -2
  91. package/lib/components/eftposPay/store/index.d.ts +5 -5
  92. package/lib/components/eftposPay/tyro/hooks.d.ts +0 -1
  93. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +1 -0
  94. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/DayItem/index.d.ts +0 -1
  95. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/index.d.ts +0 -1
  96. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/index.d.ts +0 -1
  97. package/lib/components/shoppingCart/components/Empty/index.d.ts +1 -0
  98. package/lib/hooks/useTranslationOriginal.d.ts +1 -0
  99. package/lib/hooks/useTranslationOriginal.js +42 -0
  100. package/lib/index.d.ts +3 -0
  101. package/lib/index.js +9 -0
  102. package/lib/plus/clientCard/index.d.ts +7 -0
  103. package/lib/plus/clientCard/index.js +457 -0
  104. package/lib/plus/clientCard/index.less +515 -0
  105. package/lib/plus/clientCard/line/index.d.ts +9 -0
  106. package/lib/plus/clientCard/line/index.js +153 -0
  107. package/lib/plus/clientCard/line/index.less +142 -0
  108. package/lib/plus/clientCard/locales.d.ts +18 -0
  109. package/lib/plus/clientCard/locales.js +41 -0
  110. package/lib/plus/clientCard/types.d.ts +135 -0
  111. package/lib/plus/clientCard/types.js +17 -0
  112. package/lib/plus/clientCard/utils.d.ts +8 -0
  113. package/lib/plus/clientCard/utils.js +75 -0
  114. package/lib/plus/clinetSearch/Add/BirthdayField/index.d.ts +3 -0
  115. package/lib/plus/clinetSearch/Add/BirthdayField/index.js +256 -0
  116. package/lib/plus/clinetSearch/Add/GenderField/index.d.ts +3 -0
  117. package/lib/plus/clinetSearch/Add/GenderField/index.js +52 -0
  118. package/lib/plus/clinetSearch/Add/PhoneField/index.d.ts +3 -0
  119. package/lib/plus/clinetSearch/Add/PhoneField/index.js +78 -0
  120. package/lib/plus/clinetSearch/Add/PhoneField/serve.d.ts +2 -0
  121. package/lib/plus/clinetSearch/Add/PhoneField/serve.js +193 -0
  122. package/lib/plus/clinetSearch/Add/index.d.ts +18 -0
  123. package/lib/plus/clinetSearch/Add/index.js +244 -0
  124. package/lib/plus/clinetSearch/Add/index.less +30 -0
  125. package/lib/plus/clinetSearch/InfiniteScroll/InfiniteScroll.d.ts +5 -0
  126. package/lib/plus/clinetSearch/InfiniteScroll/InfiniteScroll.js +235 -0
  127. package/lib/plus/clinetSearch/InfiniteScroll/index.d.ts +2 -0
  128. package/lib/plus/clinetSearch/InfiniteScroll/index.js +35 -0
  129. package/lib/plus/clinetSearch/InfiniteScroll/types.d.ts +46 -0
  130. package/lib/plus/clinetSearch/InfiniteScroll/types.js +17 -0
  131. package/lib/plus/clinetSearch/index.d.ts +18 -0
  132. package/lib/plus/clinetSearch/index.js +237 -0
  133. package/lib/plus/clinetSearch/index.less +95 -0
  134. package/lib/plus/clinetSearch/locales.d.ts +108 -0
  135. package/lib/plus/clinetSearch/locales.js +131 -0
  136. package/lib/plus/clinetSearch/serve.d.ts +1 -0
  137. package/lib/plus/clinetSearch/serve.js +33 -0
  138. package/lib/plus/clinetSearch/types.d.ts +70 -0
  139. package/lib/plus/clinetSearch/types.js +17 -0
  140. package/lib/plus/walletEditor/components/ImageUpload/index.d.ts +1 -1
  141. package/lib/plus/walletPassGallery/components/passDetail/index.d.ts +2 -0
  142. package/lib/plus/walletPassGallery/components/passDetail/index.js +57 -5
  143. package/lib/plus/walletPassGallery/components/timelineSection/index.d.ts +2 -0
  144. package/lib/plus/walletPassGallery/components/timelineSection/index.js +17 -2
  145. package/lib/plus/walletPassGallery/index.d.ts +4 -0
  146. package/lib/plus/walletPassGallery/index.js +141 -42
  147. package/lib/plus/walletPassGallery/serve.d.ts +3 -1
  148. package/lib/plus/walletPassGallery/serve.js +2 -2
  149. package/lib/pro/Selector/Selector.d.ts +1 -1
  150. package/lib/pro/pisellPhoneKeyboard/index.d.ts +13 -0
  151. package/lib/pro/pisellPhoneKeyboard/index.js +219 -0
  152. package/lib/pro/pisellPhoneKeyboard/index.less +157 -0
  153. package/lib/pro/pisellPhoneKeyboard/locales.d.ts +12 -0
  154. package/lib/pro/pisellPhoneKeyboard/locales.js +35 -0
  155. package/lowcode/client-card/fragments/cardStyle.ts +63 -0
  156. package/lowcode/client-card/fragments/nameStyle.ts +34 -0
  157. package/lowcode/client-card/fragments/pisellAvatar.ts +87 -0
  158. package/lowcode/client-card/fragments/tagConfig.ts +88 -0
  159. package/lowcode/client-card/meta.ts +343 -0
  160. package/lowcode/client-search/meta.ts +316 -0
  161. package/lowcode/eco-cup-list/meta.ts +1 -1
  162. package/lowcode/eco-customer-list/meta.ts +1 -1
  163. package/lowcode/wallet-pass-gallery/meta.ts +66 -1
  164. package/package.json +2 -2
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { SendModalValues } from './index';
2
3
  declare const useSendModal: (bookingId?: number) => {
3
4
  open: boolean;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  declare const useIsLowSpeedNetwork: () => import("react").MutableRefObject<boolean>;
3
2
  export default useIsLowSpeedNetwork;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { EditServiceRef } from "../service/editService";
2
3
  declare const useInfoHolder: (state: any, dispatch: any) => {
3
4
  detailRef: import("react").MutableRefObject<EditServiceRef | undefined>;
@@ -166,10 +166,10 @@ export declare const getProductTotalPrice: (item: any) => number;
166
166
  export declare const getDuration: (duration: number | {
167
167
  type: string;
168
168
  value: number;
169
- }) => number | "flexible" | {
169
+ }) => number | {
170
170
  type: string;
171
171
  value: number;
172
- };
172
+ } | "flexible";
173
173
  export declare const isWalkIn: (customer_id?: number | string) => boolean;
174
174
  export declare const getIsEdit: (state: any) => boolean;
175
175
  export {};
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { Eftpos } from './const';
3
2
  /**
4
3
  * @title: tyro 设备连接
@@ -9,7 +9,7 @@ import { PosProps } from './const';
9
9
  */
10
10
  declare const _default: ({ className, onChange, onClose, formatAmount, isMobile, net, client }: {
11
11
  className?: string | undefined;
12
- onChange?: ((status: "success" | "page" | "print" | "fail" | "mark_tx_processed", params?: string | {
12
+ onChange?: ((status: "page" | "success" | "fail" | "print" | "mark_tx_processed", params?: string | {
13
13
  [keys: string]: unknown;
14
14
  } | undefined, other?: any) => void) | undefined;
15
15
  onClose: () => void;
@@ -11,7 +11,7 @@ import './device.less';
11
11
  declare const _default: ({ api, onChange, onClose, className, device_number, isMobile, net, client, formatAmount, }: {
12
12
  api: PayProps['api'];
13
13
  className?: string | undefined;
14
- onChange?: ((status: "success" | "page" | "print" | "fail" | "mark_tx_processed", params?: string | {
14
+ onChange?: ((status: "page" | "success" | "fail" | "print" | "mark_tx_processed", params?: string | {
15
15
  [keys: string]: unknown;
16
16
  } | undefined, other?: any) => void) | undefined;
17
17
  onClose: () => void;
@@ -15,11 +15,11 @@ export declare const useStoreRef: <T extends {
15
15
  readonly numRef: React.MutableRefObject<string | number | undefined>;
16
16
  readonly orderIdRef: React.MutableRefObject<string | number>;
17
17
  readonly modeRef: React.MutableRefObject<ModeEnum>;
18
- readonly statusRef: React.MutableRefObject<"warn" | "success" | "loading" | "fail" | "pedding" | "resove" | "reject" | "question">;
18
+ readonly statusRef: React.MutableRefObject<"loading" | "success" | "warn" | "fail" | "pedding" | "resove" | "reject" | "question">;
19
19
  readonly netRef: React.MutableRefObject<boolean | undefined>;
20
20
  readonly symbolRef: React.MutableRefObject<string>;
21
21
  readonly amountRef: React.MutableRefObject<string | number>;
22
- readonly eftposRef: React.MutableRefObject<"stripe" | "payo" | "tyro" | "windcave" | "linkly">;
22
+ readonly eftposRef: React.MutableRefObject<"payo" | "tyro" | "windcave" | "stripe" | "linkly">;
23
23
  readonly clientRef: React.MutableRefObject<ClientEnum>;
24
24
  readonly dataRef: React.MutableRefObject<import("./store").State>;
25
25
  };
@@ -174,7 +174,7 @@ export declare const updateCustom: (payload: {
174
174
  export declare const updateStatus: (status: 'loading' | 'warn' | 'fail' | 'success' | 'question') => {
175
175
  type: EActionTypes;
176
176
  payload: {
177
- status: "warn" | "success" | "loading" | "fail" | "question";
177
+ status: "loading" | "success" | "warn" | "fail" | "question";
178
178
  };
179
179
  };
180
180
  /**
@@ -295,10 +295,10 @@ export declare const backUpFree: (payload: Partial<State>) => {
295
295
  name?: string | undefined;
296
296
  symbol?: string | undefined;
297
297
  amount?: string | number | undefined;
298
- mode?: "refund" | "pay" | "fullPay" | "query" | undefined;
298
+ mode?: "pay" | "fullPay" | "refund" | "query" | undefined;
299
299
  order_id?: string | number | undefined;
300
- eftpos?: "stripe" | "payo" | "tyro" | "windcave" | "linkly" | undefined;
301
- action?: "amount" | "pay" | "deviceList" | undefined;
300
+ eftpos?: "payo" | "tyro" | "windcave" | "stripe" | "linkly" | undefined;
301
+ action?: "pay" | "amount" | "deviceList" | undefined;
302
302
  key?: number | undefined;
303
303
  step?: number | undefined;
304
304
  title?: string | undefined;
@@ -308,7 +308,7 @@ export declare const backUpFree: (payload: Partial<State>) => {
308
308
  net?: boolean | undefined;
309
309
  component?: string | undefined;
310
310
  form?: string | undefined;
311
- status?: "warn" | "success" | "loading" | "fail" | "pedding" | "resove" | "reject" | "question" | undefined;
311
+ status?: "loading" | "success" | "warn" | "fail" | "pedding" | "resove" | "reject" | "question" | undefined;
312
312
  warn?: string | undefined;
313
313
  steps?: {
314
314
  /** 用于重置当前步骤 */
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  /**
3
2
  * @title: 获取 Tyro 资源
4
3
  * @description:
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  declare type CallToBookProps = {
2
3
  show: boolean;
3
4
  type: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  declare const DayItem: (props: any) => import("react").JSX.Element;
4
3
  export default DayItem;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  import { CalendarItemProps } from '../../../../../type';
4
3
  declare const Item: (props: CalendarItemProps) => import("react").JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare const StripeSDK: ({ public_key, client_secret, children, lang, }: {
3
2
  public_key: string;
4
3
  client_secret?: string | undefined;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  declare const Empty: (props: any) => import("react").JSX.Element;
3
4
  export default Empty;
@@ -0,0 +1 @@
1
+ export default function useTranslationOriginal(): any;
@@ -0,0 +1,10 @@
1
+ import useEngineContext from "./useEngineContext";
2
+ export default function useTranslationOriginal() {
3
+ var context = useEngineContext();
4
+ var appHelper = context.appHelper;
5
+ var _ref = appHelper || {},
6
+ utils = _ref.utils;
7
+ var _ref2 = utils || {},
8
+ translationOriginal = _ref2.translationOriginal;
9
+ return translationOriginal;
10
+ }
package/es/index.d.ts CHANGED
@@ -44,6 +44,9 @@ export { default as TicketBooking } from './components/ticketBooking';
44
44
  export { default as SubTotal } from './components/subTotal';
45
45
  export { default as EditBookingModal } from './components/booking/editBookingModal';
46
46
  export { default as StepController } from './components/stepController';
47
+ export { default as ClientCard } from './plus/clientCard';
48
+ export { default as ClientSearch } from './plus/clinetSearch';
49
+ export { default as ComprehensiveSearch } from './pro/comprehensiveSearch';
47
50
  export { default as SaasLogin } from './plus/saasLogin';
48
51
  export { default as SaasRegister } from './plus/saasRegister';
49
52
  export { default as SaasCreateOrganization } from './plus/saasCreateOrganization';
package/es/index.js CHANGED
@@ -48,6 +48,9 @@ export { default as TicketBooking } from "./components/ticketBooking";
48
48
  export { default as SubTotal } from "./components/subTotal";
49
49
  export { default as EditBookingModal } from "./components/booking/editBookingModal";
50
50
  export { default as StepController } from "./components/stepController";
51
+ export { default as ClientCard } from "./plus/clientCard";
52
+ export { default as ClientSearch } from "./plus/clinetSearch";
53
+ export { default as ComprehensiveSearch } from "./pro/comprehensiveSearch";
51
54
  export { default as SaasLogin } from "./plus/saasLogin";
52
55
  export { default as SaasRegister } from "./plus/saasRegister";
53
56
  export { default as SaasCreateOrganization } from "./plus/saasCreateOrganization";
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import type { ClientData, ClientCardProps, ProcessedClientData, FieldNames } from './types';
3
+ import './index.less';
4
+ export declare const processClientData: (dataSource: ClientData, fieldNames?: FieldNames) => ProcessedClientData | null;
5
+ export declare const PREFIX = "pisell-client-card";
6
+ declare const ClientCard: React.FC<ClientCardProps>;
7
+ export default ClientCard;
@@ -0,0 +1,462 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
+ import React, { useMemo } from 'react';
9
+ import { Tag, Dropdown, Button } from 'antd';
10
+ import { PisellAvatar, Icon } from '@pisell/materials';
11
+ import { PlusCircle, User01 } from '@pisell/icon';
12
+ import classNames from 'classnames';
13
+ import LineCard from "./line";
14
+ import localeTexts from "./locales";
15
+ import { locales } from '@pisell/utils';
16
+ import useEngineContext from "../../hooks/useEngineContext";
17
+ import ClientName from "../clientName";
18
+ import { getAvatarText, getFieldValue, isWalkIn as isWalkInData } from "./utils";
19
+ import "./index.less";
20
+ export var processClientData = function processClientData(dataSource) {
21
+ var fieldNames = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
22
+ if (!dataSource) return null;
23
+ var fields = ['id', 'name', 'display_name', 'nickname', 'cover', 'phone', 'email', 'birthday', 'address', 'tags'];
24
+ var _data = {};
25
+ fields.forEach(function (key) {
26
+ _data[key] = getFieldValue(dataSource, key, fieldNames);
27
+ });
28
+ return _objectSpread(_objectSpread({}, dataSource), _data);
29
+ };
30
+
31
+ // 类名前缀
32
+ export var PREFIX = 'pisell-client-card';
33
+
34
+ // 渲染头像组件
35
+ var renderAvatar = function renderAvatar(processedData) {
36
+ var avatarConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
37
+ var isShowAvatar = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
38
+ var isShowStatus = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
39
+ var statusConfig = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
40
+ if (!isShowAvatar || !processedData) return null;
41
+ var icon = avatarConfig.icon,
42
+ _avatarConfig$useText = avatarConfig.useTextAvatar,
43
+ useTextAvatar = _avatarConfig$useText === void 0 ? false : _avatarConfig$useText,
44
+ children = avatarConfig.children;
45
+
46
+ // 状态指示器
47
+ var statusIndicator = isShowStatus && /*#__PURE__*/React.createElement("div", {
48
+ className: "".concat(PREFIX, "__status-indicator"),
49
+ style: {
50
+ backgroundColor: statusConfig.color || '#17B26A'
51
+ }
52
+ });
53
+ if (useTextAvatar) {
54
+ var text = children || getAvatarText(processedData.name || processedData.display_name || processedData.nickname || '');
55
+ return /*#__PURE__*/React.createElement("div", {
56
+ className: "".concat(PREFIX, "__avatar-wrapper")
57
+ }, /*#__PURE__*/React.createElement(PisellAvatar, _extends({
58
+ className: "".concat(PREFIX, "__avatar")
59
+ }, avatarConfig), text), statusIndicator);
60
+ }
61
+ if (icon) {
62
+ return /*#__PURE__*/React.createElement("div", {
63
+ className: "".concat(PREFIX, "__avatar-wrapper")
64
+ }, /*#__PURE__*/React.createElement(PisellAvatar, _extends({
65
+ className: "".concat(PREFIX, "__avatar")
66
+ }, avatarConfig, {
67
+ icon: /*#__PURE__*/React.createElement(Icon, {
68
+ type: icon
69
+ })
70
+ })), statusIndicator);
71
+ }
72
+ return /*#__PURE__*/React.createElement("div", {
73
+ className: "".concat(PREFIX, "__avatar-wrapper")
74
+ }, /*#__PURE__*/React.createElement(PisellAvatar, _extends({
75
+ className: "".concat(PREFIX, "__avatar")
76
+ }, avatarConfig, {
77
+ src: processedData.cover
78
+ })), statusIndicator);
79
+ };
80
+
81
+ // 渲染标签
82
+ var renderTags = function renderTags(processedData) {
83
+ var isShowTag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
84
+ var tags = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
85
+ var tagConfig = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
86
+ if (!isShowTag) return null;
87
+ var tagsToShow = tags.length > 0 ? tags : (processedData === null || processedData === void 0 ? void 0 : processedData.tags) || [];
88
+ if (!tagsToShow.length) return null;
89
+ var _tagConfig$gap = tagConfig.gap,
90
+ gap = _tagConfig$gap === void 0 ? 4 : _tagConfig$gap,
91
+ _tagConfig$flexWrap = tagConfig.flexWrap,
92
+ flexWrap = _tagConfig$flexWrap === void 0 ? 'nowrap' : _tagConfig$flexWrap;
93
+ var isNoWrap = flexWrap === 'nowrap';
94
+ return /*#__PURE__*/React.createElement("div", {
95
+ className: classNames("".concat(PREFIX, "__tags"), isNoWrap && "".concat(PREFIX, "__tags--nowrap")),
96
+ style: {
97
+ gap: gap,
98
+ flexWrap: flexWrap
99
+ }
100
+ }, tagsToShow.map(function (tag, index) {
101
+ var content = typeof tag === 'string' ? tag : tag.children || tag.label;
102
+ var tagProps = {
103
+ key: index,
104
+ color: _typeof(tag) === 'object' ? tag.color : undefined,
105
+ className: classNames("".concat(PREFIX, "__tag"), isNoWrap && "".concat(PREFIX, "__tag--nowrap"), !isNoWrap && "".concat(PREFIX, "__tag--wrap"))
106
+ };
107
+ return /*#__PURE__*/React.createElement(Tag, tagProps, content);
108
+ }));
109
+ };
110
+
111
+ // 渲染联系信息
112
+ var renderContactInfo = function renderContactInfo(processedData) {
113
+ var isShowPhone = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
114
+ var isShowEmail = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
115
+ var isShowBirthday = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
116
+ var isShowAddress = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
117
+ var gap = arguments.length > 5 ? arguments[5] : undefined;
118
+ var cardType = arguments.length > 6 ? arguments[6] : undefined;
119
+ if (!processedData) return null;
120
+ var fields = [];
121
+
122
+ // B2 模式下,联系方式只显示一个,电话优先于邮箱
123
+ if (cardType === 'b2') {
124
+ if (isShowPhone && processedData.phone) {
125
+ fields.push({
126
+ value: processedData.phone,
127
+ type: 'phone'
128
+ });
129
+ } else if (isShowEmail && processedData.email) {
130
+ fields.push({
131
+ value: processedData.email,
132
+ type: 'email'
133
+ });
134
+ }
135
+ } else {
136
+ // 其他模式下,显示所有可用的联系方式
137
+ if (isShowPhone && processedData.phone) {
138
+ fields.push({
139
+ value: processedData.phone,
140
+ type: 'phone'
141
+ });
142
+ }
143
+ if (isShowEmail && processedData.email) {
144
+ fields.push({
145
+ value: processedData.email,
146
+ type: 'email'
147
+ });
148
+ }
149
+ }
150
+ if (isShowBirthday && processedData.birthday) {
151
+ fields.push({
152
+ value: processedData.birthday,
153
+ type: 'birthday'
154
+ });
155
+ }
156
+ if (isShowAddress && processedData.address) {
157
+ fields.push({
158
+ value: processedData.address,
159
+ type: 'address'
160
+ });
161
+ }
162
+ if (!fields.length) return null;
163
+ return /*#__PURE__*/React.createElement("div", {
164
+ className: "".concat(PREFIX, "__fields"),
165
+ style: {
166
+ gap: gap
167
+ }
168
+ }, fields.map(function (field, index) {
169
+ return /*#__PURE__*/React.createElement("div", {
170
+ key: index,
171
+ className: classNames("".concat(PREFIX, "__contact"), field.type === 'address' && "".concat(PREFIX, "__contact--address"))
172
+ }, field.value);
173
+ }));
174
+ };
175
+ // 渲染额外字段
176
+ var renderExtraFields = function renderExtraFields() {
177
+ var extraFields = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
178
+ var gap = arguments.length > 1 ? arguments[1] : undefined;
179
+ if (!extraFields.length) return null;
180
+ return /*#__PURE__*/React.createElement("div", {
181
+ className: "".concat(PREFIX, "__extra-fields"),
182
+ style: {
183
+ gap: gap
184
+ }
185
+ }, extraFields.map(function (field, index) {
186
+ return /*#__PURE__*/React.createElement("div", {
187
+ key: index,
188
+ className: "".concat(PREFIX, "__extra-field")
189
+ }, field.icon && /*#__PURE__*/React.createElement(Icon, {
190
+ type: field.icon,
191
+ className: "".concat(PREFIX, "__extra-field-icon"),
192
+ style: {
193
+ fontSize: field.iconSize,
194
+ color: field.iconColor
195
+ }
196
+ }), field.isShowLabel !== false && field.label && /*#__PURE__*/React.createElement("span", {
197
+ className: "".concat(PREFIX, "__extra-field-label")
198
+ }, field.label, ":"), field.isShowValue !== false && field.value && /*#__PURE__*/React.createElement("span", {
199
+ className: classNames("".concat(PREFIX, "__extra-field-value"))
200
+ }, field.value));
201
+ }));
202
+ };
203
+ var ClientCard = function ClientCard(_ref) {
204
+ var _context$appHelper;
205
+ var _ref$type = _ref.type,
206
+ type = _ref$type === void 0 ? 'b2' : _ref$type,
207
+ _ref$direction = _ref.direction,
208
+ direction = _ref$direction === void 0 ? 'horizontal' : _ref$direction,
209
+ dataSource = _ref.dataSource,
210
+ _ref$fieldNames = _ref.fieldNames,
211
+ fieldNames = _ref$fieldNames === void 0 ? {} : _ref$fieldNames,
212
+ _ref$style = _ref.style,
213
+ customStyle = _ref$style === void 0 ? {} : _ref$style,
214
+ horizontalGap = _ref.horizontalGap,
215
+ verticalGap = _ref.verticalGap,
216
+ _ref$isShowAvatar = _ref.isShowAvatar,
217
+ isShowAvatar = _ref$isShowAvatar === void 0 ? true : _ref$isShowAvatar,
218
+ _ref$isShowName = _ref.isShowName,
219
+ isShowName = _ref$isShowName === void 0 ? true : _ref$isShowName,
220
+ _ref$isShowPhone = _ref.isShowPhone,
221
+ isShowPhone = _ref$isShowPhone === void 0 ? true : _ref$isShowPhone,
222
+ _ref$isShowEmail = _ref.isShowEmail,
223
+ isShowEmail = _ref$isShowEmail === void 0 ? true : _ref$isShowEmail,
224
+ _ref$isShowBirthday = _ref.isShowBirthday,
225
+ isShowBirthday = _ref$isShowBirthday === void 0 ? true : _ref$isShowBirthday,
226
+ _ref$isShowAddress = _ref.isShowAddress,
227
+ isShowAddress = _ref$isShowAddress === void 0 ? true : _ref$isShowAddress,
228
+ _ref$isShowTag = _ref.isShowTag,
229
+ isShowTag = _ref$isShowTag === void 0 ? true : _ref$isShowTag,
230
+ _ref$isShowStatus = _ref.isShowStatus,
231
+ isShowStatus = _ref$isShowStatus === void 0 ? false : _ref$isShowStatus,
232
+ _ref$isShowEmptyDescr = _ref.isShowEmptyDescription,
233
+ isShowEmptyDescription = _ref$isShowEmptyDescr === void 0 ? true : _ref$isShowEmptyDescr,
234
+ _ref$avatar = _ref.avatar,
235
+ avatar = _ref$avatar === void 0 ? {} : _ref$avatar,
236
+ _ref$status = _ref.status,
237
+ status = _ref$status === void 0 ? {} : _ref$status,
238
+ dropdown = _ref.dropdown,
239
+ defaultName = _ref.defaultName,
240
+ _ref$nameStyle = _ref.nameStyle,
241
+ nameStyle = _ref$nameStyle === void 0 ? {} : _ref$nameStyle,
242
+ _ref$tags = _ref.tags,
243
+ tags = _ref$tags === void 0 ? [] : _ref$tags,
244
+ _ref$tag = _ref.tag,
245
+ tag = _ref$tag === void 0 ? {} : _ref$tag,
246
+ _ref$extraFields = _ref.extraFields,
247
+ extraFields = _ref$extraFields === void 0 ? [] : _ref$extraFields,
248
+ _ref$slots = _ref.slots,
249
+ slots = _ref$slots === void 0 ? {} : _ref$slots,
250
+ onViewClient = _ref.onViewClient,
251
+ onAddClient = _ref.onAddClient,
252
+ onChangeClient = _ref.onChangeClient,
253
+ onRemoveClient = _ref.onRemoveClient;
254
+ var context = useEngineContext();
255
+ locales.init(localeTexts, ((_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.utils) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.storage) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.get('umi_locale')) || 'en');
256
+ var processed = useMemo(function () {
257
+ if (dataSource) {
258
+ return processClientData(dataSource, fieldNames);
259
+ }
260
+ return null;
261
+ }, [dataSource, fieldNames]);
262
+ var translatedExtraFields = useMemo(function () {
263
+ var _fields = extraFields.filter(function (item) {
264
+ return !!item;
265
+ });
266
+ return _fields;
267
+ }, [extraFields]);
268
+ var _dropdownProps = useMemo(function () {
269
+ var _props = {
270
+ menu: {
271
+ items: [{
272
+ key: 'change',
273
+ label: locales.getText('pisell2.text.change-client'),
274
+ onClick: function onClick() {
275
+ onChangeClient === null || onChangeClient === void 0 || onChangeClient(dataSource);
276
+ }
277
+ }, {
278
+ key: 'remove',
279
+ label: locales.getText('pisell2.text.remove-client'),
280
+ onClick: function onClick() {
281
+ onRemoveClient === null || onRemoveClient === void 0 || onRemoveClient(dataSource);
282
+ }
283
+ }]
284
+ }
285
+ };
286
+ if (dropdown && 'open' in dropdown) {
287
+ _props.open = dropdown.open;
288
+ }
289
+ return _props;
290
+ }, [dropdown]);
291
+ var isWalkIn = isWalkInData(processed === null || processed === void 0 ? void 0 : processed.id);
292
+ if (isWalkIn) {
293
+ var _cardStyle = _objectSpread(_objectSpread({}, customStyle), {}, {
294
+ gap: horizontalGap
295
+ });
296
+ return /*#__PURE__*/React.createElement("div", {
297
+ className: classNames(PREFIX, "".concat(PREFIX, "--empty")),
298
+ onClick: function onClick() {
299
+ return onAddClient === null || onAddClient === void 0 ? void 0 : onAddClient();
300
+ },
301
+ style: _objectSpread(_objectSpread({}, _cardStyle), {}, {
302
+ cursor: 'pointer'
303
+ })
304
+ }, /*#__PURE__*/React.createElement("div", {
305
+ className: "".concat(PREFIX, "__content")
306
+ }, /*#__PURE__*/React.createElement("div", {
307
+ className: "".concat(PREFIX, "__info")
308
+ }, isShowAvatar && /*#__PURE__*/React.createElement(PisellAvatar, {
309
+ icon: avatar.icon ? /*#__PURE__*/React.createElement(Icon, {
310
+ type: avatar.icon
311
+ }) : /*#__PURE__*/React.createElement(User01, {
312
+ style: {
313
+ color: '#475467'
314
+ }
315
+ }),
316
+ size: avatar.size
317
+ }), /*#__PURE__*/React.createElement("div", {
318
+ className: "".concat(PREFIX, "__details"),
319
+ style: {
320
+ gap: verticalGap
321
+ }
322
+ }, isShowName && /*#__PURE__*/React.createElement(ClientName, {
323
+ dataSource: defaultName || locales.getText('pisell2.text.add-client'),
324
+ style: nameStyle
325
+ }), isShowEmptyDescription && /*#__PURE__*/React.createElement("div", {
326
+ className: "".concat(PREFIX, "__empty-description")
327
+ }, locales.getText('pisell2.text.leave-empty-for-walk-in')))), /*#__PURE__*/React.createElement("div", {
328
+ className: "".concat(PREFIX, "__actions")
329
+ }, /*#__PURE__*/React.createElement("span", {
330
+ className: "".concat(PREFIX, "__plugin-icon")
331
+ }, /*#__PURE__*/React.createElement(PlusCircle, {
332
+ style: {
333
+ fontSize: 28,
334
+ color: '#475467'
335
+ }
336
+ })))));
337
+ }
338
+
339
+ // 根据类型渲染不同的卡片
340
+ if (type === 'b1') {
341
+ return /*#__PURE__*/React.createElement(LineCard, {
342
+ dataSource: processed,
343
+ isShowAvatar: isShowAvatar,
344
+ isShowPhone: isShowPhone,
345
+ isShowEmail: isShowEmail,
346
+ isShowStatus: isShowStatus
347
+ // 样式配置
348
+ ,
349
+ style: customStyle,
350
+ horizontalGap: horizontalGap
351
+ // 头像配置
352
+ ,
353
+ avatar: avatar,
354
+ status: status
355
+ // 姓名样式
356
+ ,
357
+ nameStyle: nameStyle
358
+ // 标签配置
359
+ ,
360
+ tags: tags,
361
+ tag: tag
362
+ // 插槽
363
+ ,
364
+ slots: slots
365
+ // 事件回调
366
+ ,
367
+ onViewClient: onViewClient
368
+ });
369
+ }
370
+
371
+ // 通用卡片渲染逻辑 (b2, b5, b9)
372
+ var cardStyle = _objectSpread(_objectSpread({}, customStyle), {}, {
373
+ gap: horizontalGap
374
+ });
375
+ var isVertical = direction === 'vertical';
376
+ var isInlineTag = tag.placement === 'inline';
377
+
378
+ // 根据卡片类型确定显示的字段
379
+ var getFieldVisibility = function getFieldVisibility() {
380
+ switch (type) {
381
+ case 'b2':
382
+ return {
383
+ showBirthday: false,
384
+ showAddress: false,
385
+ showExtraFields: false
386
+ };
387
+ case 'b5':
388
+ return {
389
+ showBirthday: isShowBirthday,
390
+ showAddress: isShowAddress,
391
+ showExtraFields: false
392
+ };
393
+ case 'b9':
394
+ return {
395
+ showBirthday: isShowBirthday,
396
+ showAddress: isShowAddress,
397
+ showExtraFields: true
398
+ };
399
+ default:
400
+ return {
401
+ showBirthday: isShowBirthday,
402
+ showAddress: isShowAddress,
403
+ showExtraFields: true
404
+ };
405
+ }
406
+ };
407
+ var _getFieldVisibility = getFieldVisibility(),
408
+ showBirthday = _getFieldVisibility.showBirthday,
409
+ showAddress = _getFieldVisibility.showAddress,
410
+ showExtraFields = _getFieldVisibility.showExtraFields;
411
+ return /*#__PURE__*/React.createElement("div", {
412
+ className: classNames(PREFIX, "".concat(PREFIX, "--").concat(type), _defineProperty(_defineProperty({}, "".concat(PREFIX, "--vertical"), isVertical), "".concat(PREFIX, "--horizontal"), !isVertical)),
413
+ style: _objectSpread(_objectSpread({}, cardStyle), {}, {
414
+ cursor: 'pointer'
415
+ }),
416
+ onClick: function onClick() {
417
+ return dataSource && (onViewClient === null || onViewClient === void 0 ? void 0 : onViewClient(dataSource));
418
+ }
419
+ }, slots.top, /*#__PURE__*/React.createElement("div", {
420
+ className: "".concat(PREFIX, "__content")
421
+ }, slots.left && /*#__PURE__*/React.createElement("div", {
422
+ className: "".concat(PREFIX, "__slot-left")
423
+ }, slots.left), /*#__PURE__*/React.createElement("div", {
424
+ className: "".concat(PREFIX, "__info")
425
+ }, renderAvatar(processed, avatar, isShowAvatar, isShowStatus, status), /*#__PURE__*/React.createElement("div", {
426
+ className: "".concat(PREFIX, "__details"),
427
+ style: {
428
+ gap: verticalGap
429
+ }
430
+ }, /*#__PURE__*/React.createElement("div", {
431
+ className: classNames("".concat(PREFIX, "__name-tags"), isInlineTag && "".concat(PREFIX, "__name-tags--inline"))
432
+ }, isShowName && /*#__PURE__*/React.createElement(ClientName, {
433
+ dataSource: processed,
434
+ style: nameStyle,
435
+ className: "pisell-client-card__name "
436
+ }), isInlineTag && renderTags(processed, isShowTag, tags, tag)), !isInlineTag && renderTags(processed, isShowTag, tags, tag), renderContactInfo(processed, isShowPhone, isShowEmail, showBirthday, showAddress, typeof verticalGap === 'number' ? verticalGap : undefined, type), showExtraFields && renderExtraFields(translatedExtraFields, typeof verticalGap === 'number' ? verticalGap : undefined))), /*#__PURE__*/React.createElement("div", {
437
+ className: "".concat(PREFIX, "__actions"),
438
+ onClick: function onClick(e) {
439
+ return e.stopPropagation();
440
+ }
441
+ }, /*#__PURE__*/React.createElement(Dropdown, _extends({
442
+ trigger: ['click'],
443
+ placement: "bottomRight"
444
+ }, _dropdownProps), /*#__PURE__*/React.createElement(Button, _extends({
445
+ type: "text",
446
+ className: "".concat(PREFIX, "__menu-button"),
447
+ size: "large",
448
+ icon: /*#__PURE__*/React.createElement(Icon, {
449
+ type: 'pisell2-dots-vertical',
450
+ className: "".concat(PREFIX, "__menu-button-icon")
451
+ })
452
+ }, (dropdown === null || dropdown === void 0 ? void 0 : dropdown.buttonProps) || {}, {
453
+ onClick: function onClick(e) {
454
+ var _dropdown$buttonProps, _dropdown$buttonProps2;
455
+ e.stopPropagation(); // 阻止事件冒泡,避免触发卡片点击
456
+ dropdown === null || dropdown === void 0 || (_dropdown$buttonProps = dropdown.buttonProps) === null || _dropdown$buttonProps === void 0 || (_dropdown$buttonProps2 = _dropdown$buttonProps.onClick) === null || _dropdown$buttonProps2 === void 0 || _dropdown$buttonProps2.call(_dropdown$buttonProps, e);
457
+ }
458
+ })))), slots.right && /*#__PURE__*/React.createElement("div", {
459
+ className: "".concat(PREFIX, "__slot-right")
460
+ }, slots.right)), slots.bottom);
461
+ };
462
+ export default ClientCard;