@pisell/pisellos 0.10.5 → 0.10.6

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.
@@ -497,7 +497,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
497
497
  generateIdempotencyToken(): string;
498
498
  syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
499
499
  createOrder(params: CommitOrderParams['query']): {
500
- type: "appointment_booking" | "virtual";
500
+ type: "virtual" | "appointment_booking";
501
501
  platform: string;
502
502
  sales_channel: string;
503
503
  order_sales_channel: string;
@@ -41,6 +41,10 @@ export declare class PaymentModule extends BaseModule implements Module, Payment
41
41
  * paymentModule.updateOtherParams({ fatherModule: 'bookingTicket' });
42
42
  */
43
43
  updateOtherParams(params: Record<string, any>): void;
44
+ /**
45
+ * 获取标准化后的宿主平台标识,供支付子能力做平台边界判断。
46
+ */
47
+ getPlatform(): string;
44
48
  private getPaymentNumberAppData;
45
49
  /**
46
50
  * 记录信息日志
@@ -231,6 +231,16 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
231
231
  value: function updateOtherParams(params) {
232
232
  this.otherParams = params || {};
233
233
  }
234
+
235
+ /**
236
+ * 获取标准化后的宿主平台标识,供支付子能力做平台边界判断。
237
+ */
238
+ }, {
239
+ key: "getPlatform",
240
+ value: function getPlatform() {
241
+ var _this$otherParams;
242
+ return String(((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.platform) || '').trim().toLowerCase();
243
+ }
234
244
  }, {
235
245
  key: "getPaymentNumberAppData",
236
246
  value: function getPaymentNumberAppData(key) {
@@ -247,10 +257,10 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
247
257
  }, {
248
258
  key: "logInfo",
249
259
  value: function logInfo(title, metadata) {
250
- var _this$otherParams;
251
- if ((_this$otherParams = this.otherParams) !== null && _this$otherParams !== void 0 && _this$otherParams.fatherModule) {
252
- var _this$otherParams2;
253
- var fatherModule = this.core.getModule((_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.fatherModule);
260
+ var _this$otherParams2;
261
+ if ((_this$otherParams2 = this.otherParams) !== null && _this$otherParams2 !== void 0 && _this$otherParams2.fatherModule) {
262
+ var _this$otherParams3;
263
+ var fatherModule = this.core.getModule((_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.fatherModule);
254
264
  if (fatherModule) {
255
265
  fatherModule.logInfo("".concat(title), metadata);
256
266
  return;
@@ -759,7 +759,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
759
759
  key: "getUserIdentificationCodeListAsync",
760
760
  value: function () {
761
761
  var _getUserIdentificationCodeListAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(params) {
762
- var _newParams$products, _newParams$prepare_pa, _this$walletParams2, newParams, response, sortedData;
762
+ var _newParams$products, _newParams$prepare_pa, _this$walletParams2, newParams, platform, response, sortedData;
763
763
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
764
764
  while (1) switch (_context6.prev = _context6.next) {
765
765
  case 0:
@@ -772,6 +772,20 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
772
772
  this.paymentModule.logInfo('[WalletPass] 商品列表为空,跳过获取用户识别码列表');
773
773
  return _context6.abrupt("return", []);
774
774
  case 5:
775
+ platform = this.paymentModule.getPlatform();
776
+ if (!(platform === 'pc' || platform === 'h5')) {
777
+ _context6.next = 11;
778
+ break;
779
+ }
780
+ this.userIdentificationCodes = [];
781
+ this.emitEvent(WalletPassHooks.OnUserIdentificationCodesUpdated, {
782
+ userIdentificationCodes: []
783
+ });
784
+ this.paymentModule.logInfo('[WalletPass] 用户端平台跳过获取用户识别码列表', {
785
+ platform: platform
786
+ });
787
+ return _context6.abrupt("return", []);
788
+ case 11:
775
789
  if (typeof newParams.payment_order_id === 'string' && newParams.payment_order_id.startsWith('LOCAL_')) {
776
790
  newParams.payment_order_id = undefined;
777
791
  }
@@ -782,9 +796,9 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
782
796
  filter_prepare_wallet_pass: newParams.filter_prepare_wallet_pass,
783
797
  payment_order_id: (_this$walletParams2 = this.walletParams) === null || _this$walletParams2 === void 0 ? void 0 : _this$walletParams2.payment_order_id
784
798
  });
785
- _context6.next = 9;
799
+ _context6.next = 15;
786
800
  return this.paymentModule.request.post('/machinecode/prepare/deduction', newParams);
787
- case 9:
801
+ case 15:
788
802
  response = _context6.sent;
789
803
  // 对获取到的数据进行排序,将错误码为 500100、500200、500300 的项目排到最后
790
804
  sortedData = sortUserIdentificationCodeList((response === null || response === void 0 ? void 0 : response.data) || []);
@@ -805,19 +819,19 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
805
819
  })
806
820
  });
807
821
  return _context6.abrupt("return", this.userIdentificationCodes);
808
- case 17:
809
- _context6.prev = 17;
822
+ case 23:
823
+ _context6.prev = 23;
810
824
  _context6.t0 = _context6["catch"](0);
811
825
  this.paymentModule.logError('[WalletPass] 获取用户识别码列表失败', _context6.t0, {
812
826
  customer_id: params.customer_id,
813
827
  available: params.available
814
828
  });
815
829
  return _context6.abrupt("return", []);
816
- case 21:
830
+ case 27:
817
831
  case "end":
818
832
  return _context6.stop();
819
833
  }
820
- }, _callee6, this, [[0, 17]]);
834
+ }, _callee6, this, [[0, 23]]);
821
835
  }));
