@pisell/pisellos 2.2.238 → 2.2.239

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.
@@ -1,9 +0,0 @@
1
- // 导出评估器
2
- export { PromotionEvaluator } from "./evaluator";
3
-
4
- // 导出适配器
5
- export { PromotionAdapter } from "./adapter";
6
- export { default } from "./adapter";
7
-
8
- // 导出策略配置示例常量
9
- export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY } from "./examples";
@@ -283,7 +283,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
283
283
  break;
284
284
  }
285
285
  console.warn('[BookingTicket] businessCode 缺失,跳过 OpenData 配置加载,当前 module name: ', this.name);
286
- return _context2.abrupt("return", new Error('businessCode 缺失'));
286
+ return _context2.abrupt("return", null);
287
287
  case 6:
288
288
  lastFetchedAt = this.store.openData.getLastFetchedAt();
289
289
  cachedData = this.store.openData.getOpenData();
@@ -392,7 +392,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
392
392
  value: function () {
393
393
  var _configureIdGeneratorFromOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
394
394
  var _openDataConfig, _openDataConfig2, _openDataConfig3, _openDataConfig4, _openDataConfig5, _openDataConfig6;
395
- var openDataConfig, idGenerator, receiptSequenceLength, receiptSequenceStart, prefix, shopOrderPrefix, resetReceiptSequenceDaily, operatingDayBoundary, deviceId;
395
+ var openDataConfig, idGenerator, receiptSequenceLength, receiptSequenceStart, prefix, shopOrderPrefix, resetReceiptSequenceDaily, operatingDayBoundary, deviceId, businessCode;
396
396
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
397
397
  while (1) switch (_context5.prev = _context5.next) {
398
398
  case 0:
@@ -429,10 +429,18 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
429
429
  return this.getShortNumberOrDeviceId();
430
430
  case 23:
431
431
  deviceId = _context5.sent;
432
- _context5.prev = 24;
433
- _context5.next = 27;
432
+ businessCode = this.getBookingTicketBusinessCode();
433
+ if (businessCode) {
434
+ _context5.next = 28;
435
+ break;
436
+ }
437
+ console.warn('[BookingTicket] businessCode 缺失,跳过 idGenerator 配置');
438
+ return _context5.abrupt("return");
439
+ case 28:
440
+ _context5.prev = 28;
441
+ _context5.next = 31;
434
442
  return idGenerator.configure({
435
- biz: this.getBookingTicketBusinessCode() || 'ticket',
443
+ biz: businessCode,
436
444
  config: {
437
445
  prefix: prefix,
438
446
  deviceCode: deviceId,
@@ -445,18 +453,18 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
445
453
  shopOrderPrefix: shopOrderPrefix
446
454
  }
447
455
  });
448
- case 27:
449
- _context5.next = 32;
456
+ case 31:
457
+ _context5.next = 36;
450
458
  break;
451
- case 29:
452
- _context5.prev = 29;
453
- _context5.t1 = _context5["catch"](24);
459
+ case 33:
460
+ _context5.prev = 33;
461
+ _context5.t1 = _context5["catch"](28);
454
462
  console.warn('[BookingTicket] idGenerator 配置失败', _context5.t1);
455
- case 32:
463
+ case 36:
456
464
  case "end":
457
465
  return _context5.stop();
458
466
  }
459
- }, _callee5, this, [[1, 7], [24, 29]]);
467
+ }, _callee5, this, [[1, 7], [28, 33]]);
460
468
  }));
461
469
  function configureIdGeneratorFromOpenData() {
462
470
  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
+ });
@@ -192,7 +192,7 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
192
192
  const businessCode = this.getBookingTicketBusinessCode();
193
193
  if (!businessCode) {
194
194
  console.warn("[BookingTicket] businessCode 缺失,跳过 OpenData 配置加载,当前 module name: ", this.name);
195
- return new Error("businessCode 缺失");
195
+ return null;
196
196
  }
197
197
  const lastFetchedAt = this.store.openData.getLastFetchedAt();
198
198
  const cachedData = this.store.openData.getOpenData();
@@ -263,9 +263,14 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
263
263
  const resetReceiptSequenceDaily = typeof (openDataConfig == null ? void 0 : openDataConfig["sale.short_number_daily_reset"]) === "boolean" ? openDataConfig == null ? void 0 : openDataConfig["sale.short_number_daily_reset"] : false;
264
264
  const operatingDayBoundary = this.getAppData("operating_day_boundary");
265
265
  const deviceId = await this.getShortNumberOrDeviceId();
266
+ const businessCode = this.getBookingTicketBusinessCode();
267
+ if (!businessCode) {
268
+ console.warn("[BookingTicket] businessCode 缺失,跳过 idGenerator 配置");
269
+ return;
270
+ }
266
271
  try {
267
272
  await idGenerator.configure({
268
- biz: this.getBookingTicketBusinessCode() || "ticket",
273
+ biz: businessCode,
269
274
  config: {
270
275
  prefix,
271
276
  deviceCode: deviceId,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.2.238",
4
+ "version": "2.2.239",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",