@pisell/private-materials 3.4.72 → 3.4.74

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 (184) 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 +1 -1
  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 +10 -10
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +10 -10
  11. package/es/components/Sales/Cart/index.d.ts +1 -1
  12. package/es/components/Sales/Cart/index.js +18 -3
  13. package/es/components/Sales/Checkout/utils.js +57 -1
  14. package/es/components/Sales/Summary/index.d.ts +2 -0
  15. package/es/components/Sales/Summary/index.js +7 -2
  16. package/es/components/Sales/Summary/utils.d.ts +10 -3
  17. package/es/components/Sales/Summary/utils.js +57 -10
  18. package/es/components/appointmentBooking/components/Cart/Item/index.d.ts +1 -0
  19. package/es/components/appointmentBooking/components/Cart/Item/index.js +62 -4
  20. package/es/components/appointmentBooking/components/Deposit/index.d.ts +5 -1
  21. package/es/components/appointmentBooking/components/Deposit/index.js +9 -4
  22. package/es/components/booking/info/date/index.d.ts +1 -0
  23. package/es/components/booking/info/hooks/useInfoHolder.d.ts +1 -0
  24. package/es/components/booking/info/service/Lists.d.ts +1 -0
  25. package/es/components/booking/info/service/editService/BookingList/index.d.ts +1 -0
  26. package/es/components/booking/info/service/serviceItem/index.d.ts +1 -0
  27. package/es/components/booking/info/service/serviceList/index.d.ts +1 -0
  28. package/es/components/booking/info/service2/Lists.d.ts +1 -0
  29. package/es/components/booking/info2/service/serviceItem/index.d.ts +1 -0
  30. package/es/components/booking/info2/service/serviceList/index.d.ts +1 -0
  31. package/es/components/booking/notes/addNote/index.d.ts +1 -0
  32. package/es/components/eftposPay/amount.d.ts +1 -1
  33. package/es/components/eftposPay/component/fail/failCustom.d.ts +1 -0
  34. package/es/components/eftposPay/device.d.ts +1 -1
  35. package/es/components/eftposPay/device.js +208 -36
  36. package/es/components/eftposPay/pay.d.ts +1 -0
  37. package/es/components/eftposPay/store/index.d.ts +1 -1
  38. package/es/components/eftposPay/windcave/windcave.d.ts +1 -0
  39. package/es/components/eventBooking/components/Provider/Cart/Deposit/index.d.ts +4 -1
  40. package/es/components/eventBooking/components/Provider/Cart/Deposit/index.js +4 -1
  41. package/es/components/eventBooking/components/Provider/Cart/Item/index.d.ts +0 -1
  42. package/es/components/eventBooking/components/Provider/Cart/Item/index.js +79 -6
  43. package/es/components/eventBooking/components/Provider/Cart/Item/index.less +7 -6
  44. package/es/components/eventBooking/components/Provider/Cart/index.js +2 -7
  45. package/es/components/eventBooking/components/Provider/Content/index.less +1 -1
  46. package/es/components/eventBooking/components/Voucher/index.js +1 -1
  47. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +1 -0
  48. package/es/components/index.d.ts +1 -2
  49. package/es/components/index.js +1 -2
  50. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/Finish/index.d.ts +1 -0
  51. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/PageLoading/index.d.ts +1 -0
  52. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/PaymentRequestForm.d.ts +1 -0
  53. package/es/components/productSelect/components/TabProduct/index.d.ts +1 -0
  54. package/es/components/productSelect/components/productGroup/index.d.ts +1 -0
  55. package/es/components/shoppingCart/components/Cart/Product.d.ts +1 -0
  56. package/es/components/shoppingCart/components/Cart/index.d.ts +1 -0
  57. package/es/components/subTotal/index.d.ts +2 -0
  58. package/es/components/subTotal/index.js +42 -20
  59. package/es/components/ticketBooking/components/menuBar/index.d.ts +1 -0
  60. package/es/index.d.ts +1 -0
  61. package/es/index.js +1 -0
  62. package/es/plus/orderList/config.d.ts +1 -0
  63. package/es/plus/saasAttendance/index.d.ts +6 -0
  64. package/es/plus/saasAttendance/index.js +5 -0
  65. package/es/plus/saasAttendance/locales.d.ts +318 -0
  66. package/es/plus/saasAttendance/locales.js +354 -0
  67. package/es/plus/saasAttendance/settings/BasicInfoTab.d.ts +5 -0
  68. package/es/plus/saasAttendance/settings/BasicInfoTab.js +96 -0
  69. package/es/plus/saasAttendance/settings/ClockInMethodTab.d.ts +8 -0
  70. package/es/plus/saasAttendance/settings/ClockInMethodTab.js +81 -0
  71. package/es/plus/saasAttendance/settings/CorrectionPolicyTab.d.ts +8 -0
  72. package/es/plus/saasAttendance/settings/CorrectionPolicyTab.js +293 -0
  73. package/es/plus/saasAttendance/settings/ShiftScheduleTab.d.ts +5 -0
  74. package/es/plus/saasAttendance/settings/ShiftScheduleTab.js +109 -0
  75. package/es/plus/saasAttendance/settings/components/MapField.d.ts +78 -0
  76. package/es/plus/saasAttendance/settings/components/MapField.js +810 -0
  77. package/es/plus/saasAttendance/settings/components/index.d.ts +3 -0
  78. package/es/plus/saasAttendance/settings/components/index.js +2 -0
  79. package/es/plus/saasAttendance/settings/components/membersField/index.d.ts +8 -0
  80. package/es/plus/saasAttendance/settings/components/membersField/index.js +216 -0
  81. package/es/plus/saasAttendance/settings/components/membersField/index.less +70 -0
  82. package/es/plus/saasAttendance/settings/components/shiftModal/index.d.ts +18 -0
  83. package/es/plus/saasAttendance/settings/components/shiftModal/index.js +438 -0
  84. package/es/plus/saasAttendance/settings/index.d.ts +18 -0
  85. package/es/plus/saasAttendance/settings/index.js +255 -0
  86. package/es/plus/saasAttendance/settings/index.less +495 -0
  87. package/es/plus/saasAttendance/settings/serve.d.ts +27 -0
  88. package/es/plus/saasAttendance/settings/serve.js +83 -0
  89. package/es/plus/saasAttendance/settings/types.d.ts +128 -0
  90. package/es/plus/saasAttendance/settings/types.js +1 -0
  91. package/es/plus/selectHolder/locales.d.ts +6 -0
  92. package/es/plus/selectHolder/locales.js +6 -0
  93. package/es/plus/skuOptionsSelection/components/NormalCard/index.d.ts +1 -0
  94. package/es/plus/skuOptionsSelection/components/OptionsCard/OptionItemCard.d.ts +1 -0
  95. package/es/plus/skuOptionsSelection/components/OptionsModal/index.d.ts +1 -0
  96. package/lib/components/Sales/Cart/index.d.ts +1 -1
  97. package/lib/components/Sales/Cart/index.js +20 -7
  98. package/lib/components/Sales/Checkout/utils.js +64 -1
  99. package/lib/components/Sales/Summary/index.d.ts +2 -0
  100. package/lib/components/Sales/Summary/index.js +8 -2
  101. package/lib/components/Sales/Summary/utils.d.ts +10 -3
  102. package/lib/components/Sales/Summary/utils.js +38 -13
  103. package/lib/components/appointmentBooking/components/Cart/Item/index.d.ts +1 -0
  104. package/lib/components/appointmentBooking/components/Cart/Item/index.js +52 -4
  105. package/lib/components/appointmentBooking/components/Deposit/index.d.ts +5 -1
  106. package/lib/components/appointmentBooking/components/Deposit/index.js +7 -4
  107. package/lib/components/booking/info/date/index.d.ts +1 -0
  108. package/lib/components/booking/info/hooks/useInfoHolder.d.ts +1 -0
  109. package/lib/components/booking/info/service/Lists.d.ts +1 -0
  110. package/lib/components/booking/info/service/editService/BookingList/index.d.ts +1 -0
  111. package/lib/components/booking/info/service/serviceItem/index.d.ts +1 -0
  112. package/lib/components/booking/info/service/serviceList/index.d.ts +1 -0
  113. package/lib/components/booking/info/service2/Lists.d.ts +1 -0
  114. package/lib/components/booking/info2/service/serviceItem/index.d.ts +1 -0
  115. package/lib/components/booking/info2/service/serviceList/index.d.ts +1 -0
  116. package/lib/components/booking/notes/addNote/index.d.ts +1 -0
  117. package/lib/components/eftposPay/amount.d.ts +1 -1
  118. package/lib/components/eftposPay/component/fail/failCustom.d.ts +1 -0
  119. package/lib/components/eftposPay/device.d.ts +1 -1
  120. package/lib/components/eftposPay/device.js +108 -23
  121. package/lib/components/eftposPay/pay.d.ts +1 -0
  122. package/lib/components/eftposPay/store/index.d.ts +1 -1
  123. package/lib/components/eftposPay/windcave/windcave.d.ts +1 -0
  124. package/lib/components/eventBooking/components/Provider/Cart/Deposit/index.d.ts +4 -1
  125. package/lib/components/eventBooking/components/Provider/Cart/Deposit/index.js +3 -1
  126. package/lib/components/eventBooking/components/Provider/Cart/Item/index.d.ts +0 -1
  127. package/lib/components/eventBooking/components/Provider/Cart/Item/index.js +77 -5
  128. package/lib/components/eventBooking/components/Provider/Cart/Item/index.less +7 -6
  129. package/lib/components/eventBooking/components/Provider/Cart/index.js +2 -2
  130. package/lib/components/eventBooking/components/Provider/Content/index.less +1 -1
  131. package/lib/components/eventBooking/components/Voucher/index.js +1 -1
  132. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +1 -0
  133. package/lib/components/index.d.ts +1 -2
  134. package/lib/components/index.js +0 -3
  135. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/Finish/index.d.ts +1 -0
  136. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/PageLoading/index.d.ts +1 -0
  137. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/PaymentRequestForm.d.ts +1 -0
  138. package/lib/components/productSelect/components/TabProduct/index.d.ts +1 -0
  139. package/lib/components/productSelect/components/productGroup/index.d.ts +1 -0
  140. package/lib/components/shoppingCart/components/Cart/Product.d.ts +1 -0
  141. package/lib/components/shoppingCart/components/Cart/index.d.ts +1 -0
  142. package/lib/components/subTotal/index.d.ts +2 -0
  143. package/lib/components/subTotal/index.js +34 -20
  144. package/lib/components/ticketBooking/components/menuBar/index.d.ts +1 -0
  145. package/lib/index.d.ts +1 -0
  146. package/lib/index.js +3 -0
  147. package/lib/plus/orderList/config.d.ts +1 -0
  148. package/lib/plus/saasAttendance/index.d.ts +6 -0
  149. package/lib/plus/saasAttendance/index.js +39 -0
  150. package/lib/plus/saasAttendance/locales.d.ts +318 -0
  151. package/lib/plus/saasAttendance/locales.js +342 -0
  152. package/lib/plus/saasAttendance/settings/BasicInfoTab.d.ts +5 -0
  153. package/lib/plus/saasAttendance/settings/BasicInfoTab.js +152 -0
  154. package/lib/plus/saasAttendance/settings/ClockInMethodTab.d.ts +8 -0
  155. package/lib/plus/saasAttendance/settings/ClockInMethodTab.js +88 -0
  156. package/lib/plus/saasAttendance/settings/CorrectionPolicyTab.d.ts +8 -0
  157. package/lib/plus/saasAttendance/settings/CorrectionPolicyTab.js +369 -0
  158. package/lib/plus/saasAttendance/settings/ShiftScheduleTab.d.ts +5 -0
  159. package/lib/plus/saasAttendance/settings/ShiftScheduleTab.js +106 -0
  160. package/lib/plus/saasAttendance/settings/components/MapField.d.ts +78 -0
  161. package/lib/plus/saasAttendance/settings/components/MapField.js +631 -0
  162. package/lib/plus/saasAttendance/settings/components/index.d.ts +3 -0
  163. package/lib/plus/saasAttendance/settings/components/index.js +42 -0
  164. package/lib/plus/saasAttendance/settings/components/membersField/index.d.ts +8 -0
  165. package/lib/plus/saasAttendance/settings/components/membersField/index.js +247 -0
  166. package/lib/plus/saasAttendance/settings/components/membersField/index.less +70 -0
  167. package/lib/plus/saasAttendance/settings/components/shiftModal/index.d.ts +18 -0
  168. package/lib/plus/saasAttendance/settings/components/shiftModal/index.js +447 -0
  169. package/lib/plus/saasAttendance/settings/index.d.ts +18 -0
  170. package/lib/plus/saasAttendance/settings/index.js +283 -0
  171. package/lib/plus/saasAttendance/settings/index.less +495 -0
  172. package/lib/plus/saasAttendance/settings/serve.d.ts +27 -0
  173. package/lib/plus/saasAttendance/settings/serve.js +54 -0
  174. package/lib/plus/saasAttendance/settings/types.d.ts +128 -0
  175. package/lib/plus/saasAttendance/settings/types.js +17 -0
  176. package/lib/plus/selectHolder/locales.d.ts +6 -0
  177. package/lib/plus/selectHolder/locales.js +6 -0
  178. package/lib/plus/skuOptionsSelection/components/NormalCard/index.d.ts +1 -0
  179. package/lib/plus/skuOptionsSelection/components/OptionsCard/OptionItemCard.d.ts +1 -0
  180. package/lib/plus/skuOptionsSelection/components/OptionsModal/index.d.ts +1 -0
  181. package/lowcode/eco-cup-list/meta.ts +63 -0
  182. package/lowcode/eco-customer-list/meta.ts +63 -0
  183. package/lowcode/saas-attendance-settings/meta.ts +56 -0
  184. package/package.json +2 -2
