@pisell/private-materials 3.0.192 → 3.0.194

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 +150 -142
  7. package/build/lowcode/render/default/view.js +10 -10
  8. package/build/lowcode/view.js +9 -9
  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/hooks.d.ts +1 -1
  21. package/es/components/eftposPay/store/index.d.ts +1 -1
  22. package/es/components/eftposPay/tyro/index.js +40 -17
  23. package/es/components/ruleSetting/server.js +11 -4
  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/hooks.d.ts +1 -1
  38. package/lib/components/eftposPay/store/index.d.ts +1 -1
  39. package/lib/components/eftposPay/tyro/index.js +26 -5
  40. package/lib/components/ruleSetting/server.js +5 -4
  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
+ });
@@ -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<"tyro" | "windcave" | "payo" | "stripe">;
22
+ readonly eftposRef: React.MutableRefObject<"payo" | "tyro" | "windcave" | "stripe">;
23
23
  readonly clientRef: React.MutableRefObject<ClientEnum>;
24
24
  };
25
25
  /**
@@ -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,7 +128,7 @@ 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,
@@ -244,8 +258,14 @@ var tyro_default = ({
244
258
  console.log("商家小票 客户端是否打印小票 = ", signatureRequired);
245
259
  console.log("商家小票 小票内容 = \n", merchantReceipt);
246
260
  const receipt = [merchantReceipt].filter((item) => typeof item === "string").filter(Boolean);
247
- onChange("print", receipt);
248
261
  merchantReceiptRef.current = { signatureRequired, merchantReceipt };
262
+ if (signatureRequired) {
263
+ onChange("print", receipt);
264
+ return;
265
+ }
266
+ if (isPrint("merchant")) {
267
+ onChange("print", receipt);
268
+ }
249
269
  };
250
270
  const statusMessageCallbackImpl = (message) => {
251
271
  var _a;
@@ -381,7 +401,6 @@ var tyro_default = ({
381
401
  })
382
402
  );
383
403
  clearRef.current = setTimeout(() => {
384
- var _a2;
385
404
  const params = (0, import_helper.getPayParams)(
386
405
  {
387
406
  mode: modeRef.current,
@@ -398,14 +417,16 @@ var tyro_default = ({
398
417
  );
399
418
  onChange("success", {
400
419
  ...params,
401
- receipt: ((_a2 = deviceRef.current) == null ? void 0 : _a2.setting.receipts) ? [] : receipt
420
+ receipt: isPrint("customer") ? receipt : []
402
421
  });
403
422
  }, 1e3);
404
423
  return;
405
424
  } else {
406
425
  const current = ((_b = deviceRef.current) == null ? void 0 : _b.setting.receipts) ? [] : receipt;
407
426
  if (current.length > 0) {
408
- onChange("print", current);
427
+ if (isPrint("customer")) {
428
+ onChange("print", receipt);
429
+ }
409
430
  }
410
431
  }
411
432
  if (response.result === "UNKNOWN") {
@@ -32,7 +32,8 @@ var getStaffList = async () => {
32
32
  "/shop/shop/setting/staff",
33
33
  {},
34
34
  {
35
- useCache: true
35
+ useCache: true,
36
+ fullResult: true
36
37
  }
37
38
  );
38
39
  let _list = ((data == null ? void 0 : data.staff) || []).map((d) => {
@@ -53,7 +54,7 @@ var getStaffList = async () => {
53
54
  return _list;
54
55
  };
55
56
  var getProductChannel = async () => {
56
- const { data } = await import_utils2.request.getRequest().get("/shop/order/platform-list");
57
+ const { data } = await import_utils2.request.getRequest().get("/shop/order/platform-list", {}, { fullResult: true });
57
58
  let _list = (data || []).map((d) => {
58
59
  return {
59
60
  label: d.name,
@@ -68,7 +69,7 @@ var getProductChannel = async () => {
68
69
  };
69
70
  var getOrderTypes = async () => {
70
71
  var _a;
71
- let { data } = await import_utils2.request.getRequest().get("/shop/order/aggregation-type");
72
+ let { data } = await import_utils2.request.getRequest().get("/shop/order/aggregation-type", {}, { fullResult: true });
72
73
  let _list = (_a = data || []) == null ? void 0 : _a.map((d) => {
73
74
  return {
74
75
  ...d,
@@ -84,7 +85,7 @@ var getOrderTypes = async () => {
84
85
  };
85
86
  var getPaymentTypes = async () => {
86
87
  var _a;
87
- let { data } = await import_utils2.request.getRequest().get("/shop/till/opened-payment-method");
88
+ let { data } = await import_utils2.request.getRequest().get("/shop/till/opened-payment-method", {}, { fullResult: true });
88
89
  let _list = (_a = data || []) == null ? void 0 : _a.map((d) => {
89
90
  return {
90
91
  ...d,
@@ -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.192",
3
+ "version": "3.0.194",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -60,9 +60,9 @@
60
60
  "rc-virtual-list": "^3.11.3",
61
61
  "decimal.js": "^10.4.3",
62
62
  "@pisell/utils": "1.0.42",
63
- "@pisell/materials": "3.0.55",
64
63
  "@pisell/date-picker": "1.0.100",
65
- "@pisell/icon": "0.0.11"
64
+ "@pisell/icon": "0.0.11",
65
+ "@pisell/materials": "3.0.55"
66
66
  },
67
67
  "peerDependencies": {
68
68
  "react": "^18.0.0",