@pisell/private-materials 6.4.42 → 6.4.43

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 (188) 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 +146 -146
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +8 -8
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +8 -8
  11. package/es/components/booking/components/actionButtons/index.js +37 -42
  12. package/es/components/booking/components/actionButtons/index.less +0 -28
  13. package/es/components/booking/components/footer/amount.d.ts +3 -3
  14. package/es/components/booking/components/footer/amount.js +13 -2
  15. package/es/components/booking/components/footer/index.js +168 -68
  16. package/es/components/booking/components/footer/utils.js +62 -33
  17. package/es/components/booking/info/model.js +5 -0
  18. package/es/components/booking/info/service/addService/index.js +2 -1
  19. package/es/components/booking/info2/index.js +42 -2
  20. package/es/components/booking/info2/service/addService/index.js +2 -1
  21. package/es/components/booking/info2/service/editService/index.js +12 -4
  22. package/es/components/checkout/PaymentModal.d.ts +2 -0
  23. package/es/components/checkout/PaymentModal.js +395 -240
  24. package/es/components/checkout/components/AdditionalModule/index.less +1 -1
  25. package/es/components/checkout/components/AmountSummary/index.js +161 -54
  26. package/es/components/checkout/components/CashPaymentModule/index.d.ts +5 -3
  27. package/es/components/checkout/components/CashPaymentModule/index.js +114 -137
  28. package/es/components/checkout/components/CashPaymentModule/index.less +200 -176
  29. package/es/components/checkout/components/PaymentDetailModal/index.js +2 -2
  30. package/es/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.d.ts +29 -0
  31. package/es/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.js +210 -0
  32. package/es/components/checkout/components/PaymentOptionsModule/index.d.ts +2 -4
  33. package/es/components/checkout/components/PaymentOptionsModule/index.js +12 -114
  34. package/es/components/checkout/components/PaymentOptionsModule/index.less +29 -0
  35. package/es/components/checkout/components/SavePayLaterHandler/index.js +1 -1
  36. package/es/components/checkout/components/SearchAndClientModule/index.js +40 -39
  37. package/es/components/checkout/components/WalletPassModule/index.js +3 -2
  38. package/es/components/checkout/components/WalletPassModule/utils.js +6 -1
  39. package/es/components/checkout/hooks/useWalletPass.d.ts +1 -1
  40. package/es/components/checkout/hooks/useWalletPass.js +2 -0
  41. package/es/components/checkout/index.less +1 -1
  42. package/es/components/checkout/locales.d.ts +33 -0
  43. package/es/components/checkout/locales.js +39 -3
  44. package/es/components/checkout/types.d.ts +1 -0
  45. package/es/components/eftposPay/hooks.d.ts +1 -1
  46. package/es/components/eftposPay/store/index.d.ts +2 -2
  47. package/es/components/shoppingCart/components/Cart/Product.js +143 -71
  48. package/es/components/shoppingCart/components/Cart/index.js +1 -1
  49. package/es/components/shoppingCart/components/Cart/index.less +31 -0
  50. package/es/components/shoppingCart/locales.d.ts +3 -0
  51. package/es/components/shoppingCart/locales.js +12 -3
  52. package/es/components/ticketBooking/utils/index.js +2 -1
  53. package/es/pro/pisellPriceKeyboardPopover/PisellPriceKeyboardPopover.js +1 -1
  54. package/es/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.d.ts +5 -0
  55. package/es/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.js +148 -0
  56. package/es/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.less +23 -0
  57. package/es/pro/pisellSimplePriceKeyboardPopover/index.d.ts +2 -0
  58. package/es/pro/pisellSimplePriceKeyboardPopover/index.js +1 -0
  59. package/es/pro/pisellSimplePriceKeyboardPopover/types.d.ts +33 -0
  60. package/es/pro/pisellSimplePriceKeyboardPopover/types.js +1 -0
  61. package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.d.ts +4 -0
  62. package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.js +310 -0
  63. package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.d.ts +13 -0
  64. package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.js +349 -0
  65. package/es/pro/priceKeyboard/components/cashKeyboard/index.d.ts +11 -0
  66. package/es/pro/priceKeyboard/components/cashKeyboard/index.js +49 -0
  67. package/es/pro/priceKeyboard/components/cashKeyboard/index.less +103 -0
  68. package/es/pro/priceKeyboard/components/cashKeyboard/locales.d.ts +39 -0
  69. package/es/pro/priceKeyboard/components/cashKeyboard/locales.js +41 -0
  70. package/es/pro/priceKeyboard/components/cashKeyboard/types.d.ts +97 -0
  71. package/es/pro/priceKeyboard/components/cashKeyboard/types.js +1 -0
  72. package/es/pro/priceKeyboard/components/discountKeyboard/index.d.ts +22 -0
  73. package/es/pro/priceKeyboard/components/discountKeyboard/index.js +442 -0
  74. package/es/pro/priceKeyboard/components/discountKeyboard/index.less +47 -0
  75. package/es/pro/priceKeyboard/components/discountKeyboard/locales.d.ts +42 -0
  76. package/es/pro/priceKeyboard/components/discountKeyboard/locales.js +44 -0
  77. package/es/pro/priceKeyboard/components/discountKeyboard/types.d.ts +17 -0
  78. package/es/pro/priceKeyboard/components/discountKeyboard/types.js +1 -0
  79. package/es/pro/priceKeyboard/components/paymentKeyboard/index.d.ts +11 -0
  80. package/es/pro/priceKeyboard/components/paymentKeyboard/index.js +444 -0
  81. package/es/pro/priceKeyboard/components/paymentKeyboard/index.less +64 -0
  82. package/es/pro/priceKeyboard/components/paymentKeyboard/locales.d.ts +45 -0
  83. package/es/pro/priceKeyboard/components/paymentKeyboard/locales.js +47 -0
  84. package/es/pro/priceKeyboard/components/paymentKeyboard/types.d.ts +39 -0
  85. package/es/pro/priceKeyboard/components/paymentKeyboard/types.js +1 -0
  86. package/es/pro/priceKeyboard/components/shortcuts/index.d.ts +17 -0
  87. package/es/pro/priceKeyboard/components/shortcuts/index.js +47 -0
  88. package/es/pro/priceKeyboard/components/shortcuts/index.less +39 -0
  89. package/es/pro/priceKeyboard/hooks/keyActions.d.ts +28 -0
  90. package/es/pro/priceKeyboard/hooks/keyActions.js +252 -0
  91. package/es/pro/priceKeyboard/hooks/rightItems.d.ts +27 -0
  92. package/es/pro/priceKeyboard/hooks/rightItems.js +50 -0
  93. package/es/pro/priceKeyboard/index.d.ts +3 -0
  94. package/es/pro/priceKeyboard/index.js +3 -0
  95. package/es/pro/priceKeyboard/index.less +215 -0
  96. package/es/pro/priceKeyboard/utils.d.ts +31 -0
  97. package/es/pro/priceKeyboard/utils.js +51 -0
  98. package/es/pro/skuDetailModal/index.js +19 -16
  99. package/lib/components/booking/components/actionButtons/index.js +31 -28
  100. package/lib/components/booking/components/actionButtons/index.less +0 -28
  101. package/lib/components/booking/components/footer/amount.d.ts +3 -3
  102. package/lib/components/booking/components/footer/amount.js +10 -4
  103. package/lib/components/booking/components/footer/index.js +107 -40
  104. package/lib/components/booking/components/footer/utils.js +35 -7
  105. package/lib/components/booking/info/model.js +3 -0
  106. package/lib/components/booking/info/service/addService/index.js +2 -1
  107. package/lib/components/booking/info2/index.js +18 -1
  108. package/lib/components/booking/info2/service/addService/index.js +2 -1
  109. package/lib/components/booking/info2/service/editService/index.js +12 -4
  110. package/lib/components/checkout/PaymentModal.d.ts +2 -0
  111. package/lib/components/checkout/PaymentModal.js +152 -73
  112. package/lib/components/checkout/components/AdditionalModule/index.less +1 -1
  113. package/lib/components/checkout/components/AmountSummary/index.js +114 -40
  114. package/lib/components/checkout/components/CashPaymentModule/index.d.ts +5 -3
  115. package/lib/components/checkout/components/CashPaymentModule/index.js +103 -140
  116. package/lib/components/checkout/components/CashPaymentModule/index.less +200 -176
  117. package/lib/components/checkout/components/PaymentDetailModal/index.js +2 -2
  118. package/lib/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.d.ts +29 -0
  119. package/lib/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.js +172 -0
  120. package/lib/components/checkout/components/PaymentOptionsModule/index.d.ts +2 -4
  121. package/lib/components/checkout/components/PaymentOptionsModule/index.js +11 -123
  122. package/lib/components/checkout/components/PaymentOptionsModule/index.less +29 -0
  123. package/lib/components/checkout/components/SavePayLaterHandler/index.js +1 -1
  124. package/lib/components/checkout/components/SearchAndClientModule/index.js +3 -29
  125. package/lib/components/checkout/components/WalletPassModule/index.js +3 -2
  126. package/lib/components/checkout/components/WalletPassModule/utils.js +4 -1
  127. package/lib/components/checkout/hooks/useWalletPass.d.ts +1 -1
  128. package/lib/components/checkout/hooks/useWalletPass.js +2 -0
  129. package/lib/components/checkout/index.less +1 -1
  130. package/lib/components/checkout/locales.d.ts +33 -0
  131. package/lib/components/checkout/locales.js +39 -3
  132. package/lib/components/checkout/types.d.ts +1 -0
  133. package/lib/components/eftposPay/hooks.d.ts +1 -1
  134. package/lib/components/eftposPay/store/index.d.ts +2 -2
  135. package/lib/components/shoppingCart/components/Cart/Product.js +111 -51
  136. package/lib/components/shoppingCart/components/Cart/index.js +1 -1
  137. package/lib/components/shoppingCart/components/Cart/index.less +31 -0
  138. package/lib/components/shoppingCart/locales.d.ts +3 -0
  139. package/lib/components/shoppingCart/locales.js +6 -3
  140. package/lib/components/ticketBooking/index.js +5 -1
  141. package/lib/components/ticketBooking/utils/index.js +2 -1
  142. package/lib/pro/pisellPriceKeyboardPopover/PisellPriceKeyboardPopover.js +2 -2
  143. package/lib/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.d.ts +5 -0
  144. package/lib/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.js +144 -0
  145. package/lib/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.less +23 -0
  146. package/lib/pro/pisellSimplePriceKeyboardPopover/index.d.ts +2 -0
  147. package/lib/pro/pisellSimplePriceKeyboardPopover/index.js +35 -0
  148. package/lib/pro/pisellSimplePriceKeyboardPopover/types.d.ts +33 -0
  149. package/lib/pro/pisellSimplePriceKeyboardPopover/types.js +17 -0
  150. package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.d.ts +4 -0
  151. package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.js +332 -0
  152. package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.d.ts +13 -0
  153. package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.js +399 -0
  154. package/lib/pro/priceKeyboard/components/cashKeyboard/index.d.ts +11 -0
  155. package/lib/pro/priceKeyboard/components/cashKeyboard/index.js +76 -0
  156. package/lib/pro/priceKeyboard/components/cashKeyboard/index.less +103 -0
  157. package/lib/pro/priceKeyboard/components/cashKeyboard/locales.d.ts +39 -0
  158. package/lib/pro/priceKeyboard/components/cashKeyboard/locales.js +65 -0
  159. package/lib/pro/priceKeyboard/components/cashKeyboard/types.d.ts +97 -0
  160. package/lib/pro/priceKeyboard/components/cashKeyboard/types.js +17 -0
  161. package/lib/pro/priceKeyboard/components/discountKeyboard/index.d.ts +22 -0
  162. package/lib/pro/priceKeyboard/components/discountKeyboard/index.js +485 -0
  163. package/lib/pro/priceKeyboard/components/discountKeyboard/index.less +47 -0
  164. package/lib/pro/priceKeyboard/components/discountKeyboard/locales.d.ts +42 -0
  165. package/lib/pro/priceKeyboard/components/discountKeyboard/locales.js +68 -0
  166. package/lib/pro/priceKeyboard/components/discountKeyboard/types.d.ts +17 -0
  167. package/lib/pro/priceKeyboard/components/discountKeyboard/types.js +17 -0
  168. package/lib/pro/priceKeyboard/components/paymentKeyboard/index.d.ts +11 -0
  169. package/lib/pro/priceKeyboard/components/paymentKeyboard/index.js +488 -0
  170. package/lib/pro/priceKeyboard/components/paymentKeyboard/index.less +64 -0
  171. package/lib/pro/priceKeyboard/components/paymentKeyboard/locales.d.ts +45 -0
  172. package/lib/pro/priceKeyboard/components/paymentKeyboard/locales.js +71 -0
  173. package/lib/pro/priceKeyboard/components/paymentKeyboard/types.d.ts +39 -0
  174. package/lib/pro/priceKeyboard/components/paymentKeyboard/types.js +17 -0
  175. package/lib/pro/priceKeyboard/components/shortcuts/index.d.ts +17 -0
  176. package/lib/pro/priceKeyboard/components/shortcuts/index.js +79 -0
  177. package/lib/pro/priceKeyboard/components/shortcuts/index.less +39 -0
  178. package/lib/pro/priceKeyboard/hooks/keyActions.d.ts +28 -0
  179. package/lib/pro/priceKeyboard/hooks/keyActions.js +176 -0
  180. package/lib/pro/priceKeyboard/hooks/rightItems.d.ts +27 -0
  181. package/lib/pro/priceKeyboard/hooks/rightItems.js +81 -0
  182. package/lib/pro/priceKeyboard/index.d.ts +3 -0
  183. package/lib/pro/priceKeyboard/index.js +45 -0
  184. package/lib/pro/priceKeyboard/index.less +215 -0
  185. package/lib/pro/priceKeyboard/utils.d.ts +31 -0
  186. package/lib/pro/priceKeyboard/utils.js +75 -0
  187. package/lib/pro/skuDetailModal/index.js +18 -22
  188. package/package.json +4 -4
