@pisell/pisellos 2.2.240 → 2.2.241

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";
@@ -416,7 +416,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
416
416
  generateIdempotencyToken(): string;
417
417
  syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
418
418
  createOrder(params: CommitOrderParams['query']): {
419
- type: "appointment_booking" | "virtual";
419
+ type: "virtual" | "appointment_booking";
420
420
  platform: string;
421
421
  sales_channel: string;
422
422
  order_sales_channel: string;
@@ -3911,7 +3911,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3911
3911
  value: function () {
3912
3912
  var _runSubmitTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
3913
3913
  var _params$cacheId2, _this$otherParams5, _ref70, _params$businessCode2, _this$otherParams6, _this$otherParams7;
3914
- var tempOrder, latestSummary, effectiveCacheId, hasPaymentOverride, hasPaymentStatusOverride, hasSmallTicketDataFlagOverride, enhancePayload, payload, result, _payload$payments, _payload$payments2, backendErrorResponse, submittedOrderId, resultRecord;
3914
+ var tempOrder, latestSummary, effectiveCacheId, hasPaymentOverride, hasPaymentStatusOverride, hasSmallTicketDataFlagOverride, enhancePayload, payload, result, _payload$payments, _result, _data, _payload$payments2, backendErrorResponse, submittedOrderId, resultRecord;
3915
3915
  return _regeneratorRuntime().wrap(function _callee27$(_context29) {
3916
3916
  while (1) switch (_context29.prev = _context29.next) {
3917
3917
  case 0:
@@ -3989,20 +3989,24 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3989
3989
  });
3990
3990
  case 25:
3991
3991
  result = _context29.sent;
3992
- _context29.next = 38;
3992
+ // 如果成功需要把当前内存 tempOrder的一部分同步成 result 的
3993
+ if ((_result = result) !== null && _result !== void 0 && _result.success) {
3994
+ tempOrder.order_id = (_data = result.data) === null || _data === void 0 ? void 0 : _data.order_id;
3995
+ }
3996
+ _context29.next = 39;
3993
3997
  break;
3994
- case 28:
3995
- _context29.prev = 28;
3998
+ case 29:
3999
+ _context29.prev = 29;
3996
4000
  _context29.t2 = _context29["catch"](21);
3997
4001
  backendErrorResponse = this.extractSubmitErrorResponse(_context29.t2);
3998
4002
  if (!backendErrorResponse) {
3999
- _context29.next = 35;
4003
+ _context29.next = 36;
4000
4004
  break;
4001
4005
  }
4002
4006
  this.store.syncState = 'failed';
4003
4007
  this.logSubmitBackendRejected(backendErrorResponse, payload);
4004
4008
  return _context29.abrupt("return", backendErrorResponse);
4005
- case 35:
4009
+ case 36:
4006
4010
  this.store.syncState = 'failed';
4007
4011
  this.logError('submitTempOrder failed', {
4008
4012
  error: _context29.t2 instanceof Error ? _context29.t2.message : String(_context29.t2),
@@ -4012,40 +4016,40 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4012
4016
  paymentsCount: ((_payload$payments2 = payload.payments) === null || _payload$payments2 === void 0 ? void 0 : _payload$payments2.length) || 0
4013
4017
  });
4014
4018
  throw _context29.t2;
4015
- case 38:
4019
+ case 39:
4016
4020
  if (!this.isSubmitResponseRejected(result)) {
4017
- _context29.next = 42;
4021
+ _context29.next = 43;
4018
4022
  break;
4019
4023
  }
4020
4024
  this.store.syncState = 'failed';
4021
4025
  this.logSubmitBackendRejected(result, payload);
4022
4026
  return _context29.abrupt("return", result);
4023
- case 42:
4027
+ case 43:
4024
4028
  submittedOrderId = this.extractOrderIdFromSubmitResult(result);
4025
4029
  if (!(submittedOrderId !== null && submittedOrderId !== undefined)) {
4026
- _context29.next = 50;
4030
+ _context29.next = 51;
4027
4031
  break;
4028
4032
  }
4029
4033
  tempOrder.order_id = submittedOrderId;
4030
4034
  resultRecord = result;
4031
- _context29.next = 48;
4035
+ _context29.next = 49;
4032
4036
  return this.markLocalOrderSynced(submittedOrderId, (resultRecord === null || resultRecord === void 0 ? void 0 : resultRecord.data) || resultRecord || {});
4033
- case 48:
4034
- _context29.next = 51;
4037
+ case 49:
4038
+ _context29.next = 52;
4035
4039
  break;
4036
- case 50:
4040
+ case 51:
4037
4041
  if (this.isLocalPendingSubmitResult(result)) {
4038
4042
  this.store.syncState = 'local';
4039
4043
  } else {
4040
4044
  this.store.syncState = 'submitted';
4041
4045
  }
4042
- case 51:
4043
- return _context29.abrupt("return", result);
4044
4046
  case 52:
4047
+ return _context29.abrupt("return", result);
4048
+ case 53:
4045
4049
  case "end":
4046
4050
  return _context29.stop();
4047
4051
  }
4048
- }, _callee27, this, [[21, 28]]);
4052
+ }, _callee27, this, [[21, 29]]);
4049
4053
  }));
