@pisell/pisellos 2.2.275 → 2.2.276

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.
@@ -159,7 +159,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
159
159
  _step2;
160
160
  try {
161
161
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
162
- var _item$type2, _ref, _ref2, _item$discount$resour, _item$discount, _item$discount$title, _item$discount2, _item$amount, _ref3, _item$discount$origin, _item$discount3, _ref4, _ref5, _item$metadata$num, _item$metadata, _ref6, _ref7, _item$metadata$num2, _item$metadata2, _ref8, _item$discount$discou, _item$discount4, _ref9, _item$discount$origin2, _item$discount5, _item$amount2, _item$amount3, _product$product_id, _product$is_charge_ta, _ref10, _product$original_pri, _ref11, _item$discount$discou2, _item$discount6, _item$discount$discou3, _item$discount7;
162
+ var _item$type2, _ref, _ref2, _item$discount$resour, _item$discount, _item$discount$title, _item$discount2, _item$discount3, _item$discount$fixed_, _item$discount4, _item$discount5, _item$amount, _ref3, _item$discount$origin, _item$discount6, _ref4, _ref5, _item$metadata$num, _item$metadata, _ref6, _ref7, _item$metadata$num2, _item$metadata2, _ref8, _item$discount$discou, _item$discount7, _item$amount2, _item$amount3, _product$product_id, _product$is_charge_ta, _ref9, _product$original_pri, _ref10, _item$discount$discou2, _item$discount8, _item$discount$discou3, _item$discount9;
163
163
  var item = _step2.value;
164
164
  var type = (_item$type2 = item === null || item === void 0 ? void 0 : item.type) !== null && _item$type2 !== void 0 ? _item$type2 : item === null || item === void 0 ? void 0 : item.tag;
165
165
  if (!type || type === 'product') continue;
@@ -170,12 +170,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
170
170
  var key = Number.isFinite(id) ? id : String(resourceId);
171
171
  var title = (_item$discount$title = item === null || item === void 0 || (_item$discount2 = item.discount) === null || _item$discount2 === void 0 ? void 0 : _item$discount2.title) !== null && _item$discount$title !== void 0 ? _item$discount$title : {};
172
172
  var amount = Number((item === null || item === void 0 ? void 0 : item.amount) || 0);
173
+ var discountCardType = item === null || item === void 0 || (_item$discount3 = item.discount) === null || _item$discount3 === void 0 ? void 0 : _item$discount3.discount_card_type;
174
+ var parValue = isDiscountCard ? discountCardType === 'fixed_amount' ? (_item$discount$fixed_ = item === null || item === void 0 || (_item$discount4 = item.discount) === null || _item$discount4 === void 0 ? void 0 : _item$discount4.fixed_amount) !== null && _item$discount$fixed_ !== void 0 ? _item$discount$fixed_ : item === null || item === void 0 ? void 0 : item.amount : item === null || item === void 0 || (_item$discount5 = item.discount) === null || _item$discount5 === void 0 ? void 0 : _item$discount5.percent : '0';
173
175
  var detail = {
174
176
  amount: String((_item$amount = item === null || item === void 0 ? void 0 : item.amount) !== null && _item$amount !== void 0 ? _item$amount : '0'),
175
177
  type: type,
176
178
  resource_id: key,
177
179
  title: title,
178
- original_amount: String((_ref3 = (_item$discount$origin = item === null || item === void 0 || (_item$discount3 = item.discount) === null || _item$discount3 === void 0 ? void 0 : _item$discount3.original_amount) !== null && _item$discount$origin !== void 0 ? _item$discount$origin : item === null || item === void 0 ? void 0 : item.amount) !== null && _ref3 !== void 0 ? _ref3 : '0'),
180
+ original_amount: String((_ref3 = (_item$discount$origin = item === null || item === void 0 || (_item$discount6 = item.discount) === null || _item$discount6 === void 0 ? void 0 : _item$discount6.original_amount) !== null && _item$discount$origin !== void 0 ? _item$discount$origin : item === null || item === void 0 ? void 0 : item.amount) !== null && _ref3 !== void 0 ? _ref3 : '0'),
179
181
  num: Number((_ref4 = (_ref5 = (_item$metadata$num = item === null || item === void 0 || (_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata.num) !== null && _item$metadata$num !== void 0 ? _item$metadata$num : product === null || product === void 0 ? void 0 : product.num) !== null && _ref5 !== void 0 ? _ref5 : product === null || product === void 0 ? void 0 : product.product_quantity) !== null && _ref4 !== void 0 ? _ref4 : 1) || 1,
180
182
  metadata: item === null || item === void 0 ? void 0 : item.metadata,
181
183
  discount: item === null || item === void 0 ? void 0 : item.discount,
@@ -205,9 +207,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
205
207
  encoded: '',
206
208
  code: '',
207
209
  tag: type,
208
- product_id: (_ref8 = (_item$discount$discou = item === null || item === void 0 || (_item$discount4 = item.discount) === null || _item$discount4 === void 0 ? void 0 : _item$discount4.discount_product_id) !== null && _item$discount$discou !== void 0 ? _item$discount$discou : product === null || product === void 0 ? void 0 : product.product_id) !== null && _ref8 !== void 0 ? _ref8 : 0,
210
+ product_id: (_ref8 = (_item$discount$discou = item === null || item === void 0 || (_item$discount7 = item.discount) === null || _item$discount7 === void 0 ? void 0 : _item$discount7.discount_product_id) !== null && _item$discount$discou !== void 0 ? _item$discount$discou : product === null || product === void 0 ? void 0 : product.product_id) !== null && _ref8 !== void 0 ? _ref8 : 0,
209
211
  relation_type: '',
210
- par_value: String((_ref9 = (_item$discount$origin2 = item === null || item === void 0 || (_item$discount5 = item.discount) === null || _item$discount5 === void 0 ? void 0 : _item$discount5.original_amount) !== null && _item$discount$origin2 !== void 0 ? _item$discount$origin2 : item === null || item === void 0 ? void 0 : item.amount) !== null && _ref9 !== void 0 ? _ref9 : '0'),
212
+ par_value: String(parValue !== null && parValue !== void 0 ? parValue : '0'),
211
213
  used_par_value: String((_item$amount2 = item === null || item === void 0 ? void 0 : item.amount) !== null && _item$amount2 !== void 0 ? _item$amount2 : '0'),
212
214
  limit_status: 'enable',
213
215
  limited_relation_product_data: {
@@ -226,7 +228,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
226
228
  id: (_product$product_id = product === null || product === void 0 ? void 0 : product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : 0,
227
229
  title: '',
228
230
  is_charge_tax: (_product$is_charge_ta = product === null || product === void 0 ? void 0 : product.is_charge_tax) !== null && _product$is_charge_ta !== void 0 ? _product$is_charge_ta : 0,
229
- base_price: String((_ref10 = (_product$original_pri = product === null || product === void 0 ? void 0 : product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : product === null || product === void 0 ? void 0 : product.selling_price) !== null && _ref10 !== void 0 ? _ref10 : '0')
231
+ base_price: String((_ref9 = (_product$original_pri = product === null || product === void 0 ? void 0 : product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : product === null || product === void 0 ? void 0 : product.selling_price) !== null && _ref9 !== void 0 ? _ref9 : '0')
230
232
  },
231
233
  type: type,
232
234
  resource_id: key,
@@ -238,8 +240,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
238
240
  amount: amount,
239
241
  discount: _objectSpread(_objectSpread({}, (item === null || item === void 0 ? void 0 : item.discount) || {}), {}, {
240
242
  resource_id: key,
241
- discount_product_id: (_ref11 = (_item$discount$discou2 = item === null || item === void 0 || (_item$discount6 = item.discount) === null || _item$discount6 === void 0 ? void 0 : _item$discount6.discount_product_id) !== null && _item$discount$discou2 !== void 0 ? _item$discount$discou2 : product === null || product === void 0 ? void 0 : product.product_id) !== null && _ref11 !== void 0 ? _ref11 : 0,
242
- discount_calculation_mode: (_item$discount$discou3 = item === null || item === void 0 || (_item$discount7 = item.discount) === null || _item$discount7 === void 0 ? void 0 : _item$discount7.discount_calculation_mode) !== null && _item$discount$discou3 !== void 0 ? _item$discount$discou3 : 'item_level'
243
+ discount_product_id: (_ref10 = (_item$discount$discou2 = item === null || item === void 0 || (_item$discount8 = item.discount) === null || _item$discount8 === void 0 ? void 0 : _item$discount8.discount_product_id) !== null && _item$discount$discou2 !== void 0 ? _item$discount$discou2 : product === null || product === void 0 ? void 0 : product.product_id) !== null && _ref10 !== void 0 ? _ref10 : 0,
244
+ discount_calculation_mode: (_item$discount$discou3 = item === null || item === void 0 || (_item$discount9 = item.discount) === null || _item$discount9 === void 0 ? void 0 : _item$discount9.discount_calculation_mode) !== null && _item$discount$discou3 !== void 0 ? _item$discount$discou3 : 'item_level'
243
245
  }),
244
246
  applicableProductDetails: [detail],
245
247
  appliedProductDetails: [detail]
@@ -287,10 +289,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
287
289
  }
288
290
  if (Array.isArray(product.product_bundle)) {
289
291
  product.product_bundle = product.product_bundle.map(function (bundle) {
290
- var _ref12, _bundle$original_pric;
292
+ var _ref11, _bundle$original_pric;
291
293
  var hasBundleDiscount = Array.isArray(bundle === null || bundle === void 0 ? void 0 : bundle.discount_list) && bundle.discount_list.length > 0;
292
294
  if (hasBundleDiscount) return bundle;
293
- var restoredPrice = (_ref12 = (_bundle$original_pric = bundle === null || bundle === void 0 ? void 0 : bundle.original_price) !== null && _bundle$original_pric !== void 0 ? _bundle$original_pric : bundle === null || bundle === void 0 ? void 0 : bundle.product_price) !== null && _ref12 !== void 0 ? _ref12 : bundle === null || bundle === void 0 ? void 0 : bundle.price;
295
+ var restoredPrice = (_ref11 = (_bundle$original_pric = bundle === null || bundle === void 0 ? void 0 : bundle.original_price) !== null && _bundle$original_pric !== void 0 ? _bundle$original_pric : bundle === null || bundle === void 0 ? void 0 : bundle.product_price) !== null && _ref11 !== void 0 ? _ref11 : bundle === null || bundle === void 0 ? void 0 : bundle.price;
294
296
  if (restoredPrice === undefined || restoredPrice === null || restoredPrice === '') return bundle;
295
297
  return _objectSpread(_objectSpread({}, bundle), {}, {
296
298
  price: restoredPrice,
@@ -686,7 +688,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
686
688
  value: function () {
687
689
  var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(code, customerId) {
688
690
  var _this$store$discount11, _tempOrder$holder, _this$store$summary;
689
- var resultDiscountWithReason, resultDiscountList, unavailableReasonKey, rulesModule, withScanList, currentSelected, tempOrder, holders, _ref13, isAvailable, newDiscountList, evaluatedDiscountList, unavailableReason, shouldRetainForLater, normalizedNewDiscountList, retainedDiscountList, resolvedDiscountList, _this$store$discount12, _this$store$discount13;
691
+ var resultDiscountWithReason, resultDiscountList, unavailableReasonKey, rulesModule, withScanList, currentSelected, tempOrder, holders, _ref12, isAvailable, newDiscountList, evaluatedDiscountList, unavailableReason, shouldRetainForLater, normalizedNewDiscountList, retainedDiscountList, resolvedDiscountList, _this$store$discount12, _this$store$discount13;
690
692
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
691
693
  while (1) switch (_context6.prev = _context6.next) {
692
694
  case 0:
@@ -763,7 +765,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
763
765
  case 18:
764
766
  tempOrder = this.store.tempOrder;
765
767
  holders = (tempOrder === null || tempOrder === void 0 || (_tempOrder$holder = tempOrder.holder) === null || _tempOrder$holder === void 0 ? void 0 : _tempOrder$holder.form_record) || [];
766
- _ref13 = rulesModule.isDiscountListAvailable({
768
+ _ref12 = rulesModule.isDiscountListAvailable({
767
769
  productList: (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || [],
768
770
  oldDiscountList: this.getDiscountList(),
769
771
  newDiscountList: withScanList,
@@ -775,7 +777,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
775
777
  }) || {
776
778
  isAvailable: false,
777
779
  discountList: this.getDiscountList()
778
- }, isAvailable = _ref13.isAvailable, newDiscountList = _ref13.discountList, evaluatedDiscountList = _ref13.evaluatedDiscountList, unavailableReason = _ref13.unavailableReason;
780
+ }, isAvailable = _ref12.isAvailable, newDiscountList = _ref12.discountList, evaluatedDiscountList = _ref12.evaluatedDiscountList, unavailableReason = _ref12.unavailableReason;
779
781
  shouldRetainForLater = !isAvailable && unavailableReason === UnavailableReason.ProductNotApplicable && withScanList.some(isCustomerPromotionDiscount);
780
782
  normalizedNewDiscountList = newDiscountList ? markScannedDiscounts(newDiscountList, withScanList) : undefined;
781
783
  retainedDiscountList = evaluatedDiscountList ? markScannedDiscounts(evaluatedDiscountList, withScanList) : normalizedNewDiscountList;
@@ -858,9 +860,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
858
860
  if (result !== null && result !== void 0 && result.productList) {
859
861
  var previousProductsByUid = indexOrderProductsByUid(tempOrder.products);
860
862
  tempOrder.products = this.applyProductDiscountPrices((result.productList || []).map(function (product, index) {
861
- var _ref14;
863
+ var _ref13;
862
864
  var uid = getOrderProductLineUid(product);
863
- var previous = (_ref14 = uid ? previousProductsByUid.get(uid) : undefined) !== null && _ref14 !== void 0 ? _ref14 : previousProductsByUid.get("__index__:".concat(index));
865
+ var previous = (_ref13 = uid ? previousProductsByUid.get(uid) : undefined) !== null && _ref13 !== void 0 ? _ref13 : previousProductsByUid.get("__index__:".concat(index));
864
866
  if (isManualProductDiscountProduct(previous)) {
865
867
  return previous;
866
868
  }
@@ -1385,15 +1387,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1385
1387
  }, {
1386
1388
  key: "extractOrderIdFromSubmitResult",
1387
1389
  value: function extractOrderIdFromSubmitResult(result) {
1388
- var _ref15, _ref16, _ref17, _result$data$order_id, _result$data, _result$data2;
1389
- return (_ref15 = (_ref16 = (_ref17 = (_result$data$order_id = result === null || result === void 0 || (_result$data = result.data) === null || _result$data === void 0 ? void 0 : _result$data.order_id) !== null && _result$data$order_id !== void 0 ? _result$data$order_id : result === null || result === void 0 ? void 0 : result.order_id) !== null && _ref17 !== void 0 ? _ref17 : result === null || result === void 0 || (_result$data2 = result.data) === null || _result$data2 === void 0 ? void 0 : _result$data2.id) !== null && _ref16 !== void 0 ? _ref16 : result === null || result === void 0 ? void 0 : result.id) !== null && _ref15 !== void 0 ? _ref15 : null;
1390
+ var _ref14, _ref15, _ref16, _result$data$order_id, _result$data, _result$data2;
1391
+ return (_ref14 = (_ref15 = (_ref16 = (_result$data$order_id = result === null || result === void 0 || (_result$data = result.data) === null || _result$data === void 0 ? void 0 : _result$data.order_id) !== null && _result$data$order_id !== void 0 ? _result$data$order_id : result === null || result === void 0 ? void 0 : result.order_id) !== null && _ref16 !== void 0 ? _ref16 : result === null || result === void 0 || (_result$data2 = result.data) === null || _result$data2 === void 0 ? void 0 : _result$data2.id) !== null && _ref15 !== void 0 ? _ref15 : result === null || result === void 0 ? void 0 : result.id) !== null && _ref14 !== void 0 ? _ref14 : null;
1390
1392
  }
1391
1393
  }, {
1392
1394
  key: "calculatePaymentEffectiveAmount",
1393
1395
  value: function calculatePaymentEffectiveAmount(payment) {
1394
- var _ref18, _payment$origin_amoun;
1396
+ var _ref17, _payment$origin_amoun;
1395
1397
  var amount = new Decimal(payment.amount || 0);
1396
- var originAmount = new Decimal((_ref18 = (_payment$origin_amoun = payment.origin_amount) !== null && _payment$origin_amoun !== void 0 ? _payment$origin_amoun : payment.amount) !== null && _ref18 !== void 0 ? _ref18 : 0);
1398
+ var originAmount = new Decimal((_ref17 = (_payment$origin_amoun = payment.origin_amount) !== null && _payment$origin_amoun !== void 0 ? _payment$origin_amoun : payment.amount) !== null && _ref17 !== void 0 ? _ref17 : 0);
1397
1399
  var serviceFee = new Decimal(payment.service_fee || 0);
1398
1400
  // TODO: 后端允许 amount 表示顾客实际支付总额后,移除这个兼容分支。
1399
1401
  var effectiveAmount = serviceFee.gt(0) && amount.eq(originAmount) ? amount.plus(serviceFee) : amount;
@@ -1593,12 +1595,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1593
1595
  }, {
1594
1596
  key: "normalizePaymentSource",
1595
1597
  value: function normalizePaymentSource(payment, options) {
1596
- var _ref19, _paymentRecord$origin;
1598
+ var _ref18, _paymentRecord$origin;
1597
1599
  var paymentRecord = payment;
1598
1600
  var metadata = paymentRecord.metadata && _typeof(paymentRecord.metadata) === 'object' ? _objectSpread({}, paymentRecord.metadata) : {};
1599
1601
  var normalized = ensureOrderPaymentNumber(_objectSpread(_objectSpread({}, paymentRecord), {}, {
1600
1602
  metadata: metadata,
1601
- origin_amount: (_ref19 = (_paymentRecord$origin = paymentRecord.origin_amount) !== null && _paymentRecord$origin !== void 0 ? _paymentRecord$origin : paymentRecord.amount) !== null && _ref19 !== void 0 ? _ref19 : '0.00'
1603
+ origin_amount: (_ref18 = (_paymentRecord$origin = paymentRecord.origin_amount) !== null && _paymentRecord$origin !== void 0 ? _paymentRecord$origin : paymentRecord.amount) !== null && _ref18 !== void 0 ? _ref18 : '0.00'
1602
1604
  }), (options === null || options === void 0 ? void 0 : options.devicePrefix) || this.getPaymentNumberDevicePrefixSync(), createUuidV4);
1603
1605
  if (paymentRecord.status !== undefined) {
1604
1606
  normalized.status = paymentRecord.status;
@@ -1949,7 +1951,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1949
1951
  _product$payment_pric,
1950
1952
  _sku$code,
1951
1953
  _sku$barcode,
1952
- _ref20,
1954
+ _ref19,
1953
1955
  _sku$variant_id,
1954
1956
  _this11 = this;
1955
1957
  var sku = (product === null || product === void 0 ? void 0 : product.product_sku) || {};
@@ -1976,24 +1978,24 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1976
1978
  product_sku: this.normalizeFingerprintValue({
1977
1979
  code: (_sku$code = sku.code) !== null && _sku$code !== void 0 ? _sku$code : '',
1978
1980
  barcode: (_sku$barcode = sku.barcode) !== null && _sku$barcode !== void 0 ? _sku$barcode : '',
1979
- variant_id: (_ref20 = (_sku$variant_id = sku.variant_id) !== null && _sku$variant_id !== void 0 ? _sku$variant_id : product === null || product === void 0 ? void 0 : product.product_variant_id) !== null && _ref20 !== void 0 ? _ref20 : 0,
1981
+ variant_id: (_ref19 = (_sku$variant_id = sku.variant_id) !== null && _sku$variant_id !== void 0 ? _sku$variant_id : product === null || product === void 0 ? void 0 : product.product_variant_id) !== null && _ref19 !== void 0 ? _ref19 : 0,
1980
1982
  variant: sku.variant || [],
1981
1983
  option: getProductSkuOptions(product || {}).map(function (option) {
1982
- var _ref21, _option$id, _option$option_group_, _ref22, _option$option_group_2, _option$num, _option$add_price;
1984
+ var _ref20, _option$id, _option$option_group_, _ref21, _option$option_group_2, _option$num, _option$add_price;
1983
1985
  return {
1984
- id: (_ref21 = (_option$id = option === null || option === void 0 ? void 0 : option.id) !== null && _option$id !== void 0 ? _option$id : option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _ref21 !== void 0 ? _ref21 : null,
1986
+ id: (_ref20 = (_option$id = option === null || option === void 0 ? void 0 : option.id) !== null && _option$id !== void 0 ? _option$id : option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _ref20 !== void 0 ? _ref20 : null,
1985
1987
  option_group_id: (_option$option_group_ = option === null || option === void 0 ? void 0 : option.option_group_id) !== null && _option$option_group_ !== void 0 ? _option$option_group_ : null,
1986
- option_group_item_id: (_ref22 = (_option$option_group_2 = option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _option$option_group_2 !== void 0 ? _option$option_group_2 : option === null || option === void 0 ? void 0 : option.id) !== null && _ref22 !== void 0 ? _ref22 : null,
1988
+ option_group_item_id: (_ref21 = (_option$option_group_2 = option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _option$option_group_2 !== void 0 ? _option$option_group_2 : option === null || option === void 0 ? void 0 : option.id) !== null && _ref21 !== void 0 ? _ref21 : null,
1987
1989
  num: Number((_option$num = option === null || option === void 0 ? void 0 : option.num) !== null && _option$num !== void 0 ? _option$num : 1) || 1,
1988
1990
  add_price: _this11.normalizeFingerprintMoney((_option$add_price = option === null || option === void 0 ? void 0 : option.add_price) !== null && _option$add_price !== void 0 ? _option$add_price : option === null || option === void 0 ? void 0 : option.price)
1989
1991
  };
1990
1992
  })
1991
1993
  }),
1992
1994
  product_bundle: this.normalizeFingerprintValue(((product === null || product === void 0 ? void 0 : product.product_bundle) || []).map(function (bundle) {
1993
- var _ref23, _ref24, _bundle$bundle_produc, _ref25, _bundle$bundle_varian, _bundle$num, _bundle$price_type, _bundle$price_type_ex;
1995
+ var _ref22, _ref23, _bundle$bundle_produc, _ref24, _bundle$bundle_varian, _bundle$num, _bundle$price_type, _bundle$price_type_ex;
1994
1996
  return {
1995
- bundle_product_id: (_ref23 = (_ref24 = (_bundle$bundle_produc = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_product_id) !== null && _bundle$bundle_produc !== void 0 ? _bundle$bundle_produc : bundle === null || bundle === void 0 ? void 0 : bundle._bundle_product_id) !== null && _ref24 !== void 0 ? _ref24 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id) !== null && _ref23 !== void 0 ? _ref23 : null,
1996
- bundle_variant_id: (_ref25 = (_bundle$bundle_varian = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_variant_id) !== null && _bundle$bundle_varian !== void 0 ? _bundle$bundle_varian : bundle === null || bundle === void 0 ? void 0 : bundle.product_variant_id) !== null && _ref25 !== void 0 ? _ref25 : 0,
1997
+ bundle_product_id: (_ref22 = (_ref23 = (_bundle$bundle_produc = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_product_id) !== null && _bundle$bundle_produc !== void 0 ? _bundle$bundle_produc : bundle === null || bundle === void 0 ? void 0 : bundle._bundle_product_id) !== null && _ref23 !== void 0 ? _ref23 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id) !== null && _ref22 !== void 0 ? _ref22 : null,
1998
+ bundle_variant_id: (_ref24 = (_bundle$bundle_varian = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_variant_id) !== null && _bundle$bundle_varian !== void 0 ? _bundle$bundle_varian : bundle === null || bundle === void 0 ? void 0 : bundle.product_variant_id) !== null && _ref24 !== void 0 ? _ref24 : 0,
1997
1999
  num: getSafeProductNum((_bundle$num = bundle === null || bundle === void 0 ? void 0 : bundle.num) !== null && _bundle$num !== void 0 ? _bundle$num : bundle === null || bundle === void 0 ? void 0 : bundle.quantity),
1998
2000
  price: _this11.normalizeFingerprintMoney(bundle === null || bundle === void 0 ? void 0 : bundle.price),
1999
2001
  bundle_selling_price: _this11.normalizeFingerprintMoney(bundle === null || bundle === void 0 ? void 0 : bundle.bundle_selling_price),
@@ -2002,10 +2004,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2002
2004
  };
2003
2005
  })),
2004
2006
  discount_list: this.normalizeFingerprintValue(((product === null || product === void 0 ? void 0 : product.discount_list) || []).map(function (discount) {
2005
- var _ref26, _discount$type2, _ref27, _ref28, _discount$discount_id, _discount$discount;
2007
+ var _ref25, _discount$type2, _ref26, _ref27, _discount$discount_id, _discount$discount;
2006
2008
  return {
2007
- type: (_ref26 = (_discount$type2 = discount === null || discount === void 0 ? void 0 : discount.type) !== null && _discount$type2 !== void 0 ? _discount$type2 : discount === null || discount === void 0 ? void 0 : discount.tag) !== null && _ref26 !== void 0 ? _ref26 : '',
2008
- discount_id: (_ref27 = (_ref28 = (_discount$discount_id = discount === null || discount === void 0 ? void 0 : discount.discount_id) !== null && _discount$discount_id !== void 0 ? _discount$discount_id : discount === null || discount === void 0 ? void 0 : discount.order_discount_id) !== null && _ref28 !== void 0 ? _ref28 : discount === null || discount === void 0 || (_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) !== null && _ref27 !== void 0 ? _ref27 : null,
2009
+ type: (_ref25 = (_discount$type2 = discount === null || discount === void 0 ? void 0 : discount.type) !== null && _discount$type2 !== void 0 ? _discount$type2 : discount === null || discount === void 0 ? void 0 : discount.tag) !== null && _ref25 !== void 0 ? _ref25 : '',
2010
+ discount_id: (_ref26 = (_ref27 = (_discount$discount_id = discount === null || discount === void 0 ? void 0 : discount.discount_id) !== null && _discount$discount_id !== void 0 ? _discount$discount_id : discount === null || discount === void 0 ? void 0 : discount.order_discount_id) !== null && _ref27 !== void 0 ? _ref27 : discount === null || discount === void 0 || (_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) !== null && _ref26 !== void 0 ? _ref26 : null,
2009
2011
  amount: _this11.normalizeFingerprintMoney(discount === null || discount === void 0 ? void 0 : discount.amount)
2010
2012
  };
2011
2013
  }))
@@ -2029,14 +2031,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2029
2031
  var _product$product_id3,
2030
2032
  _product$product_vari2,
2031
2033
  _product$num2,
2032
- _ref29,
2034
+ _ref28,
2033
2035
  _metadata$unique_iden,
2034
2036
  _metadata$price_overr,
2035
2037
  _metadata$is_manual_d,
2036
2038
  _metadata$product_dis,
2037
2039
  _sku$code2,
2038
2040
  _sku$barcode2,
2039
- _ref30,
2041
+ _ref29,
2040
2042
  _sku$variant_id2,
2041
2043
  _this13 = this;
2042
2044
  var sku = (product === null || product === void 0 ? void 0 : product.product_sku) || {};
@@ -2052,7 +2054,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2052
2054
  extension_type: extensionType,
2053
2055
  num: getSafeProductNum((_product$num2 = product === null || product === void 0 ? void 0 : product.num) !== null && _product$num2 !== void 0 ? _product$num2 : product === null || product === void 0 ? void 0 : product.product_quantity),
2054
2056
  metadata: {
2055
- unique_identification_number: (_ref29 = (_metadata$unique_iden = metadata.unique_identification_number) !== null && _metadata$unique_iden !== void 0 ? _metadata$unique_iden : product === null || product === void 0 ? void 0 : product.unique_identification_number) !== null && _ref29 !== void 0 ? _ref29 : '',
2057
+ unique_identification_number: (_ref28 = (_metadata$unique_iden = metadata.unique_identification_number) !== null && _metadata$unique_iden !== void 0 ? _metadata$unique_iden : product === null || product === void 0 ? void 0 : product.unique_identification_number) !== null && _ref28 !== void 0 ? _ref28 : '',
2056
2058
  price_override: (_metadata$price_overr = metadata.price_override) !== null && _metadata$price_overr !== void 0 ? _metadata$price_overr : '',
2057
2059
  is_manual_discount: (_metadata$is_manual_d = metadata.is_manual_discount) !== null && _metadata$is_manual_d !== void 0 ? _metadata$is_manual_d : '',
2058
2060
  product_discount_reason: (_metadata$product_dis = metadata.product_discount_reason) !== null && _metadata$product_dis !== void 0 ? _metadata$product_dis : ''
@@ -2060,35 +2062,35 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2060
2062
  product_sku: this.normalizeFingerprintValue({
2061
2063
  code: (_sku$code2 = sku.code) !== null && _sku$code2 !== void 0 ? _sku$code2 : '',
2062
2064
  barcode: (_sku$barcode2 = sku.barcode) !== null && _sku$barcode2 !== void 0 ? _sku$barcode2 : '',
2063
- variant_id: (_ref30 = (_sku$variant_id2 = sku.variant_id) !== null && _sku$variant_id2 !== void 0 ? _sku$variant_id2 : product === null || product === void 0 ? void 0 : product.product_variant_id) !== null && _ref30 !== void 0 ? _ref30 : 0,
2065
+ variant_id: (_ref29 = (_sku$variant_id2 = sku.variant_id) !== null && _sku$variant_id2 !== void 0 ? _sku$variant_id2 : product === null || product === void 0 ? void 0 : product.product_variant_id) !== null && _ref29 !== void 0 ? _ref29 : 0,
2064
2066
  variant: sku.variant || [],
2065
2067
  option: getProductSkuOptions(product || {}).map(function (option) {
2066
- var _ref31, _option$id2, _option$option_group_3, _ref32, _option$option_group_4, _option$num2, _option$add_price2;
2068
+ var _ref30, _option$id2, _option$option_group_3, _ref31, _option$option_group_4, _option$num2, _option$add_price2;
2067
2069
  return {
2068
- id: (_ref31 = (_option$id2 = option === null || option === void 0 ? void 0 : option.id) !== null && _option$id2 !== void 0 ? _option$id2 : option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _ref31 !== void 0 ? _ref31 : null,
2070
+ id: (_ref30 = (_option$id2 = option === null || option === void 0 ? void 0 : option.id) !== null && _option$id2 !== void 0 ? _option$id2 : option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _ref30 !== void 0 ? _ref30 : null,
2069
2071
  option_group_id: (_option$option_group_3 = option === null || option === void 0 ? void 0 : option.option_group_id) !== null && _option$option_group_3 !== void 0 ? _option$option_group_3 : null,
2070
- option_group_item_id: (_ref32 = (_option$option_group_4 = option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _option$option_group_4 !== void 0 ? _option$option_group_4 : option === null || option === void 0 ? void 0 : option.id) !== null && _ref32 !== void 0 ? _ref32 : null,
2072
+ option_group_item_id: (_ref31 = (_option$option_group_4 = option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _option$option_group_4 !== void 0 ? _option$option_group_4 : option === null || option === void 0 ? void 0 : option.id) !== null && _ref31 !== void 0 ? _ref31 : null,
2071
2073
  num: Number((_option$num2 = option === null || option === void 0 ? void 0 : option.num) !== null && _option$num2 !== void 0 ? _option$num2 : 1) || 1,
2072
2074
  add_price: _this13.normalizeFingerprintMoney((_option$add_price2 = option === null || option === void 0 ? void 0 : option.add_price) !== null && _option$add_price2 !== void 0 ? _option$add_price2 : option === null || option === void 0 ? void 0 : option.price)
2073
2075
  };
2074
2076
  })
2075
2077
  }),
2076
2078
  product_bundle: this.normalizeFingerprintValue(((product === null || product === void 0 ? void 0 : product.product_bundle) || []).map(function (bundle) {
2077
- var _ref33, _bundle$bundle_id, _ref34, _bundle$bundle_group_, _ref35, _ref36, _bundle$bundle_produc2, _ref37, _bundle$bundle_varian2, _bundle$num2, _bundle$price_type2, _bundle$price_type_ex2;
2079
+ var _ref32, _bundle$bundle_id, _ref33, _bundle$bundle_group_, _ref34, _ref35, _bundle$bundle_produc2, _ref36, _bundle$bundle_varian2, _bundle$num2, _bundle$price_type2, _bundle$price_type_ex2;
2078
2080
  return {
2079
- bundle_id: (_ref33 = (_bundle$bundle_id = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_id) !== null && _bundle$bundle_id !== void 0 ? _bundle$bundle_id : bundle === null || bundle === void 0 ? void 0 : bundle.id) !== null && _ref33 !== void 0 ? _ref33 : null,
2080
- bundle_group_id: (_ref34 = (_bundle$bundle_group_ = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_group_id) !== null && _bundle$bundle_group_ !== void 0 ? _bundle$bundle_group_ : bundle === null || bundle === void 0 ? void 0 : bundle.group_id) !== null && _ref34 !== void 0 ? _ref34 : null,
2081
- bundle_product_id: (_ref35 = (_ref36 = (_bundle$bundle_produc2 = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_product_id) !== null && _bundle$bundle_produc2 !== void 0 ? _bundle$bundle_produc2 : bundle === null || bundle === void 0 ? void 0 : bundle._bundle_product_id) !== null && _ref36 !== void 0 ? _ref36 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id) !== null && _ref35 !== void 0 ? _ref35 : null,
2082
- bundle_variant_id: (_ref37 = (_bundle$bundle_varian2 = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_variant_id) !== null && _bundle$bundle_varian2 !== void 0 ? _bundle$bundle_varian2 : bundle === null || bundle === void 0 ? void 0 : bundle.product_variant_id) !== null && _ref37 !== void 0 ? _ref37 : 0,
2081
+ bundle_id: (_ref32 = (_bundle$bundle_id = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_id) !== null && _bundle$bundle_id !== void 0 ? _bundle$bundle_id : bundle === null || bundle === void 0 ? void 0 : bundle.id) !== null && _ref32 !== void 0 ? _ref32 : null,
2082
+ bundle_group_id: (_ref33 = (_bundle$bundle_group_ = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_group_id) !== null && _bundle$bundle_group_ !== void 0 ? _bundle$bundle_group_ : bundle === null || bundle === void 0 ? void 0 : bundle.group_id) !== null && _ref33 !== void 0 ? _ref33 : null,
2083
+ bundle_product_id: (_ref34 = (_ref35 = (_bundle$bundle_produc2 = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_product_id) !== null && _bundle$bundle_produc2 !== void 0 ? _bundle$bundle_produc2 : bundle === null || bundle === void 0 ? void 0 : bundle._bundle_product_id) !== null && _ref35 !== void 0 ? _ref35 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id) !== null && _ref34 !== void 0 ? _ref34 : null,
2084
+ bundle_variant_id: (_ref36 = (_bundle$bundle_varian2 = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_variant_id) !== null && _bundle$bundle_varian2 !== void 0 ? _bundle$bundle_varian2 : bundle === null || bundle === void 0 ? void 0 : bundle.product_variant_id) !== null && _ref36 !== void 0 ? _ref36 : 0,
2083
2085
  num: getSafeProductNum((_bundle$num2 = bundle === null || bundle === void 0 ? void 0 : bundle.num) !== null && _bundle$num2 !== void 0 ? _bundle$num2 : bundle === null || bundle === void 0 ? void 0 : bundle.quantity),
2084
2086
  price_type: (_bundle$price_type2 = bundle === null || bundle === void 0 ? void 0 : bundle.price_type) !== null && _bundle$price_type2 !== void 0 ? _bundle$price_type2 : '',
2085
2087
  price_type_ext: (_bundle$price_type_ex2 = bundle === null || bundle === void 0 ? void 0 : bundle.price_type_ext) !== null && _bundle$price_type_ex2 !== void 0 ? _bundle$price_type_ex2 : '',
2086
2088
  option: _this13.normalizeFingerprintValue(((bundle === null || bundle === void 0 ? void 0 : bundle.option) || []).map(function (option) {
2087
- var _ref38, _option$id3, _option$option_group_5, _ref39, _option$option_group_6, _option$num3, _option$add_price3;
2089
+ var _ref37, _option$id3, _option$option_group_5, _ref38, _option$option_group_6, _option$num3, _option$add_price3;
2088
2090
  return {
2089
- id: (_ref38 = (_option$id3 = option === null || option === void 0 ? void 0 : option.id) !== null && _option$id3 !== void 0 ? _option$id3 : option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _ref38 !== void 0 ? _ref38 : null,
2091
+ id: (_ref37 = (_option$id3 = option === null || option === void 0 ? void 0 : option.id) !== null && _option$id3 !== void 0 ? _option$id3 : option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _ref37 !== void 0 ? _ref37 : null,
2090
2092
  option_group_id: (_option$option_group_5 = option === null || option === void 0 ? void 0 : option.option_group_id) !== null && _option$option_group_5 !== void 0 ? _option$option_group_5 : null,
2091
- option_group_item_id: (_ref39 = (_option$option_group_6 = option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _option$option_group_6 !== void 0 ? _option$option_group_6 : option === null || option === void 0 ? void 0 : option.id) !== null && _ref39 !== void 0 ? _ref39 : null,
2093
+ option_group_item_id: (_ref38 = (_option$option_group_6 = option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _option$option_group_6 !== void 0 ? _option$option_group_6 : option === null || option === void 0 ? void 0 : option.id) !== null && _ref38 !== void 0 ? _ref38 : null,
2092
2094
  num: Number((_option$num3 = option === null || option === void 0 ? void 0 : option.num) !== null && _option$num3 !== void 0 ? _option$num3 : 1) || 1,
2093
2095
  add_price: _this13.normalizeFingerprintMoney((_option$add_price3 = option === null || option === void 0 ? void 0 : option.add_price) !== null && _option$add_price3 !== void 0 ? _option$add_price3 : option === null || option === void 0 ? void 0 : option.price)
2094
2096
  };
@@ -2096,10 +2098,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2096
2098
  };
2097
2099
  })),
2098
2100
  discount_list: this.normalizeFingerprintValue(((product === null || product === void 0 ? void 0 : product.discount_list) || []).map(function (discount) {
2099
- var _ref40, _discount$type4, _ref41, _ref42, _discount$discount_id2, _discount$discount2;
2101
+ var _ref39, _discount$type4, _ref40, _ref41, _discount$discount_id2, _discount$discount2;
2100
2102
  return {
2101
- type: (_ref40 = (_discount$type4 = discount === null || discount === void 0 ? void 0 : discount.type) !== null && _discount$type4 !== void 0 ? _discount$type4 : discount === null || discount === void 0 ? void 0 : discount.tag) !== null && _ref40 !== void 0 ? _ref40 : '',
2102
- discount_id: (_ref41 = (_ref42 = (_discount$discount_id2 = discount === null || discount === void 0 ? void 0 : discount.discount_id) !== null && _discount$discount_id2 !== void 0 ? _discount$discount_id2 : discount === null || discount === void 0 ? void 0 : discount.order_discount_id) !== null && _ref42 !== void 0 ? _ref42 : discount === null || discount === void 0 || (_discount$discount2 = discount.discount) === null || _discount$discount2 === void 0 ? void 0 : _discount$discount2.resource_id) !== null && _ref41 !== void 0 ? _ref41 : null,
2103
+ type: (_ref39 = (_discount$type4 = discount === null || discount === void 0 ? void 0 : discount.type) !== null && _discount$type4 !== void 0 ? _discount$type4 : discount === null || discount === void 0 ? void 0 : discount.tag) !== null && _ref39 !== void 0 ? _ref39 : '',
2104
+ discount_id: (_ref40 = (_ref41 = (_discount$discount_id2 = discount === null || discount === void 0 ? void 0 : discount.discount_id) !== null && _discount$discount_id2 !== void 0 ? _discount$discount_id2 : discount === null || discount === void 0 ? void 0 : discount.order_discount_id) !== null && _ref41 !== void 0 ? _ref41 : discount === null || discount === void 0 || (_discount$discount2 = discount.discount) === null || _discount$discount2 === void 0 ? void 0 : _discount$discount2.resource_id) !== null && _ref40 !== void 0 ? _ref40 : null,
2103
2105
  amount: _this13.normalizeFingerprintMoney(discount === null || discount === void 0 ? void 0 : discount.amount)
2104
2106
  };
2105
2107
  }))
@@ -2402,11 +2404,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2402
2404
  }, {
2403
2405
  key: "getOrderIdentity",
2404
2406
  value: function getOrderIdentity() {
2405
- var _ref43, _ref44, _tempOrder$order_id, _tempOrder$_extend6;
2407
+ var _ref42, _ref43, _tempOrder$order_id, _tempOrder$_extend6;
2406
2408
  var tempOrder = this.store.tempOrder;
2407
2409
  if (!tempOrder) return null;
2408
2410
  var lastOrderInfo = this.store.lastOrderInfo || {};
2409
- var orderId = (_ref43 = (_ref44 = (_tempOrder$order_id = tempOrder.order_id) !== null && _tempOrder$order_id !== void 0 ? _tempOrder$order_id : lastOrderInfo.order_id) !== null && _ref44 !== void 0 ? _ref44 : lastOrderInfo.id) !== null && _ref43 !== void 0 ? _ref43 : null;
2411
+ var orderId = (_ref42 = (_ref43 = (_tempOrder$order_id = tempOrder.order_id) !== null && _tempOrder$order_id !== void 0 ? _tempOrder$order_id : lastOrderInfo.order_id) !== null && _ref43 !== void 0 ? _ref43 : lastOrderInfo.id) !== null && _ref42 !== void 0 ? _ref42 : null;
2410
2412
  return {
2411
2413
  localId: this.cacheId || ((_tempOrder$_extend6 = tempOrder._extend) === null || _tempOrder$_extend6 === void 0 ? void 0 : _tempOrder$_extend6.localId),
2412
2414
  orderId: orderId,
@@ -2559,11 +2561,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2559
2561
  }, {
2560
2562
  key: "captureProductRuntime",
2561
2563
  value: function captureProductRuntime(tempOrder, rawProduct, normalizedProduct, existedUid) {
2562
- var _extend$productsByUid, _ref45, _rawProduct$_origin;
2564
+ var _extend$productsByUid, _ref44, _rawProduct$_origin;
2563
2565
  var uid = existedUid || this.getProductUid(normalizedProduct);
2564
2566
  var extend = this.ensureExtend(tempOrder);
2565
2567
  var existed = ((_extend$productsByUid = extend.productsByUid) === null || _extend$productsByUid === void 0 ? void 0 : _extend$productsByUid[uid]) || {};
2566
- var origin = (_ref45 = (_rawProduct$_origin = rawProduct._origin) !== null && _rawProduct$_origin !== void 0 ? _rawProduct$_origin : normalizedProduct._origin) !== null && _ref45 !== void 0 ? _ref45 : existed.origin;
2568
+ var origin = (_ref44 = (_rawProduct$_origin = rawProduct._origin) !== null && _rawProduct$_origin !== void 0 ? _rawProduct$_origin : normalizedProduct._origin) !== null && _ref44 !== void 0 ? _ref44 : existed.origin;
2567
2569
  extend.productsByUid[uid] = _objectSpread(_objectSpread({}, existed), origin !== undefined ? {
2568
2570
  origin: origin
2569
2571
  } : {});
@@ -2706,7 +2708,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2706
2708
  }, {
2707
2709
  key: "buildTempOrderHolderFromBookings",
2708
2710
  value: function buildTempOrderHolderFromBookings(tempOrder) {
2709
- var _baseHolder$customer_, _baseHolder, _ref46, _baseHolder$form_id, _baseHolder2, _tempOrder$holder2, _baseHolder3, _this$otherParams;
2711
+ var _baseHolder$customer_, _baseHolder, _ref45, _baseHolder$form_id, _baseHolder2, _tempOrder$holder2, _baseHolder3, _this$otherParams;
2710
2712
  var holderRecords = [];
2711
2713
  var holderNames = [];
2712
2714
  var baseHolder = null;
@@ -2753,7 +2755,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2753
2755
  }
2754
2756
  var nextHolder = {
2755
2757
  customer_id: (_baseHolder$customer_ = (_baseHolder = baseHolder) === null || _baseHolder === void 0 ? void 0 : _baseHolder.customer_id) !== null && _baseHolder$customer_ !== void 0 ? _baseHolder$customer_ : tempOrder.customer_id,
2756
- form_id: (_ref46 = (_baseHolder$form_id = (_baseHolder2 = baseHolder) === null || _baseHolder2 === void 0 ? void 0 : _baseHolder2.form_id) !== null && _baseHolder$form_id !== void 0 ? _baseHolder$form_id : (_tempOrder$holder2 = tempOrder.holder) === null || _tempOrder$holder2 === void 0 ? void 0 : _tempOrder$holder2.form_id) !== null && _ref46 !== void 0 ? _ref46 : 0,
2758
+ form_id: (_ref45 = (_baseHolder$form_id = (_baseHolder2 = baseHolder) === null || _baseHolder2 === void 0 ? void 0 : _baseHolder2.form_id) !== null && _baseHolder$form_id !== void 0 ? _baseHolder$form_id : (_tempOrder$holder2 = tempOrder.holder) === null || _tempOrder$holder2 === void 0 ? void 0 : _tempOrder$holder2.form_id) !== null && _ref45 !== void 0 ? _ref45 : 0,
2757
2759
  form_record: holderRecords
2758
2760
  };
2759
2761
  if (holderNames.length) {
@@ -2858,7 +2860,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2858
2860
  key: "recalculateSummary",
2859
2861
  value: function () {
2860
2862
  var _recalculateSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(options) {
2861
- var _this$otherParams2, _ref47, _salesSummaryResult$e;
2863
+ var _this$otherParams2, _ref46, _salesSummaryResult$e;
2862
2864
  var tempOrder, originalSnapshot, hasShopDiscountChanged, shouldReuseOriginalSnapshot, snapshotSummary, shouldFullRecalculateFromSnapshot, summaryProducts, salesSummary, existedSummary, totalRefundAmount, paidPaymentSummary, emptyBaseSummary, emptySummaryBase, emptySummaryWithDeposit, emptySummary, salesSummaryResult, roundingAmount, payServiceChargeAmount, hasSalesSummaryAmount, expectAmount, amountPaymentPatch, normalizedExpectAmountPatch, summaryForGap, summary;
2863
2865
  return _regeneratorRuntime().wrap(function _callee12$(_context14) {
2864
2866
  while (1) switch (_context14.prev = _context14.next) {
@@ -2936,7 +2938,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2936
2938
  roundingAmount = paidPaymentSummary.roundingAmount;
2937
2939
  payServiceChargeAmount = paidPaymentSummary.payServiceChargeAmount;
2938
2940
  hasSalesSummaryAmount = salesSummaryResult.expect_amount !== undefined || salesSummaryResult.total_amount !== undefined;
2939
- expectAmount = hasSalesSummaryAmount ? new Decimal((_ref47 = (_salesSummaryResult$e = salesSummaryResult.expect_amount) !== null && _salesSummaryResult$e !== void 0 ? _salesSummaryResult$e : salesSummaryResult.total_amount) !== null && _ref47 !== void 0 ? _ref47 : 0) : null;
2941
+ expectAmount = hasSalesSummaryAmount ? new Decimal((_ref46 = (_salesSummaryResult$e = salesSummaryResult.expect_amount) !== null && _salesSummaryResult$e !== void 0 ? _salesSummaryResult$e : salesSummaryResult.total_amount) !== null && _ref46 !== void 0 ? _ref46 : 0) : null;
2940
2942
  amountPaymentPatch = hasSalesSummaryAmount || !roundingAmount.eq(0) || !payServiceChargeAmount.eq(0) ? _objectSpread({
2941
2943
  rounding_amount: roundingAmount.toFixed(2)
2942
2944
  }, expectAmount ? {
@@ -3114,17 +3116,17 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3114
3116
  }, {
3115
3117
  key: "buildTempOrderCustomer",
3116
3118
  value: function buildTempOrderCustomer(params) {
3117
- var _ref48, _ref49, _ref50, _source$name, _ref51, _ref52, _ref53, _source$customer_name, _source$id, _source$customer_id, _ref54, _source$country_calli, _source$phone, _source$email;
3119
+ var _ref47, _ref48, _ref49, _source$name, _ref50, _ref51, _ref52, _source$customer_name, _source$id, _source$customer_id, _ref53, _source$country_calli, _source$phone, _source$email;
3118
3120
  if (!params.customerId) return null;
3119
3121
  var source = params.source ? cloneDeep(params.source) : {};
3120
- var name = (_ref48 = (_ref49 = (_ref50 = (_source$name = source.name) !== null && _source$name !== void 0 ? _source$name : source.display_name) !== null && _ref50 !== void 0 ? _ref50 : source.customerName) !== null && _ref49 !== void 0 ? _ref49 : source.customer_name) !== null && _ref48 !== void 0 ? _ref48 : params.customerName;
3121
- var customerName = (_ref51 = (_ref52 = (_ref53 = (_source$customer_name = source.customer_name) !== null && _source$customer_name !== void 0 ? _source$customer_name : source.customerName) !== null && _ref53 !== void 0 ? _ref53 : source.display_name) !== null && _ref52 !== void 0 ? _ref52 : source.name) !== null && _ref51 !== void 0 ? _ref51 : params.customerName;
3122
+ var name = (_ref47 = (_ref48 = (_ref49 = (_source$name = source.name) !== null && _source$name !== void 0 ? _source$name : source.display_name) !== null && _ref49 !== void 0 ? _ref49 : source.customerName) !== null && _ref48 !== void 0 ? _ref48 : source.customer_name) !== null && _ref47 !== void 0 ? _ref47 : params.customerName;
3123
+ var customerName = (_ref50 = (_ref51 = (_ref52 = (_source$customer_name = source.customer_name) !== null && _source$customer_name !== void 0 ? _source$customer_name : source.customerName) !== null && _ref52 !== void 0 ? _ref52 : source.display_name) !== null && _ref51 !== void 0 ? _ref51 : source.name) !== null && _ref50 !== void 0 ? _ref50 : params.customerName;
3122
3124
  return _objectSpread(_objectSpread({}, source), {}, {
3123
3125
  id: (_source$id = source.id) !== null && _source$id !== void 0 ? _source$id : params.customerId,
3124
3126
  customer_id: (_source$customer_id = source.customer_id) !== null && _source$customer_id !== void 0 ? _source$customer_id : params.customerId,
3125
3127
  name: String(name || ''),
3126
3128
  customer_name: String(customerName || ''),
3127
- country_calling_code: String((_ref54 = (_source$country_calli = source.country_calling_code) !== null && _source$country_calli !== void 0 ? _source$country_calli : source.countryCallingCode) !== null && _ref54 !== void 0 ? _ref54 : params.countryCallingCode),
3129
+ country_calling_code: String((_ref53 = (_source$country_calli = source.country_calling_code) !== null && _source$country_calli !== void 0 ? _source$country_calli : source.countryCallingCode) !== null && _ref53 !== void 0 ? _ref53 : params.countryCallingCode),
3128
3130
  phone: String((_source$phone = source.phone) !== null && _source$phone !== void 0 ? _source$phone : params.phone),
3129
3131
  email: String((_source$email = source.email) !== null && _source$email !== void 0 ? _source$email : params.email)
3130
3132
  });
@@ -3228,14 +3230,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3228
3230
  }, {
3229
3231
  key: "updateTempOrderCustomer",
3230
3232
  value: function updateTempOrderCustomer(customer) {
3231
- var _tempOrder$customer_i2, _ref55, _ref56, _customer$customer_id, _ref57, _ref58, _ref59, _customer$customer_na, _ref60, _customer$country_cal, _tempOrder$customer_i3;
3233
+ var _tempOrder$customer_i2, _ref54, _ref55, _customer$customer_id, _ref56, _ref57, _ref58, _customer$customer_na, _ref59, _customer$country_cal, _tempOrder$customer_i3;
3232
3234
  var tempOrder = this.ensureTempOrder();
3233
3235
  var previousCustomerId = (_tempOrder$customer_i2 = tempOrder.customer_id) !== null && _tempOrder$customer_i2 !== void 0 ? _tempOrder$customer_i2 : null;
3234
- var customerId = (_ref55 = (_ref56 = (_customer$customer_id = customer.customer_id) !== null && _customer$customer_id !== void 0 ? _customer$customer_id : customer.customerId) !== null && _ref56 !== void 0 ? _ref56 : customer.id) !== null && _ref55 !== void 0 ? _ref55 : null;
3235
- var customerName = (_ref57 = (_ref58 = (_ref59 = (_customer$customer_na = customer.customer_name) !== null && _customer$customer_na !== void 0 ? _customer$customer_na : customer.customerName) !== null && _ref59 !== void 0 ? _ref59 : customer.display_name) !== null && _ref58 !== void 0 ? _ref58 : customer.name) !== null && _ref57 !== void 0 ? _ref57 : '';
3236
+ 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;
3237
+ 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 : '';
3236
3238
  tempOrder.customer_id = customerId === null || customerId === undefined || customerId === '' ? null : Number(customerId);
3237
3239
  tempOrder.customer_name = String(customerName || '');
3238
- tempOrder.country_calling_code = String((_ref60 = (_customer$country_cal = customer.country_calling_code) !== null && _customer$country_cal !== void 0 ? _customer$country_cal : customer.countryCallingCode) !== null && _ref60 !== void 0 ? _ref60 : '');
3240
+ tempOrder.country_calling_code = String((_ref59 = (_customer$country_cal = customer.country_calling_code) !== null && _customer$country_cal !== void 0 ? _customer$country_cal : customer.countryCallingCode) !== null && _ref59 !== void 0 ? _ref59 : '');
3239
3241
  tempOrder.phone = String(customer.phone || '');
3240
3242
  tempOrder.email = String(customer.email || '');
3241
3243
  tempOrder.customer = this.buildTempOrderCustomer({
@@ -4034,7 +4036,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4034
4036
  key: "addProductToOrder",
4035
4037
  value: (function () {
4036
4038
  var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(product, booking, options) {
4037
- var tempOrder, insertAfterProductUid, anchorIndex, insertAtIndex, _ref61, _productRecord$num, productRecord, splitCount, i, singleLine;
4039
+ var tempOrder, insertAfterProductUid, anchorIndex, insertAtIndex, _ref60, _productRecord$num, productRecord, splitCount, i, singleLine;
4038
4040
  return _regeneratorRuntime().wrap(function _callee21$(_context23) {
4039
4041
  while (1) switch (_context23.prev = _context23.next) {
4040
4042
  case 0:
@@ -4051,7 +4053,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4051
4053
  break;
4052
4054
  }
4053
4055
  productRecord = product;
4054
- splitCount = getSafeProductNum((_ref61 = (_productRecord$num = productRecord.num) !== null && _productRecord$num !== void 0 ? _productRecord$num : productRecord.product_quantity) !== null && _ref61 !== void 0 ? _ref61 : 1);
4056
+ splitCount = getSafeProductNum((_ref60 = (_productRecord$num = productRecord.num) !== null && _productRecord$num !== void 0 ? _productRecord$num : productRecord.product_quantity) !== null && _ref60 !== void 0 ? _ref60 : 1);
4055
4057
  if (!(splitCount > 1)) {
4056
4058
  _context23.next = 22;
4057
4059
  break;
@@ -4119,7 +4121,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4119
4121
  key: "addProductsToOrder",
4120
4122
  value: (function () {
4121
4123
  var _addProductsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(items, options) {
4122
- var tempOrder, _iterator20, _step20, item, product, booking, _ref62, _productRecord$num2, productRecord, splitCount, i, singleLine;
4124
+ var tempOrder, _iterator20, _step20, item, product, booking, _ref61, _productRecord$num2, productRecord, splitCount, i, singleLine;
4123
4125
  return _regeneratorRuntime().wrap(function _callee22$(_context24) {
4124
4126
  while (1) switch (_context24.prev = _context24.next) {
4125
4127
  case 0:
@@ -4151,7 +4153,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4151
4153
  break;
4152
4154
  }
4153
4155
  productRecord = product;
4154
- splitCount = getSafeProductNum((_ref62 = (_productRecord$num2 = productRecord.num) !== null && _productRecord$num2 !== void 0 ? _productRecord$num2 : productRecord.product_quantity) !== null && _ref62 !== void 0 ? _ref62 : 1);
4156
+ splitCount = getSafeProductNum((_ref61 = (_productRecord$num2 = productRecord.num) !== null && _productRecord$num2 !== void 0 ? _productRecord$num2 : productRecord.product_quantity) !== null && _ref61 !== void 0 ? _ref61 : 1);
4155
4157
  if (!(splitCount > 1)) {
4156
4158
  _context24.next = 26;
4157
4159
  break;
@@ -4231,9 +4233,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4231
4233
  }, {
4232
4234
  key: "getBundleRuntimeIdentity",
4233
4235
  value: function getBundleRuntimeIdentity(bundle) {
4234
- var _ref63, _bundle$bundle_id2, _ref64, _bundle$bundle_group_2, _ref65, _ref66, _bundle$bundle_produc3, _ref67, _bundle$bundle_varian3;
4236
+ var _ref62, _bundle$bundle_id2, _ref63, _bundle$bundle_group_2, _ref64, _ref65, _bundle$bundle_produc3, _ref66, _bundle$bundle_varian3;
4235
4237
  if (!bundle || _typeof(bundle) !== 'object') return '';
4236
- return [(_ref63 = (_bundle$bundle_id2 = bundle.bundle_id) !== null && _bundle$bundle_id2 !== void 0 ? _bundle$bundle_id2 : bundle.id) !== null && _ref63 !== void 0 ? _ref63 : '', (_ref64 = (_bundle$bundle_group_2 = bundle.bundle_group_id) !== null && _bundle$bundle_group_2 !== void 0 ? _bundle$bundle_group_2 : bundle.group_id) !== null && _ref64 !== void 0 ? _ref64 : '', (_ref65 = (_ref66 = (_bundle$bundle_produc3 = bundle.bundle_product_id) !== null && _bundle$bundle_produc3 !== void 0 ? _bundle$bundle_produc3 : bundle._bundle_product_id) !== null && _ref66 !== void 0 ? _ref66 : bundle.product_id) !== null && _ref65 !== void 0 ? _ref65 : '', (_ref67 = (_bundle$bundle_varian3 = bundle.bundle_variant_id) !== null && _bundle$bundle_varian3 !== void 0 ? _bundle$bundle_varian3 : bundle.product_variant_id) !== null && _ref67 !== void 0 ? _ref67 : 0].join('|');
4238
+ return [(_ref62 = (_bundle$bundle_id2 = bundle.bundle_id) !== null && _bundle$bundle_id2 !== void 0 ? _bundle$bundle_id2 : bundle.id) !== null && _ref62 !== void 0 ? _ref62 : '', (_ref63 = (_bundle$bundle_group_2 = bundle.bundle_group_id) !== null && _bundle$bundle_group_2 !== void 0 ? _bundle$bundle_group_2 : bundle.group_id) !== null && _ref63 !== void 0 ? _ref63 : '', (_ref64 = (_ref65 = (_bundle$bundle_produc3 = bundle.bundle_product_id) !== null && _bundle$bundle_produc3 !== void 0 ? _bundle$bundle_produc3 : bundle._bundle_product_id) !== null && _ref65 !== void 0 ? _ref65 : bundle.product_id) !== null && _ref64 !== void 0 ? _ref64 : '', (_ref66 = (_bundle$bundle_varian3 = bundle.bundle_variant_id) !== null && _bundle$bundle_varian3 !== void 0 ? _bundle$bundle_varian3 : bundle.product_variant_id) !== null && _ref66 !== void 0 ? _ref66 : 0].join('|');
4237
4239
  }
4238
4240
  }, {
4239
4241
  key: "preservePersistedBundlePriceFields",
@@ -4384,13 +4386,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4384
4386
  delete nextProduct.metadata.main_product_original_price;
4385
4387
  delete nextProduct.metadata.price_schema_version;
4386
4388
  } else if (callerChangesLineConfiguration && !callerUpdatesTopPrice && !callerUpdatesMainMeta) {
4387
- var _ref68, _targetProduct$metada10, _targetProduct$metada11, _ref69, _targetProduct$metada12, _targetProduct$metada13, _targetProduct$metada14;
4389
+ var _ref67, _targetProduct$metada10, _targetProduct$metada11, _ref68, _targetProduct$metada12, _targetProduct$metada13, _targetProduct$metada14;
4388
4390
  // 仅 option / bundle 变化时,保留历史 source 和主商品折扣金额,
4389
4391
  // 但必须让 original 与 selling 一起随新的 option 金额移动。
4390
4392
  var previousOptionSum = sumOptionUnitPrice(getProductSkuOptions(targetProduct));
4391
4393
  var nextOptionSum = sumOptionUnitPrice(getProductSkuOptions(nextProduct));
4392
- var _previousMainOriginal = new Decimal(Number((_ref68 = (_targetProduct$metada10 = (_targetProduct$metada11 = targetProduct.metadata) === null || _targetProduct$metada11 === void 0 ? void 0 : _targetProduct$metada11.main_product_original_price) !== null && _targetProduct$metada10 !== void 0 ? _targetProduct$metada10 : targetProduct.original_price) !== null && _ref68 !== void 0 ? _ref68 : 0) || 0);
4393
- var _previousMainSelling = new Decimal(Number((_ref69 = (_targetProduct$metada12 = (_targetProduct$metada13 = targetProduct.metadata) === null || _targetProduct$metada13 === void 0 ? void 0 : _targetProduct$metada13.main_product_selling_price) !== null && _targetProduct$metada12 !== void 0 ? _targetProduct$metada12 : targetProduct.selling_price) !== null && _ref69 !== void 0 ? _ref69 : _previousMainOriginal.toNumber()) || 0);
4394
+ var _previousMainOriginal = new Decimal(Number((_ref67 = (_targetProduct$metada10 = (_targetProduct$metada11 = targetProduct.metadata) === null || _targetProduct$metada11 === void 0 ? void 0 : _targetProduct$metada11.main_product_original_price) !== null && _targetProduct$metada10 !== void 0 ? _targetProduct$metada10 : targetProduct.original_price) !== null && _ref67 !== void 0 ? _ref67 : 0) || 0);
4395
+ var _previousMainSelling = new Decimal(Number((_ref68 = (_targetProduct$metada12 = (_targetProduct$metada13 = targetProduct.metadata) === null || _targetProduct$metada13 === void 0 ? void 0 : _targetProduct$metada13.main_product_selling_price) !== null && _targetProduct$metada12 !== void 0 ? _targetProduct$metada12 : targetProduct.selling_price) !== null && _ref68 !== void 0 ? _ref68 : _previousMainOriginal.toNumber()) || 0);
4394
4396
  var _preservedDiscount = _previousMainOriginal.minus(_previousMainSelling);
4395
4397
  var previousSource = ((_targetProduct$metada14 = targetProduct.metadata) === null || _targetProduct$metada14 === void 0 ? void 0 : _targetProduct$metada14.source_product_price) != null ? new Decimal(Number(targetProduct.metadata.source_product_price) || 0) : _previousMainOriginal.minus(previousOptionSum);
4396
4398
  var _nextMainOriginal = previousSource.plus(nextOptionSum);
@@ -4893,23 +4895,23 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4893
4895
  }, {
4894
4896
  key: "buildCurrentSubmitPayloadForLocalPrint",
4895
4897
  value: function buildCurrentSubmitPayloadForLocalPrint(params) {
4896
- var _params$cacheId, _this$otherParams3, _ref70, _params$businessCode, _this$otherParams4, _this$otherParams5;
4898
+ var _params$cacheId, _this$otherParams3, _ref69, _params$businessCode, _this$otherParams4, _this$otherParams5;
4897
4899
  var tempOrder = this.ensureTempOrder();
4898
4900
  this.persistTempOrder();
4899
4901
  var payload = buildSubmitPayload({
4900
4902
  tempOrder: tempOrder,
4901
4903
  cacheId: (_params$cacheId = params === null || params === void 0 ? void 0 : params.cacheId) !== null && _params$cacheId !== void 0 ? _params$cacheId : this.cacheId,
4902
4904
  platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.platform),
4903
- businessCode: (_ref70 = (_params$businessCode = params === null || params === void 0 ? void 0 : params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.businessCode) !== null && _ref70 !== void 0 ? _ref70 : (_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.business_code,
4905
+ businessCode: (_ref69 = (_params$businessCode = params === null || params === void 0 ? void 0 : params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.businessCode) !== null && _ref69 !== void 0 ? _ref69 : (_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.business_code,
4904
4906
  channel: params === null || params === void 0 ? void 0 : params.channel,
4905
4907
  type: params === null || params === void 0 ? void 0 : params.type,
4906
4908
  summary: this.store.summary || createEmptySummary(),
4907
4909
  enhance: function enhance(nextPayload) {
4908
- var _ref71, _tempOrder$order_numb, _ref72, _tempOrder$shop_order, _ref73, _tempOrder$shop_full_;
4910
+ var _ref70, _tempOrder$order_numb, _ref71, _tempOrder$shop_order, _ref72, _tempOrder$shop_full_;
4909
4911
  return _objectSpread(_objectSpread({}, nextPayload), {}, {
4910
- order_number: (_ref71 = (_tempOrder$order_numb = tempOrder.order_number) !== null && _tempOrder$order_numb !== void 0 ? _tempOrder$order_numb : nextPayload.order_number) !== null && _ref71 !== void 0 ? _ref71 : null,
4911
- shop_order_number: (_ref72 = (_tempOrder$shop_order = tempOrder.shop_order_number) !== null && _tempOrder$shop_order !== void 0 ? _tempOrder$shop_order : nextPayload.shop_order_number) !== null && _ref72 !== void 0 ? _ref72 : null,
4912
- shop_full_order_number: (_ref73 = (_tempOrder$shop_full_ = tempOrder.shop_full_order_number) !== null && _tempOrder$shop_full_ !== void 0 ? _tempOrder$shop_full_ : nextPayload.shop_full_order_number) !== null && _ref73 !== void 0 ? _ref73 : null,
4912
+ order_number: (_ref70 = (_tempOrder$order_numb = tempOrder.order_number) !== null && _tempOrder$order_numb !== void 0 ? _tempOrder$order_numb : nextPayload.order_number) !== null && _ref70 !== void 0 ? _ref70 : null,
4913
+ shop_order_number: (_ref71 = (_tempOrder$shop_order = tempOrder.shop_order_number) !== null && _tempOrder$shop_order !== void 0 ? _tempOrder$shop_order : nextPayload.shop_order_number) !== null && _ref71 !== void 0 ? _ref71 : null,
4914
+ shop_full_order_number: (_ref72 = (_tempOrder$shop_full_ = tempOrder.shop_full_order_number) !== null && _tempOrder$shop_full_ !== void 0 ? _tempOrder$shop_full_ : nextPayload.shop_full_order_number) !== null && _ref72 !== void 0 ? _ref72 : null,
4913
4915
  small_ticket_data_flag: 1
4914
4916
  });
4915
4917
  }
@@ -5073,7 +5075,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5073
5075
  key: "runSubmitTempOrder",
5074
5076
  value: function () {
5075
5077
  var _runSubmitTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(params) {
5076
- var _params$cacheId3, _this$otherParams10, _ref74, _ref75, _submitSnapshot$busin, _this$otherParams11, _this$otherParams12, _submitSnapshot$type;
5078
+ var _params$cacheId3, _this$otherParams10, _ref73, _ref74, _submitSnapshot$busin, _this$otherParams11, _this$otherParams12, _submitSnapshot$type;
5077
5079
  var tempOrder, shouldConfirmPendingVoucherPayments, hasPaymentOverride, preparedPaymentOverride, latestSummary, effectiveCacheId, hasPaymentStatusOverride, hasSmallTicketDataFlagOverride, enhancePayload, submitSnapshot, payload, result, _payload$payments, _payload$payments2, backendErrorResponse, submittedOrderId, resultRecord;
5078
5080
  return _regeneratorRuntime().wrap(function _callee34$(_context37) {
5079
5081
  while (1) switch (_context37.prev = _context37.next) {
@@ -5135,7 +5137,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5135
5137
  tempOrder: tempOrder,
5136
5138
  cacheId: effectiveCacheId,
5137
5139
  platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.platform),
5138
- businessCode: (_ref74 = (_ref75 = (_submitSnapshot$busin = submitSnapshot.businessCode) !== null && _submitSnapshot$busin !== void 0 ? _submitSnapshot$busin : params === null || params === void 0 ? void 0 : params.businessCode) !== null && _ref75 !== void 0 ? _ref75 : (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.businessCode) !== null && _ref74 !== void 0 ? _ref74 : (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.business_code,
5140
+ businessCode: (_ref73 = (_ref74 = (_submitSnapshot$busin = submitSnapshot.businessCode) !== null && _submitSnapshot$busin !== void 0 ? _submitSnapshot$busin : params === null || params === void 0 ? void 0 : params.businessCode) !== null && _ref74 !== void 0 ? _ref74 : (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.businessCode) !== null && _ref73 !== void 0 ? _ref73 : (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.business_code,
5139
5141
  channel: params === null || params === void 0 ? void 0 : params.channel,
5140
5142
  type: (_submitSnapshot$type = submitSnapshot.type) !== null && _submitSnapshot$type !== void 0 ? _submitSnapshot$type : params === null || params === void 0 ? void 0 : params.type,
5141
5143
  summary: latestSummary,
@@ -6167,7 +6169,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6167
6169
  _step24;
6168
6170
  try {
6169
6171
  for (_iterator24.s(); !(_step24 = _iterator24.n()).done;) {
6170
- var _product$metadata11, _ref76, _ref77, _existed$origin, _rawProduct$metadata;
6172
+ var _product$metadata11, _ref75, _ref76, _existed$origin, _rawProduct$metadata;
6171
6173
  var _step24$value = _slicedToArray(_step24.value, 2),
6172
6174
  index = _step24$value[0],
6173
6175
  product = _step24$value[1];
@@ -6175,7 +6177,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6175
6177
  if (!uid) continue;
6176
6178
  var existed = productsByUid[uid] && _typeof(productsByUid[uid]) === 'object' ? productsByUid[uid] : {};
6177
6179
  var rawProduct = rawProducts[index] && _typeof(rawProducts[index]) === 'object' ? rawProducts[index] : product;
6178
- var origin = (_ref76 = (_ref77 = (_existed$origin = existed.origin) !== null && _existed$origin !== void 0 ? _existed$origin : rawProduct._origin) !== null && _ref77 !== void 0 ? _ref77 : (_rawProduct$metadata = rawProduct.metadata) === null || _rawProduct$metadata === void 0 ? void 0 : _rawProduct$metadata.origin) !== null && _ref76 !== void 0 ? _ref76 : rawProduct;
6180
+ var origin = (_ref75 = (_ref76 = (_existed$origin = existed.origin) !== null && _existed$origin !== void 0 ? _existed$origin : rawProduct._origin) !== null && _ref76 !== void 0 ? _ref76 : (_rawProduct$metadata = rawProduct.metadata) === null || _rawProduct$metadata === void 0 ? void 0 : _rawProduct$metadata.origin) !== null && _ref75 !== void 0 ? _ref75 : rawProduct;
6179
6181
  var originSnapshot = cloneDeep(origin);
6180
6182
  var productOptionString = this.buildHydratedProductOptionString(rawProduct) || this.buildHydratedProductOptionString(product);
6181
6183
  if (productOptionString && originSnapshot && _typeof(originSnapshot) === 'object') {
@@ -6304,10 +6306,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6304
6306
  }, {
6305
6307
  key: "normalizeHydratedProductOptionItem",
6306
6308
  value: function normalizeHydratedProductOptionItem(optionItem) {
6307
- var _ref78, _optionItem$num, _ref79, _optionItem$add_price;
6308
- var rawNum = (_ref78 = (_optionItem$num = optionItem === null || optionItem === void 0 ? void 0 : optionItem.num) !== null && _optionItem$num !== void 0 ? _optionItem$num : optionItem === null || optionItem === void 0 ? void 0 : optionItem.quantity) !== null && _ref78 !== void 0 ? _ref78 : 1;
6309
+ var _ref77, _optionItem$num, _ref78, _optionItem$add_price;
6310
+ var rawNum = (_ref77 = (_optionItem$num = optionItem === null || optionItem === void 0 ? void 0 : optionItem.num) !== null && _optionItem$num !== void 0 ? _optionItem$num : optionItem === null || optionItem === void 0 ? void 0 : optionItem.quantity) !== null && _ref77 !== void 0 ? _ref77 : 1;
6309
6311
  var parsedNum = Number(rawNum);
6310
- var rawPrice = (_ref79 = (_optionItem$add_price = optionItem === null || optionItem === void 0 ? void 0 : optionItem.add_price) !== null && _optionItem$add_price !== void 0 ? _optionItem$add_price : optionItem === null || optionItem === void 0 ? void 0 : optionItem.price) !== null && _ref79 !== void 0 ? _ref79 : 0;
6312
+ var rawPrice = (_ref78 = (_optionItem$add_price = optionItem === null || optionItem === void 0 ? void 0 : optionItem.add_price) !== null && _optionItem$add_price !== void 0 ? _optionItem$add_price : optionItem === null || optionItem === void 0 ? void 0 : optionItem.price) !== null && _ref78 !== void 0 ? _ref78 : 0;
6311
6313
  var parsedPrice = Number(rawPrice);
6312
6314
  var normalized = _objectSpread(_objectSpread({}, optionItem), {}, {
6313
6315
  option_group_item_id: optionItem === null || optionItem === void 0 ? void 0 : optionItem.option_group_item_id,
@@ -6448,10 +6450,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6448
6450
  _step29;
6449
6451
  try {
6450
6452
  for (_iterator29.s(); !(_step29 = _iterator29.n()).done;) {
6451
- var _ref80, _bundle$num3;
6452
6453
  var bundle = _step29.value;
6453
6454
  var isPersistedBundleProduct = isPersistedProduct || Boolean((bundle === null || bundle === void 0 ? void 0 : bundle.order_detail_id) || (bundle === null || bundle === void 0 ? void 0 : bundle.orderDetailId) || (bundle === null || bundle === void 0 ? void 0 : bundle.booking_id));
6454
- var bundleQty = new Decimal(Number(qty) || 1).times(Number((_ref80 = (_bundle$num3 = bundle === null || bundle === void 0 ? void 0 : bundle.num) !== null && _bundle$num3 !== void 0 ? _bundle$num3 : bundle === null || bundle === void 0 ? void 0 : bundle.quantity) !== null && _ref80 !== void 0 ? _ref80 : 1) || 1).toNumber();
6455
+ var bundleQty = Number(qty) || 1;
6455
6456
  var _iterator30 = _createForOfIteratorHelper((bundle === null || bundle === void 0 ? void 0 : bundle.discount_list) || []),
6456
6457
  _step30;
6457
6458
  try {