@pisell/private-materials 6.6.61 → 6.6.62

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.
@@ -17,7 +17,7 @@ export declare const useWalletPass: (props: {
17
17
  cardData: any;
18
18
  handleSelectWallet: (value: number[]) => void;
19
19
  selectedWalletIds: any[];
20
- expiredWalletIds: any[];
20
+ expiredWalletIds: any;
21
21
  expiredWalletData: any;
22
22
  disabledWalletData: any[];
23
23
  clearAllSelectedWallet: () => void;
@@ -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" | "tyro" | "windcave" | "payo" | "linkly" | "huifu">;
22
+ readonly eftposRef: React.MutableRefObject<"stripe" | "payo" | "tyro" | "windcave" | "linkly" | "huifu">;
23
23
  readonly clientRef: React.MutableRefObject<ClientEnum>;
24
24
  readonly dataRef: React.MutableRefObject<import("./store").State>;
25
25
  };
@@ -301,8 +301,8 @@ 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" | "tyro" | "windcave" | "payo" | "linkly" | "huifu" | undefined;
305
- action?: "amount" | "pay" | "deviceList" | undefined;
304
+ eftpos?: "stripe" | "payo" | "tyro" | "windcave" | "linkly" | "huifu" | undefined;
305
+ action?: "pay" | "amount" | "deviceList" | undefined;
306
306
  key?: number | undefined;
307
307
  step?: number | undefined;
308
308
  title?: string | undefined;
@@ -1,6 +1,20 @@
1
1
  import { formatAmount } from '@pisell/utils';
2
2
  import { getServiceTime } from "./formatTime";
3
+ import { locales } from '@pisell/utils';
4
+ var UNIT_LABEL = {
5
+ KILOGRAMS: 'kg',
6
+ GRAMS: 'g',
7
+ POUNDS: 'lb',
8
+ OUNCES: 'oz'
9
+ };
10
+ var DEFAULT_WEIGHT_PRECISION = 3;
11
+ var formatWeightValue = function formatWeightValue(value) {
12
+ var parsedValue = Number(value);
13
+ var displayValue = Number.isFinite(parsedValue) ? parsedValue : 0;
14
+ return displayValue.toFixed(DEFAULT_WEIGHT_PRECISION);
15
+ };
3
16
  var formatProductMessage = function formatProductMessage(product, utils) {
17
+ var _product$_origin;
4
18
  var product_option_string = product.product_option_string,
5
19
  options = product.options,
6
20
  bundle = product.bundle,
@@ -42,6 +56,32 @@ var formatProductMessage = function formatProductMessage(product, utils) {
42
56
  });
43
57
  }
44
58
 
59
+ // 重量信息
60
+ var weighing = product === null || product === void 0 || (_product$_origin = product._origin) === null || _product$_origin === void 0 || (_product$_origin = _product$_origin._extend) === null || _product$_origin === void 0 ? void 0 : _product$_origin.weighing;
61
+ if (weighing) {
62
+ var mode = weighing.mode,
63
+ unit_price = weighing.unit_price,
64
+ unit = weighing.unit,
65
+ weight = weighing.weight,
66
+ tare = weighing.tare,
67
+ net_weight = weighing.net_weight;
68
+ var unitLabel = UNIT_LABEL[unit] || unit;
69
+ var weightText = formatWeightValue(weight);
70
+ var tareText = formatWeightValue(tare === null || tare === void 0 ? void 0 : tare.value);
71
+ var netWeightText = formatWeightValue(net_weight);
72
+ var tareValue = Number((tare === null || tare === void 0 ? void 0 : tare.value) || 0);
73
+ var isManualWeight = mode === 'manual';
74
+ var unitPriceText = "".concat(currency_symbol || '').concat(unit_price !== null && unit_price !== void 0 ? unit_price : '0.00');
75
+ var manualPrefix = isManualWeight ? '(M) ' : '';
76
+ if (tareValue > 0) {
77
+ str += "".concat(manualPrefix).concat(locales.getText('pisell2.cart.sku-card.weighing.gross'), ": ").concat(weightText, " ").concat(unitLabel, " \n");
78
+ }
79
+ if (tareValue > 0) {
80
+ str += "".concat(locales.getText('pisell2.cart.sku-card.weighing.tare'), ": ").concat(tareText, " ").concat(UNIT_LABEL[tare === null || tare === void 0 ? void 0 : tare.unit] || (tare === null || tare === void 0 ? void 0 : tare.unit) || unitLabel, " \n");
81
+ }
82
+ str += "".concat(tareValue > 0 ? '' : manualPrefix).concat(netWeightText, " ").concat(unitLabel, " ").concat(locales.getText('pisell2.cart.sku-card.weighing.net'), " @ ").concat(unitPriceText, "/").concat(unitLabel, " \n");
83
+ }
84
+
45
85
  // 组合规格 单规格