822
836
  function getUserIdentificationCodeListAsync(_x7) {
823
837
  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 | 5 | 2 | 1 | 6 | 4 | 3;
329
+ weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
@@ -328,7 +328,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
328
328
  * 获取当前的客户搜索条件
329
329
  * @returns 当前搜索条件
330
330
  */
331
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
331
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
332
332
  /**
333
333
  * 获取客户列表状态(包含滚动加载相关状态)
334
334
  * @returns 客户状态
@@ -447,19 +447,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
447
447
  * 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
448
448
  * 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
449
449
  */
450
- decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): {
451
- action: "reloadCatalog";
452
- } | {
453
- action: "add";
454
- cacheItem: any;
455
- } | {
456
- action: "requiresDetail";
457
- payload: AddProductRequiresDetailPayload;
458
- } | {
459
- action: "requiresBookingEdit";
460
- cacheItem: any;
461
- payload: import("./utils/addProductDecision").AddProductRequiresBookingEditPayload;
462
- };
450
+ decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
463
451
  /** 规格弹窗 callback 后的第二段决策。 */
464
452
  decideAfterDetail(cacheItem: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
465
453
  /**
@@ -497,7 +497,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
497
497
  generateIdempotencyToken(): string;
498
498
  syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
499
499
  createOrder(params: CommitOrderParams['query']): {
500
- type: "appointment_booking" | "virtual";
500
+ type: "virtual" | "appointment_booking";
501
501
  platform: string;
502
502
  sales_channel: string;
503
503
  order_sales_channel: string;
@@ -41,6 +41,10 @@ export declare class PaymentModule extends BaseModule implements Module, Payment
41
41
  * paymentModule.updateOtherParams({ fatherModule: 'bookingTicket' });
42
42
  */
43
43
  updateOtherParams(params: Record<string, any>): void;
44
+ /**
45
+ * 获取标准化后的宿主平台标识,供支付子能力做平台边界判断。
46
+ */
47
+ getPlatform(): string;
44
48
  private getPaymentNumberAppData;
45
49
  /**
46
50
  * 记录信息日志
@@ -139,6 +139,13 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
139
139
  updateOtherParams(params) {
140
140
  this.otherParams = params || {};
141
141
  }
142
+ /**
143
+ * 获取标准化后的宿主平台标识,供支付子能力做平台边界判断。
144
+ */
145
+ getPlatform() {
146
+ var _a;
147
+ return String(((_a = this.otherParams) == null ? void 0 : _a.platform) || "").trim().toLowerCase();
148
+ }
142
149
  getPaymentNumberAppData(key) {
143
150
  var _a, _b, _c, _d, _e, _f, _g;
144
151
  const getData = (_b = (_a = this.appPlugin) == null ? void 0 : _a.getData) == null ? void 0 : _b.call(_a);
@@ -638,6 +638,18 @@ var WalletPassPaymentImpl = class {
638
638
  this.paymentModule.logInfo("[WalletPass] 商品列表为空,跳过获取用户识别码列表");
639
639
  return [];
640
640
  }
641
+ const platform = this.paymentModule.getPlatform();
642
+ if (platform === "pc" || platform === "h5") {
643
+ this.userIdentificationCodes = [];
644
+ this.emitEvent(import_types.WalletPassHooks.OnUserIdentificationCodesUpdated, {
645
+ userIdentificationCodes: []
646
+ });
647
+ this.paymentModule.logInfo(
648
+ "[WalletPass] 用户端平台跳过获取用户识别码列表",
649
+ { platform }
650
+ );
651
+ return [];
652
+ }
641
653
  if (typeof newParams.payment_order_id === "string" && newParams.payment_order_id.startsWith("LOCAL_")) {
642
654
  newParams.payment_order_id = void 0;
643
655
  }
@@ -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 | 5 | 2 | 1 | 6 | 4 | 3;
329
+ weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
@@ -328,7 +328,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
328
328
  * 获取当前的客户搜索条件
329
329
  * @returns 当前搜索条件
330
330
  */
331
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
331
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
332
332
  /**
333
333
  * 获取客户列表状态(包含滚动加载相关状态)
334
334
  * @returns 客户状态
@@ -447,19 +447,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
447
447
  * 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
448
448
  * 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
449
449
  */
450
- decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): {
451
- action: "reloadCatalog";
452
- } | {
453
- action: "add";
454
- cacheItem: any;
455
- } | {
456
- action: "requiresDetail";
457
- payload: AddProductRequiresDetailPayload;
458
- } | {
459
- action: "requiresBookingEdit";
460
- cacheItem: any;
461
- payload: import("./utils/addProductDecision").AddProductRequiresBookingEditPayload;
462
- };
450
+ decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
463
451
  /** 规格弹窗 callback 后的第二段决策。 */
464
452
  decideAfterDetail(cacheItem: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
465
453
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.10.5",
4
+ "version": "0.10.6",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",