@pisell/private-materials 3.0.138 → 3.0.140

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 (57) 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 +8 -8
  7. package/build/lowcode/render/default/view.js +9 -9
  8. package/build/lowcode/view.js +7 -7
  9. package/es/components/booking/addons/model.d.ts +1 -2
  10. package/es/components/booking/forms/model.d.ts +1 -2
  11. package/es/components/booking/info/header/index.js +2 -2
  12. package/es/components/booking/notes/index.d.ts +1 -1
  13. package/es/components/booking/notes/model.d.ts +1 -2
  14. package/es/components/booking/payments/model.d.ts +1 -2
  15. package/es/components/eftpos/deviceList/index.d.ts +3 -0
  16. package/es/components/eftpos/deviceList/index.js +52 -0
  17. package/es/components/eftpos/form/index.js +21 -74
  18. package/es/components/eftpos/group/index.d.ts +7 -0
  19. package/es/components/eftpos/group/index.js +65 -0
  20. package/es/components/eftposPay/component/manual/index.js +15 -15
  21. package/es/components/eftposPay/helper.d.ts +9 -0
  22. package/es/components/eftposPay/helper.js +69 -1
  23. package/es/components/eftposPay/hooks.d.ts +1 -1
  24. package/es/components/eftposPay/manufacturer.d.ts +1 -1
  25. package/es/components/eftposPay/manufacturer.js +17 -15
  26. package/es/components/eftposPay/payo/const.js +6 -3
  27. package/es/components/eftposPay/payo/hooks.js +31 -2
  28. package/es/components/eftposPay/store/index.d.ts +1 -1
  29. package/es/components/eftposPay/tyro/const.js +3 -1
  30. package/es/components/eftposPay/windcave/const.js +2 -1
  31. package/es/components/schedules/index.d.ts +1 -1
  32. package/es/components/schedules/model.d.ts +1 -2
  33. package/lib/components/booking/addons/model.d.ts +1 -2
  34. package/lib/components/booking/forms/model.d.ts +1 -2
  35. package/lib/components/booking/info/header/index.js +1 -1
  36. package/lib/components/booking/notes/index.d.ts +1 -1
  37. package/lib/components/booking/notes/model.d.ts +1 -2
  38. package/lib/components/booking/payments/model.d.ts +1 -2
  39. package/lib/components/eftpos/deviceList/index.d.ts +3 -0
  40. package/lib/components/eftpos/deviceList/index.js +70 -0
  41. package/lib/components/eftpos/form/index.js +6 -33
  42. package/lib/components/eftpos/group/index.d.ts +7 -0
  43. package/lib/components/eftpos/group/index.js +75 -0
  44. package/lib/components/eftposPay/component/manual/index.js +4 -15
  45. package/lib/components/eftposPay/helper.d.ts +9 -0
  46. package/lib/components/eftposPay/helper.js +49 -0
  47. package/lib/components/eftposPay/hooks.d.ts +1 -1
  48. package/lib/components/eftposPay/manufacturer.d.ts +1 -1
  49. package/lib/components/eftposPay/manufacturer.js +2 -13
  50. package/lib/components/eftposPay/payo/const.js +3 -3
  51. package/lib/components/eftposPay/payo/hooks.js +17 -0
  52. package/lib/components/eftposPay/store/index.d.ts +1 -1
  53. package/lib/components/eftposPay/tyro/const.js +1 -1
  54. package/lib/components/eftposPay/windcave/const.js +1 -1
  55. package/lib/components/schedules/index.d.ts +1 -1
  56. package/lib/components/schedules/model.d.ts +1 -2
  57. package/package.json +3 -3
@@ -1,6 +1,5 @@
1
- /// <reference types="react" />
2
1
  import { FormState } from "../model";
3
- export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
2
+ export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
4
3
  state: FormState;
