@pisell/pisellos 2.2.324 → 2.2.326

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 (32) hide show
  1. package/dist/model/strategy/adapter/walletPass/locales.js +9 -0
  2. package/dist/modules/Order/index.d.ts +1 -1
  3. package/dist/modules/Payment/utils.d.ts +2 -0
  4. package/dist/modules/Payment/utils.js +6 -6
  5. package/dist/modules/Payment/walletpass.d.ts +2 -0
  6. package/dist/modules/Payment/walletpass.js +75 -34
  7. package/dist/modules/Product/index.d.ts +1 -1
  8. package/dist/server/index.d.ts +3 -0
  9. package/dist/server/index.js +792 -645
  10. package/dist/server/modules/products/index.d.ts +6 -2
  11. package/dist/server/modules/products/index.js +476 -400
  12. package/dist/solution/BookingByStep/index.d.ts +1 -1
  13. package/dist/solution/BookingTicket/index.js +6 -5
  14. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +1 -1
  15. package/dist/solution/UnifiedBookingSales/index.js +34 -23
  16. package/lib/model/strategy/adapter/promotion/index.js +46 -1
  17. package/lib/model/strategy/adapter/walletPass/locales.js +9 -0
  18. package/lib/modules/Order/index.d.ts +1 -1
  19. package/lib/modules/Payment/utils.d.ts +2 -0
  20. package/lib/modules/Payment/utils.js +7 -7
  21. package/lib/modules/Payment/walletpass.d.ts +2 -0
  22. package/lib/modules/Payment/walletpass.js +42 -11
  23. package/lib/modules/Product/index.d.ts +1 -1
  24. package/lib/server/index.d.ts +3 -0
  25. package/lib/server/index.js +79 -7
  26. package/lib/server/modules/products/index.d.ts +6 -2
  27. package/lib/server/modules/products/index.js +40 -7
  28. package/lib/solution/BookingByStep/index.d.ts +1 -1
  29. package/lib/solution/BookingTicket/index.js +2 -1
  30. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +1 -1
  31. package/lib/solution/UnifiedBookingSales/index.js +3 -2
  32. package/package.json +1 -1
