@pisell/private-materials 6.6.101 → 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.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.js +1 -1
- package/build/lowcode/view.js +1 -1
- package/es/components/booking/components/footer/utils.js +13 -0
- package/es/components/booking/components/voucher/index.js +42 -3
- package/es/components/booking/info/clientVariant/hooks/useClientFn.js +8 -5
- package/es/components/booking/info/clientVariant/vertical/index.js +1 -1
- package/es/components/booking/info2/service/editService/index.js +31 -11
- package/es/components/booking/info2/service/editService/utils.d.ts +3 -0
- package/es/components/booking/info2/service/editService/utils.js +128 -19
- package/es/components/eftpos/const.d.ts +2 -0
- package/es/components/eftpos/const.js +25 -2
- package/es/components/eftpos/device.d.ts +1 -0
- package/es/components/eftpos/device.js +9 -4
- package/es/components/eftpos/form/index.d.ts +2 -1
- package/es/components/eftpos/form/index.js +7 -2
- package/es/components/eftpos/index.js +5 -0
- package/es/components/eftpos/pos.d.ts +2 -1
- package/es/components/eftpos/pos.js +9 -4
- package/es/components/eftpos/surcharge/index.js +13 -1
- package/es/components/eftposPay/amount.js +20 -5
- package/es/components/eftposPay/hooks.d.ts +1 -1
- package/es/components/eftposPay/store/index.d.ts +1 -1
- package/es/components/ticketBooking/utils/index.js +4 -4
- package/es/hooks/useCardSurchargeReadOnly.d.ts +4 -0
- package/es/hooks/useCardSurchargeReadOnly.js +61 -0
- package/lib/components/booking/components/footer/utils.js +8 -1
- package/lib/components/booking/components/voucher/index.js +43 -3
- package/lib/components/booking/info/clientVariant/hooks/useClientFn.js +7 -5
- package/lib/components/booking/info/clientVariant/vertical/index.js +1 -1
- package/lib/components/booking/info2/service/editService/index.js +38 -12
- package/lib/components/booking/info2/service/editService/utils.d.ts +3 -0
- package/lib/components/booking/info2/service/editService/utils.js +94 -12
- package/lib/components/eftpos/const.d.ts +2 -0
- package/lib/components/eftpos/const.js +18 -2
- package/lib/components/eftpos/device.d.ts +1 -0
- package/lib/components/eftpos/device.js +11 -3
- package/lib/components/eftpos/form/index.d.ts +2 -1
- package/lib/components/eftpos/form/index.js +11 -2
- package/lib/components/eftpos/index.js +5 -0
- package/lib/components/eftpos/pos.d.ts +2 -1
- package/lib/components/eftpos/pos.js +15 -3
- package/lib/components/eftpos/surcharge/index.js +41 -8
- package/lib/components/eftposPay/amount.js +26 -3
- package/lib/components/eftposPay/hooks.d.ts +1 -1
- package/lib/components/eftposPay/store/index.d.ts +1 -1
- package/lib/components/ticketBooking/utils/index.js +2 -2
- package/lib/hooks/useCardSurchargeReadOnly.d.ts +4 -0
- package/lib/hooks/useCardSurchargeReadOnly.js +86 -0
- package/package.json +4 -4
|
@@ -39,10 +39,12 @@ var import_react = __toESM(require("react"));
|
|
|
39
39
|
var import_ahooks = require("ahooks");
|
|
40
40
|
var import_alert = __toESM(require("./component/alert"));
|
|
41
41
|
var import_titlebar = __toESM(require("./component/header/titlebar"));
|
|
42
|
+
var import_const = require("./const");
|
|
42
43
|
var import_manufacturer = require("./manufacturer");
|
|
43
44
|
var import_helper = require("./helper");
|
|
44
45
|
var import_store = require("./store");
|
|
45
46
|
var import_payLog = __toESM(require("./utils/payLog"));
|
|
47
|
+
var import_useCardSurchargeReadOnly = __toESM(require("../../hooks/useCardSurchargeReadOnly"));
|
|
46
48
|
var amount_default = ({
|
|
47
49
|
className = "",
|
|
48
50
|
onChange,
|
|
@@ -55,6 +57,15 @@ var amount_default = ({
|
|
|
55
57
|
const dispatch = (0, import_store.useDispatch)();
|
|
56
58
|
const [status, setStatus] = (0, import_react.useState)(true);
|
|
57
59
|
const store = (0, import_store.useContextData)();
|
|
60
|
+
const isPayment = store.mode === import_const.ModeEnum.Pay || store.mode === import_const.ModeEnum.FullPay;
|
|
61
|
+
const surchargeReadOnly = (0, import_useCardSurchargeReadOnly.default)(store.eftpos, {
|
|
62
|
+
includePos: isPayment
|
|
63
|
+
});
|
|
64
|
+
const hideSurchargeEdit = isPayment && surchargeReadOnly;
|
|
65
|
+
const isAmountPage = status || hideSurchargeEdit;
|
|
66
|
+
(0, import_react.useEffect)(() => {
|
|
67
|
+
if (hideSurchargeEdit) setStatus(true);
|
|
68
|
+
}, [hideSurchargeEdit]);
|
|
58
69
|
const {
|
|
59
70
|
name,
|
|
60
71
|
symbol,
|
|
@@ -101,6 +112,7 @@ var amount_default = ({
|
|
|
101
112
|
const onSubmit = () => {
|
|
102
113
|
if (!status) {
|
|
103
114
|
setStatus(true);
|
|
115
|
+
if (surchargeReadOnly) return;
|
|
104
116
|
setSurRate(tempSurRate);
|
|
105
117
|
setSurMoney(tempSurMoney);
|
|
106
118
|
return;
|
|
@@ -139,12 +151,13 @@ var amount_default = ({
|
|
|
139
151
|
onClose();
|
|
140
152
|
};
|
|
141
153
|
const onEdit = () => {
|
|
154
|
+
if (surchargeReadOnly || useOriginSurcharge) return;
|
|
142
155
|
import_payLog.default.log("金额页-点击编辑");
|
|
143
156
|
setStatus(false);
|
|
144
157
|
setTempSurRate(curSurRate);
|
|
145
158
|
setTempSurMoney(curSurMoney);
|
|
146
159
|
};
|
|
147
|
-
return /* @__PURE__ */ import_react.default.createElement("div", { className: `pisell-lowcode__eft-pay-amount ${className}` }, isMobile ? null : /* @__PURE__ */ import_react.default.createElement(import_titlebar.default, { type: "left-title-close", onClose },
|
|
160
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: `pisell-lowcode__eft-pay-amount ${className}` }, isMobile ? null : /* @__PURE__ */ import_react.default.createElement(import_titlebar.default, { type: "left-title-close", onClose }, isAmountPage ? name : import_utils.locales.getText("page.eftpos-pay.text.surcharge.edit.title")), isAmountPage ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-amount-body" }, /* @__PURE__ */ import_react.default.createElement(
|
|
148
161
|
"div",
|
|
149
162
|
{
|
|
150
163
|
className: "pisell-lowcode__eft-pay-cash",
|
|
@@ -177,10 +190,19 @@ var amount_default = ({
|
|
|
177
190
|
"page.eftpos-pay.text.surcharge.edit.actual.pay"
|
|
178
191
|
), ":", formatAmount(`${total}`, 2, symbol)), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-money" }, import_utils.locales.getText(
|
|
179
192
|
"page.eftpos-pay.text.surcharge.edit.inc.surcharge"
|
|
180
|
-
), ": ", formatAmount(`${totalSurMoney}`, 2, symbol), " (", import_utils.locales.getText("page.eftpos-pay.text.surcharge.edit.rate"), ":", curSurRate, "% + ", formatAmount(`${curSurMoney}`, 2, symbol), ")")),
|
|
193
|
+
), ": ", formatAmount(`${totalSurMoney}`, 2, symbol), " (", import_utils.locales.getText("page.eftpos-pay.text.surcharge.edit.rate"), ":", curSurRate, "% + ", formatAmount(`${curSurMoney}`, 2, symbol), ")")), !hideSurchargeEdit && /* @__PURE__ */ import_react.default.createElement(
|
|
194
|
+
import_antd.Button,
|
|
195
|
+
{
|
|
196
|
+
type: "link",
|
|
197
|
+
onClick: onEdit,
|
|
198
|
+
disabled: surchargeReadOnly || useOriginSurcharge
|
|
199
|
+
},
|
|
200
|
+
import_utils.locales.getText("page.eftpos-pay.text.surcharge.edit.surcharge")
|
|
201
|
+
))) : /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-amount-body" }, /* @__PURE__ */ import_react.default.createElement(import_alert.default, null, import_utils.locales.getText("page.eftpos-pay.text.surcharge.percentage-fixed")), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-amount-form" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-amount-item" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-amount-item-title" }, import_utils.locales.getText("page.eftpos-pay.text.surcharge.percentage")), /* @__PURE__ */ import_react.default.createElement(
|
|
181
202
|
import_antd.InputNumber,
|
|
182
203
|
{
|
|
183
204
|
type: "number",
|
|
205
|
+
disabled: surchargeReadOnly,
|
|
184
206
|
value: tempSurRate,
|
|
185
207
|
min: 0,
|
|
186
208
|
max: 100,
|
|
@@ -195,6 +217,7 @@ var amount_default = ({
|
|
|
195
217
|
import_antd.InputNumber,
|
|
196
218
|
{
|
|
197
219
|
type: "number",
|
|
220
|
+
disabled: surchargeReadOnly,
|
|
198
221
|
value: tempSurMoney,
|
|
199
222
|
min: 0,
|
|
200
223
|
max: 1e5,
|
|
@@ -220,7 +243,7 @@ var amount_default = ({
|
|
|
220
243
|
className: "pisell-lowcode__eft-pay-step-item-btn",
|
|
221
244
|
type: "primary",
|
|
222
245
|
onClick: onSubmit,
|
|
223
|
-
disabled: currentMoney <= 0 &&
|
|
246
|
+
disabled: currentMoney <= 0 && isAmountPage
|
|
224
247
|
},
|
|
225
248
|
import_utils.locales.getText("page.eftpos-pay.text.sure")
|
|
226
249
|
)));
|
|
@@ -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<"stripe" | "
|
|
22
|
+
readonly eftposRef: React.MutableRefObject<"stripe" | "payo" | "tyro" | "windcave" | "linkly" | "mx51" | "adyenpos" | "huifu" | "adyenalipay" | "adyenwechat">;
|
|
23
23
|
readonly clientRef: React.MutableRefObject<ClientEnum>;
|
|
24
24
|
readonly dataRef: React.MutableRefObject<import("./store").State>;
|
|
25
25
|
};
|
|
@@ -301,7 +301,7 @@ export declare const backUpFree: (payload: Partial<State>) => {
|
|
|
301
301
|
amount?: string | number | undefined;
|
|
302
302
|
mode?: "pay" | "refund" | "fullPay" | "query" | undefined;
|
|
303
303
|
order_id?: string | number | undefined;
|
|
304
|
-
eftpos?: "stripe" | "
|
|
304
|
+
eftpos?: "stripe" | "payo" | "tyro" | "windcave" | "linkly" | "mx51" | "adyenpos" | "huifu" | "adyenalipay" | "adyenwechat" | undefined;
|
|
305
305
|
action?: "pay" | "amount" | "deviceList" | undefined;
|
|
306
306
|
key?: number | undefined;
|
|
307
307
|
step?: number | undefined;
|
|
@@ -190,13 +190,13 @@ var addService = (list, addItem, state, isMultiDay) => {
|
|
|
190
190
|
let isSetCount = false;
|
|
191
191
|
value = list.map((item) => {
|
|
192
192
|
var _a, _b, _c, _d, _e;
|
|
193
|
-
const isGoodPassDiscountProduct = (item.discount_list || []).some((item2) => item2.
|
|
193
|
+
const isGoodPassDiscountProduct = (item.discount_list || []).some((item2) => ["good_pass", "entitlement_pass"].includes(item2.tag || item2.type));
|
|
194
194
|
const isEdit = item == null ? void 0 : item.edit;
|
|
195
195
|
const bundleDiscountList = [];
|
|
196
196
|
(((_b = (_a = item == null ? void 0 : item._extend) == null ? void 0 : _a.other) == null ? void 0 : _b.bundle) || []).forEach((item2) => {
|
|
197
197
|
bundleDiscountList.push(...(item2 == null ? void 0 : item2.discount_list) || []);
|
|
198
198
|
});
|
|
199
|
-
const isGoodPassBundleProduct = bundleDiscountList.some((item2) => item2.
|
|
199
|
+
const isGoodPassBundleProduct = bundleDiscountList.some((item2) => ["good_pass", "entitlement_pass"].includes(item2.tag || item2.type));
|
|
200
200
|
if (isSameProduct(item, addItem) && !isSetCount && !isGoodPassDiscountProduct && !isEdit && !isGoodPassBundleProduct) {
|
|
201
201
|
isNotSame = false;
|
|
202
202
|
const quantity = (((_c = item == null ? void 0 : item._extend) == null ? void 0 : _c.quantity) || 1) + (((_d = addItem == null ? void 0 : addItem._extend) == null ? void 0 : _d.quantity) || 1);
|
|
@@ -0,0 +1,86 @@
|
|
|
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/hooks/useCardSurchargeReadOnly.ts
|
|
30
|
+
var useCardSurchargeReadOnly_exports = {};
|
|
31
|
+
__export(useCardSurchargeReadOnly_exports, {
|
|
32
|
+
default: () => useCardSurchargeReadOnly
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(useCardSurchargeReadOnly_exports);
|
|
35
|
+
var import_react = require("react");
|
|
36
|
+
var import_useEngineContext = __toESM(require("./useEngineContext"));
|
|
37
|
+
var cardEftposTypes = /* @__PURE__ */ new Set([
|
|
38
|
+
"payo",
|
|
39
|
+
"tyro",
|
|
40
|
+
"windcave",
|
|
41
|
+
"stripe",
|
|
42
|
+
"linkly",
|
|
43
|
+
"mx51",
|
|
44
|
+
"adyenpos"
|
|
45
|
+
]);
|
|
46
|
+
function useCardSurchargeReadOnly(paymentType, { includePos = false } = {}) {
|
|
47
|
+
var _a, _b;
|
|
48
|
+
const context = (0, import_useEngineContext.default)();
|
|
49
|
+
const { platform } = ((_a = context == null ? void 0 : context.appHelper) == null ? void 0 : _a.constants) || {};
|
|
50
|
+
const { store, getData, isCardSurchargeReadOnly } = ((_b = context == null ? void 0 : context.appHelper) == null ? void 0 : _b.utils) || {};
|
|
51
|
+
const isPosCardPayment = includePos && (platform === "webpos" || platform === "pos") && cardEftposTypes.has(paymentType.toLowerCase().replace(/^eftpos_/, ""));
|
|
52
|
+
const getReadOnly = (0, import_react.useCallback)(() => {
|
|
53
|
+
var _a2, _b2, _c, _d;
|
|
54
|
+
if (platform === "shop") {
|
|
55
|
+
return typeof isCardSurchargeReadOnly === "function" && Boolean(isCardSurchargeReadOnly(paymentType));
|
|
56
|
+
}
|
|
57
|
+
if (!isPosCardPayment) return false;
|
|
58
|
+
const state = (_a2 = store == null ? void 0 : store.getState) == null ? void 0 : _a2.call(store);
|
|
59
|
+
const shopInfo = ((_b2 = state == null ? void 0 : state.core) == null ? void 0 : _b2.shopInfo) || (getData == null ? void 0 : getData("shop_info"));
|
|
60
|
+
const shopId = (_d = (_c = state == null ? void 0 : state.core) == null ? void 0 : _c.core) == null ? void 0 : _d.id;
|
|
61
|
+
if (shopId != null && (shopInfo == null ? void 0 : shopInfo.id) != null && String(shopId) !== String(shopInfo.id)) {
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
const countryCode = String((shopInfo == null ? void 0 : shopInfo.country_code) || "").toUpperCase();
|
|
65
|
+
return !countryCode || countryCode === "AU";
|
|
66
|
+
}, [
|
|
67
|
+
platform,
|
|
68
|
+
isCardSurchargeReadOnly,
|
|
69
|
+
paymentType,
|
|
70
|
+
isPosCardPayment,
|
|
71
|
+
store,
|
|
72
|
+
getData
|
|
73
|
+
]);
|
|
74
|
+
const [, setReadOnly] = (0, import_react.useState)(getReadOnly);
|
|
75
|
+
(0, import_react.useEffect)(() => {
|
|
76
|
+
var _a2;
|
|
77
|
+
if (!isPosCardPayment && (platform !== "shop" || typeof isCardSurchargeReadOnly !== "function")) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const update = () => setReadOnly(getReadOnly());
|
|
81
|
+
const unsubscribe = (_a2 = store == null ? void 0 : store.subscribe) == null ? void 0 : _a2.call(store, update);
|
|
82
|
+
update();
|
|
83
|
+
return () => unsubscribe == null ? void 0 : unsubscribe();
|
|
84
|
+
}, [store, getReadOnly, platform, isCardSurchargeReadOnly, isPosCardPayment]);
|
|
85
|
+
return getReadOnly();
|
|
86
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pisell/private-materials",
|
|
3
|
-
"version": "6.6.
|
|
3
|
+
"version": "6.6.103",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"module": "./es/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -64,9 +64,9 @@
|
|
|
64
64
|
"@react-spring/web": "^9.6.1",
|
|
65
65
|
"@use-gesture/react": "^10.3.1",
|
|
66
66
|
"@pisell/utils": "3.0.2",
|
|
67
|
-
"@pisell/
|
|
68
|
-
"@pisell/
|
|
69
|
-
"@pisell/
|
|
67
|
+
"@pisell/materials": "6.6.25",
|
|
68
|
+
"@pisell/icon": "0.0.11",
|
|
69
|
+
"@pisell/date-picker": "3.0.7"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
72
|
"react": "^18.0.0",
|