@pisell/private-materials 3.0.139 → 3.0.141

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 (43) 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/info/header/index.js +73 -9
  10. package/es/components/booking/locales.d.ts +3 -0
  11. package/es/components/booking/locales.js +3 -0
  12. package/es/components/eftpos/deviceList/index.d.ts +3 -0
  13. package/es/components/eftpos/deviceList/index.js +52 -0
  14. package/es/components/eftpos/form/index.js +21 -74
  15. package/es/components/eftpos/group/index.d.ts +7 -0
  16. package/es/components/eftpos/group/index.js +65 -0
  17. package/es/components/eftposPay/component/manual/index.js +15 -15
  18. package/es/components/eftposPay/helper.d.ts +9 -0
  19. package/es/components/eftposPay/helper.js +69 -1
  20. package/es/components/eftposPay/manufacturer.d.ts +1 -1
  21. package/es/components/eftposPay/manufacturer.js +17 -15
  22. package/es/components/eftposPay/payo/const.js +6 -3
  23. package/es/components/eftposPay/payo/hooks.js +31 -2
  24. package/es/components/eftposPay/tyro/const.js +3 -1
  25. package/es/components/eftposPay/windcave/const.js +2 -1
  26. package/lib/components/booking/info/header/index.js +52 -7
  27. package/lib/components/booking/locales.d.ts +3 -0
  28. package/lib/components/booking/locales.js +3 -0
  29. package/lib/components/eftpos/deviceList/index.d.ts +3 -0
  30. package/lib/components/eftpos/deviceList/index.js +70 -0
  31. package/lib/components/eftpos/form/index.js +6 -33
  32. package/lib/components/eftpos/group/index.d.ts +7 -0
  33. package/lib/components/eftpos/group/index.js +75 -0
  34. package/lib/components/eftposPay/component/manual/index.js +4 -15
  35. package/lib/components/eftposPay/helper.d.ts +9 -0
  36. package/lib/components/eftposPay/helper.js +49 -0
  37. package/lib/components/eftposPay/manufacturer.d.ts +1 -1
  38. package/lib/components/eftposPay/manufacturer.js +2 -13
  39. package/lib/components/eftposPay/payo/const.js +3 -3
  40. package/lib/components/eftposPay/payo/hooks.js +17 -0
  41. package/lib/components/eftposPay/tyro/const.js +1 -1
  42. package/lib/components/eftposPay/windcave/const.js +1 -1
  43. package/package.json +2 -2
@@ -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,
@@ -1,5 +1,10 @@
1
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
2
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
3
+ 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; }
4
+ 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; }
5
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
7
+ 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); }
3
8
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4
9
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
5
10
  /* eslint-disable @typescript-eslint/no-unused-expressions */
