@pisell/pisellos 0.10.28 → 0.10.30

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 (85) hide show
  1. package/dist/core/index.d.ts +7 -0
  2. package/dist/core/index.js +108 -65
  3. package/dist/model/strategy/adapter/dataVariant/evaluator.js +13 -2
  4. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  5. package/dist/modules/Discount/index.js +4 -1
  6. package/dist/modules/Discount/types.d.ts +14 -4
  7. package/dist/modules/Order/index.d.ts +3 -1
  8. package/dist/modules/Order/index.js +89 -16
  9. package/dist/modules/Order/types.d.ts +13 -0
  10. package/dist/modules/Order/utils.d.ts +17 -2
  11. package/dist/modules/Order/utils.js +133 -27
  12. package/dist/modules/Quotation/index.d.ts +6 -0
  13. package/dist/modules/Quotation/index.js +77 -25
  14. package/dist/modules/ResourcePlanner/planner.js +14 -4
  15. package/dist/modules/ResourcePlanner/types.d.ts +2 -0
  16. package/dist/plugins/request.d.ts +1 -0
  17. package/dist/server/index.d.ts +13 -2
  18. package/dist/server/index.js +1531 -1230
  19. package/dist/server/modules/floor-plan/index.d.ts +4 -0
  20. package/dist/server/modules/floor-plan/index.js +240 -98
  21. package/dist/server/modules/menu/index.js +48 -23
  22. package/dist/server/modules/order/index.d.ts +17 -7
  23. package/dist/server/modules/order/index.js +419 -207
  24. package/dist/server/modules/order/types.d.ts +50 -0
  25. package/dist/server/modules/order/types.js +2 -0
  26. package/dist/server/modules/products/index.d.ts +10 -4
  27. package/dist/server/modules/products/index.js +177 -84
  28. package/dist/server/modules/resource/index.js +21 -13
  29. package/dist/server/utils/product.d.ts +1 -1
  30. package/dist/server/utils/product.js +186 -22
  31. package/dist/server/utils/small-ticket.d.ts +4 -1
  32. package/dist/server/utils/small-ticket.js +543 -101
  33. package/dist/solution/BaseSales/index.d.ts +3 -3
  34. package/dist/solution/BaseSales/index.js +171 -198
  35. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +2 -0
  36. package/dist/solution/BaseSales/utils/parseSalesResponse.js +1 -1
  37. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +3 -2
  38. package/dist/solution/BookingByStep/index.d.ts +2 -2
  39. package/dist/solution/Sales/index.d.ts +7 -0
  40. package/dist/solution/Sales/index.js +87 -31
  41. package/dist/solution/UnifiedBookingSales/index.d.ts +2 -2
  42. package/dist/solution/UnifiedBookingSales/index.js +38 -21
  43. package/lib/core/index.d.ts +7 -0
  44. package/lib/core/index.js +20 -2
  45. package/lib/model/strategy/adapter/dataVariant/evaluator.js +12 -2
  46. package/lib/model/strategy/adapter/promotion/index.js +46 -1
  47. package/lib/modules/Discount/index.js +4 -1
  48. package/lib/modules/Discount/types.d.ts +14 -4
  49. package/lib/modules/Order/index.d.ts +3 -1
  50. package/lib/modules/Order/index.js +69 -1
  51. package/lib/modules/Order/types.d.ts +13 -0
  52. package/lib/modules/Order/utils.d.ts +17 -2
  53. package/lib/modules/Order/utils.js +131 -18
  54. package/lib/modules/Quotation/index.d.ts +6 -0
  55. package/lib/modules/Quotation/index.js +52 -8
  56. package/lib/modules/ResourcePlanner/planner.js +9 -1
  57. package/lib/modules/ResourcePlanner/types.d.ts +2 -0
  58. package/lib/plugins/request.d.ts +1 -0
  59. package/lib/server/index.d.ts +13 -2
  60. package/lib/server/index.js +210 -19
  61. package/lib/server/modules/floor-plan/index.d.ts +4 -0
  62. package/lib/server/modules/floor-plan/index.js +60 -7
  63. package/lib/server/modules/menu/index.js +26 -4
  64. package/lib/server/modules/order/index.d.ts +17 -7
  65. package/lib/server/modules/order/index.js +194 -57
  66. package/lib/server/modules/order/types.d.ts +50 -0
  67. package/lib/server/modules/order/types.js +1 -0
  68. package/lib/server/modules/products/index.d.ts +10 -4
  69. package/lib/server/modules/products/index.js +93 -23
  70. package/lib/server/modules/resource/index.js +12 -2
  71. package/lib/server/utils/product.d.ts +1 -1
  72. package/lib/server/utils/product.js +163 -3
  73. package/lib/server/utils/small-ticket.d.ts +4 -1
  74. package/lib/server/utils/small-ticket.js +507 -75
  75. package/lib/solution/BaseSales/index.d.ts +3 -3
  76. package/lib/solution/BaseSales/index.js +9 -14
  77. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +2 -0
  78. package/lib/solution/BaseSales/utils/parseSalesResponse.js +1 -1
  79. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +3 -2
  80. package/lib/solution/BookingByStep/index.d.ts +2 -2
  81. package/lib/solution/Sales/index.d.ts +7 -0
  82. package/lib/solution/Sales/index.js +48 -3
  83. package/lib/solution/UnifiedBookingSales/index.d.ts +2 -2
  84. package/lib/solution/UnifiedBookingSales/index.js +19 -3
  85. package/package.json +1 -1
@@ -32,7 +32,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
32
32
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
33
33
  import { BaseModule } from "../BaseModule";
34
34
  import { OrderHooks } from "./types";
