@pisell/pisellos 2.2.262 → 2.2.263

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.
@@ -0,0 +1,9 @@
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";
@@ -4909,7 +4909,7 @@ var Server = /*#__PURE__*/function () {
4909
4909
  key: "handleOrderCheckoutSubmit",
4910
4910
  value: function () {
4911
4911
  var _handleOrderCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(params) {
4912
- var backendPath, data, title, normalizedData, checkoutData, pendingResult, pendingOrder;
4912
+ var backendPath, data, title, normalizedData, checkoutData, pendingResult, _this$core$context2, pendingOrder, platform, isAndroid;
4913
4913
  return _regeneratorRuntime().wrap(function _callee51$(_context51) {
4914
4914
  while (1) switch (_context51.prev = _context51.next) {
4915
4915
  case 0:
@@ -4948,34 +4948,35 @@ var Server = /*#__PURE__*/function () {
4948
4948
  case 12:
4949
4949
  pendingResult = _context51.sent;
4950
4950
  if (!((pendingResult === null || pendingResult === void 0 ? void 0 : pendingResult.status) === true)) {
4951
- _context51.next = 20;
4951
+ _context51.next = 22;
4952
4952
  break;
4953
4953
  }
4954
4954
  pendingOrder = pendingResult.data;
4955
- if (!(pendingOrder && this.shouldBuildSmallTicketData(checkoutData) && this.isSalesOrderFullyPaid(pendingOrder) &&
4956
- // TODO 这里先加个兼容,只有 type 为 virtual 才走打印
4957
- // 后期需要迁移到 picoding ,根据工作流配置
4958
- checkoutData.type === 'virtual')) {
4959
- _context51.next = 18;
4955
+ platform = (_this$core$context2 = this.core.context) === null || _this$core$context2 === void 0 ? void 0 : _this$core$context2.getPlatform();
4956
+ isAndroid = platform === 'android';
4957
+ if (!(pendingOrder && this.shouldBuildSmallTicketData(checkoutData) && this.isSalesOrderFullyPaid(pendingOrder) && (
4958
+ // TODO 这里先加个兼容,如果是安卓,则需要 type=virtual 才走打印,如果是苹果则无限制
4959
+ isAndroid ? checkoutData.type === 'virtual' : true))) {
4960
+ _context51.next = 20;
4960
4961
  break;
4961
4962
  }
4962
- _context51.next = 18;
4963
+ _context51.next = 20;
4963
4964
  return this.dispatchLocalReceiptPrint({
4964
4965
  checkoutData: checkoutData,
4965
4966
  order: pendingOrder,
4966
4967
  response: pendingResult,
4967
4968
  requireFullyPaid: true
4968
4969
  });
4969
- case 18:
4970
- _context51.next = 20;
4970
+ case 20:
4971
+ _context51.next = 22;
4971
4972
  return this.dispatchCheckoutSyncTask({
4972
4973
  backendPath: backendPath,
4973
4974
  data: checkoutData,
4974
4975
  title: title
4975
4976
  });
4976
- case 20:
4977
+ case 22:
4977
4978
  if (pendingResult.data.order_id) {
4978
- _context51.next = 22;
4979
+ _context51.next = 24;
4979
4980
  break;
4980
4981
  }
4981
4982
  return _context51.abrupt("return", _objectSpread(_objectSpread({}, pendingResult), {}, {
@@ -4983,9 +4984,9 @@ var Server = /*#__PURE__*/function () {
4983
4984
  order_id: pendingResult.data.external_sale_number
4984
4985
  })
4985
4986
  }));
4986
- case 22:
4987
+ case 24:
4987
4988
  return _context51.abrupt("return", pendingResult);
4988
- case 23:
4989
+ case 25:
4989
4990
  case "end":
4990
4991
  return _context51.stop();
4991
4992
  }
@@ -5568,9 +5569,9 @@ var Server = /*#__PURE__*/function () {
5568
5569
  }, {
5569
5570
  key: "getProductTitleSnapshotCurrentLocale",
5570
5571
  value: function getProductTitleSnapshotCurrentLocale() {
5571
- var _this$core$context2, _this$core$context3;
5572
+ var _this$core$context3, _this$core$context4;
5572
5573
  var shopInfo = this.getSmallTicketShopInfo();
5573
- var rawLocale = shopInfo.primary_locale || this.getAppData('locale') || this.getAppData('language') || ((_this$core$context2 = this.core.context) === null || _this$core$context2 === void 0 ? void 0 : _this$core$context2.locale) || ((_this$core$context3 = this.core.context) === null || _this$core$context3 === void 0 ? void 0 : _this$core$context3.language);
5574
+ var rawLocale = shopInfo.primary_locale || this.getAppData('locale') || this.getAppData('language') || ((_this$core$context3 = this.core.context) === null || _this$core$context3 === void 0 ? void 0 : _this$core$context3.locale) || ((_this$core$context4 = this.core.context) === null || _this$core$context4 === void 0 ? void 0 : _this$core$context4.language);
5574
5575
  return this.normalizeProductTitleSnapshotLocale(rawLocale);
5575
5576
  }
5576
5577
  }, {
@@ -6937,7 +6938,7 @@ var Server = /*#__PURE__*/function () {
6937
6938
  }, {
6938
6939
  key: "buildProductFormatterContext",
6939
6940
  value: function buildProductFormatterContext(context) {
6940
- var _this$menu, _this$menu$getMenuLis, _scheduleModule$getSc, _this$core$context4;
6941
+ var _this$menu, _this$menu$getMenuLis, _scheduleModule$getSc, _this$core$context5;
6941
6942
  var scheduleModule = this.getSchedule();
6942
6943
  return {
6943
6944
  scheduleModule: scheduleModule,
@@ -6946,7 +6947,7 @@ var Server = /*#__PURE__*/function () {
6946
6947
  strategy_context: context.strategy_context,
6947
6948
  menuList: ((_this$menu = this.menu) === null || _this$menu === void 0 || (_this$menu$getMenuLis = _this$menu.getMenuList) === null || _this$menu$getMenuLis === void 0 ? void 0 : _this$menu$getMenuLis.call(_this$menu)) || [],
6948
6949
  scheduleList: (scheduleModule === null || scheduleModule === void 0 || (_scheduleModule$getSc = scheduleModule.getScheduleList) === null || _scheduleModule$getSc === void 0 ? void 0 : _scheduleModule$getSc.call(scheduleModule)) || [],
6949
- dataVariantEvaluator: (_this$core$context4 = this.core.context) === null || _this$core$context4 === void 0 ? void 0 : _this$core$context4.dataVariantEvaluator
6950
+ dataVariantEvaluator: (_this$core$context5 = this.core.context) === null || _this$core$context5 === void 0 ? void 0 : _this$core$context5.dataVariantEvaluator
6950
6951
  };
6951
6952
  }
6952
6953
 
@@ -3106,6 +3106,7 @@ var Server = class {
3106
3106
  });
3107
3107
  }
3108
3108
  async handleOrderCheckoutSubmit(params) {
3109
+ var _a;
3109
3110
  const { backendPath, data, title } = params;
3110
3111
  this.logInfo(`${title}: 开始处理`, {
3111
3112
  backendPath,
@@ -3130,9 +3131,10 @@ var Server = class {
3130
3131
  });
3131
3132
  if ((pendingResult == null ? void 0 : pendingResult.status) === true) {
3132
3133
  const pendingOrder = pendingResult.data;
3133
- if (pendingOrder && this.shouldBuildSmallTicketData(checkoutData) && this.isSalesOrderFullyPaid(pendingOrder) && // TODO 这里先加个兼容,只有 type virtual 才走打印
3134
- // 后期需要迁移到 picoding ,根据工作流配置
3135
- checkoutData.type === "virtual") {
3134
+ const platform = (_a = this.core.context) == null ? void 0 : _a.getPlatform();
3135
+ const isAndroid = platform === "android";
3136
+ if (pendingOrder && this.shouldBuildSmallTicketData(checkoutData) && this.isSalesOrderFullyPaid(pendingOrder) && // TODO 这里先加个兼容,如果是安卓,则需要 type=virtual 才走打印,如果是苹果则无限制
3137
+ (isAndroid ? checkoutData.type === "virtual" : true)) {
3136
3138
  await this.dispatchLocalReceiptPrint({
3137
3139
  checkoutData,
3138
3140
  order: pendingOrder,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.2.262",
4
+ "version": "2.2.263",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",