@pisell/pisellos 0.0.211 → 0.0.213

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.
@@ -39,6 +39,7 @@ export var formatDateToCartItemOrigin = function formatDateToCartItemOrigin(para
39
39
  * @returns 删除后的购物车
40
40
  */
41
41
  export var deleteTimeFromCartItem = function deleteTimeFromCartItem(cartItem) {
42
+ var _cartItem$osWarnTips;
42
43
  // 删除UI层的数据
43
44
  cartItem.start_date = undefined;
44
45
  cartItem.start_time = undefined;
@@ -51,5 +52,10 @@ export var deleteTimeFromCartItem = function deleteTimeFromCartItem(cartItem) {
51
52
  cartItem._origin.start_time = null;
52
53
  cartItem._origin.end_date = null;
53
54
  cartItem._origin.end_time = null;
55
+
56
+ // 同时清空 osWarnTips 中的关于时间的提示
57
+ cartItem.osWarnTips = (_cartItem$osWarnTips = cartItem.osWarnTips) === null || _cartItem$osWarnTips === void 0 ? void 0 : _cartItem$osWarnTips.filter(function (item) {
58
+ return !item.includes('pisell2.product.card.closing-soon.warning');
59
+ });
54
60
  return cartItem;
55
61
  };
@@ -1219,7 +1219,18 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1219
1219
  _context15.prev = 0;
1220
1220
  paymentData = {
1221
1221
  payments: order.payment.map(function (payment) {
1222
- return payment;
1222
+ return {
1223
+ uuid: payment.uuid,
1224
+ amount: payment.amount,
1225
+ code: payment.code,
1226
+ id: payment.id,
1227
+ name: payment.name,
1228
+ type: payment.type,
1229
+ voucher_id: payment.voucher_id,
1230
+ metadata: payment.metadata,
1231
+ rounding_amount: payment.rounding_amount,
1232
+ service_charge: payment.service_charge
1233
+ };
1223
1234
  }),
1224
1235
  payment_status: 'pending'
1225
1236
  }; // 计算总支付金额
@@ -1984,7 +1995,18 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1984
1995
  // 构造支付数据
1985
1996
  paymentData = {
1986
1997
  payments: order.payment.map(function (payment) {
1987
- return payment;
1998
+ return {
1999
+ uuid: payment.uuid,
2000
+ amount: payment.amount,
2001
+ code: payment.code,
2002
+ id: payment.id,
2003
+ name: payment.name,
2004
+ type: payment.type,
2005
+ voucher_id: payment.voucher_id,
2006
+ metadata: payment.metadata,
2007
+ rounding_amount: payment.rounding_amount,
2008
+ service_charge: payment.service_charge
2009
+ };
1988
2010
  }),
1989
2011
  payment_status: order.payment_status === PaymentStatus.Finished ? 'paid' : 'partially_paid'
1990
2012
  }; // 检查是否已经在队列中,避免重复添加
@@ -2201,7 +2201,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2201
2201
  var _item$_productOrigin17;
2202
2202
  // 如果商品配置的是灵活时长,开始时间设置为提交的时间,结束时间从资源的可用最晚时间和店铺营业结束时间里取一个最早的
2203
2203
  if (((_item$_productOrigin17 = item._productOrigin) === null || _item$_productOrigin17 === void 0 || (_item$_productOrigin17 = _item$_productOrigin17.duration) === null || _item$_productOrigin17 === void 0 ? void 0 : _item$_productOrigin17.type) === 'flexible') {
2204
- var _allResources$find, _item$_productOrigin18;
2204
+ var _allResources$find, _item$_productOrigin18, _item$_productOrigin19;
2205
2205
  item.duration = {
2206
2206
  type: 'minutes',
2207
2207
  value: 10
@@ -2231,15 +2231,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2231
2231
  resource.endTime = formattedEndTime.format('YYYY-MM-DD HH:mm');
2232
2232
  // 如果是动态时长商品,并且当前选择的时间的结束时间小于了最低提示时长(warningThreshold),则追加一个提示
2233
2233
  // 如果currentStartTime + warningThreshold 大于 currentEndTime,且 osWarnTips 没有pisell2.product.card.closing-soon.warning 这一项,则加入这一项
2234
- if (dayjs(currentStartTime).add(((_item$_productOrigin18 = item._productOrigin) === null || _item$_productOrigin18 === void 0 || (_item$_productOrigin18 = _item$_productOrigin18.duration) === null || _item$_productOrigin18 === void 0 || (_item$_productOrigin18 = _item$_productOrigin18.flexible_config) === null || _item$_productOrigin18 === void 0 ? void 0 : _item$_productOrigin18.warning_threshold) || 0, 'minutes').isAfter(dayjs(formattedEndTime))) {
2234
+ if ((_item$_productOrigin18 = item._productOrigin) !== null && _item$_productOrigin18 !== void 0 && (_item$_productOrigin18 = _item$_productOrigin18.duration) !== null && _item$_productOrigin18 !== void 0 && (_item$_productOrigin18 = _item$_productOrigin18.flexible_config) !== null && _item$_productOrigin18 !== void 0 && _item$_productOrigin18.is_enable_minimum_duration && dayjs(currentStartTime).add(((_item$_productOrigin19 = item._productOrigin) === null || _item$_productOrigin19 === void 0 || (_item$_productOrigin19 = _item$_productOrigin19.duration) === null || _item$_productOrigin19 === void 0 || (_item$_productOrigin19 = _item$_productOrigin19.flexible_config) === null || _item$_productOrigin19 === void 0 ? void 0 : _item$_productOrigin19.warning_threshold) || 0, 'minutes').isAfter(dayjs(formattedEndTime))) {
2235
2235
  if (!osWarnTips.includes('pisell2.product.card.closing-soon.warning')) {
2236
2236
  osWarnTips.push('pisell2.product.card.closing-soon.warning');
2237
2237
  }
2238
2238
  }
2239
2239
  } else {
2240
- var _item$_productOrigin19;
2240
+ var _item$_productOrigin20;
2241
2241
  resource.startTime = currentStartTime;
2242
- resource.endTime = dayjs(currentStartTime).add(((_item$_productOrigin19 = item._productOrigin) === null || _item$_productOrigin19 === void 0 || (_item$_productOrigin19 = _item$_productOrigin19.duration) === null || _item$_productOrigin19 === void 0 ? void 0 : _item$_productOrigin19.value) || 10, 'minutes').format('YYYY-MM-DD HH:mm');
2242
+ resource.endTime = dayjs(currentStartTime).add(((_item$_productOrigin20 = item._productOrigin) === null || _item$_productOrigin20 === void 0 || (_item$_productOrigin20 = _item$_productOrigin20.duration) === null || _item$_productOrigin20 === void 0 ? void 0 : _item$_productOrigin20.value) || 10, 'minutes').format('YYYY-MM-DD HH:mm');
2243
2243
  }
2244
2244
  // delete resource.times;
2245
2245
  });
@@ -56,6 +56,7 @@ var formatDateToCartItemOrigin = (params) => {
56
56
  return origin;
57
57
  };
58
58
  var deleteTimeFromCartItem = (cartItem) => {
59
+ var _a;
59
60
  cartItem.start_date = void 0;
60
61
  cartItem.start_time = void 0;
61
62
  cartItem.end_date = void 0;
@@ -65,6 +66,7 @@ var deleteTimeFromCartItem = (cartItem) => {
65
66
  cartItem._origin.start_time = null;
66
67
  cartItem._origin.end_date = null;
67
68
  cartItem._origin.end_time = null;
69
+ cartItem.osWarnTips = (_a = cartItem.osWarnTips) == null ? void 0 : _a.filter((item) => !item.includes("pisell2.product.card.closing-soon.warning"));
68
70
  return cartItem;
69
71
  };
70
72
  // Annotate the CommonJS export names for ESM import in node:
@@ -567,7 +567,18 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
567
567
  async submitSingleOrderPayment(order) {
568
568
  try {
569
569
  const paymentData = {
570
- payments: order.payment.map((payment) => payment),
570
+ payments: order.payment.map((payment) => ({
571
+ uuid: payment.uuid,
572
+ amount: payment.amount,
573
+ code: payment.code,
574
+ id: payment.id,
575
+ name: payment.name,
576
+ type: payment.type,
577
+ voucher_id: payment.voucher_id,
578
+ metadata: payment.metadata,
579
+ rounding_amount: payment.rounding_amount,
580
+ service_charge: payment.service_charge
581
+ })),
571
582
  payment_status: "pending"
572
583
  };
573
584
  const totalPaidAmount = paymentData.payments.reduce(
@@ -1116,7 +1127,18 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
1116
1127
  async reAddOrderToSyncQueue(order) {
1117
1128
  try {
1118
1129
  const paymentData = {
1119
- payments: order.payment.map((payment) => payment),
1130
+ payments: order.payment.map((payment) => ({
1131
+ uuid: payment.uuid,
1132
+ amount: payment.amount,
1133
+ code: payment.code,
1134
+ id: payment.id,
1135
+ name: payment.name,
1136
+ type: payment.type,
1137
+ voucher_id: payment.voucher_id,
1138
+ metadata: payment.metadata,
1139
+ rounding_amount: payment.rounding_amount,
1140
+ service_charge: payment.service_charge
1141
+ })),
1120
1142
  payment_status: order.payment_status === import_types.PaymentStatus.Finished ? "paid" : "partially_paid"
1121
1143
  };
1122
1144
  const existingQueue = this.app.tasksManager.getTaskQueue({
@@ -1521,7 +1521,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1521
1521
  const osWarnTips = [];
1522
1522
  const newResources = (0, import_lodash_es.cloneDeep)(item._origin.resources);
1523
1523
  newResources.forEach((resource) => {
1524
- var _a3, _b2, _c, _d, _e, _f, _g, _h;
1524
+ var _a3, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k;
1525
1525
  if (((_b2 = (_a3 = item._productOrigin) == null ? void 0 : _a3.duration) == null ? void 0 : _b2.type) === "flexible") {
1526
1526
  item.duration = {
1527
1527
  type: "minutes",
@@ -1552,14 +1552,14 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1552
1552
  formattedEndTime = (0, import_dayjs.default)(endTime);
1553
1553
  }
1554
1554
  resource.endTime = formattedEndTime.format("YYYY-MM-DD HH:mm");
1555
- if ((0, import_dayjs.default)(currentStartTime).add(((_f = (_e = (_d = item._productOrigin) == null ? void 0 : _d.duration) == null ? void 0 : _e.flexible_config) == null ? void 0 : _f.warning_threshold) || 0, "minutes").isAfter((0, import_dayjs.default)(formattedEndTime))) {
1555
+ if (((_f = (_e = (_d = item._productOrigin) == null ? void 0 : _d.duration) == null ? void 0 : _e.flexible_config) == null ? void 0 : _f.is_enable_minimum_duration) && (0, import_dayjs.default)(currentStartTime).add(((_i = (_h = (_g = item._productOrigin) == null ? void 0 : _g.duration) == null ? void 0 : _h.flexible_config) == null ? void 0 : _i.warning_threshold) || 0, "minutes").isAfter((0, import_dayjs.default)(formattedEndTime))) {
1556
1556
  if (!osWarnTips.includes("pisell2.product.card.closing-soon.warning")) {
1557
1557
  osWarnTips.push("pisell2.product.card.closing-soon.warning");
1558
1558
  }
1559
1559
  }
1560
1560
  } else {
1561
1561
  resource.startTime = currentStartTime;
1562
- resource.endTime = (0, import_dayjs.default)(currentStartTime).add(((_h = (_g = item._productOrigin) == null ? void 0 : _g.duration) == null ? void 0 : _h.value) || 10, "minutes").format("YYYY-MM-DD HH:mm");
1562
+ resource.endTime = (0, import_dayjs.default)(currentStartTime).add(((_k = (_j = item._productOrigin) == null ? void 0 : _j.duration) == null ? void 0 : _k.value) || 10, "minutes").format("YYYY-MM-DD HH:mm");
1563
1563
  }
1564
1564
  });
1565
1565
  this.store.cart.updateItem({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.0.211",
4
+ "version": "0.0.213",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",