@pisell/pisellos 0.10.31 → 0.10.32

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.
@@ -0,0 +1,9 @@
1
+ // 导出评估器
2
+ export { PromotionEvaluator } from "./evaluator";
3
+
4
+ // 导出适配器
5
+ export { PromotionAdapter } from "./adapter";
6
+ export { default } from "./adapter";
7
+
8
+ // 导出策略配置示例常量
9
+ export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY, ITEM_REWARD_STRATEGY } from "./examples";
@@ -566,6 +566,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
566
566
  */
567
567
  createOrderByCheckout(params: CheckoutOrderParams): Promise<any>;
568
568
  submitSalesOrder<T = any>(params: SubmitSalesOrderParams): Promise<T>;
569
+ private isSalesCheckoutHandledByOsServer;
569
570
  /**
570
571
  * 发送支付链接邮件。
571
572
  *
@@ -35,6 +35,7 @@ import { OrderHooks } from "./types";
35
35
  import { composeLinePrice, generateDuration, getAllDiscountList, mergeRelationForms, ensureCartItemOriginHolder, buildSubmitPayload, createDefaultTempOrder, createDefaultOrderRulesHooks, createEmptySummary, createUuidV4, formatDateTime, isTempOrder, normalizeOrderMetaList, normalizeBookingIsAll, normalizeBookingSubType, mapPaymentItemsToOrderPayments, normalizeOrderProductDiscountList, resolveEffectivePerUnitDiscount, ensureProductSku, getProductSkuOptions, normalizeProductSkuOptions, sumOptionUnitPrice, clearTempOrderHolderAssignments, getOrderProductLineUid, indexOrderProductsByUid, calculateOrderProductsDeposit, buildPointCardSnapshotFromWalletPassList, mergeOrderProductDisplayFields, resolveIsFormSubject, isMarkdownBundle } from "./utils";
36
36
  import { isNormalProduct } from "../Product/utils";
37
37
  import dayjs from 'dayjs';
38
+ import { stripOsPrivatePayloadFields } from "../../utils/os-private-payload";
38
39
  import { ensureOrderPaymentNumber, mergeOrderPaymentRecord, resolveOrderPaymentIdentity } from "./payment-utils";
39
40
  import { resolvePaymentNumberDevicePrefix, resolvePaymentNumberDevicePrefixFromDeviceId } from "../../utils/payment-number";
40
41
  import { processCartPromotion, appendPromotionTags as _appendPromotionTags, getOrderProductUid as getPromotionUid, PRODUCT_LINE_MERGE_DISABLED_METADATA_KEY } from "../../solution/BaseSales/utils/cartPromotion";
@@ -6283,17 +6284,18 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6283
6284
  key: "submitSalesOrder",
6284
6285
  value: function () {
6285
6286
  var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(params) {
6286
- var url, query, fetchUrl;
6287
+ var url, query, fetchUrl, requestQuery;
6287
6288
  return _regeneratorRuntime().wrap(function _callee40$(_context43) {
6288
6289
  while (1) switch (_context43.prev = _context43.next) {
6289
6290
  case 0:
6290
6291
  url = params.url, query = params.query;
6291
6292
  fetchUrl = url || '/order/sales/checkout';
6292
- return _context43.abrupt("return", this.request.post(fetchUrl, query, {
6293
+ requestQuery = this.isSalesCheckoutHandledByOsServer(fetchUrl) ? query : stripOsPrivatePayloadFields(query);
6294
+ return _context43.abrupt("return", this.request.post(fetchUrl, requestQuery, {
6293
6295
  osServer: true,
6294
6296
  customToast: function customToast() {}
6295
6297
  }));
6296
- case 3:
6298
+ case 4:
6297
6299
  case "end":
6298
6300
  return _context43.stop();
6299
6301
  }
@@ -6304,6 +6306,19 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6304
6306
  }
6305
6307
  return submitSalesOrder;
6306
6308
  }()
6309
+ }, {
6310
+ key: "isSalesCheckoutHandledByOsServer",
6311
+ value: function isSalesCheckoutHandledByOsServer(fetchUrl) {
6312
+ var _this$core2, _this$request;
6313
+ var server = (_this$core2 = this.core) === null || _this$core2 === void 0 ? void 0 : _this$core2.server;
6314
+ if (!server || typeof server.hasRoute !== 'function') return false;
6315
+ var requestBaseUrl = String(((_this$request = this.request) === null || _this$request === void 0 ? void 0 : _this$request.baseUrl) || '/shop').replace(/\/+$/, '');
6316
+ if (!requestBaseUrl.startsWith('/')) return false;
6317
+ var normalizedFetchUrl = fetchUrl.startsWith('/') ? fetchUrl : "/".concat(fetchUrl);
6318
+ var routePath = normalizedFetchUrl === requestBaseUrl || normalizedFetchUrl.startsWith("".concat(requestBaseUrl, "/")) ? normalizedFetchUrl : "".concat(requestBaseUrl).concat(normalizedFetchUrl);
6319
+ return server.hasRoute('post', routePath) === true;
6320
+ }
6321
+
6307
6322
  /**
6308
6323
  * 发送支付链接邮件。
6309
6324
  *
@@ -44,6 +44,7 @@ import { buildSmallTicketData, hasSmallTicketData } from "./utils/small-ticket";
44
44
  import { BaseSalesImpl } from "../solution/BaseSales";
45
45
  import { getOrderPaymentIdentityKeys, isIdentifiedPendingOrderPayment, isPendingOrderPayment, mergeOrderPaymentListsByIdentity } from "../modules/Order/payment-utils";
46
46
  import { normalizeOrderCollections } from "../modules/Order/utils/orderCollectionIdentity";
47
+ import { stripOsPrivatePayloadFields } from "../utils/os-private-payload";
47
48
  import { getDefaultInvoiceLayoutConfig, getDefaultInvoiceTemplateSettings, normalizeRawInvoiceTemplateSettings, resolveInvoiceReceiptLocales } from "../modules/OpenData";
48
49
  var OS_FULFILLMENT_REF_MODE_FIELD = '_os_fulfillment_ref_mode';
49
50
  var OS_INVOICE_LAYOUT_CONFIG_FIELD = '_os_invoice_layout_config';
@@ -2573,7 +2574,7 @@ var Server = /*#__PURE__*/function () {
2573
2574
  return this.ensureCheckoutOrderNumbers(normalizedData, title);
2574
2575
  case 6:
2575
2576
  numberedData = _context32.sent;
2576
- checkoutData = this.normalizeCheckoutCollections(this.applyCheckoutFulfillmentBuzzer(numberedData, title));
2577
+ checkoutData = this.normalizeCheckoutCollections(stripOsPrivatePayloadFields(this.applyCheckoutFulfillmentBuzzer(numberedData, title)));
2577
2578
  remoteCheckoutData = this.buildRemoteCheckoutData(checkoutData, title);
2578
2579
  _context32.next = 11;
2579
2580
  return this.buildCheckoutDeviceHeaders(title);
@@ -2675,11 +2676,9 @@ var Server = /*#__PURE__*/function () {
2675
2676
  }, {
2676
2677
  key: "buildRemoteCheckoutData",
2677
2678
  value: function buildRemoteCheckoutData(data, title) {
2678
- var next = cloneDeep(this.omitCheckoutSyncMode(data));
2679
+ var next = stripOsPrivatePayloadFields(this.omitCheckoutSyncMode(data));
2679
2680
  if (!next || _typeof(next) !== 'object') return next;
2680
2681
  var record = next;
2681
- delete record[OS_FULFILLMENT_REF_MODE_FIELD];
2682
- delete record[OS_INVOICE_LAYOUT_CONFIG_FIELD];
2683
2682
  this.applyKioskCheckoutOperator(record);
2684
2683
  if (!Array.isArray(record.payments)) return next;
2685
2684
  var originalPayments = record.payments;
@@ -6372,7 +6371,7 @@ var Server = /*#__PURE__*/function () {
6372
6371
  return this.ensureCheckoutOrderNumbers(normalizedData, title);
6373
6372
  case 14:
6374
6373
  numberedData = _context62.sent;
6375
- checkoutData = this.normalizeCheckoutCollections(this.applyCheckoutFulfillmentBuzzer(numberedData, title));
6374
+ checkoutData = this.normalizeCheckoutCollections(stripOsPrivatePayloadFields(this.applyCheckoutFulfillmentBuzzer(numberedData, title)));
6376
6375
  _context62.next = 18;
6377
6376
  return this.handlePendingSyncCheckoutOrder({
6378
6377
  backendPath: backendPath,
@@ -39,7 +39,7 @@ var LABELS = {
39
39
  balance: 'Balance',
40
40
  remainingAmount: 'Remaining amount',
41
41
  redeemPoints: 'Redeem points',
42
- remainingPoints: 'Remaining points',
42
+ remainingPoints: 'Point Balance',
43
43
  table: 'Table',
44
44
  orderDiscount: 'Order discount',
45
45
  manualDiscount: 'Manual discount',
@@ -72,7 +72,7 @@ var LABELS = {
72
72
  balance: '余额',
73
73
  remainingAmount: '剩余金额',
74
74
  redeemPoints: '本次使用积分',
75
- remainingPoints: '剩余积分',
75
+ remainingPoints: '积分余额',
76
76
  table: '桌台',
77
77
  orderDiscount: '整单折扣',
78
78
  manualDiscount: '手动折扣',
@@ -105,7 +105,7 @@ var LABELS = {
105
105
  balance: '餘額',
106
106
  remainingAmount: '剩餘金額',
107
107
  redeemPoints: '本次使用積分',
108
- remainingPoints: '剩餘積分',
108
+ remainingPoints: '積分餘額',
109
109
  table: '桌台',
110
110
  orderDiscount: '整單折扣',
111
111
  manualDiscount: '手動折扣',
@@ -136,7 +136,7 @@ var LABELS = {
136
136
  balance: '残高',
137
137
  remainingAmount: '残高',
138
138
  redeemPoints: '利用ポイント',
139
- remainingPoints: '残りポイント',
139
+ remainingPoints: 'ポイント残高',
140
140
  table: 'テーブル',
141
141
  orderDiscount: '注文割引',
142
142
  manualDiscount: '手動割引',
@@ -168,7 +168,7 @@ var LABELS = {
168
168
  balance: 'Saldo',
169
169
  remainingAmount: 'Saldo restante',
170
170
  redeemPoints: 'Pontos utilizados',
171
- remainingPoints: 'Pontos restantes',
171
+ remainingPoints: 'Saldo de pontos',
172
172
  table: 'Mesa',
173
173
  orderDiscount: 'Desconto do pedido',
174
174
  manualDiscount: 'Desconto manual',
@@ -371,10 +371,14 @@ function normalizeProductDiscounts(params) {
371
371
  locale = params.locale,
372
372
  currencySymbol = params.currencySymbol,
373
373
  quantity = params.quantity;
374
- return normalizeArray(product.discount_list).map(function (discount) {
374
+ return normalizeArray(product.discount_list).filter(function (discount) {
375
375
  var _ref8, _discount$amount;
376
- var title = resolveDiscountTitleWithPercent(discount, locale);
377
376
  var amount = (_ref8 = (_discount$amount = discount.amount) !== null && _discount$amount !== void 0 ? _discount$amount : discount.value) !== null && _ref8 !== void 0 ? _ref8 : discount.discount_amount;
377
+ return isNonZero(amount);
378
+ }).map(function (discount) {
379
+ var _ref9, _discount$amount2;
380
+ var title = resolveDiscountTitleWithPercent(discount, locale);
381
+ var amount = (_ref9 = (_discount$amount2 = discount.amount) !== null && _discount$amount2 !== void 0 ? _discount$amount2 : discount.value) !== null && _ref9 !== void 0 ? _ref9 : discount.discount_amount;
378
382
  var formattedAmount = formatNegativeMoney(new Decimal(toMoneyNumber(amount)).mul(quantity), currencySymbol);
379
383
  return {
380
384
  item: title,
@@ -458,8 +462,8 @@ function resolveDiscountTitleWithPercent(discount, locale) {
458
462
  return "".concat(title, " (").concat(percent, "%)");
459
463
  }
460
464
  function resolveDiscountTitle(discount, locale) {
461
- var _ref9, _ref10, _ref11, _ref12, _discount$discount$na, _discount$discount3, _discount$discount4, _discount$discount5;
462
- var title = getLocalizedValue((_ref9 = (_ref10 = (_ref11 = (_ref12 = (_discount$discount$na = (_discount$discount3 = discount.discount) === null || _discount$discount3 === void 0 ? void 0 : _discount$discount3.name) !== null && _discount$discount$na !== void 0 ? _discount$discount$na : (_discount$discount4 = discount.discount) === null || _discount$discount4 === void 0 ? void 0 : _discount$discount4.title) !== null && _ref12 !== void 0 ? _ref12 : (_discount$discount5 = discount.discount) === null || _discount$discount5 === void 0 ? void 0 : _discount$discount5.message) !== null && _ref11 !== void 0 ? _ref11 : discount.name) !== null && _ref10 !== void 0 ? _ref10 : discount.title) !== null && _ref9 !== void 0 ? _ref9 : discount.message, locale);
465
+ var _ref10, _ref11, _ref12, _ref13, _discount$discount$na, _discount$discount3, _discount$discount4, _discount$discount5;
466
+ var title = getLocalizedValue((_ref10 = (_ref11 = (_ref12 = (_ref13 = (_discount$discount$na = (_discount$discount3 = discount.discount) === null || _discount$discount3 === void 0 ? void 0 : _discount$discount3.name) !== null && _discount$discount$na !== void 0 ? _discount$discount$na : (_discount$discount4 = discount.discount) === null || _discount$discount4 === void 0 ? void 0 : _discount$discount4.title) !== null && _ref13 !== void 0 ? _ref13 : (_discount$discount5 = discount.discount) === null || _discount$discount5 === void 0 ? void 0 : _discount$discount5.message) !== null && _ref12 !== void 0 ? _ref12 : discount.name) !== null && _ref11 !== void 0 ? _ref11 : discount.title) !== null && _ref10 !== void 0 ? _ref10 : discount.message, locale);
463
467
  if (title) return title;
464
468
  if (discount.type === 'product') return label(locale, 'manualDiscount');
465
469
  return '';
@@ -484,9 +488,9 @@ function normalizeProductOptions(params) {
484
488
  parentProduct = params.parentProduct;
485
489
  var rawOptions = Array.isArray(params.options) ? params.options : Array.isArray(product.options) ? product.options : Array.isArray((_product$product_sku = product.product_sku) === null || _product$product_sku === void 0 ? void 0 : _product$product_sku.option) ? product.product_sku.option : [];
486
490
  return rawOptions.map(function (option) {
487
- var _ref13, _option$original_pric, _ref14, _option$value, _option$num;
488
- var price = (_ref13 = (_option$original_pric = option.original_price) !== null && _option$original_pric !== void 0 ? _option$original_pric : option.add_price) !== null && _ref13 !== void 0 ? _ref13 : option.price;
489
- var value = (_ref14 = (_option$value = option.value) !== null && _option$value !== void 0 ? _option$value : option.option) !== null && _ref14 !== void 0 ? _ref14 : option.item;
491
+ var _ref14, _option$original_pric, _ref15, _option$value, _option$num;
492
+ var price = (_ref14 = (_option$original_pric = option.original_price) !== null && _option$original_pric !== void 0 ? _option$original_pric : option.add_price) !== null && _ref14 !== void 0 ? _ref14 : option.price;
493
+ var value = (_ref15 = (_option$value = option.value) !== null && _option$value !== void 0 ? _option$value : option.option) !== null && _ref15 !== void 0 ? _ref15 : option.item;
490
494
  var name = getProductTitleSource(option, locale) || resolveOptionTitleFromParentProduct({
491
495
  option: option,
492
496
  parentProduct: parentProduct,
@@ -511,7 +515,7 @@ function normalizeProductCombinations(params) {
511
515
  parentProduct = params.parentProduct;
512
516
  var bundles = Array.isArray(product.product_bundle) ? product.product_bundle : [];
513
517
  return bundles.map(function (bundle) {
514
- var _ref15, _bundle$num;
518
+ var _ref16, _bundle$num;
515
519
  var combinationsOptions = normalizeProductOptions({
516
520
  product: {},
517
521
  locale: locale,
@@ -529,7 +533,7 @@ function normalizeProductCombinations(params) {
529
533
  var nestedCombinations = Array.isArray(bundle.combinations) ? normalizeExistingCombinations(bundle.combinations, locale) : [];
530
534
  return _objectSpread(_objectSpread({
531
535
  product_title: baseTitle,
532
- product_quantity: toNumber((_ref15 = (_bundle$num = bundle.num) !== null && _bundle$num !== void 0 ? _bundle$num : bundle.quantity) !== null && _ref15 !== void 0 ? _ref15 : 1, 1),
536
+ product_quantity: toNumber((_ref16 = (_bundle$num = bundle.num) !== null && _bundle$num !== void 0 ? _bundle$num : bundle.quantity) !== null && _ref16 !== void 0 ? _ref16 : 1, 1),
533
537
  price: formatBundlePrice(bundle, currencySymbol),
534
538
  combinations_options: combinationsOptions
535
539
  }, productNote ? {
@@ -562,7 +566,7 @@ function resolveProductNote(product, locale) {
562
566
  return getLocalizedValue(product.note, locale).trim();
563
567
  }
564
568
  function resolveBundleProductTitle(params) {
565
- var _ref16, _ref17, _bundle$bundle_produc;
569
+ var _ref17, _ref18, _bundle$bundle_produc;
566
570
  var bundle = params.bundle,
567
571
  productMap = params.productMap,
568
572
  locale = params.locale,
@@ -575,7 +579,7 @@ function resolveBundleProductTitle(params) {
575
579
  });
576
580
  var parentBundleTitle = parentBundleItem ? getProductTitleSource(parentBundleItem, locale) : '';
577
581
  if (parentBundleTitle) return parentBundleTitle;
578
- var productId = (_ref16 = (_ref17 = (_bundle$bundle_produc = bundle.bundle_product_id) !== null && _bundle$bundle_produc !== void 0 ? _bundle$bundle_produc : bundle._bundle_product_id) !== null && _ref17 !== void 0 ? _ref17 : bundle.product_id) !== null && _ref16 !== void 0 ? _ref16 : bundle.id;
582
+ var productId = (_ref17 = (_ref18 = (_bundle$bundle_produc = bundle.bundle_product_id) !== null && _bundle$bundle_produc !== void 0 ? _bundle$bundle_produc : bundle._bundle_product_id) !== null && _ref18 !== void 0 ? _ref18 : bundle.product_id) !== null && _ref17 !== void 0 ? _ref17 : bundle.id;
579
583
  var fallbackProduct = resolveProductFromMap(productId, productMap);
580
584
  if (!fallbackProduct) return '';
581
585
  return getProductTitleSource(fallbackProduct, locale);
@@ -627,10 +631,10 @@ function resolveVariantTextFromSkuKey(params) {
627
631
  }
628
632
  function resolveVariantTextFromNameMap(params) {
629
633
  if (!params.nameMap || _typeof(params.nameMap) !== 'object') return '';
630
- return Object.entries(params.nameMap).map(function (_ref18) {
631
- var _ref19 = _slicedToArray(_ref18, 2),
632
- groupPositionId = _ref19[0],
633
- value = _ref19[1];
634
+ return Object.entries(params.nameMap).map(function (_ref19) {
635
+ var _ref20 = _slicedToArray(_ref19, 2),
636
+ groupPositionId = _ref20[0],
637
+ value = _ref20[1];
634
638
  var group = resolveVariantGroup(params.parentProduct, groupPositionId);
635
639
  if (!group) return '';
636
640
  var groupName = getLocalizedValue(group.name, params.locale);
@@ -664,12 +668,12 @@ function getProductTitleSource(source, locale) {
664
668
  return resolveTitleValue(source.product_title, locale) || resolveTitleValue(source.title, locale) || resolveTitleValue(source.name, locale);
665
669
  }
666
670
  function resolveTitleValue(value, locale) {
667
- var _ref20, _ref21, _ref22, _ref23, _value$locale;
671
+ var _ref21, _ref22, _ref23, _ref24, _value$locale;
668
672
  if (value === undefined || value === null) return '';
669
673
  if (_typeof(value) !== 'object') return stringify(value);
670
674
  var dashedLocale = locale.replace('_', '-');
671
675
  var underscoredLocale = locale.replace('-', '_');
672
- return stringify((_ref20 = (_ref21 = (_ref22 = (_ref23 = (_value$locale = value[locale]) !== null && _value$locale !== void 0 ? _value$locale : value[dashedLocale]) !== null && _ref23 !== void 0 ? _ref23 : value[underscoredLocale]) !== null && _ref22 !== void 0 ? _ref22 : value.original) !== null && _ref21 !== void 0 ? _ref21 : value.auto) !== null && _ref20 !== void 0 ? _ref20 : '');
676
+ return stringify((_ref21 = (_ref22 = (_ref23 = (_ref24 = (_value$locale = value[locale]) !== null && _value$locale !== void 0 ? _value$locale : value[dashedLocale]) !== null && _ref24 !== void 0 ? _ref24 : value[underscoredLocale]) !== null && _ref23 !== void 0 ? _ref23 : value.original) !== null && _ref22 !== void 0 ? _ref22 : value.auto) !== null && _ref21 !== void 0 ? _ref21 : '');
673
677
  }
674
678
  function resolveOptionTitleFromParentProduct(params) {
675
679
  var option = params.option,
@@ -687,17 +691,17 @@ function flattenOptionItems(parentProduct) {
687
691
  return optionGroups.flatMap(function (group) {
688
692
  var items = normalizeArray(group.option_item || group.option_items || group.option || group.options || group.items || group.children || group.product_option_item);
689
693
  return items.map(function (item) {
690
- var _ref24, _item$option_group_id;
694
+ var _ref25, _item$option_group_id;
691
695
  return _objectSpread(_objectSpread({}, item), {}, {
692
- option_group_id: (_ref24 = (_item$option_group_id = item.option_group_id) !== null && _item$option_group_id !== void 0 ? _item$option_group_id : group.id) !== null && _ref24 !== void 0 ? _ref24 : group.option_group_id
696
+ option_group_id: (_ref25 = (_item$option_group_id = item.option_group_id) !== null && _item$option_group_id !== void 0 ? _item$option_group_id : group.id) !== null && _ref25 !== void 0 ? _ref25 : group.option_group_id
693
697
  });
694
698
  });
695
699
  });
696
700
  }
697
701
  function isOptionItemMatch(option, item) {
698
- var _ref25, _option$option_group_, _ref26, _item$option_group_it, _option$option_group_2, _item$option_group_id2;
699
- var optionItemId = (_ref25 = (_option$option_group_ = option.option_group_item_id) !== null && _option$option_group_ !== void 0 ? _option$option_group_ : option.product_option_item_id) !== null && _ref25 !== void 0 ? _ref25 : option.id;
700
- var itemId = (_ref26 = (_item$option_group_it = item.option_group_item_id) !== null && _item$option_group_it !== void 0 ? _item$option_group_it : item.product_option_item_id) !== null && _ref26 !== void 0 ? _ref26 : item.id;
702
+ var _ref26, _option$option_group_, _ref27, _item$option_group_it, _option$option_group_2, _item$option_group_id2;
703
+ var optionItemId = (_ref26 = (_option$option_group_ = option.option_group_item_id) !== null && _option$option_group_ !== void 0 ? _option$option_group_ : option.product_option_item_id) !== null && _ref26 !== void 0 ? _ref26 : option.id;
704
+ var itemId = (_ref27 = (_item$option_group_it = item.option_group_item_id) !== null && _item$option_group_it !== void 0 ? _item$option_group_it : item.product_option_item_id) !== null && _ref27 !== void 0 ? _ref27 : item.id;
701
705
  if (!isSameId(optionItemId, itemId)) return false;
702
706
  var optionGroupId = (_option$option_group_2 = option.option_group_id) !== null && _option$option_group_2 !== void 0 ? _option$option_group_2 : option.group_id;
703
707
  var itemGroupId = (_item$option_group_id2 = item.option_group_id) !== null && _item$option_group_id2 !== void 0 ? _item$option_group_id2 : item.group_id;
@@ -707,16 +711,16 @@ function isOptionItemMatch(option, item) {
707
711
  return true;
708
712
  }
709
713
  function resolveBundleItemFromParentProduct(params) {
710
- var _ref27, _bundle$bundle_varian, _bundle$bundle_id, _bundle$bundle_group_, _ref29, _bundle$bundle_produc2;
714
+ var _ref28, _bundle$bundle_varian, _bundle$bundle_id, _bundle$bundle_group_, _ref30, _bundle$bundle_produc2;
711
715
  var bundle = params.bundle,
712
716
  parentProduct = params.parentProduct;
713
717
  if (!parentProduct) return null;
714
718
  var bundleItems = flattenBundleItems(parentProduct);
715
- var bundleVariantId = (_ref27 = (_bundle$bundle_varian = bundle.bundle_variant_id) !== null && _bundle$bundle_varian !== void 0 ? _bundle$bundle_varian : bundle.variant_id) !== null && _ref27 !== void 0 ? _ref27 : bundle.product_variant_id;
719
+ var bundleVariantId = (_ref28 = (_bundle$bundle_varian = bundle.bundle_variant_id) !== null && _bundle$bundle_varian !== void 0 ? _bundle$bundle_varian : bundle.variant_id) !== null && _ref28 !== void 0 ? _ref28 : bundle.product_variant_id;
716
720
  if (isNonZeroId(bundleVariantId)) {
717
721
  var matchedByVariant = bundleItems.find(function (item) {
718
- var _ref28, _item$bundle_variant_;
719
- return isSameId((_ref28 = (_item$bundle_variant_ = item.bundle_variant_id) !== null && _item$bundle_variant_ !== void 0 ? _item$bundle_variant_ : item.variant_id) !== null && _ref28 !== void 0 ? _ref28 : item.product_variant_id, bundleVariantId);
722
+ var _ref29, _item$bundle_variant_;
723
+ return isSameId((_ref29 = (_item$bundle_variant_ = item.bundle_variant_id) !== null && _item$bundle_variant_ !== void 0 ? _item$bundle_variant_ : item.variant_id) !== null && _ref29 !== void 0 ? _ref29 : item.product_variant_id, bundleVariantId);
720
724
  });
721
725
  if (matchedByVariant) return matchedByVariant;
722
726
  }
@@ -729,18 +733,18 @@ function resolveBundleItemFromParentProduct(params) {
729
733
  if (matchedByBundleId) return matchedByBundleId;
730
734
  }
731
735
  var bundleGroupId = (_bundle$bundle_group_ = bundle.bundle_group_id) !== null && _bundle$bundle_group_ !== void 0 ? _bundle$bundle_group_ : bundle.group_id;
732
- var bundleProductId = (_ref29 = (_bundle$bundle_produc2 = bundle.bundle_product_id) !== null && _bundle$bundle_produc2 !== void 0 ? _bundle$bundle_produc2 : bundle._bundle_product_id) !== null && _ref29 !== void 0 ? _ref29 : bundle.product_id;
736
+ var bundleProductId = (_ref30 = (_bundle$bundle_produc2 = bundle.bundle_product_id) !== null && _bundle$bundle_produc2 !== void 0 ? _bundle$bundle_produc2 : bundle._bundle_product_id) !== null && _ref30 !== void 0 ? _ref30 : bundle.product_id;
733
737
  if (isPresentId(bundleGroupId) && isPresentId(bundleProductId)) {
734
738
  var matchedByGroupAndProduct = bundleItems.find(function (item) {
735
- var _item$group_id, _ref30, _item$bundle_product_;
736
- return isSameId((_item$group_id = item.group_id) !== null && _item$group_id !== void 0 ? _item$group_id : item.bundle_group_id, bundleGroupId) && isSameId((_ref30 = (_item$bundle_product_ = item.bundle_product_id) !== null && _item$bundle_product_ !== void 0 ? _item$bundle_product_ : item._bundle_product_id) !== null && _ref30 !== void 0 ? _ref30 : item.product_id, bundleProductId);
739
+ var _item$group_id, _ref31, _item$bundle_product_;
740
+ return isSameId((_item$group_id = item.group_id) !== null && _item$group_id !== void 0 ? _item$group_id : item.bundle_group_id, bundleGroupId) && isSameId((_ref31 = (_item$bundle_product_ = item.bundle_product_id) !== null && _item$bundle_product_ !== void 0 ? _item$bundle_product_ : item._bundle_product_id) !== null && _ref31 !== void 0 ? _ref31 : item.product_id, bundleProductId);
737
741
  });
738
742
  if (matchedByGroupAndProduct) return matchedByGroupAndProduct;
739
743
  }
740
744
  if (isPresentId(bundleProductId)) {
741
745
  return bundleItems.find(function (item) {
742
- var _ref31, _item$bundle_product_2;
743
- return isSameId((_ref31 = (_item$bundle_product_2 = item.bundle_product_id) !== null && _item$bundle_product_2 !== void 0 ? _item$bundle_product_2 : item._bundle_product_id) !== null && _ref31 !== void 0 ? _ref31 : item.product_id, bundleProductId);
746
+ var _ref32, _item$bundle_product_2;
747
+ return isSameId((_ref32 = (_item$bundle_product_2 = item.bundle_product_id) !== null && _item$bundle_product_2 !== void 0 ? _item$bundle_product_2 : item._bundle_product_id) !== null && _ref32 !== void 0 ? _ref32 : item.product_id, bundleProductId);
744
748
  }) || null;
745
749
  }
746
750
  return null;
@@ -750,9 +754,9 @@ function flattenBundleItems(parentProduct) {
750
754
  return bundleGroups.flatMap(function (group) {
751
755
  var items = Array.isArray(group.bundle_item) ? group.bundle_item : [];
752
756
  return items.map(function (item) {
753
- var _ref32, _item$group_id2;
757
+ var _ref33, _item$group_id2;
754
758
  return _objectSpread(_objectSpread({}, item), {}, {
755
- group_id: (_ref32 = (_item$group_id2 = item.group_id) !== null && _item$group_id2 !== void 0 ? _item$group_id2 : group.id) !== null && _ref32 !== void 0 ? _ref32 : group.group_id
759
+ group_id: (_ref33 = (_item$group_id2 = item.group_id) !== null && _item$group_id2 !== void 0 ? _item$group_id2 : group.id) !== null && _ref33 !== void 0 ? _ref33 : group.group_id
756
760
  });
757
761
  });
758
762
  });
@@ -776,8 +780,8 @@ function isSameId(left, right) {
776
780
  return String(left) === String(right);
777
781
  }
778
782
  function formatBundlePrice(bundle, currencySymbol) {
779
- var _ref33, _ref34, _bundle$bundle_sellin;
780
- var value = (_ref33 = (_ref34 = (_bundle$bundle_sellin = bundle.bundle_selling_price) !== null && _bundle$bundle_sellin !== void 0 ? _bundle$bundle_sellin : bundle.bundle_sum_price) !== null && _ref34 !== void 0 ? _ref34 : bundle.price) !== null && _ref33 !== void 0 ? _ref33 : 0;
783
+ var _ref34, _ref35, _bundle$bundle_sellin;
784
+ var value = (_ref34 = (_ref35 = (_bundle$bundle_sellin = bundle.bundle_selling_price) !== null && _bundle$bundle_sellin !== void 0 ? _bundle$bundle_sellin : bundle.bundle_sum_price) !== null && _ref35 !== void 0 ? _ref35 : bundle.price) !== null && _ref34 !== void 0 ? _ref34 : 0;
781
785
  var amount = new Decimal(toMoneyNumber(value));
782
786
  // 套餐价格协议:只有 markdown 是减价;加价与商品原价都保持正数。
783
787
  var isNegative = bundle.price_type === 'markdown';
@@ -795,9 +799,9 @@ function buildFees(params) {
795
799
  financials = params.financials;
796
800
  var fees = [];
797
801
  for (var _i = 0, _normalizeArray = normalizeArray(order.surcharges || summary.surcharges); _i < _normalizeArray.length; _i++) {
798
- var _ref35, _surcharge$amount;
802
+ var _ref36, _surcharge$amount;
799
803
  var surcharge = _normalizeArray[_i];
800
- var value = (_ref35 = (_surcharge$amount = surcharge.amount) !== null && _surcharge$amount !== void 0 ? _surcharge$amount : surcharge.value) !== null && _ref35 !== void 0 ? _ref35 : surcharge.total_amount;
804
+ var value = (_ref36 = (_surcharge$amount = surcharge.amount) !== null && _surcharge$amount !== void 0 ? _surcharge$amount : surcharge.value) !== null && _ref36 !== void 0 ? _ref36 : surcharge.total_amount;
801
805
  if (!isNonZero(value)) continue;
802
806
  fees.push({
803
807
  item: getLocalizedValue(surcharge.name || surcharge.title || surcharge.item, locale),
@@ -903,9 +907,9 @@ function resolveTaxTitle(params) {
903
907
  }
904
908
  function calculateProductOriginalAmount(order) {
905
909
  return normalizeArray(order.products).reduce(function (total, product) {
906
- var _ref36, _ref37, _product$product_quan2, _ref38, _ref39, _ref40, _product$original_pri2;
907
- var quantity = toNumber((_ref36 = (_ref37 = (_product$product_quan2 = product.product_quantity) !== null && _product$product_quan2 !== void 0 ? _product$product_quan2 : product.quantity) !== null && _ref37 !== void 0 ? _ref37 : product.num) !== null && _ref36 !== void 0 ? _ref36 : 1, 1);
908
- var originalPrice = (_ref38 = (_ref39 = (_ref40 = (_product$original_pri2 = product.original_price) !== null && _product$original_pri2 !== void 0 ? _product$original_pri2 : product.selling_price) !== null && _ref40 !== void 0 ? _ref40 : product.payment_price) !== null && _ref39 !== void 0 ? _ref39 : product.price) !== null && _ref38 !== void 0 ? _ref38 : 0;
910
+ var _ref37, _ref38, _product$product_quan2, _ref39, _ref40, _ref41, _product$original_pri2;
911
+ var quantity = toNumber((_ref37 = (_ref38 = (_product$product_quan2 = product.product_quantity) !== null && _product$product_quan2 !== void 0 ? _product$product_quan2 : product.quantity) !== null && _ref38 !== void 0 ? _ref38 : product.num) !== null && _ref37 !== void 0 ? _ref37 : 1, 1);
912
+ var originalPrice = (_ref39 = (_ref40 = (_ref41 = (_product$original_pri2 = product.original_price) !== null && _product$original_pri2 !== void 0 ? _product$original_pri2 : product.selling_price) !== null && _ref41 !== void 0 ? _ref41 : product.payment_price) !== null && _ref40 !== void 0 ? _ref40 : product.price) !== null && _ref39 !== void 0 ? _ref39 : 0;
909
913
  return total.plus(new Decimal(toMoneyNumber(originalPrice)).mul(quantity));
910
914
  }, new Decimal(0));
911
915
  }
@@ -993,8 +997,8 @@ function sortBookings(bookings) {
993
997
  }
994
998
  var bookingUidOrder = compareOptionalValues(firstPresentValue((_left$booking2 = left.booking) === null || _left$booking2 === void 0 || (_left$booking2 = _left$booking2.metadata) === null || _left$booking2 === void 0 ? void 0 : _left$booking2.unique_identification_number, (_left$booking3 = left.booking) === null || _left$booking3 === void 0 ? void 0 : _left$booking3.booking_uid), firstPresentValue((_right$booking2 = right.booking) === null || _right$booking2 === void 0 || (_right$booking2 = _right$booking2.metadata) === null || _right$booking2 === void 0 ? void 0 : _right$booking2.unique_identification_number, (_right$booking3 = right.booking) === null || _right$booking3 === void 0 ? void 0 : _right$booking3.booking_uid));
995
999
  return bookingUidOrder || left.index - right.index;
996
- }).map(function (_ref41) {
997
- var booking = _ref41.booking;
1000
+ }).map(function (_ref42) {
1001
+ var booking = _ref42.booking;
998
1002
  return booking;
999
1003
  });
1000
1004
  }
@@ -1037,7 +1041,9 @@ function buildPaymentData(params) {
1037
1041
  payment: payment,
1038
1042
  locale: params.locale,
1039
1043
  currencySymbol: params.currencySymbol,
1040
- includeFundRecordBalance: false
1044
+ includeFundRecordBalance: false,
1045
+ includeFundRecordUsage: true,
1046
+ includePaymentAmount: true
1041
1047
  });
1042
1048
  });
1043
1049
  }
@@ -1054,8 +1060,8 @@ function buildRefundData(params) {
1054
1060
  result.set(identity, candidate);
1055
1061
  }
1056
1062
  return result;
1057
- }, new Map()).values()).filter(function (_ref42) {
1058
- var refund = _ref42.refund;
1063
+ }, new Map()).values()).filter(function (_ref43) {
1064
+ var refund = _ref43.refund;
1059
1065
  return isPrintableRefund(refund);
1060
1066
  }).sort(function (left, right) {
1061
1067
  var leftTime = refundTimestamp(left.refund);
@@ -1063,9 +1069,9 @@ function buildRefundData(params) {
1063
1069
  if (leftTime !== rightTime) return leftTime < rightTime ? -1 : 1;
1064
1070
  return left.index - right.index;
1065
1071
  });
1066
- return refunds.map(function (_ref43) {
1072
+ return refunds.map(function (_ref44) {
1067
1073
  var _firstPresentValue7;
1068
- var refund = _ref43.refund;
1074
+ var refund = _ref44.refund;
1069
1075
  var payment = resolveRefundPayment(refund, payments);
1070
1076
  var methodName = paymentMethodName(payment, params.locale) || label(params.locale, 'refund');
1071
1077
  var amount = (_firstPresentValue7 = firstPresentValue(refund.amount, refund.refund_amount, refund.total_amount)) !== null && _firstPresentValue7 !== void 0 ? _firstPresentValue7 : 0;
@@ -1133,7 +1139,9 @@ function buildWallets(params) {
1133
1139
  payment: payment,
1134
1140
  locale: params.locale,
1135
1141
  currencySymbol: params.currencySymbol,
1136
- includeFundRecordBalance: true
1142
+ includeFundRecordBalance: true,
1143
+ includeFundRecordUsage: false,
1144
+ includePaymentAmount: false
1137
1145
  });
1138
1146
  });
1139
1147
  var displayedWalletPassIds = collectDisplayedWalletPassIds(displayedWalletPayments);
@@ -1254,11 +1262,13 @@ function buildPaymentItems(params) {
1254
1262
  var payment = params.payment,
1255
1263
  locale = params.locale,
1256
1264
  currencySymbol = params.currencySymbol,
1257
- includeFundRecordBalance = params.includeFundRecordBalance;
1265
+ includeFundRecordBalance = params.includeFundRecordBalance,
1266
+ includeFundRecordUsage = params.includeFundRecordUsage,
1267
+ includePaymentAmount = params.includePaymentAmount;
1258
1268
  var serviceFee = getPaymentServiceFee(payment);
1259
1269
  var items = [{
1260
1270
  item: paymentMethodName(payment, locale),
1261
- value: formatMoney(resolveReceiptPaymentAmount(payment, serviceFee), currencySymbol)
1271
+ value: includePaymentAmount ? formatMoney(resolveReceiptPaymentAmount(payment, serviceFee), currencySymbol) : ''
1262
1272
  }];
1263
1273
  items.push.apply(items, _toConsumableArray(buildCashChangePaymentItems({
1264
1274
  payment: payment,
@@ -1278,11 +1288,12 @@ function buildPaymentItems(params) {
1278
1288
  fundRecord: fundRecord,
1279
1289
  locale: locale,
1280
1290
  currencySymbol: currencySymbol,
1281
- includeBalance: includeFundRecordBalance
1291
+ includeBalance: includeFundRecordBalance,
1292
+ includeUsage: includeFundRecordUsage
1282
1293
  })));
1283
1294
  } else {
1284
- var _ref44, _payment$remaining_am, _payment$metadata;
1285
- var remainingAmount = (_ref44 = (_payment$remaining_am = payment.remaining_amount) !== null && _payment$remaining_am !== void 0 ? _payment$remaining_am : payment.balance) !== null && _ref44 !== void 0 ? _ref44 : (_payment$metadata = payment.metadata) === null || _payment$metadata === void 0 ? void 0 : _payment$metadata.remaining_amount;
1295
+ var _ref45, _payment$remaining_am, _payment$metadata;
1296
+ var remainingAmount = (_ref45 = (_payment$remaining_am = payment.remaining_amount) !== null && _payment$remaining_am !== void 0 ? _payment$remaining_am : payment.balance) !== null && _ref45 !== void 0 ? _ref45 : (_payment$metadata = payment.metadata) === null || _payment$metadata === void 0 ? void 0 : _payment$metadata.remaining_amount;
1286
1297
  if (remainingAmount !== undefined && remainingAmount !== null) {
1287
1298
  items.push({
1288
1299
  item: label(locale, 'remainingAmount'),
@@ -1342,16 +1353,19 @@ function buildFundRecordPaymentItems(params) {
1342
1353
  fundRecord = params.fundRecord,
1343
1354
  locale = params.locale,
1344
1355
  currencySymbol = params.currencySymbol,
1345
- includeBalance = params.includeBalance;
1356
+ includeBalance = params.includeBalance,
1357
+ includeUsage = params.includeUsage;
1346
1358
  var items = [];
1347
1359
  var usingBeforeValue = fundRecord.using_before_value;
1348
1360
  var usingAfterValue = fundRecord.using_after_value;
1349
1361
  if (isPointCardPayment(payment) && usingBeforeValue !== undefined && usingAfterValue !== undefined) {
1350
1362
  var usedPoints = new Decimal(toMoneyNumber(usingBeforeValue)).minus(toMoneyNumber(usingAfterValue));
1351
- items.push({
1352
- item: label(locale, 'redeemPoints'),
1353
- value: trimDecimal(usedPoints)
1354
- });
1363
+ if (includeUsage) {
1364
+ items.push({
1365
+ item: label(locale, 'redeemPoints'),
1366
+ value: trimDecimal(usedPoints)
1367
+ });
1368
+ }
1355
1369
  if (includeBalance) {
1356
1370
  items.push({
1357
1371
  item: label(locale, 'remainingPoints'),
@@ -1362,7 +1376,7 @@ function buildFundRecordPaymentItems(params) {
1362
1376
  }
1363
1377
  if (includeBalance && usingAfterValue !== undefined && usingAfterValue !== null) {
1364
1378
  items.push({
1365
- item: label(locale, 'remainingAmount'),
1379
+ item: label(locale, 'balance'),
1366
1380
  value: formatMoney(usingAfterValue, currencySymbol)
1367
1381
  });
1368
1382
  }
@@ -1433,12 +1447,12 @@ function label(locale, key) {
1433
1447
  return ((_LABELS$locale = LABELS[locale]) === null || _LABELS$locale === void 0 ? void 0 : _LABELS$locale[key]) || LABELS.en[key] || key;
1434
1448
  }
1435
1449
  function getLocalizedValue(value, locale) {
1436
- var _ref45, _ref46, _ref47, _ref48, _ref49, _ref50, _value$locale2;
1450
+ var _ref46, _ref47, _ref48, _ref49, _ref50, _ref51, _value$locale2;
1437
1451
  if (value === undefined || value === null) return '';
1438
1452
  if (_typeof(value) !== 'object') return stringify(value);
1439
1453
  var dashedLocale = locale.replace('_', '-');
1440
1454
  var underscoredLocale = locale.replace('-', '_');
1441
- return stringify((_ref45 = (_ref46 = (_ref47 = (_ref48 = (_ref49 = (_ref50 = (_value$locale2 = value[locale]) !== null && _value$locale2 !== void 0 ? _value$locale2 : value[dashedLocale]) !== null && _ref50 !== void 0 ? _ref50 : value[underscoredLocale]) !== null && _ref49 !== void 0 ? _ref49 : value.original) !== null && _ref48 !== void 0 ? _ref48 : value.auto) !== null && _ref47 !== void 0 ? _ref47 : value.default) !== null && _ref46 !== void 0 ? _ref46 : value.en) !== null && _ref45 !== void 0 ? _ref45 : '');
1455
+ return stringify((_ref46 = (_ref47 = (_ref48 = (_ref49 = (_ref50 = (_ref51 = (_value$locale2 = value[locale]) !== null && _value$locale2 !== void 0 ? _value$locale2 : value[dashedLocale]) !== null && _ref51 !== void 0 ? _ref51 : value[underscoredLocale]) !== null && _ref50 !== void 0 ? _ref50 : value.original) !== null && _ref49 !== void 0 ? _ref49 : value.auto) !== null && _ref48 !== void 0 ? _ref48 : value.default) !== null && _ref47 !== void 0 ? _ref47 : value.en) !== null && _ref46 !== void 0 ? _ref46 : '');
1442
1456
  }
1443
1457
  function resolveServiceTypeLabelKey(serviceType, order) {
1444
1458
  var normalized = serviceType.trim().toLowerCase().replace(/[\s-]+/g, '_');
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
326
326
  date: string;
327
327
  status: string;
328
328
  week: string;
329
- weekNum: 0 | 5 | 3 | 1 | 2 | 4 | 6;
329
+ weekNum: 0 | 1 | 2 | 5 | 4 | 3 | 6;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Remove top-level fields reserved for communication with the PisellOS proxy.
3
+ * Nested business payloads are intentionally left untouched.
4
+ */
5
+ export declare function stripOsPrivatePayloadFields<T>(data: T): T;
@@ -0,0 +1,17 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ import { cloneDeep } from 'lodash-es';
3
+ var OS_PRIVATE_FIELD_PREFIX = '_os_';
4
+
5
+ /**
6
+ * Remove top-level fields reserved for communication with the PisellOS proxy.
7
+ * Nested business payloads are intentionally left untouched.
8
+ */
9
+ export function stripOsPrivatePayloadFields(data) {
10
+ var next = cloneDeep(data);
11
+ if (!next || _typeof(next) !== 'object' || Array.isArray(next)) return next;
12
+ var record = next;
13
+ Object.keys(record).forEach(function (key) {
14
+ if (key.startsWith(OS_PRIVATE_FIELD_PREFIX)) delete record[key];
15
+ });
16
+ return next;
17
+ }
@@ -566,6 +566,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
566
566
  */
567
567
  createOrderByCheckout(params: CheckoutOrderParams): Promise<any>;
568
568
  submitSalesOrder<T = any>(params: SubmitSalesOrderParams): Promise<T>;
569
+ private isSalesCheckoutHandledByOsServer;
569
570
  /**
570
571
  * 发送支付链接邮件。
571
572
  *
@@ -9,6 +9,7 @@ var _types = require("./types");
9
9
  var _utils = require("./utils");
10
10
  var _utils2 = require("../Product/utils");
11
11
  var _dayjs = _interopRequireDefault(require("dayjs"));
12
+ var _osPrivatePayload = require("../../utils/os-private-payload");
12
13
  var _paymentUtils = require("./payment-utils");
13
14
  var _paymentNumber = require("../../utils/payment-number");
14
15
  var _cartPromotion = require("../../solution/BaseSales/utils/cartPromotion");
@@ -4358,11 +4359,21 @@ class OrderModule extends _BaseModule.BaseModule {
4358
4359
  query
4359
4360
  } = params;
4360
4361
  const fetchUrl = url || '/order/sales/checkout';
4361
- return this.request.post(fetchUrl, query, {
4362
+ const requestQuery = this.isSalesCheckoutHandledByOsServer(fetchUrl) ? query : (0, _osPrivatePayload.stripOsPrivatePayloadFields)(query);
4363
+ return this.request.post(fetchUrl, requestQuery, {
4362
4364
  osServer: true,
4363
4365
  customToast: () => {}
4364
4366
  });
4365
4367
  }
4368
+ isSalesCheckoutHandledByOsServer(fetchUrl) {
4369
+ const server = this.core?.server;
4370
+ if (!server || typeof server.hasRoute !== 'function') return false;
4371
+ const requestBaseUrl = String(this.request?.baseUrl || '/shop').replace(/\/+$/, '');
4372
+ if (!requestBaseUrl.startsWith('/')) return false;
4373
+ const normalizedFetchUrl = fetchUrl.startsWith('/') ? fetchUrl : `/${fetchUrl}`;
4374
+ const routePath = normalizedFetchUrl === requestBaseUrl || normalizedFetchUrl.startsWith(`${requestBaseUrl}/`) ? normalizedFetchUrl : `${requestBaseUrl}${normalizedFetchUrl}`;
4375
+ return server.hasRoute('post', routePath) === true;
4376
+ }
4366
4377
 
4367
4378
  /**
4368
4379
  * 发送支付链接邮件。
@@ -28,6 +28,7 @@ var _smallTicket = require("./utils/small-ticket");
28
28
  var _BaseSales = require("../solution/BaseSales");
29
29
  var _paymentUtils = require("../modules/Order/payment-utils");
30
30
  var _orderCollectionIdentity = require("../modules/Order/utils/orderCollectionIdentity");
31
+ var _osPrivatePayload = require("../utils/os-private-payload");
31
32
  var _OpenData = require("../modules/OpenData");
32
33
  var _modules = require("./modules");
33
34
  Object.keys(_modules).forEach(function (key) {
@@ -642,7 +643,7 @@ class Server {
642
643
  } = params;
643
644
  const normalizedData = await this.normalizeCheckoutSubmitData(params.data, title);
644
645
  const numberedData = await this.ensureCheckoutOrderNumbers(normalizedData, title);
645
- const checkoutData = this.normalizeCheckoutCollections(this.applyCheckoutFulfillmentBuzzer(numberedData, title));
646
+ const checkoutData = this.normalizeCheckoutCollections((0, _osPrivatePayload.stripOsPrivatePayloadFields)(this.applyCheckoutFulfillmentBuzzer(numberedData, title)));
646
647
  const remoteCheckoutData = this.buildRemoteCheckoutData(checkoutData, title);
647
648
  const deviceHeaders = await this.buildCheckoutDeviceHeaders(title);
648
649
  if (!this.app?.request?.post) {
@@ -714,11 +715,9 @@ class Server {
714
715
  return next;
715
716
  }
716
717
  buildRemoteCheckoutData(data, title) {
717
- const next = (0, _lodashEs.cloneDeep)(this.omitCheckoutSyncMode(data));
718
+ const next = (0, _osPrivatePayload.stripOsPrivatePayloadFields)(this.omitCheckoutSyncMode(data));
718
719
  if (!next || typeof next !== 'object') return next;
719
720
  const record = next;
720
- delete record[OS_FULFILLMENT_REF_MODE_FIELD];
721
- delete record[OS_INVOICE_LAYOUT_CONFIG_FIELD];
722
721
  this.applyKioskCheckoutOperator(record);
723
722
  if (!Array.isArray(record.payments)) return next;
724
723
  const originalPayments = record.payments;
@@ -4294,7 +4293,7 @@ class Server {
4294
4293
  }
4295
4294
  const normalizedData = await this.normalizeCheckoutSubmitData(data, title);
4296
4295
  const numberedData = await this.ensureCheckoutOrderNumbers(normalizedData, title);
4297
- const checkoutData = this.normalizeCheckoutCollections(this.applyCheckoutFulfillmentBuzzer(numberedData, title));
4296
+ const checkoutData = this.normalizeCheckoutCollections((0, _osPrivatePayload.stripOsPrivatePayloadFields)(this.applyCheckoutFulfillmentBuzzer(numberedData, title)));
4298
4297
  const pendingResult = await this.handlePendingSyncCheckoutOrder({
4299
4298
  backendPath,
4300
4299
  data: checkoutData,
@@ -31,7 +31,7 @@ const LABELS = {
31
31
  balance: 'Balance',
32
32
  remainingAmount: 'Remaining amount',
33
33
  redeemPoints: 'Redeem points',
34
- remainingPoints: 'Remaining points',
34
+ remainingPoints: 'Point Balance',
35
35
  table: 'Table',
36
36
  orderDiscount: 'Order discount',
37
37
  manualDiscount: 'Manual discount',
@@ -64,7 +64,7 @@ const LABELS = {
64
64
  balance: '余额',
65
65
  remainingAmount: '剩余金额',
66
66
  redeemPoints: '本次使用积分',
67
- remainingPoints: '剩余积分',
67
+ remainingPoints: '积分余额',
68
68
  table: '桌台',
69
69
  orderDiscount: '整单折扣',
70
70
  manualDiscount: '手动折扣',
@@ -97,7 +97,7 @@ const LABELS = {
97
97
  balance: '餘額',
98
98
  remainingAmount: '剩餘金額',
99
99
  redeemPoints: '本次使用積分',
100
- remainingPoints: '剩餘積分',
100
+ remainingPoints: '積分餘額',
101
101
  table: '桌台',
102
102
  orderDiscount: '整單折扣',
103
103
  manualDiscount: '手動折扣',
@@ -128,7 +128,7 @@ const LABELS = {
128
128
  balance: '残高',
129
129
  remainingAmount: '残高',
130
130
  redeemPoints: '利用ポイント',
131
- remainingPoints: '残りポイント',
131
+ remainingPoints: 'ポイント残高',
132
132
  table: 'テーブル',
133
133
  orderDiscount: '注文割引',
134
134
  manualDiscount: '手動割引',
@@ -160,7 +160,7 @@ const LABELS = {
160
160
  balance: 'Saldo',
161
161
  remainingAmount: 'Saldo restante',
162
162
  redeemPoints: 'Pontos utilizados',
163
- remainingPoints: 'Pontos restantes',
163
+ remainingPoints: 'Saldo de pontos',
164
164
  table: 'Mesa',
165
165
  orderDiscount: 'Desconto do pedido',
166
166
  manualDiscount: 'Desconto manual',
@@ -371,7 +371,10 @@ function normalizeProductDiscounts(params) {
371
371
  currencySymbol,
372
372
  quantity
373
373
  } = params;
374
- return normalizeArray(product.discount_list).map(discount => {
374
+ return normalizeArray(product.discount_list).filter(discount => {
375
+ const amount = discount.amount ?? discount.value ?? discount.discount_amount;
376
+ return isNonZero(amount);
377
+ }).map(discount => {
375
378
  const title = resolveDiscountTitleWithPercent(discount, locale);
376
379
  const amount = discount.amount ?? discount.value ?? discount.discount_amount;
377
380
  const formattedAmount = formatNegativeMoney(new _decimal.default(toMoneyNumber(amount)).mul(quantity), currencySymbol);
@@ -1004,7 +1007,9 @@ function buildPaymentData(params) {
1004
1007
  payment,
1005
1008
  locale: params.locale,
1006
1009
  currencySymbol: params.currencySymbol,
1007
- includeFundRecordBalance: false
1010
+ includeFundRecordBalance: false,
1011
+ includeFundRecordUsage: true,
1012
+ includePaymentAmount: true
1008
1013
  }));
1009
1014
  }
1010
1015
  function buildRefundData(params) {
@@ -1093,7 +1098,9 @@ function buildWallets(params) {
1093
1098
  payment,
1094
1099
  locale: params.locale,
1095
1100
  currencySymbol: params.currencySymbol,
1096
- includeFundRecordBalance: true
1101
+ includeFundRecordBalance: true,
1102
+ includeFundRecordUsage: false,
1103
+ includePaymentAmount: false
1097
1104
  }));
1098
1105
  const displayedWalletPassIds = collectDisplayedWalletPassIds(displayedWalletPayments);
1099
1106
  return [...paymentWallets, ...buildVoucherAssets(params), ...buildPointCardSnapshotAssets({
@@ -1212,12 +1219,14 @@ function buildPaymentItems(params) {
1212
1219
  payment,
1213
1220
  locale,
1214
1221
  currencySymbol,
1215
- includeFundRecordBalance
1222
+ includeFundRecordBalance,
1223
+ includeFundRecordUsage,
1224
+ includePaymentAmount
1216
1225
  } = params;
1217
1226
  const serviceFee = getPaymentServiceFee(payment);
1218
1227
  const items = [{
1219
1228
  item: paymentMethodName(payment, locale),
1220
- value: formatMoney(resolveReceiptPaymentAmount(payment, serviceFee), currencySymbol)
1229
+ value: includePaymentAmount ? formatMoney(resolveReceiptPaymentAmount(payment, serviceFee), currencySymbol) : ''
1221
1230
  }];
1222
1231
  items.push(...buildCashChangePaymentItems({
1223
1232
  payment,
@@ -1237,7 +1246,8 @@ function buildPaymentItems(params) {
1237
1246
  fundRecord,
1238
1247
  locale,
1239
1248
  currencySymbol,
1240
- includeBalance: includeFundRecordBalance
1249
+ includeBalance: includeFundRecordBalance,
1250
+ includeUsage: includeFundRecordUsage
1241
1251
  }));
1242
1252
  } else {
1243
1253
  const remainingAmount = payment.remaining_amount ?? payment.balance ?? payment.metadata?.remaining_amount;
@@ -1301,17 +1311,20 @@ function buildFundRecordPaymentItems(params) {
1301
1311
  fundRecord,
1302
1312
  locale,
1303
1313
  currencySymbol,
1304
- includeBalance
1314
+ includeBalance,
1315
+ includeUsage
1305
1316
  } = params;
1306
1317
  const items = [];
1307
1318
  const usingBeforeValue = fundRecord.using_before_value;
1308
1319
  const usingAfterValue = fundRecord.using_after_value;
1309
1320
  if (isPointCardPayment(payment) && usingBeforeValue !== undefined && usingAfterValue !== undefined) {
1310
1321
  const usedPoints = new _decimal.default(toMoneyNumber(usingBeforeValue)).minus(toMoneyNumber(usingAfterValue));
1311
- items.push({
1312
- item: label(locale, 'redeemPoints'),
1313
- value: trimDecimal(usedPoints)
1314
- });
1322
+ if (includeUsage) {
1323
+ items.push({
1324
+ item: label(locale, 'redeemPoints'),
1325
+ value: trimDecimal(usedPoints)
1326
+ });
1327
+ }
1315
1328
  if (includeBalance) {
1316
1329
  items.push({
1317
1330
  item: label(locale, 'remainingPoints'),
@@ -1322,7 +1335,7 @@ function buildFundRecordPaymentItems(params) {
1322
1335
  }
1323
1336
  if (includeBalance && usingAfterValue !== undefined && usingAfterValue !== null) {
1324
1337
  items.push({
1325
- item: label(locale, 'remainingAmount'),
1338
+ item: label(locale, 'balance'),
1326
1339
  value: formatMoney(usingAfterValue, currencySymbol)
1327
1340
  });
1328
1341
  }
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
326
326
  date: string;
327
327
  status: string;
328
328
  week: string;
329
- weekNum: 0 | 5 | 3 | 1 | 2 | 4 | 6;
329
+ weekNum: 0 | 1 | 2 | 5 | 4 | 3 | 6;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Remove top-level fields reserved for communication with the PisellOS proxy.
3
+ * Nested business payloads are intentionally left untouched.
4
+ */
5
+ export declare function stripOsPrivatePayloadFields<T>(data: T): T;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.stripOsPrivatePayloadFields = stripOsPrivatePayloadFields;
7
+ var _lodashEs = require("lodash-es");
8
+ const OS_PRIVATE_FIELD_PREFIX = '_os_';
9
+
10
+ /**
11
+ * Remove top-level fields reserved for communication with the PisellOS proxy.
12
+ * Nested business payloads are intentionally left untouched.
13
+ */
14
+ function stripOsPrivatePayloadFields(data) {
15
+ const next = (0, _lodashEs.cloneDeep)(data);
16
+ if (!next || typeof next !== 'object' || Array.isArray(next)) return next;
17
+ const record = next;
18
+ Object.keys(record).forEach(key => {
19
+ if (key.startsWith(OS_PRIVATE_FIELD_PREFIX)) delete record[key];
20
+ });
21
+ return next;
22
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.10.31",
4
+ "version": "0.10.32",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",