@@ -1,5 +1,6 @@
1
1
  export var locales = {
2
2
  'zh-CN': {
3
+ 'empty_cart': '请先添加商品到购物车',
3
4
  'not_meet_the_required_conditions': '未达到使用条件',
4
5
  'exceeds_the_maximum_deduction_limit': '超出最大抵扣金额限制',
5
6
  'usage_limit_reached': '已达到使用次数上限',
@@ -11,6 +12,7 @@ export var locales = {
11
12
  'applicable_product_count_not_enough': '至少 {value} 件'
12
13
  },
13
14
  'en': {
15
+ 'empty_cart': 'Add items to the cart first.',
14
16
  'not_meet_the_required_conditions': 'Not meet the required conditions.',
15
17
  'exceeds_the_maximum_deduction_limit': 'Exceeds the maximum deduction limit.',
16
18
  'usage_limit_reached': 'Usage limit reached.',
@@ -22,6 +24,7 @@ export var locales = {
22
24
  'applicable_product_count_not_enough': 'Min. Qty {value}'
23
25
  },
24
26
  'zh-HK': {
27
+ 'empty_cart': '請先添加商品到購物車',
25
28
  'not_meet_the_required_conditions': '未達使用條件',
26
29
  'exceeds_the_maximum_deduction_limit': '超出最大抵扣金額限制',
27
30
  'usage_limit_reached': '已達使用次數上限',
@@ -31,5 +34,11 @@ export var locales = {
31
34
  'order_total_amount_not_enough': '滿 {currency}{value} 可用',
32
35
  'applicable_product_total_amount_not_enough': '滿 {currency}{value} 可用',
33
36
  'applicable_product_count_not_enough': '至少 {value} 件'
37
+ },
38
+ 'ja': {
39
+ 'empty_cart': '先に商品をカートに追加してください。'
40
+ },
41
+ 'pt': {
42
+ 'empty_cart': 'Adicione produtos ao carrinho primeiro.'
34
43
  }
35
44
  };
@@ -640,7 +640,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
640
640
  generateIdempotencyToken(): string;
641
641
  syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
642
642
  createOrder(params: CommitOrderParams['query']): {
643
- type: "appointment_booking" | "virtual";
643
+ type: "virtual" | "appointment_booking";
644
644
  platform: string;
645
645
  sales_channel: string;
646
646
  order_sales_channel: string;
@@ -10,6 +10,8 @@ export declare const formatWalletPassList2PreparePayments: (list?: any[]) => {
10
10
  wallet_pass_usage_unit: any;
11
11
  wallet_pass_use_value: any;
12
12
  }[];
13
+ /** 这两种不可用原因随订单内容变化,其他服务端错误需保留。 */
14
+ export declare const isWalletOrderAvailabilityError: (code: unknown) => boolean;
13
15
  /**
14
16
  * 对用户识别码列表进行排序
15
17
  * 排序规则:正常数据 -> unified_available_status===1 -> 500601/500602 -> unified_available_status===0
@@ -26,6 +26,11 @@ export var formatWalletPassList2PreparePayments = function formatWalletPassList2
26
26
  return formatted;
27
27
  };
28
28
 
29
+ /** 这两种不可用原因随订单内容变化,其他服务端错误需保留。 */
30
+ export var isWalletOrderAvailabilityError = function isWalletOrderAvailabilityError(code) {
31
+ return String(code) === '500601' || String(code) === '500602';
32
+ };
33
+
29
34
  /**
30
35
  * 对用户识别码列表进行排序
31
36
  * 排序规则:正常数据 -> unified_available_status===1 -> 500601/500602 -> unified_available_status===0
@@ -36,9 +41,6 @@ export var sortUserIdentificationCodeList = function sortUserIdentificationCodeL
36
41
  if (!Array.isArray(list) || list.length === 0) {
37
42
  return list;
38
43
  }
39
-
40
- // 定义中等优先级错误码
41
- var middlePriorityErrorCodes = ['500601', '500602'];
42
44
  return list.sort(function (a, b) {
43
45
  // 确定每个项目的优先级
44
46
  // 0: 正常数据(没有特定错误码且available_status不是1或0)
@@ -46,12 +48,10 @@ export var sortUserIdentificationCodeList = function sortUserIdentificationCodeL
46
48
  // 2: 中等优先级错误码(500601、500602) 此订单内不可用 订单没有剩余金额
47
49
  // 3: unified_available_status === 0(最后)
48
50
  var getPriority = function getPriority(item) {
49
- var _item$unified_error_c;
50
- var errorCode = (_item$unified_error_c = item.unified_error_code) === null || _item$unified_error_c === void 0 ? void 0 : _item$unified_error_c.toString();
51
51
  var availableStatus = item.unified_available_status;
52
52
 
53
53
  // 中等优先级错误码
54
- if (errorCode && middlePriorityErrorCodes.includes(errorCode)) return 2;
54
+ if (isWalletOrderAvailabilityError(item.unified_error_code)) return 2;
55
55
 
56
56
  // unified_available_status === 0 最后
57
57
  if (availableStatus === 0) return 3;
@@ -23,6 +23,8 @@ export declare class WalletPassPaymentImpl implements WalletPassPayment {
23
23
  */
24
24
  private emitEvent;
25
25
  private publishWalletAssetsState;
26
+ private get hasEmptyWalletCart();
27
+ private walletAssetForEmptyCart;
26
28
  private recalculateWalletAssets;
27
29
  /**
28
30
  * 搜索接口只返回后端 Wallet Pass 数据,不包含前端策略 config。
@@ -21,8 +21,12 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
21
21
  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); }
22
22
  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); }
23
23
  import { WalletPassHooks } from "./types";
24
- import { formatWalletPassList2PreparePayments as formatWalletPassList2PreparePaymentsUtils, sortUserIdentificationCodeList } from "./utils";
24
+ import { locales as walletPassLocales } from "../../model/strategy/adapter/walletPass/locales";
25
+ import { formatWalletPassList2PreparePayments as formatWalletPassList2PreparePaymentsUtils, isWalletOrderAvailabilityError, sortUserIdentificationCodeList } from "./utils";
25
26
  var WALLET_PAYMENT_ASSET_TAGS = new Set(['product_voucher', 'gift_card', 'point_card']);
27
+
28
+ // 旧版搜索响应可能只有订单不适用的提示文本,没有 unified_error_code。
29
+ var LEGACY_CART_MESSAGES = new Set(['Voucher not applicable to current cart', 'No eligible items in the cart', walletPassLocales.en.exceeds_the_maximum_deduction_limit]);
26
30
  function isWalletPaymentAsset(asset) {
27
31
  return WALLET_PAYMENT_ASSET_TAGS.has(String((asset === null || asset === void 0 ? void 0 : asset.tag) || '').toLowerCase());
28
32
  }
@@ -207,10 +211,41 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
207
211
  });
208
212
  return state;
209
213
  }
214
+ }, {
215
+ key: "hasEmptyWalletCart",
216
+ get: function get() {
217
+ return this.walletParams !== null && this.walletAssetsCalculationContext.products.length === 0;
218
+ }
219
+ }, {
220
+ key: "walletAssetForEmptyCart",
221
+ value: function walletAssetForEmptyCart(asset) {
222
+ var _asset$unified_messag, _this$paymentModule$w, _this$paymentModule$w2, _evaluator$getText;
223
+ var unavailableAsset = _objectSpread(_objectSpread({}, asset), {}, {
224
+ actualDeduction: 0,
225
+ deductionDetails: [],
226
+ _available_max_amount: 0,
227
+ _unified_available_status: 0,
228
+ _wallet_asset_recommended: false
229
+ });
230
+ var errorCode = asset.unified_error_code;
231
+ var reportedReason = ((_asset$unified_messag = asset.unified_messages) === null || _asset$unified_messag === void 0 ? void 0 : _asset$unified_messag.title) || asset.error_msg || asset.disabledReason;
232
+ var reportedUnavailable = Number(asset.unified_available_status) === 0 || asset.available === false || asset.isDisabled === true;
233
+ var hasAssetRestriction = errorCode ? !isWalletOrderAvailabilityError(errorCode) : reportedUnavailable && reportedReason && !LEGACY_CART_MESSAGES.has(reportedReason);
234
+ if (hasAssetRestriction) {
235
+ return unavailableAsset;
236
+ }
237
+ var evaluator = (_this$paymentModule$w = this.paymentModule.window) === null || _this$paymentModule$w === void 0 || (_this$paymentModule$w2 = _this$paymentModule$w.getWalletPassEvaluator) === null || _this$paymentModule$w2 === void 0 ? void 0 : _this$paymentModule$w2.call(_this$paymentModule$w);
238
+ return _objectSpread(_objectSpread({}, unavailableAsset), {}, {
239
+ reasonCode: 'empty_cart',
240
+ reason: (evaluator === null || evaluator === void 0 || (_evaluator$getText = evaluator.getText) === null || _evaluator$getText === void 0 ? void 0 : _evaluator$getText.call(evaluator, 'empty_cart')) || walletPassLocales.en.empty_cart
241
+ });
242
+ }
210
243
  }, {
211
244
  key: "recalculateWalletAssets",
212
245
  value: function recalculateWalletAssets(items, requestedIds, selectionSources) {
213
- var _this$paymentModule$w, _this$paymentModule$w2;
246
+ var _this$paymentModule$w3,
247
+ _this$paymentModule$w4,
248
+ _this = this;
214
249
  var committedKeys = new Set(this.walletAssetsState.committedIds.map(function (id) {
215
250
  return String(id);
216
251
  }));
@@ -228,8 +263,13 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
228
263
  });
229
264
  var nextItems = items;
230
265
  var selectedItems = requested;
231
- var evaluator = (_this$paymentModule$w = this.paymentModule.window) === null || _this$paymentModule$w === void 0 || (_this$paymentModule$w2 = _this$paymentModule$w.getWalletPassEvaluator) === null || _this$paymentModule$w2 === void 0 ? void 0 : _this$paymentModule$w2.call(_this$paymentModule$w);
232
- if (evaluator !== null && evaluator !== void 0 && evaluator.recalculateVouchers) {
266
+ var evaluator = (_this$paymentModule$w3 = this.paymentModule.window) === null || _this$paymentModule$w3 === void 0 || (_this$paymentModule$w4 = _this$paymentModule$w3.getWalletPassEvaluator) === null || _this$paymentModule$w4 === void 0 ? void 0 : _this$paymentModule$w4.call(_this$paymentModule$w3);
267
+ if (this.hasEmptyWalletCart) {
268
+ nextItems = items.map(function (asset) {
269
+ return committedKeys.has(getWalletAssetKey(asset)) ? asset : _this.walletAssetForEmptyCart(asset);
270
+ });
271
+ selectedItems = [];
272
+ } else if (evaluator !== null && evaluator !== void 0 && evaluator.recalculateVouchers) {
233
273
  try {
234
274
  var result = evaluator.recalculateVouchers(items, requested, this.walletAssetsCalculationContext.orderTotalAmount, this.walletAssetsCalculationContext.products);
235
275
  nextItems = mergeWalletAssets(items, (result === null || result === void 0 ? void 0 : result.allWithUpdatedStatus) || []);
@@ -278,10 +318,10 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
278
318
  }, {
279
319
  key: "formatSearchedWalletPaymentAssets",
280
320
  value: function formatSearchedWalletPaymentAssets(assets) {
281
- var _this$paymentModule$w3, _this$paymentModule$w4, _this$walletParams, _this$walletParams2;
321
+ var _this$paymentModule$w5, _this$paymentModule$w6, _this$walletParams, _this$walletParams2;
282
322
  if (!assets.length) return assets;
283
323
  var assetsWithRecalculationBase = assets.map(withWalletAssetRecalculationBaseAmount);
284
- var evaluator = (_this$paymentModule$w3 = this.paymentModule.window) === null || _this$paymentModule$w3 === void 0 || (_this$paymentModule$w4 = _this$paymentModule$w3.getWalletPassEvaluator) === null || _this$paymentModule$w4 === void 0 ? void 0 : _this$paymentModule$w4.call(_this$paymentModule$w3);
324
+ var evaluator = (_this$paymentModule$w5 = this.paymentModule.window) === null || _this$paymentModule$w5 === void 0 || (_this$paymentModule$w6 = _this$paymentModule$w5.getWalletPassEvaluator) === null || _this$paymentModule$w6 === void 0 ? void 0 : _this$paymentModule$w6.call(_this$paymentModule$w5);
285
325
  if (!(evaluator !== null && evaluator !== void 0 && evaluator.searchVoucherFormat)) return assetsWithRecalculationBase;
286
326
  var hasCalculationProducts = this.walletAssetsCalculationContext.products.length > 0;
287
327
  var products = hasCalculationProducts ? this.walletAssetsCalculationContext.products : ((_this$walletParams = this.walletParams) === null || _this$walletParams === void 0 ? void 0 : _this$walletParams.products) || [];
@@ -356,27 +396,27 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
356
396
  }, {
357
397
  key: "isPendingAutoSelectAsset",
358
398
  value: function isPendingAutoSelectAsset(asset) {
359
- var _this = this;
399
+ var _this2 = this;
360
400
  return getWalletAssetCodeKeys(asset).some(function (code) {
361
- return _this.pendingAutoSelectSearchCodes.has(code);
401
+ return _this2.pendingAutoSelectSearchCodes.has(code);
362
402
  });
363
403
  }
364
404
  }, {
365
405
  key: "clearPendingAutoSelectForAsset",
366
406
  value: function clearPendingAutoSelectForAsset(asset) {
367
- var _this2 = this;
407
+ var _this3 = this;
368
408
  getWalletAssetCodeKeys(asset).forEach(function (code) {
369
- _this2.pendingAutoSelectSearchCodes.delete(code);
409
+ _this3.pendingAutoSelectSearchCodes.delete(code);
370
410
  });
371
411
  }
372
412
  }, {
373
413
  key: "queuePendingAutoSelectForAssets",
374
414
  value: function queuePendingAutoSelectForAssets(assets) {
375
- var _this3 = this;
415
+ var _this4 = this;
376
416
  if (!this.walletAssetsBehavior.autoSelectAfterSearch) return;
377
417
  assets.forEach(function (asset) {
378
418
  getWalletAssetCodeKeys(asset).forEach(function (code) {
379
- _this3.pendingAutoSelectSearchCodes.add(code);
419
+ _this4.pendingAutoSelectSearchCodes.add(code);
380
420
  });
381
421
  });
382
422
  }
@@ -601,7 +641,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
601
641
  key: "initializeWalletDataAsync",
602
642
  value: (function () {
603
643
  var _initializeWalletDataAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(baseParams) {
604
- var _this$paymentModule$w5, _this$paymentModule$w6, identificationParams, _yield$Promise$all, _yield$Promise$all2, allList, orderBasicDetail, walletPassEvaluator, products, res, recommended, transformList, noApplicableVoucher, recommendedAmount;
644
+ var _this$paymentModule$w7, _this$paymentModule$w8, identificationParams, _yield$Promise$all, _yield$Promise$all2, allList, orderBasicDetail, walletPassEvaluator, products, res, recommended, transformList, noApplicableVoucher, recommendedAmount;
605
645
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
606
646
  while (1) switch (_context3.prev = _context3.next) {
607
647
  case 0:
@@ -620,7 +660,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
620
660
  _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
621
661
  allList = _yield$Promise$all2[0];
622
662
  orderBasicDetail = _yield$Promise$all2[1];
623
- walletPassEvaluator = (_this$paymentModule$w5 = this.paymentModule.window) === null || _this$paymentModule$w5 === void 0 || (_this$paymentModule$w6 = _this$paymentModule$w5.getWalletPassEvaluator) === null || _this$paymentModule$w6 === void 0 ? void 0 : _this$paymentModule$w6.call(_this$paymentModule$w5);
663
+ walletPassEvaluator = (_this$paymentModule$w7 = this.paymentModule.window) === null || _this$paymentModule$w7 === void 0 || (_this$paymentModule$w8 = _this$paymentModule$w7.getWalletPassEvaluator) === null || _this$paymentModule$w8 === void 0 ? void 0 : _this$paymentModule$w8.call(_this$paymentModule$w7);
624
664
  if (walletPassEvaluator) {
625
665
  _context3.next = 11;
626
666
  break;
@@ -687,7 +727,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
687
727
  key: "aggregateRecalculateWalletAssetsAsync",
688
728
  value: (function () {
689
729
  var _aggregateRecalculateWalletAssetsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(businessData, selectedIds) {
690
- var _this$paymentModule$w7, _this$paymentModule$w8;
730
+ var _this$paymentModule$w9, _this$paymentModule$w10;
691
731
  var walletParams, customerId, requestParams, response, responseData, hasAggregateLists, recalculateList, customerWalletPassList, orderedRecalculateList, allList, walletPassEvaluator, evaluated, returnedSelectedKeys, authoritativeSelectedIds;
692
732
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
693
733
  while (1) switch (_context4.prev = _context4.next) {
@@ -726,7 +766,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
726
766
  customerWalletPassList = Array.isArray(responseData === null || responseData === void 0 ? void 0 : responseData.customer_wallet_pass_list) ? responseData.customer_wallet_pass_list : [];
727
767
  orderedRecalculateList = orderWalletAssetsByIds(recalculateList, selectedIds);
728
768
  allList = mergeWalletAssets(orderedRecalculateList, customerWalletPassList);
729
- walletPassEvaluator = (_this$paymentModule$w7 = this.paymentModule.window) === null || _this$paymentModule$w7 === void 0 || (_this$paymentModule$w8 = _this$paymentModule$w7.getWalletPassEvaluator) === null || _this$paymentModule$w8 === void 0 ? void 0 : _this$paymentModule$w8.call(_this$paymentModule$w7);
769
+ walletPassEvaluator = (_this$paymentModule$w9 = this.paymentModule.window) === null || _this$paymentModule$w9 === void 0 || (_this$paymentModule$w10 = _this$paymentModule$w9.getWalletPassEvaluator) === null || _this$paymentModule$w10 === void 0 ? void 0 : _this$paymentModule$w10.call(_this$paymentModule$w9);
730
770
  evaluated = walletPassEvaluator !== null && walletPassEvaluator !== void 0 && walletPassEvaluator.getRecommendedVouchers ? walletPassEvaluator.getRecommendedVouchers({
731
771
  orderTotalAmount: walletParams.order_wait_pay_amount,
732
772
  products: walletParams.products,
@@ -1119,7 +1159,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
1119
1159
  value: (function () {
1120
1160
  var _refreshWalletAssetsFromBusinessAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(businessData) {
1121
1161
  var _businessData$product2,
1122
- _this4 = this;
1162
+ _this5 = this;
1123
1163
  var options,
1124
1164
  requestSequence,
1125
1165
  nextCustomerId,
@@ -1207,13 +1247,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
1207
1247
  this.queuePendingAutoSelectForAssets(scanSelectedAssets);
1208
1248
  this.generateWalletParams(businessData);
1209
1249
  restoredSearchedAssets = this.searchResults.filter(isWalletPaymentAsset).map(function (item) {
1210
- return _objectSpread(_objectSpread({}, item), {}, {
1211
- actualDeduction: 0,
1212
- deductionDetails: [],
1213
- _available_max_amount: 0,
1214
- _unified_available_status: 0,
1215
- _wallet_asset_recommended: false
1216
- });
1250
+ return _this5.walletAssetForEmptyCart(item);
1217
1251
  });
1218
1252
  this.walletRecommendList = [];
1219
1253
  this.userIdentificationCodes = [];
@@ -1325,7 +1359,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
1325
1359
  latestSelectedIds = preserveSelection ? authoritativeSelectedIds : [];
1326
1360
  latestSelectionSources = preserveSelection ? _objectSpread({}, this.walletAssetsState.selectionSources) : {};
1327
1361
  pendingAutoSelectAssets = this.walletAssetsBehavior.autoSelectAfterSearch ? items.filter(function (asset) {
1328
- return _this4.isPendingAutoSelectAsset(asset) && isWalletAssetAvailable(asset);
1362
+ return _this5.isPendingAutoSelectAsset(asset) && isWalletAssetAvailable(asset);
1329
1363
  }) : [];
1330
1364
  requestedKeySet = new Set(latestSelectedIds.map(function (id) {
1331
1365
  return String(id);
@@ -1347,7 +1381,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
1347
1381
  pendingAutoSelectAssets.forEach(function (asset) {
1348
1382
  var assetId = getWalletAssetId(asset);
1349
1383
  if (assetId !== undefined && assetId !== null && selectedKeySet.has(String(assetId))) {
1350
- _this4.clearPendingAutoSelectForAsset(asset);
1384
+ _this5.clearPendingAutoSelectForAsset(asset);
1351
1385
  }
1352
1386
  });
1353
1387
  droppedScanSelectedAssets = scanSelectedAssets.filter(function (asset) {
@@ -1525,7 +1559,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
1525
1559
  key: "scanWalletAssetAsync",
1526
1560
  value: function () {
1527
1561
  var _scanWalletAssetAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(code) {
1528
- var normalizedCode, selectedAsset, result, paymentAssets, matchedAsset, assetsToApply, asset, _items, assetIds, selectionSources, _selected, items, recalculatedState, assetId, recalculatedAsset, selected, isSelected, selectedStateAsset, resolvedAsset;
1562
+ var normalizedCode, selectedAsset, result, paymentAssets, matchedAsset, assetsToApply, asset, _items, assetIds, selectionSources, _selected, anySelected, firstAssetKey, items, recalculatedState, assetId, recalculatedAsset, selected, isSelected, selectedStateAsset, resolvedAsset;
1529
1563
  return _regeneratorRuntime().wrap(function _callee9$(_context9) {
1530
1564
  while (1) switch (_context9.prev = _context9.next) {
1531
1565
  case 0:
@@ -1595,7 +1629,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
1595
1629
  });
1596
1630
  case 19:
1597
1631
  if (!(!matchedAsset && assetsToApply.length > 1)) {
1598
- _context9.next = 26;
1632
+ _context9.next = 29;
1599
1633
  break;
1600
1634
  }
1601
1635
  _items = mergeWalletAssets(this.walletAssetsState.items, assetsToApply);
@@ -1609,15 +1643,22 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
1609
1643
  selectionSources[String(id)] = 'scan';
1610
1644
  });
1611
1645
  _selected = this.walletAssetsBehavior.autoSelectAfterSearch ? this.recalculateWalletAssets(_items, Array.from(new Set([].concat(_toConsumableArray(this.walletAssetsState.selectedIds), _toConsumableArray(assetIds)))), selectionSources) : this.recalculateWalletAssets(_items, this.walletAssetsState.selectedIds, this.walletAssetsState.selectionSources);
1646
+ anySelected = assetIds.some(function (id) {
1647
+ return _selected.selectedIds.includes(id);
1648
+ });
1649
+ if (this.hasEmptyWalletCart) {
1650
+ this.queuePendingAutoSelectForAssets(assetsToApply);
1651
+ }
1652
+ firstAssetKey = getWalletAssetKey(asset);
1612
1653
  return _context9.abrupt("return", {
1613
1654
  type: result.type,
1614
- asset: asset,
1615
- selected: assetIds.some(function (id) {
1616
- return _selected.selectedIds.includes(id);
1617
- }),
1655
+ asset: _selected.items.find(function (item) {
1656
+ return getWalletAssetKey(item) === firstAssetKey;
1657
+ }) || asset,
1658
+ selected: anySelected,
1618
1659
  state: _selected
1619
1660
  });
1620
- case 26:
1661
+ case 29:
1621
1662
  items = mergeWalletAssets(this.walletAssetsState.items, [asset]);
1622
1663
  recalculatedState = this.recalculateWalletAssets(items, this.walletAssetsState.selectedIds, this.walletAssetsState.selectionSources);
1623
1664
  assetId = getWalletAssetId(asset);
@@ -1647,7 +1688,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
1647
1688
  selected: isSelected,
1648
1689
  state: selected
1649
1690
  });
1650
- case 36:
1691
+ case 39:
1651
1692
  case "end":
1652
1693
  return _context9.stop();
1653
1694
  }
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
49
49
  getCategories(): ProductCategory[];
50
50
  setOtherParams(key: string, value: any): void;
51
51
  getOtherParams(): any;
52
- getProductType(): "duration" | "session" | "normal";
52
+ getProductType(): "normal" | "duration" | "session";
53
53
  }
@@ -65,6 +65,7 @@ declare class Server {
65
65
  private deviceTaskActionsRegistered;
66
66
  private localPaymentUpdateQueues;
67
67
  private paymentIdentityRefreshes;
68
+ private receiptFulfillmentConfigInFlight;
68
69
  private floorPlanQuerySubscribers;
69
70
  private moduleRegistry;
70
71
  constructor(core: PisellCore);
@@ -525,6 +526,8 @@ declare class Server {
525
526
  private extractInvoiceTemplateSettings;
526
527
  private applyCheckoutFulfillmentBuzzer;
527
528
  private buildCheckoutResourceIdentifierBuzzer;
529
+ /** Refresh derived references on receipt copies; manual references and stored orders stay intact. */
530
+ private withCurrentReceiptResourceReference;
528
531
  private getCheckoutResourceIdentifier;
529
532
  private stringifyCheckoutResourceIdentifier;
530
533
  private normalizeCheckoutSubmitData;