@pisell/private-materials 6.6.102 → 6.6.103

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 (81) 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/meta.js +1 -1
  5. package/build/lowcode/render/default/view.js +1 -1
  6. package/build/lowcode/view.js +1 -1
  7. package/es/components/Sales/Summary/utils.d.ts +1 -1
  8. package/es/components/booking/addons/model.d.ts +10 -1
  9. package/es/components/booking/forms/model.d.ts +10 -1
  10. package/es/components/booking/forms/sendModal/useSendModal.d.ts +1 -1
  11. package/es/components/booking/info/model.d.ts +10 -1
  12. package/es/components/booking/info/service/addService/utils.d.ts +1 -1
  13. package/es/components/booking/info2/service/addService/utils.d.ts +1 -1
  14. package/es/components/booking/model.d.ts +9 -1
  15. package/es/components/booking/notes/model.d.ts +10 -1
  16. package/es/components/booking/payments/model.d.ts +10 -1
  17. package/es/components/booking/utils.d.ts +2 -2
  18. package/es/components/eftpos/const.d.ts +2 -0
  19. package/es/components/eftpos/const.js +25 -2
  20. package/es/components/eftpos/device.d.ts +1 -0
  21. package/es/components/eftpos/device.js +9 -4
  22. package/es/components/eftpos/form/index.d.ts +2 -1
  23. package/es/components/eftpos/form/index.js +7 -2
  24. package/es/components/eftpos/index.js +5 -0
  25. package/es/components/eftpos/pos.d.ts +2 -1
  26. package/es/components/eftpos/pos.js +9 -4
  27. package/es/components/eftpos/surcharge/index.js +13 -1
  28. package/es/components/eftposPay/amount.js +20 -5
  29. package/es/components/eftposPay/hooks.d.ts +1 -1
  30. package/es/components/eftposPay/store/index.d.ts +4 -4
  31. package/es/components/pay/toC/model.d.ts +9 -1
  32. package/es/components/schedules/model.d.ts +9 -1
  33. package/es/components/ticketBooking/utils/index.d.ts +1 -1
  34. package/es/hooks/useCardSurchargeReadOnly.d.ts +4 -0
  35. package/es/hooks/useCardSurchargeReadOnly.js +61 -0
  36. package/es/plus/productSelect/ProductCard/SkuCard/components/Capacity/index.d.ts +1 -1
  37. package/es/plus/productSelect/ProductCard/SkuCard/components/CardMask/index.d.ts +1 -1
  38. package/es/plus/productSelect/ProductCard/SkuCard/components/Countdown/index.d.ts +1 -1
  39. package/es/plus/productSelect/ProductCard/SkuCard/components/Duration/index.d.ts +1 -1
  40. package/es/plus/productSelect/ProductCard/SkuCard/components/MemberPrice/index.d.ts +1 -1
  41. package/es/plus/productSelect/ProductCard/SkuCard/components/Resource/index.d.ts +1 -1
  42. package/es/plus/productSelect/ProductCard/SkuCard/components/Stock/index.d.ts +1 -1
  43. package/es/plus/productSelect/ProductCard/SkuCard/components/Time/index.d.ts +1 -1
  44. package/lib/components/Sales/Summary/utils.d.ts +1 -1
  45. package/lib/components/booking/addons/model.d.ts +10 -1
  46. package/lib/components/booking/forms/model.d.ts +10 -1
  47. package/lib/components/booking/forms/sendModal/useSendModal.d.ts +1 -1
  48. package/lib/components/booking/info/model.d.ts +10 -1
  49. package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
  50. package/lib/components/booking/info2/service/addService/utils.d.ts +1 -1
  51. package/lib/components/booking/model.d.ts +9 -1
  52. package/lib/components/booking/notes/model.d.ts +10 -1
  53. package/lib/components/booking/payments/model.d.ts +10 -1
  54. package/lib/components/booking/utils.d.ts +2 -2
  55. package/lib/components/eftpos/const.d.ts +2 -0
  56. package/lib/components/eftpos/const.js +18 -2
  57. package/lib/components/eftpos/device.d.ts +1 -0
  58. package/lib/components/eftpos/device.js +11 -3
  59. package/lib/components/eftpos/form/index.d.ts +2 -1
  60. package/lib/components/eftpos/form/index.js +11 -2
  61. package/lib/components/eftpos/index.js +5 -0
  62. package/lib/components/eftpos/pos.d.ts +2 -1
  63. package/lib/components/eftpos/pos.js +15 -3
  64. package/lib/components/eftpos/surcharge/index.js +41 -8
  65. package/lib/components/eftposPay/amount.js +26 -3
  66. package/lib/components/eftposPay/hooks.d.ts +1 -1
  67. package/lib/components/eftposPay/store/index.d.ts +4 -4
  68. package/lib/components/pay/toC/model.d.ts +9 -1
  69. package/lib/components/schedules/model.d.ts +9 -1
  70. package/lib/components/ticketBooking/utils/index.d.ts +1 -1
  71. package/lib/hooks/useCardSurchargeReadOnly.d.ts +4 -0
  72. package/lib/hooks/useCardSurchargeReadOnly.js +86 -0
  73. package/lib/plus/productSelect/ProductCard/SkuCard/components/Capacity/index.d.ts +1 -1
  74. package/lib/plus/productSelect/ProductCard/SkuCard/components/CardMask/index.d.ts +1 -1
  75. package/lib/plus/productSelect/ProductCard/SkuCard/components/Countdown/index.d.ts +1 -1
  76. package/lib/plus/productSelect/ProductCard/SkuCard/components/Duration/index.d.ts +1 -1
  77. package/lib/plus/productSelect/ProductCard/SkuCard/components/MemberPrice/index.d.ts +1 -1
  78. package/lib/plus/productSelect/ProductCard/SkuCard/components/Resource/index.d.ts +1 -1
  79. package/lib/plus/productSelect/ProductCard/SkuCard/components/Stock/index.d.ts +1 -1
  80. package/lib/plus/productSelect/ProductCard/SkuCard/components/Time/index.d.ts +1 -1
  81. package/package.json +2 -2
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { CalendarDataItem, ScheduleItem } from "./type";
2
3
  import dayjs from "dayjs";