@@ -0,0 +1,128 @@
1
+ /**
2
+ * 多语言名称
3
+ */
4
+ export interface MultiLangName {
5
+ en?: string;
6
+ 'zh-CN'?: string;
7
+ 'zh-HK'?: string;
8
+ original?: string;
9
+ }
10
+ /**
11
+ * 未排班时的打卡规则
12
+ * - anytime: 随时打卡
13
+ * - business_hours: 正常上下班(按照店铺营业时间打卡)
14
+ * - select_shift: 自选班次(员工需先选班次后打卡)
15
+ */
16
+ export declare type NoShiftPolicy = 'anytime' | 'business_hours' | 'select_shift';
17
+ /**
18
+ * 考勤规则
19
+ */
20
+ export interface AttendanceRule {
21
+ no_shift_policy: NoShiftPolicy;
22
+ }
23
+ /**
24
+ * 考勤地点
25
+ */
26
+ export interface AttendanceLocation {
27
+ id: string;
28
+ name: MultiLangName;
29
+ radius?: number;
30
+ address: {
31
+ lat: number;
32
+ lng: number;
33
+ };
34
+ }
35
+ /**
36
+ * 考勤地点配置
37
+ */
38
+ export interface AttendancePlace {
39
+ radius: number;
40
+ location: AttendanceLocation[];
41
+ }
42
+ /**
43
+ * 补卡类型
44
+ * - normal: 正常
45
+ * - late: 迟到
46
+ * - early_leave: 早退
47
+ * - missing: 缺卡
48
+ */
49
+ export declare type CorrectionType = 'normal' | 'late' | 'early_leave' | 'missing';
50
+ /**
51
+ * 补卡周期类型
52
+ * - natural_month: 自然月
53
+ * - custom: 自定义周期
54
+ */
55
+ export declare type FrequencyType = 'natural_month' | 'custom';
56
+ /**
57
+ * 补卡配置
58
+ */
59
+ export interface AttendanceCorrection {
60
+ allow: boolean;
61
+ types: CorrectionType[];
62
+ approver_ids: number[];
63
+ days_limit: number;
64
+ monthly_times: number;
65
+ period_type: FrequencyType;
66
+ period_custom: number | null;
67
+ }
68
+ /**
69
+ * 考勤组设置值 - 完整的API数据结构
70
+ */
71
+ export interface AttendanceGroupSettingsValue {
72
+ id?: number;
73
+ name: MultiLangName;
74
+ timezone: string;
75
+ rule: AttendanceRule;
76
+ place: AttendancePlace;
77
+ member_ids: number[];
78
+ correction: AttendanceCorrection;
79
+ creator_type?: string;
80
+ creator_id?: number;
81
+ editor_type?: string;
82
+ editor_id?: number;
83
+ created_at?: string;
84
+ updated_at?: string;
85
+ }
86
+ /**
87
+ * 基本信息Tab的值
88
+ */
89
+ export interface BasicInfoTabValue {
90
+ name: MultiLangName;
91
+ timezone: string;
92
+ member_ids: number[];
93
+ }
94
+ /**
95
+ * 排班规则Tab的值
96
+ */
97
+ export interface ShiftScheduleTabValue {
98
+ rule: AttendanceRule;
99
+ }
100
+ /**
101
+ * 打卡方式Tab的值
102
+ */
103
+ export interface ClockInMethodTabValue {
104
+ place: AttendancePlace;
105
+ }
106
+ /**
107
+ * 补卡规则Tab的值
108
+ */
109
+ export interface CorrectionPolicyTabValue {
110
+ correction: AttendanceCorrection;
111
+ }
112
+ export declare type AttendanceGroupSettingsSection = 'basic' | 'shift' | 'clock' | 'correction';
113
+ export interface TenantAccount {
114
+ account?: {
115
+ id: number;
116
+ email: string;
117
+ avatar: string;
118
+ };
119
+ account_id: number;
120
+ created_at: string;
121
+ id: number;
122
+ member_id: string;
123
+ nickname: string;
124
+ status: 'active' | 'inactive';
125
+ tenant_id: number;
126
+ type: 'founder' | 'staff';
127
+ updated_at: string;
128
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -17,5 +17,11 @@ declare const _default: {
17
17
  'pisell-select-holder-selected': string;
18
18
  'pisell-select-holder-skip': string;
19
19
  };
20
+ 'zh-HK': {
21
+ 'pisell-select-holder-create': string;
22
+ 'pisell-select-holder-please-select': string;
23
+ 'pisell-select-holder-selected': string;
24
+ 'pisell-select-holder-skip': string;
25
+ };
20
26
  };