4050
4054
  function runSubmitTempOrder(_x31) {
4051
4055
  return _runSubmitTempOrder.apply(this, arguments);
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
311
311
  date: string;
312
312
  status: string;
313
313
  week: string;
314
- weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
314
+ weekNum: 0 | 2 | 1 | 6 | 3 | 4 | 5;
315
315
  }[]>;
316
316
  submitTimeSlot(timeSlots: TimeSliceItem): void;
317
317
  private getScheduleDataByIds;
@@ -322,7 +322,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
322
322
  * 获取当前的客户搜索条件
323
323
  * @returns 当前搜索条件
324
324
  */
325
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
325
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
326
326
  /**
327
327
  * 获取客户列表状态(包含滚动加载相关状态)
328
328
  * @returns 客户状态
@@ -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
+ });
@@ -416,7 +416,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
416
416
  generateIdempotencyToken(): string;
417
417
  syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
418
418
  createOrder(params: CommitOrderParams['query']): {
419
- type: "appointment_booking" | "virtual";
419
+ type: "virtual" | "appointment_booking";
420
420
  platform: string;
421
421
  sales_channel: string;
422
422
  order_sales_channel: string;
@@ -2852,7 +2852,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
2852
2852
  });
2853
2853
  }
2854
2854
  async runSubmitTempOrder(params) {
2855
- var _a, _b, _c, _d, _e;
2855
+ var _a, _b, _c, _d, _e, _f;
2856
2856
  const tempOrder = this.ensureTempOrder();
2857
2857
  this.persistTempOrder();
2858
2858
  const latestSummary = await this.recalculateSummary({ createIfMissing: true }) || this.store.summary || (0, import_utils.createEmptySummary)();
@@ -2906,6 +2906,9 @@ var OrderModule = class extends import_BaseModule.BaseModule {
2906
2906
  result = await this.submitSalesOrder({
2907
2907
  query: payload
2908
2908
  });
2909
+ if (result == null ? void 0 : result.success) {
2910
+ tempOrder.order_id = (_e = result.data) == null ? void 0 : _e.order_id;
2911
+ }
2909
2912
  } catch (error) {
2910
2913
  const backendErrorResponse = this.extractSubmitErrorResponse(error);
2911
2914
  if (backendErrorResponse) {
@@ -2919,7 +2922,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
2919
2922
  orderId: payload.order_id,
2920
2923
  externalSaleNumber: payload.external_sale_number,
2921
2924
  paymentStatus: payload.payment_status,
2922
- paymentsCount: ((_e = payload.payments) == null ? void 0 : _e.length) || 0
2925
+ paymentsCount: ((_f = payload.payments) == null ? void 0 : _f.length) || 0
2923
2926
  });
2924
2927
  throw error;
2925
2928
  }
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
311
311
  date: string;
312
312
  status: string;
313
313
  week: string;
314
- weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
314
+ weekNum: 0 | 2 | 1 | 6 | 3 | 4 | 5;
315
315
  }[]>;
316
316
  submitTimeSlot(timeSlots: TimeSliceItem): void;
317
317
  private getScheduleDataByIds;
@@ -322,7 +322,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
322
322
  * 获取当前的客户搜索条件
323
323
  * @returns 当前搜索条件
324
324
  */
325
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
325
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
326
326
  /**
327
327
  * 获取客户列表状态(包含滚动加载相关状态)
328
328
  * @returns 客户状态
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.2.240",
4
+ "version": "2.2.241",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",