@pisell/private-materials 3.0.193 → 3.0.195

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 +9 -9
  7. package/build/lowcode/render/default/view.js +10 -10
  8. package/build/lowcode/view.js +8 -8
  9. package/es/components/booking/addons/model.d.ts +2 -1
  10. package/es/components/booking/forms/model.d.ts +2 -1
  11. package/es/components/booking/notes/index.d.ts +1 -1
  12. package/es/components/booking/notes/model.d.ts +2 -1
  13. package/es/components/booking/payments/model.d.ts +2 -1
  14. package/es/components/eftpos/form/index.js +12 -6
  15. package/es/components/eftpos/group/index.d.ts +1 -2
  16. package/es/components/eftpos/group/index.js +1 -2
  17. package/es/components/eftpos/index.js +2 -2
  18. package/es/components/eftpos/receipt/index.d.ts +24 -0
  19. package/es/components/eftpos/receipt/index.js +96 -0
  20. package/es/components/eftposPay/helper.d.ts +1 -0
  21. package/es/components/eftposPay/helper.js +14 -0
  22. package/es/components/eftposPay/store/index.d.ts +1 -1
  23. package/es/components/eftposPay/tyro/index.js +51 -20
  24. package/es/components/schedules/index.d.ts +1 -1
  25. package/es/components/schedules/model.d.ts +2 -1
  26. package/lib/components/booking/addons/model.d.ts +2 -1
  27. package/lib/components/booking/forms/model.d.ts +2 -1
  28. package/lib/components/booking/notes/index.d.ts +1 -1
  29. package/lib/components/booking/notes/model.d.ts +2 -1
  30. package/lib/components/booking/payments/model.d.ts +2 -1
  31. package/lib/components/eftpos/form/index.js +12 -6
  32. package/lib/components/eftpos/group/index.d.ts +1 -2
  33. package/lib/components/eftpos/group/index.js +0 -1
  34. package/lib/components/eftpos/index.js +2 -2
  35. package/lib/components/eftpos/receipt/index.d.ts +24 -0
  36. package/lib/components/eftpos/receipt/index.js +88 -0
  37. package/lib/components/eftposPay/helper.d.ts +1 -0
  38. package/lib/components/eftposPay/helper.js +21 -0
  39. package/lib/components/eftposPay/store/index.d.ts +1 -1
  40. package/lib/components/eftposPay/tyro/index.js +36 -7
  41. package/lib/components/schedules/index.d.ts +1 -1
  42. package/lib/components/schedules/model.d.ts +2 -1
  43. package/package.json +3 -3