@@ -16,10 +21,11 @@ import { sleep } from "../helper";
16
21
  export var useValidate = function useValidate(timeout) {
17
22
  var controllerRef = useRef();
18
23
  var ref = useRef(true);
24
+ var isTimeoutCloseRef = useRef(false);
19
25
  var TimeoutRef = useRef();
20
26
  var checkApi = useCallback( /*#__PURE__*/function () {
21
27
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(check, number, time) {
22
- var res, start, diff;
28
+ var res, start, diff, _ref2, code;
23
29
  return _regeneratorRuntime().wrap(function _callee$(_context) {
24
30
  while (1) switch (_context.prev = _context.next) {
25
31
  case 0:
@@ -61,8 +67,29 @@ export var useValidate = function useValidate(timeout) {
61
67
  _context.next = 4;
62
68
  break;
63
69
  case 16:
70
+ if (!isTimeoutCloseRef.current) {
71
+ _context.next = 22;
72
+ break;
73
+ }
74
+ if (res) {
75
+ _context.next = 19;
76
+ break;
77
+ }
78
+ return _context.abrupt("return", {
79
+ code: PayStatus.Timeout
80
+ });
81
+ case 19:
82
+ _ref2 = res, code = _ref2.code;
83
+ if (!("".concat(code) === "200")) {
84
+ _context.next = 22;
85
+ break;
86
+ }
87
+ return _context.abrupt("return", _objectSpread(_objectSpread({}, res), {}, {
88
+ code: PayStatus.Timeout
89
+ }));
90
+ case 22:
64
91
  return _context.abrupt("return", res);
65
- case 17:
92
+ case 23:
66
93
  case "end":
67
94
  return _context.stop();
68
95
  }
@@ -84,9 +111,11 @@ export var useValidate = function useValidate(timeout) {
84
111
  (_controllerRef$curren = controllerRef.current) === null || _controllerRef$curren === void 0 ? void 0 : _controllerRef$curren.abort();
85
112
  }, []);
86
113
  var run = function run() {
114
+ isTimeoutCloseRef.current = false;
87
115
  TimeoutRef.current && clearTimeout(TimeoutRef.current);
88
116
  // 开启计时
89
117
  TimeoutRef.current = setTimeout(function () {
118
+ isTimeoutCloseRef.current = true;
90
119
  close();
91
120
  }, timeout);
92
121
  return checkApi.apply(void 0, arguments);
@@ -102,11 +102,13 @@ export function getAmonunt(store) {
102
102
  useOriginSurcharge: false
103
103
  };
104
104
  }
105
+ var useOriginSurcharge = setting.useOriginSurcharge || false;
106
+
105
107
  // 直接设备中手续费金额
108
+
106
109
  var surRate = setting.constant_rate || 0;
107
110
  var surMoney = setting.constant_money || 0;
108
111
  var surcharge = setting.surcharge;
109
- var useOriginSurcharge = setting.useOriginSurcharge || false;
110
112
  return {
111
113
  name: name,
112
114
  symbol: symbol,
@@ -111,11 +111,12 @@ export function getAmonunt(store) {
111
111
  useOriginSurcharge: false
112
112
  };
113
113
  }
114
+ var useOriginSurcharge = setting.useOriginSurcharge || false;
115
+
114
116
  // 直接设备中手续费金额 + 原始支付总额
115
117
  var surRate = setting.constant_rate || 0;
116
118
  var surMoney = setting.constant_money || 0;
117
119
  var surcharge = setting.surcharge;
118
- var useOriginSurcharge = setting.useOriginSurcharge || false;
119
120
  return {
120
121
  name: name,
121
122
  symbol: symbol,
@@ -40,7 +40,7 @@ var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContex
40
40
  var import_index = require("./index.less");
41
41
  var import_classnames = __toESM(require("classnames"));
42
42
  var header = ({ state, dispatch }) => {
43
- var _a, _b, _c, _d, _e, _f, _g, _h;
43
+ var _a, _b, _c, _d, _e, _f;
44
44
  const context = (0, import_useEngineContext.default)();
45
45
  const [modalContent, setModalContent] = (0, import_react.useState)({
46
46
  open: false,
@@ -169,14 +169,25 @@ var header = ({ state, dispatch }) => {
169
169
  )
170
170
  );
171
171
  }, [(_c = state.service) == null ? void 0 : _c.value]);
172
- const isPaymentProcessingPayments = (0, import_react.useMemo)(() => {
172
+ const paymentProcessingPayment = (type) => {
173
173
  var _a2;
174
- return !!((_a2 = state.bookingDetail) == null ? void 0 : _a2.payment_processing_payment_nums);
175
- }, [(_e = (_d = state.bookingDetail) == null ? void 0 : _d.payment_processing_payments) == null ? void 0 : _e.length]);
174
+ const payments = ((_a2 = state == null ? void 0 : state.bookingDetail) == null ? void 0 : _a2.payments) || [];
175
+ const status = ["payment_processing"];
176
+ const payment_method = ["BANK_DEPOSIT"];
177
+ if (type === "bank") {
178
+ return !!(payments == null ? void 0 : payments.find(
179
+ (item) => status.includes(item == null ? void 0 : item.status) && payment_method.includes(item == null ? void 0 : item.payment_method)
180
+ ));
181
+ }
182
+ return !!(payments == null ? void 0 : payments.find((item) => status.includes(item == null ? void 0 : item.status)));
183
+ };
176
184
  const handleCancel = () => {
177
- if (isPaymentProcessingPayments) {
185
+ if (paymentProcessingPayment("bank")) {
178
186
  return showPaymentModal();
179
187
  }
188
+ if (paymentProcessingPayment()) {
189
+ return showCancelCalendarModal();
190
+ }
180
191
  return showCancelledModal();
181
192
  };
182
193
  const handleRefund = () => {
@@ -235,6 +246,40 @@ var header = ({ state, dispatch }) => {
235
246
  footer: null
236
247
  });
237
248
  };
249
+ const showCancelCalendarModal = () => {
250
+ setModalContentState({
251
+ className: "go-payments-modal-wrap",
252
+ open: true,
253
+ width: 480,
254
+ onCancel: () => {
255
+ setModalContentState({ open: false });
256
+ },
257
+ children: /* @__PURE__ */ import_react.default.createElement("div", { className: "go-payments-modal-content" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "go-payments-modal-content-title" }, import_utils.locales.getText("page.booking.text.cancel-booking")), /* @__PURE__ */ import_react.default.createElement("div", { className: "go-payments-modal-content-desc" }, import_utils.locales.getText("page.booking.text.cancel.calendar.msg")), /* @__PURE__ */ import_react.default.createElement("div", { className: "go-payments-footer" }, /* @__PURE__ */ import_react.default.createElement(
258
+ import_antd.Button,
259
+ {
260
+ className: "go-payments-footer-btn",
261
+ size: "large",
262
+ onClick: () => {
263
+ setModalContentState({ open: false });
264
+ }
265
+ },
266
+ import_utils.locales.getText("page.booking.text.go-back")
267
+ ), /* @__PURE__ */ import_react.default.createElement(
268
+ import_antd.Button,
269
+ {
270
+ className: "go-payments-footer-btn",
271
+ type: "primary",
272
+ size: "large",
273
+ onClick: () => {
274
+ setBookingStatus("cancelled");
275
+ setModalContentState({ open: false });
276
+ }
277
+ },
278
+ import_utils.locales.getText("page.booking.text.cancel-booking")
279
+ ))),
280
+ footer: null
281
+ });
282
+ };
238
283
  const showCancelledModal = () => {
239
284
  const cancelBtn = /* @__PURE__ */ import_react.default.createElement(
240
285
  import_antd.Button,
@@ -316,8 +361,8 @@ var header = ({ state, dispatch }) => {
316
361
  className: "booking-header",
317
362
  style: { backgroundColor: currentStatus.color }
318
363
  },
319
- /* @__PURE__ */ import_react.default.createElement("div", { className: "booking-order-sales-channel" }, orderSalesChannel[(_f = state.bookingDetail) == null ? void 0 : _f.order_sales_channel] || ""),
320
- /* @__PURE__ */ import_react.default.createElement("div", { className: "booking-header-line-2" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "booking-header-left" }, import_utils.locales.getText("pisell2.text.status.booking_id"), ":", " ", ((_h = (_g = state.bookingDetail) == null ? void 0 : _g.bookings) == null ? void 0 : _h.booking_id) || "-"), /* @__PURE__ */ import_react.default.createElement("div", { className: "booking-header-right" }, /* @__PURE__ */ import_react.default.createElement(
364
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "booking-order-sales-channel" }, orderSalesChannel[(_d = state.bookingDetail) == null ? void 0 : _d.order_sales_channel] || ""),
365
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "booking-header-line-2" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "booking-header-left" }, import_utils.locales.getText("pisell2.text.status.booking_id"), ":", " ", ((_f = (_e = state.bookingDetail) == null ? void 0 : _e.bookings) == null ? void 0 : _f.booking_id) || "-"), /* @__PURE__ */ import_react.default.createElement("div", { className: "booking-header-right" }, /* @__PURE__ */ import_react.default.createElement(
321
366
  import_antd.Dropdown,
322
367
  {
323
368
  menu: { items, onClick: onSelect },
@@ -181,6 +181,7 @@ declare const _default: {
181
181
  'page.event.booking.text.duplicate-enrollment-confirm': string;
182
182
  'page.booking.text.unconfirmed-payments': string;
183
183
  'page.booking.text.unconfirmed-payments.msg': string;
184
+ 'page.booking.text.cancel.calendar.msg': string;
184
185
  'page.booking.text.go-to-payments': string;
185
186
  'page.booking.text.cancel-only': string;
186
187
  'page.booking.text.refund': string;
@@ -376,6 +377,7 @@ declare const _default: {
376
377
  'page.event.booking.text.duplicate-enrollment-confirm': string;
377
378
  'page.booking.text.unconfirmed-payments': string;
378
379
  'page.booking.text.unconfirmed-payments.msg': string;
380
+ 'page.booking.text.cancel.calendar.msg': string;
379
381
  'page.booking.text.go-to-payments': string;
380
382
  'page.booking.text.cancel-only': string;
381
383
  'page.booking.text.refund': string;
@@ -571,6 +573,7 @@ declare const _default: {
571
573
  'page.event.booking.text.duplicate-enrollment-confirm': string;
572
574
  'page.booking.text.unconfirmed-payments': string;
573
575
  'page.booking.text.unconfirmed-payments.msg': string;
576
+ 'page.booking.text.cancel.calendar.msg': string;
574
577
  'page.booking.text.go-to-payments': string;
575
578
  'page.booking.text.cancel-only': string;
576
579
  'page.booking.text.refund': string;
@@ -237,6 +237,7 @@ var locales_default = {
237
237
  "page.event.booking.text.duplicate-enrollment-confirm": "Confirm",
238
238
  "page.booking.text.unconfirmed-payments": "Unconfirmed payments",
239
239
  "page.booking.text.unconfirmed-payments.msg": "There are unconfirmed payments, please confirm or void the payments first.",
240
+ "page.booking.text.cancel.calendar.msg": "Are you sure you want to cancel the appointment? This appointment will be removed from the calendar.",
240
241
  "page.booking.text.go-to-payments": "Go to payments",
241
242
  "page.booking.text.cancel-only": "Cancel only",
242
243
  "page.booking.text.refund": "Refund",
@@ -458,6 +459,7 @@ var locales_default = {
458
459
  "page.event.booking.text.duplicate-enrollment-confirm": "确认",
459
460
  "page.booking.text.unconfirmed-payments": "未确认的付款",
460
461
  "page.booking.text.unconfirmed-payments.msg": "存在未确认的付款,请先确认收款或作废。",
462
+ "page.booking.text.cancel.calendar.msg": "确定要取消预约吗?此预约将从日历中移除。",
461
463
  "page.booking.text.go-to-payments": "前往收款界面",
462
464
  "page.booking.text.cancel-only": "仅取消",
463
465
  "page.booking.text.refund": "退款",
@@ -679,6 +681,7 @@ var locales_default = {
679
681
  "page.event.booking.text.duplicate-enrollment-confirm": "確認",
680
682
  "page.booking.text.unconfirmed-payments": "未確認的付款",
681
683
  "page.booking.text.unconfirmed-payments.msg": "存在未確認的付款,請先確認收款或作廢。",
684
+ "page.booking.text.cancel.calendar.msg": "確定要取消預約嗎?此預約將從日曆中移除。",
682
685
  "page.booking.text.go-to-payments": "前往收款界面",
683
686
  "page.booking.text.cancel-only": "僅取消",
684
687
  "page.booking.text.refund": "退款",
@@ -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,70 @@
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/components/eftpos/deviceList/index.tsx
30
+ var deviceList_exports = {};
31
+ __export(deviceList_exports, {
32
+ default: () => deviceList_default
33
+ });
34
+ module.exports = __toCommonJS(deviceList_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_antd = require("antd");
37
+ var import_group = require("../group");
38
+ var DeviceList = (props) => {
39
+ const [form] = import_antd.Form.useForm();
40
+ const { list, onChange } = props;
41
+ console.log(list);
42
+ const onValuesChange = () => {
43
+ const val = Object.values(form.getFieldsValue()).flat();
44
+ onChange(val);
45
+ };
46
+ const initialValues = (0, import_react.useMemo)(() => {
47
+ return list.reduce((target, item) => {
48
+ var _a, _b;
49
+ return {
50
+ ...target,
51
+ [item.name]: ((_a = item == null ? void 0 : item.input) == null ? void 0 : _a.value) || ((_b = item == null ? void 0 : item.input) == null ? void 0 : _b.defaultValue)
52
+ };
53
+ }, {});
54
+ }, [list]);
55
+ return /* @__PURE__ */ import_react.default.createElement(
56
+ import_antd.Form,
57
+ {
58
+ layout: "vertical",
59
+ onValuesChange,
60
+ form,
61
+ initialValues
62
+ },
63
+ list.map(({ input, ...formItemProps }) => {
64
+ return /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { ...formItemProps }, /* @__PURE__ */ import_react.default.createElement(import_group.CheckboxGroup, { ...input }));
65
+ })
66
+ );
67
+ };
68
+ var deviceList_default = ({ input, ...formItemProps }) => {
69
+ return /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { ...formItemProps }, /* @__PURE__ */ import_react.default.createElement(DeviceList, { ...input }));
70
+ };
@@ -35,44 +35,16 @@ __export(form_exports, {
35
35
  module.exports = __toCommonJS(form_exports);
36
36
  var import_react = __toESM(require("react"));
37
37
  var import_antd = require("antd");
38
+ var import_group = require("../group");
38
39
  var import_surcharge = __toESM(require("../surcharge"));
40
+ var import_deviceList = __toESM(require("../deviceList"));
39
41
  var Mapping = {
40
42
  Input: import_antd.Input,
41
43
  InputNumber: import_antd.InputNumber,
42
44
  Checkbox: import_antd.Checkbox,
43
- "Checkbox.Group": ({
44
- direction,
45
- options,
46
- ...props
47
- }) => {
48
- if (direction === "vertical") {
49
- return /* @__PURE__ */ import_react.default.createElement(import_antd.Checkbox.Group, { ...props }, /* @__PURE__ */ import_react.default.createElement(import_antd.Space, { direction }, options == null ? void 0 : options.map((item) => {
50
- if (typeof item === "object") {
51
- const { label, value, ...other } = item;
52
- return /* @__PURE__ */ import_react.default.createElement(import_antd.Checkbox, { ...other, value, key: `${item.value}` }, label);
53
- }
54
- return /* @__PURE__ */ import_react.default.createElement(import_antd.Checkbox, { value: item, key: `${item}` }, item);
55
- })));
56
- }
57
- return /* @__PURE__ */ import_react.default.createElement(import_antd.Checkbox.Group, { ...props, options });
58
- },
45
+ "Checkbox.Group": import_group.CheckboxGroup,
59
46
  Radio: import_antd.Radio,
60
- "Radio.Group": ({
61
- direction,
62
- options,
63
- ...props
64
- }) => {
65
- if (direction === "vertical") {
66
- return /* @__PURE__ */ import_react.default.createElement(import_antd.Radio.Group, { ...props }, /* @__PURE__ */ import_react.default.createElement(import_antd.Space, { direction: "vertical" }, options == null ? void 0 : options.map((item) => {
67
- if (typeof item === "object") {
68
- const { label, value, ...other } = item;
69
- return /* @__PURE__ */ import_react.default.createElement(import_antd.Radio, { ...other, value, key: `${item.value}` }, label);
70
- }
71
- return /* @__PURE__ */ import_react.default.createElement(import_antd.Radio, { value: item, key: `${item}` }, item);
72
- })));
73
- }
74
- return /* @__PURE__ */ import_react.default.createElement(import_antd.Radio.Group, { ...props, options });
75
- },
47
+ "Radio.Group": import_group.RadioGroup,
76
48
  "Radio.Button": import_antd.Radio.Button,
77
49
  Cascader: import_antd.Cascader,
78
50
  DatePicker: import_antd.DatePicker,
@@ -85,7 +57,8 @@ var Mapping = {
85
57
  Upload: import_antd.Upload
86
58
  };
87
59
  var CustomMapping = {
88
- Surcharge: import_surcharge.default
60
+ Surcharge: import_surcharge.default,
61
+ DeviceList: import_deviceList.default
89
62
  };
90
63
  var CustomFormItem = ({
91
64
  formItemList,
@@ -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,75 @@
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/components/eftpos/group/index.tsx
30
+ var group_exports = {};
31
+ __export(group_exports, {
32
+ CheckboxGroup: () => CheckboxGroup,
33
+ RadioGroup: () => RadioGroup
34
+ });
35
+ module.exports = __toCommonJS(group_exports);
36
+ var import_react = __toESM(require("react"));
37
+ var import_antd = require("antd");
38
+ var CheckboxGroup = ({
39
+ direction,
40
+ options,
41
+ ...props
42
+ }) => {
43
+ if (direction === "vertical") {
44
+ return /* @__PURE__ */ import_react.default.createElement(import_antd.Checkbox.Group, { ...props }, /* @__PURE__ */ import_react.default.createElement(import_antd.Space, { direction }, options == null ? void 0 : options.map((item) => {
45
+ if (typeof item === "object") {
46
+ const { label, value, ...other } = item;
47
+ return /* @__PURE__ */ import_react.default.createElement(import_antd.Checkbox, { ...other, value, key: `${item.value}` }, label);
48
+ }
49
+ return /* @__PURE__ */ import_react.default.createElement(import_antd.Checkbox, { value: item, key: `${item}` }, item);
50
+ })));
51
+ }
52
+ return /* @__PURE__ */ import_react.default.createElement(import_antd.Checkbox.Group, { ...props, options });
53
+ };
54
+ var RadioGroup = ({
55
+ direction,
56
+ options,
57
+ component,
58
+ ...props
59
+ }) => {
60
+ if (direction === "vertical") {
61
+ return /* @__PURE__ */ import_react.default.createElement(import_antd.Radio.Group, { ...props }, /* @__PURE__ */ import_react.default.createElement(import_antd.Space, { direction: "vertical" }, options == null ? void 0 : options.map((item) => {
62
+ if (typeof item === "object") {
63
+ const { label, value, ...other } = item;
64
+ return /* @__PURE__ */ import_react.default.createElement(import_antd.Radio, { ...other, value, key: `${item.value}` }, label);
65
+ }
66
+ return /* @__PURE__ */ import_react.default.createElement(import_antd.Radio, { value: item, key: `${item}` }, item);
67
+ })));
68
+ }
69
+ return /* @__PURE__ */ import_react.default.createElement(import_antd.Radio.Group, { ...props, options });
70
+ };
71
+ // Annotate the CommonJS export names for ESM import in node:
72
+ 0 && (module.exports = {
73
+ CheckboxGroup,
74
+ RadioGroup
75
+ });
@@ -45,11 +45,11 @@ var manual_default = ({ onChange, className = "", formatAmount }) => {
45
45
  const dispatch = (0, import_store.useDispatch)();
46
46
  const { symbol, manual, order_id, mode, device, number, pay, amount } = (0, import_store.useContextData)();
47
47
  const start = (0, import_react.useMemo)(() => {
48
- if (typeof (manual == null ? void 0 : manual.money) === "number") {
49
- return manual == null ? void 0 : manual.money;
48
+ if (typeof (manual == null ? void 0 : manual.money) === "number" || typeof (manual == null ? void 0 : manual.money) === "string") {
49
+ return Number(manual == null ? void 0 : manual.money);
50
50
  }
51
- if (typeof (pay == null ? void 0 : pay.total) === "number") {
52
- return pay == null ? void 0 : pay.total;
51
+ if (typeof (pay == null ? void 0 : pay.total) === "number" || typeof (pay == null ? void 0 : pay.total) === "string") {
52
+ return Number(pay == null ? void 0 : pay.total);
53
53
  }
54
54
  return amount;
55
55
  }, [manual == null ? void 0 : manual.money, pay == null ? void 0 : pay.total, amount]);
@@ -61,17 +61,6 @@ var manual_default = ({ onChange, className = "", formatAmount }) => {
61
61
  if (disabled) {
62
62
  return;
63
63
  }
64
- if (mode === import_const.ModeEnum.Pay) {
65
- setDisabled(true);
66
- const obj = pay || {};
67
- onChange("success", {
68
- ...obj,
69
- number,
70
- device,
71
- order_id
72
- });
73
- return;
74
- }
75
64
  if (mode === import_const.ModeEnum.Refund) {
76
65
  setDisabled(true);
77
66
  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 {};
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  var helper_exports = {};
21
21
  __export(helper_exports, {
22
22
  cloneDeep: () => cloneDeep,
23
+ getAmonunt: () => getAmonunt,
23
24
  getPayParams: () => getPayParams,
24
25
  getUuid: () => getUuid,
25
26
  limitDecimals: () => limitDecimals,
@@ -116,9 +117,57 @@ var limitDecimals = (value) => {
116
117
  }
117
118
  return "";
118
119
  };
120
+ function getAmonunt(store) {
121
+ const { device, pay, custom, name, symbol, amount } = store;
122
+ if (!device || !custom) {
123
+ throw Error("device or custom is not defined");
124
+ }
125
+ const setting = device.setting;
126
+ if (pay) {
127
+ return {
128
+ name,
129
+ symbol,
130
+ // format,
131
+ money: Number(amount),
132
+ amount: Number(pay.amount),
133
+ surRate: Number(pay.surRate),
134
+ surMoney: Number(pay.surMoney),
135
+ surcharge: (setting == null ? void 0 : setting.surcharge) || false,
136
+ useOriginSurcharge: (pay == null ? void 0 : pay.useOriginSurcharge) || false
137
+ };
138
+ }
139
+ if (!setting) {
140
+ return {
141
+ name,
142
+ symbol,
143
+ // format,
144
+ money: Number(amount),
145
+ amount: Number(amount),
146
+ surRate: 0,
147
+ surMoney: 0,
148
+ surcharge: false,
149
+ useOriginSurcharge: false
150
+ };
151
+ }
152
+ const useOriginSurcharge = setting.useOriginSurcharge || false;
153
+ const surRate = setting.constant_rate || 0;
154
+ const surMoney = setting.constant_money || 0;
155
+ const surcharge = setting.surcharge;
156
+ return {
157
+ name,
158
+ symbol,
159
+ money: Number(amount),
160
+ amount: Number(amount),
161
+ surRate: useOriginSurcharge ? 0 : surcharge ? surRate : 0,
162
+ surMoney: useOriginSurcharge ? 0 : surcharge ? surMoney : 0,
163
+ surcharge,
164
+ useOriginSurcharge
165
+ };
166
+ }
119
167
  // Annotate the CommonJS export names for ESM import in node:
120
168
  0 && (module.exports = {
121
169
  cloneDeep,
170
+ getAmonunt,
122
171
  getPayParams,
123
172
  getUuid,
124
173
  limitDecimals,
@@ -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;