3
4
  export interface FormState {
@@ -68,4 +69,11 @@ export interface FormState {
68
69
  };
69
70
  setGlobalState: Function | null;
70
71
  }
71
- export declare const Provider: any, Context: any;
72
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
73
+ state: FormState;
74
+ } & {
75
+ dispatch: (params: {
76
+ type: string;
77
+ payload: any;
78
+ }) => void;
79
+ }>;
@@ -47,7 +47,7 @@ declare type ScanData = {
47
47
  };
48
48
  };
49
49
  export declare const formatScanCustomer: (data: ScanData) => {
50
- searchType: "product" | "customer" | "wallet" | "walletPass" | "local_product";
50
+ searchType: "customer" | "product" | "wallet" | "walletPass" | "local_product";
51
51
  data: any;
52
52
  scanCode: string;
53
53
  } | null;
@@ -0,0 +1,4 @@
1
+ /** POS opts in only for payment amount pages; configuration keeps the Shop policy. */
2
+ export default function useCardSurchargeReadOnly(paymentType: string, { includePos }?: {
3
+ includePos?: boolean;
4
+ }): boolean;
@@ -0,0 +1,61 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ 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."); }
3
+ 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); }
4
+ 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; }
5
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import { useCallback, useEffect, useState } from 'react';
8
+ import useEngineContext from "./useEngineContext";
9
+ var cardEftposTypes = new Set(['payo', 'tyro', 'windcave', 'stripe', 'linkly', 'mx51', 'adyenpos']);
10
+
11
+ /** POS opts in only for payment amount pages; configuration keeps the Shop policy. */
12
+ export default function useCardSurchargeReadOnly(paymentType) {
13
+ var _context$appHelper, _context$appHelper2;
14
+ var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
15
+ _ref$includePos = _ref.includePos,
16
+ includePos = _ref$includePos === void 0 ? false : _ref$includePos;
17
+ var context = useEngineContext();
18
+ var _ref2 = (context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.constants) || {},
19
+ platform = _ref2.platform;
20
+ var _ref3 = (context === null || context === void 0 || (_context$appHelper2 = context.appHelper) === null || _context$appHelper2 === void 0 ? void 0 : _context$appHelper2.utils) || {},
21
+ store = _ref3.store,
22
+ getData = _ref3.getData,
23
+ isCardSurchargeReadOnly = _ref3.isCardSurchargeReadOnly;
24
+ var isPosCardPayment = includePos && (platform === 'webpos' || platform === 'pos') && cardEftposTypes.has(paymentType.toLowerCase().replace(/^eftpos_/, ''));
25
+ var getReadOnly = useCallback(function () {
26
+ var _store$getState, _state$core, _state$core2;
27
+ if (platform === 'shop') {
28
+ return typeof isCardSurchargeReadOnly === 'function' && Boolean(isCardSurchargeReadOnly(paymentType));
29
+ }
30
+ if (!isPosCardPayment) return false;
31
+
32
+ // shop_info comes from /shop/shop/show/:id and contains the saved address.
33
+ // Missing or stale shop details keep the entry closed while loading.
34
+ var state = store === null || store === void 0 || (_store$getState = store.getState) === null || _store$getState === void 0 ? void 0 : _store$getState.call(store);
35
+ var shopInfo = (state === null || state === void 0 || (_state$core = state.core) === null || _state$core === void 0 ? void 0 : _state$core.shopInfo) || (getData === null || getData === void 0 ? void 0 : getData('shop_info'));
36
+ var shopId = state === null || state === void 0 || (_state$core2 = state.core) === null || _state$core2 === void 0 || (_state$core2 = _state$core2.core) === null || _state$core2 === void 0 ? void 0 : _state$core2.id;
37
+ if (shopId != null && (shopInfo === null || shopInfo === void 0 ? void 0 : shopInfo.id) != null && String(shopId) !== String(shopInfo.id)) {
38
+ return true;
39
+ }
40
+ var countryCode = String((shopInfo === null || shopInfo === void 0 ? void 0 : shopInfo.country_code) || '').toUpperCase();
41
+ return !countryCode || countryCode === 'AU';
42
+ }, [platform, isCardSurchargeReadOnly, paymentType, isPosCardPayment, store, getData]);
43
+ var _useState = useState(getReadOnly),
44
+ _useState2 = _slicedToArray(_useState, 2),
45
+ setReadOnly = _useState2[1];
46
+ useEffect(function () {
47
+ var _store$subscribe;
48
+ if (!isPosCardPayment && (platform !== 'shop' || typeof isCardSurchargeReadOnly !== 'function')) {
49
+ return;
50
+ }
51
+ var update = function update() {
52
+ return setReadOnly(getReadOnly());
53
+ };
54
+ var unsubscribe = store === null || store === void 0 || (_store$subscribe = store.subscribe) === null || _store$subscribe === void 0 ? void 0 : _store$subscribe.call(store, update);
55
+ update();
56
+ return function () {
57
+ return unsubscribe === null || unsubscribe === void 0 ? void 0 : unsubscribe();
58
+ };
59
+ }, [store, getReadOnly, platform, isCardSurchargeReadOnly, isPosCardPayment]);
60
+ return getReadOnly();
61
+ }
@@ -2,5 +2,5 @@ import React from 'react';
2
2
  import { ProductCardConfig } from '../../type';