35
- import { composeLinePrice, generateDuration, getAllDiscountList, mergeRelationForms, ensureCartItemOriginHolder, buildSubmitPayload, createDefaultTempOrder, createDefaultOrderRulesHooks, createEmptySummary, createUuidV4, formatDateTime, isTempOrder, normalizeBookingIsAll, normalizeBookingSubType, mapPaymentItemsToOrderPayments, normalizeOrderProductDiscountList, resolveEffectivePerUnitDiscount, ensureProductSku, getProductSkuOptions, normalizeProductSkuOptions, sumOptionUnitPrice, clearTempOrderHolderAssignments, getOrderProductLineUid, indexOrderProductsByUid, calculateOrderProductsDeposit, mergeOrderProductDisplayFields, resolveIsFormSubject } from "./utils";
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
38
  import { ensureOrderPaymentNumber, mergeOrderPaymentRecord, resolveOrderPaymentIdentity } from "./payment-utils";
@@ -106,6 +106,13 @@ function getVoucherPaymentLifecycleKey(payment) {
106
106
  if (!isVoucherPaymentRecord(payment)) return null;
107
107
  return "".concat(String(payment.voucher_id), "::").concat(String(payment.status || ''));
108
108
  }
109
+ function hasPersistedOrderId(orderId) {
110
+ if (orderId === undefined || orderId === null || orderId === '') return false;
111
+ if (typeof orderId === 'string' && orderId.startsWith('LOCAL_')) return false;
112
+ var normalizedOrderId = Number(orderId);
113
+ if (Number.isFinite(normalizedOrderId)) return normalizedOrderId > 0;
114
+ return String(orderId).trim() !== '';
115
+ }
109
116
  export var OrderModule = /*#__PURE__*/function (_BaseModule) {
110
117
  _inherits(OrderModule, _BaseModule);
111
118
  var _super = _createSuper(OrderModule);
@@ -583,8 +590,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
583
590
  discountList = prepareConfigResult === null || prepareConfigResult === void 0 ? void 0 : prepareConfigResult.discountList;
584
591
  this.store.availableWalletIds = (prepareConfigResult === null || prepareConfigResult === void 0 ? void 0 : prepareConfigResult.availableWalletIds) || [];
585
592
  this.store.virtualCurrencyList = (prepareConfigResult === null || prepareConfigResult === void 0 ? void 0 : prepareConfigResult.virtualCurrencyList) || [];
593
+ if (prepareConfigResult) {
594
+ this.writePointCardSnapshotFromPrepareConfig({
595
+ orderId: orderId,
596
+ customerId: params.customerId,
597
+ availableWalletPassList: prepareConfigResult.availableWalletPassList || []
598
+ });
599
+ }
586
600
  if (!discountList) {
587
- _context3.next = 19;
601
+ _context3.next = 20;
588
602
  break;
589
603
  }
590
604
  currentDiscountList = ((_this$store$discount2 = this.store.discount) === null || _this$store$discount2 === void 0 ? void 0 : _this$store$discount2.getDiscountList()) || [];
@@ -605,17 +619,17 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
605
619
  return true;
606
620
  });
607
621
  mergedDiscountList = [].concat(_toConsumableArray(currentEditDiscounts), _toConsumableArray(currentScanDiscounts), _toConsumableArray(runtimeDiscounts));
608
- _context3.next = 17;
622
+ _context3.next = 18;
609
623
  return (_this$store$discount3 = this.store.discount) === null || _this$store$discount3 === void 0 ? void 0 : _this$store$discount3.setOriginalDiscountList(mergedDiscountList);
610
- case 17:
611
- _context3.next = 19;
624
+ case 18:
625
+ _context3.next = 20;
612
626
  return (_this$store$discount4 = this.store.discount) === null || _this$store$discount4 === void 0 ? void 0 : _this$store$discount4.setDiscountList(mergedDiscountList);
613
- case 19:
627
+ case 20:
614
628
  if (params.apply !== false && (_this$store$tempOrder2 = this.store.tempOrder) !== null && _this$store$tempOrder2 !== void 0 && (_this$store$tempOrder2 = _this$store$tempOrder2.products) !== null && _this$store$tempOrder2 !== void 0 && _this$store$tempOrder2.length) {
615
629
  this.applyDiscount();
616
630
  }
617
631
  return _context3.abrupt("return", this.getDiscountList());
618
- case 21:
632
+ case 22:
619
633
  case "end":
620
634
  return _context3.stop();
621
635
  }
@@ -1436,6 +1450,34 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1436
1450
  now: formatDateTime(new Date())
1437
1451
  });
1438
1452
  }
