@pisell/pisellos 2.2.208 → 2.2.209
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/server/index.js
CHANGED
|
@@ -3492,7 +3492,6 @@ var Server = /*#__PURE__*/function () {
|
|
|
3492
3492
|
value: function getSmallTicketShopInfo() {
|
|
3493
3493
|
var _shopInfo$is_price_in;
|
|
3494
3494
|
var shopInfo = this.getAppData('shop_info') || {};
|
|
3495
|
-
debugger;
|
|
3496
3495
|
return _objectSpread(_objectSpread({}, shopInfo), {}, {
|
|
3497
3496
|
currency_symbol: shopInfo.currency_symbol || this.getAppData('shop_symbol') || this.getAppData('currency_symbol'),
|
|
3498
3497
|
currency_code: shopInfo.currency_code || this.getAppData('shop_currency_code') || this.getAppData('currency_code'),
|
|
@@ -3541,24 +3540,23 @@ var Server = /*#__PURE__*/function () {
|
|
|
3541
3540
|
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
3542
3541
|
while (1) switch (_context37.prev = _context37.next) {
|
|
3543
3542
|
case 0:
|
|
3544
|
-
debugger;
|
|
3545
3543
|
getAsyncIotDeviceInfo = this.getAppData('async_iot_device_info');
|
|
3546
3544
|
if (!getAsyncIotDeviceInfo) {
|
|
3547
|
-
_context37.next =
|
|
3545
|
+
_context37.next = 7;
|
|
3548
3546
|
break;
|
|
3549
3547
|
}
|
|
3550
|
-
_context37.next =
|
|
3548
|
+
_context37.next = 4;
|
|
3551
3549
|
return getAsyncIotDeviceInfo === null || getAsyncIotDeviceInfo === void 0 ? void 0 : getAsyncIotDeviceInfo();
|
|
3552
|
-
case
|
|
3550
|
+
case 4:
|
|
3553
3551
|
res = _context37.sent;
|
|
3554
3552
|
if (!res.short_number) {
|
|
3555
|
-
_context37.next =
|
|
3553
|
+
_context37.next = 7;
|
|
3556
3554
|
break;
|
|
3557
3555
|
}
|
|
3558
3556
|
return _context37.abrupt("return", res.short_number);
|
|
3559
|
-
case
|
|
3557
|
+
case 7:
|
|
3560
3558
|
return _context37.abrupt("return", this.getAppData('device_id') || 0);
|
|
3561
|
-
case
|
|
3559
|
+
case 8:
|
|
3562
3560
|
case "end":
|
|
3563
3561
|
return _context37.stop();
|
|
3564
3562
|
}
|
|
@@ -272,6 +272,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
272
272
|
key: "configureIdGeneratorFromOpenData",
|
|
273
273
|
value: function () {
|
|
274
274
|
var _configureIdGeneratorFromOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
275
|
+
var _openDataConfig, _openDataConfig2, _openDataConfig3, _openDataConfig4, _openDataConfig5;
|
|
275
276
|
var openDataConfig, idGenerator, receiptSequenceLength, receiptSequenceStart, prefix, resetReceiptSequenceDaily, operatingDayBoundary, deviceId;
|
|
276
277
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
277
278
|
while (1) switch (_context4.prev = _context4.next) {
|
|
@@ -290,33 +291,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
290
291
|
console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置', _context4.t0);
|
|
291
292
|
return _context4.abrupt("return");
|
|
292
293
|
case 11:
|
|
293
|
-
if (openDataConfig)
|
|
294
|
-
_context4.next = 13;
|
|
295
|
-
break;
|
|
296
|
-
}
|
|
297
|
-
return _context4.abrupt("return");
|
|
298
|
-
case 13:
|
|
294
|
+
// if (!openDataConfig) return;
|
|
299
295
|
idGenerator = this.getIdGeneratorPlugin();
|
|
300
296
|
if (idGenerator !== null && idGenerator !== void 0 && idGenerator.configure) {
|
|
301
|
-
_context4.next =
|
|
297
|
+
_context4.next = 15;
|
|
302
298
|
break;
|
|
303
299
|
}
|
|
304
300
|
console.warn('[BookingTicket] idGenerator 插件不可用,跳过配置');
|
|
305
301
|
return _context4.abrupt("return");
|
|
306
|
-
case
|
|
307
|
-
receiptSequenceLength = this.normalizePositiveInteger(openDataConfig['sale.short_number_digits'], 5);
|
|
308
|
-
receiptSequenceStart = this.normalizePositiveInteger(openDataConfig['sale.short_number_start_number'], 1);
|
|
309
|
-
prefix = this.normalizeIdPrefix(openDataConfig['sale.short_number_prefix'], 'R');
|
|
310
|
-
resetReceiptSequenceDaily = typeof openDataConfig['sale.short_number_daily_reset'] === 'boolean' ? openDataConfig['sale.short_number_daily_reset'] : true;
|
|
302
|
+
case 15:
|
|
303
|
+
receiptSequenceLength = this.normalizePositiveInteger((_openDataConfig = openDataConfig) === null || _openDataConfig === void 0 ? void 0 : _openDataConfig['sale.short_number_digits'], 5);
|
|
304
|
+
receiptSequenceStart = this.normalizePositiveInteger((_openDataConfig2 = openDataConfig) === null || _openDataConfig2 === void 0 ? void 0 : _openDataConfig2['sale.short_number_start_number'], 1);
|
|
305
|
+
prefix = this.normalizeIdPrefix((_openDataConfig3 = openDataConfig) === null || _openDataConfig3 === void 0 ? void 0 : _openDataConfig3['sale.short_number_prefix'], 'R');
|
|
306
|
+
resetReceiptSequenceDaily = typeof ((_openDataConfig4 = openDataConfig) === null || _openDataConfig4 === void 0 ? void 0 : _openDataConfig4['sale.short_number_daily_reset']) === 'boolean' ? (_openDataConfig5 = openDataConfig) === null || _openDataConfig5 === void 0 ? void 0 : _openDataConfig5['sale.short_number_daily_reset'] : true;
|
|
311
307
|
operatingDayBoundary = this.getAppData('operating_day_boundary');
|
|
312
|
-
_context4.next =
|
|
308
|
+
_context4.next = 22;
|
|
313
309
|
return this.getShortNumberOrDeviceId();
|
|
314
|
-
case
|
|
310
|
+
case 22:
|
|
315
311
|
deviceId = _context4.sent;
|
|
316
|
-
_context4.prev =
|
|
317
|
-
_context4.next =
|
|
312
|
+
_context4.prev = 23;
|
|
313
|
+
_context4.next = 26;
|
|
318
314
|
return idGenerator.configure({
|
|
319
|
-
biz: 'ticket',
|
|
315
|
+
biz: this.getBookingTicketBusinessCode() || 'ticket',
|
|
320
316
|
config: {
|
|
321
317
|
prefix: prefix,
|
|
322
318
|
deviceCode: deviceId,
|
|
@@ -328,18 +324,18 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
328
324
|
receiptSequenceStart: receiptSequenceStart
|
|
329
325
|
}
|
|
330
326
|
});
|
|
331
|
-
case
|
|
332
|
-
_context4.next =
|
|
327
|
+
case 26:
|
|
328
|
+
_context4.next = 31;
|
|
333
329
|
break;
|
|
334
|
-
case
|
|
335
|
-
_context4.prev =
|
|
336
|
-
_context4.t1 = _context4["catch"](
|
|
330
|
+
case 28:
|
|
331
|
+
_context4.prev = 28;
|
|
332
|
+
_context4.t1 = _context4["catch"](23);
|
|
337
333
|
console.warn('[BookingTicket] idGenerator 配置失败', _context4.t1);
|
|
338
|
-
case
|
|
334
|
+
case 31:
|
|
339
335
|
case "end":
|
|
340
336
|
return _context4.stop();
|
|
341
337
|
}
|
|
342
|
-
}, _callee4, this, [[1, 7], [
|
|
338
|
+
}, _callee4, this, [[1, 7], [23, 28]]);
|
|
343
339
|
}));
|
|
344
340
|
function configureIdGeneratorFromOpenData() {
|
|
345
341
|
return _configureIdGeneratorFromOpenData.apply(this, arguments);
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/model/strategy/adapter/promotion/index.ts
|
|
30
|
+
var promotion_exports = {};
|
|
31
|
+
__export(promotion_exports, {
|
|
32
|
+
BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
|
|
33
|
+
PromotionAdapter: () => import_adapter.PromotionAdapter,
|
|
34
|
+
PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
|
|
35
|
+
X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
|
|
36
|
+
default: () => import_adapter2.default
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(promotion_exports);
|
|
39
|
+
var import_evaluator = require("./evaluator");
|
|
40
|
+
var import_adapter = require("./adapter");
|
|
41
|
+
var import_adapter2 = __toESM(require("./adapter"));
|
|
42
|
+
var import_examples = require("./examples");
|
|
43
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
+
0 && (module.exports = {
|
|
45
|
+
BUY_X_GET_Y_FREE_STRATEGY,
|
|
46
|
+
PromotionAdapter,
|
|
47
|
+
PromotionEvaluator,
|
|
48
|
+
X_ITEMS_FOR_Y_PRICE_STRATEGY
|
|
49
|
+
});
|
package/lib/server/index.js
CHANGED
|
@@ -2181,7 +2181,6 @@ var Server = class {
|
|
|
2181
2181
|
}
|
|
2182
2182
|
getSmallTicketShopInfo() {
|
|
2183
2183
|
const shopInfo = this.getAppData("shop_info") || {};
|
|
2184
|
-
debugger;
|
|
2185
2184
|
return {
|
|
2186
2185
|
...shopInfo,
|
|
2187
2186
|
currency_symbol: shopInfo.currency_symbol || this.getAppData("shop_symbol") || this.getAppData("currency_symbol"),
|
|
@@ -2208,7 +2207,6 @@ var Server = class {
|
|
|
2208
2207
|
};
|
|
2209
2208
|
}
|
|
2210
2209
|
async getShortNumberOrDeviceId() {
|
|
2211
|
-
debugger;
|
|
2212
2210
|
const getAsyncIotDeviceInfo = this.getAppData("async_iot_device_info");
|
|
2213
2211
|
if (getAsyncIotDeviceInfo) {
|
|
2214
2212
|
const res = await (getAsyncIotDeviceInfo == null ? void 0 : getAsyncIotDeviceInfo());
|
|
@@ -178,31 +178,29 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
178
178
|
console.warn("[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置", error);
|
|
179
179
|
return;
|
|
180
180
|
}
|
|
181
|
-
if (!openDataConfig)
|
|
182
|
-
return;
|
|
183
181
|
const idGenerator = this.getIdGeneratorPlugin();
|
|
184
182
|
if (!(idGenerator == null ? void 0 : idGenerator.configure)) {
|
|
185
183
|
console.warn("[BookingTicket] idGenerator 插件不可用,跳过配置");
|
|
186
184
|
return;
|
|
187
185
|
}
|
|
188
186
|
const receiptSequenceLength = this.normalizePositiveInteger(
|
|
189
|
-
openDataConfig["sale.short_number_digits"],
|
|
187
|
+
openDataConfig == null ? void 0 : openDataConfig["sale.short_number_digits"],
|
|
190
188
|
5
|
|
191
189
|
);
|
|
192
190
|
const receiptSequenceStart = this.normalizePositiveInteger(
|
|
193
|
-
openDataConfig["sale.short_number_start_number"],
|
|
191
|
+
openDataConfig == null ? void 0 : openDataConfig["sale.short_number_start_number"],
|
|
194
192
|
1
|
|
195
193
|
);
|
|
196
194
|
const prefix = this.normalizeIdPrefix(
|
|
197
|
-
openDataConfig["sale.short_number_prefix"],
|
|
195
|
+
openDataConfig == null ? void 0 : openDataConfig["sale.short_number_prefix"],
|
|
198
196
|
"R"
|
|
199
197
|
);
|
|
200
|
-
const resetReceiptSequenceDaily = typeof openDataConfig["sale.short_number_daily_reset"] === "boolean" ? openDataConfig["sale.short_number_daily_reset"] : true;
|
|
198
|
+
const resetReceiptSequenceDaily = typeof (openDataConfig == null ? void 0 : openDataConfig["sale.short_number_daily_reset"]) === "boolean" ? openDataConfig == null ? void 0 : openDataConfig["sale.short_number_daily_reset"] : true;
|
|
201
199
|
const operatingDayBoundary = this.getAppData("operating_day_boundary");
|
|
202
200
|
const deviceId = await this.getShortNumberOrDeviceId();
|
|
203
201
|
try {
|
|
204
202
|
await idGenerator.configure({
|
|
205
|
-
biz: "ticket",
|
|
203
|
+
biz: this.getBookingTicketBusinessCode() || "ticket",
|
|
206
204
|
config: {
|
|
207
205
|
prefix,
|
|
208
206
|
deviceCode: deviceId,
|