@pisell/pisellos 2.3.180 → 2.3.181
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/Product/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/UnifiedBookingSales/index.d.ts +4 -0
- package/dist/solution/UnifiedBookingSales/index.js +719 -554
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/UnifiedBookingSales/index.d.ts +4 -0
- package/lib/solution/UnifiedBookingSales/index.js +76 -0
- package/package.json +1 -1
|
@@ -3126,76 +3126,241 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3126
3126
|
return _fetchAllergyItemRuleConfigs.apply(this, arguments);
|
|
3127
3127
|
}
|
|
3128
3128
|
return fetchAllergyItemRuleConfigs;
|
|
3129
|
+
}() /** Required products currently apply only to the online venue-ticket entry. */
|
|
3130
|
+
}, {
|
|
3131
|
+
key: "validateRequiredProducts",
|
|
3132
|
+
value: (function () {
|
|
3133
|
+
var _validateRequiredProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
|
|
3134
|
+
var _ref36, _this$otherParams$bus3, _this$otherParams23, _this$otherParams24, _this$otherParams$cha3, _this$otherParams25, _this$otherParams26;
|
|
3135
|
+
var businessCode, channel, scope, order, runtimeConfig, configs, _response$data2, openData, ids, response, strategyConfigs, cartItems, result, _result$failedChecks$, error;
|
|
3136
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
3137
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
3138
|
+
case 0:
|
|
3139
|
+
businessCode = String((_ref36 = (_this$otherParams$bus3 = (_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.businessCode) !== null && _this$otherParams$bus3 !== void 0 ? _this$otherParams$bus3 : (_this$otherParams24 = this.otherParams) === null || _this$otherParams24 === void 0 ? void 0 : _this$otherParams24.business_code) !== null && _ref36 !== void 0 ? _ref36 : '').trim();
|
|
3140
|
+
channel = String((_this$otherParams$cha3 = (_this$otherParams25 = this.otherParams) === null || _this$otherParams25 === void 0 ? void 0 : _this$otherParams25.channel) !== null && _this$otherParams$cha3 !== void 0 ? _this$otherParams$cha3 : '').trim();
|
|
3141
|
+
if (!(businessCode !== 'venue_ticket' || channel !== 'online_ordering')) {
|
|
3142
|
+
_context23.next = 4;
|
|
3143
|
+
break;
|
|
3144
|
+
}
|
|
3145
|
+
return _context23.abrupt("return");
|
|
3146
|
+
case 4:
|
|
3147
|
+
scope = this.getPickupTimingScope();
|
|
3148
|
+
order = this.getTempOrder();
|
|
3149
|
+
runtimeConfig = ((_this$otherParams26 = this.otherParams) === null || _this$otherParams26 === void 0 ? void 0 : _this$otherParams26.itemRule) || {};
|
|
3150
|
+
configs = normalizeItemRuleStrategyConfigs(runtimeConfig.strategyConfigs);
|
|
3151
|
+
if (configs.length) {
|
|
3152
|
+
_context23.next = 23;
|
|
3153
|
+
break;
|
|
3154
|
+
}
|
|
3155
|
+
_context23.next = 11;
|
|
3156
|
+
return this.getOpenData();
|
|
3157
|
+
case 11:
|
|
3158
|
+
openData = _context23.sent;
|
|
3159
|
+
if (toConfiguredBoolean(openData === null || openData === void 0 ? void 0 : openData['sale.enable_item_rules'])) {
|
|
3160
|
+
_context23.next = 14;
|
|
3161
|
+
break;
|
|
3162
|
+
}
|
|
3163
|
+
return _context23.abrupt("return");
|
|
3164
|
+
case 14:
|
|
3165
|
+
ids = normalizePositiveIntegerList(openData === null || openData === void 0 ? void 0 : openData['sale.enabled_item_rules']);
|
|
3166
|
+
if (ids.length) {
|
|
3167
|
+
_context23.next = 17;
|
|
3168
|
+
break;
|
|
3169
|
+
}
|
|
3170
|
+
return _context23.abrupt("return");
|
|
3171
|
+
case 17:
|
|
3172
|
+
_context23.next = 19;
|
|
3173
|
+
return this.request.get('/promotion', {
|
|
3174
|
+
skip: 1,
|
|
3175
|
+
num: 99,
|
|
3176
|
+
status: 'active',
|
|
3177
|
+
ids: ids
|
|
3178
|
+
});
|
|
3179
|
+
case 19:
|
|
3180
|
+
response = _context23.sent;
|
|
3181
|
+
if (!((response === null || response === void 0 ? void 0 : response.code) !== 200 || !Array.isArray(response === null || response === void 0 || (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.list))) {
|
|
3182
|
+
_context23.next = 22;
|
|
3183
|
+
break;
|
|
3184
|
+
}
|
|
3185
|
+
throw new Error('Unable to load required product rules. Please try again.');
|
|
3186
|
+
case 22:
|
|
3187
|
+
// Configured IDs can include disabled or deleted rules; only active results participate.
|
|
3188
|
+
configs = normalizeItemRuleStrategyConfigs(response.data.list.filter(function (item) {
|
|
3189
|
+
return ids.includes(Number(item === null || item === void 0 ? void 0 : item.id));
|
|
3190
|
+
}).map(function (item) {
|
|
3191
|
+
return item === null || item === void 0 ? void 0 : item.metadata;
|
|
3192
|
+
}));
|
|
3193
|
+
case 23:
|
|
3194
|
+
if (!(scope !== this.getPickupTimingScope() || order !== this.getTempOrder())) {
|
|
3195
|
+
_context23.next = 25;
|
|
3196
|
+
break;
|
|
3197
|
+
}
|
|
3198
|
+
throw new Error('The order changed. Please try again.');
|
|
3199
|
+
case 25:
|
|
3200
|
+
strategyConfigs = configs.filter(function (config) {
|
|
3201
|
+
return Array.isArray(config.actions);
|
|
3202
|
+
}).map(function (config) {
|
|
3203
|
+
return _objectSpread(_objectSpread({}, config), {}, {
|
|
3204
|
+
actions: config.actions.filter(function (action) {
|
|
3205
|
+
var _action$config, _action$config2;
|
|
3206
|
+
var rules = (_action$config = action.config) === null || _action$config === void 0 ? void 0 : _action$config.quantityRules;
|
|
3207
|
+
return action.type === 'QUANTITY_CHECK' && ((_action$config2 = action.config) === null || _action$config2 === void 0 ? void 0 : _action$config2.targetType) === 'product' && Array.isArray(rules) && rules.length > 0 && rules.every(function (rule) {
|
|
3208
|
+
return rule.source === 'fixed' && (rule.comparison === 'minimum' || rule.comparison === 'must_include');
|
|
3209
|
+
});
|
|
3210
|
+
})
|
|
3211
|
+
});
|
|
3212
|
+
}).filter(function (config) {
|
|
3213
|
+
return config.actions.length > 0;
|
|
3214
|
+
});
|
|
3215
|
+
if (strategyConfigs.length) {
|
|
3216
|
+
_context23.next = 28;
|
|
3217
|
+
break;
|
|
3218
|
+
}
|
|
3219
|
+
return _context23.abrupt("return");
|
|
3220
|
+
case 28:
|
|
3221
|
+
cartItems = this.getOrderProducts().map(function (item) {
|
|
3222
|
+
return {
|
|
3223
|
+
product_id: Number(item.product_id),
|
|
3224
|
+
quantity: Number(item.num)
|
|
3225
|
+
};
|
|
3226
|
+
}).filter(function (item) {
|
|
3227
|
+
return Number.isFinite(item.product_id) && item.product_id > 0 && Number.isFinite(item.quantity) && item.quantity > 0;
|
|
3228
|
+
});
|
|
3229
|
+
result = new ItemRuleEvaluator().evaluate({
|
|
3230
|
+
strategyConfigs: strategyConfigs,
|
|
3231
|
+
cartItems: cartItems,
|
|
3232
|
+
// Fixed-quantity rules do not consume pax; no customer headcount is collected.
|
|
3233
|
+
pax: {
|
|
3234
|
+
total: 0,
|
|
3235
|
+
adult: 0,
|
|
3236
|
+
child: 0
|
|
3237
|
+
},
|
|
3238
|
+
channel: channel,
|
|
3239
|
+
submissionIndex: 0,
|
|
3240
|
+
custom: _objectSpread(_objectSpread({}, runtimeConfig.custom), {}, {
|
|
3241
|
+
businessCode: businessCode
|
|
3242
|
+
})
|
|
3243
|
+
});
|
|
3244
|
+
if (!result.rawResults.some(function (evaluation) {
|
|
3245
|
+
return !evaluation.success;
|
|
3246
|
+
})) {
|
|
3247
|
+
_context23.next = 32;
|
|
3248
|
+
break;
|
|
3249
|
+
}
|
|
3250
|
+
throw new Error('Unable to validate required product rules. Please try again.');
|
|
3251
|
+
case 32:
|
|
3252
|
+
if (result.allPassed) {
|
|
3253
|
+
_context23.next = 36;
|
|
3254
|
+
break;
|
|
3255
|
+
}
|
|
3256
|
+
error = new Error(((_result$failedChecks$ = result.failedChecks[0]) === null || _result$failedChecks$ === void 0 ? void 0 : _result$failedChecks$.validationMessage) || 'Please select the required product before checkout.');
|
|
3257
|
+
Object.assign(error, {
|
|
3258
|
+
code: 'REQUIRED_PRODUCT_MISSING',
|
|
3259
|
+
failures: result.failedChecks
|
|
3260
|
+
});
|
|
3261
|
+
throw error;
|
|
3262
|
+
case 36:
|
|
3263
|
+
case "end":
|
|
3264
|
+
return _context23.stop();
|
|
3265
|
+
}
|
|
3266
|
+
}, _callee23, this);
|
|
3267
|
+
}));
|
|
3268
|
+
function validateRequiredProducts() {
|
|
3269
|
+
return _validateRequiredProducts.apply(this, arguments);
|
|
3270
|
+
}
|
|
3271
|
+
return validateRequiredProducts;
|
|
3272
|
+
}())
|
|
3273
|
+
}, {
|
|
3274
|
+
key: "submitSalesOrder",
|
|
3275
|
+
value: function () {
|
|
3276
|
+
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(params) {
|
|
3277
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
3278
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
3279
|
+
case 0:
|
|
3280
|
+
_context24.next = 2;
|
|
3281
|
+
return this.validateRequiredProducts();
|
|
3282
|
+
case 2:
|
|
3283
|
+
return _context24.abrupt("return", _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "submitSalesOrder", this).call(this, params));
|
|
3284
|
+
case 3:
|
|
3285
|
+
case "end":
|
|
3286
|
+
return _context24.stop();
|
|
3287
|
+
}
|
|
3288
|
+
}, _callee24, this);
|
|
3289
|
+
}));
|
|
3290
|
+
function submitSalesOrder(_x14) {
|
|
3291
|
+
return _submitSalesOrder.apply(this, arguments);
|
|
3292
|
+
}
|
|
3293
|
+
return submitSalesOrder;
|
|
3129
3294
|
}()
|
|
3130
3295
|
}, {
|
|
3131
3296
|
key: "ensureAllergyItemRuleConfigsLoaded",
|
|
3132
3297
|
value: function () {
|
|
3133
|
-
var _ensureAllergyItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3298
|
+
var _ensureAllergyItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
|
|
3134
3299
|
var _this9 = this;
|
|
3135
|
-
return _regeneratorRuntime().wrap(function
|
|
3136
|
-
while (1) switch (
|
|
3300
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
3301
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
3137
3302
|
case 0:
|
|
3138
3303
|
if (!(this.allergyItemRuleConfigs.length > 0)) {
|
|
3139
|
-
|
|
3304
|
+
_context26.next = 2;
|
|
3140
3305
|
break;
|
|
3141
3306
|
}
|
|
3142
|
-
return
|
|
3307
|
+
return _context26.abrupt("return", this.allergyItemRuleConfigs);
|
|
3143
3308
|
case 2:
|
|
3144
3309
|
if (!this.allergyItemRuleConfigsPromise) {
|
|
3145
|
-
|
|
3310
|
+
_context26.next = 4;
|
|
3146
3311
|
break;
|
|
3147
3312
|
}
|
|
3148
|
-
return
|
|
3313
|
+
return _context26.abrupt("return", this.allergyItemRuleConfigsPromise);
|
|
3149
3314
|
case 4:
|
|
3150
|
-
this.allergyItemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3315
|
+
this.allergyItemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
|
|
3151
3316
|
var _this9$otherParams;
|
|
3152
3317
|
var staticConfigs, openData, enabled, strategyModelIds, loaded;
|
|
3153
|
-
return _regeneratorRuntime().wrap(function
|
|
3154
|
-
while (1) switch (
|
|
3318
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
3319
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
3155
3320
|
case 0:
|
|
3156
3321
|
staticConfigs = normalizeItemRuleStrategyConfigs((_this9$otherParams = _this9.otherParams) === null || _this9$otherParams === void 0 || (_this9$otherParams = _this9$otherParams.itemRule) === null || _this9$otherParams === void 0 ? void 0 : _this9$otherParams.strategyConfigs);
|
|
3157
3322
|
if (!(staticConfigs.length > 0)) {
|
|
3158
|
-
|
|
3323
|
+
_context25.next = 5;
|
|
3159
3324
|
break;
|
|
3160
3325
|
}
|
|
3161
3326
|
_this9.allergyItemRuleConfigs = staticConfigs;
|
|
3162
3327
|
_this9.allergyItemRuleEvaluator.setStrategyConfigs(staticConfigs);
|
|
3163
|
-
return
|
|
3328
|
+
return _context25.abrupt("return", staticConfigs);
|
|
3164
3329
|
case 5:
|
|
3165
|
-
|
|
3330
|
+
_context25.next = 7;
|
|
3166
3331
|
return _this9.getOpenData();
|
|
3167
3332
|
case 7:
|
|
3168
|
-
openData =
|
|
3333
|
+
openData = _context25.sent;
|
|
3169
3334
|
enabled = toConfiguredBoolean(openData === null || openData === void 0 ? void 0 : openData['sale.enable_item_rules']);
|
|
3170
3335
|
strategyModelIds = normalizePositiveIntegerList(openData === null || openData === void 0 ? void 0 : openData['sale.enabled_item_rules']);
|
|
3171
3336
|
if (!(!enabled || !strategyModelIds.length)) {
|
|
3172
|
-
|
|
3337
|
+
_context25.next = 13;
|
|
3173
3338
|
break;
|
|
3174
3339
|
}
|
|
3175
3340
|
_this9.allergyItemRuleEvaluator.setStrategyConfigs([]);
|
|
3176
|
-
return
|
|
3341
|
+
return _context25.abrupt("return", []);
|
|
3177
3342
|
case 13:
|
|
3178
|
-
|
|
3343
|
+
_context25.next = 15;
|
|
3179
3344
|
return _this9.fetchAllergyItemRuleConfigs(strategyModelIds);
|
|
3180
3345
|
case 15:
|
|
3181
|
-
loaded =
|
|
3346
|
+
loaded = _context25.sent;
|
|
3182
3347
|
_this9.allergyItemRuleConfigs = loaded;
|
|
3183
3348
|
_this9.allergyItemRuleEvaluator.setStrategyConfigs(loaded);
|
|
3184
|
-
return
|
|
3349
|
+
return _context25.abrupt("return", loaded);
|
|
3185
3350
|
case 19:
|
|
3186
3351
|
case "end":
|
|
3187
|
-
return
|
|
3352
|
+
return _context25.stop();
|
|
3188
3353
|
}
|
|
3189
|
-
},
|
|
3354
|
+
}, _callee25);
|
|
3190
3355
|
}))().catch(function () {
|
|
3191
3356
|
return [];
|
|
3192
3357
|
});
|
|
3193
|
-
return
|
|
3358
|
+
return _context26.abrupt("return", this.allergyItemRuleConfigsPromise);
|
|
3194
3359
|
case 6:
|
|
3195
3360
|
case "end":
|
|
3196
|
-
return
|
|
3361
|
+
return _context26.stop();
|
|
3197
3362
|
}
|
|
3198
|
-
},
|
|
3363
|
+
}, _callee26, this);
|
|
3199
3364
|
}));
|
|
3200
3365
|
function ensureAllergyItemRuleConfigsLoaded() {
|
|
3201
3366
|
return _ensureAllergyItemRuleConfigsLoaded.apply(this, arguments);
|
|
@@ -3209,51 +3374,51 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3209
3374
|
}, {
|
|
3210
3375
|
key: "resolveProductAllergyRequirement",
|
|
3211
3376
|
value: (function () {
|
|
3212
|
-
var _resolveProductAllergyRequirement = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3213
|
-
var _this$
|
|
3377
|
+
var _resolveProductAllergyRequirement = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
|
|
3378
|
+
var _this$otherParams27, _this$getOrderProduct, _runtimePax$total, _runtimePax$adult, _runtimePax$child, _ref39, _runtimeConfig$servic, _this$otherParams28, _ref40, _ref41, _params$channel, _this$otherParams29, _this$otherParams30, _runtimeConfig$submis;
|
|
3214
3379
|
var productId, strategyConfigs, productVariantId, runtimeConfig, runtimePax, cartItems;
|
|
3215
|
-
return _regeneratorRuntime().wrap(function
|
|
3216
|
-
while (1) switch (
|
|
3380
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
3381
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
3217
3382
|
case 0:
|
|
3218
3383
|
productId = normalizePositiveInteger(params.productId);
|
|
3219
3384
|
if (productId) {
|
|
3220
|
-
|
|
3385
|
+
_context27.next = 3;
|
|
3221
3386
|
break;
|
|
3222
3387
|
}
|
|
3223
|
-
return
|
|
3388
|
+
return _context27.abrupt("return", null);
|
|
3224
3389
|
case 3:
|
|
3225
|
-
|
|
3390
|
+
_context27.next = 5;
|
|
3226
3391
|
return this.ensureAllergyItemRuleConfigsLoaded();
|
|
3227
3392
|
case 5:
|
|
3228
|
-
strategyConfigs =
|
|
3393
|
+
strategyConfigs = _context27.sent;
|
|
3229
3394
|
if (strategyConfigs.length) {
|
|
3230
|
-
|
|
3395
|
+
_context27.next = 8;
|
|
3231
3396
|
break;
|
|
3232
3397
|
}
|
|
3233
|
-
return
|
|
3398
|
+
return _context27.abrupt("return", null);
|
|
3234
3399
|
case 8:
|
|
3235
3400
|
productVariantId = normalizePositiveInteger(params.productVariantId);
|
|
3236
|
-
runtimeConfig = ((_this$
|
|
3401
|
+
runtimeConfig = ((_this$otherParams27 = this.otherParams) === null || _this$otherParams27 === void 0 ? void 0 : _this$otherParams27.itemRule) || {};
|
|
3237
3402
|
runtimePax = runtimeConfig.pax || {};
|
|
3238
3403
|
cartItems = (((_this$getOrderProduct = this.getOrderProducts) === null || _this$getOrderProduct === void 0 ? void 0 : _this$getOrderProduct.call(this)) || []).map(function (item) {
|
|
3239
|
-
var _item$product_id, _item$product_variant,
|
|
3404
|
+
var _item$product_id, _item$product_variant, _ref38, _item$num;
|
|
3240
3405
|
return {
|
|
3241
3406
|
product_id: Number((_item$product_id = item === null || item === void 0 ? void 0 : item.product_id) !== null && _item$product_id !== void 0 ? _item$product_id : item === null || item === void 0 ? void 0 : item.id),
|
|
3242
3407
|
product_variant_id: Number((_item$product_variant = item === null || item === void 0 ? void 0 : item.product_variant_id) !== null && _item$product_variant !== void 0 ? _item$product_variant : 0) || undefined,
|
|
3243
|
-
quantity: Number((
|
|
3408
|
+
quantity: Number((_ref38 = (_item$num = item === null || item === void 0 ? void 0 : item.num) !== null && _item$num !== void 0 ? _item$num : item === null || item === void 0 ? void 0 : item.quantity) !== null && _ref38 !== void 0 ? _ref38 : 0)
|
|
3244
3409
|
};
|
|
3245
3410
|
}).filter(function (item) {
|
|
3246
3411
|
return Number.isFinite(item.product_id) && item.product_id > 0 && Number.isFinite(item.quantity) && item.quantity > 0;
|
|
3247
3412
|
});
|
|
3248
|
-
return
|
|
3413
|
+
return _context27.abrupt("return", this.allergyItemRuleEvaluator.getAllergyRequirement({
|
|
3249
3414
|
pax: {
|
|
3250
3415
|
total: Number((_runtimePax$total = runtimePax.total) !== null && _runtimePax$total !== void 0 ? _runtimePax$total : 0) || 0,
|
|
3251
3416
|
adult: Number((_runtimePax$adult = runtimePax.adult) !== null && _runtimePax$adult !== void 0 ? _runtimePax$adult : 0) || 0,
|
|
3252
3417
|
child: Number((_runtimePax$child = runtimePax.child) !== null && _runtimePax$child !== void 0 ? _runtimePax$child : 0) || 0
|
|
3253
3418
|
},
|
|
3254
3419
|
cartItems: cartItems,
|
|
3255
|
-
serviceType: String((
|
|
3256
|
-
channel: String((
|
|
3420
|
+
serviceType: String((_ref39 = (_runtimeConfig$servic = runtimeConfig.serviceType) !== null && _runtimeConfig$servic !== void 0 ? _runtimeConfig$servic : (_this$otherParams28 = this.otherParams) === null || _this$otherParams28 === void 0 ? void 0 : _this$otherParams28.serviceType) !== null && _ref39 !== void 0 ? _ref39 : ''),
|
|
3421
|
+
channel: String((_ref40 = (_ref41 = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : (_this$otherParams29 = this.otherParams) === null || _this$otherParams29 === void 0 ? void 0 : _this$otherParams29.channel) !== null && _ref41 !== void 0 ? _ref41 : (_this$otherParams30 = this.otherParams) === null || _this$otherParams30 === void 0 ? void 0 : _this$otherParams30.platform) !== null && _ref40 !== void 0 ? _ref40 : ''),
|
|
3257
3422
|
currentProduct: _objectSpread({
|
|
3258
3423
|
product_id: productId
|
|
3259
3424
|
}, productVariantId ? {
|
|
@@ -3265,11 +3430,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3265
3430
|
}));
|
|
3266
3431
|
case 13:
|
|
3267
3432
|
case "end":
|
|
3268
|
-
return
|
|
3433
|
+
return _context27.stop();
|
|
3269
3434
|
}
|
|
3270
|
-
},
|
|
3435
|
+
}, _callee27, this);
|
|
3271
3436
|
}));
|
|
3272
|
-
function resolveProductAllergyRequirement(
|
|
3437
|
+
function resolveProductAllergyRequirement(_x15) {
|
|
3273
3438
|
return _resolveProductAllergyRequirement.apply(this, arguments);
|
|
3274
3439
|
}
|
|
3275
3440
|
return resolveProductAllergyRequirement;
|
|
@@ -3283,27 +3448,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3283
3448
|
}, {
|
|
3284
3449
|
key: "getInvoiceLayoutConfig",
|
|
3285
3450
|
value: function () {
|
|
3286
|
-
var _getInvoiceLayoutConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3451
|
+
var _getInvoiceLayoutConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
|
|
3287
3452
|
var openData;
|
|
3288
|
-
return _regeneratorRuntime().wrap(function
|
|
3289
|
-
while (1) switch (
|
|
3453
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
3454
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
3290
3455
|
case 0:
|
|
3291
|
-
|
|
3456
|
+
_context28.next = 2;
|
|
3292
3457
|
return this.getOpenData();
|
|
3293
3458
|
case 2:
|
|
3294
|
-
openData =
|
|
3459
|
+
openData = _context28.sent;
|
|
3295
3460
|
if (!(!openData || !this.store.openData)) {
|
|
3296
|
-
|
|
3461
|
+
_context28.next = 5;
|
|
3297
3462
|
break;
|
|
3298
3463
|
}
|
|
3299
|
-
return
|
|
3464
|
+
return _context28.abrupt("return", getDefaultInvoiceLayoutConfig());
|
|
3300
3465
|
case 5:
|
|
3301
|
-
return
|
|
3466
|
+
return _context28.abrupt("return", this.store.openData.getInvoiceLayoutConfig());
|
|
3302
3467
|
case 6:
|
|
3303
3468
|
case "end":
|
|
3304
|
-
return
|
|
3469
|
+
return _context28.stop();
|
|
3305
3470
|
}
|
|
3306
|
-
},
|
|
3471
|
+
}, _callee28, this);
|
|
3307
3472
|
}));
|
|
3308
3473
|
function getInvoiceLayoutConfig() {
|
|
3309
3474
|
return _getInvoiceLayoutConfig.apply(this, arguments);
|
|
@@ -3313,27 +3478,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3313
3478
|
}, {
|
|
3314
3479
|
key: "getInvoiceTemplateSettings",
|
|
3315
3480
|
value: function () {
|
|
3316
|
-
var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3481
|
+
var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
3317
3482
|
var openData;
|
|
3318
|
-
return _regeneratorRuntime().wrap(function
|
|
3319
|
-
while (1) switch (
|
|
3483
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
3484
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
3320
3485
|
case 0:
|
|
3321
|
-
|
|
3486
|
+
_context29.next = 2;
|
|
3322
3487
|
return this.getOpenData();
|
|
3323
3488
|
case 2:
|
|
3324
|
-
openData =
|
|
3489
|
+
openData = _context29.sent;
|
|
3325
3490
|
if (!(!openData || !this.store.openData)) {
|
|
3326
|
-
|
|
3491
|
+
_context29.next = 5;
|
|
3327
3492
|
break;
|
|
3328
3493
|
}
|
|
3329
|
-
return
|
|
3494
|
+
return _context29.abrupt("return", getDefaultInvoiceTemplateSettings());
|
|
3330
3495
|
case 5:
|
|
3331
|
-
return
|
|
3496
|
+
return _context29.abrupt("return", this.store.openData.getInvoiceTemplateSettings());
|
|
3332
3497
|
case 6:
|
|
3333
3498
|
case "end":
|
|
3334
|
-
return
|
|
3499
|
+
return _context29.stop();
|
|
3335
3500
|
}
|
|
3336
|
-
},
|
|
3501
|
+
}, _callee29, this);
|
|
3337
3502
|
}));
|
|
3338
3503
|
function getInvoiceTemplateSettings() {
|
|
3339
3504
|
return _getInvoiceTemplateSettings.apply(this, arguments);
|
|
@@ -3343,9 +3508,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3343
3508
|
}, {
|
|
3344
3509
|
key: "isInvoiceOpenDataCacheCurrent",
|
|
3345
3510
|
value: function isInvoiceOpenDataCacheCurrent() {
|
|
3346
|
-
var _this$
|
|
3347
|
-
var businessCode = String(((_this$
|
|
3348
|
-
var channel = String(((_this$
|
|
3511
|
+
var _this$otherParams31, _this$otherParams32;
|
|
3512
|
+
var businessCode = String(((_this$otherParams31 = this.otherParams) === null || _this$otherParams31 === void 0 ? void 0 : _this$otherParams31.businessCode) || '').trim();
|
|
3513
|
+
var channel = String(((_this$otherParams32 = this.otherParams) === null || _this$otherParams32 === void 0 ? void 0 : _this$otherParams32.channel) || '').trim();
|
|
3349
3514
|
if (!businessCode || !channel) return false;
|
|
3350
3515
|
return this.openDataTarget === "".concat(businessCode, "+").concat(channel) && this.runtimeOpenDataScope === this.getRuntimeOpenDataScope();
|
|
3351
3516
|
}
|
|
@@ -3356,14 +3521,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3356
3521
|
}, {
|
|
3357
3522
|
key: "getProtocol",
|
|
3358
3523
|
value: (function () {
|
|
3359
|
-
var _getProtocol = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3524
|
+
var _getProtocol = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(policyId) {
|
|
3360
3525
|
var normalizedPolicyId, policyUrl;
|
|
3361
|
-
return _regeneratorRuntime().wrap(function
|
|
3362
|
-
while (1) switch (
|
|
3526
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
3527
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
3363
3528
|
case 0:
|
|
3364
3529
|
normalizedPolicyId = String(policyId !== null && policyId !== void 0 ? policyId : '').trim();
|
|
3365
3530
|
if (normalizedPolicyId) {
|
|
3366
|
-
|
|
3531
|
+
_context30.next = 3;
|
|
3367
3532
|
break;
|
|
3368
3533
|
}
|
|
3369
3534
|
throw new Error('[UnifiedBookingSales] getProtocol 需要 policyId');
|
|
@@ -3372,14 +3537,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3372
3537
|
if (this.otherParams.platform === 'kiosk' || this.otherParams.platform === 'pos' || this.otherParams.platform === 'shop') {
|
|
3373
3538
|
policyUrl = 'policy';
|
|
3374
3539
|
}
|
|
3375
|
-
return
|
|
3540
|
+
return _context30.abrupt("return", this.request.get("/".concat(policyUrl, "/").concat(encodeURIComponent(normalizedPolicyId))));
|
|
3376
3541
|
case 6:
|
|
3377
3542
|
case "end":
|
|
3378
|
-
return
|
|
3543
|
+
return _context30.stop();
|
|
3379
3544
|
}
|
|
3380
|
-
},
|
|
3545
|
+
}, _callee30, this);
|
|
3381
3546
|
}));
|
|
3382
|
-
function getProtocol(
|
|
3547
|
+
function getProtocol(_x16) {
|
|
3383
3548
|
return _getProtocol.apply(this, arguments);
|
|
3384
3549
|
}
|
|
3385
3550
|
return getProtocol;
|
|
@@ -3392,27 +3557,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3392
3557
|
}, {
|
|
3393
3558
|
key: "loadProducts",
|
|
3394
3559
|
value: (function () {
|
|
3395
|
-
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3560
|
+
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
|
|
3396
3561
|
var params,
|
|
3397
3562
|
options,
|
|
3398
3563
|
schedule_date,
|
|
3399
3564
|
schedule_datetime,
|
|
3400
3565
|
result,
|
|
3401
|
-
|
|
3402
|
-
return _regeneratorRuntime().wrap(function
|
|
3403
|
-
while (1) switch (
|
|
3566
|
+
_args31 = arguments;
|
|
3567
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
3568
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
3404
3569
|
case 0:
|
|
3405
|
-
params =
|
|
3406
|
-
options =
|
|
3570
|
+
params = _args31.length > 0 && _args31[0] !== undefined ? _args31[0] : {};
|
|
3571
|
+
options = _args31.length > 1 ? _args31[1] : undefined;
|
|
3407
3572
|
if (this.store.products) {
|
|
3408
|
-
|
|
3573
|
+
_context31.next = 4;
|
|
3409
3574
|
break;
|
|
3410
3575
|
}
|
|
3411
3576
|
throw new Error('[UnifiedBookingSales] products 模块未初始化');
|
|
3412
3577
|
case 4:
|
|
3413
3578
|
schedule_date = params.schedule_date || dayjs().format('YYYY-MM-DD');
|
|
3414
3579
|
schedule_datetime = params.schedule_datetime || "".concat(schedule_date, " ").concat(dayjs().format('HH:mm:ss'));
|
|
3415
|
-
|
|
3580
|
+
_context31.next = 8;
|
|
3416
3581
|
return this.store.products.loadProducts(_objectSpread(_objectSpread({
|
|
3417
3582
|
with_count: ['bundleGroup', 'optionGroup'],
|
|
3418
3583
|
with_schedule: 1
|
|
@@ -3422,17 +3587,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3422
3587
|
cacheId: this.cacheId
|
|
3423
3588
|
}), options);
|
|
3424
3589
|
case 8:
|
|
3425
|
-
result =
|
|
3590
|
+
result = _context31.sent;
|
|
3426
3591
|
this.unifiedProductCatalog = Array.isArray(result) ? _toConsumableArray(result) : [];
|
|
3427
|
-
|
|
3592
|
+
_context31.next = 12;
|
|
3428
3593
|
return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), result);
|
|
3429
3594
|
case 12:
|
|
3430
|
-
return
|
|
3595
|
+
return _context31.abrupt("return", result);
|
|
3431
3596
|
case 13:
|
|
3432
3597
|
case "end":
|
|
3433
|
-
return
|
|
3598
|
+
return _context31.stop();
|
|
3434
3599
|
}
|
|
3435
|
-
},
|
|
3600
|
+
}, _callee31, this);
|
|
3436
3601
|
}));
|
|
3437
3602
|
function loadProducts() {
|
|
3438
3603
|
return _loadProducts.apply(this, arguments);
|
|
@@ -3442,25 +3607,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3442
3607
|
}, {
|
|
3443
3608
|
key: "queryProducts",
|
|
3444
3609
|
value: function () {
|
|
3445
|
-
var _queryProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3610
|
+
var _queryProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
|
|
3446
3611
|
var params,
|
|
3447
|
-
|
|
3448
|
-
return _regeneratorRuntime().wrap(function
|
|
3449
|
-
while (1) switch (
|
|
3612
|
+
_args32 = arguments;
|
|
3613
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
3614
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
3450
3615
|
case 0:
|
|
3451
|
-
params =
|
|
3616
|
+
params = _args32.length > 0 && _args32[0] !== undefined ? _args32[0] : {};
|
|
3452
3617
|
if (this.store.products) {
|
|
3453
|
-
|
|
3618
|
+
_context32.next = 3;
|
|
3454
3619
|
break;
|
|
3455
3620
|
}
|
|
3456
3621
|
throw new Error('[UnifiedBookingSales] products 模块未初始化');
|
|
3457
3622
|
case 3:
|
|
3458
|
-
return
|
|
3623
|
+
return _context32.abrupt("return", this.store.products.queryProducts(params));
|
|
3459
3624
|
case 4:
|
|
3460
3625
|
case "end":
|
|
3461
|
-
return
|
|
3626
|
+
return _context32.stop();
|
|
3462
3627
|
}
|
|
3463
|
-
},
|
|
3628
|
+
}, _callee32, this);
|
|
3464
3629
|
}));
|
|
3465
3630
|
function queryProducts() {
|
|
3466
3631
|
return _queryProducts.apply(this, arguments);
|
|
@@ -3470,24 +3635,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3470
3635
|
}, {
|
|
3471
3636
|
key: "loadScheduleAvailableDate",
|
|
3472
3637
|
value: (function () {
|
|
3473
|
-
var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3474
|
-
return _regeneratorRuntime().wrap(function
|
|
3475
|
-
while (1) switch (
|
|
3638
|
+
var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
|
|
3639
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
3640
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
3476
3641
|
case 0:
|
|
3477
3642
|
if (this.store.schedule) {
|
|
3478
|
-
|
|
3643
|
+
_context33.next = 2;
|
|
3479
3644
|
break;
|
|
3480
3645
|
}
|
|
3481
3646
|
throw new Error('[UnifiedBookingSales] schedule 模块未初始化');
|
|
3482
3647
|
case 2:
|
|
3483
|
-
return
|
|
3648
|
+
return _context33.abrupt("return", this.store.schedule.loadScheduleAvailableDate(params));
|
|
3484
3649
|
case 3:
|
|
3485
3650
|
case "end":
|
|
3486
|
-
return
|
|
3651
|
+
return _context33.stop();
|
|
3487
3652
|
}
|
|
3488
|
-
},
|
|
3653
|
+
}, _callee33, this);
|
|
3489
3654
|
}));
|
|
3490
|
-
function loadScheduleAvailableDate(
|
|
3655
|
+
function loadScheduleAvailableDate(_x17) {
|
|
3491
3656
|
return _loadScheduleAvailableDate.apply(this, arguments);
|
|
3492
3657
|
}
|
|
3493
3658
|
return loadScheduleAvailableDate;
|
|
@@ -3501,15 +3666,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3501
3666
|
}, {
|
|
3502
3667
|
key: "loadProductsByScheduleDate",
|
|
3503
3668
|
value: (function () {
|
|
3504
|
-
var _loadProductsByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3669
|
+
var _loadProductsByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(params) {
|
|
3505
3670
|
var _this$store$schedule$, _this$store$schedule, _this$store$schedule$2, _this$store$schedule2, _this$store$schedule$3, _this$store$schedule3, _this$store$schedule$4, _this$store$schedule4;
|
|
3506
3671
|
var date, custom_page_id, channel, product_ids, productLoadParams, cachedDates, hasCachedDate, hasOtherProducts, scheduleDate, productIdFilter, availableProductIds, products, fallbackProducts, _iterator2, _step2, productId, result;
|
|
3507
|
-
return _regeneratorRuntime().wrap(function
|
|
3508
|
-
while (1) switch (
|
|
3672
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
3673
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
3509
3674
|
case 0:
|
|
3510
3675
|
date = params.date, custom_page_id = params.custom_page_id, channel = params.channel, product_ids = params.product_ids, productLoadParams = _objectWithoutProperties(params, _excluded);
|
|
3511
3676
|
if (this.store.schedule) {
|
|
3512
|
-
|
|
3677
|
+
_context34.next = 3;
|
|
3513
3678
|
break;
|
|
3514
3679
|
}
|
|
3515
3680
|
throw new Error('[UnifiedBookingSales] schedule 模块未初始化');
|
|
@@ -3520,10 +3685,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3520
3685
|
});
|
|
3521
3686
|
hasOtherProducts = (((_this$store$schedule$2 = (_this$store$schedule2 = this.store.schedule).getOtherProductsIds) === null || _this$store$schedule$2 === void 0 ? void 0 : _this$store$schedule$2.call(_this$store$schedule2)) || []).length > 0;
|
|
3522
3687
|
if (!(!hasCachedDate && !hasOtherProducts)) {
|
|
3523
|
-
|
|
3688
|
+
_context34.next = 9;
|
|
3524
3689
|
break;
|
|
3525
3690
|
}
|
|
3526
|
-
|
|
3691
|
+
_context34.next = 9;
|
|
3527
3692
|
return this.loadScheduleAvailableDate({
|
|
3528
3693
|
startDate: date,
|
|
3529
3694
|
endDate: date,
|
|
@@ -3543,45 +3708,45 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3543
3708
|
return !productIdFilter || productIdFilter.has(String(id));
|
|
3544
3709
|
});
|
|
3545
3710
|
if (availableProductIds.length) {
|
|
3546
|
-
|
|
3711
|
+
_context34.next = 17;
|
|
3547
3712
|
break;
|
|
3548
3713
|
}
|
|
3549
3714
|
this.unifiedProductCatalog = [];
|
|
3550
|
-
|
|
3715
|
+
_context34.next = 16;
|
|
3551
3716
|
return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), []);
|
|
3552
3717
|
case 16:
|
|
3553
|
-
return
|
|
3718
|
+
return _context34.abrupt("return", []);
|
|
3554
3719
|
case 17:
|
|
3555
|
-
|
|
3720
|
+
_context34.next = 19;
|
|
3556
3721
|
return this.loadProducts(_objectSpread(_objectSpread({}, productLoadParams), {}, {
|
|
3557
3722
|
product_ids: availableProductIds,
|
|
3558
3723
|
schedule_date: date
|
|
3559
3724
|
}));
|
|
3560
3725
|
case 19:
|
|
3561
|
-
products =
|
|
3726
|
+
products = _context34.sent;
|
|
3562
3727
|
if (!(products.length || availableProductIds.length <= 1)) {
|
|
3563
|
-
|
|
3728
|
+
_context34.next = 22;
|
|
3564
3729
|
break;
|
|
3565
3730
|
}
|
|
3566
|
-
return
|
|
3731
|
+
return _context34.abrupt("return", products);
|
|
3567
3732
|
case 22:
|
|
3568
3733
|
fallbackProducts = [];
|
|
3569
3734
|
_iterator2 = _createForOfIteratorHelper(availableProductIds);
|
|
3570
|
-
|
|
3735
|
+
_context34.prev = 24;
|
|
3571
3736
|
_iterator2.s();
|
|
3572
3737
|
case 26:
|
|
3573
3738
|
if ((_step2 = _iterator2.n()).done) {
|
|
3574
|
-
|
|
3739
|
+
_context34.next = 34;
|
|
3575
3740
|
break;
|
|
3576
3741
|
}
|
|
3577
3742
|
productId = _step2.value;
|
|
3578
|
-
|
|
3743
|
+
_context34.next = 30;
|
|
3579
3744
|
return this.loadProducts(_objectSpread(_objectSpread({}, productLoadParams), {}, {
|
|
3580
3745
|
product_ids: [productId],
|
|
3581
3746
|
schedule_date: date
|
|
3582
3747
|
}));
|
|
3583
3748
|
case 30:
|
|
3584
|
-
result =
|
|
3749
|
+
result = _context34.sent;
|
|
3585
3750
|
result.forEach(function (product) {
|
|
3586
3751
|
var _id;
|
|
3587
3752
|
var id = (_id = product === null || product === void 0 ? void 0 : product.id) !== null && _id !== void 0 ? _id : product === null || product === void 0 ? void 0 : product.product_id;
|
|
@@ -3593,32 +3758,32 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3593
3758
|
}
|
|
3594
3759
|
});
|
|
3595
3760
|
case 32:
|
|
3596
|
-
|
|
3761
|
+
_context34.next = 26;
|
|
3597
3762
|
break;
|
|
3598
3763
|
case 34:
|
|
3599
|
-
|
|
3764
|
+
_context34.next = 39;
|
|
3600
3765
|
break;
|
|
3601
3766
|
case 36:
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
_iterator2.e(
|
|
3767
|
+
_context34.prev = 36;
|
|
3768
|
+
_context34.t0 = _context34["catch"](24);
|
|
3769
|
+
_iterator2.e(_context34.t0);
|
|
3605
3770
|
case 39:
|
|
3606
|
-
|
|
3771
|
+
_context34.prev = 39;
|
|
3607
3772
|
_iterator2.f();
|
|
3608
|
-
return
|
|
3773
|
+
return _context34.finish(39);
|
|
3609
3774
|
case 42:
|
|
3610
3775
|
this.unifiedProductCatalog = [].concat(fallbackProducts);
|
|
3611
|
-
|
|
3776
|
+
_context34.next = 45;
|
|
3612
3777
|
return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), fallbackProducts);
|
|
3613
3778
|
case 45:
|
|
3614
|
-
return
|
|
3779
|
+
return _context34.abrupt("return", fallbackProducts);
|
|
3615
3780
|
case 46:
|
|
3616
3781
|
case "end":
|
|
3617
|
-
return
|
|
3782
|
+
return _context34.stop();
|
|
3618
3783
|
}
|
|
3619
|
-
},
|
|
3784
|
+
}, _callee34, this, [[24, 36, 39, 42]]);
|
|
3620
3785
|
}));
|
|
3621
|
-
function loadProductsByScheduleDate(
|
|
3786
|
+
function loadProductsByScheduleDate(_x18) {
|
|
3622
3787
|
return _loadProductsByScheduleDate.apply(this, arguments);
|
|
3623
3788
|
}
|
|
3624
3789
|
return loadProductsByScheduleDate;
|
|
@@ -3671,7 +3836,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3671
3836
|
}, {
|
|
3672
3837
|
key: "applyPlannerDiscounts",
|
|
3673
3838
|
value: (function () {
|
|
3674
|
-
var _applyPlannerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3839
|
+
var _applyPlannerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
|
|
3675
3840
|
var _params$customerId;
|
|
3676
3841
|
var params,
|
|
3677
3842
|
tempOrder,
|
|
@@ -3688,24 +3853,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3688
3853
|
discount,
|
|
3689
3854
|
discountId,
|
|
3690
3855
|
nextTempOrder,
|
|
3691
|
-
|
|
3692
|
-
return _regeneratorRuntime().wrap(function
|
|
3693
|
-
while (1) switch (
|
|
3856
|
+
_args35 = arguments;
|
|
3857
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
3858
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
3694
3859
|
case 0:
|
|
3695
|
-
params =
|
|
3860
|
+
params = _args35.length > 0 && _args35[0] !== undefined ? _args35[0] : {};
|
|
3696
3861
|
tempOrder = this.getTempOrder();
|
|
3697
3862
|
requestedCustomerId = (_params$customerId = params.customerId) !== null && _params$customerId !== void 0 ? _params$customerId : tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.customer_id;
|
|
3698
3863
|
parsedCustomerId = Number(requestedCustomerId);
|
|
3699
3864
|
customerId = Number.isFinite(parsedCustomerId) && parsedCustomerId > 1 ? parsedCustomerId : null;
|
|
3700
|
-
|
|
3865
|
+
_context35.next = 7;
|
|
3701
3866
|
return this.getSummary();
|
|
3702
3867
|
case 7:
|
|
3703
|
-
summaryBefore =
|
|
3868
|
+
summaryBefore = _context35.sent;
|
|
3704
3869
|
if (customerId) {
|
|
3705
|
-
|
|
3870
|
+
_context35.next = 10;
|
|
3706
3871
|
break;
|
|
3707
3872
|
}
|
|
3708
|
-
return
|
|
3873
|
+
return _context35.abrupt("return", buildPlannerDiscountResult({
|
|
3709
3874
|
customerId: null,
|
|
3710
3875
|
discountList: this.getDiscountList(),
|
|
3711
3876
|
products: (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || [],
|
|
@@ -3714,7 +3879,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3714
3879
|
status: 'no_customer'
|
|
3715
3880
|
}));
|
|
3716
3881
|
case 10:
|
|
3717
|
-
|
|
3882
|
+
_context35.next = 12;
|
|
3718
3883
|
return this.loadDiscountConfig({
|
|
3719
3884
|
customerId: customerId,
|
|
3720
3885
|
action: 'create'
|
|
@@ -3726,7 +3891,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3726
3891
|
return String((_resolvePlannerDiscou = resolvePlannerDiscountId(discount)) !== null && _resolvePlannerDiscou !== void 0 ? _resolvePlannerDiscou : '') === String(preferredDiscountId);
|
|
3727
3892
|
});
|
|
3728
3893
|
if (!preferredDiscount) {
|
|
3729
|
-
|
|
3894
|
+
_context35.next = 40;
|
|
3730
3895
|
break;
|
|
3731
3896
|
}
|
|
3732
3897
|
// A requested card is an explicit UI choice, not a best-effort preference. Clear prior
|
|
@@ -3738,98 +3903,98 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3738
3903
|
return discount.isSelected === true && String((_resolvePlannerDiscou2 = resolvePlannerDiscountId(discount)) !== null && _resolvePlannerDiscou2 !== void 0 ? _resolvePlannerDiscou2 : '') !== String(preferredId);
|
|
3739
3904
|
});
|
|
3740
3905
|
_iterator3 = _createForOfIteratorHelper(selectedOtherDiscounts);
|
|
3741
|
-
|
|
3906
|
+
_context35.prev = 18;
|
|
3742
3907
|
_iterator3.s();
|
|
3743
3908
|
case 20:
|
|
3744
3909
|
if ((_step3 = _iterator3.n()).done) {
|
|
3745
|
-
|
|
3910
|
+
_context35.next = 28;
|
|
3746
3911
|
break;
|
|
3747
3912
|
}
|
|
3748
3913
|
discount = _step3.value;
|
|
3749
3914
|
discountId = Number(resolvePlannerDiscountId(discount));
|
|
3750
3915
|
if (!Number.isFinite(discountId)) {
|
|
3751
|
-
|
|
3916
|
+
_context35.next = 26;
|
|
3752
3917
|
break;
|
|
3753
3918
|
}
|
|
3754
|
-
|
|
3919
|
+
_context35.next = 26;
|
|
3755
3920
|
return this.setDiscountSelected({
|
|
3756
3921
|
discountId: discountId,
|
|
3757
3922
|
isSelected: false
|
|
3758
3923
|
});
|
|
3759
3924
|
case 26:
|
|
3760
|
-
|
|
3925
|
+
_context35.next = 20;
|
|
3761
3926
|
break;
|
|
3762
3927
|
case 28:
|
|
3763
|
-
|
|
3928
|
+
_context35.next = 33;
|
|
3764
3929
|
break;
|
|
3765
3930
|
case 30:
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
_iterator3.e(
|
|
3931
|
+
_context35.prev = 30;
|
|
3932
|
+
_context35.t0 = _context35["catch"](18);
|
|
3933
|
+
_iterator3.e(_context35.t0);
|
|
3769
3934
|
case 33:
|
|
3770
|
-
|
|
3935
|
+
_context35.prev = 33;
|
|
3771
3936
|
_iterator3.f();
|
|
3772
|
-
return
|
|
3937
|
+
return _context35.finish(33);
|
|
3773
3938
|
case 36:
|
|
3774
|
-
|
|
3939
|
+
_context35.next = 38;
|
|
3775
3940
|
return this.setDiscountSelected({
|
|
3776
3941
|
discountId: Number(preferredId),
|
|
3777
3942
|
isSelected: true
|
|
3778
3943
|
});
|
|
3779
3944
|
case 38:
|
|
3780
|
-
|
|
3945
|
+
_context35.next = 49;
|
|
3781
3946
|
break;
|
|
3782
3947
|
case 40:
|
|
3783
3948
|
if (!(preferredDiscountId === undefined || preferredDiscountId === null)) {
|
|
3784
|
-
|
|
3949
|
+
_context35.next = 46;
|
|
3785
3950
|
break;
|
|
3786
3951
|
}
|
|
3787
3952
|
if (!(params.applyBestDiscount !== false)) {
|
|
3788
|
-
|
|
3953
|
+
_context35.next = 44;
|
|
3789
3954
|
break;
|
|
3790
3955
|
}
|
|
3791
|
-
|
|
3956
|
+
_context35.next = 44;
|
|
3792
3957
|
return this.bestDiscount();
|
|
3793
3958
|
case 44:
|
|
3794
|
-
|
|
3959
|
+
_context35.next = 49;
|
|
3795
3960
|
break;
|
|
3796
3961
|
case 46:
|
|
3797
3962
|
if (!(params.applyBestDiscount !== false)) {
|
|
3798
|
-
|
|
3963
|
+
_context35.next = 49;
|
|
3799
3964
|
break;
|
|
3800
3965
|
}
|
|
3801
|
-
|
|
3966
|
+
_context35.next = 49;
|
|
3802
3967
|
return this.bestDiscount();
|
|
3803
3968
|
case 49:
|
|
3804
3969
|
nextTempOrder = this.getTempOrder();
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3970
|
+
_context35.t1 = buildPlannerDiscountResult;
|
|
3971
|
+
_context35.t2 = customerId;
|
|
3972
|
+
_context35.t3 = this.getDiscountList();
|
|
3973
|
+
_context35.t4 = (nextTempOrder === null || nextTempOrder === void 0 ? void 0 : nextTempOrder.products) || [];
|
|
3974
|
+
_context35.t5 = summaryBefore;
|
|
3975
|
+
_context35.next = 57;
|
|
3811
3976
|
return this.getSummary();
|
|
3812
3977
|
case 57:
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
customerId:
|
|
3819
|
-
discountList:
|
|
3820
|
-
products:
|
|
3821
|
-
summaryBefore:
|
|
3822
|
-
summaryAfter:
|
|
3823
|
-
status:
|
|
3824
|
-
preferredDiscountId:
|
|
3825
|
-
preferredDiscountFound:
|
|
3978
|
+
_context35.t6 = _context35.sent;
|
|
3979
|
+
_context35.t7 = params.applyBestDiscount === false && !preferredDiscount ? 'loaded' : 'applied';
|
|
3980
|
+
_context35.t8 = preferredDiscountId;
|
|
3981
|
+
_context35.t9 = preferredDiscountId === undefined || preferredDiscountId === null ? undefined : Boolean(preferredDiscount);
|
|
3982
|
+
_context35.t10 = {
|
|
3983
|
+
customerId: _context35.t2,
|
|
3984
|
+
discountList: _context35.t3,
|
|
3985
|
+
products: _context35.t4,
|
|
3986
|
+
summaryBefore: _context35.t5,
|
|
3987
|
+
summaryAfter: _context35.t6,
|
|
3988
|
+
status: _context35.t7,
|
|
3989
|
+
preferredDiscountId: _context35.t8,
|
|
3990
|
+
preferredDiscountFound: _context35.t9
|
|
3826
3991
|
};
|
|
3827
|
-
return
|
|
3992
|
+
return _context35.abrupt("return", (0, _context35.t1)(_context35.t10));
|
|
3828
3993
|
case 63:
|
|
3829
3994
|
case "end":
|
|
3830
|
-
return
|
|
3995
|
+
return _context35.stop();
|
|
3831
3996
|
}
|
|
3832
|
-
},
|
|
3997
|
+
}, _callee35, this, [[18, 30, 33, 36]]);
|
|
3833
3998
|
}));
|
|
3834
3999
|
function applyPlannerDiscounts() {
|
|
3835
4000
|
return _applyPlannerDiscounts.apply(this, arguments);
|
|
@@ -3839,16 +4004,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3839
4004
|
}, {
|
|
3840
4005
|
key: "buildUnifiedOrderProduct",
|
|
3841
4006
|
value: function buildUnifiedOrderProduct(sourceProduct, ownershipKey, product) {
|
|
3842
|
-
var
|
|
4007
|
+
var _ref42, _sourceProduct$_exten, _sourceProduct$_exten2, _sourceProduct$metada, _sourceProduct$id, _ref43, _sourceProduct$produc, _ref44, _ref45, _sourceProduct$quanti, _sourceProduct$price, _ref46, _ref47, _sourceProduct$sellin;
|
|
3843
4008
|
var normalizedProductRaw = (product === null || product === void 0 ? void 0 : product.raw) || {};
|
|
3844
|
-
var quotationShelfId = (
|
|
4009
|
+
var quotationShelfId = (_ref42 = (_sourceProduct$_exten = (_sourceProduct$_exten2 = sourceProduct._extend) === null || _sourceProduct$_exten2 === void 0 ? void 0 : _sourceProduct$_exten2.quotation_shelf_id) !== null && _sourceProduct$_exten !== void 0 ? _sourceProduct$_exten : sourceProduct.quotation_shelf_id) !== null && _ref42 !== void 0 ? _ref42 : (_sourceProduct$metada = sourceProduct.metadata) === null || _sourceProduct$metada === void 0 ? void 0 : _sourceProduct$metada.quotation_shelf_id;
|
|
3845
4010
|
var orderProduct = this.transformBaseProductToOrderProduct({
|
|
3846
4011
|
payload: _objectSpread(_objectSpread({}, sourceProduct), {}, {
|
|
3847
4012
|
id: (_sourceProduct$id = sourceProduct.id) !== null && _sourceProduct$id !== void 0 ? _sourceProduct$id : product === null || product === void 0 ? void 0 : product.id,
|
|
3848
|
-
product_id: (
|
|
3849
|
-
quantity: (
|
|
4013
|
+
product_id: (_ref43 = (_sourceProduct$produc = sourceProduct.product_id) !== null && _sourceProduct$produc !== void 0 ? _sourceProduct$produc : sourceProduct.id) !== null && _ref43 !== void 0 ? _ref43 : product === null || product === void 0 ? void 0 : product.id,
|
|
4014
|
+
quantity: (_ref44 = (_ref45 = (_sourceProduct$quanti = sourceProduct.quantity) !== null && _sourceProduct$quanti !== void 0 ? _sourceProduct$quanti : sourceProduct.num) !== null && _ref45 !== void 0 ? _ref45 : product === null || product === void 0 ? void 0 : product.quantity) !== null && _ref44 !== void 0 ? _ref44 : 1,
|
|
3850
4015
|
price: (_sourceProduct$price = sourceProduct.price) !== null && _sourceProduct$price !== void 0 ? _sourceProduct$price : normalizedProductRaw.price,
|
|
3851
|
-
selling_price: (
|
|
4016
|
+
selling_price: (_ref46 = (_ref47 = (_sourceProduct$sellin = sourceProduct.selling_price) !== null && _sourceProduct$sellin !== void 0 ? _sourceProduct$sellin : sourceProduct.price) !== null && _ref47 !== void 0 ? _ref47 : normalizedProductRaw.selling_price) !== null && _ref46 !== void 0 ? _ref46 : normalizedProductRaw.price,
|
|
3852
4017
|
metadata: _objectSpread(_objectSpread({}, sourceProduct.metadata || {}), {}, _defineProperty({}, ownershipKey, true))
|
|
3853
4018
|
}),
|
|
3854
4019
|
sourceProduct: sourceProduct
|
|
@@ -3867,29 +4032,29 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3867
4032
|
}, {
|
|
3868
4033
|
key: "removeExistingStagedLines",
|
|
3869
4034
|
value: (function () {
|
|
3870
|
-
var _removeExistingStagedLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4035
|
+
var _removeExistingStagedLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(ownershipKey) {
|
|
3871
4036
|
var _this$getTempOrder2;
|
|
3872
4037
|
var existingLines;
|
|
3873
|
-
return _regeneratorRuntime().wrap(function
|
|
3874
|
-
while (1) switch (
|
|
4038
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
4039
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
3875
4040
|
case 0:
|
|
3876
4041
|
existingLines = (((_this$getTempOrder2 = this.getTempOrder()) === null || _this$getTempOrder2 === void 0 ? void 0 : _this$getTempOrder2.products) || []).filter(function (product) {
|
|
3877
4042
|
var _product$metadata5;
|
|
3878
4043
|
return (product === null || product === void 0 || (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5[ownershipKey]) === true;
|
|
3879
4044
|
});
|
|
3880
4045
|
if (!(existingLines.length > 0)) {
|
|
3881
|
-
|
|
4046
|
+
_context36.next = 4;
|
|
3882
4047
|
break;
|
|
3883
4048
|
}
|
|
3884
|
-
|
|
4049
|
+
_context36.next = 4;
|
|
3885
4050
|
return this.removeProductsFromOrder(existingLines.map(buildAvailabilityLineIdentity));
|
|
3886
4051
|
case 4:
|
|
3887
4052
|
case "end":
|
|
3888
|
-
return
|
|
4053
|
+
return _context36.stop();
|
|
3889
4054
|
}
|
|
3890
|
-
},
|
|
4055
|
+
}, _callee36, this);
|
|
3891
4056
|
}));
|
|
3892
|
-
function removeExistingStagedLines(
|
|
4057
|
+
function removeExistingStagedLines(_x19) {
|
|
3893
4058
|
return _removeExistingStagedLines.apply(this, arguments);
|
|
3894
4059
|
}
|
|
3895
4060
|
return removeExistingStagedLines;
|
|
@@ -3897,25 +4062,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3897
4062
|
}, {
|
|
3898
4063
|
key: "stageProducts",
|
|
3899
4064
|
value: function () {
|
|
3900
|
-
var _stageProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4065
|
+
var _stageProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params, ownershipKey) {
|
|
3901
4066
|
var _params$rawProducts;
|
|
3902
4067
|
var productIds, existingIds, missingIds, productIdSet, selectedProducts, _i2, _arr2, sourceProduct, productInput;
|
|
3903
|
-
return _regeneratorRuntime().wrap(function
|
|
3904
|
-
while (1) switch (
|
|
4068
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
4069
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
3905
4070
|
case 0:
|
|
3906
4071
|
productIds = params.productIds || [];
|
|
3907
4072
|
if (productIds.length) {
|
|
3908
|
-
|
|
4073
|
+
_context37.next = 3;
|
|
3909
4074
|
break;
|
|
3910
4075
|
}
|
|
3911
|
-
return
|
|
4076
|
+
return _context37.abrupt("return", this.getTempOrder());
|
|
3912
4077
|
case 3:
|
|
3913
4078
|
if (!((_params$rawProducts = params.rawProducts) !== null && _params$rawProducts !== void 0 && _params$rawProducts.length)) {
|
|
3914
|
-
|
|
4079
|
+
_context37.next = 7;
|
|
3915
4080
|
break;
|
|
3916
4081
|
}
|
|
3917
4082
|
this.unifiedProductCatalog = params.rawProducts;
|
|
3918
|
-
|
|
4083
|
+
_context37.next = 12;
|
|
3919
4084
|
break;
|
|
3920
4085
|
case 7:
|
|
3921
4086
|
existingIds = new Set((this.unifiedProductCatalog || []).map(function (product) {
|
|
@@ -3926,15 +4091,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3926
4091
|
return !existingIds.has(String(id));
|
|
3927
4092
|
});
|
|
3928
4093
|
if (!(missingIds.length || params.productLoadParams)) {
|
|
3929
|
-
|
|
4094
|
+
_context37.next = 12;
|
|
3930
4095
|
break;
|
|
3931
4096
|
}
|
|
3932
|
-
|
|
4097
|
+
_context37.next = 12;
|
|
3933
4098
|
return this.loadProducts(_objectSpread(_objectSpread({}, params.productLoadParams || {}), {}, {
|
|
3934
4099
|
product_ids: productIds.map(Number).filter(Number.isFinite)
|
|
3935
4100
|
}));
|
|
3936
4101
|
case 12:
|
|
3937
|
-
|
|
4102
|
+
_context37.next = 14;
|
|
3938
4103
|
return this.removeExistingStagedLines(ownershipKey);
|
|
3939
4104
|
case 14:
|
|
3940
4105
|
productIdSet = new Set(productIds.map(function (id) {
|
|
@@ -3947,30 +4112,30 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3947
4112
|
_i2 = 0, _arr2 = selectedProducts;
|
|
3948
4113
|
case 17:
|
|
3949
4114
|
if (!(_i2 < _arr2.length)) {
|
|
3950
|
-
|
|
4115
|
+
_context37.next = 26;
|
|
3951
4116
|
break;
|
|
3952
4117
|
}
|
|
3953
4118
|
sourceProduct = _arr2[_i2];
|
|
3954
4119
|
productInput = this.buildUnifiedOrderProduct(sourceProduct, ownershipKey);
|
|
3955
4120
|
if (!productInput) {
|
|
3956
|
-
|
|
4121
|
+
_context37.next = 23;
|
|
3957
4122
|
break;
|
|
3958
4123
|
}
|
|
3959
|
-
|
|
4124
|
+
_context37.next = 23;
|
|
3960
4125
|
return this.addProductToOrder(productInput);
|
|
3961
4126
|
case 23:
|
|
3962
4127
|
_i2++;
|
|
3963
|
-
|
|
4128
|
+
_context37.next = 17;
|
|
3964
4129
|
break;
|
|
3965
4130
|
case 26:
|
|
3966
|
-
return
|
|
4131
|
+
return _context37.abrupt("return", this.getTempOrder());
|
|
3967
4132
|
case 27:
|
|
3968
4133
|
case "end":
|
|
3969
|
-
return
|
|
4134
|
+
return _context37.stop();
|
|
3970
4135
|
}
|
|
3971
|
-
},
|
|
4136
|
+
}, _callee37, this);
|
|
3972
4137
|
}));
|
|
3973
|
-
function stageProducts(
|
|
4138
|
+
function stageProducts(_x20, _x21) {
|
|
3974
4139
|
return _stageProducts.apply(this, arguments);
|
|
3975
4140
|
}
|
|
3976
4141
|
return stageProducts;
|
|
@@ -3982,18 +4147,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3982
4147
|
}, {
|
|
3983
4148
|
key: "stageRetailProducts",
|
|
3984
4149
|
value: (function () {
|
|
3985
|
-
var _stageRetailProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3986
|
-
return _regeneratorRuntime().wrap(function
|
|
3987
|
-
while (1) switch (
|
|
4150
|
+
var _stageRetailProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(params) {
|
|
4151
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
4152
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
3988
4153
|
case 0:
|
|
3989
|
-
return
|
|
4154
|
+
return _context38.abrupt("return", this.stageProducts(params, 'unified_booking_sales_retail'));
|
|
3990
4155
|
case 1:
|
|
3991
4156
|
case "end":
|
|
3992
|
-
return
|
|
4157
|
+
return _context38.stop();
|
|
3993
4158
|
}
|
|
3994
|
-
},
|
|
4159
|
+
}, _callee38, this);
|
|
3995
4160
|
}));
|
|
3996
|
-
function stageRetailProducts(
|
|
4161
|
+
function stageRetailProducts(_x22) {
|
|
3997
4162
|
return _stageRetailProducts.apply(this, arguments);
|
|
3998
4163
|
}
|
|
3999
4164
|
return stageRetailProducts;
|
|
@@ -4007,20 +4172,20 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4007
4172
|
}, {
|
|
4008
4173
|
key: "addRetailProduct",
|
|
4009
4174
|
value: (function () {
|
|
4010
|
-
var _addRetailProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4011
|
-
var _params$quantity,
|
|
4175
|
+
var _addRetailProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(params) {
|
|
4176
|
+
var _params$quantity, _ref48, _params$productId, _params$product, _params$product2;
|
|
4012
4177
|
var quantity, productId, sourceProduct, products, orderProduct;
|
|
4013
|
-
return _regeneratorRuntime().wrap(function
|
|
4014
|
-
while (1) switch (
|
|
4178
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
4179
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
4015
4180
|
case 0:
|
|
4016
4181
|
quantity = Math.floor(Number((_params$quantity = params.quantity) !== null && _params$quantity !== void 0 ? _params$quantity : 1));
|
|
4017
4182
|
if (!(!Number.isFinite(quantity) || quantity <= 0)) {
|
|
4018
|
-
|
|
4183
|
+
_context39.next = 3;
|
|
4019
4184
|
break;
|
|
4020
4185
|
}
|
|
4021
4186
|
throw new Error('[UnifiedBookingSales] retail 商品数量必须大于 0');
|
|
4022
4187
|
case 3:
|
|
4023
|
-
productId = (
|
|
4188
|
+
productId = (_ref48 = (_params$productId = params.productId) !== null && _params$productId !== void 0 ? _params$productId : (_params$product = params.product) === null || _params$product === void 0 ? void 0 : _params$product.id) !== null && _ref48 !== void 0 ? _ref48 : (_params$product2 = params.product) === null || _params$product2 === void 0 ? void 0 : _params$product2.product_id;
|
|
4024
4189
|
sourceProduct = params.product;
|
|
4025
4190
|
if (!sourceProduct && productId !== undefined && productId !== null) {
|
|
4026
4191
|
sourceProduct = this.unifiedProductCatalog.find(function (product) {
|
|
@@ -4029,22 +4194,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4029
4194
|
});
|
|
4030
4195
|
}
|
|
4031
4196
|
if (!(!sourceProduct && productId !== undefined && productId !== null)) {
|
|
4032
|
-
|
|
4197
|
+
_context39.next = 11;
|
|
4033
4198
|
break;
|
|
4034
4199
|
}
|
|
4035
|
-
|
|
4200
|
+
_context39.next = 9;
|
|
4036
4201
|
return this.loadProducts(_objectSpread(_objectSpread({}, params.productLoadParams || {}), {}, {
|
|
4037
4202
|
product_ids: [Number(productId)].filter(Number.isFinite)
|
|
4038
4203
|
}));
|
|
4039
4204
|
case 9:
|
|
4040
|
-
products =
|
|
4205
|
+
products = _context39.sent;
|
|
4041
4206
|
sourceProduct = products.find(function (product) {
|
|
4042
4207
|
var _product$id4;
|
|
4043
4208
|
return String((_product$id4 = product.id) !== null && _product$id4 !== void 0 ? _product$id4 : product.product_id) === String(productId);
|
|
4044
4209
|
});
|
|
4045
4210
|
case 11:
|
|
4046
4211
|
if (sourceProduct) {
|
|
4047
|
-
|
|
4212
|
+
_context39.next = 13;
|
|
4048
4213
|
break;
|
|
4049
4214
|
}
|
|
4050
4215
|
throw new Error("[UnifiedBookingSales] \u672A\u627E\u5230\u96F6\u552E\u5546\u54C1 ".concat(String(productId !== null && productId !== void 0 ? productId : '')).trim());
|
|
@@ -4053,19 +4218,19 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4053
4218
|
quantity: quantity
|
|
4054
4219
|
}), 'unified_booking_sales_retail');
|
|
4055
4220
|
if (orderProduct) {
|
|
4056
|
-
|
|
4221
|
+
_context39.next = 16;
|
|
4057
4222
|
break;
|
|
4058
4223
|
}
|
|
4059
4224
|
throw new Error('[UnifiedBookingSales] 无法生成零售商品订单行');
|
|
4060
4225
|
case 16:
|
|
4061
|
-
return
|
|
4226
|
+
return _context39.abrupt("return", this.addProductToOrder(orderProduct));
|
|
4062
4227
|
case 17:
|
|
4063
4228
|
case "end":
|
|
4064
|
-
return
|
|
4229
|
+
return _context39.stop();
|
|
4065
4230
|
}
|
|
4066
|
-
},
|
|
4231
|
+
}, _callee39, this);
|
|
4067
4232
|
}));
|
|
4068
|
-
function addRetailProduct(
|
|
4233
|
+
function addRetailProduct(_x23) {
|
|
4069
4234
|
return _addRetailProduct.apply(this, arguments);
|
|
4070
4235
|
}
|
|
4071
4236
|
return addRetailProduct;
|
|
@@ -4267,46 +4432,46 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4267
4432
|
}, {
|
|
4268
4433
|
key: "loadAvailabilityProducts",
|
|
4269
4434
|
value: function () {
|
|
4270
|
-
var _loadAvailabilityProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4435
|
+
var _loadAvailabilityProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(params) {
|
|
4271
4436
|
var _prepare$catalogScope,
|
|
4272
4437
|
_prepare$catalogScope2,
|
|
4273
4438
|
_this11 = this,
|
|
4274
4439
|
_prepare$resourceIds;
|
|
4275
4440
|
var prepare, dateRange, explicitProductIds, rawProducts, _this$store$schedule$6, _this$store$schedule6, _this$store$schedule$7, _this$store$schedule7, dateSet, scheduleProductIds, productIds, normalized, productIdSet;
|
|
4276
|
-
return _regeneratorRuntime().wrap(function
|
|
4277
|
-
while (1) switch (
|
|
4441
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
4442
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
4278
4443
|
case 0:
|
|
4279
4444
|
prepare = params.prepare, dateRange = params.dateRange;
|
|
4280
4445
|
explicitProductIds = prepare.productIds || [];
|
|
4281
4446
|
rawProducts = [];
|
|
4282
4447
|
if (!Array.isArray(prepare.rawProducts)) {
|
|
4283
|
-
|
|
4448
|
+
_context40.next = 8;
|
|
4284
4449
|
break;
|
|
4285
4450
|
}
|
|
4286
4451
|
rawProducts = prepare.rawProducts;
|
|
4287
4452
|
this.unifiedProductCatalog = _toConsumableArray(rawProducts);
|
|
4288
|
-
|
|
4453
|
+
_context40.next = 34;
|
|
4289
4454
|
break;
|
|
4290
4455
|
case 8:
|
|
4291
4456
|
if (!(explicitProductIds.length > 0)) {
|
|
4292
|
-
|
|
4457
|
+
_context40.next = 14;
|
|
4293
4458
|
break;
|
|
4294
4459
|
}
|
|
4295
|
-
|
|
4460
|
+
_context40.next = 11;
|
|
4296
4461
|
return this.loadProducts({
|
|
4297
4462
|
product_ids: explicitProductIds,
|
|
4298
4463
|
schedule_date: dateRange.startDate
|
|
4299
4464
|
});
|
|
4300
4465
|
case 11:
|
|
4301
|
-
rawProducts =
|
|
4302
|
-
|
|
4466
|
+
rawProducts = _context40.sent;
|
|
4467
|
+
_context40.next = 34;
|
|
4303
4468
|
break;
|
|
4304
4469
|
case 14:
|
|
4305
4470
|
if (!(((_prepare$catalogScope = prepare.catalogScope) === null || _prepare$catalogScope === void 0 ? void 0 : _prepare$catalogScope.type) === 'schedule')) {
|
|
4306
|
-
|
|
4471
|
+
_context40.next = 30;
|
|
4307
4472
|
break;
|
|
4308
4473
|
}
|
|
4309
|
-
|
|
4474
|
+
_context40.next = 17;
|
|
4310
4475
|
return this.loadScheduleAvailableDate({
|
|
4311
4476
|
startDate: dateRange.startDate,
|
|
4312
4477
|
endDate: dateRange.endDate,
|
|
@@ -4322,44 +4487,44 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4322
4487
|
});
|
|
4323
4488
|
productIds = uniqueAvailabilityIds([].concat(_toConsumableArray(scheduleProductIds), _toConsumableArray(((_this$store$schedule$7 = (_this$store$schedule7 = this.store.schedule).getOtherProductsIds) === null || _this$store$schedule$7 === void 0 ? void 0 : _this$store$schedule$7.call(_this$store$schedule7)) || [])));
|
|
4324
4489
|
if (!(productIds.length > 0)) {
|
|
4325
|
-
|
|
4490
|
+
_context40.next = 27;
|
|
4326
4491
|
break;
|
|
4327
4492
|
}
|
|
4328
4493
|
assertAvailabilityCatalogProductIds(productIds, 'prepare.catalogScope.scheduleProductIds');
|
|
4329
|
-
|
|
4494
|
+
_context40.next = 24;
|
|
4330
4495
|
return this.loadProducts({
|
|
4331
4496
|
product_ids: productIds,
|
|
4332
4497
|
schedule_date: dateRange.startDate
|
|
4333
4498
|
});
|
|
4334
4499
|
case 24:
|
|
4335
|
-
rawProducts =
|
|
4336
|
-
|
|
4500
|
+
rawProducts = _context40.sent;
|
|
4501
|
+
_context40.next = 28;
|
|
4337
4502
|
break;
|
|
4338
4503
|
case 27:
|
|
4339
4504
|
this.unifiedProductCatalog = [];
|
|
4340
4505
|
case 28:
|
|
4341
|
-
|
|
4506
|
+
_context40.next = 34;
|
|
4342
4507
|
break;
|
|
4343
4508
|
case 30:
|
|
4344
4509
|
if (!(((_prepare$catalogScope2 = prepare.catalogScope) === null || _prepare$catalogScope2 === void 0 ? void 0 : _prepare$catalogScope2.type) === 'productList')) {
|
|
4345
|
-
|
|
4510
|
+
_context40.next = 34;
|
|
4346
4511
|
break;
|
|
4347
4512
|
}
|
|
4348
|
-
|
|
4513
|
+
_context40.next = 33;
|
|
4349
4514
|
return this.loadProducts(_objectSpread(_objectSpread({}, prepare.catalogScope.params), {}, {
|
|
4350
4515
|
schedule_date: prepare.catalogScope.params.schedule_date || dateRange.startDate
|
|
4351
4516
|
}));
|
|
4352
4517
|
case 33:
|
|
4353
|
-
rawProducts =
|
|
4518
|
+
rawProducts = _context40.sent;
|
|
4354
4519
|
case 34:
|
|
4355
4520
|
normalized = rawProducts.map(function (product) {
|
|
4356
4521
|
return normalizeProductForAvailability(product, params.scheduleList, _this11.getAvailabilityRuntimeOffsetMinutes());
|
|
4357
4522
|
});
|
|
4358
4523
|
if (!(!explicitProductIds.length && (_prepare$resourceIds = prepare.resourceIds) !== null && _prepare$resourceIds !== void 0 && _prepare$resourceIds.length)) {
|
|
4359
|
-
|
|
4524
|
+
_context40.next = 37;
|
|
4360
4525
|
break;
|
|
4361
4526
|
}
|
|
4362
|
-
return
|
|
4527
|
+
return _context40.abrupt("return", normalized.filter(function (product) {
|
|
4363
4528
|
var _product$requirementG2;
|
|
4364
4529
|
return (_product$requirementG2 = product.requirementGroups) === null || _product$requirementG2 === void 0 ? void 0 : _product$requirementG2.some(function (group) {
|
|
4365
4530
|
var _group$resourceIds3;
|
|
@@ -4372,16 +4537,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4372
4537
|
}));
|
|
4373
4538
|
case 37:
|
|
4374
4539
|
productIdSet = explicitProductIds.length ? new Set(explicitProductIds.map(String)) : null;
|
|
4375
|
-
return
|
|
4540
|
+
return _context40.abrupt("return", productIdSet ? normalized.filter(function (product) {
|
|
4376
4541
|
return productIdSet.has(String(product.id));
|
|
4377
4542
|
}) : normalized);
|
|
4378
4543
|
case 39:
|
|
4379
4544
|
case "end":
|
|
4380
|
-
return
|
|
4545
|
+
return _context40.stop();
|
|
4381
4546
|
}
|
|
4382
|
-
},
|
|
4547
|
+
}, _callee40, this);
|
|
4383
4548
|
}));
|
|
4384
|
-
function loadAvailabilityProducts(
|
|
4549
|
+
function loadAvailabilityProducts(_x24) {
|
|
4385
4550
|
return _loadAvailabilityProducts.apply(this, arguments);
|
|
4386
4551
|
}
|
|
4387
4552
|
return loadAvailabilityProducts;
|
|
@@ -4394,12 +4559,12 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4394
4559
|
}, {
|
|
4395
4560
|
key: "fetchAvailabilityResourcesV2",
|
|
4396
4561
|
value: (function () {
|
|
4397
|
-
var _fetchAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4562
|
+
var _fetchAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(params) {
|
|
4398
4563
|
var response, data;
|
|
4399
|
-
return _regeneratorRuntime().wrap(function
|
|
4400
|
-
while (1) switch (
|
|
4564
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
4565
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
4401
4566
|
case 0:
|
|
4402
|
-
|
|
4567
|
+
_context41.next = 2;
|
|
4403
4568
|
return this.request.get('/schedule/resource/list/v2', {
|
|
4404
4569
|
start_date: params.dateRange.startDate,
|
|
4405
4570
|
end_date: params.dateRange.endDate,
|
|
@@ -4409,28 +4574,28 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4409
4574
|
useCache: false
|
|
4410
4575
|
});
|
|
4411
4576
|
case 2:
|
|
4412
|
-
response =
|
|
4577
|
+
response = _context41.sent;
|
|
4413
4578
|
data = response === null || response === void 0 ? void 0 : response.data;
|
|
4414
4579
|
if (!Array.isArray(data)) {
|
|
4415
|
-
|
|
4580
|
+
_context41.next = 6;
|
|
4416
4581
|
break;
|
|
4417
4582
|
}
|
|
4418
|
-
return
|
|
4583
|
+
return _context41.abrupt("return", data);
|
|
4419
4584
|
case 6:
|
|
4420
4585
|
if (!Array.isArray(data === null || data === void 0 ? void 0 : data.list)) {
|
|
4421
|
-
|
|
4586
|
+
_context41.next = 8;
|
|
4422
4587
|
break;
|
|
4423
4588
|
}
|
|
4424
|
-
return
|
|
4589
|
+
return _context41.abrupt("return", data.list);
|
|
4425
4590
|
case 8:
|
|
4426
|
-
return
|
|
4591
|
+
return _context41.abrupt("return", []);
|
|
4427
4592
|
case 9:
|
|
4428
4593
|
case "end":
|
|
4429
|
-
return
|
|
4594
|
+
return _context41.stop();
|
|
4430
4595
|
}
|
|
4431
|
-
},
|
|
4596
|
+
}, _callee41, this);
|
|
4432
4597
|
}));
|
|
4433
|
-
function fetchAvailabilityResourcesV2(
|
|
4598
|
+
function fetchAvailabilityResourcesV2(_x25) {
|
|
4434
4599
|
return _fetchAvailabilityResourcesV.apply(this, arguments);
|
|
4435
4600
|
}
|
|
4436
4601
|
return fetchAvailabilityResourcesV2;
|
|
@@ -4438,17 +4603,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4438
4603
|
}, {
|
|
4439
4604
|
key: "fetchAndPublishAvailabilityResourcesV2",
|
|
4440
4605
|
value: function () {
|
|
4441
|
-
var _fetchAndPublishAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4606
|
+
var _fetchAndPublishAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(params) {
|
|
4442
4607
|
var normalizedResourceIds, scopeKey, cacheParams, cachedRawResources;
|
|
4443
|
-
return _regeneratorRuntime().wrap(function
|
|
4444
|
-
while (1) switch (
|
|
4608
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
4609
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
4445
4610
|
case 0:
|
|
4446
4611
|
normalizedResourceIds = this.normalizeAvailabilityIdList(params.resourceIds) || [];
|
|
4447
4612
|
if (!(normalizedResourceIds.length === 0)) {
|
|
4448
|
-
|
|
4613
|
+
_context42.next = 3;
|
|
4449
4614
|
break;
|
|
4450
4615
|
}
|
|
4451
|
-
return
|
|
4616
|
+
return _context42.abrupt("return", []);
|
|
4452
4617
|
case 3:
|
|
4453
4618
|
scopeKey = this.buildAvailabilityRemoteResourceScopeKey(params.timezone);
|
|
4454
4619
|
cacheParams = {
|
|
@@ -4458,7 +4623,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4458
4623
|
};
|
|
4459
4624
|
cachedRawResources = this.availabilityRemoteOccupancyCache.read(cacheParams);
|
|
4460
4625
|
if (!cachedRawResources) {
|
|
4461
|
-
|
|
4626
|
+
_context42.next = 9;
|
|
4462
4627
|
break;
|
|
4463
4628
|
}
|
|
4464
4629
|
if (params.useCacheOnHit) {
|
|
@@ -4470,23 +4635,23 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4470
4635
|
console.warn('[UnifiedBookingSales] Remote occupancy background refresh failed', error);
|
|
4471
4636
|
});
|
|
4472
4637
|
}
|
|
4473
|
-
return
|
|
4638
|
+
return _context42.abrupt("return", cachedRawResources);
|
|
4474
4639
|
case 9:
|
|
4475
|
-
|
|
4640
|
+
_context42.next = 11;
|
|
4476
4641
|
return this.refreshAvailabilityRemoteResourceQuery({
|
|
4477
4642
|
timezone: params.timezone,
|
|
4478
4643
|
dateRange: params.dateRange,
|
|
4479
4644
|
resourceIds: normalizedResourceIds
|
|
4480
4645
|
});
|
|
4481
4646
|
case 11:
|
|
4482
|
-
return
|
|
4647
|
+
return _context42.abrupt("return", _context42.sent);
|
|
4483
4648
|
case 12:
|
|
4484
4649
|
case "end":
|
|
4485
|
-
return
|
|
4650
|
+
return _context42.stop();
|
|
4486
4651
|
}
|
|
4487
|
-
},
|
|
4652
|
+
}, _callee42, this);
|
|
4488
4653
|
}));
|
|
4489
|
-
function fetchAndPublishAvailabilityResourcesV2(
|
|
4654
|
+
function fetchAndPublishAvailabilityResourcesV2(_x26) {
|
|
4490
4655
|
return _fetchAndPublishAvailabilityResourcesV.apply(this, arguments);
|
|
4491
4656
|
}
|
|
4492
4657
|
return fetchAndPublishAvailabilityResourcesV2;
|
|
@@ -4494,17 +4659,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4494
4659
|
}, {
|
|
4495
4660
|
key: "refreshAvailabilityRemoteResourceQuery",
|
|
4496
4661
|
value: function () {
|
|
4497
|
-
var _refreshAvailabilityRemoteResourceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4662
|
+
var _refreshAvailabilityRemoteResourceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
|
|
4498
4663
|
var normalizedResourceIds, queryKey, epoch, existing, writeVersion, promise, rawResources, current;
|
|
4499
|
-
return _regeneratorRuntime().wrap(function
|
|
4500
|
-
while (1) switch (
|
|
4664
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
4665
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
4501
4666
|
case 0:
|
|
4502
4667
|
normalizedResourceIds = this.normalizeAvailabilityIdList(params.resourceIds) || [];
|
|
4503
4668
|
if (!(normalizedResourceIds.length === 0)) {
|
|
4504
|
-
|
|
4669
|
+
_context43.next = 3;
|
|
4505
4670
|
break;
|
|
4506
4671
|
}
|
|
4507
|
-
return
|
|
4672
|
+
return _context43.abrupt("return", []);
|
|
4508
4673
|
case 3:
|
|
4509
4674
|
queryKey = this.buildAvailabilityRemoteResourceQueryKey({
|
|
4510
4675
|
timezone: params.timezone,
|
|
@@ -4514,13 +4679,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4514
4679
|
epoch = this.availabilityRemoteResourceEpoch;
|
|
4515
4680
|
existing = this.availabilityRemoteResourceQueryInFlight.get(queryKey);
|
|
4516
4681
|
if (!((existing === null || existing === void 0 ? void 0 : existing.epoch) === epoch)) {
|
|
4517
|
-
|
|
4682
|
+
_context43.next = 10;
|
|
4518
4683
|
break;
|
|
4519
4684
|
}
|
|
4520
|
-
|
|
4685
|
+
_context43.next = 9;
|
|
4521
4686
|
return existing.promise;
|
|
4522
4687
|
case 9:
|
|
4523
|
-
return
|
|
4688
|
+
return _context43.abrupt("return", _context43.sent);
|
|
4524
4689
|
case 10:
|
|
4525
4690
|
this.availabilityRemoteResourceQuerySequence += 1;
|
|
4526
4691
|
writeVersion = this.availabilityRemoteResourceQuerySequence;
|
|
@@ -4532,11 +4697,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4532
4697
|
epoch: epoch,
|
|
4533
4698
|
promise: promise
|
|
4534
4699
|
});
|
|
4535
|
-
|
|
4536
|
-
|
|
4700
|
+
_context43.prev = 14;
|
|
4701
|
+
_context43.next = 17;
|
|
4537
4702
|
return promise;
|
|
4538
4703
|
case 17:
|
|
4539
|
-
rawResources =
|
|
4704
|
+
rawResources = _context43.sent;
|
|
4540
4705
|
if (epoch === this.availabilityRemoteResourceEpoch) {
|
|
4541
4706
|
this.availabilityRemoteOccupancyCache.publish({
|
|
4542
4707
|
scopeKey: this.buildAvailabilityRemoteResourceScopeKey(params.timezone),
|
|
@@ -4547,21 +4712,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4547
4712
|
version: writeVersion
|
|
4548
4713
|
});
|
|
4549
4714
|
}
|
|
4550
|
-
return
|
|
4715
|
+
return _context43.abrupt("return", rawResources);
|
|
4551
4716
|
case 20:
|
|
4552
|
-
|
|
4717
|
+
_context43.prev = 20;
|
|
4553
4718
|
current = this.availabilityRemoteResourceQueryInFlight.get(queryKey);
|
|
4554
4719
|
if ((current === null || current === void 0 ? void 0 : current.promise) === promise) {
|
|
4555
4720
|
this.availabilityRemoteResourceQueryInFlight.delete(queryKey);
|
|
4556
4721
|
}
|
|
4557
|
-
return
|
|
4722
|
+
return _context43.finish(20);
|
|
4558
4723
|
case 24:
|
|
4559
4724
|
case "end":
|
|
4560
|
-
return
|
|
4725
|
+
return _context43.stop();
|
|
4561
4726
|
}
|
|
4562
|
-
},
|
|
4727
|
+
}, _callee43, this, [[14,, 20, 24]]);
|
|
4563
4728
|
}));
|
|
4564
|
-
function refreshAvailabilityRemoteResourceQuery(
|
|
4729
|
+
function refreshAvailabilityRemoteResourceQuery(_x27) {
|
|
4565
4730
|
return _refreshAvailabilityRemoteResourceQuery.apply(this, arguments);
|
|
4566
4731
|
}
|
|
4567
4732
|
return refreshAvailabilityRemoteResourceQuery;
|
|
@@ -4569,26 +4734,26 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4569
4734
|
}, {
|
|
4570
4735
|
key: "loadAvailabilityResources",
|
|
4571
4736
|
value: function () {
|
|
4572
|
-
var _loadAvailabilityResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4737
|
+
var _loadAvailabilityResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params) {
|
|
4573
4738
|
var resourceIds, cachedRawResources, rawResources;
|
|
4574
|
-
return _regeneratorRuntime().wrap(function
|
|
4575
|
-
while (1) switch (
|
|
4739
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
4740
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
4576
4741
|
case 0:
|
|
4577
4742
|
resourceIds = collectAvailabilityResourceIds(params.products, params.resourceIds || []);
|
|
4578
4743
|
if (!(resourceIds.length === 0)) {
|
|
4579
|
-
|
|
4744
|
+
_context44.next = 3;
|
|
4580
4745
|
break;
|
|
4581
4746
|
}
|
|
4582
|
-
return
|
|
4747
|
+
return _context44.abrupt("return", {
|
|
4583
4748
|
resources: [],
|
|
4584
4749
|
resourceOccupancies: []
|
|
4585
4750
|
});
|
|
4586
4751
|
case 3:
|
|
4587
4752
|
if (!Array.isArray(params.rawResources)) {
|
|
4588
|
-
|
|
4753
|
+
_context44.next = 5;
|
|
4589
4754
|
break;
|
|
4590
4755
|
}
|
|
4591
|
-
return
|
|
4756
|
+
return _context44.abrupt("return", buildAvailabilityResourcesFromV2({
|
|
4592
4757
|
rawResources: params.rawResources,
|
|
4593
4758
|
scheduleList: params.scheduleList,
|
|
4594
4759
|
dateRange: params.dateRange,
|
|
@@ -4596,7 +4761,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4596
4761
|
}));
|
|
4597
4762
|
case 5:
|
|
4598
4763
|
if (!(params.fetchPolicy === 'cache_only')) {
|
|
4599
|
-
|
|
4764
|
+
_context44.next = 10;
|
|
4600
4765
|
break;
|
|
4601
4766
|
}
|
|
4602
4767
|
cachedRawResources = this.availabilityRemoteOccupancyCache.read({
|
|
@@ -4605,22 +4770,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4605
4770
|
dateRange: params.dateRange
|
|
4606
4771
|
});
|
|
4607
4772
|
if (!cachedRawResources) {
|
|
4608
|
-
|
|
4773
|
+
_context44.next = 9;
|
|
4609
4774
|
break;
|
|
4610
4775
|
}
|
|
4611
|
-
return
|
|
4776
|
+
return _context44.abrupt("return", buildAvailabilityResourcesFromV2({
|
|
4612
4777
|
rawResources: cachedRawResources,
|
|
4613
4778
|
scheduleList: params.scheduleList,
|
|
4614
4779
|
dateRange: params.dateRange,
|
|
4615
4780
|
fixedOffsetMinutes: this.getAvailabilityRuntimeOffsetMinutes()
|
|
4616
4781
|
}));
|
|
4617
4782
|
case 9:
|
|
4618
|
-
return
|
|
4783
|
+
return _context44.abrupt("return", params.fallbackResources ? cloneDeep(params.fallbackResources) : {
|
|
4619
4784
|
resources: [],
|
|
4620
4785
|
resourceOccupancies: []
|
|
4621
4786
|
});
|
|
4622
4787
|
case 10:
|
|
4623
|
-
|
|
4788
|
+
_context44.next = 12;
|
|
4624
4789
|
return this.fetchAndPublishAvailabilityResourcesV2({
|
|
4625
4790
|
timezone: params.timezone,
|
|
4626
4791
|
dateRange: params.dateRange,
|
|
@@ -4628,8 +4793,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4628
4793
|
useCacheOnHit: true
|
|
4629
4794
|
});
|
|
4630
4795
|
case 12:
|
|
4631
|
-
rawResources =
|
|
4632
|
-
return
|
|
4796
|
+
rawResources = _context44.sent;
|
|
4797
|
+
return _context44.abrupt("return", buildAvailabilityResourcesFromV2({
|
|
4633
4798
|
rawResources: rawResources,
|
|
4634
4799
|
scheduleList: params.scheduleList,
|
|
4635
4800
|
dateRange: params.dateRange,
|
|
@@ -4637,11 +4802,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4637
4802
|
}));
|
|
4638
4803
|
case 14:
|
|
4639
4804
|
case "end":
|
|
4640
|
-
return
|
|
4805
|
+
return _context44.stop();
|
|
4641
4806
|
}
|
|
4642
|
-
},
|
|
4807
|
+
}, _callee44, this);
|
|
4643
4808
|
}));
|
|
4644
|
-
function loadAvailabilityResources(
|
|
4809
|
+
function loadAvailabilityResources(_x28) {
|
|
4645
4810
|
return _loadAvailabilityResources.apply(this, arguments);
|
|
4646
4811
|
}
|
|
4647
4812
|
return loadAvailabilityResources;
|
|
@@ -4661,7 +4826,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4661
4826
|
var products = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) ? tempOrder.products : [];
|
|
4662
4827
|
var bookings = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.bookings) ? tempOrder.bookings : [];
|
|
4663
4828
|
productLineUids.forEach(function (requestedUid) {
|
|
4664
|
-
var
|
|
4829
|
+
var _ref49, _product$booking_uid2, _product$metadata6;
|
|
4665
4830
|
var product = products.find(function (line) {
|
|
4666
4831
|
return getProductLineUid(line) === String(requestedUid);
|
|
4667
4832
|
});
|
|
@@ -4671,7 +4836,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4671
4836
|
});
|
|
4672
4837
|
}
|
|
4673
4838
|
var productUid = getProductLineUid(product);
|
|
4674
|
-
var linkedBookingUid = String((
|
|
4839
|
+
var linkedBookingUid = String((_ref49 = (_product$booking_uid2 = product.booking_uid) !== null && _product$booking_uid2 !== void 0 ? _product$booking_uid2 : (_product$metadata6 = product.metadata) === null || _product$metadata6 === void 0 ? void 0 : _product$metadata6.booking_uid) !== null && _ref49 !== void 0 ? _ref49 : '');
|
|
4675
4840
|
var linkedBookings = bookings.filter(function (booking) {
|
|
4676
4841
|
var _booking$product_uid;
|
|
4677
4842
|
return linkedBookingUid && getBookingUid(booking) === linkedBookingUid || productUid && String((_booking$product_uid = booking.product_uid) !== null && _booking$product_uid !== void 0 ? _booking$product_uid : '') === productUid;
|
|
@@ -4717,16 +4882,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4717
4882
|
var _this12 = this;
|
|
4718
4883
|
var bookings = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.bookings) ? tempOrder.bookings : [];
|
|
4719
4884
|
return bookings.flatMap(function (booking) {
|
|
4720
|
-
var
|
|
4885
|
+
var _ref50, _booking$product_uid2, _booking$metadata2;
|
|
4721
4886
|
var bookingUid = getBookingUid(booking);
|
|
4722
|
-
var productUid = String((
|
|
4887
|
+
var productUid = String((_ref50 = (_booking$product_uid2 = booking.product_uid) !== null && _booking$product_uid2 !== void 0 ? _booking$product_uid2 : (_booking$metadata2 = booking.metadata) === null || _booking$metadata2 === void 0 ? void 0 : _booking$metadata2.product_uid) !== null && _ref50 !== void 0 ? _ref50 : '');
|
|
4723
4888
|
var scheduleEventId = toNumberId(booking.schedule_event_id);
|
|
4724
4889
|
var startAt = booking.start_at || "".concat(booking.start_date || '', " ").concat(booking.start_time || '').trim();
|
|
4725
4890
|
var endAt = booking.end_at || "".concat(booking.end_date || booking.start_date || '', " ").concat(booking.end_time || '').trim();
|
|
4726
4891
|
var resources = Array.isArray(booking.resources) ? booking.resources : [];
|
|
4727
4892
|
return resources.flatMap(function (resource) {
|
|
4728
|
-
var
|
|
4729
|
-
var resourceId = (
|
|
4893
|
+
var _ref51, _resource$resource_id, _ref52, _resource$capacity;
|
|
4894
|
+
var resourceId = (_ref51 = (_resource$resource_id = resource.resource_id) !== null && _resource$resource_id !== void 0 ? _resource$resource_id : resource.relation_id) !== null && _ref51 !== void 0 ? _ref51 : resource.id;
|
|
4730
4895
|
if (resourceId == null || !startAt || !endAt) return [];
|
|
4731
4896
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
4732
4897
|
startAt: startAt,
|
|
@@ -4739,7 +4904,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4739
4904
|
resourceId: resourceId,
|
|
4740
4905
|
startAt: range.startAt,
|
|
4741
4906
|
endAt: range.endAt,
|
|
4742
|
-
pax: Math.max(1, Number((
|
|
4907
|
+
pax: Math.max(1, Number((_ref52 = (_resource$capacity = resource.capacity) !== null && _resource$capacity !== void 0 ? _resource$capacity : booking.capacity) !== null && _ref52 !== void 0 ? _ref52 : 1) || 1),
|
|
4743
4908
|
source: 'cart',
|
|
4744
4909
|
scheduleEventId: scheduleEventId,
|
|
4745
4910
|
bookingUid: bookingUid || undefined,
|
|
@@ -4872,7 +5037,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4872
5037
|
}, {
|
|
4873
5038
|
key: "buildAvailabilityProjectionSnapshot",
|
|
4874
5039
|
value: function () {
|
|
4875
|
-
var _buildAvailabilityProjectionSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5040
|
+
var _buildAvailabilityProjectionSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(params) {
|
|
4876
5041
|
var _this14 = this;
|
|
4877
5042
|
var options,
|
|
4878
5043
|
normalizedPrepareParams,
|
|
@@ -4896,23 +5061,23 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4896
5061
|
durationCandidateAnchorAt,
|
|
4897
5062
|
orderRevision,
|
|
4898
5063
|
projection,
|
|
4899
|
-
|
|
4900
|
-
return _regeneratorRuntime().wrap(function
|
|
4901
|
-
while (1) switch (
|
|
5064
|
+
_args45 = arguments;
|
|
5065
|
+
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
|
5066
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
4902
5067
|
case 0:
|
|
4903
|
-
options =
|
|
5068
|
+
options = _args45.length > 1 && _args45[1] !== undefined ? _args45[1] : {};
|
|
4904
5069
|
normalizedPrepareParams = this.normalizeAvailabilityPrepareDescriptor(params);
|
|
4905
5070
|
timezoneLabel = String(normalizedPrepareParams.timezone);
|
|
4906
5071
|
dateRange = normalizedPrepareParams.dateRange;
|
|
4907
5072
|
scheduleList = this.getAvailabilityScheduleCatalog();
|
|
4908
|
-
|
|
5073
|
+
_context45.next = 7;
|
|
4909
5074
|
return this.loadAvailabilityProducts({
|
|
4910
5075
|
prepare: normalizedPrepareParams,
|
|
4911
5076
|
dateRange: dateRange,
|
|
4912
5077
|
scheduleList: scheduleList
|
|
4913
5078
|
});
|
|
4914
5079
|
case 7:
|
|
4915
|
-
products =
|
|
5080
|
+
products = _context45.sent;
|
|
4916
5081
|
// Coverage is physical local time; the caller's date range remains business
|
|
4917
5082
|
// dates. Keep yesterday's opening and the last business day's overnight tail.
|
|
4918
5083
|
useDurationTimeGrid = this.usesDurationTimeGrid() && products.some(function (product) {
|
|
@@ -4934,7 +5099,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4934
5099
|
scheduleList: scheduleList,
|
|
4935
5100
|
businessHours: businessHours
|
|
4936
5101
|
});
|
|
4937
|
-
|
|
5102
|
+
_context45.next = 16;
|
|
4938
5103
|
return this.loadAvailabilityResources({
|
|
4939
5104
|
timezone: timezoneLabel,
|
|
4940
5105
|
dateRange: coverageDateRange,
|
|
@@ -4946,7 +5111,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4946
5111
|
fallbackResources: options.fallbackResources
|
|
4947
5112
|
});
|
|
4948
5113
|
case 16:
|
|
4949
|
-
loadedResources =
|
|
5114
|
+
loadedResources = _context45.sent;
|
|
4950
5115
|
tempOrder = this.getTempOrder();
|
|
4951
5116
|
exclusions = this.resolveEditingOccupancyExclusions(tempOrder, normalizedPrepareParams.editingProductLineUids);
|
|
4952
5117
|
injectedRawOccupancies = (normalizedPrepareParams.rawOccupancies || []).flatMap(function (occupancy) {
|
|
@@ -4992,18 +5157,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4992
5157
|
prepareParams: normalizedPrepareParams,
|
|
4993
5158
|
durationCandidateAnchorAt: durationCandidateAnchorAt
|
|
4994
5159
|
});
|
|
4995
|
-
return
|
|
5160
|
+
return _context45.abrupt("return", {
|
|
4996
5161
|
projection: projection,
|
|
4997
5162
|
prepareParams: normalizedPrepareParams,
|
|
4998
5163
|
orderRevision: orderRevision
|
|
4999
5164
|
});
|
|
5000
5165
|
case 28:
|
|
5001
5166
|
case "end":
|
|
5002
|
-
return
|
|
5167
|
+
return _context45.stop();
|
|
5003
5168
|
}
|
|
5004
|
-
},
|
|
5169
|
+
}, _callee45, this);
|
|
5005
5170
|
}));
|
|
5006
|
-
function buildAvailabilityProjectionSnapshot(
|
|
5171
|
+
function buildAvailabilityProjectionSnapshot(_x29) {
|
|
5007
5172
|
return _buildAvailabilityProjectionSnapshot.apply(this, arguments);
|
|
5008
5173
|
}
|
|
5009
5174
|
return buildAvailabilityProjectionSnapshot;
|
|
@@ -5011,10 +5176,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5011
5176
|
}, {
|
|
5012
5177
|
key: "getSharedPreparedAvailabilitySnapshot",
|
|
5013
5178
|
value: function () {
|
|
5014
|
-
var _getSharedPreparedAvailabilitySnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5179
|
+
var _getSharedPreparedAvailabilitySnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(params) {
|
|
5015
5180
|
var lifecycleGeneration, normalizedParams, hasRawInputs, prepareKey, snapshot, existing, promise, _snapshot, current;
|
|
5016
|
-
return _regeneratorRuntime().wrap(function
|
|
5017
|
-
while (1) switch (
|
|
5181
|
+
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
|
5182
|
+
while (1) switch (_context46.prev = _context46.next) {
|
|
5018
5183
|
case 0:
|
|
5019
5184
|
lifecycleGeneration = this.availabilityLifecycleGeneration;
|
|
5020
5185
|
normalizedParams = this.normalizeAvailabilityPrepareDescriptor(params);
|
|
@@ -5033,15 +5198,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5033
5198
|
}
|
|
5034
5199
|
})) : this.buildAvailabilityPrepareKey(normalizedParams);
|
|
5035
5200
|
if (!hasRawInputs) {
|
|
5036
|
-
|
|
5201
|
+
_context46.next = 11;
|
|
5037
5202
|
break;
|
|
5038
5203
|
}
|
|
5039
|
-
|
|
5204
|
+
_context46.next = 7;
|
|
5040
5205
|
return this.buildAvailabilityProjectionSnapshot(normalizedParams);
|
|
5041
5206
|
case 7:
|
|
5042
|
-
snapshot =
|
|
5207
|
+
snapshot = _context46.sent;
|
|
5043
5208
|
if (!(lifecycleGeneration !== this.availabilityLifecycleGeneration)) {
|
|
5044
|
-
|
|
5209
|
+
_context46.next = 10;
|
|
5045
5210
|
break;
|
|
5046
5211
|
}
|
|
5047
5212
|
throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'prepare 期间业务作用域或实例生命周期已变化,请重新 prepare', {
|
|
@@ -5050,7 +5215,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5050
5215
|
currentLifecycleGeneration: this.availabilityLifecycleGeneration
|
|
5051
5216
|
});
|
|
5052
5217
|
case 10:
|
|
5053
|
-
return
|
|
5218
|
+
return _context46.abrupt("return", {
|
|
5054
5219
|
prepareKey: prepareKey,
|
|
5055
5220
|
snapshot: snapshot
|
|
5056
5221
|
});
|
|
@@ -5064,13 +5229,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5064
5229
|
promise: promise
|
|
5065
5230
|
});
|
|
5066
5231
|
}
|
|
5067
|
-
|
|
5068
|
-
|
|
5232
|
+
_context46.prev = 14;
|
|
5233
|
+
_context46.next = 17;
|
|
5069
5234
|
return promise;
|
|
5070
5235
|
case 17:
|
|
5071
|
-
_snapshot =
|
|
5236
|
+
_snapshot = _context46.sent;
|
|
5072
5237
|
if (!(lifecycleGeneration !== this.availabilityLifecycleGeneration)) {
|
|
5073
|
-
|
|
5238
|
+
_context46.next = 20;
|
|
5074
5239
|
break;
|
|
5075
5240
|
}
|
|
5076
5241
|
throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'prepare 期间业务作用域或实例生命周期已变化,请重新 prepare', {
|
|
@@ -5079,24 +5244,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5079
5244
|
currentLifecycleGeneration: this.availabilityLifecycleGeneration
|
|
5080
5245
|
});
|
|
5081
5246
|
case 20:
|
|
5082
|
-
return
|
|
5247
|
+
return _context46.abrupt("return", {
|
|
5083
5248
|
prepareKey: prepareKey,
|
|
5084
5249
|
snapshot: _snapshot
|
|
5085
5250
|
});
|
|
5086
5251
|
case 21:
|
|
5087
|
-
|
|
5252
|
+
_context46.prev = 21;
|
|
5088
5253
|
current = this.availabilityPrepareInFlight.get(prepareKey);
|
|
5089
5254
|
if ((current === null || current === void 0 ? void 0 : current.promise) === promise) {
|
|
5090
5255
|
this.availabilityPrepareInFlight.delete(prepareKey);
|
|
5091
5256
|
}
|
|
5092
|
-
return
|
|
5257
|
+
return _context46.finish(21);
|
|
5093
5258
|
case 25:
|
|
5094
5259
|
case "end":
|
|
5095
|
-
return
|
|
5260
|
+
return _context46.stop();
|
|
5096
5261
|
}
|
|
5097
|
-
},
|
|
5262
|
+
}, _callee46, this, [[14,, 21, 25]]);
|
|
5098
5263
|
}));
|
|
5099
|
-
function getSharedPreparedAvailabilitySnapshot(
|
|
5264
|
+
function getSharedPreparedAvailabilitySnapshot(_x30) {
|
|
5100
5265
|
return _getSharedPreparedAvailabilitySnapshot.apply(this, arguments);
|
|
5101
5266
|
}
|
|
5102
5267
|
return getSharedPreparedAvailabilitySnapshot;
|
|
@@ -5104,49 +5269,49 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5104
5269
|
}, {
|
|
5105
5270
|
key: "refreshAvailabilityContextProjection",
|
|
5106
5271
|
value: function () {
|
|
5107
|
-
var _refreshAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5272
|
+
var _refreshAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(params) {
|
|
5108
5273
|
var _this15 = this;
|
|
5109
5274
|
var existingInFlight, context, expectedVersion, expectedRefreshNonce, expectedLifecycleGeneration, refreshPromise, current;
|
|
5110
|
-
return _regeneratorRuntime().wrap(function
|
|
5111
|
-
while (1) switch (
|
|
5275
|
+
return _regeneratorRuntime().wrap(function _callee48$(_context48) {
|
|
5276
|
+
while (1) switch (_context48.prev = _context48.next) {
|
|
5112
5277
|
case 0:
|
|
5113
5278
|
existingInFlight = this.availabilityProjectionRefreshInFlight.get(params.contextId);
|
|
5114
5279
|
if (!existingInFlight) {
|
|
5115
|
-
|
|
5280
|
+
_context48.next = 5;
|
|
5116
5281
|
break;
|
|
5117
5282
|
}
|
|
5118
|
-
|
|
5283
|
+
_context48.next = 4;
|
|
5119
5284
|
return existingInFlight;
|
|
5120
5285
|
case 4:
|
|
5121
|
-
return
|
|
5286
|
+
return _context48.abrupt("return", _context48.sent);
|
|
5122
5287
|
case 5:
|
|
5123
5288
|
context = this.getAvailabilityContextEntry(params.contextId);
|
|
5124
5289
|
expectedVersion = context.activeVersion;
|
|
5125
5290
|
expectedRefreshNonce = context.refreshNonce;
|
|
5126
5291
|
expectedLifecycleGeneration = this.availabilityLifecycleGeneration;
|
|
5127
|
-
refreshPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5292
|
+
refreshPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47() {
|
|
5128
5293
|
var snapshot, currentContext, projectionEntry;
|
|
5129
|
-
return _regeneratorRuntime().wrap(function
|
|
5130
|
-
while (1) switch (
|
|
5294
|
+
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
|
5295
|
+
while (1) switch (_context47.prev = _context47.next) {
|
|
5131
5296
|
case 0:
|
|
5132
|
-
|
|
5297
|
+
_context47.next = 2;
|
|
5133
5298
|
return _this15.buildAvailabilityProjectionSnapshot(_this15.cloneAvailabilityPrepareParams(context.prepareParams), {
|
|
5134
5299
|
durationCandidateAnchorAt: context.durationCandidateAnchorAt
|
|
5135
5300
|
});
|
|
5136
5301
|
case 2:
|
|
5137
|
-
snapshot =
|
|
5302
|
+
snapshot = _context47.sent;
|
|
5138
5303
|
currentContext = _this15.availabilityContextRegistry.get(params.contextId);
|
|
5139
5304
|
if (currentContext) {
|
|
5140
|
-
|
|
5305
|
+
_context47.next = 6;
|
|
5141
5306
|
break;
|
|
5142
5307
|
}
|
|
5143
|
-
return
|
|
5308
|
+
return _context47.abrupt("return", null);
|
|
5144
5309
|
case 6:
|
|
5145
5310
|
if (!(expectedLifecycleGeneration !== _this15.availabilityLifecycleGeneration || currentContext.activeVersion !== expectedVersion || currentContext.refreshNonce !== expectedRefreshNonce || currentContext.lifecycleGeneration !== expectedLifecycleGeneration)) {
|
|
5146
|
-
|
|
5311
|
+
_context47.next = 8;
|
|
5147
5312
|
break;
|
|
5148
5313
|
}
|
|
5149
|
-
return
|
|
5314
|
+
return _context47.abrupt("return", null);
|
|
5150
5315
|
case 8:
|
|
5151
5316
|
projectionEntry = _this15.storeAvailabilityProjectionEntry({
|
|
5152
5317
|
contextId: currentContext.contextId,
|
|
@@ -5156,7 +5321,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5156
5321
|
orderRevision: snapshot.orderRevision,
|
|
5157
5322
|
incrementVersion: true
|
|
5158
5323
|
});
|
|
5159
|
-
|
|
5324
|
+
_context47.next = 11;
|
|
5160
5325
|
return _this15.emitAvailabilityDiagnostic({
|
|
5161
5326
|
action: 'refresh',
|
|
5162
5327
|
contextId: currentContext.contextId,
|
|
@@ -5168,33 +5333,33 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5168
5333
|
reason: params.reason
|
|
5169
5334
|
});
|
|
5170
5335
|
case 11:
|
|
5171
|
-
return
|
|
5336
|
+
return _context47.abrupt("return", projectionEntry);
|
|
5172
5337
|
case 12:
|
|
5173
5338
|
case "end":
|
|
5174
|
-
return
|
|
5339
|
+
return _context47.stop();
|
|
5175
5340
|
}
|
|
5176
|
-
},
|
|
5341
|
+
}, _callee47);
|
|
5177
5342
|
}))();
|
|
5178
5343
|
this.availabilityProjectionRefreshInFlight.set(params.contextId, refreshPromise);
|
|
5179
|
-
|
|
5180
|
-
|
|
5344
|
+
_context48.prev = 11;
|
|
5345
|
+
_context48.next = 14;
|
|
5181
5346
|
return refreshPromise;
|
|
5182
5347
|
case 14:
|
|
5183
|
-
return
|
|
5348
|
+
return _context48.abrupt("return", _context48.sent);
|
|
5184
5349
|
case 15:
|
|
5185
|
-
|
|
5350
|
+
_context48.prev = 15;
|
|
5186
5351
|
current = this.availabilityProjectionRefreshInFlight.get(params.contextId);
|
|
5187
5352
|
if (current === refreshPromise) {
|
|
5188
5353
|
this.availabilityProjectionRefreshInFlight.delete(params.contextId);
|
|
5189
5354
|
}
|
|
5190
|
-
return
|
|
5355
|
+
return _context48.finish(15);
|
|
5191
5356
|
case 19:
|
|
5192
5357
|
case "end":
|
|
5193
|
-
return
|
|
5358
|
+
return _context48.stop();
|
|
5194
5359
|
}
|
|
5195
|
-
},
|
|
5360
|
+
}, _callee48, this, [[11,, 15, 19]]);
|
|
5196
5361
|
}));
|
|
5197
|
-
function refreshAvailabilityContextProjection(
|
|
5362
|
+
function refreshAvailabilityContextProjection(_x31) {
|
|
5198
5363
|
return _refreshAvailabilityContextProjection.apply(this, arguments);
|
|
5199
5364
|
}
|
|
5200
5365
|
return refreshAvailabilityContextProjection;
|
|
@@ -5202,53 +5367,53 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5202
5367
|
}, {
|
|
5203
5368
|
key: "ensureAvailabilityContextProjection",
|
|
5204
5369
|
value: function () {
|
|
5205
|
-
var _ensureAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5370
|
+
var _ensureAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(contextId, reason) {
|
|
5206
5371
|
var retries, context, currentOrderRevision, projectionEntry, refreshedProjectionEntry;
|
|
5207
|
-
return _regeneratorRuntime().wrap(function
|
|
5208
|
-
while (1) switch (
|
|
5372
|
+
return _regeneratorRuntime().wrap(function _callee49$(_context49) {
|
|
5373
|
+
while (1) switch (_context49.prev = _context49.next) {
|
|
5209
5374
|
case 0:
|
|
5210
5375
|
retries = 0;
|
|
5211
5376
|
case 1:
|
|
5212
5377
|
if (!(retries < 3)) {
|
|
5213
|
-
|
|
5378
|
+
_context49.next = 19;
|
|
5214
5379
|
break;
|
|
5215
5380
|
}
|
|
5216
5381
|
context = this.getAvailabilityContextEntry(contextId);
|
|
5217
5382
|
currentOrderRevision = this.getCurrentOrderRevision();
|
|
5218
5383
|
projectionEntry = this.getActiveAvailabilityProjectionEntry(context);
|
|
5219
5384
|
if (!(projectionEntry && projectionEntry.orderRevision === currentOrderRevision)) {
|
|
5220
|
-
|
|
5385
|
+
_context49.next = 7;
|
|
5221
5386
|
break;
|
|
5222
5387
|
}
|
|
5223
|
-
return
|
|
5388
|
+
return _context49.abrupt("return", {
|
|
5224
5389
|
context: context,
|
|
5225
5390
|
projectionEntry: projectionEntry,
|
|
5226
5391
|
refreshed: false
|
|
5227
5392
|
});
|
|
5228
5393
|
case 7:
|
|
5229
|
-
|
|
5394
|
+
_context49.next = 9;
|
|
5230
5395
|
return this.refreshAvailabilityContextProjection({
|
|
5231
5396
|
contextId: contextId,
|
|
5232
5397
|
reason: projectionEntry ? reason : "".concat(reason, ":projection_cache_miss"),
|
|
5233
5398
|
previousOrderRevision: context.lastKnownOrderRevision
|
|
5234
5399
|
});
|
|
5235
5400
|
case 9:
|
|
5236
|
-
refreshedProjectionEntry =
|
|
5401
|
+
refreshedProjectionEntry = _context49.sent;
|
|
5237
5402
|
if (refreshedProjectionEntry) {
|
|
5238
|
-
|
|
5403
|
+
_context49.next = 13;
|
|
5239
5404
|
break;
|
|
5240
5405
|
}
|
|
5241
5406
|
retries += 1;
|
|
5242
|
-
return
|
|
5407
|
+
return _context49.abrupt("continue", 1);
|
|
5243
5408
|
case 13:
|
|
5244
5409
|
if (!(refreshedProjectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
|
|
5245
|
-
|
|
5410
|
+
_context49.next = 16;
|
|
5246
5411
|
break;
|
|
5247
5412
|
}
|
|
5248
5413
|
retries += 1;
|
|
5249
|
-
return
|
|
5414
|
+
return _context49.abrupt("continue", 1);
|
|
5250
5415
|
case 16:
|
|
5251
|
-
return
|
|
5416
|
+
return _context49.abrupt("return", {
|
|
5252
5417
|
context: this.getAvailabilityContextEntry(contextId),
|
|
5253
5418
|
projectionEntry: refreshedProjectionEntry,
|
|
5254
5419
|
refreshed: true
|
|
@@ -5260,11 +5425,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5260
5425
|
});
|
|
5261
5426
|
case 20:
|
|
5262
5427
|
case "end":
|
|
5263
|
-
return
|
|
5428
|
+
return _context49.stop();
|
|
5264
5429
|
}
|
|
5265
|
-
},
|
|
5430
|
+
}, _callee49, this);
|
|
5266
5431
|
}));
|
|
5267
|
-
function ensureAvailabilityContextProjection(
|
|
5432
|
+
function ensureAvailabilityContextProjection(_x32, _x33) {
|
|
5268
5433
|
return _ensureAvailabilityContextProjection.apply(this, arguments);
|
|
5269
5434
|
}
|
|
5270
5435
|
return ensureAvailabilityContextProjection;
|
|
@@ -5272,18 +5437,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5272
5437
|
}, {
|
|
5273
5438
|
key: "tryAcquireAvailabilityCommitLock",
|
|
5274
5439
|
value: function () {
|
|
5275
|
-
var _tryAcquireAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5440
|
+
var _tryAcquireAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(contextId) {
|
|
5276
5441
|
var _currentContext$activ;
|
|
5277
5442
|
var _waitingContext$activ, waitingContext, currentContext;
|
|
5278
|
-
return _regeneratorRuntime().wrap(function
|
|
5279
|
-
while (1) switch (
|
|
5443
|
+
return _regeneratorRuntime().wrap(function _callee50$(_context50) {
|
|
5444
|
+
while (1) switch (_context50.prev = _context50.next) {
|
|
5280
5445
|
case 0:
|
|
5281
5446
|
if (!this.availabilityCommitLocks.has(contextId)) {
|
|
5282
|
-
|
|
5447
|
+
_context50.next = 5;
|
|
5283
5448
|
break;
|
|
5284
5449
|
}
|
|
5285
5450
|
waitingContext = this.availabilityContextRegistry.get(contextId);
|
|
5286
|
-
|
|
5451
|
+
_context50.next = 4;
|
|
5287
5452
|
return this.emitAvailabilityDiagnostic({
|
|
5288
5453
|
action: 'commit_lock_wait',
|
|
5289
5454
|
contextId: contextId,
|
|
@@ -5300,7 +5465,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5300
5465
|
case 5:
|
|
5301
5466
|
this.availabilityCommitLocks.add(contextId);
|
|
5302
5467
|
currentContext = this.availabilityContextRegistry.get(contextId);
|
|
5303
|
-
|
|
5468
|
+
_context50.next = 9;
|
|
5304
5469
|
return this.emitAvailabilityDiagnostic({
|
|
5305
5470
|
action: 'commit_lock_acquired',
|
|
5306
5471
|
contextId: contextId,
|
|
@@ -5312,11 +5477,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5312
5477
|
});
|
|
5313
5478
|
case 9:
|
|
5314
5479
|
case "end":
|
|
5315
|
-
return
|
|
5480
|
+
return _context50.stop();
|
|
5316
5481
|
}
|
|
5317
|
-
},
|
|
5482
|
+
}, _callee50, this);
|
|
5318
5483
|
}));
|
|
5319
|
-
function tryAcquireAvailabilityCommitLock(
|
|
5484
|
+
function tryAcquireAvailabilityCommitLock(_x34) {
|
|
5320
5485
|
return _tryAcquireAvailabilityCommitLock.apply(this, arguments);
|
|
5321
5486
|
}
|
|
5322
5487
|
return tryAcquireAvailabilityCommitLock;
|
|
@@ -5324,15 +5489,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5324
5489
|
}, {
|
|
5325
5490
|
key: "releaseAvailabilityCommitLock",
|
|
5326
5491
|
value: function () {
|
|
5327
|
-
var _releaseAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5492
|
+
var _releaseAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(contextId) {
|
|
5328
5493
|
var _releasedContext$acti;
|
|
5329
5494
|
var releasedContext;
|
|
5330
|
-
return _regeneratorRuntime().wrap(function
|
|
5331
|
-
while (1) switch (
|
|
5495
|
+
return _regeneratorRuntime().wrap(function _callee51$(_context51) {
|
|
5496
|
+
while (1) switch (_context51.prev = _context51.next) {
|
|
5332
5497
|
case 0:
|
|
5333
5498
|
this.availabilityCommitLocks.delete(contextId);
|
|
5334
5499
|
releasedContext = this.availabilityContextRegistry.get(contextId);
|
|
5335
|
-
|
|
5500
|
+
_context51.next = 4;
|
|
5336
5501
|
return this.emitAvailabilityDiagnostic({
|
|
5337
5502
|
action: 'commit_lock_released',
|
|
5338
5503
|
contextId: contextId,
|
|
@@ -5344,11 +5509,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5344
5509
|
});
|
|
5345
5510
|
case 4:
|
|
5346
5511
|
case "end":
|
|
5347
|
-
return
|
|
5512
|
+
return _context51.stop();
|
|
5348
5513
|
}
|
|
5349
|
-
},
|
|
5514
|
+
}, _callee51, this);
|
|
5350
5515
|
}));
|
|
5351
|
-
function releaseAvailabilityCommitLock(
|
|
5516
|
+
function releaseAvailabilityCommitLock(_x35) {
|
|
5352
5517
|
return _releaseAvailabilityCommitLock.apply(this, arguments);
|
|
5353
5518
|
}
|
|
5354
5519
|
return releaseAvailabilityCommitLock;
|
|
@@ -5356,20 +5521,20 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5356
5521
|
}, {
|
|
5357
5522
|
key: "prepareAvailabilityProjection",
|
|
5358
5523
|
value: (function () {
|
|
5359
|
-
var _prepareAvailabilityProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5524
|
+
var _prepareAvailabilityProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(params) {
|
|
5360
5525
|
var paramsWithDefaults, _yield$this$getShared, prepareKey, snapshot, contextId, projectionEntry, context, handle, payload;
|
|
5361
|
-
return _regeneratorRuntime().wrap(function
|
|
5362
|
-
while (1) switch (
|
|
5526
|
+
return _regeneratorRuntime().wrap(function _callee52$(_context52) {
|
|
5527
|
+
while (1) switch (_context52.prev = _context52.next) {
|
|
5363
5528
|
case 0:
|
|
5364
5529
|
this.assertAvailabilityPrepareParams(params);
|
|
5365
|
-
|
|
5530
|
+
_context52.next = 3;
|
|
5366
5531
|
return this.resolveAvailabilityPrepareDefaults(params);
|
|
5367
5532
|
case 3:
|
|
5368
|
-
paramsWithDefaults =
|
|
5369
|
-
|
|
5533
|
+
paramsWithDefaults = _context52.sent;
|
|
5534
|
+
_context52.next = 6;
|
|
5370
5535
|
return this.getSharedPreparedAvailabilitySnapshot(paramsWithDefaults);
|
|
5371
5536
|
case 6:
|
|
5372
|
-
_yield$this$getShared =
|
|
5537
|
+
_yield$this$getShared = _context52.sent;
|
|
5373
5538
|
prepareKey = _yield$this$getShared.prepareKey;
|
|
5374
5539
|
snapshot = _yield$this$getShared.snapshot;
|
|
5375
5540
|
contextId = this.createAvailabilityContextId();
|
|
@@ -5390,7 +5555,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5390
5555
|
refreshed: false,
|
|
5391
5556
|
reason: 'prepare'
|
|
5392
5557
|
};
|
|
5393
|
-
|
|
5558
|
+
_context52.next = 16;
|
|
5394
5559
|
return this.emitAvailabilityDiagnostic({
|
|
5395
5560
|
action: 'prepare',
|
|
5396
5561
|
contextId: contextId,
|
|
@@ -5401,17 +5566,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5401
5566
|
reason: 'prepare'
|
|
5402
5567
|
});
|
|
5403
5568
|
case 16:
|
|
5404
|
-
|
|
5569
|
+
_context52.next = 18;
|
|
5405
5570
|
return this.core.effects.emit("".concat(this.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilityProjectionPrepared), payload);
|
|
5406
5571
|
case 18:
|
|
5407
|
-
return
|
|
5572
|
+
return _context52.abrupt("return", handle);
|
|
5408
5573
|
case 19:
|
|
5409
5574
|
case "end":
|
|
5410
|
-
return
|
|
5575
|
+
return _context52.stop();
|
|
5411
5576
|
}
|
|
5412
|
-
},
|
|
5577
|
+
}, _callee52, this);
|
|
5413
5578
|
}));
|
|
5414
|
-
function prepareAvailabilityProjection(
|
|
5579
|
+
function prepareAvailabilityProjection(_x36) {
|
|
5415
5580
|
return _prepareAvailabilityProjection.apply(this, arguments);
|
|
5416
5581
|
}
|
|
5417
5582
|
return prepareAvailabilityProjection;
|
|
@@ -5419,9 +5584,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5419
5584
|
}, {
|
|
5420
5585
|
key: "getProductTimeRanges",
|
|
5421
5586
|
value: (function () {
|
|
5422
|
-
var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5587
|
+
var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(contextId) {
|
|
5423
5588
|
var _this$otherParams$pla2,
|
|
5424
|
-
_this$
|
|
5589
|
+
_this$otherParams33,
|
|
5425
5590
|
_context$prepareParam,
|
|
5426
5591
|
_extractFixedOffsetMi,
|
|
5427
5592
|
_this16 = this;
|
|
@@ -5439,26 +5604,26 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5439
5604
|
businessDate,
|
|
5440
5605
|
rememberedStartAtByProductId,
|
|
5441
5606
|
allowOutsideOperatingHoursForRequestedStartTimes,
|
|
5442
|
-
|
|
5443
|
-
return _regeneratorRuntime().wrap(function
|
|
5444
|
-
while (1) switch (
|
|
5607
|
+
_args53 = arguments;
|
|
5608
|
+
return _regeneratorRuntime().wrap(function _callee53$(_context53) {
|
|
5609
|
+
while (1) switch (_context53.prev = _context53.next) {
|
|
5445
5610
|
case 0:
|
|
5446
|
-
request =
|
|
5447
|
-
|
|
5611
|
+
request = _args53.length > 1 && _args53[1] !== undefined ? _args53[1] : {};
|
|
5612
|
+
_context53.next = 3;
|
|
5448
5613
|
return this.ensureAvailabilityContextProjection(contextId, 'get_product_time_ranges');
|
|
5449
5614
|
case 3:
|
|
5450
|
-
_yield$this$ensureAva =
|
|
5615
|
+
_yield$this$ensureAva = _context53.sent;
|
|
5451
5616
|
context = _yield$this$ensureAva.context;
|
|
5452
5617
|
projectionEntry = _yield$this$ensureAva.projectionEntry;
|
|
5453
5618
|
contextVersion = context.activeVersion;
|
|
5454
|
-
isPosAvailabilityRequest = String((_this$otherParams$pla2 = (_this$
|
|
5619
|
+
isPosAvailabilityRequest = String((_this$otherParams$pla2 = (_this$otherParams33 = this.otherParams) === null || _this$otherParams33 === void 0 ? void 0 : _this$otherParams33.platform) !== null && _this$otherParams$pla2 !== void 0 ? _this$otherParams$pla2 : '').trim().toLowerCase() === 'pos';
|
|
5455
5620
|
isEditingContext = Boolean((_context$prepareParam = context.prepareParams.editingProductLineUids) === null || _context$prepareParam === void 0 ? void 0 : _context$prepareParam.length);
|
|
5456
5621
|
editingOffset = (_extractFixedOffsetMi = extractFixedOffsetMinutes(projectionEntry.projection.meta.now)) !== null && _extractFixedOffsetMi !== void 0 ? _extractFixedOffsetMi : this.getAvailabilityRuntimeOffsetMinutes(); // This new editing input represents an absolute instant. Normalize it once
|
|
5457
5622
|
// to the projection's fixed business clock before the wall-clock planner.
|
|
5458
|
-
editingStartAtByProductId = isEditingContext && request.editingStartAtByProductId ? Object.fromEntries(Object.entries(request.editingStartAtByProductId).map(function (
|
|
5459
|
-
var
|
|
5460
|
-
productId =
|
|
5461
|
-
startAt =
|
|
5623
|
+
editingStartAtByProductId = isEditingContext && request.editingStartAtByProductId ? Object.fromEntries(Object.entries(request.editingStartAtByProductId).map(function (_ref54) {
|
|
5624
|
+
var _ref55 = _slicedToArray(_ref54, 2),
|
|
5625
|
+
productId = _ref55[0],
|
|
5626
|
+
startAt = _ref55[1];
|
|
5462
5627
|
try {
|
|
5463
5628
|
var _extractFixedOffsetMi2;
|
|
5464
5629
|
var scalar = localDateTimeToScalar(parseLocalDateTime(startAt));
|
|
@@ -5482,7 +5647,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5482
5647
|
allowOutsideOperatingHoursForRequestedStartTimes = isPosAvailabilityRequest && !rememberedStartAtByProductId && (editingStarts.length > 0 || Object.values(request.durationStartTimesByProductId || {}).some(function (startTimes) {
|
|
5483
5648
|
return Array.isArray(startTimes) && startTimes.length > 0;
|
|
5484
5649
|
}));
|
|
5485
|
-
return
|
|
5650
|
+
return _context53.abrupt("return", getProjectionProductTimeRanges(projectionEntry.projection, _objectSpread(_objectSpread(_objectSpread({}, request), {}, {
|
|
5486
5651
|
dateRange: dateRange,
|
|
5487
5652
|
editingStartAtByProductId: editingStartAtByProductId,
|
|
5488
5653
|
rememberedStartAtByProductId: rememberedStartAtByProductId
|
|
@@ -5506,11 +5671,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5506
5671
|
}));
|
|
5507
5672
|
case 17:
|
|
5508
5673
|
case "end":
|
|
5509
|
-
return
|
|
5674
|
+
return _context53.stop();
|
|
5510
5675
|
}
|
|
5511
|
-
},
|
|
5676
|
+
}, _callee53, this);
|
|
5512
5677
|
}));
|
|
5513
|
-
function getProductTimeRanges(
|
|
5678
|
+
function getProductTimeRanges(_x37) {
|
|
5514
5679
|
return _getProductTimeRanges.apply(this, arguments);
|
|
5515
5680
|
}
|
|
5516
5681
|
return getProductTimeRanges;
|
|
@@ -5518,21 +5683,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5518
5683
|
}, {
|
|
5519
5684
|
key: "queryBookingAvailability",
|
|
5520
5685
|
value: (function () {
|
|
5521
|
-
var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5522
|
-
var _this$otherParams$pla3, _this$
|
|
5686
|
+
var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(contextId, request) {
|
|
5687
|
+
var _this$otherParams$pla3, _this$otherParams34, _context$prepareParam2;
|
|
5523
5688
|
var _yield$this$ensureAva2, context, projectionEntry, refreshed, isPosAvailabilityRequest, queryRequest, result, contextVersion, contextualResult;
|
|
5524
|
-
return _regeneratorRuntime().wrap(function
|
|
5525
|
-
while (1) switch (
|
|
5689
|
+
return _regeneratorRuntime().wrap(function _callee54$(_context54) {
|
|
5690
|
+
while (1) switch (_context54.prev = _context54.next) {
|
|
5526
5691
|
case 0:
|
|
5527
|
-
|
|
5692
|
+
_context54.next = 2;
|
|
5528
5693
|
return this.ensureAvailabilityContextProjection(contextId, 'query_booking_availability');
|
|
5529
5694
|
case 2:
|
|
5530
|
-
_yield$this$ensureAva2 =
|
|
5695
|
+
_yield$this$ensureAva2 = _context54.sent;
|
|
5531
5696
|
context = _yield$this$ensureAva2.context;
|
|
5532
5697
|
projectionEntry = _yield$this$ensureAva2.projectionEntry;
|
|
5533
5698
|
refreshed = _yield$this$ensureAva2.refreshed;
|
|
5534
5699
|
this.assertContextualQueryFreshness(context, request);
|
|
5535
|
-
isPosAvailabilityRequest = String((_this$otherParams$pla3 = (_this$
|
|
5700
|
+
isPosAvailabilityRequest = String((_this$otherParams$pla3 = (_this$otherParams34 = this.otherParams) === null || _this$otherParams34 === void 0 ? void 0 : _this$otherParams34.platform) !== null && _this$otherParams$pla3 !== void 0 ? _this$otherParams$pla3 : '').trim().toLowerCase() === 'pos';
|
|
5536
5701
|
queryRequest = request.target === 'date' || request.target === 'product' ? _objectSpread(_objectSpread({}, request), {}, {
|
|
5537
5702
|
dateRange: request.dateRange || this.getAvailabilityBusinessDateRange(projectionEntry.projection)
|
|
5538
5703
|
}) : request;
|
|
@@ -5568,18 +5733,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5568
5733
|
});
|
|
5569
5734
|
})
|
|
5570
5735
|
}) : result;
|
|
5571
|
-
return
|
|
5736
|
+
return _context54.abrupt("return", _objectSpread(_objectSpread({}, contextualResult), {}, {
|
|
5572
5737
|
contextId: context.contextId,
|
|
5573
5738
|
contextVersion: contextVersion,
|
|
5574
5739
|
refreshed: refreshed
|
|
5575
5740
|
}));
|
|
5576
5741
|
case 13:
|
|
5577
5742
|
case "end":
|
|
5578
|
-
return
|
|
5743
|
+
return _context54.stop();
|
|
5579
5744
|
}
|
|
5580
|
-
},
|
|
5745
|
+
}, _callee54, this);
|
|
5581
5746
|
}));
|
|
5582
|
-
function queryBookingAvailability(
|
|
5747
|
+
function queryBookingAvailability(_x38, _x39) {
|
|
5583
5748
|
return _queryBookingAvailability.apply(this, arguments);
|
|
5584
5749
|
}
|
|
5585
5750
|
return queryBookingAvailability;
|
|
@@ -5636,9 +5801,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5636
5801
|
}, {
|
|
5637
5802
|
key: "findLinkedBooking",
|
|
5638
5803
|
value: function findLinkedBooking(product) {
|
|
5639
|
-
var
|
|
5804
|
+
var _ref56, _product$booking_uid3, _product$metadata7, _this$getTempOrder4;
|
|
5640
5805
|
var productUid = getProductLineUid(product);
|
|
5641
|
-
var bookingUid = String((
|
|
5806
|
+
var bookingUid = String((_ref56 = (_product$booking_uid3 = product.booking_uid) !== null && _product$booking_uid3 !== void 0 ? _product$booking_uid3 : (_product$metadata7 = product.metadata) === null || _product$metadata7 === void 0 ? void 0 : _product$metadata7.booking_uid) !== null && _ref56 !== void 0 ? _ref56 : '');
|
|
5642
5807
|
return (((_this$getTempOrder4 = this.getTempOrder()) === null || _this$getTempOrder4 === void 0 ? void 0 : _this$getTempOrder4.bookings) || []).find(function (booking) {
|
|
5643
5808
|
var _booking$product_uid3;
|
|
5644
5809
|
return bookingUid && getBookingUid(booking) === bookingUid || productUid && String((_booking$product_uid3 = booking.product_uid) !== null && _booking$product_uid3 !== void 0 ? _booking$product_uid3 : '') === productUid;
|
|
@@ -5647,27 +5812,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5647
5812
|
}, {
|
|
5648
5813
|
key: "removeBookingProductsOutsideStartDate",
|
|
5649
5814
|
value: function () {
|
|
5650
|
-
var _removeBookingProductsOutsideStartDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5815
|
+
var _removeBookingProductsOutsideStartDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(startDate) {
|
|
5651
5816
|
var _this$getTempOrder5,
|
|
5652
|
-
_this$
|
|
5817
|
+
_this$otherParams35,
|
|
5653
5818
|
_this17 = this;
|
|
5654
5819
|
var products, targetDate, identities;
|
|
5655
|
-
return _regeneratorRuntime().wrap(function
|
|
5656
|
-
while (1) switch (
|
|
5820
|
+
return _regeneratorRuntime().wrap(function _callee55$(_context55) {
|
|
5821
|
+
while (1) switch (_context55.prev = _context55.next) {
|
|
5657
5822
|
case 0:
|
|
5658
5823
|
products = ((_this$getTempOrder5 = this.getTempOrder()) === null || _this$getTempOrder5 === void 0 ? void 0 : _this$getTempOrder5.products) || [];
|
|
5659
|
-
if (!(((_this$
|
|
5660
|
-
|
|
5824
|
+
if (!(((_this$otherParams35 = this.otherParams) === null || _this$otherParams35 === void 0 ? void 0 : _this$otherParams35.enforceSingleBookingStartDate) !== true)) {
|
|
5825
|
+
_context55.next = 3;
|
|
5661
5826
|
break;
|
|
5662
5827
|
}
|
|
5663
|
-
return
|
|
5828
|
+
return _context55.abrupt("return", products);
|
|
5664
5829
|
case 3:
|
|
5665
5830
|
targetDate = getVisibleCalendarDate(startDate);
|
|
5666
5831
|
if (targetDate) {
|
|
5667
|
-
|
|
5832
|
+
_context55.next = 6;
|
|
5668
5833
|
break;
|
|
5669
5834
|
}
|
|
5670
|
-
return
|
|
5835
|
+
return _context55.abrupt("return", products);
|
|
5671
5836
|
case 6:
|
|
5672
5837
|
identities = products.flatMap(function (product) {
|
|
5673
5838
|
var _product$metadata8;
|
|
@@ -5679,14 +5844,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5679
5844
|
var bookingDate = getVisibleCalendarDate(booking.start_date);
|
|
5680
5845
|
return bookingDate && bookingDate !== targetDate ? [buildAvailabilityLineIdentity(product)] : [];
|
|
5681
5846
|
});
|
|
5682
|
-
return
|
|
5847
|
+
return _context55.abrupt("return", identities.length ? this.removeProductsFromOrder(identities) : products);
|
|
5683
5848
|
case 8:
|
|
5684
5849
|
case "end":
|
|
5685
|
-
return
|
|
5850
|
+
return _context55.stop();
|
|
5686
5851
|
}
|
|
5687
|
-
},
|
|
5852
|
+
}, _callee55, this);
|
|
5688
5853
|
}));
|
|
5689
|
-
function removeBookingProductsOutsideStartDate(
|
|
5854
|
+
function removeBookingProductsOutsideStartDate(_x40) {
|
|
5690
5855
|
return _removeBookingProductsOutsideStartDate.apply(this, arguments);
|
|
5691
5856
|
}
|
|
5692
5857
|
return removeBookingProductsOutsideStartDate;
|
|
@@ -5694,20 +5859,20 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5694
5859
|
}, {
|
|
5695
5860
|
key: "commitAvailabilitySelection",
|
|
5696
5861
|
value: (function () {
|
|
5697
|
-
var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5862
|
+
var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(contextId, params) {
|
|
5698
5863
|
var _this$otherParams$pla4,
|
|
5699
|
-
_this$
|
|
5864
|
+
_this$otherParams36,
|
|
5700
5865
|
_params$availabilityC,
|
|
5701
5866
|
_this$store$order11,
|
|
5702
5867
|
_this$store$order11$e,
|
|
5703
5868
|
_this18 = this;
|
|
5704
|
-
var normalizedContextId, isRememberedSelection, hasCommitGuard, rememberedOrder, getRememberedCommitIdentity, rememberedCommitIdentity, availabilityCommitTargetGuard, guardedCommitPublished, _params$bookingCount,
|
|
5705
|
-
return _regeneratorRuntime().wrap(function
|
|
5706
|
-
while (1) switch (
|
|
5869
|
+
var normalizedContextId, isRememberedSelection, hasCommitGuard, rememberedOrder, getRememberedCommitIdentity, rememberedCommitIdentity, availabilityCommitTargetGuard, guardedCommitPublished, _params$bookingCount, _ref57, _params$orderProduct$, _params$orderProduct, _params$orderProduct2, _params$orderProduct3, _params$orderProduct$2, _params$orderProduct4, _params$orderProduct5, _editingLine$product_, _this$otherParams$pla5, _this$otherParams37, _baseProjection$meta$, _refreshedProjection$, _baseProjection$meta$2, _this$otherParams$pla6, _this$otherParams38, _ref58, _params$orderProduct$3, _params$orderProduct6, _existingBooking$meta, _ref59, _ref60, _params$orderProduct$4, _params$orderProduct7, _params$orderProduct8, _existingBooking$meta2, _existingBooking$hold, _params$orderProduct9, _nextContext$activeVe, bookingCount, orderProductQuantity, partySize, _yield$this$ensureAva3, context, projectionEntry, refreshed, boundEditingUids, orderProductId, editingLine, _editingLine$product_2, baseProjection, selectedProduct, commitWriteGuard, prepareParams, fallbackResources, commitSnapshot, refreshedProjection, _baseProjection$meta$3, latestContext, candidateDurationMinutes, candidateStartTime, allowPosAvailabilityOverride, candidateBusinessDate, refreshedRanges, refreshedCandidateBase, product, validation, forced, capacityConflict, revalidationEntry, revalidatedContext, refreshedCandidate, availabilityCommitGuard, existingBooking, existingBookingUid, booking, legacyBooking, legacyResources, selectedResources, resourceKeys, transformed, productLineUid, bookingUid, productLineUids, bookingUids, _transformed$product_, _transformed$product_2, _transformed$product_3, _ref61, _transformed$product_4, _this$getTempOrder6, _this$getTempOrder7, _params$salesNotes, _params$salesNotes2, _ref62, beforeProductLineUids, beforeBookingUids, products, addedLines, addedBookings, targetStillCurrent, nextContext, result, emit, release;
|
|
5870
|
+
return _regeneratorRuntime().wrap(function _callee56$(_context56) {
|
|
5871
|
+
while (1) switch (_context56.prev = _context56.next) {
|
|
5707
5872
|
case 0:
|
|
5708
5873
|
normalizedContextId = String(contextId || '').trim();
|
|
5709
5874
|
if (normalizedContextId) {
|
|
5710
|
-
|
|
5875
|
+
_context56.next = 3;
|
|
5711
5876
|
break;
|
|
5712
5877
|
}
|
|
5713
5878
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'commitAvailabilitySelection 缺少 contextId', {
|
|
@@ -5715,8 +5880,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5715
5880
|
});
|
|
5716
5881
|
case 3:
|
|
5717
5882
|
isRememberedSelection = params.selectionIntent === 'remembered';
|
|
5718
|
-
if (!(isRememberedSelection && (String((_this$otherParams$pla4 = (_this$
|
|
5719
|
-
|
|
5883
|
+
if (!(isRememberedSelection && (String((_this$otherParams$pla4 = (_this$otherParams36 = this.otherParams) === null || _this$otherParams36 === void 0 ? void 0 : _this$otherParams36.platform) !== null && _this$otherParams$pla4 !== void 0 ? _this$otherParams$pla4 : '').trim().toLowerCase() !== 'pos' || params.mode !== 'add'))) {
|
|
5884
|
+
_context56.next = 6;
|
|
5720
5885
|
break;
|
|
5721
5886
|
}
|
|
5722
5887
|
throw new AvailabilityError('INVALID_TARGET_FILTER', '记忆时间自动提交仅支持 POS 新增 duration 商品');
|
|
@@ -5741,13 +5906,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5741
5906
|
return _this18.getTempOrder() === rememberedOrder && getRememberedCommitIdentity() === rememberedCommitIdentity;
|
|
5742
5907
|
};
|
|
5743
5908
|
guardedCommitPublished = false;
|
|
5744
|
-
|
|
5909
|
+
_context56.next = 16;
|
|
5745
5910
|
return this.tryAcquireAvailabilityCommitLock(normalizedContextId);
|
|
5746
5911
|
case 16:
|
|
5747
|
-
|
|
5912
|
+
_context56.prev = 16;
|
|
5748
5913
|
bookingCount = Number((_params$bookingCount = params.bookingCount) !== null && _params$bookingCount !== void 0 ? _params$bookingCount : 1);
|
|
5749
5914
|
if (!(!Number.isInteger(bookingCount) || bookingCount <= 0)) {
|
|
5750
|
-
|
|
5915
|
+
_context56.next = 20;
|
|
5751
5916
|
break;
|
|
5752
5917
|
}
|
|
5753
5918
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'bookingCount 必须是正整数', {
|
|
@@ -5755,16 +5920,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5755
5920
|
});
|
|
5756
5921
|
case 20:
|
|
5757
5922
|
if (!(params.mode === 'edit' && bookingCount !== 1)) {
|
|
5758
|
-
|
|
5923
|
+
_context56.next = 22;
|
|
5759
5924
|
break;
|
|
5760
5925
|
}
|
|
5761
5926
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', '编辑预约商品时 bookingCount 必须为 1', {
|
|
5762
5927
|
bookingCount: bookingCount
|
|
5763
5928
|
});
|
|
5764
5929
|
case 22:
|
|
5765
|
-
orderProductQuantity = (
|
|
5930
|
+
orderProductQuantity = (_ref57 = (_params$orderProduct$ = (_params$orderProduct = params.orderProduct) === null || _params$orderProduct === void 0 ? void 0 : _params$orderProduct.num) !== null && _params$orderProduct$ !== void 0 ? _params$orderProduct$ : (_params$orderProduct2 = params.orderProduct) === null || _params$orderProduct2 === void 0 ? void 0 : _params$orderProduct2.quantity) !== null && _ref57 !== void 0 ? _ref57 : (_params$orderProduct3 = params.orderProduct) === null || _params$orderProduct3 === void 0 || (_params$orderProduct3 = _params$orderProduct3._extend) === null || _params$orderProduct3 === void 0 ? void 0 : _params$orderProduct3.quantity;
|
|
5766
5931
|
if (!(orderProductQuantity !== undefined && orderProductQuantity !== null && Number(orderProductQuantity) !== bookingCount)) {
|
|
5767
|
-
|
|
5932
|
+
_context56.next = 25;
|
|
5768
5933
|
break;
|
|
5769
5934
|
}
|
|
5770
5935
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'orderProduct 数量与 bookingCount 不一致', {
|
|
@@ -5774,22 +5939,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5774
5939
|
case 25:
|
|
5775
5940
|
partySize = Number(params.partySize);
|
|
5776
5941
|
if (!(!Number.isInteger(partySize) || partySize <= 0)) {
|
|
5777
|
-
|
|
5942
|
+
_context56.next = 28;
|
|
5778
5943
|
break;
|
|
5779
5944
|
}
|
|
5780
5945
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'partySize 必须是正整数', {
|
|
5781
5946
|
partySize: params.partySize
|
|
5782
5947
|
});
|
|
5783
5948
|
case 28:
|
|
5784
|
-
|
|
5949
|
+
_context56.next = 30;
|
|
5785
5950
|
return this.ensureAvailabilityContextProjection(normalizedContextId, 'commit_precheck');
|
|
5786
5951
|
case 30:
|
|
5787
|
-
_yield$this$ensureAva3 =
|
|
5952
|
+
_yield$this$ensureAva3 = _context56.sent;
|
|
5788
5953
|
context = _yield$this$ensureAva3.context;
|
|
5789
5954
|
projectionEntry = _yield$this$ensureAva3.projectionEntry;
|
|
5790
5955
|
refreshed = _yield$this$ensureAva3.refreshed;
|
|
5791
5956
|
if (!refreshed) {
|
|
5792
|
-
|
|
5957
|
+
_context56.next = 36;
|
|
5793
5958
|
break;
|
|
5794
5959
|
}
|
|
5795
5960
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
|
|
@@ -5800,11 +5965,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5800
5965
|
case 36:
|
|
5801
5966
|
boundEditingUids = context.prepareParams.editingProductLineUids || [];
|
|
5802
5967
|
if (!(params.mode === 'edit')) {
|
|
5803
|
-
|
|
5968
|
+
_context56.next = 42;
|
|
5804
5969
|
break;
|
|
5805
5970
|
}
|
|
5806
5971
|
if (!(!params.productLineUid || !boundEditingUids.includes(String(params.productLineUid)))) {
|
|
5807
|
-
|
|
5972
|
+
_context56.next = 40;
|
|
5808
5973
|
break;
|
|
5809
5974
|
}
|
|
5810
5975
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 与当前商品行不匹配,请重新 prepare 编辑上下文', {
|
|
@@ -5813,11 +5978,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5813
5978
|
editingProductLineUids: boundEditingUids
|
|
5814
5979
|
});
|
|
5815
5980
|
case 40:
|
|
5816
|
-
|
|
5981
|
+
_context56.next = 44;
|
|
5817
5982
|
break;
|
|
5818
5983
|
case 42:
|
|
5819
5984
|
if (!(boundEditingUids.length > 0)) {
|
|
5820
|
-
|
|
5985
|
+
_context56.next = 44;
|
|
5821
5986
|
break;
|
|
5822
5987
|
}
|
|
5823
5988
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 不能用于 add,请重新 prepare 新增上下文', {
|
|
@@ -5826,7 +5991,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5826
5991
|
});
|
|
5827
5992
|
case 44:
|
|
5828
5993
|
if (!(projectionEntry.contextVersion !== context.activeVersion)) {
|
|
5829
|
-
|
|
5994
|
+
_context56.next = 46;
|
|
5830
5995
|
break;
|
|
5831
5996
|
}
|
|
5832
5997
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
|
|
@@ -5836,7 +6001,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5836
6001
|
});
|
|
5837
6002
|
case 46:
|
|
5838
6003
|
if (!(projectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
|
|
5839
|
-
|
|
6004
|
+
_context56.next = 48;
|
|
5840
6005
|
break;
|
|
5841
6006
|
}
|
|
5842
6007
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '购物车已变化,请重新获取候选', {
|
|
@@ -5847,7 +6012,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5847
6012
|
});
|
|
5848
6013
|
case 48:
|
|
5849
6014
|
if (!(projectionEntry.contextVersion !== params.candidate.availabilityContextVersion)) {
|
|
5850
|
-
|
|
6015
|
+
_context56.next = 50;
|
|
5851
6016
|
break;
|
|
5852
6017
|
}
|
|
5853
6018
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '候选已过期,请重新获取最新时间段', {
|
|
@@ -5859,7 +6024,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5859
6024
|
this.assertAvailabilityCandidateFreshness(context, params.candidate);
|
|
5860
6025
|
orderProductId = (_params$orderProduct$2 = (_params$orderProduct4 = params.orderProduct) === null || _params$orderProduct4 === void 0 ? void 0 : _params$orderProduct4.product_id) !== null && _params$orderProduct$2 !== void 0 ? _params$orderProduct$2 : (_params$orderProduct5 = params.orderProduct) === null || _params$orderProduct5 === void 0 ? void 0 : _params$orderProduct5.id;
|
|
5861
6026
|
if (sameAvailabilityId(orderProductId, params.candidate.productId)) {
|
|
5862
|
-
|
|
6027
|
+
_context56.next = 54;
|
|
5863
6028
|
break;
|
|
5864
6029
|
}
|
|
5865
6030
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 与 candidate 商品不一致', {
|
|
@@ -5868,14 +6033,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5868
6033
|
});
|
|
5869
6034
|
case 54:
|
|
5870
6035
|
if (!(params.mode === 'edit' && !params.productLineUid)) {
|
|
5871
|
-
|
|
6036
|
+
_context56.next = 56;
|
|
5872
6037
|
break;
|
|
5873
6038
|
}
|
|
5874
6039
|
throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', 'edit 模式必须提供 productLineUid');
|
|
5875
6040
|
case 56:
|
|
5876
6041
|
editingLine = params.mode === 'edit' ? this.findProductLineByUid(String(params.productLineUid)) : undefined;
|
|
5877
6042
|
if (!(params.mode === 'edit' && !editingLine)) {
|
|
5878
|
-
|
|
6043
|
+
_context56.next = 59;
|
|
5879
6044
|
break;
|
|
5880
6045
|
}
|
|
5881
6046
|
throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '找不到要编辑的预约商品行', {
|
|
@@ -5883,7 +6048,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5883
6048
|
});
|
|
5884
6049
|
case 59:
|
|
5885
6050
|
if (!(editingLine && !sameAvailabilityId((_editingLine$product_ = editingLine.product_id) !== null && _editingLine$product_ !== void 0 ? _editingLine$product_ : editingLine.id, params.candidate.productId))) {
|
|
5886
|
-
|
|
6051
|
+
_context56.next = 61;
|
|
5887
6052
|
break;
|
|
5888
6053
|
}
|
|
5889
6054
|
throw new AvailabilityError('INVALID_TARGET_FILTER', '编辑商品行与 candidate 商品不一致', {
|
|
@@ -5893,7 +6058,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5893
6058
|
});
|
|
5894
6059
|
case 61:
|
|
5895
6060
|
if (Array.isArray(params.requirementSelections)) {
|
|
5896
|
-
|
|
6061
|
+
_context56.next = 63;
|
|
5897
6062
|
break;
|
|
5898
6063
|
}
|
|
5899
6064
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'requirementSelections 必须是数组', {
|
|
@@ -5904,8 +6069,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5904
6069
|
selectedProduct = baseProjection.products.find(function (item) {
|
|
5905
6070
|
return sameAvailabilityId(item.id, params.candidate.productId);
|
|
5906
6071
|
});
|
|
5907
|
-
if (!(isRememberedSelection && (String((_this$otherParams$pla5 = (_this$
|
|
5908
|
-
|
|
6072
|
+
if (!(isRememberedSelection && (String((_this$otherParams$pla5 = (_this$otherParams37 = this.otherParams) === null || _this$otherParams37 === void 0 ? void 0 : _this$otherParams37.platform) !== null && _this$otherParams$pla5 !== void 0 ? _this$otherParams$pla5 : '').trim().toLowerCase() !== 'pos' || params.mode !== 'add' || (selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.kind) !== 'duration'))) {
|
|
6073
|
+
_context56.next = 67;
|
|
5909
6074
|
break;
|
|
5910
6075
|
}
|
|
5911
6076
|
throw new AvailabilityError('INVALID_TARGET_FILTER', '记忆时间自动提交仅支持 POS 新增 duration 商品');
|
|
@@ -5919,7 +6084,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5919
6084
|
};
|
|
5920
6085
|
prepareParams = baseProjection.meta.prepareParams;
|
|
5921
6086
|
if (prepareParams) {
|
|
5922
|
-
|
|
6087
|
+
_context56.next = 71;
|
|
5923
6088
|
break;
|
|
5924
6089
|
}
|
|
5925
6090
|
throw new AvailabilityError('REVALIDATION_FAILED', 'projection 缺少 prepareParams,无法执行缓存重校验');
|
|
@@ -5931,7 +6096,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5931
6096
|
})),
|
|
5932
6097
|
includesInjectedRawOccupancies: true
|
|
5933
6098
|
};
|
|
5934
|
-
|
|
6099
|
+
_context56.next = 74;
|
|
5935
6100
|
return this.buildAvailabilityProjectionSnapshot(_objectSpread(_objectSpread({}, this.cloneAvailabilityPrepareParams(prepareParams)), {}, {
|
|
5936
6101
|
editingProductLineUids: params.mode === 'edit' && params.productLineUid ? [params.productLineUid] : []
|
|
5937
6102
|
}), {
|
|
@@ -5940,13 +6105,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5940
6105
|
durationCandidateAnchorAt: this.getAvailabilityDurationCandidateAnchorAt(baseProjection) || context.durationCandidateAnchorAt
|
|
5941
6106
|
});
|
|
5942
6107
|
case 74:
|
|
5943
|
-
commitSnapshot =
|
|
6108
|
+
commitSnapshot = _context56.sent;
|
|
5944
6109
|
refreshedProjection = commitSnapshot.projection;
|
|
5945
6110
|
if (!(String((_refreshedProjection$ = refreshedProjection.meta.orderRevision) !== null && _refreshedProjection$ !== void 0 ? _refreshedProjection$ : '') !== String((_baseProjection$meta$2 = baseProjection.meta.orderRevision) !== null && _baseProjection$meta$2 !== void 0 ? _baseProjection$meta$2 : ''))) {
|
|
5946
|
-
|
|
6111
|
+
_context56.next = 81;
|
|
5947
6112
|
break;
|
|
5948
6113
|
}
|
|
5949
|
-
|
|
6114
|
+
_context56.next = 79;
|
|
5950
6115
|
return this.refreshAvailabilityContextProjection({
|
|
5951
6116
|
contextId: normalizedContextId,
|
|
5952
6117
|
reason: 'commit_order_revision_changed',
|
|
@@ -5967,7 +6132,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5967
6132
|
this.assertAvailabilityCommitWriteCAS(commitWriteGuard);
|
|
5968
6133
|
candidateDurationMinutes = getCandidateDurationMinutes(params.candidate);
|
|
5969
6134
|
candidateStartTime = getCandidateStartTime(params.candidate);
|
|
5970
|
-
allowPosAvailabilityOverride = String((_this$otherParams$pla6 = (_this$
|
|
6135
|
+
allowPosAvailabilityOverride = String((_this$otherParams$pla6 = (_this$otherParams38 = this.otherParams) === null || _this$otherParams38 === void 0 ? void 0 : _this$otherParams38.platform) !== null && _this$otherParams$pla6 !== void 0 ? _this$otherParams$pla6 : '').trim().toLowerCase() === 'pos' && !isRememberedSelection;
|
|
5971
6136
|
candidateBusinessDate = params.candidate.businessDate || ((selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.kind) === 'duration' && this.usesDurationTimeGrid(refreshedProjection) ? getDurationBusinessDate(refreshedProjection, params.candidate.startAt) : params.candidate.startAt.slice(0, 10));
|
|
5972
6137
|
refreshedRanges = getProjectionProductTimeRanges(refreshedProjection, _objectSpread({
|
|
5973
6138
|
productIds: [params.candidate.productId],
|
|
@@ -6001,7 +6166,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6001
6166
|
return candidate.startAt === params.candidate.startAt && candidate.endAt === params.candidate.endAt && candidate.bookingStartAt === params.candidate.bookingStartAt && candidate.bookingEndAt === params.candidate.bookingEndAt;
|
|
6002
6167
|
});
|
|
6003
6168
|
if (refreshedCandidateBase) {
|
|
6004
|
-
|
|
6169
|
+
_context56.next = 90;
|
|
6005
6170
|
break;
|
|
6006
6171
|
}
|
|
6007
6172
|
throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后候选时间已不在商品配置中', {
|
|
@@ -6014,7 +6179,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6014
6179
|
return sameAvailabilityId(item.id, refreshedCandidateBase.productId);
|
|
6015
6180
|
});
|
|
6016
6181
|
if (product) {
|
|
6017
|
-
|
|
6182
|
+
_context56.next = 93;
|
|
6018
6183
|
break;
|
|
6019
6184
|
}
|
|
6020
6185
|
throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后商品不在 projection 中', {
|
|
@@ -6053,7 +6218,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6053
6218
|
});
|
|
6054
6219
|
}
|
|
6055
6220
|
if (validation.ok) {
|
|
6056
|
-
|
|
6221
|
+
_context56.next = 98;
|
|
6057
6222
|
break;
|
|
6058
6223
|
}
|
|
6059
6224
|
capacityConflict = validation.conflicts.find(function (conflict) {
|
|
@@ -6076,7 +6241,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6076
6241
|
incrementVersion: true
|
|
6077
6242
|
});
|
|
6078
6243
|
revalidatedContext = this.getAvailabilityContextEntry(normalizedContextId);
|
|
6079
|
-
|
|
6244
|
+
_context56.next = 102;
|
|
6080
6245
|
return this.emitAvailabilityDiagnostic({
|
|
6081
6246
|
action: 'refresh',
|
|
6082
6247
|
contextId: normalizedContextId,
|
|
@@ -6123,7 +6288,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6123
6288
|
existingBooking = editingLine ? this.findLinkedBooking(editingLine) : undefined;
|
|
6124
6289
|
existingBookingUid = existingBooking ? getBookingUid(existingBooking) : '';
|
|
6125
6290
|
if (!(params.mode === 'edit' && !existingBookingUid)) {
|
|
6126
|
-
|
|
6291
|
+
_context56.next = 109;
|
|
6127
6292
|
break;
|
|
6128
6293
|
}
|
|
6129
6294
|
throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '编辑商品行缺少关联 booking', {
|
|
@@ -6137,11 +6302,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6137
6302
|
product: product,
|
|
6138
6303
|
resources: refreshedProjection.resources,
|
|
6139
6304
|
bookingUid: existingBookingUid || undefined,
|
|
6140
|
-
holder: (
|
|
6141
|
-
holderIds: (
|
|
6305
|
+
holder: (_ref58 = (_params$orderProduct$3 = (_params$orderProduct6 = params.orderProduct) === null || _params$orderProduct6 === void 0 || (_params$orderProduct6 = _params$orderProduct6._extend) === null || _params$orderProduct6 === void 0 ? void 0 : _params$orderProduct6.holder) !== null && _params$orderProduct$3 !== void 0 ? _params$orderProduct$3 : existingBooking === null || existingBooking === void 0 ? void 0 : existingBooking.holder) !== null && _ref58 !== void 0 ? _ref58 : existingBooking === null || existingBooking === void 0 || (_existingBooking$meta = existingBooking.metadata) === null || _existingBooking$meta === void 0 ? void 0 : _existingBooking$meta.holder,
|
|
6306
|
+
holderIds: (_ref59 = (_ref60 = (_params$orderProduct$4 = (_params$orderProduct7 = params.orderProduct) === null || _params$orderProduct7 === void 0 || (_params$orderProduct7 = _params$orderProduct7._extend) === null || _params$orderProduct7 === void 0 ? void 0 : _params$orderProduct7.holder_id) !== null && _params$orderProduct$4 !== void 0 ? _params$orderProduct$4 : (_params$orderProduct8 = params.orderProduct) === null || _params$orderProduct8 === void 0 || (_params$orderProduct8 = _params$orderProduct8._extend) === null || _params$orderProduct8 === void 0 || (_params$orderProduct8 = _params$orderProduct8.holder) === null || _params$orderProduct8 === void 0 ? void 0 : _params$orderProduct8.form_record) !== null && _ref60 !== void 0 ? _ref60 : existingBooking === null || existingBooking === void 0 || (_existingBooking$meta2 = existingBooking.metadata) === null || _existingBooking$meta2 === void 0 ? void 0 : _existingBooking$meta2.holder_id) !== null && _ref59 !== void 0 ? _ref59 : existingBooking === null || existingBooking === void 0 || (_existingBooking$hold = existingBooking.holder) === null || _existingBooking$hold === void 0 ? void 0 : _existingBooking$hold.form_record
|
|
6142
6307
|
});
|
|
6143
6308
|
if (!(isRememberedSelection && (_params$orderProduct9 = params.orderProduct) !== null && _params$orderProduct9 !== void 0 && (_params$orderProduct9 = _params$orderProduct9._extend) !== null && _params$orderProduct9 !== void 0 && _params$orderProduct9.resource)) {
|
|
6144
|
-
|
|
6309
|
+
_context56.next = 119;
|
|
6145
6310
|
break;
|
|
6146
6311
|
}
|
|
6147
6312
|
// AutoClose 与编辑共用旧资源协议。仅复用其结构,实际资源及每份容量
|
|
@@ -6161,7 +6326,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6161
6326
|
return sameAvailabilityId(selected.form_id, resource.form_id);
|
|
6162
6327
|
});
|
|
6163
6328
|
}))) {
|
|
6164
|
-
|
|
6329
|
+
_context56.next = 118;
|
|
6165
6330
|
break;
|
|
6166
6331
|
}
|
|
6167
6332
|
throw new AvailabilityError('REVALIDATION_FAILED', '记忆时间的资源与本次校验结果不一致');
|
|
@@ -6178,7 +6343,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6178
6343
|
quantity: bookingCount
|
|
6179
6344
|
}), 'unified_booking_sales', product);
|
|
6180
6345
|
if (transformed) {
|
|
6181
|
-
|
|
6346
|
+
_context56.next = 122;
|
|
6182
6347
|
break;
|
|
6183
6348
|
}
|
|
6184
6349
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 无法转换为订单行', {
|
|
@@ -6197,7 +6362,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6197
6362
|
productLineUids = [];
|
|
6198
6363
|
bookingUids = [];
|
|
6199
6364
|
if (!(params.mode === 'edit' && editingLine && params.productLineUid)) {
|
|
6200
|
-
|
|
6365
|
+
_context56.next = 143;
|
|
6201
6366
|
break;
|
|
6202
6367
|
}
|
|
6203
6368
|
transformed.product_sku = (_transformed$product_ = transformed.product_sku) !== null && _transformed$product_ !== void 0 ? _transformed$product_ : editingLine.product_sku;
|
|
@@ -6207,10 +6372,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6207
6372
|
unique_identification_number: params.productLineUid,
|
|
6208
6373
|
booking_uid: existingBookingUid
|
|
6209
6374
|
});
|
|
6210
|
-
|
|
6375
|
+
_context56.next = 135;
|
|
6211
6376
|
return this.updateOrderProduct(_objectSpread(_objectSpread({
|
|
6212
6377
|
product_id: (_transformed$product_3 = transformed.product_id) !== null && _transformed$product_3 !== void 0 ? _transformed$product_3 : editingLine.product_id,
|
|
6213
|
-
product_variant_id: (
|
|
6378
|
+
product_variant_id: (_ref61 = (_transformed$product_4 = transformed.product_variant_id) !== null && _transformed$product_4 !== void 0 ? _transformed$product_4 : editingLine.product_variant_id) !== null && _ref61 !== void 0 ? _ref61 : 0,
|
|
6214
6379
|
unique_identification_number: params.productLineUid,
|
|
6215
6380
|
updates: transformed,
|
|
6216
6381
|
booking: booking
|
|
@@ -6220,14 +6385,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6220
6385
|
allow_booking_discount_reapply: params.allowBookingDiscountReapply
|
|
6221
6386
|
} : {}));
|
|
6222
6387
|
case 135:
|
|
6223
|
-
|
|
6388
|
+
_context56.next = 137;
|
|
6224
6389
|
return this.removeBookingProductsOutsideStartDate(booking.start_date);
|
|
6225
6390
|
case 137:
|
|
6226
6391
|
productLineUid = params.productLineUid;
|
|
6227
6392
|
bookingUid = existingBookingUid;
|
|
6228
6393
|
productLineUids = [productLineUid];
|
|
6229
6394
|
bookingUids = [bookingUid];
|
|
6230
|
-
|
|
6395
|
+
_context56.next = 160;
|
|
6231
6396
|
break;
|
|
6232
6397
|
case 143:
|
|
6233
6398
|
beforeProductLineUids = new Set((((_this$getTempOrder6 = this.getTempOrder()) === null || _this$getTempOrder6 === void 0 ? void 0 : _this$getTempOrder6.products) || []).map(function (line) {
|
|
@@ -6237,7 +6402,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6237
6402
|
return getBookingUid(item);
|
|
6238
6403
|
}).filter(Boolean));
|
|
6239
6404
|
availabilityCommitGuard === null || availabilityCommitGuard === void 0 || availabilityCommitGuard();
|
|
6240
|
-
|
|
6405
|
+
_context56.next = 148;
|
|
6241
6406
|
return this.addProductToOrder(transformed, booking, (_params$salesNotes = params.salesNotes) !== null && _params$salesNotes !== void 0 && _params$salesNotes.length || availabilityCommitGuard ? _objectSpread(_objectSpread({}, (_params$salesNotes2 = params.salesNotes) !== null && _params$salesNotes2 !== void 0 && _params$salesNotes2.length ? {
|
|
6242
6407
|
salesNotes: params.salesNotes
|
|
6243
6408
|
} : {}), availabilityCommitGuard ? {
|
|
@@ -6245,11 +6410,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6245
6410
|
availabilityCommitTargetGuard: availabilityCommitTargetGuard
|
|
6246
6411
|
} : {}) : undefined);
|
|
6247
6412
|
case 148:
|
|
6248
|
-
products =
|
|
6249
|
-
|
|
6413
|
+
products = _context56.sent;
|
|
6414
|
+
_context56.next = 151;
|
|
6250
6415
|
return this.removeBookingProductsOutsideStartDate(booking.start_date);
|
|
6251
6416
|
case 151:
|
|
6252
|
-
products =
|
|
6417
|
+
products = _context56.sent;
|
|
6253
6418
|
guardedCommitPublished = hasCommitGuard;
|
|
6254
6419
|
addedLines = products.filter(function (line) {
|
|
6255
6420
|
var _line$product_id, _line$metadata;
|
|
@@ -6258,7 +6423,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6258
6423
|
productLineUids = addedLines.map(function (line) {
|
|
6259
6424
|
return getProductLineUid(line);
|
|
6260
6425
|
}).filter(Boolean);
|
|
6261
|
-
addedBookings = (((
|
|
6426
|
+
addedBookings = (((_ref62 = hasCommitGuard ? rememberedOrder : this.getTempOrder()) === null || _ref62 === void 0 ? void 0 : _ref62.bookings) || []).filter(function (item) {
|
|
6262
6427
|
var _item$metadata;
|
|
6263
6428
|
return ((_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata.availability_candidate_key) === refreshedCandidate.key && !beforeBookingUids.has(getBookingUid(item));
|
|
6264
6429
|
});
|
|
@@ -6267,8 +6432,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6267
6432
|
}).filter(Boolean);
|
|
6268
6433
|
if (bookingUids.length === 0) {
|
|
6269
6434
|
bookingUids = addedLines.map(function (line) {
|
|
6270
|
-
var
|
|
6271
|
-
return String((
|
|
6435
|
+
var _ref63, _line$booking_uid, _line$metadata2;
|
|
6436
|
+
return String((_ref63 = (_line$booking_uid = line.booking_uid) !== null && _line$booking_uid !== void 0 ? _line$booking_uid : (_line$metadata2 = line.metadata) === null || _line$metadata2 === void 0 ? void 0 : _line$metadata2.booking_uid) !== null && _ref63 !== void 0 ? _ref63 : '');
|
|
6272
6437
|
}).filter(Boolean);
|
|
6273
6438
|
}
|
|
6274
6439
|
productLineUid = productLineUids[productLineUids.length - 1] || '';
|
|
@@ -6289,7 +6454,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6289
6454
|
bookingUids: bookingUids
|
|
6290
6455
|
};
|
|
6291
6456
|
if (!targetStillCurrent) {
|
|
6292
|
-
|
|
6457
|
+
_context56.next = 178;
|
|
6293
6458
|
break;
|
|
6294
6459
|
}
|
|
6295
6460
|
// A notification failure after publication must not invite a duplicate add.
|
|
@@ -6297,52 +6462,52 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6297
6462
|
return _this18.core.effects.emit("".concat(_this18.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilitySelectionCommitted), result);
|
|
6298
6463
|
};
|
|
6299
6464
|
if (!guardedCommitPublished) {
|
|
6300
|
-
|
|
6465
|
+
_context56.next = 176;
|
|
6301
6466
|
break;
|
|
6302
6467
|
}
|
|
6303
|
-
|
|
6304
|
-
|
|
6468
|
+
_context56.prev = 167;
|
|
6469
|
+
_context56.next = 170;
|
|
6305
6470
|
return emit();
|
|
6306
6471
|
case 170:
|
|
6307
|
-
|
|
6472
|
+
_context56.next = 174;
|
|
6308
6473
|
break;
|
|
6309
6474
|
case 172:
|
|
6310
|
-
|
|
6311
|
-
|
|
6475
|
+
_context56.prev = 172;
|
|
6476
|
+
_context56.t0 = _context56["catch"](167);
|
|
6312
6477
|
case 174:
|
|
6313
|
-
|
|
6478
|
+
_context56.next = 178;
|
|
6314
6479
|
break;
|
|
6315
6480
|
case 176:
|
|
6316
|
-
|
|
6481
|
+
_context56.next = 178;
|
|
6317
6482
|
return emit();
|
|
6318
6483
|
case 178:
|
|
6319
|
-
return
|
|
6484
|
+
return _context56.abrupt("return", result);
|
|
6320
6485
|
case 179:
|
|
6321
|
-
|
|
6486
|
+
_context56.prev = 179;
|
|
6322
6487
|
release = this.releaseAvailabilityCommitLock(normalizedContextId);
|
|
6323
6488
|
if (!guardedCommitPublished) {
|
|
6324
|
-
|
|
6489
|
+
_context56.next = 186;
|
|
6325
6490
|
break;
|
|
6326
6491
|
}
|
|
6327
|
-
|
|
6492
|
+
_context56.next = 184;
|
|
6328
6493
|
return release.catch(function () {
|
|
6329
6494
|
return undefined;
|
|
6330
6495
|
});
|
|
6331
6496
|
case 184:
|
|
6332
|
-
|
|
6497
|
+
_context56.next = 188;
|
|
6333
6498
|
break;
|
|
6334
6499
|
case 186:
|
|
6335
|
-
|
|
6500
|
+
_context56.next = 188;
|
|
6336
6501
|
return release;
|
|
6337
6502
|
case 188:
|
|
6338
|
-
return
|
|
6503
|
+
return _context56.finish(179);
|
|
6339
6504
|
case 189:
|
|
6340
6505
|
case "end":
|
|
6341
|
-
return
|
|
6506
|
+
return _context56.stop();
|
|
6342
6507
|
}
|
|
6343
|
-
},
|
|
6508
|
+
}, _callee56, this, [[16,, 179, 189], [167, 172]]);
|
|
6344
6509
|
}));
|
|
6345
|
-
function commitAvailabilitySelection(
|
|
6510
|
+
function commitAvailabilitySelection(_x41, _x42) {
|
|
6346
6511
|
return _commitAvailabilitySelection.apply(this, arguments);
|
|
6347
6512
|
}
|
|
6348
6513
|
return commitAvailabilitySelection;
|