@pisell/private-materials 3.0.206 → 3.0.207

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 (73) 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 +142 -142
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +9 -9
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +8 -8
  11. package/es/components/booking/forms/model.d.ts +1 -1
  12. package/es/components/booking/notes/index.d.ts +1 -1
  13. package/es/components/booking/notes/model.d.ts +1 -1
  14. package/es/components/booking/payments/model.d.ts +1 -1
  15. package/es/components/eftposPay/amount.d.ts +1 -1
  16. package/es/components/eftposPay/app.d.ts +11 -0
  17. package/es/components/eftposPay/app.js +173 -0
  18. package/es/components/eftposPay/component/fail/failCustom.js +1 -0
  19. package/es/components/eftposPay/component/fail/index.js +1 -0
  20. package/es/components/eftposPay/component/manual/index.js +4 -1
  21. package/es/components/eftposPay/const.d.ts +27 -1
  22. package/es/components/eftposPay/const.js +22 -0
  23. package/es/components/eftposPay/device.d.ts +1 -1
  24. package/es/components/eftposPay/device.js +2 -2
  25. package/es/components/eftposPay/helper.d.ts +5 -0
  26. package/es/components/eftposPay/helper.js +10 -4
  27. package/es/components/eftposPay/hooks.d.ts +2 -1
  28. package/es/components/eftposPay/hooks.js +22 -16
  29. package/es/components/eftposPay/index.d.ts +1 -1
  30. package/es/components/eftposPay/index.js +130 -179
  31. package/es/components/eftposPay/locales.d.ts +15 -0
  32. package/es/components/eftposPay/locales.js +15 -0
  33. package/es/components/eftposPay/payo/config.js +20 -8
  34. package/es/components/eftposPay/store/index.d.ts +1 -1
  35. package/es/components/eftposPay/tip.d.ts +10 -0
  36. package/es/components/eftposPay/tip.js +177 -0
  37. package/es/components/eftposPay/tip.less +9 -0
  38. package/es/components/eftposPay/tyro/index.js +4 -2
  39. package/es/components/eftposPay/windcave/windcave.js +17 -6
  40. package/es/components/schedules/index.d.ts +1 -1
  41. package/es/components/schedules/model.d.ts +1 -1
  42. package/lib/components/booking/forms/model.d.ts +1 -1
  43. package/lib/components/booking/notes/index.d.ts +1 -1
  44. package/lib/components/booking/notes/model.d.ts +1 -1
  45. package/lib/components/booking/payments/model.d.ts +1 -1
  46. package/lib/components/eftposPay/amount.d.ts +1 -1
  47. package/lib/components/eftposPay/app.d.ts +11 -0
  48. package/lib/components/eftposPay/app.js +166 -0
  49. package/lib/components/eftposPay/component/fail/failCustom.js +1 -1
  50. package/lib/components/eftposPay/component/fail/index.js +1 -1
  51. package/lib/components/eftposPay/component/manual/index.js +19 -5
  52. package/lib/components/eftposPay/const.d.ts +27 -1
  53. package/lib/components/eftposPay/const.js +18 -0
  54. package/lib/components/eftposPay/device.d.ts +1 -1
  55. package/lib/components/eftposPay/device.js +2 -2
  56. package/lib/components/eftposPay/helper.d.ts +5 -0
  57. package/lib/components/eftposPay/helper.js +8 -4
  58. package/lib/components/eftposPay/hooks.d.ts +2 -1
  59. package/lib/components/eftposPay/hooks.js +8 -2
  60. package/lib/components/eftposPay/index.d.ts +1 -1
  61. package/lib/components/eftposPay/index.js +106 -144
  62. package/lib/components/eftposPay/locales.d.ts +15 -0
  63. package/lib/components/eftposPay/locales.js +15 -0
  64. package/lib/components/eftposPay/payo/config.js +33 -9
  65. package/lib/components/eftposPay/store/index.d.ts +1 -1
  66. package/lib/components/eftposPay/tip.d.ts +10 -0
  67. package/lib/components/eftposPay/tip.js +159 -0
  68. package/lib/components/eftposPay/tip.less +9 -0
  69. package/lib/components/eftposPay/tyro/index.js +4 -2
  70. package/lib/components/eftposPay/windcave/windcave.js +29 -6
  71. package/lib/components/schedules/index.d.ts +1 -1
  72. package/lib/components/schedules/model.d.ts +1 -1
  73. package/package.json +1 -1
