@pisell/pisellos 2.3.184 → 2.3.186
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/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/inventory/index.d.ts +92 -0
- package/dist/inventory/index.js +509 -0
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/modules/Discount/index.js +1 -0
- package/dist/modules/Order/index.d.ts +25 -3
- package/dist/modules/Order/index.js +1770 -1311
- package/dist/modules/Order/types.d.ts +7 -0
- package/dist/modules/Order/utils/discountProductLineIdentity.js +2 -2
- package/dist/modules/Order/utils/productVoucherGroups.d.ts +15 -0
- package/dist/modules/Order/utils/productVoucherGroups.js +115 -0
- package/dist/modules/Order/utils.js +12 -1
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/Product/types.d.ts +5 -0
- package/dist/modules/ProductList/index.js +33 -12
- package/dist/modules/Rules/index.d.ts +2 -0
- package/dist/modules/Rules/index.js +29 -21
- package/dist/solution/BaseSales/index.d.ts +18 -1
- package/dist/solution/BaseSales/index.js +1762 -1434
- package/dist/solution/BaseSales/types.d.ts +3 -0
- package/dist/solution/BaseSales/utils/posDurationPricing.d.ts +21 -0
- package/dist/solution/BaseSales/utils/posDurationPricing.js +174 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +2 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +8 -8
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/BookingTicket/index.d.ts +13 -1
- package/dist/solution/BookingTicket/index.js +197 -108
- package/dist/solution/BookingTicket/types.d.ts +14 -2
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +1 -1
- package/dist/solution/BookingTicket/utils/addProductDecision.js +4 -3
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +8 -0
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +88 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +1 -0
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -1
- package/dist/solution/UnifiedBookingSales/index.d.ts +1 -1
- package/dist/solution/UnifiedBookingSales/index.js +102 -64
- package/dist/utils/platform.d.ts +2 -0
- package/dist/utils/platform.js +6 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +12 -0
- package/lib/inventory/index.d.ts +92 -0
- package/lib/inventory/index.js +287 -0
- package/lib/modules/Discount/index.js +1 -0
- package/lib/modules/Order/index.d.ts +25 -3
- package/lib/modules/Order/index.js +192 -38
- package/lib/modules/Order/types.d.ts +7 -0
- package/lib/modules/Order/utils/discountProductLineIdentity.js +1 -1
- package/lib/modules/Order/utils/productVoucherGroups.d.ts +15 -0
- package/lib/modules/Order/utils/productVoucherGroups.js +64 -0
- package/lib/modules/Order/utils.js +13 -0
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Product/types.d.ts +5 -0
- package/lib/modules/ProductList/index.js +15 -0
- package/lib/modules/Rules/index.d.ts +2 -0
- package/lib/modules/Rules/index.js +6 -0
- package/lib/solution/BaseSales/index.d.ts +18 -1
- package/lib/solution/BaseSales/index.js +214 -50
- package/lib/solution/BaseSales/types.d.ts +3 -0
- package/lib/solution/BaseSales/utils/posDurationPricing.d.ts +21 -0
- package/lib/solution/BaseSales/utils/posDurationPricing.js +133 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +2 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +1 -1
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/BookingTicket/index.d.ts +13 -1
- package/lib/solution/BookingTicket/index.js +37 -2
- package/lib/solution/BookingTicket/types.d.ts +14 -2
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +1 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.js +4 -3
- package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +8 -0
- package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +54 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +1 -0
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -1
- package/lib/solution/UnifiedBookingSales/index.d.ts +1 -1
- package/lib/solution/UnifiedBookingSales/index.js +37 -4
- package/lib/utils/platform.d.ts +2 -0
- package/lib/utils/platform.js +7 -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";
|
|
@@ -2986,24 +2987,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2986
2987
|
}, {
|
|
2987
2988
|
key: "handleGlobalScanCode",
|
|
2988
2989
|
value: (function () {
|
|
2989
|
-
var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2990
|
+
var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(code, bridge) {
|
|
2990
2991
|
var _this8 = this;
|
|
2991
|
-
var trimmed, _bridge$onNotify, _bridge$refresh, beforeScanCommit, beforeScanDialog, guardCallback, guardedBridge, localSearch, scanCallback, raw, formatted, _bridge$onNotify2, _result8, _bridge$onNotify3;
|
|
2992
|
-
return _regeneratorRuntime().wrap(function
|
|
2993
|
-
while (1) switch (
|
|
2992
|
+
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;
|
|
2993
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
2994
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
2994
2995
|
case 0:
|
|
2995
2996
|
trimmed = typeof code === 'string' ? code.trim() : '';
|
|
2996
2997
|
if (trimmed) {
|
|
2997
|
-
|
|
2998
|
+
_context40.next = 4;
|
|
2998
2999
|
break;
|
|
2999
3000
|
}
|
|
3000
3001
|
bridge === null || bridge === void 0 || (_bridge$onNotify = bridge.onNotify) === null || _bridge$onNotify === void 0 || _bridge$onNotify.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
3001
|
-
return
|
|
3002
|
+
return _context40.abrupt("return", {
|
|
3002
3003
|
status: 'failed',
|
|
3003
3004
|
reason: 'empty_code'
|
|
3004
3005
|
});
|
|
3005
3006
|
case 4:
|
|
3006
|
-
|
|
3007
|
+
_context40.prev = 4;
|
|
3007
3008
|
// Capture before lookup/UI awaits, so a result cannot land in a new cart.
|
|
3008
3009
|
// Unscoped POS Order modules return a no-op guard.
|
|
3009
3010
|
beforeScanCommit = this.store.order.createCartIntentCommitGuard('add_product');
|
|
@@ -3029,30 +3030,54 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3029
3030
|
return bridge.openBookingEdit(payload);
|
|
3030
3031
|
} : undefined
|
|
3031
3032
|
}) : undefined;
|
|
3033
|
+
if (!((guardedBridge === null || guardedBridge === void 0 ? void 0 : guardedBridge.scanScope) === 'product-voucher')) {
|
|
3034
|
+
_context40.next = 16;
|
|
3035
|
+
break;
|
|
3036
|
+
}
|
|
3037
|
+
if (guardedBridge.applyPromotionCode) {
|
|
3038
|
+
_context40.next = 12;
|
|
3039
|
+
break;
|
|
3040
|
+
}
|
|
3041
|
+
return _context40.abrupt("return", {
|
|
3042
|
+
status: 'failed',
|
|
3043
|
+
reason: 'no_bridge'
|
|
3044
|
+
});
|
|
3045
|
+
case 12:
|
|
3046
|
+
_context40.next = 14;
|
|
3047
|
+
return guardedBridge.applyPromotionCode(trimmed);
|
|
3048
|
+
case 14:
|
|
3049
|
+
promotion = _context40.sent;
|
|
3050
|
+
return _context40.abrupt("return", ((_promotion$isAccepted = promotion.isAccepted) !== null && _promotion$isAccepted !== void 0 ? _promotion$isAccepted : promotion.isAvailable) ? {
|
|
3051
|
+
status: 'success',
|
|
3052
|
+
kind: 'promotion'
|
|
3053
|
+
} : {
|
|
3054
|
+
status: 'failed',
|
|
3055
|
+
reason: 'not_found'
|
|
3056
|
+
});
|
|
3057
|
+
case 16:
|
|
3032
3058
|
localSearch = function localSearch(v) {
|
|
3033
3059
|
return _this8.store.products.findProductsByCodeOrBarcode(v);
|
|
3034
3060
|
};
|
|
3035
3061
|
scanCallback = handleGlobalScan(this.request, localSearch, this.getSubmitOrderSalesChannel());
|
|
3036
|
-
|
|
3062
|
+
_context40.next = 20;
|
|
3037
3063
|
return scanCallback({
|
|
3038
3064
|
type: 'nativeScanner',
|
|
3039
3065
|
value: trimmed
|
|
3040
3066
|
});
|
|
3041
|
-
case
|
|
3042
|
-
raw =
|
|
3067
|
+
case 20:
|
|
3068
|
+
raw = _context40.sent;
|
|
3043
3069
|
formatted = formatGlobalScanResult(raw, trimmed);
|
|
3044
3070
|
if (formatted) {
|
|
3045
|
-
|
|
3071
|
+
_context40.next = 25;
|
|
3046
3072
|
break;
|
|
3047
3073
|
}
|
|
3048
3074
|
bridge === null || bridge === void 0 || (_bridge$onNotify2 = bridge.onNotify) === null || _bridge$onNotify2 === void 0 || _bridge$onNotify2.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
3049
|
-
return
|
|
3075
|
+
return _context40.abrupt("return", {
|
|
3050
3076
|
status: 'failed',
|
|
3051
3077
|
reason: 'not_found'
|
|
3052
3078
|
});
|
|
3053
|
-
case
|
|
3054
|
-
|
|
3055
|
-
return applyGlobalScan({
|
|
3079
|
+
case 25:
|
|
3080
|
+
host = {
|
|
3056
3081
|
setOrderCustomer: function setOrderCustomer(customer) {
|
|
3057
3082
|
beforeScanCommit();
|
|
3058
3083
|
_this8.setOrderCustomer(customer);
|
|
@@ -3090,25 +3115,89 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3090
3115
|
beforeScanCommit();
|
|
3091
3116
|
return _this8.scanWalletAsset(scanCode);
|
|
3092
3117
|
}
|
|
3093
|
-
}
|
|
3094
|
-
|
|
3095
|
-
|
|
3118
|
+
};
|
|
3119
|
+
if (!((guardedBridge === null || guardedBridge === void 0 ? void 0 : guardedBridge.scanScope) === 'product-voucher-collection')) {
|
|
3120
|
+
_context40.next = 32;
|
|
3121
|
+
break;
|
|
3122
|
+
}
|
|
3123
|
+
_context40.next = 29;
|
|
3124
|
+
return applyProductVoucherCollectionScan(_objectSpread(_objectSpread({}, host), {}, {
|
|
3125
|
+
loadCustomerDiscounts: function () {
|
|
3126
|
+
var _loadCustomerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
|
|
3127
|
+
var _this8$getOrderCustom;
|
|
3128
|
+
var customerId;
|
|
3129
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
3130
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
3131
|
+
case 0:
|
|
3132
|
+
beforeScanCommit();
|
|
3133
|
+
customerId = Number(((_this8$getOrderCustom = _this8.getOrderCustomer()) === null || _this8$getOrderCustom === void 0 ? void 0 : _this8$getOrderCustom.customer_id) || 0);
|
|
3134
|
+
if (!(customerId <= 1)) {
|
|
3135
|
+
_context39.next = 4;
|
|
3136
|
+
break;
|
|
3137
|
+
}
|
|
3138
|
+
return _context39.abrupt("return", []);
|
|
3139
|
+
case 4:
|
|
3140
|
+
_context39.next = 6;
|
|
3141
|
+
return _this8.refreshDiscountConfigAfterOrderCustomerChange(customerId);
|
|
3142
|
+
case 6:
|
|
3143
|
+
beforeScanCommit();
|
|
3144
|
+
return _context39.abrupt("return", _this8.getDiscountList());
|
|
3145
|
+
case 8:
|
|
3146
|
+
case "end":
|
|
3147
|
+
return _context39.stop();
|
|
3148
|
+
}
|
|
3149
|
+
}, _callee39);
|
|
3150
|
+
}));
|
|
3151
|
+
function loadCustomerDiscounts() {
|
|
3152
|
+
return _loadCustomerDiscounts.apply(this, arguments);
|
|
3153
|
+
}
|
|
3154
|
+
return loadCustomerDiscounts;
|
|
3155
|
+
}()
|
|
3156
|
+
}), formatted, guardedBridge);
|
|
3157
|
+
case 29:
|
|
3158
|
+
_context40.t0 = _context40.sent;
|
|
3159
|
+
_context40.next = 35;
|
|
3160
|
+
break;
|
|
3161
|
+
case 32:
|
|
3162
|
+
_context40.next = 34;
|
|
3163
|
+
return applyGlobalScan(host, formatted, guardedBridge);
|
|
3164
|
+
case 34:
|
|
3165
|
+
_context40.t0 = _context40.sent;
|
|
3166
|
+
case 35:
|
|
3167
|
+
_result8 = _context40.t0;
|
|
3096
3168
|
bridge === null || bridge === void 0 || (_bridge$refresh = bridge.refresh) === null || _bridge$refresh === void 0 || _bridge$refresh.call(bridge);
|
|
3097
|
-
return
|
|
3098
|
-
case
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3169
|
+
return _context40.abrupt("return", _result8);
|
|
3170
|
+
case 40:
|
|
3171
|
+
_context40.prev = 40;
|
|
3172
|
+
_context40.t1 = _context40["catch"](4);
|
|
3173
|
+
if (!((bridge === null || bridge === void 0 ? void 0 : bridge.scanScope) === 'product-voucher-collection')) {
|
|
3174
|
+
_context40.next = 46;
|
|
3175
|
+
break;
|
|
3176
|
+
}
|
|
3177
|
+
if (!(((_bridge$isCurrent = bridge.isCurrent) === null || _bridge$isCurrent === void 0 ? void 0 : _bridge$isCurrent.call(bridge)) === false)) {
|
|
3178
|
+
_context40.next = 45;
|
|
3179
|
+
break;
|
|
3180
|
+
}
|
|
3181
|
+
return _context40.abrupt("return", {
|
|
3182
|
+
status: 'cancelled'
|
|
3183
|
+
});
|
|
3184
|
+
case 45:
|
|
3185
|
+
return _context40.abrupt("return", {
|
|
3186
|
+
status: 'failed',
|
|
3187
|
+
reason: 'entry_resolution_failed'
|
|
3188
|
+
});
|
|
3189
|
+
case 46:
|
|
3190
|
+
console.error('[BookingTicket] handleGlobalScanCode failed', _context40.t1);
|
|
3102
3191
|
bridge === null || bridge === void 0 || (_bridge$onNotify3 = bridge.onNotify) === null || _bridge$onNotify3 === void 0 || _bridge$onNotify3.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
3103
|
-
return
|
|
3192
|
+
return _context40.abrupt("return", {
|
|
3104
3193
|
status: 'failed',
|
|
3105
3194
|
reason: 'not_found'
|
|
3106
3195
|
});
|
|
3107
|
-
case
|
|
3196
|
+
case 49:
|
|
3108
3197
|
case "end":
|
|
3109
|
-
return
|
|
3198
|
+
return _context40.stop();
|
|
3110
3199
|
}
|
|
3111
|
-
},
|
|
3200
|
+
}, _callee40, this, [[4, 40]]);
|
|
3112
3201
|
}));
|
|
3113
3202
|
function handleGlobalScanCode(_x23, _x24) {
|
|
3114
3203
|
return _handleGlobalScanCode.apply(this, arguments);
|
|
@@ -3118,37 +3207,37 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3118
3207
|
}, {
|
|
3119
3208
|
key: "getGlobalScanCodeType",
|
|
3120
3209
|
value: (function () {
|
|
3121
|
-
var _getGlobalScanCodeType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3210
|
+
var _getGlobalScanCodeType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(code) {
|
|
3122
3211
|
var _this9 = this,
|
|
3123
3212
|
_formatGlobalScanResu,
|
|
3124
3213
|
_formatGlobalScanResu2;
|
|
3125
3214
|
var trimmed, scan, raw;
|
|
3126
|
-
return _regeneratorRuntime().wrap(function
|
|
3127
|
-
while (1) switch (
|
|
3215
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
3216
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
3128
3217
|
case 0:
|
|
3129
3218
|
trimmed = typeof code === 'string' ? code.trim() : '';
|
|
3130
3219
|
if (trimmed) {
|
|
3131
|
-
|
|
3220
|
+
_context41.next = 3;
|
|
3132
3221
|
break;
|
|
3133
3222
|
}
|
|
3134
|
-
return
|
|
3223
|
+
return _context41.abrupt("return", null);
|
|
3135
3224
|
case 3:
|
|
3136
3225
|
scan = handleGlobalScan(this.request, function (value) {
|
|
3137
3226
|
return _this9.store.products.findProductsByCodeOrBarcode(value);
|
|
3138
3227
|
}, this.getSubmitOrderSalesChannel());
|
|
3139
|
-
|
|
3228
|
+
_context41.next = 6;
|
|
3140
3229
|
return scan({
|
|
3141
3230
|
type: 'nativeScanner',
|
|
3142
3231
|
value: trimmed
|
|
3143
3232
|
});
|
|
3144
3233
|
case 6:
|
|
3145
|
-
raw =
|
|
3146
|
-
return
|
|
3234
|
+
raw = _context41.sent;
|
|
3235
|
+
return _context41.abrupt("return", (_formatGlobalScanResu = (_formatGlobalScanResu2 = formatGlobalScanResult(raw, trimmed)) === null || _formatGlobalScanResu2 === void 0 ? void 0 : _formatGlobalScanResu2.searchType) !== null && _formatGlobalScanResu !== void 0 ? _formatGlobalScanResu : null);
|
|
3147
3236
|
case 8:
|
|
3148
3237
|
case "end":
|
|
3149
|
-
return
|
|
3238
|
+
return _context41.stop();
|
|
3150
3239
|
}
|
|
3151
|
-
},
|
|
3240
|
+
}, _callee41, this);
|
|
3152
3241
|
}));
|
|
3153
3242
|
function getGlobalScanCodeType(_x25) {
|
|
3154
3243
|
return _getGlobalScanCodeType.apply(this, arguments);
|
|
@@ -3232,11 +3321,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3232
3321
|
}, {
|
|
3233
3322
|
key: "addAddTimeProductToBooking",
|
|
3234
3323
|
value: (function () {
|
|
3235
|
-
var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3236
|
-
return _regeneratorRuntime().wrap(function
|
|
3237
|
-
while (1) switch (
|
|
3324
|
+
var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(input) {
|
|
3325
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
3326
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
3238
3327
|
case 0:
|
|
3239
|
-
return
|
|
3328
|
+
return _context42.abrupt("return", this.addAddTimeProductsToBooking({
|
|
3240
3329
|
booking: input.booking,
|
|
3241
3330
|
products: [input],
|
|
3242
3331
|
coveredMinutes: input.coveredMinutes,
|
|
@@ -3244,9 +3333,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3244
3333
|
}));
|
|
3245
3334
|
case 1:
|
|
3246
3335
|
case "end":
|
|
3247
|
-
return
|
|
3336
|
+
return _context42.stop();
|
|
3248
3337
|
}
|
|
3249
|
-
},
|
|
3338
|
+
}, _callee42, this);
|
|
3250
3339
|
}));
|
|
3251
3340
|
function addAddTimeProductToBooking(_x26) {
|
|
3252
3341
|
return _addAddTimeProductToBooking.apply(this, arguments);
|
|
@@ -3266,16 +3355,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3266
3355
|
}, {
|
|
3267
3356
|
key: "addAddTimeProductsToBooking",
|
|
3268
3357
|
value: (function () {
|
|
3269
|
-
var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3358
|
+
var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(input) {
|
|
3270
3359
|
var _this10 = this,
|
|
3271
3360
|
_input$bookingPatch;
|
|
3272
3361
|
var bookingUid, orderLines, coveredMinutes, bookingTimePatch, result, _iterator2, _step2, line;
|
|
3273
|
-
return _regeneratorRuntime().wrap(function
|
|
3274
|
-
while (1) switch (
|
|
3362
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
3363
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
3275
3364
|
case 0:
|
|
3276
3365
|
bookingUid = resolveBookingUidForAddTime(input === null || input === void 0 ? void 0 : input.booking);
|
|
3277
3366
|
if (bookingUid) {
|
|
3278
|
-
|
|
3367
|
+
_context43.next = 3;
|
|
3279
3368
|
break;
|
|
3280
3369
|
}
|
|
3281
3370
|
throw new Error('[BookingTicket] addAddTimeProductToBooking: booking.metadata.unique_identification_number 缺失');
|
|
@@ -3286,7 +3375,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3286
3375
|
};
|
|
3287
3376
|
});
|
|
3288
3377
|
if (this.store.order) {
|
|
3289
|
-
|
|
3378
|
+
_context43.next = 6;
|
|
3290
3379
|
break;
|
|
3291
3380
|
}
|
|
3292
3381
|
throw new Error('order 模块未初始化');
|
|
@@ -3300,53 +3389,53 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3300
3389
|
});
|
|
3301
3390
|
}
|
|
3302
3391
|
if (!(typeof this.store.order.addProductsToOrder === 'function')) {
|
|
3303
|
-
|
|
3392
|
+
_context43.next = 11;
|
|
3304
3393
|
break;
|
|
3305
3394
|
}
|
|
3306
|
-
return
|
|
3395
|
+
return _context43.abrupt("return", this.store.order.addProductsToOrder(orderLines));
|
|
3307
3396
|
case 11:
|
|
3308
3397
|
result = [];
|
|
3309
3398
|
_iterator2 = _createForOfIteratorHelper(orderLines);
|
|
3310
|
-
|
|
3399
|
+
_context43.prev = 13;
|
|
3311
3400
|
_iterator2.s();
|
|
3312
3401
|
case 15:
|
|
3313
3402
|
if ((_step2 = _iterator2.n()).done) {
|
|
3314
|
-
|
|
3403
|
+
_context43.next = 29;
|
|
3315
3404
|
break;
|
|
3316
3405
|
}
|
|
3317
3406
|
line = _step2.value;
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3407
|
+
_context43.t0 = result.splice;
|
|
3408
|
+
_context43.t1 = result;
|
|
3409
|
+
_context43.t2 = [0, result.length];
|
|
3410
|
+
_context43.t3 = _toConsumableArray;
|
|
3411
|
+
_context43.next = 23;
|
|
3323
3412
|
return this.addProductToOrder(line.product);
|
|
3324
3413
|
case 23:
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3414
|
+
_context43.t4 = _context43.sent;
|
|
3415
|
+
_context43.t5 = (0, _context43.t3)(_context43.t4);
|
|
3416
|
+
_context43.t6 = _context43.t2.concat.call(_context43.t2, _context43.t5);
|
|
3417
|
+
_context43.t0.apply.call(_context43.t0, _context43.t1, _context43.t6);
|
|
3329
3418
|
case 27:
|
|
3330
|
-
|
|
3419
|
+
_context43.next = 15;
|
|
3331
3420
|
break;
|
|
3332
3421
|
case 29:
|
|
3333
|
-
|
|
3422
|
+
_context43.next = 34;
|
|
3334
3423
|
break;
|
|
3335
3424
|
case 31:
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
_iterator2.e(
|
|
3425
|
+
_context43.prev = 31;
|
|
3426
|
+
_context43.t7 = _context43["catch"](13);
|
|
3427
|
+
_iterator2.e(_context43.t7);
|
|
3339
3428
|
case 34:
|
|
3340
|
-
|
|
3429
|
+
_context43.prev = 34;
|
|
3341
3430
|
_iterator2.f();
|
|
3342
|
-
return
|
|
3431
|
+
return _context43.finish(34);
|
|
3343
3432
|
case 37:
|
|
3344
|
-
return
|
|
3433
|
+
return _context43.abrupt("return", result);
|
|
3345
3434
|
case 38:
|
|
3346
3435
|
case "end":
|
|
3347
|
-
return
|
|
3436
|
+
return _context43.stop();
|
|
3348
3437
|
}
|
|
3349
|
-
},
|
|
3438
|
+
}, _callee43, this, [[13, 31, 34, 37]]);
|
|
3350
3439
|
}));
|
|
3351
3440
|
function addAddTimeProductsToBooking(_x27) {
|
|
3352
3441
|
return _addAddTimeProductsToBooking.apply(this, arguments);
|
|
@@ -3356,47 +3445,47 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3356
3445
|
}, {
|
|
3357
3446
|
key: "setOtherParams",
|
|
3358
3447
|
value: function () {
|
|
3359
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3448
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params) {
|
|
3360
3449
|
var _this11 = this;
|
|
3361
3450
|
var _ref21,
|
|
3362
3451
|
_ref21$cover,
|
|
3363
3452
|
cover,
|
|
3364
3453
|
nextParams,
|
|
3365
3454
|
invoiceContextChanged,
|
|
3366
|
-
|
|
3367
|
-
return _regeneratorRuntime().wrap(function
|
|
3368
|
-
while (1) switch (
|
|
3455
|
+
_args44 = arguments;
|
|
3456
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
3457
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
3369
3458
|
case 0:
|
|
3370
|
-
_ref21 =
|
|
3459
|
+
_ref21 = _args44.length > 1 && _args44[1] !== undefined ? _args44[1] : {}, _ref21$cover = _ref21.cover, cover = _ref21$cover === void 0 ? false : _ref21$cover;
|
|
3371
3460
|
nextParams = cover ? params : _objectSpread(_objectSpread({}, this.otherParams), params);
|
|
3372
3461
|
if (['businessCode', 'business_code', 'channel', 'platform', 'shop_id', 'tenantId', 'cacheId'].some(function (key) {
|
|
3373
3462
|
var _this11$otherParams;
|
|
3374
3463
|
return (nextParams === null || nextParams === void 0 ? void 0 : nextParams[key]) !== ((_this11$otherParams = _this11.otherParams) === null || _this11$otherParams === void 0 ? void 0 : _this11$otherParams[key]);
|
|
3375
3464
|
})) this.orderCustomerContactRequest = null;
|
|
3376
|
-
|
|
3465
|
+
_context44.next = 5;
|
|
3377
3466
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "setOtherParams", this).call(this, params, {
|
|
3378
3467
|
cover: cover
|
|
3379
3468
|
});
|
|
3380
3469
|
case 5:
|
|
3381
3470
|
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');
|
|
3382
3471
|
if (!invoiceContextChanged) {
|
|
3383
|
-
|
|
3472
|
+
_context44.next = 9;
|
|
3384
3473
|
break;
|
|
3385
3474
|
}
|
|
3386
|
-
|
|
3475
|
+
_context44.next = 9;
|
|
3387
3476
|
return this.prepareInvoiceTemplateAtSolutionReady(Object.prototype.hasOwnProperty.call(params, 'openData') ? this.getInjectedOpenDataConfig() : undefined);
|
|
3388
3477
|
case 9:
|
|
3389
3478
|
if (!((params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined)) {
|
|
3390
|
-
|
|
3479
|
+
_context44.next = 12;
|
|
3391
3480
|
break;
|
|
3392
3481
|
}
|
|
3393
|
-
|
|
3482
|
+
_context44.next = 12;
|
|
3394
3483
|
return this.configureIdGeneratorFromOpenData();
|
|
3395
3484
|
case 12:
|
|
3396
3485
|
case "end":
|
|
3397
|
-
return
|
|
3486
|
+
return _context44.stop();
|
|
3398
3487
|
}
|
|
3399
|
-
},
|
|
3488
|
+
}, _callee44, this);
|
|
3400
3489
|
}));
|
|
3401
3490
|
function setOtherParams(_x28) {
|
|
3402
3491
|
return _setOtherParams.apply(this, arguments);
|
|
@@ -3415,15 +3504,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3415
3504
|
}, {
|
|
3416
3505
|
key: "handlePrintWristband",
|
|
3417
3506
|
value: function () {
|
|
3418
|
-
var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3507
|
+
var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(params) {
|
|
3419
3508
|
var _this$getOrderIdentit2;
|
|
3420
3509
|
var deviceTask, deviceId, idempotencyKey;
|
|
3421
|
-
return _regeneratorRuntime().wrap(function
|
|
3422
|
-
while (1) switch (
|
|
3510
|
+
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
|
3511
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
3423
3512
|
case 0:
|
|
3424
3513
|
deviceTask = this.getDeviceTaskPlugin();
|
|
3425
3514
|
if (deviceTask !== null && deviceTask !== void 0 && deviceTask.dispatch) {
|
|
3426
|
-
|
|
3515
|
+
_context45.next = 4;
|
|
3427
3516
|
break;
|
|
3428
3517
|
}
|
|
3429
3518
|
this.logger.addLog({
|
|
@@ -3433,7 +3522,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3433
3522
|
voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
|
|
3434
3523
|
}
|
|
3435
3524
|
});
|
|
3436
|
-
return
|
|
3525
|
+
return _context45.abrupt("return");
|
|
3437
3526
|
case 4:
|
|
3438
3527
|
this.logger.addLog({
|
|
3439
3528
|
type: 'info',
|
|
@@ -3442,10 +3531,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3442
3531
|
voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
|
|
3443
3532
|
}
|
|
3444
3533
|
});
|
|
3445
|
-
|
|
3534
|
+
_context45.next = 7;
|
|
3446
3535
|
return this.getShortNumberOrDeviceId();
|
|
3447
3536
|
case 7:
|
|
3448
|
-
deviceId =
|
|
3537
|
+
deviceId = _context45.sent;
|
|
3449
3538
|
idempotencyKey = createUuidV4();
|
|
3450
3539
|
deviceTask.dispatch({
|
|
3451
3540
|
action: 'print_all',
|
|
@@ -3465,9 +3554,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3465
3554
|
});
|
|
3466
3555
|
case 10:
|
|
3467
3556
|
case "end":
|
|
3468
|
-
return
|
|
3557
|
+
return _context45.stop();
|
|
3469
3558
|
}
|
|
3470
|
-
},
|
|
3559
|
+
}, _callee45, this);
|
|
3471
3560
|
}));
|
|
3472
3561
|
function handlePrintWristband(_x29) {
|
|
3473
3562
|
return _handlePrintWristband.apply(this, arguments);
|
|
@@ -3477,11 +3566,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3477
3566
|
}, {
|
|
3478
3567
|
key: "handleRedeem",
|
|
3479
3568
|
value: function () {
|
|
3480
|
-
var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3569
|
+
var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(params) {
|
|
3481
3570
|
var _this$store$order8, _this$store$order8$ge, _this$store$order9, _ref22, _tempOrder$order_id2;
|
|
3482
3571
|
var voucherIds, status, voucherIdSet, tempOrder, vouchers, hasUpdatedVoucher, nextVouchers, identity, externalSaleNumber, orderId, orderLookup;
|
|
3483
|
-
return _regeneratorRuntime().wrap(function
|
|
3484
|
-
while (1) switch (
|
|
3572
|
+
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
|
3573
|
+
while (1) switch (_context46.prev = _context46.next) {
|
|
3485
3574
|
case 0:
|
|
3486
3575
|
voucherIds = Array.isArray(params.voucher_ids) ? params.voucher_ids : [];
|
|
3487
3576
|
status = params.is_checkin ? 'used' : 'unused';
|
|
@@ -3505,20 +3594,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3505
3594
|
});
|
|
3506
3595
|
});
|
|
3507
3596
|
if (!(tempOrder && hasUpdatedVoucher)) {
|
|
3508
|
-
|
|
3597
|
+
_context46.next = 11;
|
|
3509
3598
|
break;
|
|
3510
3599
|
}
|
|
3511
|
-
|
|
3600
|
+
_context46.next = 11;
|
|
3512
3601
|
return this.replaceTempOrder(_objectSpread(_objectSpread({}, tempOrder), {}, {
|
|
3513
3602
|
vouchers: nextVouchers
|
|
3514
3603
|
}));
|
|
3515
3604
|
case 11:
|
|
3516
3605
|
this.core.effects.emit("".concat(this.name, ":onVouchersChange"), {});
|
|
3517
3606
|
if (!(voucherIds.length === 0)) {
|
|
3518
|
-
|
|
3607
|
+
_context46.next = 14;
|
|
3519
3608
|
break;
|
|
3520
3609
|
}
|
|
3521
|
-
return
|
|
3610
|
+
return _context46.abrupt("return", {
|
|
3522
3611
|
code: 200,
|
|
3523
3612
|
status: true,
|
|
3524
3613
|
message: '',
|
|
@@ -3529,7 +3618,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3529
3618
|
externalSaleNumber = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.external_sale_number) || (identity === null || identity === void 0 ? void 0 : identity.externalSaleNumber) || undefined;
|
|
3530
3619
|
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;
|
|
3531
3620
|
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;
|
|
3532
|
-
return
|
|
3621
|
+
return _context46.abrupt("return", this.request.post('/machinecode/batch', {
|
|
3533
3622
|
ids: voucherIds,
|
|
3534
3623
|
status: status,
|
|
3535
3624
|
order_lookup: orderLookup,
|
|
@@ -3540,9 +3629,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3540
3629
|
}));
|
|
3541
3630
|
case 19:
|
|
3542
3631
|
case "end":
|
|
3543
|
-
return
|
|
3632
|
+
return _context46.stop();
|
|
3544
3633
|
}
|
|
3545
|
-
},
|
|
3634
|
+
}, _callee46, this);
|
|
3546
3635
|
}));
|
|
3547
3636
|
function handleRedeem(_x30) {
|
|
3548
3637
|
return _handleRedeem.apply(this, arguments);
|
|
@@ -3556,13 +3645,13 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3556
3645
|
}, {
|
|
3557
3646
|
key: "destroy",
|
|
3558
3647
|
value: (function () {
|
|
3559
|
-
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3648
|
+
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47() {
|
|
3560
3649
|
var _this$scan;
|
|
3561
|
-
return _regeneratorRuntime().wrap(function
|
|
3562
|
-
while (1) switch (
|
|
3650
|
+
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
|
3651
|
+
while (1) switch (_context47.prev = _context47.next) {
|
|
3563
3652
|
case 0:
|
|
3564
3653
|
this.orderCustomerContactRequest = null;
|
|
3565
|
-
|
|
3654
|
+
_context47.next = 3;
|
|
3566
3655
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "destroy", this).call(this);
|
|
3567
3656
|
case 3:
|
|
3568
3657
|
try {
|
|
@@ -3573,9 +3662,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3573
3662
|
scanCache.clear();
|
|
3574
3663
|
case 5:
|
|
3575
3664
|
case "end":
|
|
3576
|
-
return
|
|
3665
|
+
return _context47.stop();
|
|
3577
3666
|
}
|
|
3578
|
-
},
|
|
3667
|
+
}, _callee47, this);
|
|
3579
3668
|
}));
|
|
3580
3669
|
function destroy() {
|
|
3581
3670
|
return _destroy.apply(this, arguments);
|
|
@@ -208,6 +208,10 @@ export interface AddAddTimeProductsToBookingInput {
|
|
|
208
208
|
}
|
|
209
209
|
/** 扫码宿主桥接:SalesSdk 在 pubsub 订阅回调里注入,OS 需要 UI 时直接调用 */
|
|
210
210
|
export interface GlobalScanHostBridge {
|
|
211
|
+
/** product-voucher handles voucher codes; product-voucher-collection loads all vouchers for the scanned customer. */
|
|
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;
|
|
211
215
|
openProductDetail?: (payload: Record<string, any>) => Promise<any | null>;
|
|
212
216
|
openBookingEdit?: (payload: Record<string, any>) => Promise<any | null>;
|
|
213
217
|
confirmDetail?: (input: {
|
|
@@ -232,11 +236,13 @@ export interface GlobalScanHostBridge {
|
|
|
232
236
|
*/
|
|
233
237
|
applyPromotionCode?: (code: string, customerId?: number, options?: {
|
|
234
238
|
suppressFailureNotification?: boolean;
|
|
239
|
+
productVouchersOnly?: boolean;
|
|
235
240
|
}) => Promise<{
|
|
236
241
|
isAvailable?: boolean;
|
|
237
242
|
isAccepted?: boolean;
|
|
238
243
|
type?: string;
|
|
239
244
|
unavailableReason?: string;
|
|
245
|
+
scannedDiscountList?: Record<string, any>[];
|
|
240
246
|
}>;
|
|
241
247
|
/** 当前订单已有其他客户时,由宿主复用客户组件完成确认及切换。 */
|
|
242
248
|
requestCustomerSwitch?: (customer: ICustomer) => Promise<boolean | null>;
|
|
@@ -244,7 +250,7 @@ export interface GlobalScanHostBridge {
|
|
|
244
250
|
refresh?: () => void;
|
|
245
251
|
}
|
|
246
252
|
/** handleGlobalScanCode 结构化返回 */
|
|
247
|
-
export type GlobalScanHandleResult = {
|
|
253
|
+
export type GlobalScanHandleResult = ({
|
|
248
254
|
status: 'success';
|
|
249
255
|
kind: 'customer' | 'products' | 'promotion';
|
|
250
256
|
meta?: {
|
|
@@ -257,5 +263,11 @@ export type GlobalScanHandleResult = {
|
|
|
257
263
|
status: 'cancelled';
|
|
258
264
|
} | {
|
|
259
265
|
status: 'failed';
|
|
260
|
-
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
|
+
};
|
|
261
273
|
};
|
|
@@ -5,7 +5,7 @@ import type { OrderProduct, OrderProductIdentity, AddProductBookingInput } from
|
|
|
5
5
|
* cart.addProduct 两阶段决策(与 ticketBooking `handleSelectProduct` 对齐):
|
|
6
6
|
*
|
|
7
7
|
* 1. `requiresDetail`:规格 / SKU / 套餐 / Session / 称重弹窗(门禁:`isOpenDetailModal` / `cartDetailValue` / `open_sold_weight`)
|
|
8
|
-
* 2. `requiresBookingEdit`:资源 /
|
|
8
|
+
* 2. `requiresBookingEdit`:资源 / 时间编辑抽屉(自助终端强制进入;其他渠道由 `getIsAutoClose` 决定)
|
|
9
9
|
* 3. `add`:两关均通过,直接 transform + 加车
|
|
10
10
|
*/
|
|
11
11
|
export type AddProductDecision = {
|