46
86
  if (product_option_string) str += "".concat(product_option_string, "\n");
47
87
  if (Array.isArray(options) && options.length) {
@@ -53,8 +93,13 @@ var formatProductMessage = function formatProductMessage(product, utils) {
53
93
  // 套餐
54
94
  if (Array.isArray(bundle) && bundle.length) {
55
95
  bundle.forEach(function (item) {
56
- str += "".concat(item.title, " \n");
57
- str += "".concat(formatAmount(item.price, 2, currency_symbol), " x ").concat(item.num);
96
+ str += "".concat(item.title, " ").concat(formatAmount(item.price, 2, currency_symbol), " x ").concat(item.num, "\n");
97
+ var bundleOptions = item === null || item === void 0 ? void 0 : item.options;
98
+ if (Array.isArray(bundleOptions) && bundleOptions.length) {
99
+ bundleOptions.forEach(function (opt) {
100
+ str += " ".concat(opt === null || opt === void 0 ? void 0 : opt.name, " ").concat(formatAmount(opt === null || opt === void 0 ? void 0 : opt.price, 2, currency_symbol), " x ").concat(opt === null || opt === void 0 ? void 0 : opt.num, "\n");
101
+ });
102
+ }
58
103
  });
59
104
  }
60
105
  return str;
@@ -17,7 +17,7 @@ export declare const useWalletPass: (props: {
17
17
  cardData: any;
18
18
  handleSelectWallet: (value: number[]) => void;
19
19
  selectedWalletIds: any[];
20
- expiredWalletIds: any[];
20
+ expiredWalletIds: any;
21
21
  expiredWalletData: any;
22
22
  disabledWalletData: any[];
23
23
  clearAllSelectedWallet: () => void;
@@ -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" | "tyro" | "windcave" | "payo" | "linkly" | "huifu">;
22
+ readonly eftposRef: React.MutableRefObject<"stripe" | "payo" | "tyro" | "windcave" | "linkly" | "huifu">;
23
23
  readonly clientRef: React.MutableRefObject<ClientEnum>;
24
24
  readonly dataRef: React.MutableRefObject<import("./store").State>;
25
25
  };
@@ -301,8 +301,8 @@ 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" | "tyro" | "windcave" | "payo" | "linkly" | "huifu" | undefined;
305
- action?: "amount" | "pay" | "deviceList" | undefined;
304
+ eftpos?: "stripe" | "payo" | "tyro" | "windcave" | "linkly" | "huifu" | undefined;
305
+ action?: "pay" | "amount" | "deviceList" | undefined;
306
306
  key?: number | undefined;
307
307
  step?: number | undefined;
308
308
  title?: string | undefined;
@@ -24,7 +24,21 @@ __export(formatProductMessage_exports, {
24
24
  module.exports = __toCommonJS(formatProductMessage_exports);
25
25
  var import_utils = require("@pisell/utils");
26
26
  var import_formatTime = require("./formatTime");
27
+ var import_utils2 = require("@pisell/utils");
28
+ var UNIT_LABEL = {
29
+ KILOGRAMS: "kg",
30
+ GRAMS: "g",
31
+ POUNDS: "lb",
32
+ OUNCES: "oz"
33
+ };
34
+ var DEFAULT_WEIGHT_PRECISION = 3;
35
+ var formatWeightValue = (value) => {
36
+ const parsedValue = Number(value);
37
+ const displayValue = Number.isFinite(parsedValue) ? parsedValue : 0;
38
+ return displayValue.toFixed(DEFAULT_WEIGHT_PRECISION);
39
+ };
27
40
  var formatProductMessage = (product, utils) => {
41
+ var _a, _b;
28
42
  const {
29
43
  product_option_string,
30
44
  options,
@@ -64,6 +78,28 @@ var formatProductMessage = (product, utils) => {
64
78
  }
65
79
  });
66
80
  }
81
+ const weighing = (_b = (_a = product == null ? void 0 : product._origin) == null ? void 0 : _a._extend) == null ? void 0 : _b.weighing;
82
+ if (weighing) {
83
+ const { mode, unit_price, unit, weight, tare, net_weight } = weighing;
84
+ const unitLabel = UNIT_LABEL[unit] || unit;
85
+ const weightText = formatWeightValue(weight);
86
+ const tareText = formatWeightValue(tare == null ? void 0 : tare.value);
87
+ const netWeightText = formatWeightValue(net_weight);
88
+ const tareValue = Number((tare == null ? void 0 : tare.value) || 0);
89
+ const isManualWeight = mode === "manual";
90
+ const unitPriceText = `${currency_symbol || ""}${unit_price ?? "0.00"}`;
91
+ const manualPrefix = isManualWeight ? "(M) " : "";
92
+ if (tareValue > 0) {
93
+ str += `${manualPrefix}${import_utils2.locales.getText("pisell2.cart.sku-card.weighing.gross")}: ${weightText} ${unitLabel}
94
+ `;
95
+ }
96
+ if (tareValue > 0) {
97
+ str += `${import_utils2.locales.getText("pisell2.cart.sku-card.weighing.tare")}: ${tareText} ${UNIT_LABEL[tare == null ? void 0 : tare.unit] || (tare == null ? void 0 : tare.unit) || unitLabel}
98
+ `;
99
+ }
100
+ str += `${tareValue > 0 ? "" : manualPrefix}${netWeightText} ${unitLabel} ${import_utils2.locales.getText("pisell2.cart.sku-card.weighing.net")} @ ${unitPriceText}/${unitLabel}
101
+ `;
102
+ }
67
103
  if (product_option_string) str += `${product_option_string}
68
104
  `;
69
105
  if (Array.isArray(options) && options.length) {
@@ -74,9 +110,15 @@ var formatProductMessage = (product, utils) => {
74
110
  }
75
111
  if (Array.isArray(bundle) && bundle.length) {
76
112
  bundle.forEach((item) => {
77
- str += `${item.title}
113
+ str += `${item.title} ${(0, import_utils.formatAmount)(item.price, 2, currency_symbol)} x ${item.num}
114
+ `;
115
+ const bundleOptions = item == null ? void 0 : item.options;
116
+ if (Array.isArray(bundleOptions) && bundleOptions.length) {
117
+ bundleOptions.forEach((opt) => {
118
+ str += ` ${opt == null ? void 0 : opt.name} ${(0, import_utils.formatAmount)(opt == null ? void 0 : opt.price, 2, currency_symbol)} x ${opt == null ? void 0 : opt.num}
78
119
  `;
79
- str += `${(0, import_utils.formatAmount)(item.price, 2, currency_symbol)} x ${item.num}`;
120
+ });
121
+ }
80
122
  });
81
123
  }
82
124
  return str;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "6.6.61",
3
+ "version": "6.6.62",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -61,10 +61,10 @@
61
61
  "styled-components": "^6.0.0-rc.3",
62
62
  "@react-spring/web": "^9.6.1",
63
63
  "@use-gesture/react": "^10.3.1",
64
- "@pisell/icon": "0.0.11",
65
- "@pisell/materials": "6.6.16",
64
+ "@pisell/utils": "3.0.2",
66
65
  "@pisell/date-picker": "3.0.7",
67
- "@pisell/utils": "3.0.2"
66
+ "@pisell/materials": "6.6.17",
67
+ "@pisell/icon": "0.0.11"
68
68
  },
69
69
  "peerDependencies": {
70
70
  "react": "^18.0.0",