@@ -297,7 +297,7 @@ export declare const backUpFree: (payload: Partial<State>) => {
297
297
  amount?: string | number | undefined;
298
298
  mode?: "refund" | "pay" | "fullPay" | "query" | undefined;
299
299
  order_id?: string | number | undefined;
300
- eftpos?: "windcave" | "tyro" | "payo" | "stripe" | undefined;
300
+ eftpos?: "tyro" | "windcave" | "payo" | "stripe" | undefined;
301
301
  action?: "amount" | "deviceList" | "pay" | undefined;
302
302
  key?: number | undefined;
303
303
  step?: number | undefined;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import './tip.less';
3
+ /**
4
+ * @title: 支付状态未知页面
5
+ * @description:
6
+ * @Author: hongbing.wang
7
+ * @Date: 2024-08-20 11:42
8
+ */
9
+ declare const _default: ({ onChangeStatus, className, formatAmount, cardSurcharge, receipts, successTime, onChangeParams, }: any) => React.JSX.Element;
10
+ export default _default;
@@ -0,0 +1,159 @@
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/eftposPay/tip.tsx
30
+ var tip_exports = {};
31
+ __export(tip_exports, {
32
+ default: () => tip_default
33
+ });
34
+ module.exports = __toCommonJS(tip_exports);
35
+ var import_utils = require("@pisell/utils");
36
+ var import_antd = require("antd");
37
+ var import_react = __toESM(require("react"));
38
+ var import_helper = require("./helper");
39
+ var import_const = require("./const");
40
+ var import_dayjs = __toESM(require("dayjs"));
41
+ var import_store = require("./store");
42
+ var import_hooks = require("./hooks");
43
+ var import_tip = require("./tip.less");
44
+ function formatDateUtils(date, format) {
45
+ if (!date) {
46
+ return date;
47
+ }
48
+ if (date.includes("undefined")) {
49
+ return "";
50
+ }
51
+ const lang = localStorage.getItem("umi_locale") || "en-US";
52
+ let _format = format || ["HH:mm:ss DD/MM/YYYY", "YYYY年MM月DD日 HH:mm:ss"];
53
+ let type = lang === "en-US" || lang === "en" ? _format[0] : _format[1];
54
+ return (0, import_dayjs.default)(date).locale(lang).format(type);
55
+ }
56
+ var tip_default = ({
57
+ onChangeStatus,
58
+ className = "",
59
+ formatAmount,
60
+ cardSurcharge,
61
+ receipts,
62
+ successTime,
63
+ onChangeParams
64
+ }) => {
65
+ const [disabled, setDisabled] = (0, import_react.useState)(true);
66
+ const [amount, setAmount] = (0, import_react.useState)("");
67
+ const [surcharge, setSurcharge] = (0, import_react.useState)("");
68
+ const [surMoney, setSurMoney] = (0, import_react.useState)("");
69
+ const [rate, setRate] = (0, import_react.useState)("");
70
+ const [total, setTotal] = (0, import_react.useState)("");
71
+ const [time, setTime] = (0, import_react.useState)("");
72
+ const data = (0, import_store.useContextData)();
73
+ const { symbol, custom } = data;
74
+ const ref = (0, import_react.useRef)();
75
+ const dispatch = (0, import_store.useDispatch)();
76
+ const listRef = (0, import_react.useRef)(custom == null ? void 0 : custom.list);
77
+ const {
78
+ deviceRef,
79
+ payRef,
80
+ numRef,
81
+ orderIdRef,
82
+ modeRef,
83
+ amountRef,
84
+ eftposRef
85
+ } = (0, import_hooks.useStoreRef)();
86
+ const onConfirm = () => {
87
+ onChangeStatus("success", { ...ref.current || {} });
88
+ };
89
+ (0, import_react.useEffect)(() => {
90
+ if (eftposRef.current === import_const.EftposEnum.Payo) {
91
+ dispatch((0, import_store.updateNextStep)());
92
+ dispatch(
93
+ (0, import_store.updateCustom)({
94
+ card_reader_surcharge: cardSurcharge || 0,
95
+ receipt: receipts
96
+ })
97
+ );
98
+ } else if (eftposRef.current === import_const.EftposEnum.Windcave) {
99
+ dispatch(
100
+ (0, import_store.updateCustom)({
101
+ list: listRef.current.map((item) => ({
102
+ ...item,
103
+ status: "resolve"
104
+ })),
105
+ card_reader_surcharge: cardSurcharge || 0,
106
+ receipt: receipts
107
+ })
108
+ );
109
+ }
110
+ const params = (0, import_helper.getPayParams)(
111
+ {
112
+ mode: modeRef.current,
113
+ amount: amountRef.current,
114
+ order_id: orderIdRef.current,
115
+ number: numRef.current,
116
+ device: deviceRef.current,
117
+ pay: payRef.current,
118
+ custom: {
119
+ card_reader_surcharge: cardSurcharge,
120
+ receipt: receipts
121
+ }
122
+ },
123
+ "success"
124
+ );
125
+ ref.current = params;
126
+ setAmount(`${(params == null ? void 0 : params.amount) || ""}`);
127
+ setSurcharge(`${(params == null ? void 0 : params.surcharge) || ""}`);
128
+ setSurMoney(`${(params == null ? void 0 : params.surMoney) || ""}`);
129
+ setRate(`${(params == null ? void 0 : params.surRate) || ""}`);
130
+ setTotal(`${(params == null ? void 0 : params.total) || ""}`);
131
+ setTime(formatDateUtils(successTime));
132
+ setDisabled(false);
133
+ dispatch(
134
+ (0, import_store.updateState)({
135
+ status: "success",
136
+ title: import_utils.locales.getText("page.eftpos-pay.text.successful")(
137
+ modeRef.current
138
+ )
139
+ })
140
+ );
141
+ }, []);
142
+ (0, import_react.useEffect)(() => {
143
+ onChangeParams && onChangeParams({
144
+ ...data,
145
+ form: import_const.RestoreEumn.Restore
146
+ });
147
+ }, [data, onChangeParams]);
148
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: `pisell-lowcode__eft-pay-box ${className}` }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-fail-title" }, import_utils.locales.getText("page.eftpos-pay.text.latest.success")), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-body pisell-lowcode__eft-pay-tip-body" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-tip-text" }, import_utils.locales.getText("page.eftpos-pay.text.latest.amount"), ":", " ", formatAmount(`${amount}`, 2, symbol)), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-tip-text" }, import_utils.locales.getText("page.eftpos-pay.text.latest.surcharge"), ":", " ", formatAmount(`${surcharge}`, 2, symbol), " (", rate, "% +", " ", formatAmount(`${surMoney}`, 2, symbol), ")"), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-tip-text" }, import_utils.locales.getText("page.eftpos-pay.text.surcharge.edit.actual.pay"), ":", " ", formatAmount(`${total}`, 2, symbol)), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-tip-text" }, import_utils.locales.getText("page.eftpos-pay.text.latest.time"), ": ", time)), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-step-item-btns" }, /* @__PURE__ */ import_react.default.createElement(
149
+ import_antd.Button,
150
+ {
151
+ disabled,
152
+ block: true,
153
+ className: "pisell-lowcode__eft-pay-step-item-btn",
154
+ type: "primary",
155
+ onClick: onConfirm
156
+ },
157
+ import_utils.locales.getText("page.eftpos-pay.text.latest.confirm")
158
+ )));
159
+ };
@@ -0,0 +1,9 @@
1
+ .pisell-lowcode__eft-pay-tip-body{
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: 16px;
5
+ margin: 20px 0 0 0;
6
+ }
7
+ .pisell-lowcode__eft-pay-tip-text{
8
+ color: var(--Gray-700, #344054);
9
+ }
@@ -405,7 +405,8 @@ var tyro_default = ({
405
405
  );
406
406
  dispatch(
407
407
  (0, import_store.updateCustom)({
408
- card_reader_surcharge: response.surchargeAmount || 0
408
+ card_reader_surcharge: response.surchargeAmount || 0,
409
+ receipt
409
410
  })
410
411
  );
411
412
  clearRef.current = setTimeout(() => {
@@ -418,7 +419,8 @@ var tyro_default = ({
418
419
  device: deviceRef.current,
419
420
  pay: payRef.current,
420
421
  custom: {
421
- card_reader_surcharge: response.surchargeAmount || 0
422
+ card_reader_surcharge: response.surchargeAmount || 0,
423
+ receipt
422
424
  }
423
425
  },
424
426
  "success"
@@ -60,7 +60,7 @@ var windcave_default = ({
60
60
  symbolRef,
61
61
  amountRef,
62
62
  eftposRef,
63
- clientRef
63
+ dataRef
64
64
  } = (0, import_hooks.useStoreRef)();
65
65
  const dispatch = (0, import_store.useDispatch)();
66
66
  const fail = (0, import_helper2.useFail)();
@@ -89,13 +89,16 @@ var windcave_default = ({
89
89
  failRef.current = fail;
90
90
  }, [fail]);
91
91
  const [run, validateRef] = (0, import_helper2.useValidate)(api.check, Minute, (res) => {
92
+ let receipt = Array.isArray(res == null ? void 0 : res.receipt) ? res.receipt : [res.receipt];
93
+ receipt = receipt.filter((item) => typeof item === "string").filter(Boolean);
92
94
  dispatch(
93
95
  (0, import_store.updateCustom)({
94
96
  list: listRef.current.map((item) => ({
95
97
  ...item,
96
98
  status: "resolve"
97
99
  })),
98
- card_reader_surcharge: (res == null ? void 0 : res.card_reader_surcharge) || 0
100
+ card_reader_surcharge: (res == null ? void 0 : res.card_reader_surcharge) || 0,
101
+ receipt
99
102
  })
100
103
  );
101
104
  dispatch(
@@ -117,12 +120,12 @@ var windcave_default = ({
117
120
  device: deviceRef.current,
118
121
  pay: payRef.current,
119
122
  custom: {
120
- card_reader_surcharge: (res == null ? void 0 : res.card_reader_surcharge) || 0
123
+ card_reader_surcharge: (res == null ? void 0 : res.card_reader_surcharge) || 0,
124
+ receipt
121
125
  }
122
126
  },
123
127
  "success"
124
128
  );
125
- const receipt = Array.isArray(res.receipt) ? res.receipt : [res.receipt];
126
129
  onChange("success", {
127
130
  ...params,
128
131
  receipt: ((_b = (_a = deviceRef.current) == null ? void 0 : _a.setting) == null ? void 0 : _b.receipts) ? [] : receipt
@@ -165,7 +168,17 @@ var windcave_default = ({
165
168
  amount: payRef.current.total,
166
169
  card_reader_type: eftposRef.current,
167
170
  card_reader_id: (_a = deviceRef.current) == null ? void 0 : _a.id,
168
- number: numRef.current
171
+ number: numRef.current,
172
+ pay_param_base64: encodeURIComponent(
173
+ btoa(
174
+ encodeURIComponent(
175
+ JSON.stringify({
176
+ ...dataRef.current,
177
+ number: numRef.current
178
+ })
179
+ )
180
+ )
181
+ )
169
182
  },
170
183
  { signal: controllerRef.current.signal }
171
184
  ) : api.refund(
@@ -174,7 +187,17 @@ var windcave_default = ({
174
187
  amount: amountRef.current,
175
188
  card_reader_type: eftposRef.current,
176
189
  card_reader_id: (_b = deviceRef.current) == null ? void 0 : _b.id,
177
- number: numRef.current
190
+ number: numRef.current,
191
+ pay_param_base64: encodeURIComponent(
192
+ btoa(
193
+ encodeURIComponent(
194
+ JSON.stringify({
195
+ ...dataRef.current,
196
+ number: numRef.current
197
+ })
198
+ )
199
+ )
200
+ )
178
201
  },
179
202
  { signal: controllerRef.current.signal }
180
203
  );
@@ -1,3 +1,3 @@
1
1
  import "./index.less";
2
- declare const Schedules: (props: any) => any;
2
+ declare const Schedules: any;
3
3
  export default Schedules;
@@ -69,7 +69,7 @@ export interface FormState {
69
69
  };
70
70
  setGlobalState: Function | null;
71
71
  }
72
- export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
72
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
73
73
  state: FormState;
74
74
  } & {
75
75
  dispatch: (params: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "3.0.206",
3
+ "version": "3.0.207",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",