3
3
  declare const Capacity: ({ props }: {
4
4
  props: ProductCardConfig;
5
- }) => string | number | true | React.ReactFragment | JSX.Element | null;
5
+ }) => string | number | true | JSX.Element | React.ReactFragment | null;
6
6
  export default Capacity;
@@ -3,5 +3,5 @@ import { SkuStatusOverlayConfig } from '../../type';
3
3
  import './index.less';
4
4
  declare const CardMask: ({ props }: {
5
5
  props: SkuStatusOverlayConfig;
6
- }) => string | number | true | React.ReactFragment | JSX.Element | null;
6
+ }) => string | number | true | JSX.Element | React.ReactFragment | null;
7
7
  export default CardMask;
@@ -3,5 +3,5 @@ import { ProductCardConfig } from '../../type';
3
3
  import './index.less';
4
4
  declare const Countdown: ({ props }: {
5
5
  props: ProductCardConfig;
6
- }) => string | number | true | React.ReactFragment | JSX.Element | null;
6
+ }) => string | number | true | JSX.Element | React.ReactFragment | null;
7
7
  export default Countdown;
@@ -2,5 +2,5 @@ import React from 'react';
2
2
  import { ProductCardConfig } from '../../type';
3
3
  declare const Duration: ({ props }: {
4
4
  props: ProductCardConfig;
5
- }) => string | number | true | React.ReactFragment | JSX.Element | null;
5
+ }) => string | number | true | JSX.Element | React.ReactFragment | null;
6
6
  export default Duration;
@@ -3,5 +3,5 @@ import { ProductCardConfig } from '../../type';
3
3
  import './index.less';
4
4
  declare const MemberPrice: ({ props }: {
5
5
  props: ProductCardConfig;
6
- }) => string | number | true | React.ReactFragment | JSX.Element | null;
6
+ }) => string | number | true | JSX.Element | React.ReactFragment | null;
7
7
  export default MemberPrice;