@@ -54,7 +54,6 @@ var CheckboxGroup = ({
54
54
  var RadioGroup = ({
55
55
  direction,
56
56
  options,
57
- component,
58
57
  ...props
59
58
  }) => {
60
59
  if (direction === "vertical") {
@@ -73,7 +73,7 @@ var PosTabs = (0, import_react.forwardRef)(
73
73
  {
74
74
  className: `pisell-lowcode__pos_circle ${active2 ? "active" : ""}`
75
75
  },
76
- /* @__PURE__ */ import_react.default.createElement(import_device2.default, { color: active2 ? "#fff" : "#98A2B3" })
76
+ /* @__PURE__ */ import_react.default.createElement(import_apiKey.default, { color: active2 ? "#fff" : "#98A2B3" })
77
77
  ), /* @__PURE__ */ import_react.default.createElement(
78
78
  "span",
79
79
  {
@@ -90,7 +90,7 @@ var PosTabs = (0, import_react.forwardRef)(
90
90
  {
91
91
  className: `pisell-lowcode__pos_circle ${active2 ? "active" : ""}`
92
92
  },
93
- /* @__PURE__ */ import_react.default.createElement(import_apiKey.default, { color: active2 ? "#fff" : "#98A2B3" })
93
+ /* @__PURE__ */ import_react.default.createElement(import_device2.default, { color: active2 ? "#fff" : "#98A2B3" })
94
94
  ), /* @__PURE__ */ import_react.default.createElement(
95
95
  "span",
96
96
  {
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ /**
3
+ * @title: 自定义组件设置
4
+ * @description: 自定义组件设置
5
+ * @param {any} commConfig 当前组件配置
6
+ * @param {string} name 上游name(用于嵌套 xxx:{yyy:''})
7
+ * @return {*}
8
+ * @Author: hongbing.wang
9
+ * @Date: 2024-08-20 11:10
10
+ */
11
+ export declare const getCommName: (commConfig: any, name: string[]) => any;
12
+ /**
13
+ * @title: 自定义组件结果设置
14
+ * @description: 自定义组件结果设置
15
+ * @param {any} commConfig 当前组件配置
16
+ * @return {*}
17
+ * @Author: hongbing.wang
18
+ * @Date: 2024-08-20 11:11
19
+ */
20
+ export declare const getCommDefaultVal: (commConfig: any) => {
21
+ [x: number]: any;
22
+ };
23
+ declare const _default: (props: any) => React.JSX.Element;
24
+ export default _default;
@@ -0,0 +1,88 @@
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/receipt/index.tsx
30
+ var receipt_exports = {};
31
+ __export(receipt_exports, {
32
+ default: () => receipt_default,
33
+ getCommDefaultVal: () => getCommDefaultVal,
34
+ getCommName: () => getCommName
35
+ });
36
+ module.exports = __toCommonJS(receipt_exports);
37
+ var import_react = __toESM(require("react"));
38
+ var import_antd = require("antd");
39
+ var import_group = require("../group");
40
+ var getCommName = (commConfig, name) => {
41
+ commConfig.receipts.__sourceName = commConfig.receipts.name;
42
+ commConfig.receiptList.__sourceName = commConfig.receiptList.name;
43
+ commConfig.receipts.name = name.length > 0 ? [...name, commConfig.receipts.name] : commConfig.receipts.name;
44
+ commConfig.receiptList.name = name.length > 0 ? [...name, commConfig.receiptList.name] : commConfig.receiptList.name;
45
+ return commConfig;
46
+ };
47
+ var getCommDefaultVal = (commConfig) => {
48
+ const receipts = commConfig.receipts.input.defaultValue;
49
+ const receiptList = commConfig.receiptList.input.defaultValue;
50
+ console.log("receipts = ", receipts);
51
+ return {
52
+ [commConfig.receipts.__sourceName]: typeof receipts === "undefined" ? true : receipts,
53
+ [commConfig.receiptList.__sourceName]: typeof receiptList === "undefined" ? ["merchant", "customer"] : receiptList
54
+ };
55
+ };
56
+ var receipt_default = (props) => {
57
+ const { receipts, receiptList } = props;
58
+ const [receiptsInput, receiptsOther] = (0, import_react.useMemo)(() => {
59
+ const { input, ...other } = receipts;
60
+ return [input, other];
61
+ }, [receipts]);
62
+ const [receiptListInput, receiptListOther] = (0, import_react.useMemo)(() => {
63
+ const { input, ...other } = receiptList;
64
+ return [input, other];
65
+ }, [receipts]);
66
+ const [type, setType] = (0, import_react.useState)(receiptsInput.defaultValue);
67
+ return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { style: { marginBottom: "12px" }, ...receiptsOther }, /* @__PURE__ */ import_react.default.createElement(
68
+ import_group.RadioGroup,
69
+ {
70
+ ...receiptsInput,
71
+ onChange: (event) => {
72
+ setType(event.target.value);
73
+ }
74
+ }
75
+ )), /* @__PURE__ */ import_react.default.createElement(
76
+ import_antd.Form.Item,
77
+ {
78
+ ...receiptListOther,
79
+ style: type ? { marginLeft: "24px", display: "none" } : { marginLeft: "24px" }
80
+ },
81
+ /* @__PURE__ */ import_react.default.createElement(import_group.CheckboxGroup, { ...receiptListInput })
82
+ ));
83
+ };
84
+ // Annotate the CommonJS export names for ESM import in node:
85
+ 0 && (module.exports = {
86
+ getCommDefaultVal,
87
+ getCommName
88
+ });
@@ -74,4 +74,5 @@ export declare function getPayAmonunt({ money, amount, surRate, surMoney }: Amou
74
74
  surRateMoney: string;
75
75
  totalUnit: string;
76
76
  };
77
+ export declare function getBrowserVersion(): string;
77
78
  export {};
@@ -21,6 +21,7 @@ var helper_exports = {};
21
21
  __export(helper_exports, {
22
22
  cloneDeep: () => cloneDeep,
23
23
  getAmonunt: () => getAmonunt,
24
+ getBrowserVersion: () => getBrowserVersion,
24
25
  getPayAmonunt: () => getPayAmonunt,
25
26
  getPayParams: () => getPayParams,
26
27
  getUuid: () => getUuid,
@@ -185,10 +186,30 @@ function getPayAmonunt({ money, amount, surRate, surMoney }, formatAmount) {
185
186
  totalUnit: formatAmount(total)
186
187
  };
187
188
  }
189
+ function getBrowserVersion() {
190
+ const Sys = {};
191
+ const ua = navigator.userAgent.toLowerCase();
192
+ let s;
193
+ (s = ua.match(/rv:([\d.]+)\) like gecko/)) ? Sys.ie = s[1] : (s = ua.match(/msie ([\d\.]+)/)) ? Sys.ie = s[1] : (s = ua.match(/edge\/([\d\.]+)/)) ? Sys.edge = s[1] : (s = ua.match(/firefox\/([\d\.]+)/)) ? Sys.firefox = s[1] : (s = ua.match(/(?:opera|opr).([\d\.]+)/)) ? Sys.opera = s[1] : (s = ua.match(/chrome\/([\d\.]+)/)) ? Sys.chrome = s[1] : (s = ua.match(/version\/([\d\.]+).*safari/)) ? Sys.safari = s[1] : 0;
194
+ if (Sys.ie)
195
+ return "IE: " + Sys.ie;
196
+ if (Sys.edge)
197
+ return "EDGE: " + Sys.edge;
198
+ if (Sys.firefox)
199
+ return "Firefox: " + Sys.firefox;
200
+ if (Sys.chrome)
201
+ return "Chrome: " + Sys.chrome;
202
+ if (Sys.opera)
203
+ return "Opera: " + Sys.opera;
204
+ if (Sys.safari)
205
+ return "Safari: " + Sys.safari;
206
+ return "Unkonwn";
207
+ }
188
208
  // Annotate the CommonJS export names for ESM import in node:
189
209
  0 && (module.exports = {
190
210
  cloneDeep,
191
211
  getAmonunt,
212
+ getBrowserVersion,
192
213
  getPayAmonunt,
193
214
  getPayParams,
194
215
  getUuid,
@@ -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?: "tyro" | "windcave" | "payo" | "stripe" | undefined;
300
+ eftpos?: "payo" | "tyro" | "windcave" | "stripe" | undefined;
301
301
  action?: "amount" | "deviceList" | "pay" | undefined;
302
302
  key?: number | undefined;
303
303
  step?: number | undefined;
@@ -64,6 +64,20 @@ var tyro_default = ({
64
64
  const requestIdRef = (0, import_react.useRef)((custom == null ? void 0 : custom.requestId) || "");
65
65
  const unloadRef = (0, import_react.useRef)(false);
66
66
  const clearRef = (0, import_react.useRef)();
67
+ const isPrint = (key) => {
68
+ var _a, _b, _c, _d;
69
+ if ((_b = (_a = deviceRef.current) == null ? void 0 : _a.setting) == null ? void 0 : _b.receipts) {
70
+ return false;
71
+ }
72
+ const receiptList = (_d = (_c = deviceRef.current) == null ? void 0 : _c.setting) == null ? void 0 : _d.receiptList;
73
+ if (!Array.isArray(receiptList)) {
74
+ return true;
75
+ }
76
+ if (Array.isArray(receiptList) && receiptList.some((item) => item === key)) {
77
+ return true;
78
+ }
79
+ return false;
80
+ };
67
81
  (0, import_react.useEffect)(() => {
68
82
  listRef.current = (custom == null ? void 0 : custom.list) || [];
69
83
  }, [custom == null ? void 0 : custom.list]);
@@ -114,12 +128,16 @@ var tyro_default = ({
114
128
  );
115
129
  requestParams.current = {
116
130
  amount: new import_decimal.Decimal(amountRef.current || 0).mul(100).toFixed(0, import_decimal.Decimal.ROUND_HALF_UP),
117
- // 打印小票 true 打印到系统上 false 打印到pos机上
131
+ // 打印小票 true 打印到Pisell系统上 false 打印到pos机上
118
132
  integratedReceipt: !((_b = (_a = deviceRef.current) == null ? void 0 : _a.setting) == null ? void 0 : _b.receipts),
119
133
  integrationKey,
120
134
  transactionId: numRef.current,
121
135
  mid,
122
- tid
136
+ tid,
137
+ device: JSON.stringify(deviceRef.current),
138
+ isPrintMerchant: isPrint("merchant"),
139
+ isPrintCustomer: isPrint("customer"),
140
+ browserVersion: (0, import_helper.getBrowserVersion)()
123
141
  };
124
142
  dispatch(
125
143
  (0, import_store.updateCustom)({
@@ -186,7 +204,11 @@ var tyro_default = ({
186
204
  integrationKey,
187
205
  transactionId: numRef.current,
188
206
  mid,
189
- tid
207
+ tid,
208
+ device: JSON.stringify(deviceRef.current),
209
+ isPrintMerchant: isPrint("merchant"),
210
+ isPrintCustomer: isPrint("customer"),
211
+ browserVersion: (0, import_helper.getBrowserVersion)()
190
212
  };
191
213
  dispatch(
192
214
  (0, import_store.updateCustom)({
@@ -244,8 +266,14 @@ var tyro_default = ({
244
266
  console.log("商家小票 客户端是否打印小票 = ", signatureRequired);
245
267
  console.log("商家小票 小票内容 = \n", merchantReceipt);
246
268
  const receipt = [merchantReceipt].filter((item) => typeof item === "string").filter(Boolean);
247
- onChange("print", receipt);
248
269
  merchantReceiptRef.current = { signatureRequired, merchantReceipt };
270
+ if (signatureRequired) {
271
+ onChange("print", receipt);
272
+ return;
273
+ }
274
+ if (isPrint("merchant")) {
275
+ onChange("print", receipt);
276
+ }
249
277
  };
250
278
  const statusMessageCallbackImpl = (message) => {
251
279
  var _a;
@@ -381,7 +409,6 @@ var tyro_default = ({
381
409
  })
382
410
  );
383
411
  clearRef.current = setTimeout(() => {
384
- var _a2;
385
412
  const params = (0, import_helper.getPayParams)(
386
413
  {
387
414
  mode: modeRef.current,
@@ -398,14 +425,16 @@ var tyro_default = ({
398
425
  );
399
426
  onChange("success", {
400
427
  ...params,
401
- receipt: ((_a2 = deviceRef.current) == null ? void 0 : _a2.setting.receipts) ? [] : receipt
428
+ receipt: isPrint("customer") ? receipt : []
402
429
  });
403
430
  }, 1e3);
404
431
  return;
405
432
  } else {
406
433
  const current = ((_b = deviceRef.current) == null ? void 0 : _b.setting.receipts) ? [] : receipt;
407
434
  if (current.length > 0) {
408
- onChange("print", current);
435
+ if (isPrint("customer")) {
436
+ onChange("print", receipt);
437
+ }
409
438
  }
410
439
  }
411
440
  if (response.result === "UNKNOWN") {
@@ -1,3 +1,3 @@
1
1
  import "./index.less";
2
- declare const Schedules: (props: any) => JSX.Element;
2
+ declare const Schedules: (props: any) => any;
3
3
  export default Schedules;
@@ -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,7 +69,7 @@ export interface FormState {
68
69
  };
69
70
  setGlobalState: Function | null;
70
71
  }
71
- export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
72
+ export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
72
73
  state: FormState;
73
74
  } & {
74
75
  dispatch: (params: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "3.0.193",
3
+ "version": "3.0.195",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -61,8 +61,8 @@
61
61
  "decimal.js": "^10.4.3",
62
62
  "@pisell/materials": "3.0.55",
63
63
  "@pisell/icon": "0.0.11",
64
- "@pisell/utils": "1.0.42",
65
- "@pisell/date-picker": "1.0.100"
64
+ "@pisell/date-picker": "1.0.100",
65
+ "@pisell/utils": "1.0.42"
66
66
  },
67
67
  "peerDependencies": {
68
68
  "react": "^18.0.0",