@@ -0,0 +1,42 @@
1
+ declare const _default: {
2
+ en: {
3
+ 'discount-keyboard-price-override': string;
4
+ 'discount-keyboard-discount': string;
5
+ 'discount-keyboard-amount': string;
6
+ 'discount-keyboard-percentage': string;
7
+ 'discount-keyboard-max-discount': string;
8
+ 'discount-keyboard-discount-amount': string;
9
+ 'discount-keyboard-total': string;
10
+ 'discount-keyboard-payable': string;
11
+ 'discount-keyboard-reset': string;
12
+ 'discount-keyboard-done': string;
13
+ 'discount-keyboard-pay': string;
14
+ };
15
+ 'zh-CN': {
16
+ 'discount-keyboard-price-override': string;
17
+ 'discount-keyboard-discount': string;
18
+ 'discount-keyboard-amount': string;
19
+ 'discount-keyboard-percentage': string;
20
+ 'discount-keyboard-max-discount': string;
21
+ 'discount-keyboard-discount-amount': string;
22
+ 'discount-keyboard-total': string;
23
+ 'discount-keyboard-payable': string;
24
+ 'discount-keyboard-reset': string;
25
+ 'discount-keyboard-done': string;
26
+ 'discount-keyboard-pay': string;
27
+ };
28
+ 'zh-HK': {
29
+ 'discount-keyboard-price-override': string;
30
+ 'discount-keyboard-discount': string;
31
+ 'discount-keyboard-amount': string;
32
+ 'discount-keyboard-percentage': string;
33
+ 'discount-keyboard-max-discount': string;
34
+ 'discount-keyboard-discount-amount': string;
35
+ 'discount-keyboard-total': string;
36
+ 'discount-keyboard-payable': string;
37
+ 'discount-keyboard-reset': string;
38
+ 'discount-keyboard-done': string;
39
+ 'discount-keyboard-pay': string;
40
+ };
41
+ };
42
+ export default _default;
@@ -0,0 +1,68 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/pro/priceKeyboard/components/discountKeyboard/locales.ts
20
+ var locales_exports = {};
21
+ __export(locales_exports, {
22
+ default: () => locales_default
23
+ });
24
+ module.exports = __toCommonJS(locales_exports);
25
+ var locales_default = {
26
+ en: {
27
+ // Discount Keyboard Module
28
+ "discount-keyboard-price-override": "Price Override",
29
+ "discount-keyboard-discount": "Discount",
30
+ "discount-keyboard-amount": "Amount",
31
+ "discount-keyboard-percentage": "Percentage",
32
+ "discount-keyboard-max-discount": "Max Discount",
33
+ "discount-keyboard-discount-amount": "Discount Amount",
34
+ "discount-keyboard-total": "Total",
35
+ "discount-keyboard-payable": "Payable",
36
+ "discount-keyboard-reset": "Reset",
37
+ "discount-keyboard-done": "Done",
38
+ "discount-keyboard-pay": "Pay"
39
+ },
40
+ "zh-CN": {
41
+ // 折扣键盘模块
42
+ "discount-keyboard-price-override": "一口价",
43
+ "discount-keyboard-discount": "折扣",
44
+ "discount-keyboard-amount": "金额",
45
+ "discount-keyboard-percentage": "百分比",
46
+ "discount-keyboard-max-discount": "最高折扣",
47
+ "discount-keyboard-discount-amount": "折扣金额",
48
+ "discount-keyboard-total": "待支付金额",
49
+ "discount-keyboard-payable": "需支付金额",
50
+ "discount-keyboard-reset": "重置",
51
+ "discount-keyboard-done": "确认",
52
+ "discount-keyboard-pay": "支付"
53
+ },
54
+ "zh-HK": {
55
+ // 折扣鍵盤模組
56
+ "discount-keyboard-price-override": "一口價",
57
+ "discount-keyboard-discount": "折扣",
58
+ "discount-keyboard-amount": "金額",
59
+ "discount-keyboard-percentage": "百分比",
60
+ "discount-keyboard-max-discount": "最高折扣",
61
+ "discount-keyboard-discount-amount": "折扣金額",
62
+ "discount-keyboard-total": "待支付金額",
63
+ "discount-keyboard-payable": "需支付金額",
64
+ "discount-keyboard-reset": "重置",
65
+ "discount-keyboard-done": "確認",
66
+ "discount-keyboard-pay": "支付"
67
+ }
68
+ };
@@ -0,0 +1,17 @@
1
+ export interface DiscountKeyboardBaseProps {
2
+ /** 金额符 */
3
+ amountSymbol?: string;
4
+ /** 初始值,多用于展示及计算,不同于原始值 */
5
+ defaultValue?: string | number;
6
+ /** 原始值,多用于重置 */
7
+ originalValue?: string | number;
8
+ placeholder?: string;
9
+ doneText?: string;
10
+ resetText?: string;
11
+ /** 键盘主题 */
12
+ selectType?: 'light' | 'dark';
13
+ onEnter?: (val: string) => void;
14
+ onReset?: () => void;
15
+ onChange?: (val: string) => void;
16
+ enableExceedMaxAmount?: boolean;
17
+ }
@@ -0,0 +1,17 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+
15
+ // src/pro/priceKeyboard/components/discountKeyboard/types.ts
16
+ var types_exports = {};
17
+ module.exports = __toCommonJS(types_exports);
@@ -0,0 +1,11 @@
1
+ import { PaymentKeyboardBaseProps } from './types';
2
+ import './index.less';
3
+ interface PaymentKeyboardProps extends PaymentKeyboardBaseProps {
4
+ containerProps?: {
5
+ renderType: 'modal' | 'popover';
6
+ open: boolean;
7
+ [key: string]: any;
8
+ };
9
+ }
10
+ export declare const PaymentKeyboard: (props: PaymentKeyboardProps) => JSX.Element | null;
11
+ export default PaymentKeyboard;
@@ -0,0 +1,488 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
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
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/pro/priceKeyboard/components/paymentKeyboard/index.tsx
30
+ var paymentKeyboard_exports = {};
31
+ __export(paymentKeyboard_exports, {
32
+ PaymentKeyboard: () => PaymentKeyboard,
33
+ default: () => paymentKeyboard_default
34
+ });
35
+ module.exports = __toCommonJS(paymentKeyboard_exports);
36
+ var import_react = __toESM(require("react"));
37
+ var import_decimal = __toESM(require("decimal.js"));
38
+ var import_utils = require("@pisell/utils");
39
+ var import_lodash = require("lodash");
40
+ var import_antd = require("antd");
41
+ var import_materials = require("@pisell/materials");
42
+ var import_rightItems = __toESM(require("../../hooks/rightItems"));
43
+ var import_keyActions = __toESM(require("../../hooks/keyActions"));
44
+ var import_ahooks = require("ahooks");
45
+ var import_locales = __toESM(require("./locales"));
46
+ var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
47
+ var import_utils2 = require("../../utils");
48
+ var import_index = require("./index.less");
49
+ var KEYS = {
50
+ PAYMENT: "payment",
51
+ SURCHARGE: "surcharge",
52
+ PERCENT: "percent",
53
+ FIXED: "fixed"
54
+ };
55
+ var defaultConfig = {
56
+ payment: {
57
+ enable: true
58
+ },
59
+ surcharge: {
60
+ enable: true
61
+ }
62
+ };
63
+ var PaymentKeyboardBase = (props) => {
64
+ var _a, _b, _c, _d, _e, _f, _g, _h;
65
+ const context = (0, import_useEngineContext.default)();
66
+ const { getData } = context.appHelper.utils;
67
+ const amountSymbol = props.amountSymbol || (getData == null ? void 0 : getData("shop_symbol")) || "$";
68
+ import_utils.locales.init(
69
+ import_locales.default,
70
+ ((_e = (_d = (_c = (_b = (_a = context.appHelper.utils) == null ? void 0 : _a.getApp) == null ? void 0 : _b.call(_a)) == null ? void 0 : _c.locales) == null ? void 0 : _d.getLocale) == null ? void 0 : _e.call(_d)) || ((_g = (_f = context.appHelper.utils) == null ? void 0 : _f.storage) == null ? void 0 : _g.get("umi_locale")) || "en"
71
+ );
72
+ const {
73
+ enableExceedMaxAmount = false,
74
+ paymentOriginalValue,
75
+ surchargeDefaultValue,
76
+ doneText,
77
+ resetText,
78
+ onReset,
79
+ onPay,
80
+ selectType = "light"
81
+ } = props;
82
+ const uniqueId = (0, import_react.useId)();
83
+ const uniqueKeyboardId = `virtual-keyboard-${uniqueId.replace(/:/g, "-")}`;
84
+ (0, import_react.useEffect)(() => {
85
+ (0, import_utils2.setKeyboardTheme)(selectType);
86
+ }, [selectType]);
87
+ const [activeKey, setActiveKey] = (0, import_react.useState)(() => {
88
+ var _a2, _b2;
89
+ if ((_a2 = props.payment) == null ? void 0 : _a2.enable) {
90
+ return KEYS.PAYMENT;
91
+ }
92
+ if ((_b2 = props.surcharge) == null ? void 0 : _b2.enable) {
93
+ return KEYS.SURCHARGE;
94
+ }
95
+ return KEYS.PAYMENT;
96
+ });
97
+ const [focusedInput, setFocusedInput] = (0, import_react.useState)(KEYS.PERCENT);
98
+ const [internalPaymentValue, setInternalPaymentValue] = (0, import_ahooks.useControllableValue)(props, {
99
+ defaultValuePropName: "paymentDefaultValue",
100
+ valuePropName: "paymentValue"
101
+ });
102
+ const [internalSurchargeValue, setInternalSurchargeValue] = (0, import_ahooks.useControllableValue)(props, {
103
+ defaultValue: surchargeDefaultValue || {
104
+ percent: "",
105
+ fixed: ""
106
+ },
107
+ valuePropName: "surchargeValue"
108
+ });
109
+ const [firstInputStatus, setFirstInputStatus] = (0, import_react.useState)({
110
+ [KEYS.PAYMENT]: true,
111
+ [KEYS.PERCENT]: true,
112
+ [KEYS.FIXED]: true
113
+ });
114
+ const _onReset = (0, import_react.useCallback)(() => {
115
+ if (activeKey === KEYS.PAYMENT) {
116
+ setInternalPaymentValue(paymentOriginalValue || "");
117
+ setFirstInputStatus((prev) => ({
118
+ ...prev,
119
+ [KEYS.PAYMENT]: true
120
+ }));
121
+ } else if (activeKey === KEYS.SURCHARGE) {
122
+ if (focusedInput === KEYS.PERCENT) {
123
+ setInternalSurchargeValue({
124
+ ...internalSurchargeValue || {},
125
+ percent: (surchargeDefaultValue == null ? void 0 : surchargeDefaultValue.percent) || ""
126
+ });
127
+ setFirstInputStatus((prev) => ({
128
+ ...prev,
129
+ [KEYS.PERCENT]: true
130
+ }));
131
+ } else {
132
+ setInternalSurchargeValue({
133
+ ...internalSurchargeValue || {},
134
+ fixed: (surchargeDefaultValue == null ? void 0 : surchargeDefaultValue.fixed) || ""
135
+ });
136
+ setFirstInputStatus((prev) => ({
137
+ ...prev,
138
+ [KEYS.FIXED]: true
139
+ }));
140
+ }
141
+ }
142
+ onReset == null ? void 0 : onReset();
143
+ }, [
144
+ activeKey,
145
+ onReset,
146
+ focusedInput,
147
+ paymentOriginalValue,
148
+ surchargeDefaultValue
149
+ ]);
150
+ const currentValue = (0, import_react.useMemo)(() => {
151
+ if (activeKey === KEYS.PAYMENT) {
152
+ return internalPaymentValue;
153
+ }
154
+ if (activeKey === KEYS.SURCHARGE) {
155
+ if (focusedInput === KEYS.FIXED) {
156
+ return (internalSurchargeValue || {}).fixed || "";
157
+ }
158
+ return (internalSurchargeValue || {}).percent || "";
159
+ }
160
+ return "";
161
+ }, [activeKey, focusedInput, internalPaymentValue, internalSurchargeValue]);
162
+ const _max = (0, import_react.useMemo)(() => {
163
+ if (activeKey === KEYS.SURCHARGE && focusedInput === KEYS.PERCENT) {
164
+ return 100;
165
+ }
166
+ return void 0;
167
+ }, [activeKey, focusedInput]);
168
+ const _mode = (0, import_react.useMemo)(() => {
169
+ if (activeKey === KEYS.PAYMENT) {
170
+ return firstInputStatus.payment ? "replace" : "append";
171
+ } else {
172
+ return firstInputStatus[focusedInput] ? "replace" : "append";
173
+ }
174
+ }, [firstInputStatus, activeKey, focusedInput]);
175
+ const { handleChange } = (0, import_keyActions.default)({
176
+ onEnter: () => {
177
+ if (!enableExceedMaxAmount && new import_decimal.default(internalPaymentValue).greaterThan(maxAmount)) {
178
+ return;
179
+ }
180
+ onPay == null ? void 0 : onPay({
181
+ surcharge: internalSurchargeValue,
182
+ amount: internalPaymentValue
183
+ });
184
+ },
185
+ onReset: _onReset,
186
+ onChange: (v) => {
187
+ if (activeKey === KEYS.PAYMENT) {
188
+ setInternalPaymentValue(v);
189
+ setFirstInputStatus((prev) => ({
190
+ ...prev,
191
+ [KEYS.PAYMENT]: false
192
+ }));
193
+ } else if (activeKey === KEYS.SURCHARGE) {
194
+ if (focusedInput === KEYS.FIXED) {
195
+ setInternalSurchargeValue({
196
+ ...internalSurchargeValue || {},
197
+ fixed: v
198
+ });
199
+ setFirstInputStatus((prev) => ({
200
+ ...prev,
201
+ [KEYS.FIXED]: false
202
+ }));
203
+ } else {
204
+ setInternalSurchargeValue({
205
+ ...internalSurchargeValue || {},
206
+ percent: v
207
+ });
208
+ setFirstInputStatus((prev) => ({
209
+ ...prev,
210
+ [KEYS.PERCENT]: false
211
+ }));
212
+ }
213
+ }
214
+ },
215
+ max: _max,
216
+ value: currentValue,
217
+ scale: 2,
218
+ mode: _mode
219
+ });
220
+ const rightItems = (0, import_rightItems.default)({
221
+ rightItemsStyle: {},
222
+ doneText: doneText || import_utils.locales.getText("payment-keyboard-pay"),
223
+ resetText: resetText || import_utils.locales.getText("payment-keyboard-reset")
224
+ });
225
+ const mergedConfig = (0, import_react.useMemo)(() => {
226
+ return (0, import_lodash.merge)({}, defaultConfig, (0, import_lodash.pick)(props, ["payment", "surcharge"]));
227
+ }, [props]);
228
+ const options = (0, import_react.useMemo)(() => {
229
+ var _a2, _b2;
230
+ const opts = [];
231
+ if ((_a2 = mergedConfig.payment) == null ? void 0 : _a2.enable) {
232
+ opts.push({
233
+ label: import_utils.locales.getText("payment-keyboard-payment"),
234
+ value: KEYS.PAYMENT
235
+ });
236
+ }
237
+ if ((_b2 = mergedConfig.surcharge) == null ? void 0 : _b2.enable) {
238
+ opts.push({
239
+ label: import_utils.locales.getText("payment-keyboard-surcharge"),
240
+ value: KEYS.SURCHARGE
241
+ });
242
+ }
243
+ return opts;
244
+ }, [mergedConfig]);
245
+ const amountFormatter = (amount) => {
246
+ if (amount === "" || amount === void 0) {
247
+ return "";
248
+ }
249
+ return `${amountSymbol}${amount}`;
250
+ };
251
+ const maxAmount = props.paymentOriginalValue || 0;
252
+ const surchargeFee = (0, import_react.useMemo)(() => {
253
+ return new import_decimal.default(internalPaymentValue || 0).mul(new import_decimal.default((internalSurchargeValue == null ? void 0 : internalSurchargeValue.percent) || 0).div(100)).plus(new import_decimal.default((internalSurchargeValue == null ? void 0 : internalSurchargeValue.fixed) || 0)).toNumber();
254
+ }, [internalPaymentValue, internalSurchargeValue]);
255
+ const totalAmountDue = (0, import_react.useMemo)(() => {
256
+ return new import_decimal.default(internalPaymentValue || 0).plus(new import_decimal.default(surchargeFee || 0)).toNumber();
257
+ }, [internalPaymentValue, surchargeFee]);
258
+ const remainingAmount = (0, import_react.useMemo)(() => {
259
+ return new import_decimal.default(maxAmount || 0).minus(new import_decimal.default(internalPaymentValue || 0)).toNumber();
260
+ }, [maxAmount, internalPaymentValue]);
261
+ const renderBottomContent = () => {
262
+ if (enableExceedMaxAmount) {
263
+ if (new import_decimal.default(remainingAmount).lessThan(0)) {
264
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-pro-price-keyboard-input-tip ellipsis" }, import_utils.locales.getText("payment-keyboard-change-due"), ":", " ", /* @__PURE__ */ import_react.default.createElement(
265
+ import_materials.PisellText.Amount,
266
+ {
267
+ hideDecimalForWholeNumbers: false,
268
+ precision: 2,
269
+ value: Math.abs(remainingAmount)
270
+ }
271
+ ));
272
+ } else {
273
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-pro-price-keyboard-input-tip ellipsis" }, import_utils.locales.getText("payment-keyboard-remaining"), ":", " ", /* @__PURE__ */ import_react.default.createElement(
274
+ import_materials.PisellText.Amount,
275
+ {
276
+ hideDecimalForWholeNumbers: false,
277
+ precision: 2,
278
+ value: remainingAmount
279
+ }
280
+ ));
281
+ }
282
+ } else {
283
+ return (
284
+ // 不允许输入金额超过最大金额
285
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-pro-price-keyboard-input-tip" }, /* @__PURE__ */ import_react.default.createElement(
286
+ "span",
287
+ {
288
+ style: {
289
+ color: remainingAmount < 0 ? "#F04438" : "#475467"
290
+ }
291
+ },
292
+ import_utils.locales.getText("payment-keyboard-max"),
293
+ ":",
294
+ " ",
295
+ /* @__PURE__ */ import_react.default.createElement(
296
+ import_materials.PisellText.Amount,
297
+ {
298
+ hideDecimalForWholeNumbers: false,
299
+ precision: 2,
300
+ value: maxAmount
301
+ }
302
+ )
303
+ ), " ", "( ", import_utils.locales.getText("payment-keyboard-remaining"), ":", " ", /* @__PURE__ */ import_react.default.createElement(
304
+ import_materials.PisellText.Amount,
305
+ {
306
+ hideDecimalForWholeNumbers: false,
307
+ precision: 2,
308
+ value: Math.max(remainingAmount, 0)
309
+ }
310
+ ), " ", ")")
311
+ );
312
+ }
313
+ };
314
+ const renderPaymentDisplay = () => {
315
+ return /* @__PURE__ */ import_react.default.createElement(
316
+ import_materials.VirtualInput,
317
+ {
318
+ focused: true,
319
+ value: amountFormatter(internalPaymentValue),
320
+ wrapperStyle: {
321
+ width: "100%",
322
+ backgroundColor: "#ffffff",
323
+ borderRadius: 8,
324
+ padding: 16
325
+ },
326
+ bottomContent: renderBottomContent(),
327
+ preventBlurElements: [uniqueKeyboardId]
328
+ }
329
+ );
330
+ };
331
+ const renderSurchargeDisplay = () => {
332
+ return /* @__PURE__ */ import_react.default.createElement(
333
+ "div",
334
+ {
335
+ style: {
336
+ display: "grid",
337
+ gridTemplateColumns: "1fr auto 1fr",
338
+ gap: 8,
339
+ alignItems: "center"
340
+ }
341
+ },
342
+ /* @__PURE__ */ import_react.default.createElement(
343
+ import_materials.VirtualInput,
344
+ {
345
+ focused: focusedInput !== KEYS.FIXED,
346
+ value: (internalSurchargeValue == null ? void 0 : internalSurchargeValue.percent) ? `${internalSurchargeValue == null ? void 0 : internalSurchargeValue.percent}%` : "",
347
+ wrapperStyle: {
348
+ backgroundColor: "#ffffff",
349
+ borderRadius: 8,
350
+ padding: 20
351
+ },
352
+ placeholder: import_utils.locales.getText("payment-keyboard-percent"),
353
+ style: {
354
+ justifyContent: "center"
355
+ },
356
+ onFocus: () => setFocusedInput(KEYS.PERCENT),
357
+ preventBlurElements: [uniqueKeyboardId]
358
+ }
359
+ ),
360
+ /* @__PURE__ */ import_react.default.createElement(
361
+ "div",
362
+ {
363
+ style: {
364
+ color: "#667085",
365
+ fontSize: 36,
366
+ fontWeight: 600
367
+ }
368
+ },
369
+ "+"
370
+ ),
371
+ /* @__PURE__ */ import_react.default.createElement(
372
+ import_materials.VirtualInput,
373
+ {
374
+ focused: focusedInput === KEYS.FIXED,
375
+ value: amountFormatter((internalSurchargeValue == null ? void 0 : internalSurchargeValue.fixed) ?? ""),
376
+ wrapperStyle: {
377
+ backgroundColor: "#ffffff",
378
+ borderRadius: 8,
379
+ padding: 20
380
+ },
381
+ placeholder: import_utils.locales.getText("payment-keyboard-fixed"),
382
+ style: {
383
+ justifyContent: "center"
384
+ },
385
+ onFocus: () => setFocusedInput(KEYS.FIXED),
386
+ preventBlurElements: [uniqueKeyboardId]
387
+ }
388
+ )
389
+ );
390
+ };
391
+ const customDisplay = () => {
392
+ if (activeKey === KEYS.PAYMENT) {
393
+ return renderPaymentDisplay();
394
+ }
395
+ if (activeKey === KEYS.SURCHARGE) {
396
+ return renderSurchargeDisplay();
397
+ }
398
+ return null;
399
+ };
400
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-pro-price-keyboard-payment-container" }, (options == null ? void 0 : options.length) > 1 ? /* @__PURE__ */ import_react.default.createElement(
401
+ import_antd.Segmented,
402
+ {
403
+ size: "large",
404
+ style: {
405
+ padding: 6
406
+ },
407
+ block: true,
408
+ options,
409
+ value: activeKey,
410
+ onChange: (value) => setActiveKey(value.toString())
411
+ }
412
+ ) : null, /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-pro-price-keyboard-title ellipsis" }, import_utils.locales.getText("payment-keyboard-total-amount-due"), ":", " ", /* @__PURE__ */ import_react.default.createElement(
413
+ import_materials.PisellText.Amount,
414
+ {
415
+ hideDecimalForWholeNumbers: false,
416
+ precision: 2,
417
+ value: totalAmountDue
418
+ }
419
+ )), ((_h = mergedConfig.surcharge) == null ? void 0 : _h.enable) ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-pro-price-keyboard-subtitle ellipsis" }, import_utils.locales.getText("payment-keyboard-inc-surcharge"), ":", " ", /* @__PURE__ */ import_react.default.createElement(
420
+ import_materials.PisellText.Amount,
421
+ {
422
+ hideDecimalForWholeNumbers: false,
423
+ precision: 2,
424
+ value: surchargeFee
425
+ }
426
+ ), " ", "(", (internalSurchargeValue == null ? void 0 : internalSurchargeValue.percent) || "0", "% +", " ", /* @__PURE__ */ import_react.default.createElement(
427
+ import_materials.PisellText.Amount,
428
+ {
429
+ hideDecimalForWholeNumbers: false,
430
+ precision: 2,
431
+ value: (internalSurchargeValue == null ? void 0 : internalSurchargeValue.fixed) || 0
432
+ }
433
+ ), ")") : null), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-pro-price-keyboard-payment" }, activeKey && customDisplay(), /* @__PURE__ */ import_react.default.createElement(
434
+ import_materials.Keyboard,
435
+ {
436
+ rightItems,
437
+ onChange: handleChange,
438
+ id: uniqueKeyboardId
439
+ }
440
+ )));
441
+ };
442
+ var PaymentKeyboard = (props) => {
443
+ const { containerProps, children, ...keyboardProps } = props;
444
+ const { renderType, open, ...restProps } = containerProps || {};
445
+ if (!containerProps) {
446
+ return /* @__PURE__ */ import_react.default.createElement(PaymentKeyboardBase, { ...keyboardProps });
447
+ }
448
+ if (renderType === "popover") {
449
+ return /* @__PURE__ */ import_react.default.createElement(
450
+ import_antd.Popover,
451
+ {
452
+ key: `${open}`,
453
+ open,
454
+ trigger: "click",
455
+ className: "pisell-payment-keyboard-container pisell-payment-keyboard-popover",
456
+ ...restProps,
457
+ content: /* @__PURE__ */ import_react.default.createElement(PaymentKeyboardBase, { ...keyboardProps })
458
+ },
459
+ children
460
+ );
461
+ }
462
+ if (renderType === "modal") {
463
+ return open ? /* @__PURE__ */ import_react.default.createElement(
464
+ import_materials.PisellModal,
465
+ {
466
+ platform: "pc",
467
+ open: true,
468
+ width: "unset",
469
+ header: null,
470
+ footer: false,
471
+ mask: false,
472
+ maskClosable: true,
473
+ bodyStyle: { padding: "0px", backgroundColor: "transparent" },
474
+ closeIcon: null,
475
+ className: "pisell-payment-keyboard-container pisell-payment-keyboard-modal",
476
+ destroyOnHidden: true,
477
+ ...restProps
478
+ },
479
+ /* @__PURE__ */ import_react.default.createElement(PaymentKeyboardBase, { ...keyboardProps })
480
+ ) : null;
481
+ }
482
+ return /* @__PURE__ */ import_react.default.createElement(PaymentKeyboardBase, { ...keyboardProps });
483
+ };
484
+ var paymentKeyboard_default = PaymentKeyboard;
485
+ // Annotate the CommonJS export names for ESM import in node:
486
+ 0 && (module.exports = {
487
+ PaymentKeyboard
488
+ });