@pisell/pisellos 0.10.25 → 0.10.27

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.
@@ -533,7 +533,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
533
533
  generateIdempotencyToken(): string;
534
534
  syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
535
535
  createOrder(params: CommitOrderParams['query']): {
536
- type: "appointment_booking" | "virtual";
536
+ type: "virtual" | "appointment_booking";
537
537
  platform: string;
538
538
  sales_channel: string;
539
539
  order_sales_channel: string;
@@ -294,10 +294,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
294
294
  }
295
295
  if (Array.isArray(product.product_bundle)) {
296
296
  product.product_bundle = product.product_bundle.map(function (bundle) {
297
- var _ref11, _bundle$original_pric, _bundle$bundle_sellin;
297
+ var _ref11, _bundle$price, _bundle$bundle_sellin;
298
298
  var hasBundleDiscount = Array.isArray(bundle === null || bundle === void 0 ? void 0 : bundle.discount_list) && bundle.discount_list.length > 0;
299
299
  if (hasBundleDiscount) return bundle;
300
- var restoredPrice = (_ref11 = (_bundle$original_pric = bundle === null || bundle === void 0 ? void 0 : bundle.original_price) !== null && _bundle$original_pric !== void 0 ? _bundle$original_pric : bundle === null || bundle === void 0 ? void 0 : bundle.product_price) !== null && _ref11 !== void 0 ? _ref11 : bundle === null || bundle === void 0 ? void 0 : bundle.price;
300
+ var restoredPrice = (_ref11 = (_bundle$price = bundle === null || bundle === void 0 ? void 0 : bundle.price) !== null && _bundle$price !== void 0 ? _bundle$price : bundle === null || bundle === void 0 ? void 0 : bundle.original_price) !== null && _ref11 !== void 0 ? _ref11 : bundle === null || bundle === void 0 ? void 0 : bundle.product_price;
301
301
  if (restoredPrice === undefined || restoredPrice === null || restoredPrice === '') return bundle;
302
302
  return _objectSpread(_objectSpread({}, bundle), {}, {
303
303
  price: restoredPrice,
@@ -851,7 +851,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
851
851
  key: "getUserIdentificationCodeListAsync",
852
852
  value: function () {
853
853
  var _getUserIdentificationCodeListAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(params) {
854
- var _newParams$products, _newParams$prepare_pa, _this$walletParams4, newParams, platform, response, sortedData;
854
+ var _newParams$products, _newParams$prepare_pa, _this$walletParams4, newParams, response, sortedData;
855
855
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
856
856
  while (1) switch (_context6.prev = _context6.next) {
857
857
  case 0:
@@ -864,20 +864,19 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
864
864
  this.paymentModule.logInfo('[WalletPass] 商品列表为空,跳过获取用户识别码列表');
865
865
  return _context6.abrupt("return", []);
866
866
  case 5:
867
- platform = this.paymentModule.getPlatform();
868
- if (!(platform === 'pc' || platform === 'h5')) {
869
- _context6.next = 11;
870
- break;
871
- }
872
- this.userIdentificationCodes = [];
873
- this.emitEvent(WalletPassHooks.OnUserIdentificationCodesUpdated, {
874
- userIdentificationCodes: []
875
- });
876
- this.paymentModule.logInfo('[WalletPass] 用户端平台跳过获取用户识别码列表', {
877
- platform: platform
878
- });
879
- return _context6.abrupt("return", []);
880
- case 11:
867
+ // const platform = this.paymentModule.getPlatform();
868
+ // if (platform === 'pc' || platform === 'h5') {
869
+ // this.userIdentificationCodes = [];
870
+ // this.emitEvent(WalletPassHooks.OnUserIdentificationCodesUpdated, {
871
+ // userIdentificationCodes: [],
872
+ // } as OnUserIdentificationCodesUpdatedEventData);
873
+ // this.paymentModule.logInfo(
874
+ // '[WalletPass] 用户端平台跳过获取用户识别码列表',
875
+ // { platform },
876
+ // );
877
+ // return [];
878
+ // }
879
+
881
880
  if (typeof newParams.payment_order_id === 'string' && newParams.payment_order_id.startsWith('LOCAL_')) {
882
881
  newParams.payment_order_id = undefined;
883
882
  }
@@ -888,9 +887,9 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
888
887
  filter_prepare_wallet_pass: newParams.filter_prepare_wallet_pass,
889
888
  payment_order_id: (_this$walletParams4 = this.walletParams) === null || _this$walletParams4 === void 0 ? void 0 : _this$walletParams4.payment_order_id
890
889
  });
891
- _context6.next = 15;
890
+ _context6.next = 9;
892
891
  return this.paymentModule.request.post('/machinecode/prepare/deduction', newParams);
893
- case 15:
892
+ case 9:
894
893
  response = _context6.sent;
895
894
  // 对获取到的数据进行排序,将错误码为 500100、500200、500300 的项目排到最后
896
895
  sortedData = sortUserIdentificationCodeList((response === null || response === void 0 ? void 0 : response.data) || []);
@@ -911,19 +910,19 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
911
910
  })
912
911
  });
913
912
  return _context6.abrupt("return", this.userIdentificationCodes);
914
- case 23:
915
- _context6.prev = 23;
913
+ case 17:
914
+ _context6.prev = 17;
916
915
  _context6.t0 = _context6["catch"](0);
917
916
  this.paymentModule.logError('[WalletPass] 获取用户识别码列表失败', _context6.t0, {
918
917
  customer_id: params.customer_id,
919
918
  available: params.available
920
919
  });
921
920
  return _context6.abrupt("return", []);
922
- case 27:
921
+ case 21:
923
922
  case "end":
924
923
  return _context6.stop();
925
924
  }
926
- }, _callee6, this, [[0, 23]]);
925
+ }, _callee6, this, [[0, 17]]);
927
926
  }));