@@ -2,5 +2,5 @@ import React from 'react';
2
2
  import { ProductCardConfig } from '../../type';
3
3
  declare const Resource: ({ props }: {
4
4
  props: ProductCardConfig;
5
- }) => string | number | true | React.ReactFragment | JSX.Element | null;
5
+ }) => string | number | true | JSX.Element | React.ReactFragment | null;
6
6
  export default Resource;
@@ -2,5 +2,5 @@ import React from 'react';
2
2
  import { ProductCardConfig } from '../../type';
3
3
  declare const Stock: ({ props }: {
4
4
  props: ProductCardConfig;
5
- }) => string | number | true | React.ReactFragment | JSX.Element | null;
5
+ }) => string | number | true | JSX.Element | React.ReactFragment | null;
6
6
  export default Stock;
@@ -2,5 +2,5 @@ import React from 'react';
2
2
  import { ProductCardConfig } from '../../type';
3
3
  declare const Time: ({ props }: {
4
4
  props: ProductCardConfig;
5
- }) => string | number | true | React.ReactFragment | JSX.Element | null;
5
+ }) => string | number | true | JSX.Element | React.ReactFragment | null;
6
6
  export default Time;
@@ -30,7 +30,7 @@ export declare const calculateSubtotal: (items: CartItem[]) => string;
30
30
  * @return {*}
31
31
  * @Author: xiangfeng.xue
32
32
  */
33
- export declare const calculateTaxFee: (shopInfo: any, items: CartItem[]) => "0.00" | Decimal;
33
+ export declare const calculateTaxFee: (shopInfo: any, items: CartItem[]) => Decimal | "0.00";
34
34
  /**
35
35
  * 计算所有价格明细
36
36
  * @param items - 购物车商品数组
@@ -1 +1,10 @@
1
- export declare const Provider: any, Context: any;
1
+ /// <reference types="react" />
2
+ import { FormState } from "../model";
3
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
4
+ state: FormState;
5
+ } & {
6
+ dispatch: (params: {
7
+ type: string;
8
+ payload: any;
9
+ }) => void;
10
+ }>;
@@ -1 +1,10 @@
1
- export declare const Provider: any, Context: any;
1
+ /// <reference types="react" />
2
+ import { FormState } from "../model";
3
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
4
+ state: FormState;
5
+ } & {
6
+ dispatch: (params: {
7
+ type: string;
8
+ payload: any;
9
+ }) => void;
10
+ }>;
@@ -4,6 +4,6 @@ declare const useSendModal: (bookingId?: number) => {
4
4
  setOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
5
5
  handleOpen: () => void;
6
6
  handleValuesChange: (val: any) => void;
7
- handleOk: (values: SendModalValues) => Promise<boolean | undefined>;
7
+ handleOk: (values: SendModalValues) => Promise<any>;
8
8
  };
9
9
  export default useSendModal;
@@ -1,5 +1,14 @@
1
+ /// <reference types="react" />
2
+ import { FormState } from '../model';
1
3
  export declare const walkInData: {
2
4
  id: number;
3
5
  nickname: string;
4
6
  };
5
- export declare const Provider: any, Context: any;
7
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
8
+ state: FormState;
9
+ } & {
10
+ dispatch: (params: {
11
+ type: string;
12
+ payload: any;
13
+ }) => void;
14
+ }>;
@@ -6,7 +6,7 @@ export declare const getDurationProps: ({ cacheItem, useStartTime, currentResour
6
6
  type: string;
7
7
  value: number;
8
8
  };
9
- locale: any;
9
+ locale: string;
10
10
  slice: any;
11
11
  selectProps: {
12
12
  size: string;
@@ -7,7 +7,7 @@ export declare const getDurationProps: ({ cacheItem, useStartTime, currentResour
7
7
  type: string;
8
8
  value: number;
9
9
  };
10
- locale: any;
10
+ locale: string;
11
11
  slice: any;
12
12
  selectProps: {
13
13
  size: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export interface FormState {
2
3
  amountSymbol: string;
3
4
  apis: {
@@ -109,4 +110,11 @@ export declare const walkInData: {
109
110
  id: number;
110
111
  nickname: string;
111
112
  };
112
- export declare const Provider: any, Context: any;
113
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
114
+ state: FormState;
115
+ } & {
116
+ dispatch: (params: {
117
+ type: string;
118
+ payload: any;
119
+ }) => void;
120
+ }>;
@@ -1 +1,10 @@
1
- export declare const Provider: any, Context: any;
1
+ /// <reference types="react" />
2
+ import { FormState } from "../model";
3
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
4
+ state: FormState;
5
+ } & {
6
+ dispatch: (params: {
7
+ type: string;
8
+ payload: any;
9
+ }) => void;
10
+ }>;
@@ -1 +1,10 @@
1
- export declare const Provider: any, Context: any;
1
+ /// <reference types="react" />
2
+ import { FormState } from "../model";
3
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
4
+ state: FormState;
5
+ } & {
6
+ dispatch: (params: {
7
+ type: string;
8
+ payload: any;
9
+ }) => void;
10
+ }>;
@@ -175,10 +175,10 @@ export declare const getProductOriginTotalPrice: (item: any) => number;
175
175
  export declare const getDuration: (duration: number | {
176
176
  type: string;
177
177
  value: number;
178
- }) => number | {
178
+ }) => number | "flexible" | {
179
179
  type: string;
180
180
  value: number;
181
- } | "flexible";
181
+ };
182
182
  export declare const isWalkIn: (customer_id?: number | string) => boolean;
183
183
  export declare const getIsEdit: (state: any) => boolean;
184
184
  export {};
@@ -50,6 +50,8 @@ export interface DeviceProp {
50
50
  * @Date: 2024-08-19 11:10
51
51
  */