1453
+ }, {
1454
+ key: "clearTempOrderPointCardSnapshot",
1455
+ value: function clearTempOrderPointCardSnapshot(tempOrder) {
1456
+ var orderMetaList = normalizeOrderMetaList(tempOrder.order_meta_list);
1457
+ if (!orderMetaList) return;
1458
+ var nextOrderMetaList = _objectSpread({}, orderMetaList);
1459
+ delete nextOrderMetaList.point_cards_snapshot;
1460
+ if (Object.keys(nextOrderMetaList).length === 0) {
1461
+ delete tempOrder.order_meta_list;
1462
+ return;
1463
+ }
1464
+ tempOrder.order_meta_list = nextOrderMetaList;
1465
+ }
1466
+ }, {
1467
+ key: "writePointCardSnapshotFromPrepareConfig",
1468
+ value: function writePointCardSnapshotFromPrepareConfig(params) {
1469
+ var _tempOrder$customer_i, _params$orderId;
1470
+ var tempOrder = this.store.tempOrder;
1471
+ if (!tempOrder) return;
1472
+ if (String((_tempOrder$customer_i = tempOrder.customer_id) !== null && _tempOrder$customer_i !== void 0 ? _tempOrder$customer_i : '') !== String(params.customerId)) return;
1473
+ var effectiveOrderId = (_params$orderId = params.orderId) !== null && _params$orderId !== void 0 ? _params$orderId : tempOrder.order_id;
1474
+ if (hasPersistedOrderId(effectiveOrderId)) return;
1475
+ tempOrder.order_meta_list = _objectSpread(_objectSpread({}, normalizeOrderMetaList(tempOrder.order_meta_list) || {}), {}, {
1476
+ point_cards_snapshot: buildPointCardSnapshotFromWalletPassList(params.availableWalletPassList)
1477
+ });
1478
+ this.persistTempOrder();
1479
+ this.saveDraftInBackground();
1480
+ }
1439
1481
  }, {
1440
1482
  key: "createExternalSaleNumber",
1441
1483
  value: function createExternalSaleNumber() {
@@ -2651,7 +2693,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2651
2693
  }, {
2652
2694
  key: "getOrderSnapshot",
2653
2695
  value: function getOrderSnapshot() {
2654
- var _tempOrder$customer_i, _tempOrder$products;
2696
+ var _tempOrder$customer_i2, _tempOrder$products;
2655
2697
  var tempOrder = this.store.tempOrder;
2656
2698
  if (!tempOrder) return null;
2657
2699
  var identity = this.getOrderIdentity();
@@ -2666,7 +2708,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2666
2708
  shippingStatus: tempOrder.shipping_status || '',
2667
2709
  note: tempOrder.note || '',
2668
2710
  customer: {
2669
- customerId: (_tempOrder$customer_i = tempOrder.customer_id) !== null && _tempOrder$customer_i !== void 0 ? _tempOrder$customer_i : null,
2711
+ customerId: (_tempOrder$customer_i2 = tempOrder.customer_id) !== null && _tempOrder$customer_i2 !== void 0 ? _tempOrder$customer_i2 : null,
2670
2712
  customerName: tempOrder.customer_name || '',
2671
2713
  phone: tempOrder.phone || '',
2672
2714
  email: tempOrder.email || ''
@@ -3445,9 +3487,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3445
3487
  }, {
3446
3488
  key: "updateTempOrderCustomer",
3447
3489
  value: function updateTempOrderCustomer(customer) {
3448
- var _tempOrder$customer_i2, _ref54, _ref55, _customer$customer_id, _ref56, _ref57, _ref58, _customer$customer_na, _ref59, _customer$country_cal, _tempOrder$customer_i3;
3490
+ var _tempOrder$customer_i3, _ref54, _ref55, _customer$customer_id, _ref56, _ref57, _ref58, _customer$customer_na, _ref59, _customer$country_cal, _tempOrder$customer_i4;
3449
3491
  var tempOrder = this.ensureTempOrder();
3450
- var previousCustomerId = (_tempOrder$customer_i2 = tempOrder.customer_id) !== null && _tempOrder$customer_i2 !== void 0 ? _tempOrder$customer_i2 : null;
3492
+ var previousCustomerId = (_tempOrder$customer_i3 = tempOrder.customer_id) !== null && _tempOrder$customer_i3 !== void 0 ? _tempOrder$customer_i3 : null;
3451
3493
  var customerId = (_ref54 = (_ref55 = (_customer$customer_id = customer.customer_id) !== null && _customer$customer_id !== void 0 ? _customer$customer_id : customer.customerId) !== null && _ref55 !== void 0 ? _ref55 : customer.id) !== null && _ref54 !== void 0 ? _ref54 : null;
3452
3494
  var customerName = (_ref56 = (_ref57 = (_ref58 = (_customer$customer_na = customer.customer_name) !== null && _customer$customer_na !== void 0 ? _customer$customer_na : customer.customerName) !== null && _ref58 !== void 0 ? _ref58 : customer.display_name) !== null && _ref57 !== void 0 ? _ref57 : customer.name) !== null && _ref56 !== void 0 ? _ref56 : '';
3453
3495
  tempOrder.customer_id = customerId === null || customerId === undefined || customerId === '' ? null : Number(customerId);
@@ -3463,7 +3505,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3463
3505
  phone: tempOrder.phone,
3464
3506
  email: tempOrder.email
3465
3507
  });
3466
- var nextCustomerId = (_tempOrder$customer_i3 = tempOrder.customer_id) !== null && _tempOrder$customer_i3 !== void 0 ? _tempOrder$customer_i3 : null;
3508
+ var nextCustomerId = (_tempOrder$customer_i4 = tempOrder.customer_id) !== null && _tempOrder$customer_i4 !== void 0 ? _tempOrder$customer_i4 : null;
3509
+ if (String(previousCustomerId !== null && previousCustomerId !== void 0 ? previousCustomerId : '') !== String(nextCustomerId !== null && nextCustomerId !== void 0 ? nextCustomerId : '') && !hasPersistedOrderId(tempOrder.order_id)) {
3510
+ this.store.availableWalletIds = [];
3511
+ this.clearTempOrderPointCardSnapshot(tempOrder);
3512
+ }
3467
3513
  this.persistTempOrder();
3468
3514
  return {
3469
3515
  customerId: tempOrder.customer_id,
@@ -3475,13 +3521,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3475
3521
  }, {
3476
3522
  key: "setOrderCustomer",
3477
3523
  value: function setOrderCustomer(patch, snapshot) {
3478
- var _tempOrder$customer_i4, _tempOrder$customer_i5;
3524
+ var _tempOrder$customer_i5, _tempOrder$customer_i6;
3479
3525
  if (!patch) {
3480
3526
  this.clearOrderCustomer();
3481
3527
  return;
3482
3528
  }
3483
3529
  var tempOrder = this.ensureTempOrder();
3484
- var previousCustomerId = (_tempOrder$customer_i4 = tempOrder.customer_id) !== null && _tempOrder$customer_i4 !== void 0 ? _tempOrder$customer_i4 : null;
3530
+ var previousCustomerId = (_tempOrder$customer_i5 = tempOrder.customer_id) !== null && _tempOrder$customer_i5 !== void 0 ? _tempOrder$customer_i5 : null;
3485
3531
  tempOrder.customer_id = patch.customer_id || patch.id || null;
3486
3532
  tempOrder.customer_name = String(patch.customer_name || '');
3487
3533
  tempOrder.country_calling_code = String(patch.country_calling_code || '');
@@ -3499,10 +3545,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3499
3545
  var extend = this.ensureExtend(tempOrder);
3500
3546
  if (snapshot === null) delete extend.customerSnapshot;else extend.customerSnapshot = cloneDeep(snapshot);
3501
3547
  }
3502
- var nextCustomerId = (_tempOrder$customer_i5 = tempOrder.customer_id) !== null && _tempOrder$customer_i5 !== void 0 ? _tempOrder$customer_i5 : null;
3548
+ var nextCustomerId = (_tempOrder$customer_i6 = tempOrder.customer_id) !== null && _tempOrder$customer_i6 !== void 0 ? _tempOrder$customer_i6 : null;
3503
3549
  if (String(previousCustomerId !== null && previousCustomerId !== void 0 ? previousCustomerId : '') !== String(nextCustomerId !== null && nextCustomerId !== void 0 ? nextCustomerId : '')) {
3504
3550
  this.store.availableWalletIds = [];
3505
3551
  this.store.virtualCurrencyList = [];
3552
+ if (!hasPersistedOrderId(tempOrder.order_id)) {
3553
+ this.clearTempOrderPointCardSnapshot(tempOrder);
3554
+ }
3506
3555
  clearTempOrderHolderAssignments(tempOrder);
3507
3556
  this.clearCustomerBoundDiscounts(tempOrder);
3508
3557
  this.applyDiscount();
@@ -3549,6 +3598,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3549
3598
  if (tempOrder._extend) delete tempOrder._extend.customerSnapshot;
3550
3599
  this.store.availableWalletIds = [];
3551
3600
  this.store.virtualCurrencyList = [];
3601
+ if (!hasPersistedOrderId(tempOrder.order_id)) {
3602
+ this.clearTempOrderPointCardSnapshot(tempOrder);
3603
+ }
3552
3604
  this.clearCustomerBoundDiscounts(tempOrder);
3553
3605
  this.applyDiscount();
3554
3606
  this.persistTempOrder();
@@ -6317,7 +6369,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6317
6369
  }
6318
6370
  _context45.next = 6;
6319
6371
  return this.request.get("/order/sales/".concat(encodeURIComponent(lookup)), _objectSpread({
6320
- with: ['products', 'bookings', 'payments', 'customer', 'summary', 'contacts_info', 'refunds']
6372
+ with: ['products', 'bookings', 'payments', 'customer', 'summary', 'contacts_info', 'order_meta_list', 'refunds']
6321
6373
  }, params.forceRemote ? {
6322
6374
  forceRemote: true
6323
6375
  } : {}), {
@@ -6666,6 +6718,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6666
6718
  return _objectSpread({}, c || {});
6667
6719
  }) : [];
6668
6720
  nextTempOrder.contacts_info = raw.contacts_info && _typeof(raw.contacts_info) === 'object' && !Array.isArray(raw.contacts_info) ? _objectSpread({}, raw.contacts_info) : null;
6721
+ nextTempOrder.order_meta_list = normalizeOrderMetaList(raw.order_meta_list);
6669
6722
  nextTempOrder._extend = raw._extend && _typeof(raw._extend) === 'object' ? _objectSpread(_objectSpread({}, raw._extend), {}, {
6670
6723
  productsByUid: raw._extend.productsByUid || {}
6671
6724
  }) : {
@@ -6855,6 +6908,26 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6855
6908
  row.metadata.booking_uid = row.booking_uid;
6856
6909
  }
6857
6910
  row = restoreHydratedBundleDiscounts(row, normalizeOrderProductDiscountList);
6911
+ var rawOriginalPrice = Number(row.original_price);
6912
+ var rawSellingPrice = Number(row.selling_price);
6913
+ var hasProductDiscounts = Array.isArray(row.discount_list) && row.discount_list.length > 0;
6914
+ var hasBundleDiscounts = row.product_bundle.some(function (bundle) {
6915
+ return Array.isArray(bundle === null || bundle === void 0 ? void 0 : bundle.discount_list) && bundle.discount_list.length > 0;
6916
+ });
6917
+ var isUndiscountedV2Line = String(row.metadata.price_schema_version) === '2' && Number.isFinite(rawOriginalPrice) && Number.isFinite(rawSellingPrice) && new Decimal(rawOriginalPrice).eq(rawSellingPrice) && !hasProductDiscounts && !hasBundleDiscounts;
6918
+ if (isUndiscountedV2Line) {
6919
+ var hasPriceValue = function hasPriceValue(value) {
6920
+ return value !== undefined && value !== null && value !== '';
6921
+ };
6922
+ row.product_bundle = row.product_bundle.map(function (bundle) {
6923
+ if (!bundle || isMarkdownBundle(bundle) || hasPriceValue(bundle.original_price) || hasPriceValue(bundle.product_price) || !hasPriceValue(bundle.bundle_selling_price)) {
6924
+ return bundle;
6925
+ }
6926
+ return _objectSpread(_objectSpread({}, bundle), {}, {
6927
+ original_price: bundle.bundle_selling_price
6928
+ });
6929
+ });
6930
+ }
6858
6931
  var existingIdentity = row.metadata.unique_identification_number || row.unique_identification_number;
6859
6932
  if (!existingIdentity) {
6860
6933
  row.metadata.unique_identification_number = createUuidV4();
@@ -188,6 +188,17 @@ export interface OrderProductSku {
188
188
  export interface OrderLocalizedText {
189
189
  [locale: string]: string | null;
190
190
  }
191
+ export interface PointCardSnapshotItem {
192
+ id: number | string;
193
+ tag: 'point_card';
194
+ product_id?: number | string;
195
+ product_name: string;
196
+ par_value: string;
197
+ used_par_value: string;
198
+ }
199
+ export interface OrderMetaList {
200
+ point_cards_snapshot?: PointCardSnapshotItem[];
201
+ }
191
202
  export interface OrderProduct extends OrderProductIdentity {
192
203
  order_detail_id: number | null;
193
204
  num: number;
@@ -287,6 +298,7 @@ export interface OrderTempOrder {
287
298
  contacts: any[];
288
299
  contacts_info: Record<string, any> | null;
289
300
  holder: Record<string, any> | null;
301
+ order_meta_list?: OrderMetaList;
290
302
  metadata: Record<string, any>;
291
303
  summary?: OrderSummary;
292
304
  _extend?: {
@@ -488,6 +500,7 @@ export interface SubmitSalesOrderParams {
488
500
  contacts: any[];
489
501
  contacts_info: Record<string, any> | null;
490
502
  holder: Record<string, any> | null;
503
+ order_meta_list?: OrderMetaList;
491
504
  metadata: Record<string, any>;
492
505
  summary?: OrderSummary;
493
506
  small_ticket_data_flag?: number;
@@ -1,6 +1,6 @@
1
1
  import Decimal from 'decimal.js';
2
- import type { CartItem } from "../Cart";
3
- import type { OrderProductDiscountItem, OrderProduct, OrderSubmitPayload, OrderSubmitProduct, OrderSummary, OrderTempOrder } from './types';
2
+ import type { CartItem } from '../Cart';
3
+ import type { OrderProductDiscountItem, OrderMetaList, OrderProduct, OrderSubmitPayload, OrderSubmitProduct, OrderSummary, OrderTempOrder, PointCardSnapshotItem } from './types';
4
4
  import type { RulesParamsHooks } from '../Rules/types';
5
5
  import type { MapOrderPaymentsOptions, OrderPaymentData, OrderPaymentSource } from './types';
6
6
  import { createUuidV4 } from './utils/orderCollectionIdentity';
@@ -16,6 +16,9 @@ export interface OrderProductsDepositSummary {
16
16
  hasDeposit: boolean;
17
17
  }
18
18
  import type { WindowPlugin } from '../../plugins';
19
+ export declare function normalizePointCardSnapshotItem(value: unknown): PointCardSnapshotItem | null;
20
+ export declare function buildPointCardSnapshotFromWalletPassList(value: unknown): PointCardSnapshotItem[];
21
+ export declare function normalizeOrderMetaList(value: unknown): OrderMetaList | undefined;
19
22
  /**
20
23
  * 把"含 option 的主商品单价"与 bundle 合成"单行 composite 单价"。
21
24
  *
@@ -210,6 +213,18 @@ export interface SubmitPayloadEnhancerContext {
210
213
  now: Date;
211
214
  }
212
215
  export type SubmitPayloadEnhancer = (payload: OrderSubmitPayload, ctx: SubmitPayloadEnhancerContext) => OrderSubmitPayload;
216
+ /**
217
+ * 解析 checkout 的订单类型。
218
+ * dine_in 普通落库单在新增桌台资源后,即使原类型仍是 virtual,也必须按 table-order 提交。
219
+ */
220
+ export declare function resolveSubmitOrderType(params: {
221
+ requestedType?: string;
222
+ tempOrderType?: string;
223
+ orderId?: unknown;
224
+ businessCode?: string;
225
+ tempOrderBusinessCode?: string;
226
+ bookings?: unknown;
227
+ }): string;
213
228
  export declare function buildSubmitPayload(params: {
214
229
  tempOrder: OrderTempOrder;
215
230
  cacheId?: string;
@@ -1,7 +1,7 @@
1
1
  var _excluded = ["custom_product_bundle_map_id"],
2
2
  _excluded2 = ["unique_identification_number"],
3
- _excluded3 = ["num", "surcharge_fee", "discount_amount", "discount_type", "discountway", "product_discount_reason", "discount_per"],
4
- _excluded4 = ["_extend", "relation_id", "table_form_id", "resource_id", "summary", "lastOrderInfo", "paid_amount", "shop_id", "shop_note", "shop_service_type", "start_time", "customer", "discount_list", "tax_fee", "total_amount", "total_refund_amount", "create_date", "holder_id", "payment_status"],
3
+ _excluded3 = ["num", "surcharge_fee", "discount_amount", "discount_type", "discountway", "product_discount_reason", "discount_per", "production_code"],
4
+ _excluded4 = ["_extend", "relation_id", "table_form_id", "resource_id", "summary", "lastOrderInfo", "paid_amount", "shop_id", "shop_note", "shop_service_type", "start_time", "customer", "discount_list", "order_meta_list", "tax_fee", "total_amount", "total_refund_amount", "create_date", "holder_id", "payment_status"],
5
5
  _excluded5 = ["collect_pax", "table_occupancy_duration", "cart_settlement_key", "cart_settlement_snapshot", "legal_currency_snapshot"];
6
6
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
7
7
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
@@ -9,7 +9,6 @@ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableTo
9
9
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
10
10
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
11
11
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
12
- 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); }
13
12
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
14
13
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
15
14
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -18,11 +17,62 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
18
17
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
19
18
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
20
19
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
21
- import dayjs from "dayjs";
20
+ 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); }
21
+ import dayjs from 'dayjs';
22
22
  import Decimal from 'decimal.js';
23
23
  import { getProductHolderConfig } from "../Holder/utils";
24
24
  import { buildProductLineFingerprint, createEmptySummary } from "../../solution/ScanOrder/utils";
25
25
  import { createUuidV4 } from "./utils/orderCollectionIdentity";
26
+ var POINT_CARD_SNAPSHOT_TAG = 'point_card';
27
+ function isPlainObject(value) {
28
+ return Boolean(value) && _typeof(value) === 'object' && !Array.isArray(value);
29
+ }
30
+ function normalizeSnapshotScalar(value) {
31
+ if (value === undefined || value === null) return undefined;
32
+ if (typeof value === 'string') return value.trim() ? value : undefined;
33
+ if (typeof value === 'number') return Number.isFinite(value) ? value : undefined;
34
+ return undefined;
35
+ }
36
+ export function normalizePointCardSnapshotItem(value) {
37
+ var _value$product_name, _value$par_value, _value$used_par_value;
38
+ if (!isPlainObject(value)) return null;
39
+ var id = normalizeSnapshotScalar(value.id);
40
+ if (id === undefined) return null;
41
+ if (String(value.tag || '').trim().toLowerCase() !== POINT_CARD_SNAPSHOT_TAG) {
42
+ return null;
43
+ }
44
+ var snapshot = {
45
+ id: id,
46
+ tag: 'point_card',
47
+ product_name: String((_value$product_name = value.product_name) !== null && _value$product_name !== void 0 ? _value$product_name : ''),
48
+ par_value: String((_value$par_value = value.par_value) !== null && _value$par_value !== void 0 ? _value$par_value : ''),
49
+ used_par_value: String((_value$used_par_value = value.used_par_value) !== null && _value$used_par_value !== void 0 ? _value$used_par_value : '')
50
+ };
51
+ var productId = normalizeSnapshotScalar(value.product_id);
52
+ if (productId !== undefined) {
53
+ snapshot.product_id = productId;
54
+ }
55
+ return snapshot;
56
+ }
57
+ export function buildPointCardSnapshotFromWalletPassList(value) {
58
+ if (!Array.isArray(value)) return [];
59
+ return value.reduce(function (result, item) {
60
+ var normalized = normalizePointCardSnapshotItem(item);
61
+ if (normalized) result.push(normalized);
62
+ return result;
63
+ }, []);
64
+ }
65
+ export function normalizeOrderMetaList(value) {
66
+ if (value === undefined) return undefined;
67
+ if (!isPlainObject(value)) return undefined;
68
+ var normalized = {};
69
+ if (Object.prototype.hasOwnProperty.call(value, 'point_cards_snapshot')) {
70
+ normalized.point_cards_snapshot = buildPointCardSnapshotFromWalletPassList(value.point_cards_snapshot);
71
+ }
72
+ if (Object.keys(normalized).length > 0) return normalized;
73
+ return {};
74
+ }
75
+
26
76
  /**
27
77
  * 把"含 option 的主商品单价"与 bundle 合成"单行 composite 单价"。
28
78
  *
@@ -775,7 +825,6 @@ export function ensureCartItemOriginHolder(cartItem, window) {
775
825
  form_record: [formRecordId]
776
826
  };
777
827
  }
778
- ;
779
828
  export var getAllDiscountList = function getAllDiscountList(cartItem) {
780
829
  var _cartItem$_origin2, _cartItem$_origin3;
781
830
  var discountList = (cartItem === null || cartItem === void 0 || (_cartItem$_origin2 = cartItem._origin) === null || _cartItem$_origin2 === void 0 || (_cartItem$_origin2 = _cartItem$_origin2.product) === null || _cartItem$_origin2 === void 0 ? void 0 : _cartItem$_origin2.discount_list) || [];
@@ -814,6 +863,12 @@ function normalizeSubmitPlatform(platform) {
814
863
  if (lower === 'h5') return 'H5';
815
864
  return value;
816
865
  }
866
+ function normalizeSubmitProductionCode(value) {
867
+ if (value === undefined || value === null) return undefined;
868
+ var productionCode = String(value).trim();
869
+ return productionCode || undefined;
870
+ }
871
+
817
872
  // 后端 checkout 协议字段 option_group_item_id;tempOrder 内部也保持同一字段名。
818
873
  function formatSubmitOptionItems(options) {
819
874
  var formatOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -825,6 +880,9 @@ function formatSubmitOptionItems(options) {
825
880
  option_group_item_id: d === null || d === void 0 ? void 0 : d.option_group_item_id,
826
881
  option_group_id: d === null || d === void 0 ? void 0 : d.option_group_id
827
882
  });
883
+ var productionCode = normalizeSubmitProductionCode(d === null || d === void 0 ? void 0 : d.production_code);
884
+ delete option.production_code;
885
+ if (productionCode !== undefined) option.production_code = productionCode;
828
886
  var addPrice = (_d$add_price = d === null || d === void 0 ? void 0 : d.add_price) !== null && _d$add_price !== void 0 ? _d$add_price : d === null || d === void 0 ? void 0 : d.price;
829
887
  if (formatOptions.virtualSettlementMode) {
830
888
  option.add_price = 0;
@@ -870,10 +928,13 @@ function formatSubmitBundleItems(bundle) {
870
928
  var num = toBundleNumber((_rawBundle$num = rawBundle.num) !== null && _rawBundle$num !== void 0 ? _rawBundle$num : rawBundle.quantity, 1);
871
929
  var bundleMapId = resolveSubmitBundleMapId(rawBundle);
872
930
  var hasSubmitBundleDiscounts = Array.isArray(rawBundle.discount_list) && rawBundle.discount_list.length > 0;
873
- return {
931
+ var productionCode = normalizeSubmitProductionCode(rawBundle.production_code);
932
+ return _objectSpread(_objectSpread({
874
933
  is_charge_tax: formatOptions.virtualSettlementMode ? 0 : (_rawBundle$is_charge_ = rawBundle.is_charge_tax) !== null && _rawBundle$is_charge_ !== void 0 ? _rawBundle$is_charge_ : 0,
875
- bundle_variant_id: (_rawBundle$bundle_var = rawBundle.bundle_variant_id) !== null && _rawBundle$bundle_var !== void 0 ? _rawBundle$bundle_var : 0,
876
- production_code: rawBundle.production_code,
934
+ bundle_variant_id: (_rawBundle$bundle_var = rawBundle.bundle_variant_id) !== null && _rawBundle$bundle_var !== void 0 ? _rawBundle$bundle_var : 0
935
+ }, productionCode !== undefined ? {
936
+ production_code: productionCode
937
+ } : {}), {}, {
877
938
  num: num,
878
939
  quantity: toBundleNumber((_rawBundle$quantity = rawBundle.quantity) !== null && _rawBundle$quantity !== void 0 ? _rawBundle$quantity : rawBundle.num, num),
879
940
  extension_id: (_rawBundle$extension_ = rawBundle.extension_id) !== null && _rawBundle$extension_ !== void 0 ? _rawBundle$extension_ : 0,
@@ -895,7 +956,7 @@ function formatSubmitBundleItems(bundle) {
895
956
  relation_surcharge_ids: formatOptions.virtualSettlementMode ? [] : relationSurchargeIds,
896
957
  product_discount_difference: formatOptions.virtualSettlementMode ? '' : productDiscountDifference
897
958
  })
898
- };
959
+ });
899
960
  });
900
961
  }
901
962
 
@@ -928,7 +989,9 @@ function normalizeSubmitProduct(product) {
928
989
  _deprecatedDiscountway = submitProduct.discountway,
929
990
  _deprecatedProductDiscountReason = submitProduct.product_discount_reason,
930
991
  _deprecatedDiscountPer = submitProduct.discount_per,
992
+ rawProductionCode = submitProduct.production_code,
931
993
  productRest = _objectWithoutProperties(submitProduct, _excluded3);
994
+ var productionCode = normalizeSubmitProductionCode(rawProductionCode);
932
995
  delete productRest["product_".concat('option', "_item")];
933
996
  var rawMetadata = submitProduct.metadata || {};
934
997
  var bookingUid = rawMetadata.booking_uid;
@@ -979,10 +1042,12 @@ function normalizeSubmitProduct(product) {
979
1042
  var productSku = _objectSpread(_objectSpread({}, submitProduct.product_sku && _typeof(submitProduct.product_sku) === 'object' ? submitProduct.product_sku : {}), {}, {
980
1043
  option: formatSubmitOptionItems((_submitProduct$produc = submitProduct.product_sku) === null || _submitProduct$produc === void 0 ? void 0 : _submitProduct$produc.option, formatOptions)
981
1044
  });
982
- return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, productRest), formatOptions.virtualSettlementMode ? {
1045
+ return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, productRest), formatOptions.virtualSettlementMode ? {
983
1046
  selling_price: virtualPrice,
984
1047
  original_price: virtualPrice,
985
1048
  is_charge_tax: 0
1049
+ } : {}), productionCode !== undefined ? {
1050
+ production_code: productionCode
986
1051
  } : {}), bookingUid ? {
987
1052
  booking_uid: bookingUid
988
1053
  } : {}), bundleEdit !== undefined ? {
@@ -1115,6 +1180,49 @@ export function createDefaultTempOrder(params) {
1115
1180
  }
1116
1181
  };
1117
1182
  }
1183
+ function hasBoundBookingResource(bookings) {
1184
+ if (!Array.isArray(bookings)) return false;
1185
+ return bookings.some(function (booking) {
1186
+ if (!booking || _typeof(booking) !== 'object') return false;
1187
+ if (Number(booking.parent_id) === 0) return false;
1188
+ var resources = booking.resources;
1189
+ if (!Array.isArray(resources)) return false;
1190
+ return resources.some(function (resource) {
1191
+ var _relation_id;
1192
+ if (!resource || _typeof(resource) !== 'object') return false;
1193
+ var relationId = String((_relation_id = resource.relation_id) !== null && _relation_id !== void 0 ? _relation_id : '').trim();
1194
+ return relationId !== '' && relationId !== '0';
1195
+ });
1196
+ });
1197
+ }
1198
+ function isPersistedSubmitOrderId(orderId) {
1199
+ if (orderId === undefined || orderId === null || orderId === '') return false;
1200
+ var normalizedOrderId = Number(orderId);
1201
+ return Number.isFinite(normalizedOrderId) && normalizedOrderId > 0;
1202
+ }
1203
+
1204
+ /**
1205
+ * 解析 checkout 的订单类型。
1206
+ * dine_in 普通落库单在新增桌台资源后,即使原类型仍是 virtual,也必须按 table-order 提交。
1207
+ */
1208
+ export function resolveSubmitOrderType(params) {
1209
+ var requestedType = params.requestedType,
1210
+ tempOrderType = params.tempOrderType,
1211
+ orderId = params.orderId,
1212
+ businessCode = params.businessCode,
1213
+ tempOrderBusinessCode = params.tempOrderBusinessCode,
1214
+ bookings = params.bookings;
1215
+ var currentType = requestedType !== null && requestedType !== void 0 ? requestedType : tempOrderType;
1216
+ var resolvedBusinessCode = businessCode !== null && businessCode !== void 0 ? businessCode : tempOrderBusinessCode;
1217
+ if (isPersistedSubmitOrderId(orderId) && resolvedBusinessCode === 'dine_in' && currentType === 'virtual' && hasBoundBookingResource(bookings)) {
1218
+ return 'table-order';
1219
+ }
1220
+ if (currentType) return currentType;
1221
+ if (Array.isArray(bookings) && bookings.length > 0) {
1222
+ return businessCode === 'dine_in' ? 'table-order' : 'appointment_booking';
1223
+ }
1224
+ return 'virtual';
1225
+ }
1118
1226
  export function buildSubmitPayload(params) {
1119
1227
  var _tempOrder$metadata2, _tempOrder$customer_i, _tempOrder$country_ca, _tempOrder$phone, _tempOrder$email, _tempOrder$order_numb, _tempOrder$shop_order, _tempOrder$shop_full_, _ref31, _tempOrder$is_price_i, _tempOrder$is_deposit, _enhancedPayload$summ;
1120
1228
  var tempOrder = params.tempOrder,
@@ -1144,6 +1252,7 @@ export function buildSubmitPayload(params) {
1144
1252
  _startTime = _ref30.start_time,
1145
1253
  _customer = _ref30.customer,
1146
1254
  _discountList = _ref30.discount_list,
1255
+ _orderMetaList = _ref30.order_meta_list,
1147
1256
  _rootTaxFee = _ref30.tax_fee,
1148
1257
  _totalAmount = _ref30.total_amount,
1149
1258
  _totalRefundAmount = _ref30.total_refund_amount,
@@ -1151,21 +1260,16 @@ export function buildSubmitPayload(params) {
1151
1260
  _holderId = _ref30.holder_id,
1152
1261
  _paymentStatus = _ref30.payment_status,
1153
1262
  tempOrderRest = _objectWithoutProperties(_ref30, _excluded4);
1154
- var submitType = type !== null && type !== void 0 ? type : tempOrder.type;
1155
- if (!submitType) {
1156
- var _tempOrder$bookings;
1157
- // 如果外部没有传递 types,根据订单里当前是否有 bookings 来决定是 appointment_booking 还是 virtual
1158
- if (tempOrder !== null && tempOrder !== void 0 && (_tempOrder$bookings = tempOrder.bookings) !== null && _tempOrder$bookings !== void 0 && _tempOrder$bookings.length) {
1159
- // 260807 如果 biz 是堂食,type 使用table-order
1160
- if (businessCode === 'dine_in') {
1161
- submitType = 'table-order';
1162
- } else {
1163
- submitType = 'appointment_booking';
1164
- }
1165
- } else {
1166
- submitType = 'virtual';
1167
- }
1168
- }
1263
+ var resolvedBusinessCode = businessCode !== null && businessCode !== void 0 ? businessCode : tempOrder.business_code;
1264
+ var normalizedOrderMetaList = normalizeOrderMetaList(tempOrder.order_meta_list);
1265
+ var submitType = resolveSubmitOrderType({
1266
+ requestedType: type,
1267
+ tempOrderType: tempOrder.type,
1268
+ orderId: tempOrder.order_id,
1269
+ businessCode: businessCode,
1270
+ tempOrderBusinessCode: tempOrder.business_code,
1271
+ bookings: tempOrder.bookings
1272
+ });
1169
1273
  var payload = _objectSpread(_objectSpread(_objectSpread({}, tempOrderRest), {}, {
1170
1274
  customer_id: (_tempOrder$customer_i = tempOrder.customer_id) !== null && _tempOrder$customer_i !== void 0 ? _tempOrder$customer_i : 1,
1171
1275
  customer_name: tempOrder.customer_name || 'Walk-In',
@@ -1178,7 +1282,7 @@ export function buildSubmitPayload(params) {
1178
1282
  platform: normalizeSubmitPlatform(platform),
1179
1283
  request_unique_idempotency_token: (params === null || params === void 0 ? void 0 : params.request_unique_idempotency_token) || tempOrder.request_unique_idempotency_token || "".concat(tempOrder.external_sale_number, "_").concat(now.getTime()),
1180
1284
  type: submitType,
1181
- business_code: businessCode !== null && businessCode !== void 0 ? businessCode : tempOrder.business_code,
1285
+ business_code: resolvedBusinessCode,
1182
1286
  sales_channel: tempOrder.sales_channel || 'my_pisel',
1183
1287
  order_sales_channel: (_ref31 = channel !== null && channel !== void 0 ? channel : tempOrder.order_sales_channel) !== null && _ref31 !== void 0 ? _ref31 : 'online_store',
1184
1288
  status: tempOrder.status || 'normal'
@@ -1222,7 +1326,9 @@ export function buildSubmitPayload(params) {
1222
1326
  virtualSettlementMode: virtualSettlementMode
1223
1327
  });
1224
1328
  })
1225
- });
1329
+ }, normalizedOrderMetaList !== undefined ? {
1330
+ order_meta_list: normalizedOrderMetaList
1331
+ } : {});
1226
1332
  if (!enhance) return payload;
1227
1333
  var enhancedPayload = enhance(payload, {
1228
1334
  tempOrder: tempOrder,
@@ -9,6 +9,8 @@ export declare class QuotationModule extends BaseModule implements Module {
9
9
  private request;
10
10
  private store;
11
11
  private scheduleResolver?;
12
+ private app;
13
+ private quotationListUpdatedListener?;
12
14
  private quotationCache;
13
15
  private quotationLoadPromises;
14
16
  private quotationCacheVersions;
@@ -27,6 +29,7 @@ export declare class QuotationModule extends BaseModule implements Module {
27
29
  invalidateQuotationCache(channel?: string): void;
28
30
  private fetchQuotations;
29
31
  getQuotationList(): QuotationItem[];
32
+ setQuotationListUpdatedListener(listener?: () => void): void;
30
33
  getQuotationCustomerScopeInfo(): QuotationCustomerScopeInfo;
31
34
  /**
32
35
  * Look up the quotation price for a specific product (+ optional variant) at a given datetime.
@@ -72,6 +75,9 @@ export declare class QuotationModule extends BaseModule implements Module {
72
75
  customer_id?: number | string;
73
76
  }): Map<string, string | null>;
74
77
  setScheduleResolver(resolver: (id: number) => ScheduleItem | undefined): void;
78
+ private applyQuotationResponse;
79
+ private notifyQuotationListUpdated;
80
+ private getQuotationCacheKeyData;
75
81
  private normalizeChannel;
76
82
  private activateChannel;
77
83
  private getQuotationCacheVersion;