928
927
  function getUserIdentificationCodeListAsync(_x7) {
929
928
  return _getUserIdentificationCodeListAsync.apply(this, arguments);
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
326
326
  date: string;
327
327
  status: string;
328
328
  week: string;
329
- weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
329
+ weekNum: 0 | 2 | 1 | 6 | 4 | 5 | 3;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
@@ -345,7 +345,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
345
345
  count: number;
346
346
  left: number;
347
347
  summaryCount: number;
348
- status: "sold_out" | "lots_of_space" | "filling_up_fast";
348
+ status: "lots_of_space" | "filling_up_fast" | "sold_out";
349
349
  }[];
350
350
  /**
351
351
  * 找到多个资源的公共可用时间段
@@ -458,19 +458,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
458
458
  * 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
459
459
  * 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
460
460
  */
461
- decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): {
462
- action: "reloadCatalog";
463
- } | {
464
- action: "add";
465
- cacheItem: any;
466
- } | {
467
- action: "requiresDetail";
468
- payload: AddProductRequiresDetailPayload;
469
- } | {
470
- action: "requiresBookingEdit";
471
- cacheItem: any;
472
- payload: import("./utils/addProductDecision").AddProductRequiresBookingEditPayload;
473
- };
461
+ decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
474
462
  /** 规格弹窗 callback 后的第二段决策。 */