21
27
  export default _default;
@@ -16,5 +16,11 @@ export default {
16
16
  'pisell-select-holder-please-select': '請選擇',
17
17
  'pisell-select-holder-selected': '已選擇:',
18
18
  'pisell-select-holder-skip': '跳過'
19
+ },
20
+ 'zh-HK': {
21
+ 'pisell-select-holder-create': '創建',
22
+ 'pisell-select-holder-please-select': '請選擇',
23
+ 'pisell-select-holder-selected': '已選擇:',
24
+ 'pisell-select-holder-skip': '跳過'
19
25
  }
20
26
  };
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { RenderItemProps } from '../../../../pro/Selector/types';
2
3
  declare const NormalCard: (props: RenderItemProps & {
3
4
  parentDataSource: any;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  declare const OptionItemCard: (props: any) => JSX.Element;
3
4
  export default OptionItemCard;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  interface OptionsModalProps {
2
3
  parentDataSource: any;
3
4
  dataSource: any;
@@ -13,7 +13,7 @@ interface CartContextType {
13
13
  createCartItemFromEvent: (eventItem: any) => CartItem;
14
14
  createCartItemFromHolder: (holderItem: any) => CartItem;
15
15
  addToCart: () => void;
16
- updateCartItem: (cartItem: CartItem) => CartItem;
16
+ updateCartItem: (cartItem: CartItem, updateType?: 'deposit') => CartItem;
17
17
  deleteCartItem: (cartItem: CartItem) => void;
18
18
  clickCartItem: (cartItem: CartItem) => void;
19
19
  updateCurrentCartItem: (cartItem: Partial<CartItem>) => void;
@@ -241,10 +241,7 @@ var CartProvider = ({ children }) => {
241
241
  const endDateInfo = (_g = (_f = eventItem == null ? void 0 : eventItem.eventDetail) == null ? void 0 : _f.selectDate) == null ? void 0 : _g.endDateInfo;
242
242
  const endTime = (_j = (_i = (_h = endDateInfo == null ? void 0 : endDateInfo.times) == null ? void 0 : _h.slice(-1)) == null ? void 0 : _i[0]) == null ? void 0 : _j.end_at;
243
243
  const num = 1;
244
- const { price, totalPrice, originTotal, is_charge_tax } = (0, import_utils3.handleProductInfo)(
245
- eventDetail,
246
- num
247
- );
244
+ const { price, totalPrice, originTotal, is_charge_tax } = (0, import_utils3.handleProductInfo)(eventDetail, num);
248
245
  const transformProduct = (_temp) => {
249
246
  var _a2;
250
247
  if (!((_a2 = _temp == null ? void 0 : _temp.variant) == null ? void 0 : _a2.length)) {
@@ -305,6 +302,7 @@ var CartProvider = ({ children }) => {
305
302
  event_unique_identifier: _id
306
303
  // 传递给接口用于商品可用性检测的比对
307
304
  },
305
+ _eventDetail: eventDetail,
308
306
  _productDetail: eventDetail.productDetail,
309
307
  _productOrigin: transformProduct(
310
308
  ((_p = eventDetail == null ? void 0 : eventDetail.productDetail) == null ? void 0 : _p.origin) || bookingOptionData
@@ -337,9 +335,24 @@ var CartProvider = ({ children }) => {
337
335
  });
338
336
  }
339
337
  };
340
- const updateCartItem = (cartItem) => {
341
- const newCartItems = getCurrentData().cartData.cartItems.map(
342
- (item) => item._id === cartItem._id ? cartItem : item
338
+ const updateCartItem = (cartItem, updateType) => {
339
+ var _a, _b, _c;
340
+ let newCartItems = (_c = (_b = (_a = getCurrentData()) == null ? void 0 : _a.cartData) == null ? void 0 : _b.cartItems) == null ? void 0 : _c.map(
341
+ (item) => {
342
+ if (item._id === cartItem._id) {
343
+ const _tempCartItem = { ...cartItem || {} };
344
+ if (updateType === "deposit") {
345
+ const eventDetail = _tempCartItem == null ? void 0 : _tempCartItem._eventDetail;
346
+ if (eventDetail) {
347
+ const num = (_tempCartItem == null ? void 0 : _tempCartItem.num) || 1;
348
+ const deposit = (0, import_utils3.handleProductDeposit)(_tempCartItem, eventDetail, num);
349
+ _tempCartItem.deposit = deposit;
350
+ }
351
+ }
352
+ return _tempCartItem;
353
+ }
354
+ return item;
355
+ }
343
356
  );
344
357
  setCartData({
345
358
  cartItems: newCartItems
@@ -1,6 +1,8 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
4
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
7
  var __export = (target, all) => {
6
8
  for (var name in all)
@@ -14,6 +16,14 @@ var __copyProps = (to, from, except, desc) => {
14
16
  }
15
17
  return to;
16
18
  };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
17
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
28
 
19
29
  // src/components/Sales/Checkout/utils.ts
@@ -25,6 +35,7 @@ __export(utils_exports, {
25
35
  getFormParams: () => getFormParams
26
36
  });
27
37
  module.exports = __toCommonJS(utils_exports);
38
+ var import_decimal = __toESM(require("decimal.js"));
28
39
  var formatProductOption = (option) => {
29
40
  if (!option) {
30
41
  return [];
@@ -57,10 +68,62 @@ var formatProductBundle = (bundle) => {
57
68
  var formatBookings = (list) => {
58
69
  let bookings = [];
59
70
  bookings = list.map((item) => {
60
- return item._originData;
71
+ var _a, _b, _c;
72
+ const newOriginData = { ...item._originData || {} };
73
+ const product = (newOriginData == null ? void 0 : newOriginData.product) || {};
74
+ const discount_list = product == null ? void 0 : product.discount_list;
75
+ const main_product_discount = discount_list == null ? void 0 : discount_list.filter(
76
+ (d) => {
77
+ var _a2;
78
+ return !((_a2 = d.metadata) == null ? void 0 : _a2.custom_product_bundle_map_id);
79
+ }
80
+ );
81
+ if (main_product_discount == null ? void 0 : main_product_discount.length) {
82
+ product.metadata = {
83
+ product_discount_difference: handleProductDiscountDifference([
84
+ main_product_discount
85
+ ])
86
+ };
87
+ }
88
+ console.log("main_product_discount", main_product_discount);
89
+ if ((_a = product == null ? void 0 : product.product_bundle) == null ? void 0 : _a.length) {
90
+ product.product_bundle = (_c = (_b = product == null ? void 0 : product.product_bundle) == null ? void 0 : _b.map) == null ? void 0 : _c.call(_b, (v) => {
91
+ var _a2, _b2, _c2, _d;
92
+ const bundle_item_discount = [];
93
+ (_b2 = (_a2 = item == null ? void 0 : item.selectedBundle) == null ? void 0 : _a2.forEach) == null ? void 0 : _b2.call(_a2, (s) => {
94
+ if ((s == null ? void 0 : s.id) === (v == null ? void 0 : v.bundle_id) && (s == null ? void 0 : s.group_id) === (v == null ? void 0 : v.bundle_group_id) && (s == null ? void 0 : s._bundle_product_id) === (v == null ? void 0 : v.bundle_product_id)) {
95
+ bundle_item_discount.push(...(s == null ? void 0 : s.discount_list) || []);
96
+ }
97
+ });
98
+ console.log("bundle_item_discount", bundle_item_discount);
99
+ const newBundleItem = { ...v || {} };
100
+ if (bundle_item_discount == null ? void 0 : bundle_item_discount.length) {
101
+ newBundleItem.metadata = {
102
+ custom_product_bundle_map_id: (_d = (_c2 = bundle_item_discount == null ? void 0 : bundle_item_discount[0]) == null ? void 0 : _c2.metadata) == null ? void 0 : _d.custom_product_bundle_map_id,
103
+ product_discount_difference: handleProductDiscountDifference(bundle_item_discount)
104
+ };
105
+ }
106
+ return newBundleItem;
107
+ });
108
+ }
109
+ newOriginData.product = product;
110
+ return newOriginData;
61
111
  });
112
+ console.log("bookings>>>>", bookings);
62
113
  return bookings;
63
114
  };
115
+ var handleProductDiscountDifference = (discount_list) => {
116
+ const product_discount_difference = discount_list == null ? void 0 : discount_list.reduce(
117
+ (pre, cur) => {
118
+ var _a;
119
+ return pre.plus(
120
+ new import_decimal.default(((_a = cur == null ? void 0 : cur.metadata) == null ? void 0 : _a.product_discount_difference) || 0)
121
+ );
122
+ },
123
+ new import_decimal.default(0)
124
+ );
125
+ return product_discount_difference.toNumber();
126
+ };
64
127
  var formatValues = (params) => {
65
128
  var _a, _b;
66
129
  const { state, otherValue, platform, excludeDisabled, extra } = params;
@@ -7,6 +7,8 @@ interface SummaryContextType {
7
7
  taxTitle?: string;
8
8
  totalTaxFee?: string;
9
9
  isPriceIncludeTax?: 0 | 1;
10
+ taxRate?: number;
11
+ surcharge?: any;
10
12
  deposit?: {
11
13
  total: string;
12
14
  protocols: any[];
@@ -40,6 +40,7 @@ var import_Cart = require("../Cart");
40
40
  var import_utils = require("./utils");
41
41
  var import_Init = require("../Init");
42
42
  var import_serve = require("./serve");
43
+ var import_useEngineContext = require("../../../hooks/useEngineContext");
43
44
  var defaultState = {};
44
45
  var SummaryContext = (0, import_react.createContext)(
45
46
  void 0
@@ -47,15 +48,18 @@ var SummaryContext = (0, import_react.createContext)(
47
48
  var SummaryProvider = ({
48
49
  children
49
50
  }) => {
51
+ const pisellos = (0, import_useEngineContext.usePisellOS)();
50
52
  const { cartData } = (0, import_Cart.useCart)();
51
53
  const { initData } = (0, import_Init.useInit)();
52
54
  const [isAgreeDepositPolicy, setIsAgreeDepositPolicy] = (0, import_react.useState)(false);
55
+ const summaryModule = pisellos.getModule("summary");
53
56
  const summaryData = (0, import_react.useMemo)(() => {
54
57
  return (0, import_utils.calculatePriceDetails)(
55
58
  (initData == null ? void 0 : initData.shop) || {},
56
- cartData.cartItems
59
+ cartData.cartItems,
60
+ summaryModule
57
61
  );
58
- }, [cartData.cartItems, initData == null ? void 0 : initData.shop]);
62
+ }, [cartData.cartItems, initData == null ? void 0 : initData.shop, summaryModule]);
59
63
  const contextValue = {
60
64
  // 商品总价
61
65
  subtotal: summaryData.subtotal,
@@ -64,6 +68,8 @@ var SummaryProvider = ({
64
68
  taxTitle: summaryData.taxTitle,
65
69
  totalTaxFee: summaryData.totalTaxFee,
66
70
  isPriceIncludeTax: summaryData.isPriceIncludeTax,
71
+ taxRate: summaryData.taxRate,
72
+ surcharge: summaryData.surcharge,
67
73
  deposit: summaryData.deposit,
68
74
  isAgreeDepositPolicy,
69
75
  setIsAgreeDepositPolicy,
@@ -1,4 +1,3 @@
1
- import Decimal from 'decimal.js';
2
1
  interface CartItem {
3
2
  price: number | string;
4
3
  quantity?: number;
@@ -10,6 +9,8 @@ interface PriceDetail {
10
9
  taxTitle?: string;
11
10
  totalTaxFee?: string;
12
11
  isPriceIncludeTax?: 0 | 1;
12
+ taxRate?: number;
13
+ surcharge?: any;
13
14
  deposit?: {
14
15
  total: string;
15
16
  protocols: any[];
@@ -22,6 +23,12 @@ interface PriceDetail {
22
23
  * @returns 商品总价字符串,保留2位小数
23
24
  */
24
25
  export declare const calculateSubtotal: (items: CartItem[]) => string;
26
+ /**
27
+ * @description: 将购物车数据格式化成summaryModule需要的格式
28
+ * @param {any} items 购物车数据
29
+ * @return {*}
30
+ */
31
+ export declare const formatCartsToSummaryModule: (items: any[]) => any[];
25
32
  /**
26
33
  * @title: 单个商品的税费
27
34
  * @description:
@@ -30,14 +37,14 @@ export declare const calculateSubtotal: (items: CartItem[]) => string;
30
37
  * @return {*}
31
38
  * @Author: xiangfeng.xue
32
39
  */
33
- export declare const calculateTaxFee: (shopInfo: any, items: CartItem[]) => Decimal | "0.00";
40
+ export declare const calculateTaxFee: (shopInfo: any, items: CartItem[], summaryModule: any) => any;
34
41
  /**
35
42
  * 计算所有价格明细
36
43
  * @param items - 购物车商品数组
37
44
  * @param options - 其他费用配置
38
45
  * @returns 价格明细对象
39
46
  */
40
- export declare const calculatePriceDetails: (shopInfo: any, items: CartItem[]) => PriceDetail;
47
+ export declare const calculatePriceDetails: (shopInfo: any, items: CartItem[], summaryModule: any) => PriceDetail;
41
48
  /**
42
49
  * @title: 计算定金
43
50
  * @param items - 购物车商品数组
@@ -32,7 +32,8 @@ __export(utils_exports, {
32
32
  calculateDeposit: () => calculateDeposit,
33
33
  calculatePriceDetails: () => calculatePriceDetails,
34
34
  calculateSubtotal: () => calculateSubtotal,
35
- calculateTaxFee: () => calculateTaxFee
35
+ calculateTaxFee: () => calculateTaxFee,
36
+ formatCartsToSummaryModule: () => formatCartsToSummaryModule
36
37
  });
37
38
  module.exports = __toCommonJS(utils_exports);
38
39
  var import_decimal = __toESM(require("decimal.js"));
@@ -45,25 +46,46 @@ var calculateSubtotal = (items) => {
45
46
  }, new import_decimal.default(0));
46
47
  return subtotal.toFixed(2);
47
48
  };
48
- var calculateTaxFee = (shopInfo, items) => {
49
+ var formatCartsToSummaryModule = (items) => {
50
+ if (!Array.isArray(items) || !(items == null ? void 0 : items.length)) return [];
51
+ return items.map((item) => {
52
+ const { selectedBundle, selectedOptions, ...rest } = item;
53
+ return {
54
+ ...rest,
55
+ bundle: selectedBundle || [],
56
+ option: selectedOptions || []
57
+ };
58
+ });
59
+ };
60
+ var calculateTaxFee = (shopInfo, items, summaryModule) => {
49
61
  if (!(items == null ? void 0 : items.length)) {
50
62
  return "0.00";
51
63
  }
52
64
  const { is_price_include_tax, tax_rate } = shopInfo || {};
53
65
  console.log("shopInfo>>>", is_price_include_tax, tax_rate);
54
- const totalTaxFee = items.reduce((sum, item) => {
55
- const price = new import_decimal.default(item.total || 0);
56
- const taxRate = new import_decimal.default(tax_rate || 0).div(100);
57
- const productTaxRate = price.times(taxRate).times((item == null ? void 0 : item.is_charge_tax) || 0).div(taxRate.times(is_price_include_tax || 0).plus(1));
58
- return sum.plus(productTaxRate);
59
- }, new import_decimal.default(0));
66
+ const subtotal = new import_decimal.default(calculateSubtotal(items));
67
+ const totalTax = summaryModule.getTaxforUtils(
68
+ items,
69
+ {
70
+ tax_rate: Number(tax_rate),
71
+ is_price_include_tax: Number(is_price_include_tax || 0)
72
+ },
73
+ subtotal
74
+ );
75
+ const totalTaxFee = totalTax == null ? void 0 : totalTax.tax;
60
76
  return totalTaxFee;
61
77
  };
62
- var calculatePriceDetails = (shopInfo, items) => {
78
+ var calculatePriceDetails = (shopInfo, items, summaryModule) => {
63
79
  const subtotal = new import_decimal.default(calculateSubtotal(items));
64
- const totalTaxFee = new import_decimal.default(calculateTaxFee(shopInfo, items));
65
- console.log("totalTaxFee", totalTaxFee.toFixed(2));
66
- const total = (shopInfo == null ? void 0 : shopInfo.is_price_include_tax) ? subtotal : subtotal.plus(totalTaxFee);
80
+ const _carts = formatCartsToSummaryModule(items);
81
+ const surcharge = summaryModule.getSurchargeforUtils(_carts);
82
+ const surchargeFee = new import_decimal.default((surcharge == null ? void 0 : surcharge.surchargeAmount) || 0);
83
+ const totalTaxFee = new import_decimal.default(
84
+ calculateTaxFee(shopInfo, _carts, summaryModule)
85
+ );
86
+ const taxRate = new import_decimal.default((shopInfo == null ? void 0 : shopInfo.tax_rate) || 0).div(100);
87
+ let total = (shopInfo == null ? void 0 : shopInfo.is_price_include_tax) ? subtotal : subtotal.plus(totalTaxFee);
88
+ total = total.plus(surchargeFee);
67
89
  const deposit = calculateDeposit(items);
68
90
  return {
69
91
  subtotal: subtotal.toFixed(2),
@@ -71,6 +93,8 @@ var calculatePriceDetails = (shopInfo, items) => {
71
93
  taxTitle: shopInfo == null ? void 0 : shopInfo.tax_title,
72
94
  totalTaxFee: totalTaxFee.toFixed(2),
73
95
  isPriceIncludeTax: shopInfo == null ? void 0 : shopInfo.is_price_include_tax,
96
+ taxRate: taxRate.toNumber(),
97
+ surcharge,
74
98
  deposit
75
99
  };
76
100
  };
@@ -104,5 +128,6 @@ var calculateDeposit = (items) => {
104
128
  calculateDeposit,
105
129
  calculatePriceDetails,
106
130
  calculateSubtotal,
107
- calculateTaxFee
131
+ calculateTaxFee,
132
+ formatCartsToSummaryModule
108
133
  });
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  declare const CartItem: ({ onNext, renderContactInfo }: any) => JSX.Element;
3
4
  export default CartItem;
@@ -36,12 +36,12 @@ var import_react = __toESM(require("react"));
36
36
  var import_utils = require("@pisell/utils");
37
37
  var import_shoppingCart = __toESM(require("../../../../shoppingCart"));
38
38
  var import_ContinueButton = __toESM(require("../ContinueButton"));
39
+ var import__ = require("../../../../../index");
39
40
  var import_hooks = require("../../../hooks");
40
41
  var import_context = require("../../../context");
41
42
  var import_hooks2 = require("../../../hooks");
42
43
  var import_utils2 = require("../../../utils");
43
44
  var import_Voucher = __toESM(require("../../Voucher"));
44
- var import_Total = __toESM(require("./Total"));
45
45
  var import_Deposit = __toESM(require("../../Deposit"));
46
46
  var import_utils3 = require("../utils");
47
47
  var import_index = require("./index.less");
@@ -64,8 +64,8 @@ var CartItem = ({ onNext, renderContactInfo }) => {
64
64
  const { isFormSubject, bookingSubject, isRetailTemplate } = (0, import_hooks2.useAppointmentBookingSetting)();
65
65
  const { isLogin } = (0, import_hooks2.useAppointmentBookingLogin)();
66
66
  const utils = (0, import_hooks2.contextUtils)();
67
- const { businessUtils } = utils;
68
- const { deposit } = summary;
67
+ const { businessUtils, translation } = utils;
68
+ const { taxTitle, totalTaxFee, isPriceIncludeTax, total, deposit } = summary;
69
69
  const currentUser = (0, import_react.useMemo)(() => {
70
70
  return (0, import_utils2.formatCurrentUser)(utils) || {};
71
71
  }, []);
@@ -178,6 +178,47 @@ var CartItem = ({ onNext, renderContactInfo }) => {
178
178
  return carts;
179
179
  }
180
180
  }, [carts, currentSelectedResources, currentStepParams == null ? void 0 : currentStepParams.key, isErrorHolder]);
181
+ const subTotalList = (0, import_react.useMemo)(() => {
182
+ const hideDeposit = (carts == null ? void 0 : carts.length) === 0 || !(deposit == null ? void 0 : deposit.hasDeposit);
183
+ const surcharge = ((summary == null ? void 0 : summary.surcharge) || []).map(
184
+ (d, index) => {
185
+ return {
186
+ key: `custom_surcharge_${index}`,
187
+ label: translation(d == null ? void 0 : d.name),
188
+ value: d.amount
189
+ };
190
+ }
191
+ );
192
+ return [
193
+ {
194
+ key: "deposit",
195
+ value: deposit == null ? void 0 : deposit.total,
196
+ label: import_utils.locales.getText("pisell2.appointment.deposit"),
197
+ hidden: hideDeposit
198
+ },
199
+ {
200
+ key: "sub_total",
201
+ value: summary == null ? void 0 : summary.subtotal
202
+ },
203
+ ...surcharge,
204
+ {
205
+ key: "tax",
206
+ value: totalTaxFee,
207
+ hidden: Number(totalTaxFee) <= 0,
208
+ tax: {
209
+ rate: Number((summary == null ? void 0 : summary.taxRate) / 100),
210
+ is_price_include_tax: isPriceIncludeTax,
211
+ title: taxTitle
212
+ }
213
+ },
214
+ {
215
+ key: "custom_total",
216
+ value: total,
217
+ label: import_utils.locales.getText("pisell2.event.total"),
218
+ bold: !!hideDeposit
219
+ }
220
+ ];
221
+ }, [total, summary, carts == null ? void 0 : carts.length]);
181
222
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
182
223
  "div",
183
224
  {
@@ -209,7 +250,14 @@ var CartItem = ({ onNext, renderContactInfo }) => {
209
250
  onChange: (e, type, key) => handleClickCard(e, type, key)
210
251
  }
211
252
  )),
212
- /* @__PURE__ */ import_react.default.createElement("div", { className: "appointment-footer" }, hasGoodPassApp || hasDiscountCardApp ? /* @__PURE__ */ import_react.default.createElement(import_Voucher.default, { currentUser, products: carts }) : null, /* @__PURE__ */ import_react.default.createElement(import_Total.default, null), (carts == null ? void 0 : carts.length) > 0 && (deposit == null ? void 0 : deposit.hasDeposit) ? /* @__PURE__ */ import_react.default.createElement(import_Deposit.default, null) : null, /* @__PURE__ */ import_react.default.createElement(import_ContinueButton.default, { onNext }))
253
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "appointment-footer" }, hasGoodPassApp || hasDiscountCardApp ? /* @__PURE__ */ import_react.default.createElement(import_Voucher.default, { currentUser, products: carts }) : null, /* @__PURE__ */ import_react.default.createElement(
254
+ import__.SubTotal,
255
+ {
256
+ list: subTotalList,
257
+ style: { padding: 0 },
258
+ children: !!((carts == null ? void 0 : carts.length) > 0 && (deposit == null ? void 0 : deposit.hasDeposit)) ? /* @__PURE__ */ import_react.default.createElement(import_Deposit.default, { showTitle: false }) : null
259
+ }
260
+ ), /* @__PURE__ */ import_react.default.createElement(import_ContinueButton.default, { onNext }))
213
261
  ));
214
262
  };
215
263
  var Item_default = CartItem;
@@ -1,10 +1,14 @@
1
1
  /// <reference types="react" />
2
2
  import './index.less';
3
+ interface DepositProps {
4
+ showTitle?: boolean;
5
+ }
3
6
  export declare const DepositContent: (props: {
4
7
  isAgreeDepositPolicy: boolean;
5
8
  setIsAgreeDepositPolicy: (value: boolean) => void;
6
9
  deposit: any;
7
10
  depositProtocolRequest?: any;
11
+ showTitle?: boolean | undefined;
8
12
  }) => JSX.Element;
9
- declare const Deposit: () => JSX.Element;
13
+ declare const Deposit: (props: DepositProps) => JSX.Element;
10
14
  export default Deposit;
@@ -44,16 +44,17 @@ var DepositContent = (props) => {
44
44
  isAgreeDepositPolicy,
45
45
  setIsAgreeDepositPolicy,
46
46
  deposit,
47
- depositProtocolRequest
47
+ depositProtocolRequest,
48
+ showTitle = true
48
49
  } = props;
49
- return /* @__PURE__ */ import_react.default.createElement("div", { className: "appointment-deposit-wrap" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "appointment-deposit-top" }, /* @__PURE__ */ import_react.default.createElement("span", null, import_utils.locales.getText("pisell2.appointment.deposit")), /* @__PURE__ */ import_react.default.createElement(
50
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "appointment-deposit-wrap" }, showTitle ? /* @__PURE__ */ import_react.default.createElement("div", { className: "appointment-deposit-top" }, /* @__PURE__ */ import_react.default.createElement("span", null, import_utils.locales.getText("pisell2.appointment.deposit")), /* @__PURE__ */ import_react.default.createElement(
50
51
  import_materials.PisellText.Amount,
51
52
  {
52
53
  value: deposit == null ? void 0 : deposit.total,
53
54
  showCurrencySymbol: true,
54
55
  className: "amount"
55
56
  }
56
- )), /* @__PURE__ */ import_react.default.createElement(
57
+ )) : null, /* @__PURE__ */ import_react.default.createElement(
57
58
  import_deposit.default,
58
59
  {
59
60
  total: deposit == null ? void 0 : deposit.total,
@@ -64,7 +65,8 @@ var DepositContent = (props) => {
64
65
  }
65
66
  ));
66
67
  };
67
- var Deposit = () => {
68
+ var Deposit = (props) => {
69
+ const { showTitle = true } = props;
68
70
  const {
69
71
  setIsAgreeDepositPolicy,
70
72
  isAgreeDepositPolicy,
@@ -79,6 +81,7 @@ var Deposit = () => {
79
81
  return /* @__PURE__ */ import_react.default.createElement(
80
82
  DepositContent,
81
83
  {
84
+ showTitle,
82
85
  isAgreeDepositPolicy: !!isAgreeDepositPolicy,
83
86
  setIsAgreeDepositPolicy,
84
87
  deposit,
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import "./index.less";
2
3
  export declare const updateServiceDate: (services: any[], date: any, isTime: boolean) => any[];
3
4
  declare const DateCom: () => JSX.Element;
@@ -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>;