52
52
  export declare const getDefaultValue: (list: any) => any;
53
+ /** Preserve fee fields when saving unrelated device or merchant settings. */
54
+ export declare const preserveSurchargeValues: (values: any, list: any[]) => any;
53
55
  /**
54
56
  * @title: 构建通用表单配置信息,构建动态表单
55
57
  * @description:
@@ -23,7 +23,8 @@ __export(const_exports, {
23
23
  Eftpos: () => Eftpos,
24
24
  TYPES_WITH_MERCHANT_SETTINGS: () => TYPES_WITH_MERCHANT_SETTINGS,
25
25
  getCommByFields: () => getCommByFields,
26
- getDefaultValue: () => getDefaultValue
26
+ getDefaultValue: () => getDefaultValue,
27
+ preserveSurchargeValues: () => preserveSurchargeValues
27
28
  });
28
29
  module.exports = __toCommonJS(const_exports);
29
30
  var import_form = require("./form");
@@ -71,6 +72,20 @@ var getDefaultValue = (list) => {
71
72
  };
72
73
  }, {});
73
74
  };
75
+ var preserveSurchargeValues = (values, list) => {
76
+ const result = { ...values };
77
+ for (const item of list) {
78
+ if (Array.isArray(item.children) && item.children.length) {
79
+ result[item.__sourceName] = preserveSurchargeValues(
80
+ values == null ? void 0 : values[item.__sourceName],
81
+ item.children
82
+ );
83
+ } else if (item.Component === "Surcharge") {
84
+ Object.assign(result, import_form.helpMapping.Surcharge.getCommDefaultVal(item));
85
+ }
86
+ }
87
+ return result;
88
+ };
74
89
  async function getCommByFields({
75
90
  field,
76
91
  value,
@@ -129,5 +144,6 @@ async function getCommByFields({
129
144
  Eftpos,
130
145
  TYPES_WITH_MERCHANT_SETTINGS,
131
146
  getCommByFields,
132
- getDefaultValue
147
+ getDefaultValue,
148
+ preserveSurchargeValues
133
149
  });
@@ -5,6 +5,7 @@ interface DeviceProps {
5
5
  onSave: (device: DeviceProp) => void;
6
6
  children?: React.ReactNode;
7
7
  type?: Eftpos;
8
+ surchargeReadOnly?: boolean;
8
9
  status?: 'add' | 'edit' | 'repair';
9
10
  }
10
11
  declare const Device: (props: DeviceProps) => JSX.Element;
@@ -38,7 +38,7 @@ var import_utils = require("@pisell/utils");
38
38
  var import_const = require("./const");
39
39
  var import_form = __toESM(require("./form"));
40
40
  var Device = (props) => {
41
- const { onSave, children, formItemList } = props;
41
+ const { onSave, children, formItemList, surchargeReadOnly = false } = props;
42
42
  const initialValues = (0, import_const.getDefaultValue)(formItemList);
43
43
  const simpleCloudIntegrationSteps = import_utils.locales.getText(
44
44
  "page.eftpos.text.simple.cloud.integration.steps"
@@ -54,11 +54,19 @@ var Device = (props) => {
54
54
  import_antd.Form,
55
55
  {
56
56
  layout: "vertical",
57
- onFinish: onSave,
57
+ onFinish: (values) => onSave(
58
+ surchargeReadOnly ? (0, import_const.preserveSurchargeValues)(values, formItemList) : values
59
+ ),
58
60
  initialValues,
59
61
  className: "pisell-lowcode__pos-device"
60
62
  },
61
- /* @__PURE__ */ import_react.default.createElement("div", { style: { flex: 1, overflow: "auto", padding: "0 0 60px 0" } }, /* @__PURE__ */ import_react.default.createElement(import_form.default, { formItemList }), children),
63
+ /* @__PURE__ */ import_react.default.createElement("div", { style: { flex: 1, overflow: "auto", padding: "0 0 60px 0" } }, /* @__PURE__ */ import_react.default.createElement(
64
+ import_form.default,
65
+ {
66
+ formItemList,
67
+ surchargeReadOnly
68
+ }
69
+ ), children),
62
70
  /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { className: "pisell-lowcode__pos-device-btn" }, /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { htmlType: "submit", block: true, style: { height: "48px" } }, (props == null ? void 0 : props.status) === "edit" ? import_utils.locales.getText("page.eftpos.text.save") : import_utils.locales.getText("page.eftpos.text.pair")))
