@pisell/pisellos 0.10.68 → 0.10.70
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.
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +5 -4
- package/dist/modules/Holder/utils.d.ts +2 -0
- package/dist/modules/Holder/utils.js +32 -2
- package/dist/modules/Rules/index.js +59 -58
- package/dist/server/modules/products/index.js +3 -2
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +3 -2
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +177 -112
- package/dist/solution/BookingTicket/types.d.ts +14 -4
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +94 -58
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +10 -0
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +117 -0
- package/lib/model/strategy/adapter/promotion/index.js +46 -1
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -1
- package/lib/modules/Holder/utils.d.ts +2 -0
- package/lib/modules/Holder/utils.js +27 -1
- package/lib/modules/Rules/index.js +2 -1
- package/lib/server/modules/products/index.js +2 -1
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +9 -8
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +22 -2
- package/lib/solution/BookingTicket/types.d.ts +14 -4
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +14 -2
- package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +10 -0
- package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +71 -0
- package/package.json +1 -1
|
@@ -42,6 +42,7 @@ import { handleGlobalScan, handleCustomerScan, handleUniversalScan } from "./uti
|
|
|
42
42
|
import scanCache from "./utils/scan/scanCache";
|
|
43
43
|
import { formatGlobalScanResult } from "./utils/scan/formatGlobalScan";
|
|
44
44
|
import { applyGlobalScan } from "./utils/scan/applyGlobalScan";
|
|
45
|
+
import { applyProductVoucherCollectionScan } from "./utils/scan/applyProductVoucherCollectionScan";
|
|
45
46
|
import { buildCartView, isWalkInCustomer } from "./utils/cartView";
|
|
46
47
|
import { buildCacheItemFromCartDetail, buildCacheItemFromDetail, buildRequiresDetailPayload as _buildRequiresDetailPayload, decideAddProduct as decideAddProductUtil, decideAfterDetail as decideAfterDetailUtil, decideAutoClose as decideAutoCloseUtil, getIsEject as getIsEjectUtil, getIsOnlySession as getIsOnlySessionUtil, transformDetailToProductAndBooking as transformDetailToProductAndBookingUtil } from "./utils/addProductDecision";
|
|
47
48
|
import { buildCacheItemFromOrderLine as buildCacheItemFromOrderLineUtil } from "../../modules/BookingContext/utils/buildCacheItemFromOrderLine";
|
|
@@ -2937,24 +2938,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2937
2938
|
}, {
|
|
2938
2939
|
key: "handleGlobalScanCode",
|
|
2939
2940
|
value: (function () {
|
|
2940
|
-
var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2941
|
+
var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(code, bridge) {
|
|
2941
2942
|
var _this8 = this;
|
|
2942
|
-
var trimmed, _bridge$onNotify, _bridge$refresh, beforeScanCommit, beforeScanDialog, guardCallback, guardedBridge, _promotion$isAccepted, promotion, localSearch, scanCallback, raw, formatted, _bridge$onNotify2, _result8, _bridge$onNotify3;
|
|
2943
|
-
return _regeneratorRuntime().wrap(function
|
|
2944
|
-
while (1) switch (
|
|
2943
|
+
var trimmed, _bridge$onNotify, _bridge$refresh, beforeScanCommit, beforeScanDialog, guardCallback, guardedBridge, _promotion$isAccepted, promotion, localSearch, scanCallback, raw, formatted, _bridge$onNotify2, host, _result8, _bridge$onNotify3, _bridge$isCurrent;
|
|
2944
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
2945
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
2945
2946
|
case 0:
|
|
2946
2947
|
trimmed = typeof code === 'string' ? code.trim() : '';
|
|
2947
2948
|
if (trimmed) {
|
|
2948
|
-
|
|
2949
|
+
_context39.next = 4;
|
|
2949
2950
|
break;
|
|
2950
2951
|
}
|
|
2951
2952
|
bridge === null || bridge === void 0 || (_bridge$onNotify = bridge.onNotify) === null || _bridge$onNotify === void 0 || _bridge$onNotify.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
2952
|
-
return
|
|
2953
|
+
return _context39.abrupt("return", {
|
|
2953
2954
|
status: 'failed',
|
|
2954
2955
|
reason: 'empty_code'
|
|
2955
2956
|
});
|
|
2956
2957
|
case 4:
|
|
2957
|
-
|
|
2958
|
+
_context39.prev = 4;
|
|
2958
2959
|
// Capture before lookup/UI awaits, so a result cannot land in a new cart.
|
|
2959
2960
|
// Unscoped POS Order modules return a no-op guard.
|
|
2960
2961
|
beforeScanCommit = this.store.order.createCartIntentCommitGuard('add_product');
|
|
@@ -2981,23 +2982,23 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2981
2982
|
} : undefined
|
|
2982
2983
|
}) : undefined;
|
|
2983
2984
|
if (!((guardedBridge === null || guardedBridge === void 0 ? void 0 : guardedBridge.scanScope) === 'product-voucher')) {
|
|
2984
|
-
|
|
2985
|
+
_context39.next = 16;
|
|
2985
2986
|
break;
|
|
2986
2987
|
}
|
|
2987
2988
|
if (guardedBridge.applyPromotionCode) {
|
|
2988
|
-
|
|
2989
|
+
_context39.next = 12;
|
|
2989
2990
|
break;
|
|
2990
2991
|
}
|
|
2991
|
-
return
|
|
2992
|
+
return _context39.abrupt("return", {
|
|
2992
2993
|
status: 'failed',
|
|
2993
2994
|
reason: 'no_bridge'
|
|
2994
2995
|
});
|
|
2995
2996
|
case 12:
|
|
2996
|
-
|
|
2997
|
+
_context39.next = 14;
|
|
2997
2998
|
return guardedBridge.applyPromotionCode(trimmed);
|
|
2998
2999
|
case 14:
|
|
2999
|
-
promotion =
|
|
3000
|
-
return
|
|
3000
|
+
promotion = _context39.sent;
|
|
3001
|
+
return _context39.abrupt("return", ((_promotion$isAccepted = promotion.isAccepted) !== null && _promotion$isAccepted !== void 0 ? _promotion$isAccepted : promotion.isAvailable) ? {
|
|
3001
3002
|
status: 'success',
|
|
3002
3003
|
kind: 'promotion'
|
|
3003
3004
|
} : {
|
|
@@ -3009,26 +3010,25 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3009
3010
|
return _this8.store.products.findProductsByCodeOrBarcode(v);
|
|
3010
3011
|
};
|
|
3011
3012
|
scanCallback = handleGlobalScan(this.request, localSearch, this.getSubmitOrderSalesChannel());
|
|
3012
|
-
|
|
3013
|
+
_context39.next = 20;
|
|
3013
3014
|
return scanCallback({
|
|
3014
3015
|
type: 'nativeScanner',
|
|
3015
3016
|
value: trimmed
|
|
3016
3017
|
});
|
|
3017
3018
|
case 20:
|
|
3018
|
-
raw =
|
|
3019
|
+
raw = _context39.sent;
|
|
3019
3020
|
formatted = formatGlobalScanResult(raw, trimmed);
|
|
3020
3021
|
if (formatted) {
|
|
3021
|
-
|
|
3022
|
+
_context39.next = 25;
|
|
3022
3023
|
break;
|
|
3023
3024
|
}
|
|
3024
3025
|
bridge === null || bridge === void 0 || (_bridge$onNotify2 = bridge.onNotify) === null || _bridge$onNotify2 === void 0 || _bridge$onNotify2.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
3025
|
-
return
|
|
3026
|
+
return _context39.abrupt("return", {
|
|
3026
3027
|
status: 'failed',
|
|
3027
3028
|
reason: 'not_found'
|
|
3028
3029
|
});
|
|
3029
3030
|
case 25:
|
|
3030
|
-
|
|
3031
|
-
return applyGlobalScan({
|
|
3031
|
+
host = {
|
|
3032
3032
|
setOrderCustomer: function setOrderCustomer(customer) {
|
|
3033
3033
|
beforeScanCommit();
|
|
3034
3034
|
_this8.setOrderCustomer(customer);
|
|
@@ -3066,25 +3066,90 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3066
3066
|
beforeScanCommit();
|
|
3067
3067
|
return _this8.scanWalletAsset(scanCode);
|
|
3068
3068
|
}
|
|
3069
|
-
}
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3069
|
+
};
|
|
3070
|
+
if (!((guardedBridge === null || guardedBridge === void 0 ? void 0 : guardedBridge.scanScope) === 'product-voucher-collection')) {
|
|
3071
|
+
_context39.next = 32;
|
|
3072
|
+
break;
|
|
3073
|
+
}
|
|
3074
|
+
_context39.next = 29;
|
|
3075
|
+
return applyProductVoucherCollectionScan(_objectSpread(_objectSpread({}, host), {}, {
|
|
3076
|
+
waitForCustomerDiscounts: function waitForCustomerDiscounts() {
|
|
3077
|
+
return _this8.orderCustomerDiscountRefreshInFlight || Promise.resolve();
|
|
3078
|
+
},
|
|
3079
|
+
loadCustomerDiscounts: function () {
|
|
3080
|
+
var _loadCustomerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
|
|
3081
|
+
var _this8$getOrderCustom;
|
|
3082
|
+
var customerId;
|
|
3083
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
3084
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
3085
|
+
case 0:
|
|
3086
|
+
customerId = Number(((_this8$getOrderCustom = _this8.getOrderCustomer()) === null || _this8$getOrderCustom === void 0 ? void 0 : _this8$getOrderCustom.customer_id) || 0);
|
|
3087
|
+
if (!(customerId <= 1)) {
|
|
3088
|
+
_context38.next = 3;
|
|
3089
|
+
break;
|
|
3090
|
+
}
|
|
3091
|
+
return _context38.abrupt("return", []);
|
|
3092
|
+
case 3:
|
|
3093
|
+
_context38.next = 5;
|
|
3094
|
+
return _this8.refreshDiscountConfigAfterOrderCustomerChange(customerId);
|
|
3095
|
+
case 5:
|
|
3096
|
+
return _context38.abrupt("return", _this8.getDiscountList());
|
|
3097
|
+
case 6:
|
|
3098
|
+
case "end":
|
|
3099
|
+
return _context38.stop();
|
|
3100
|
+
}
|
|
3101
|
+
}, _callee38);
|
|
3102
|
+
}));
|
|
3103
|
+
function loadCustomerDiscounts() {
|
|
3104
|
+
return _loadCustomerDiscounts.apply(this, arguments);
|
|
3105
|
+
}
|
|
3106
|
+
return loadCustomerDiscounts;
|
|
3107
|
+
}()
|
|
3108
|
+
}), formatted, guardedBridge);
|
|
3109
|
+
case 29:
|
|
3110
|
+
_context39.t0 = _context39.sent;
|
|
3111
|
+
_context39.next = 35;
|
|
3112
|
+
break;
|
|
3074
3113
|
case 32:
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3114
|
+
_context39.next = 34;
|
|
3115
|
+
return applyGlobalScan(host, formatted, guardedBridge);
|
|
3116
|
+
case 34:
|
|
3117
|
+
_context39.t0 = _context39.sent;
|
|
3118
|
+
case 35:
|
|
3119
|
+
_result8 = _context39.t0;
|
|
3120
|
+
bridge === null || bridge === void 0 || (_bridge$refresh = bridge.refresh) === null || _bridge$refresh === void 0 || _bridge$refresh.call(bridge);
|
|
3121
|
+
return _context39.abrupt("return", _result8);
|
|
3122
|
+
case 40:
|
|
3123
|
+
_context39.prev = 40;
|
|
3124
|
+
_context39.t1 = _context39["catch"](4);
|
|
3125
|
+
if (!((bridge === null || bridge === void 0 ? void 0 : bridge.scanScope) === 'product-voucher-collection')) {
|
|
3126
|
+
_context39.next = 46;
|
|
3127
|
+
break;
|
|
3128
|
+
}
|
|
3129
|
+
if (!(((_bridge$isCurrent = bridge.isCurrent) === null || _bridge$isCurrent === void 0 ? void 0 : _bridge$isCurrent.call(bridge)) === false)) {
|
|
3130
|
+
_context39.next = 45;
|
|
3131
|
+
break;
|
|
3132
|
+
}
|
|
3133
|
+
return _context39.abrupt("return", {
|
|
3134
|
+
status: 'cancelled'
|
|
3135
|
+
});
|
|
3136
|
+
case 45:
|
|
3137
|
+
return _context39.abrupt("return", {
|
|
3138
|
+
status: 'failed',
|
|
3139
|
+
reason: 'entry_resolution_failed'
|
|
3140
|
+
});
|
|
3141
|
+
case 46:
|
|
3142
|
+
console.error('[BookingTicket] handleGlobalScanCode failed', _context39.t1);
|
|
3078
3143
|
bridge === null || bridge === void 0 || (_bridge$onNotify3 = bridge.onNotify) === null || _bridge$onNotify3 === void 0 || _bridge$onNotify3.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
3079
|
-
return
|
|
3144
|
+
return _context39.abrupt("return", {
|
|
3080
3145
|
status: 'failed',
|
|
3081
3146
|
reason: 'not_found'
|
|
3082
3147
|
});
|
|
3083
|
-
case
|
|
3148
|
+
case 49:
|
|
3084
3149
|
case "end":
|
|
3085
|
-
return
|
|
3150
|
+
return _context39.stop();
|
|
3086
3151
|
}
|
|
3087
|
-
},
|
|
3152
|
+
}, _callee39, this, [[4, 40]]);
|
|
3088
3153
|
}));
|
|
3089
3154
|
function handleGlobalScanCode(_x23, _x24) {
|
|
3090
3155
|
return _handleGlobalScanCode.apply(this, arguments);
|
|
@@ -3094,37 +3159,37 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3094
3159
|
}, {
|
|
3095
3160
|
key: "getGlobalScanCodeType",
|
|
3096
3161
|
value: (function () {
|
|
3097
|
-
var _getGlobalScanCodeType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3162
|
+
var _getGlobalScanCodeType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(code) {
|
|
3098
3163
|
var _this9 = this,
|
|
3099
3164
|
_formatGlobalScanResu,
|
|
3100
3165
|
_formatGlobalScanResu2;
|
|
3101
3166
|
var trimmed, scan, raw;
|
|
3102
|
-
return _regeneratorRuntime().wrap(function
|
|
3103
|
-
while (1) switch (
|
|
3167
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
3168
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
3104
3169
|
case 0:
|
|
3105
3170
|
trimmed = typeof code === 'string' ? code.trim() : '';
|
|
3106
3171
|
if (trimmed) {
|
|
3107
|
-
|
|
3172
|
+
_context40.next = 3;
|
|
3108
3173
|
break;
|
|
3109
3174
|
}
|
|
3110
|
-
return
|
|
3175
|
+
return _context40.abrupt("return", null);
|
|
3111
3176
|
case 3:
|
|
3112
3177
|
scan = handleGlobalScan(this.request, function (value) {
|
|
3113
3178
|
return _this9.store.products.findProductsByCodeOrBarcode(value);
|
|
3114
3179
|
}, this.getSubmitOrderSalesChannel());
|
|
3115
|
-
|
|
3180
|
+
_context40.next = 6;
|
|
3116
3181
|
return scan({
|
|
3117
3182
|
type: 'nativeScanner',
|
|
3118
3183
|
value: trimmed
|
|
3119
3184
|
});
|
|
3120
3185
|
case 6:
|
|
3121
|
-
raw =
|
|
3122
|
-
return
|
|
3186
|
+
raw = _context40.sent;
|
|
3187
|
+
return _context40.abrupt("return", (_formatGlobalScanResu = (_formatGlobalScanResu2 = formatGlobalScanResult(raw, trimmed)) === null || _formatGlobalScanResu2 === void 0 ? void 0 : _formatGlobalScanResu2.searchType) !== null && _formatGlobalScanResu !== void 0 ? _formatGlobalScanResu : null);
|
|
3123
3188
|
case 8:
|
|
3124
3189
|
case "end":
|
|
3125
|
-
return
|
|
3190
|
+
return _context40.stop();
|
|
3126
3191
|
}
|
|
3127
|
-
},
|
|
3192
|
+
}, _callee40, this);
|
|
3128
3193
|
}));
|
|
3129
3194
|
function getGlobalScanCodeType(_x25) {
|
|
3130
3195
|
return _getGlobalScanCodeType.apply(this, arguments);
|
|
@@ -3208,11 +3273,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3208
3273
|
}, {
|
|
3209
3274
|
key: "addAddTimeProductToBooking",
|
|
3210
3275
|
value: (function () {
|
|
3211
|
-
var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3212
|
-
return _regeneratorRuntime().wrap(function
|
|
3213
|
-
while (1) switch (
|
|
3276
|
+
var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(input) {
|
|
3277
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
3278
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
3214
3279
|
case 0:
|
|
3215
|
-
return
|
|
3280
|
+
return _context41.abrupt("return", this.addAddTimeProductsToBooking({
|
|
3216
3281
|
booking: input.booking,
|
|
3217
3282
|
products: [input],
|
|
3218
3283
|
coveredMinutes: input.coveredMinutes,
|
|
@@ -3220,9 +3285,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3220
3285
|
}));
|
|
3221
3286
|
case 1:
|
|
3222
3287
|
case "end":
|
|
3223
|
-
return
|
|
3288
|
+
return _context41.stop();
|
|
3224
3289
|
}
|
|
3225
|
-
},
|
|
3290
|
+
}, _callee41, this);
|
|
3226
3291
|
}));
|
|
3227
3292
|
function addAddTimeProductToBooking(_x26) {
|
|
3228
3293
|
return _addAddTimeProductToBooking.apply(this, arguments);
|
|
@@ -3242,16 +3307,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3242
3307
|
}, {
|
|
3243
3308
|
key: "addAddTimeProductsToBooking",
|
|
3244
3309
|
value: (function () {
|
|
3245
|
-
var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3310
|
+
var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(input) {
|
|
3246
3311
|
var _this10 = this,
|
|
3247
3312
|
_input$bookingPatch;
|
|
3248
3313
|
var bookingUid, orderLines, coveredMinutes, bookingTimePatch, result, _iterator2, _step2, line;
|
|
3249
|
-
return _regeneratorRuntime().wrap(function
|
|
3250
|
-
while (1) switch (
|
|
3314
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
3315
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
3251
3316
|
case 0:
|
|
3252
3317
|
bookingUid = resolveBookingUidForAddTime(input === null || input === void 0 ? void 0 : input.booking);
|
|
3253
3318
|
if (bookingUid) {
|
|
3254
|
-
|
|
3319
|
+
_context42.next = 3;
|
|
3255
3320
|
break;
|
|
3256
3321
|
}
|
|
3257
3322
|
throw new Error('[BookingTicket] addAddTimeProductToBooking: booking.metadata.unique_identification_number 缺失');
|
|
@@ -3262,7 +3327,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3262
3327
|
};
|
|
3263
3328
|
});
|
|
3264
3329
|
if (this.store.order) {
|
|
3265
|
-
|
|
3330
|
+
_context42.next = 6;
|
|
3266
3331
|
break;
|
|
3267
3332
|
}
|
|
3268
3333
|
throw new Error('order 模块未初始化');
|
|
@@ -3276,53 +3341,53 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3276
3341
|
});
|
|
3277
3342
|
}
|
|
3278
3343
|
if (!(typeof this.store.order.addProductsToOrder === 'function')) {
|
|
3279
|
-
|
|
3344
|
+
_context42.next = 11;
|
|
3280
3345
|
break;
|
|
3281
3346
|
}
|
|
3282
|
-
return
|
|
3347
|
+
return _context42.abrupt("return", this.store.order.addProductsToOrder(orderLines));
|
|
3283
3348
|
case 11:
|
|
3284
3349
|
result = [];
|
|
3285
3350
|
_iterator2 = _createForOfIteratorHelper(orderLines);
|
|
3286
|
-
|
|
3351
|
+
_context42.prev = 13;
|
|
3287
3352
|
_iterator2.s();
|
|
3288
3353
|
case 15:
|
|
3289
3354
|
if ((_step2 = _iterator2.n()).done) {
|
|
3290
|
-
|
|
3355
|
+
_context42.next = 29;
|
|
3291
3356
|
break;
|
|
3292
3357
|
}
|
|
3293
3358
|
line = _step2.value;
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3359
|
+
_context42.t0 = result.splice;
|
|
3360
|
+
_context42.t1 = result;
|
|
3361
|
+
_context42.t2 = [0, result.length];
|
|
3362
|
+
_context42.t3 = _toConsumableArray;
|
|
3363
|
+
_context42.next = 23;
|
|
3299
3364
|
return this.addProductToOrder(line.product);
|
|
3300
3365
|
case 23:
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3366
|
+
_context42.t4 = _context42.sent;
|
|
3367
|
+
_context42.t5 = (0, _context42.t3)(_context42.t4);
|
|
3368
|
+
_context42.t6 = _context42.t2.concat.call(_context42.t2, _context42.t5);
|
|
3369
|
+
_context42.t0.apply.call(_context42.t0, _context42.t1, _context42.t6);
|
|
3305
3370
|
case 27:
|
|
3306
|
-
|
|
3371
|
+
_context42.next = 15;
|
|
3307
3372
|
break;
|
|
3308
3373
|
case 29:
|
|
3309
|
-
|
|
3374
|
+
_context42.next = 34;
|
|
3310
3375
|
break;
|
|
3311
3376
|
case 31:
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
_iterator2.e(
|
|
3377
|
+
_context42.prev = 31;
|
|
3378
|
+
_context42.t7 = _context42["catch"](13);
|
|
3379
|
+
_iterator2.e(_context42.t7);
|
|
3315
3380
|
case 34:
|
|
3316
|
-
|
|
3381
|
+
_context42.prev = 34;
|
|
3317
3382
|
_iterator2.f();
|
|
3318
|
-
return
|
|
3383
|
+
return _context42.finish(34);
|
|
3319
3384
|
case 37:
|
|
3320
|
-
return
|
|
3385
|
+
return _context42.abrupt("return", result);
|
|
3321
3386
|
case 38:
|
|
3322
3387
|
case "end":
|
|
3323
|
-
return
|
|
3388
|
+
return _context42.stop();
|
|
3324
3389
|
}
|
|
3325
|
-
},
|
|
3390
|
+
}, _callee42, this, [[13, 31, 34, 37]]);
|
|
3326
3391
|
}));
|
|
3327
3392
|
function addAddTimeProductsToBooking(_x27) {
|
|
3328
3393
|
return _addAddTimeProductsToBooking.apply(this, arguments);
|
|
@@ -3332,47 +3397,47 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3332
3397
|
}, {
|
|
3333
3398
|
key: "setOtherParams",
|
|
3334
3399
|
value: function () {
|
|
3335
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3400
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
|
|
3336
3401
|
var _this11 = this;
|
|
3337
3402
|
var _ref21,
|
|
3338
3403
|
_ref21$cover,
|
|
3339
3404
|
cover,
|
|
3340
3405
|
nextParams,
|
|
3341
3406
|
invoiceContextChanged,
|
|
3342
|
-
|
|
3343
|
-
return _regeneratorRuntime().wrap(function
|
|
3344
|
-
while (1) switch (
|
|
3407
|
+
_args43 = arguments;
|
|
3408
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
3409
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
3345
3410
|
case 0:
|
|
3346
|
-
_ref21 =
|
|
3411
|
+
_ref21 = _args43.length > 1 && _args43[1] !== undefined ? _args43[1] : {}, _ref21$cover = _ref21.cover, cover = _ref21$cover === void 0 ? false : _ref21$cover;
|
|
3347
3412
|
nextParams = cover ? params : _objectSpread(_objectSpread({}, this.otherParams), params);
|
|
3348
3413
|
if (['businessCode', 'business_code', 'channel', 'platform', 'shop_id', 'tenantId', 'cacheId'].some(function (key) {
|
|
3349
3414
|
var _this11$otherParams;
|
|
3350
3415
|
return (nextParams === null || nextParams === void 0 ? void 0 : nextParams[key]) !== ((_this11$otherParams = _this11.otherParams) === null || _this11$otherParams === void 0 ? void 0 : _this11$otherParams[key]);
|
|
3351
3416
|
})) this.orderCustomerContactRequest = null;
|
|
3352
|
-
|
|
3417
|
+
_context43.next = 5;
|
|
3353
3418
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "setOtherParams", this).call(this, params, {
|
|
3354
3419
|
cover: cover
|
|
3355
3420
|
});
|
|
3356
3421
|
case 5:
|
|
3357
3422
|
invoiceContextChanged = (params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined || (params === null || params === void 0 ? void 0 : params.channel) !== undefined || (params === null || params === void 0 ? void 0 : params.platform) !== undefined || Object.prototype.hasOwnProperty.call(params, 'openData');
|
|
3358
3423
|
if (!invoiceContextChanged) {
|
|
3359
|
-
|
|
3424
|
+
_context43.next = 9;
|
|
3360
3425
|
break;
|
|
3361
3426
|
}
|
|
3362
|
-
|
|
3427
|
+
_context43.next = 9;
|
|
3363
3428
|
return this.prepareInvoiceTemplateAtSolutionReady(Object.prototype.hasOwnProperty.call(params, 'openData') ? this.getInjectedOpenDataConfig() : undefined);
|
|
3364
3429
|
case 9:
|
|
3365
3430
|
if (!((params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined)) {
|
|
3366
|
-
|
|
3431
|
+
_context43.next = 12;
|
|
3367
3432
|
break;
|
|
3368
3433
|
}
|
|
3369
|
-
|
|
3434
|
+
_context43.next = 12;
|
|
3370
3435
|
return this.configureIdGeneratorFromOpenData();
|
|
3371
3436
|
case 12:
|
|
3372
3437
|
case "end":
|
|
3373
|
-
return
|
|
3438
|
+
return _context43.stop();
|
|
3374
3439
|
}
|
|
3375
|
-
},
|
|
3440
|
+
}, _callee43, this);
|
|
3376
3441
|
}));
|
|
3377
3442
|
function setOtherParams(_x28) {
|
|
3378
3443
|
return _setOtherParams.apply(this, arguments);
|
|
@@ -3391,15 +3456,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3391
3456
|
}, {
|
|
3392
3457
|
key: "handlePrintWristband",
|
|
3393
3458
|
value: function () {
|
|
3394
|
-
var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3459
|
+
var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params) {
|
|
3395
3460
|
var _this$getOrderIdentit2;
|
|
3396
3461
|
var deviceTask, deviceId, idempotencyKey;
|
|
3397
|
-
return _regeneratorRuntime().wrap(function
|
|
3398
|
-
while (1) switch (
|
|
3462
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
3463
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
3399
3464
|
case 0:
|
|
3400
3465
|
deviceTask = this.getDeviceTaskPlugin();
|
|
3401
3466
|
if (deviceTask !== null && deviceTask !== void 0 && deviceTask.dispatch) {
|
|
3402
|
-
|
|
3467
|
+
_context44.next = 4;
|
|
3403
3468
|
break;
|
|
3404
3469
|
}
|
|
3405
3470
|
this.logger.addLog({
|
|
@@ -3409,7 +3474,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3409
3474
|
voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
|
|
3410
3475
|
}
|
|
3411
3476
|
});
|
|
3412
|
-
return
|
|
3477
|
+
return _context44.abrupt("return");
|
|
3413
3478
|
case 4:
|
|
3414
3479
|
this.logger.addLog({
|
|
3415
3480
|
type: 'info',
|
|
@@ -3418,10 +3483,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3418
3483
|
voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
|
|
3419
3484
|
}
|
|
3420
3485
|
});
|
|
3421
|
-
|
|
3486
|
+
_context44.next = 7;
|
|
3422
3487
|
return this.getShortNumberOrDeviceId();
|
|
3423
3488
|
case 7:
|
|
3424
|
-
deviceId =
|
|
3489
|
+
deviceId = _context44.sent;
|
|
3425
3490
|
idempotencyKey = createUuidV4();
|
|
3426
3491
|
deviceTask.dispatch({
|
|
3427
3492
|
action: 'print_all',
|
|
@@ -3441,9 +3506,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3441
3506
|
});
|
|
3442
3507
|
case 10:
|
|
3443
3508
|
case "end":
|
|
3444
|
-
return
|
|
3509
|
+
return _context44.stop();
|
|
3445
3510
|
}
|
|
3446
|
-
},
|
|
3511
|
+
}, _callee44, this);
|
|
3447
3512
|
}));
|
|
3448
3513
|
function handlePrintWristband(_x29) {
|
|
3449
3514
|
return _handlePrintWristband.apply(this, arguments);
|
|
@@ -3453,11 +3518,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3453
3518
|
}, {
|
|
3454
3519
|
key: "handleRedeem",
|
|
3455
3520
|
value: function () {
|
|
3456
|
-
var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3521
|
+
var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(params) {
|
|
3457
3522
|
var _this$store$order8, _this$store$order8$ge, _this$store$order9, _ref22, _tempOrder$order_id2;
|
|
3458
3523
|
var voucherIds, status, voucherIdSet, tempOrder, vouchers, hasUpdatedVoucher, nextVouchers, identity, externalSaleNumber, orderId, orderLookup;
|
|
3459
|
-
return _regeneratorRuntime().wrap(function
|
|
3460
|
-
while (1) switch (
|
|
3524
|
+
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
|
3525
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
3461
3526
|
case 0:
|
|
3462
3527
|
voucherIds = Array.isArray(params.voucher_ids) ? params.voucher_ids : [];
|
|
3463
3528
|
status = params.is_checkin ? 'used' : 'unused';
|
|
@@ -3481,20 +3546,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3481
3546
|
});
|
|
3482
3547
|
});
|
|
3483
3548
|
if (!(tempOrder && hasUpdatedVoucher)) {
|
|
3484
|
-
|
|
3549
|
+
_context45.next = 11;
|
|
3485
3550
|
break;
|
|
3486
3551
|
}
|
|
3487
|
-
|
|
3552
|
+
_context45.next = 11;
|
|
3488
3553
|
return this.replaceTempOrder(_objectSpread(_objectSpread({}, tempOrder), {}, {
|
|
3489
3554
|
vouchers: nextVouchers
|
|
3490
3555
|
}));
|
|
3491
3556
|
case 11:
|
|
3492
3557
|
this.core.effects.emit("".concat(this.name, ":onVouchersChange"), {});
|
|
3493
3558
|
if (!(voucherIds.length === 0)) {
|
|
3494
|
-
|
|
3559
|
+
_context45.next = 14;
|
|
3495
3560
|
break;
|
|
3496
3561
|
}
|
|
3497
|
-
return
|
|
3562
|
+
return _context45.abrupt("return", {
|
|
3498
3563
|
code: 200,
|
|
3499
3564
|
status: true,
|
|
3500
3565
|
message: '',
|
|
@@ -3505,7 +3570,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3505
3570
|
externalSaleNumber = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.external_sale_number) || (identity === null || identity === void 0 ? void 0 : identity.externalSaleNumber) || undefined;
|
|
3506
3571
|
orderId = (_ref22 = (_tempOrder$order_id2 = tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.order_id) !== null && _tempOrder$order_id2 !== void 0 ? _tempOrder$order_id2 : identity === null || identity === void 0 ? void 0 : identity.orderId) !== null && _ref22 !== void 0 ? _ref22 : undefined;
|
|
3507
3572
|
orderLookup = externalSaleNumber || orderId || (identity === null || identity === void 0 ? void 0 : identity.orderNumber) || (identity === null || identity === void 0 ? void 0 : identity.shopOrderNumber) || (identity === null || identity === void 0 ? void 0 : identity.shopFullOrderNumber) || undefined;
|
|
3508
|
-
return
|
|
3573
|
+
return _context45.abrupt("return", this.request.post('/machinecode/batch', {
|
|
3509
3574
|
ids: voucherIds,
|
|
3510
3575
|
status: status,
|
|
3511
3576
|
order_lookup: orderLookup,
|
|
@@ -3516,9 +3581,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3516
3581
|
}));
|
|
3517
3582
|
case 19:
|
|
3518
3583
|
case "end":
|
|
3519
|
-
return
|
|
3584
|
+
return _context45.stop();
|
|
3520
3585
|
}
|
|
3521
|
-
},
|
|
3586
|
+
}, _callee45, this);
|
|
3522
3587
|
}));
|
|
3523
3588
|
function handleRedeem(_x30) {
|
|
3524
3589
|
return _handleRedeem.apply(this, arguments);
|
|
@@ -3532,13 +3597,13 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3532
3597
|
}, {
|
|
3533
3598
|
key: "destroy",
|
|
3534
3599
|
value: (function () {
|
|
3535
|
-
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3600
|
+
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46() {
|
|
3536
3601
|
var _this$scan;
|
|
3537
|
-
return _regeneratorRuntime().wrap(function
|
|
3538
|
-
while (1) switch (
|
|
3602
|
+
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
|
3603
|
+
while (1) switch (_context46.prev = _context46.next) {
|
|
3539
3604
|
case 0:
|
|
3540
3605
|
this.orderCustomerContactRequest = null;
|
|
3541
|
-
|
|
3606
|
+
_context46.next = 3;
|
|
3542
3607
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "destroy", this).call(this);
|
|
3543
3608
|
case 3:
|
|
3544
3609
|
try {
|
|
@@ -3549,9 +3614,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3549
3614
|
scanCache.clear();
|
|
3550
3615
|
case 5:
|
|
3551
3616
|
case "end":
|
|
3552
|
-
return
|
|
3617
|
+
return _context46.stop();
|
|
3553
3618
|
}
|
|
3554
|
-
},
|
|
3619
|
+
}, _callee46, this);
|
|
3555
3620
|
}));
|
|
3556
3621
|
function destroy() {
|
|
3557
3622
|
return _destroy.apply(this, arguments);
|
|
@@ -208,8 +208,10 @@ export interface AddAddTimeProductsToBookingInput {
|
|
|
208
208
|
}
|
|
209
209
|
/** 扫码宿主桥接:SalesSdk 在 pubsub 订阅回调里注入,OS 需要 UI 时直接调用 */
|
|
210
210
|
export interface GlobalScanHostBridge {
|
|
211
|
-
/**
|
|
212
|
-
scanScope?: 'all' | 'product-voucher';
|
|
211
|
+
/** product-voucher handles voucher codes only; product-voucher-collection also resolves wallet customer vouchers. */
|
|
212
|
+
scanScope?: 'all' | 'product-voucher' | 'product-voucher-collection';
|
|
213
|
+
/** A one-shot entry may outlive its page while requests are in flight. */
|
|
214
|
+
isCurrent?: () => boolean;
|
|
213
215
|
openProductDetail?: (payload: Record<string, any>) => Promise<any | null>;
|
|
214
216
|
openBookingEdit?: (payload: Record<string, any>) => Promise<any | null>;
|
|
215
217
|
confirmDetail?: (input: {
|
|
@@ -234,11 +236,13 @@ export interface GlobalScanHostBridge {
|
|
|
234
236
|
*/
|
|
235
237
|
applyPromotionCode?: (code: string, customerId?: number, options?: {
|
|
236
238
|
suppressFailureNotification?: boolean;
|
|
239
|
+
productVouchersOnly?: boolean;
|
|
237
240
|
}) => Promise<{
|
|
238
241
|
isAvailable?: boolean;
|
|
239
242
|
isAccepted?: boolean;
|
|
240
243
|
type?: string;
|
|
241
244
|
unavailableReason?: string;
|
|
245
|
+
scannedDiscountList?: Record<string, any>[];
|
|
242
246
|
}>;
|
|
243
247
|
/** 当前订单已有其他客户时,由宿主复用客户组件完成确认及切换。 */
|
|
244
248
|
requestCustomerSwitch?: (customer: ICustomer) => Promise<boolean | null>;
|
|
@@ -246,7 +250,7 @@ export interface GlobalScanHostBridge {
|
|
|
246
250
|
refresh?: () => void;
|
|
247
251
|
}
|
|
248
252
|
/** handleGlobalScanCode 结构化返回 */
|
|
249
|
-
export type GlobalScanHandleResult = {
|
|
253
|
+
export type GlobalScanHandleResult = ({
|
|
250
254
|
status: 'success';
|
|
251
255
|
kind: 'customer' | 'products' | 'promotion';
|
|
252
256
|
meta?: {
|
|
@@ -259,5 +263,11 @@ export type GlobalScanHandleResult = {
|
|
|
259
263
|
status: 'cancelled';
|
|
260
264
|
} | {
|
|
261
265
|
status: 'failed';
|
|
262
|
-
reason: 'empty_code' | 'not_found' | 'invalid_data' | 'no_bridge';
|
|
266
|
+
reason: 'empty_code' | 'not_found' | 'invalid_data' | 'no_bridge' | 'entry_resolution_failed';
|
|
267
|
+
}) & {
|
|
268
|
+
/** product-voucher-collection returns voucher candidates; the caller decides how to use them. */
|
|
269
|
+
redemption?: {
|
|
270
|
+
source: 'wallet' | 'scan';
|
|
271
|
+
vouchers: Record<string, any>[];
|
|
272
|
+
};
|
|
263
273
|
};
|