5
4
  } & {
6
5
  dispatch: (params: {
@@ -1,6 +1,5 @@
1
- /// <reference types="react" />
2
1
  import { FormState } from "../model";
3
- export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
2
+ export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
4
3
  state: FormState;
5
4
  } & {
6
5
  dispatch: (params: {
@@ -229,7 +229,7 @@ var header = function header(_ref) {
229
229
  key: 'booking_checkout',
230
230
  data: {
231
231
  order_id: state.bookingId,
232
- callbackType: "pisell2"
232
+ callbackType: 'pisell2'
233
233
  }
234
234
  }));
235
235
  case 2:
@@ -383,7 +383,7 @@ var header = function header(_ref) {
383
383
  open: false
384
384
  });
385
385
  }
386
- }, locales.getText('pisell2.text.status.cancelled')), /*#__PURE__*/React.createElement(Button, {
386
+ }, locales.getText('page.booking.text.go-back')), /*#__PURE__*/React.createElement(Button, {
387
387
  className: "go-payments-footer-btn",
388
388
  type: "primary",
389
389
  size: "large",
@@ -4,5 +4,5 @@ export interface InfoProps {
4
4
  globalState: any;
5
5
  setGlobalState: any;
6
6
  }
7
- declare const Notes: (props: any) => any;
7
+ declare const Notes: (props: any) => JSX.Element;
8
8
  export default Notes;
@@ -1,6 +1,5 @@
1
- /// <reference types="react" />
2
1
  import { FormState } from "../model";
3
- export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
2
+ export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
4
3
  state: FormState;
5
4
  } & {
6
5
  dispatch: (params: {
@@ -1,6 +1,5 @@
1
- /// <reference types="react" />
2
1
  import { FormState } from "../model";
3
- export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
2
+ export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
4
3
  state: FormState;
5
4
  } & {
6
5
  dispatch: (params: {
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const _default: ({ input, ...formItemProps }: any) => React.JSX.Element;
3
+ export default _default;
@@ -0,0 +1,52 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ var _excluded = ["input"],
3
+ _excluded2 = ["input"];
4
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
5
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
6
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
7
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
8
+ 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; }
9
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
10
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
11
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
12
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
13
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
14
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
15
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
16
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
+ import React, { useMemo } from 'react';
18
+ import { Form } from 'antd';
19
+ import { CheckboxGroup } from "../group";
20
+ var DeviceList = function DeviceList(props) {
21
+ var _Form$useForm = Form.useForm(),
22
+ _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
23
+ form = _Form$useForm2[0];
24
+ var list = props.list,
25
+ onChange = props.onChange; //value 是form表单中"name"对应的字段值
26
+ console.log(list);
27
+ var onValuesChange = function onValuesChange() {
28
+ var val = Object.values(form.getFieldsValue()).flat();
29
+ onChange(val);
30
+ };
31
+ var initialValues = useMemo(function () {
32
+ return list.reduce(function (target, item) {
33
+ var _item$input, _item$input2;
34
+ return _objectSpread(_objectSpread({}, target), {}, _defineProperty({}, item.name, (item === null || item === void 0 ? void 0 : (_item$input = item.input) === null || _item$input === void 0 ? void 0 : _item$input.value) || (item === null || item === void 0 ? void 0 : (_item$input2 = item.input) === null || _item$input2 === void 0 ? void 0 : _item$input2.defaultValue)));
35
+ }, {});
36
+ }, [list]);
37
+ return /*#__PURE__*/React.createElement(Form, {
38
+ layout: "vertical",
39
+ onValuesChange: onValuesChange,
40
+ form: form,
41
+ initialValues: initialValues
42
+ }, list.map(function (_ref) {
43
+ var input = _ref.input,
44
+ formItemProps = _objectWithoutProperties(_ref, _excluded);
45
+ return /*#__PURE__*/React.createElement(Form.Item, formItemProps, /*#__PURE__*/React.createElement(CheckboxGroup, input));
46
+ }));
47
+ };
48
+ export default (function (_ref2) {
49
+ var input = _ref2.input,
50
+ formItemProps = _objectWithoutProperties(_ref2, _excluded2);
51
+ return /*#__PURE__*/React.createElement(Form.Item, formItemProps, /*#__PURE__*/React.createElement(DeviceList, input));
52
+ });
@@ -1,78 +1,24 @@
1
- var _excluded = ["direction", "options"],
2
- _excluded2 = ["label", "value"],
3
- _excluded3 = ["direction", "options"],
4
- _excluded4 = ["label", "value"],
5
- _excluded5 = ["__sourceName", "Component"],
6
- _excluded6 = ["input"],
7
- _excluded7 = ["input"];
1
+ var _excluded = ["__sourceName", "Component"],
2
+ _excluded2 = ["input"],
3
+ _excluded3 = ["input"];
8
4
  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); }
9
5
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
10
6
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
11
7
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
12
8
  import React from 'react';
13
- import { Input, InputNumber, Checkbox, Radio, Cascader, DatePicker, Select, Slider, Switch, TimePicker, Transfer, TreeSelect, Upload, Form, Space } from 'antd';
9
+ import { Input, InputNumber, Checkbox, Radio, Cascader, DatePicker, Select, Slider, Switch, TimePicker, Transfer, TreeSelect, Upload, Form } from 'antd';
10
+ import { CheckboxGroup, RadioGroup } from "../group";
14
11
  import Surcharge, { getCommName, getCommDefaultVal } from "../surcharge";
12
+ import DeviceList from "../deviceList";
15
13
 
16
14
  // 通用表单配置
17
15
  var Mapping = {
18
16
  Input: Input,
19
17
  InputNumber: InputNumber,
20
18
  Checkbox: Checkbox,
21
- 'Checkbox.Group': function CheckboxGroup(_ref) {
22
- var direction = _ref.direction,
23
- options = _ref.options,
24
- props = _objectWithoutProperties(_ref, _excluded);
25
- if (direction === 'vertical') {
26
- return /*#__PURE__*/React.createElement(Checkbox.Group, props, /*#__PURE__*/React.createElement(Space, {
27
- direction: direction
28
- }, options === null || options === void 0 ? void 0 : options.map(function (item) {
29
- if (_typeof(item) === 'object') {
30
- var label = item.label,
31
- value = item.value,
32
- other = _objectWithoutProperties(item, _excluded2);
33
- return /*#__PURE__*/React.createElement(Checkbox, _extends({}, other, {
34
- value: value,
35
- key: "".concat(item.value)
36
- }), label);
37
- }
38
- return /*#__PURE__*/React.createElement(Checkbox, {
39
- value: item,
40
- key: "".concat(item)
41
- }, item);
42
- })));
43
- }
44
- return /*#__PURE__*/React.createElement(Checkbox.Group, _extends({}, props, {
45
- options: options
46
- }));
47
- },
19
+ 'Checkbox.Group': CheckboxGroup,
48
20
  Radio: Radio,
49
- 'Radio.Group': function RadioGroup(_ref2) {
50
- var direction = _ref2.direction,
51
- options = _ref2.options,
52
- props = _objectWithoutProperties(_ref2, _excluded3);
53
- if (direction === 'vertical') {
54
- return /*#__PURE__*/React.createElement(Radio.Group, props, /*#__PURE__*/React.createElement(Space, {
55
- direction: "vertical"
56
- }, options === null || options === void 0 ? void 0 : options.map(function (item) {
57
- if (_typeof(item) === 'object') {
58
- var label = item.label,
59
- value = item.value,
60
- other = _objectWithoutProperties(item, _excluded4);
61
- return /*#__PURE__*/React.createElement(Radio, _extends({}, other, {
62
- value: value,
63
- key: "".concat(item.value)
64
- }), label);
65
- }
66
- return /*#__PURE__*/React.createElement(Radio, {
67
- value: item,
68
- key: "".concat(item)
69
- }, item);
70
- })));
71
- }
72
- return /*#__PURE__*/React.createElement(Radio.Group, _extends({}, props, {
73
- options: options
74
- }));
75
- },
21
+ 'Radio.Group': RadioGroup,
76
22
  'Radio.Button': Radio.Button,
77
23
  Cascader: Cascader,
78
24
  DatePicker: DatePicker,
@@ -85,7 +31,8 @@ var Mapping = {
85
31
  Upload: Upload
86
32
  };
87
33
  var CustomMapping = {
88
- Surcharge: Surcharge
34
+ Surcharge: Surcharge,
35
+ DeviceList: DeviceList
89
36
  };
90
37
 
91
38
  /**
@@ -93,15 +40,15 @@ var CustomMapping = {
93
40
  * @Author: hongbing.wang
94
41
  * @Date: 2024-08-20 13:21
95
42
  */
96
- var CustomFormItem = function CustomFormItem(_ref3) {
97
- var formItemList = _ref3.formItemList,
98
- _ref3$level = _ref3.level,
99
- level = _ref3$level === void 0 ? 0 : _ref3$level,
100
- onChange = _ref3.onChange;
101
- return /*#__PURE__*/React.createElement(React.Fragment, null, formItemList.map(function (_ref4, index) {
102
- var __sourceName = _ref4.__sourceName,
103
- Component = _ref4.Component,
104
- item = _objectWithoutProperties(_ref4, _excluded5);
43
+ var CustomFormItem = function CustomFormItem(_ref) {
44
+ var formItemList = _ref.formItemList,
45
+ _ref$level = _ref.level,
46
+ level = _ref$level === void 0 ? 0 : _ref$level,
47
+ onChange = _ref.onChange;
48
+ return /*#__PURE__*/React.createElement(React.Fragment, null, formItemList.map(function (_ref2, index) {
49
+ var __sourceName = _ref2.__sourceName,
50
+ Component = _ref2.Component,
51
+ item = _objectWithoutProperties(_ref2, _excluded);
105
52
  if (Array.isArray(item.children)) {
106
53
  return /*#__PURE__*/React.createElement(CustomFormItem, {
107
54
  formItemList: item.children,
@@ -118,7 +65,7 @@ var CustomFormItem = function CustomFormItem(_ref3) {
118
65
  if (Mapping[Component]) {
119
66
  var Comm = Mapping[Component];
120
67
  var input = item.input,
121
- formItemProps = _objectWithoutProperties(item, _excluded6);
68
+ formItemProps = _objectWithoutProperties(item, _excluded2);
122
69
  return /*#__PURE__*/React.createElement(Form.Item, _extends({}, formItemProps, {
123
70
  key: item.name + level
124
71
  }), /*#__PURE__*/React.createElement(Comm, input));
@@ -126,7 +73,7 @@ var CustomFormItem = function CustomFormItem(_ref3) {
126
73
  if (Mapping[Component]) {
127
74
  var _Comm = Mapping[Component];
128
75
  var _input = item.input,
129
- _formItemProps = _objectWithoutProperties(item, _excluded7);
76
+ _formItemProps = _objectWithoutProperties(item, _excluded3);
130
77
  return /*#__PURE__*/React.createElement(Form.Item, _extends({}, _formItemProps, {
131
78
  key: item.name + level
132
79
  }), /*#__PURE__*/React.createElement(_Comm, _input));
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { RadioGroupProps } from 'antd';
3
+ export declare const CheckboxGroup: ({ direction, options, ...props }: any) => React.JSX.Element;
4
+ export declare const RadioGroup: ({ direction, options, component, ...props }: RadioGroupProps & {
5
+ direction?: "vertical" | undefined;
6
+ component: string;
7
+ }) => React.JSX.Element;
@@ -0,0 +1,65 @@
1
+ var _excluded = ["direction", "options"],
2
+ _excluded2 = ["label", "value"],
3
+ _excluded3 = ["direction", "options", "component"],
4
+ _excluded4 = ["label", "value"];
5
+ 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); }
6
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
7
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
8
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
9
+ import React from 'react';
10
+ import { Checkbox, Radio, Space } from 'antd';
11
+ export var CheckboxGroup = function CheckboxGroup(_ref) {
12
+ var direction = _ref.direction,
13
+ options = _ref.options,
14
+ props = _objectWithoutProperties(_ref, _excluded);
15
+ if (direction === 'vertical') {
16
+ return /*#__PURE__*/React.createElement(Checkbox.Group, props, /*#__PURE__*/React.createElement(Space, {
17
+ direction: direction
18
+ }, options === null || options === void 0 ? void 0 : options.map(function (item) {
19
+ if (_typeof(item) === 'object') {
20
+ var label = item.label,
21
+ value = item.value,
22
+ other = _objectWithoutProperties(item, _excluded2);
23
+ return /*#__PURE__*/React.createElement(Checkbox, _extends({}, other, {
24
+ value: value,
25
+ key: "".concat(item.value)
26
+ }), label);
27
+ }
28
+ return /*#__PURE__*/React.createElement(Checkbox, {
29
+ value: item,
30
+ key: "".concat(item)
31
+ }, item);
32
+ })));
33
+ }
34
+ return /*#__PURE__*/React.createElement(Checkbox.Group, _extends({}, props, {
35
+ options: options
36
+ }));
37
+ };
38
+ export var RadioGroup = function RadioGroup(_ref2) {
39
+ var direction = _ref2.direction,
40
+ options = _ref2.options,
41
+ component = _ref2.component,
42
+ props = _objectWithoutProperties(_ref2, _excluded3);
43
+ if (direction === 'vertical') {
44
+ return /*#__PURE__*/React.createElement(Radio.Group, props, /*#__PURE__*/React.createElement(Space, {
45
+ direction: "vertical"
46
+ }, options === null || options === void 0 ? void 0 : options.map(function (item) {
47
+ if (_typeof(item) === 'object') {
48
+ var label = item.label,
49
+ value = item.value,
50
+ other = _objectWithoutProperties(item, _excluded4);
51
+ return /*#__PURE__*/React.createElement(Radio, _extends({}, other, {
52
+ value: value,
53
+ key: "".concat(item.value)
54
+ }), label);
55
+ }
56
+ return /*#__PURE__*/React.createElement(Radio, {
57
+ value: item,
58
+ key: "".concat(item)
59
+ }, item);
60
+ })));
61
+ }
62
+ return /*#__PURE__*/React.createElement(Radio.Group, _extends({}, props, {
63
+ options: options
64
+ }));
65
+ };
@@ -41,11 +41,11 @@ export default (function (_ref) {
41
41
  pay = _useContextData.pay,
42
42
  amount = _useContextData.amount;
43
43
  var start = useMemo(function () {
44
- if (typeof (manual === null || manual === void 0 ? void 0 : manual.money) === 'number') {
45
- return manual === null || manual === void 0 ? void 0 : manual.money;
44
+ if (typeof (manual === null || manual === void 0 ? void 0 : manual.money) === 'number' || typeof (manual === null || manual === void 0 ? void 0 : manual.money) === 'string') {
45
+ return Number(manual === null || manual === void 0 ? void 0 : manual.money);
46
46
  }
47
- if (typeof (pay === null || pay === void 0 ? void 0 : pay.total) === 'number') {
48
- return pay === null || pay === void 0 ? void 0 : pay.total;
47
+ if (typeof (pay === null || pay === void 0 ? void 0 : pay.total) === 'number' || typeof (pay === null || pay === void 0 ? void 0 : pay.total) === 'string') {
48
+ return Number(pay === null || pay === void 0 ? void 0 : pay.total);
49
49
  }
50
50
  return amount;
51
51
  }, [manual === null || manual === void 0 ? void 0 : manual.money, pay === null || pay === void 0 ? void 0 : pay.total, amount]);
@@ -72,17 +72,17 @@ export default (function (_ref) {
72
72
  if (disabled) {
73
73
  return;
74
74
  }
75
- // 暂时关闭 后期可以放开用于自定义编辑金额
76
- if (mode === ModeEnum.Pay) {
77
- setDisabled(true);
78
- var obj = pay || {};
79
- onChange('success', _objectSpread(_objectSpread({}, obj), {}, {
80
- number: number,
81
- device: device,
82
- order_id: order_id
83
- }));
84
- return;
85
- }
75
+ // if (mode === ModeEnum.Pay) {
76
+ // setDisabled(true);
77
+ // const obj = pay || {};
78
+ // onChange('success', {
79
+ // ...obj,
80
+ // number,
81
+ // device,
82
+ // order_id,
83
+ // } as { [key: string]: unknown });
84
+ // return;
85
+ // }
86
86
  if (mode === ModeEnum.Refund) {
87
87
  setDisabled(true);
88
88
  onChange('success', {
@@ -1,4 +1,5 @@
1
1
  import { State } from './store';
2
+ import { Amount } from './const';
2
3
  export declare function getUuid(): string;
3
4
  /**
4
5
  * @title: Promise化 setTimeout
@@ -54,4 +55,12 @@ export declare const getPayParams: (data: Partial<Omit<State, key>> & Pick<State
54
55
  device?: undefined;
55
56
  };
56
57
  export declare const limitDecimals: (value: any) => any;
58
+ /**
59
+ * @title: 通用获取 金额信息
60
+ * @description: 在 amount 页面设置则使用 pay ,如果有 setting 则使用 setting 信息 ,都没有则设置0
61
+ * @param {State} store : 全局store数据管理
62
+ * @Author: hongbing.wang
63
+ * @Date: 2024-08-12 10:24
64
+ */
65
+ export declare function getAmonunt(store: State): Amount;
57
66
  export {};
@@ -124,4 +124,72 @@ export var limitDecimals = function limitDecimals(value) {
124
124
  return !isNaN(value) ? String(value).replace(reg, '$1$2.$3') : '';
125
125
  }
126
126
  return '';
127
- };
127
+ };
128
+
129
+ /**
130
+ * @title: 通用获取 金额信息
131
+ * @description: 在 amount 页面设置则使用 pay ,如果有 setting 则使用 setting 信息 ,都没有则设置0
132
+ * @param {State} store : 全局store数据管理
133
+ * @Author: hongbing.wang
134
+ * @Date: 2024-08-12 10:24
135
+ */
136
+ export function getAmonunt(store) {
137
+ var device = store.device,
138
+ pay = store.pay,
139
+ custom = store.custom,
140
+ name = store.name,
141
+ symbol = store.symbol,
142
+ amount = store.amount;
143
+ if (!device || !custom) {
144
+ throw Error('device or custom is not defined');
145
+ }
146
+ var setting = device.setting;
147
+
148
+ // 从 金额编辑页 获取到 支付数据
149
+ if (pay) {
150
+ return {
151
+ name: name,
152
+ symbol: symbol,
153
+ // format,
154
+ money: Number(amount),
155
+ amount: Number(pay.amount),
156
+ surRate: Number(pay.surRate),
157
+ surMoney: Number(pay.surMoney),
158
+ surcharge: (setting === null || setting === void 0 ? void 0 : setting.surcharge) || false,
159
+ useOriginSurcharge: (pay === null || pay === void 0 ? void 0 : pay.useOriginSurcharge) || false
160
+ };
161
+ }
162
+ // 原始支付总额
163
+ if (!setting) {
164
+ return {
165
+ name: name,
166
+ symbol: symbol,
167
+ // format,
168
+ money: Number(amount),
169
+ amount: Number(amount),
170
+ surRate: 0,
171
+ surMoney: 0,
172
+ surcharge: false,
173
+ useOriginSurcharge: false
174
+ };
175
+ }
176
+ // 原始手续费 是指 各个pos机厂商跟银行合作直接收取的手续费,一旦设置则清空,配置中设置的手续费
177
+ var useOriginSurcharge = setting.useOriginSurcharge || false;
178
+
179
+ // 直接设备中手续费金额
180
+ var surRate = setting.constant_rate || 0;
181
+ var surMoney = setting.constant_money || 0;
182
+
183
+ // 是否开启手续费
184
+ var surcharge = setting.surcharge;
185
+ return {
186
+ name: name,
187
+ symbol: symbol,
188
+ money: Number(amount),
189
+ amount: Number(amount),
190
+ surRate: useOriginSurcharge ? 0 : surcharge ? surRate : 0,
191
+ surMoney: useOriginSurcharge ? 0 : surcharge ? surMoney : 0,
192
+ surcharge: surcharge,
193
+ useOriginSurcharge: useOriginSurcharge
194
+ };
195
+ }
@@ -19,7 +19,7 @@ export declare const useStoreRef: <T extends {
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<"windcave" | "tyro" | "payo" | "stripe">;
22
+ readonly eftposRef: React.MutableRefObject<"tyro" | "windcave" | "payo" | "stripe">;
23
23
  };
24
24
  /**
25
25
  * @title: 通用失败处理
@@ -1,6 +1,6 @@
1
1
  import { State } from './store';
2
+ export { getAmonunt } from './helper';
2
3
  export { default as Payo } from './payo';
3
4
  export { default as Windcave } from './windcave/windcave';
4
5
  export { default as Tyro } from './tyro';
5
6
  export declare const getInitState: (type: string, params?: any) => State;
6
- export declare const getAmonunt: (store: State) => import("./const").Amount;
@@ -1,7 +1,8 @@
1
1
  import { EftposEnum } from "./const";
2
- import getPayoInitState, { getAmonunt as getPayoAmonunt } from "./payo/const";
3
- import getTyroInitState, { getAmonunt as getTyroAmonunt } from "./tyro/const";
4
- import getWindcaveInitState, { getAmonunt as getWindcaveAmonunt } from "./windcave/const";
2
+ import getPayoInitState from "./payo/const";
3
+ import getTyroInitState from "./tyro/const";
4
+ import getWindcaveInitState from "./windcave/const";
5
+ export { getAmonunt } from "./helper";
5
6
  export { default as Payo } from "./payo";
6
7
  export { default as Windcave } from "./windcave/windcave";
7
8
  export { default as Tyro } from "./tyro";
@@ -17,15 +18,16 @@ export var getInitState = function getInitState(type, params) {
17
18
  throw new Error('未知的厂商类型');
18
19
  }
19
20
  };
20
- export var getAmonunt = function getAmonunt(store) {
21
- if (store.eftpos === EftposEnum.Payo) {
22
- return getPayoAmonunt(store);
23
- }
24
- if (store.eftpos === EftposEnum.Windcave) {
25
- return getWindcaveAmonunt(store);
26
- }
27
- if (store.eftpos === EftposEnum.Tyro) {
28
- return getTyroAmonunt(store);
29
- }
30
- throw new Error('未知的厂商类型');
31
- };
21
+ // 暂无定制业务
22
+ // export const getAmonunt = (store: State) => {
23
+ // if (store.eftpos === EftposEnum.Payo) {
24
+ // return getPayoAmonunt(store);
25
+ // }
26
+ // if (store.eftpos === EftposEnum.Windcave) {
27
+ // return getWindcaveAmonunt(store);
28
+ // }
29
+ // if (store.eftpos === EftposEnum.Tyro) {
30
+ // return getTyroAmonunt(store);
31
+ // }
32
+ // throw new Error('未知的厂商类型');
33
+ // };
@@ -111,6 +111,7 @@ export function getAmonunt(store) {
111
111
  useOriginSurcharge: (pay === null || pay === void 0 ? void 0 : pay.useOriginSurcharge) || false
112
112
  };
113
113
  }
114
+
114
115
  // 原始支付总额
115
116
  if (!setting) {
116
117
  return {
@@ -125,11 +126,13 @@ export function getAmonunt(store) {
125
126
  useOriginSurcharge: false
126
127
  };
127
128
  }
129
+ var useOriginSurcharge = setting.useOriginSurcharge || false;
130
+
128
131
  // 直接设备中手续费金额 + 原始支付总额
129
- var surRate = setting.useOriginSurcharge ? 0 : setting.constant_rate || 0;
130
- var surMoney = setting.useOriginSurcharge ? 0 : setting.constant_money || 0;
132
+
133
+ var surRate = setting.constant_rate || 0;
134
+ var surMoney = setting.constant_money || 0;
131
135
  var surcharge = setting.surcharge;
132
- var useOriginSurcharge = setting.useOriginSurcharge || false;
133
136
  return {
134
137
  name: name,
135
138
  symbol: symbol,