63
71
  ));
64
72
  };
@@ -3,10 +3,11 @@
3
3
  * @Author: hongbing.wang
4
4
  * @Date: 2024-08-20 13:21
5
5
  */
6
- declare const CustomFormItem: ({ formItemList, level, onChange, }: {
6
+ declare const CustomFormItem: ({ formItemList, level, onChange, surchargeReadOnly, }: {
7
7
  formItemList: any[];
8
8
  level?: number | undefined;
9
9
  onChange?: ((...agrn: unknown[]) => unknown) | undefined;
10
+ surchargeReadOnly?: boolean | undefined;
10
11
  }) => JSX.Element;
11
12
  export default CustomFormItem;
12
13
  declare type helpMappingType = {
@@ -65,7 +65,8 @@ var CustomMapping = {
65
65
  var CustomFormItem = ({
66
66
  formItemList,
67
67
  level = 0,
68
- onChange
68
+ onChange,
69
+ surchargeReadOnly = false
69
70
  }) => {
70
71
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, formItemList.map(({ __sourceName, Component, ...item }, index) => {
71
72
  if (Array.isArray(item.children)) {
@@ -74,6 +75,7 @@ var CustomFormItem = ({
74
75
  {
75
76
  formItemList: item.children,
76
77
  onChange,
78
+ surchargeReadOnly,
77
79
  key: item.name ? `${item.name}${level}` : `${Component}${index}${level}`,
78
80
  level: level + 1
79
81
  }
@@ -94,7 +96,14 @@ var CustomFormItem = ({
94
96
  }
95
97
  if (CustomMapping[Component]) {
96
98
  const Comm = CustomMapping[Component];
97
- return /* @__PURE__ */ import_react.default.createElement(Comm, { ...item, key: `${item.name}${level}` });
99
+ return /* @__PURE__ */ import_react.default.createElement(
100
+ Comm,
101
+ {
102
+ ...item,
103
+ ...Component === "Surcharge" ? { surchargeReadOnly } : {},
104
+ key: `${item.name}${level}`
105
+ }
106
+ );
98
107
  }
99
108
  throw TypeError(
100
109
  `pos物料库 输入组件类型 ${Component} 无法映射,请正确传入组件类型`
@@ -51,6 +51,7 @@ var import_const = require("./const");
51
51
  var import_materials = require("@pisell/materials");
52
52
  var import_mx51SCI = __toESM(require("./assets/mx51SCI.svg"));
53
53
  var import_useEngineContext = __toESM(require("../../hooks/useEngineContext"));
54
+ var import_useCardSurchargeReadOnly = __toESM(require("../../hooks/useCardSurchargeReadOnly"));
54
55
  var import_utils2 = require("../../utils");
55
56
  var import_index = require("./index.less");
56
57
  import_utils.locales.init(import_locales.default, (0, import_locales2.getLocale)());
@@ -150,6 +151,7 @@ var eftpos_default = (props) => {
150
151
  tyroVersion,
151
152
  useTyroLog
152
153
  } = props;
154
+ const surchargeReadOnly = (0, import_useCardSurchargeReadOnly.default)(type);
153
155
  const context = (0, import_useEngineContext.default)();
154
156
  const utils = context.appHelper.utils || {};
155
157
  import_utils2.request.setRequest(utils == null ? void 0 : utils.request);
@@ -431,6 +433,7 @@ var eftpos_default = (props) => {
431
433
  import_pos.default,
432
434
  {
433
435
  eftposName: name,
436
+ surchargeReadOnly,
434
437
  onSave: onSavePos,
435
438
  formItemList: posItemList
436
439
  }
@@ -460,6 +463,7 @@ var eftpos_default = (props) => {
460
463
  import_device.default,
461
464
  {
462
465
  formItemList: deviceItemList,
466
+ surchargeReadOnly,
463
467
  onSave,
464
468
  key: `posdevice${type}`
465
469
  },
@@ -539,6 +543,7 @@ var eftpos_default = (props) => {
539
543
  import_device.default,
540
544
  {
541
545
  formItemList: deviceItemList,
546
+ surchargeReadOnly,
542
547
  onSave: onSavePair,
543
548
  key: `device${type}`,
544
549
  type,
@@ -2,7 +2,8 @@ import { DeviceProp } from "./const";
2
2
  interface PosProps {
3
3
  eftposName: string;
4
4
  formItemList: any[];
5
+ surchargeReadOnly?: boolean;
5
6
  onSave: (device: DeviceProp) => void;
6
7
  }
7
- declare const PosForm: ({ onSave, formItemList }: PosProps) => JSX.Element;
8
+ declare const PosForm: ({ onSave, formItemList, surchargeReadOnly, }: PosProps) => JSX.Element;
8
9
  export default PosForm;
@@ -38,18 +38,30 @@ var import_const = require("./const");
38
38
  var import_utils = require("@pisell/utils");
39
39
  var import_form = __toESM(require("./form"));
40
40
  var { Title } = import_antd.Typography;
41
- var PosForm = ({ onSave, formItemList }) => {
41
+ var PosForm = ({
42
+ onSave,
43
+ formItemList,
44
+ surchargeReadOnly = false
45
+ }) => {
42
46
  const initialValues = (0, import_const.getDefaultValue)(formItemList);
43
47
  return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__pos-form-box" }, /* @__PURE__ */ import_react.default.createElement(Title, { level: 4, className: "pisell-lowcode__pos-title" }, import_utils.locales.getText("page.eftpos.text.setting")), /* @__PURE__ */ import_react.default.createElement(
44
48
  import_antd.Form,
45
49
  {
46
50
  layout: "vertical",
47
- onFinish: onSave,
51
+ onFinish: (values) => onSave(
52
+ surchargeReadOnly ? (0, import_const.preserveSurchargeValues)(values, formItemList) : values
53
+ ),
48
54
  initialValues,
49
55
  className: "pisell-lowcode__pos-form",
50
56
  key: formItemList
51
57
  },
52
- /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__pos-form-content" }, /* @__PURE__ */ import_react.default.createElement(import_form.default, { formItemList })),
58
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__pos-form-content" }, /* @__PURE__ */ import_react.default.createElement(
59
+ import_form.default,
60
+ {
61
+ formItemList,
62
+ surchargeReadOnly
63
+ }
64
+ )),
53
65
  /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__pos-form-btn" }, /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, null, /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { htmlType: "submit", block: true, style: { height: "48px" } }, import_utils.locales.getText("page.eftpos.text.save"))))
54
66
  ));
55
67
  };
@@ -61,7 +61,7 @@ var getCommDefaultVal = (commConfig) => {
61
61
  };
62
62
  var surcharge_default = (props) => {
63
63
  var _a, _b, _c, _d;
64
- const { origin, top, left, right } = props;
64
+ const { origin, top, left, right, surchargeReadOnly = false } = props;
65
65
  const leftRef = (0, import_react.useRef)(left.input.default || 0);
66
66
  const rightRef = (0, import_react.useRef)(right.input.default || 0);
67
67
  const [statusOrigin, setStatusOrigin] = (0, import_react.useState)(origin.input.defaultValue);
@@ -70,12 +70,15 @@ var surcharge_default = (props) => {
70
70
  const { store } = ((_a = context.appHelper) == null ? void 0 : _a.utils) || {};
71
71
  const symbol = ((_d = (_c = (_b = store == null ? void 0 : store.getState) == null ? void 0 : _b.call(store)) == null ? void 0 : _c.global) == null ? void 0 : _d.symbol) || "$";
72
72
  const onValueChange = (e) => {
73
+ if (surchargeReadOnly) return;
73
74
  setStatus(e.target.value);
74
75
  };
75
76
  const onChangeRate = (val) => {
77
+ if (surchargeReadOnly) return;
76
78
  leftRef.current = val;
77
79
  };
78
80
  const onChangeMoney = (val) => {
81
+ if (surchargeReadOnly) return;
79
82
  rightRef.current = val;
80
83
  };
81
84
  return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__pos_sur_box" }, /* @__PURE__ */ import_react.default.createElement(
@@ -89,24 +92,52 @@ var surcharge_default = (props) => {
89
92
  /* @__PURE__ */ import_react.default.createElement(
90
93
  import_antd.Radio.Group,
91
94
  {
95
+ disabled: surchargeReadOnly,
92
96
  value: origin.input.defaultValue,
93
97
  onChange: (e) => {
98
+ if (surchargeReadOnly) return;
94
99
  setStatusOrigin(e.target.value);
95
100
  }
96
101
  },
97
102
  /* @__PURE__ */ import_react.default.createElement(import_antd.Space, { direction: "vertical" }, origin.input.options.map((item) => {
98
103
  if (typeof item === "object") {
99
104
  const { label, value, ...other } = item;
100
- return /* @__PURE__ */ import_react.default.createElement(import_antd.Radio, { ...other, value, key: `${item.value}` }, label);
105
+ return /* @__PURE__ */ import_react.default.createElement(
106
+ import_antd.Radio,
107
+ {
108
+ ...other,
109
+ disabled: surchargeReadOnly || other.disabled,
110
+ value,
111
+ key: `${item.value}`
112
+ },
113
+ label
114
+ );
101
115
  }
102
116
  }))
103
117
  )
104
- ), /* @__PURE__ */ import_react.default.createElement("div", { style: { display: statusOrigin ? "none" : "contents" } }, /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { label: top.label, name: top.name, rules: top.rules || [], style: top.style || {} }, /* @__PURE__ */ import_react.default.createElement(import_antd.Radio.Group, { value: top.input.defaultValue, onChange: onValueChange }, /* @__PURE__ */ import_react.default.createElement(import_antd.Space, { direction: "vertical" }, top.input.options.map((item) => {
105
- if (typeof item === "object") {
106
- const { label, value, ...other } = item;
107
- return /* @__PURE__ */ import_react.default.createElement(import_antd.Radio, { ...other, value, key: `${item.value}` }, label);
108
- }
109
- })))), status ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__pos_row" }, /* @__PURE__ */ import_react.default.createElement(
118
+ ), /* @__PURE__ */ import_react.default.createElement("div", { style: { display: statusOrigin ? "none" : "contents" } }, /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { label: top.label, name: top.name, rules: top.rules || [], style: top.style || {} }, /* @__PURE__ */ import_react.default.createElement(
119
+ import_antd.Radio.Group,
120
+ {
121
+ disabled: surchargeReadOnly,
122
+ value: top.input.defaultValue,
123
+ onChange: onValueChange
124
+ },
125
+ /* @__PURE__ */ import_react.default.createElement(import_antd.Space, { direction: "vertical" }, top.input.options.map((item) => {
126
+ if (typeof item === "object") {
127
+ const { label, value, ...other } = item;
128
+ return /* @__PURE__ */ import_react.default.createElement(
129
+ import_antd.Radio,
130
+ {
131
+ ...other,
132
+ disabled: surchargeReadOnly || other.disabled,
133
+ value,
134
+ key: `${item.value}`
135
+ },
136
+ label
137
+ );
138
+ }
139
+ }))
140
+ )), status ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__pos_row" }, /* @__PURE__ */ import_react.default.createElement(
110
141
  import_antd.Form.Item,
111
142
  {
112
143
  label: left.label,
@@ -117,6 +148,7 @@ var surcharge_default = (props) => {
117
148
  /* @__PURE__ */ import_react.default.createElement(
118
149
  import_antd.InputNumber,
119
150
  {
151
+ disabled: surchargeReadOnly,
120
152
  min: 0,
121
153
  max: 100,
122
154
  precision: 2,
@@ -137,6 +169,7 @@ var surcharge_default = (props) => {
137
169
  /* @__PURE__ */ import_react.default.createElement(
138
170
  import_antd.InputNumber,
139
171
  {
172
+ disabled: surchargeReadOnly,
140
173
  min: 0,
141
174
  max: 1e5,
142
175
  precision: 2,