@pisell/private-materials 6.4.9 → 6.4.11

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.
@@ -185,13 +185,13 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
185
185
  // 从支付方式列表中查找现金支付方式
186
186
  cashPaymentMethod = paymentMethods.find(function (method) {
187
187
  var _method$name;
188
- return method.code === 'cash' || method.type === 'cash' || ((_method$name = method.name) === null || _method$name === void 0 ? void 0 : _method$name.toLowerCase().includes('cash'));
188
+ return method.code === 'CASHMANUAL' || method.type === 'CASHMANUAL' || ((_method$name = method.name) === null || _method$name === void 0 ? void 0 : _method$name.toLowerCase().includes('cash'));
189
189
  });
190
190
  _context.next = 3;
191
191
  return checkoutModule === null || checkoutModule === void 0 ? void 0 : checkoutModule.addPaymentItemAsync({
192
192
  amount: result.amount,
193
193
  /** 支付类型,跟支付列表上对应的支付方式保持一致 */
194
- code: result.type,
194
+ code: cashPaymentMethod === null || cashPaymentMethod === void 0 ? void 0 : cashPaymentMethod.code,
195
195
  /** 支付类型id,跟支付列表上对应的支付方式保持一致 */
196
196
  id: cashPaymentMethod === null || cashPaymentMethod === void 0 ? void 0 : cashPaymentMethod.id,
197
197
  /** 支付类型名称,跟支付列表上对应的支付方式保持一致 */
@@ -532,12 +532,16 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
532
532
  }
533
533
  // 判断是否为现金支付
534
534
  var paymentMethodName = data.paymentMethodName || data.name || '';
535
- var isCashPayment = data.paymentMethodCode === 'cash' || data.paymentMethodCode === 'CASH' || /现金|現金/i.test(paymentMethodName) || /cash/i.test(paymentMethodName);
535
+ var isCashPayment = data.paymentMethodCode === 'CASHMANUAL' || /现金|現金/i.test(paymentMethodName) || /cash/i.test(paymentMethodName);
536
536
  if (isCashPayment) {
537
- var _interaction$utils, _interaction$utils$as;
537
+ var _interaction$utils, _interaction$utils$po;
538
+ logger === null || logger === void 0 || logger.addLog({
539
+ type: 'info',
540
+ title: 'open_till',
541
+ metadata: {}
542
+ });
538
543
  // handleToastClose();
539
- // TODO: 等红阳的方法
540
- interaction === null || interaction === void 0 || (_interaction$utils = interaction.utils) === null || _interaction$utils === void 0 || (_interaction$utils$as = _interaction$utils.asyncDataManager) === null || _interaction$utils$as === void 0 || _interaction$utils$as.call(_interaction$utils, {
544
+ interaction === null || interaction === void 0 || (_interaction$utils = interaction.utils) === null || _interaction$utils === void 0 || (_interaction$utils$po = _interaction$utils.postMessageToApp) === null || _interaction$utils$po === void 0 || _interaction$utils$po.call(_interaction$utils, {
541
545
  module: 'till',
542
546
  key: 'open_till'
543
547
  });
@@ -1763,13 +1767,15 @@ var PaymentModal = function PaymentModal(_ref17) {
1763
1767
  if (data && open) {
1764
1768
  initCheckoutData();
1765
1769
  }
1770
+ }, [data, open]);
1771
+ useEffect(function () {
1766
1772
  return function () {
1767
1773
  if (typeof unsubscribeRef.current === 'function') {
1768
1774
  var _unsubscribeRef$curre;
1769
1775
  (_unsubscribeRef$curre = unsubscribeRef.current) === null || _unsubscribeRef$curre === void 0 || _unsubscribeRef$curre.call(unsubscribeRef);
1770
1776
  }
1771
1777
  };
1772
- }, [data, open]);
1778
+ }, []);
1773
1779
 
1774
1780
  // 创建PaymentResultToast配置对象
1775
1781
  var paymentResultToastConfig = {
@@ -88,7 +88,7 @@ export function CashPaymentModule(_ref) {
88
88
  }
89
89
  var finalAmount = typeof amount === 'number' ? amount : Number(amount) || 0;
90
90
  onPaymentComplete({
91
- type: 'cash',
91
+ type: 'CASHMANUAL',
92
92
  amount: finalAmount,
93
93
  totalAmount: Number(customAmount) || 0,
94
94
  change: finalAmount - (Number(customAmount) || 0),
@@ -144,13 +144,13 @@ var PaymentContent = (0, import_react.forwardRef)(
144
144
  const cashPaymentMethod = paymentMethods.find(
145
145
  (method) => {
146
146
  var _a2;
147
- return method.code === "cash" || method.type === "cash" || ((_a2 = method.name) == null ? void 0 : _a2.toLowerCase().includes("cash"));
147
+ return method.code === "CASHMANUAL" || method.type === "CASHMANUAL" || ((_a2 = method.name) == null ? void 0 : _a2.toLowerCase().includes("cash"));
148
148
  }
149
149
  );
150
150
  await (checkoutModule == null ? void 0 : checkoutModule.addPaymentItemAsync({
151
151
  amount: result.amount,
152
152
  /** 支付类型,跟支付列表上对应的支付方式保持一致 */
153
- code: result.type,
153
+ code: cashPaymentMethod == null ? void 0 : cashPaymentMethod.code,
154
154
  /** 支付类型id,跟支付列表上对应的支付方式保持一致 */
155
155
  id: cashPaymentMethod == null ? void 0 : cashPaymentMethod.id,
156
156
  /** 支付类型名称,跟支付列表上对应的支付方式保持一致 */
@@ -427,9 +427,14 @@ var PaymentContent = (0, import_react.forwardRef)(
427
427
  );
428
428
  }
429
429
  const paymentMethodName = data.paymentMethodName || data.name || "";
430
- const isCashPayment = data.paymentMethodCode === "cash" || data.paymentMethodCode === "CASH" || /现金|現金/i.test(paymentMethodName) || /cash/i.test(paymentMethodName);
430
+ const isCashPayment = data.paymentMethodCode === "CASHMANUAL" || /现金|現金/i.test(paymentMethodName) || /cash/i.test(paymentMethodName);
431
431
  if (isCashPayment) {
432
- (_b2 = (_a2 = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _a2.asyncDataManager) == null ? void 0 : _b2.call(_a2, {
432
+ logger == null ? void 0 : logger.addLog({
433
+ type: "info",
434
+ title: "open_till",
435
+ metadata: {}
436
+ });
437
+ (_b2 = (_a2 = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _a2.postMessageToApp) == null ? void 0 : _b2.call(_a2, {
433
438
  module: "till",
434
439
  key: "open_till"
435
440
  });
@@ -1309,13 +1314,15 @@ var PaymentModal = ({
1309
1314
  if (data && open) {
1310
1315
  initCheckoutData();
1311
1316
  }
1317
+ }, [data, open]);
1318
+ (0, import_react.useEffect)(() => {
1312
1319
  return () => {
1313
1320
  var _a2;
1314
1321
  if (typeof unsubscribeRef.current === "function") {
1315
1322
  (_a2 = unsubscribeRef.current) == null ? void 0 : _a2.call(unsubscribeRef);
1316
1323
  }
1317
1324
  };
1318
- }, [data, open]);
1325
+ }, []);
1319
1326
  const paymentResultToastConfig = {
1320
1327
  context,
1321
1328
  pisellos,
@@ -92,7 +92,7 @@ function CashPaymentModule({
92
92
  }
93
93
  const finalAmount = typeof amount === "number" ? amount : Number(amount) || 0;
94
94
  onPaymentComplete({
95
- type: "cash",
95
+ type: "CASHMANUAL",
96
96
  amount: finalAmount,
97
97
  totalAmount: Number(customAmount) || 0,
98
98
  change: finalAmount - (Number(customAmount) || 0),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "6.4.9",
3
+ "version": "6.4.11",
4
4
  "scripts": {
5
5
  "dev": "father dev",
6
6
  "build": "father build",