475
463
  decideAfterDetail(cacheItem: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
476
464
  /**
@@ -1 +1,46 @@
1
- "use strict";
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "BUY_X_GET_Y_FREE_STRATEGY", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _examples.BUY_X_GET_Y_FREE_STRATEGY;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "ITEM_REWARD_STRATEGY", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _examples.ITEM_REWARD_STRATEGY;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "PromotionAdapter", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _adapter.PromotionAdapter;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "PromotionEvaluator", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _evaluator.PromotionEvaluator;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "X_ITEMS_FOR_Y_PRICE_STRATEGY", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _examples.X_ITEMS_FOR_Y_PRICE_STRATEGY;
34
+ }
35
+ });
36
+ Object.defineProperty(exports, "default", {
37
+ enumerable: true,
38
+ get: function () {
39
+ return _adapter.default;
40
+ }
41
+ });
42
+ var _evaluator = require("./evaluator");
43
+ var _adapter = _interopRequireWildcard(require("./adapter"));
44
+ var _examples = require("./examples");
45
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
46
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -533,7 +533,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
533
533
  generateIdempotencyToken(): string;
534
534
  syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
535
535
  createOrder(params: CommitOrderParams['query']): {
536
- type: "appointment_booking" | "virtual";
536
+ type: "virtual" | "appointment_booking";
537
537
  platform: string;
538
538
  sales_channel: string;
539
539
  order_sales_channel: string;
@@ -261,7 +261,7 @@ class OrderModule extends _BaseModule.BaseModule {
261
261
  product.product_bundle = product.product_bundle.map(bundle => {
262
262
  const hasBundleDiscount = Array.isArray(bundle?.discount_list) && bundle.discount_list.length > 0;
263
263
  if (hasBundleDiscount) return bundle;
264
- const restoredPrice = bundle?.original_price ?? bundle?.product_price ?? bundle?.price;
264
+ const restoredPrice = bundle?.price ?? bundle?.original_price ?? bundle?.product_price;
265
265
  if (restoredPrice === undefined || restoredPrice === null || restoredPrice === '') return bundle;
266
266
  return {
267
267
  ...bundle,
@@ -650,17 +650,20 @@ class WalletPassPaymentImpl {
650
650
  this.paymentModule.logInfo('[WalletPass] 商品列表为空,跳过获取用户识别码列表');
651
651
  return [];
652
652
  }
653
- const platform = this.paymentModule.getPlatform();
654
- if (platform === 'pc' || platform === 'h5') {
655
- this.userIdentificationCodes = [];
656
- this.emitEvent(_types.WalletPassHooks.OnUserIdentificationCodesUpdated, {
657
- userIdentificationCodes: []
658
- });
659
- this.paymentModule.logInfo('[WalletPass] 用户端平台跳过获取用户识别码列表', {
660
- platform
661
- });
662
- return [];
663
- }
653
+
654
+ // const platform = this.paymentModule.getPlatform();
655
+ // if (platform === 'pc' || platform === 'h5') {
656
+ // this.userIdentificationCodes = [];
657
+ // this.emitEvent(WalletPassHooks.OnUserIdentificationCodesUpdated, {
658
+ // userIdentificationCodes: [],
659
+ // } as OnUserIdentificationCodesUpdatedEventData);
660
+ // this.paymentModule.logInfo(
661
+ // '[WalletPass] 用户端平台跳过获取用户识别码列表',
662
+ // { platform },
663
+ // );
664
+ // return [];
665
+ // }
666
+
664
667
  if (typeof newParams.payment_order_id === 'string' && newParams.payment_order_id.startsWith('LOCAL_')) {
665
668
  newParams.payment_order_id = undefined;
666
669
  }
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
326
326
  date: string;
327
327
  status: string;
328
328
  week: string;
329
- weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
329
+ weekNum: 0 | 2 | 1 | 6 | 4 | 5 | 3;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
@@ -345,7 +345,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
345
345
  count: number;
346
346
  left: number;
347
347
  summaryCount: number;
348
- status: "sold_out" | "lots_of_space" | "filling_up_fast";
348
+ status: "lots_of_space" | "filling_up_fast" | "sold_out";
349
349
  }[];
350
350
  /**
351
351
  * 找到多个资源的公共可用时间段
@@ -458,19 +458,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
458
458
  * 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
459
459
  * 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
460
460
  */
461
- decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): {
462
- action: "reloadCatalog";
463
- } | {
464
- action: "add";
465
- cacheItem: any;
466
- } | {
467
- action: "requiresDetail";
468
- payload: AddProductRequiresDetailPayload;
469
- } | {
470
- action: "requiresBookingEdit";
471
- cacheItem: any;
472
- payload: import("./utils/addProductDecision").AddProductRequiresBookingEditPayload;
473
- };
461
+ decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
474
462
  /** 规格弹窗 callback 后的第二段决策。 */
475
463
  decideAfterDetail(cacheItem: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
476
464
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.10.25",
4
+ "version": "0.10.27",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",