@pisell/pisellos 2.3.79 → 2.3.81

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, ITEM_REWARD_STRATEGY } from "./examples";
@@ -0,0 +1,27 @@
1
+ import type { PisellCore } from '../../types';
2
+ import type { RequestPlugin } from '../../plugins';
3
+ import type { ProductData } from '../Product/types';
4
+ export declare const PRODUCT_QUERY_DATA_VARIANT_RELATIONS: readonly ["category", "collection", "resourceRelation", "bundleGroup.bundleItem", "optionGroup.optionItem", "variantGroup.variantItem", "dataVariants"];
5
+ /**
6
+ * 判断当前商品查询是否会被本地 OS Server 接管。
7
+ *
8
+ * H5 RequestPlugin 即使收到 osServer=true 仍会直接请求远端接口,因此必须按
9
+ * RequestPlugin 实际 baseUrl 对应的已注册路由判断,不能只看请求选项。
10
+ */
11
+ export declare function isProductQueryHandledByOsServer(core: PisellCore | undefined, request: RequestPlugin | undefined): boolean;
12
+ export interface ResolveClientDataVariantsParams {
13
+ core: PisellCore | undefined;
14
+ otherParams?: Record<string, any>;
15
+ products: ProductData[];
16
+ queryPayload: Record<string, any>;
17
+ handledByOsServer: boolean;
18
+ scheduleList?: unknown;
19
+ menuList?: unknown;
20
+ }
21
+ /**
22
+ * 未启用商品 OS 路由时,在客户端补做 Data Variant 解析。
23
+ *
24
+ * 商品列表和预约报价必须共用这个边界,避免 H5 的弹窗报价绕过客户端智能定价。
25
+ * OS Server 已接管时直接信任服务端结果,确保同一批商品只评估一次。
26
+ */
27
+ export declare function resolveClientDataVariants({ core, otherParams, products, queryPayload, handledByOsServer, scheduleList: explicitScheduleList, menuList: explicitMenuList, }: ResolveClientDataVariantsParams): ProductData[];
@@ -0,0 +1,62 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ export var PRODUCT_QUERY_DATA_VARIANT_RELATIONS = ['category', 'collection', 'resourceRelation', 'bundleGroup.bundleItem', 'optionGroup.optionItem', 'variantGroup.variantItem', 'dataVariants'];
3
+
4
+ /**
5
+ * 判断当前商品查询是否会被本地 OS Server 接管。
6
+ *
7
+ * H5 RequestPlugin 即使收到 osServer=true 仍会直接请求远端接口,因此必须按
8
+ * RequestPlugin 实际 baseUrl 对应的已注册路由判断,不能只看请求选项。
9
+ */
10
+ export function isProductQueryHandledByOsServer(core, request) {
11
+ var server = core === null || core === void 0 ? void 0 : core.server;
12
+ if (!server || typeof server.hasRoute !== 'function') return false;
13
+ var requestBaseUrl = String((request === null || request === void 0 ? void 0 : request.baseUrl) || '/shop').replace(/\/+$/, '');
14
+ return server.hasRoute('post', "".concat(requestBaseUrl, "/product/query")) === true;
15
+ }
16
+ /**
17
+ * 未启用商品 OS 路由时,在客户端补做 Data Variant 解析。
18
+ *
19
+ * 商品列表和预约报价必须共用这个边界,避免 H5 的弹窗报价绕过客户端智能定价。
20
+ * OS Server 已接管时直接信任服务端结果,确保同一批商品只评估一次。
21
+ */
22
+ export function resolveClientDataVariants(_ref) {
23
+ var _core$context, _scheduleModule$getSc, _core$context2, _core$context3, _strategyContext$busi;
24
+ var core = _ref.core,
25
+ _ref$otherParams = _ref.otherParams,
26
+ otherParams = _ref$otherParams === void 0 ? {} : _ref$otherParams,
27
+ products = _ref.products,
28
+ queryPayload = _ref.queryPayload,
29
+ handledByOsServer = _ref.handledByOsServer,
30
+ explicitScheduleList = _ref.scheduleList,
31
+ explicitMenuList = _ref.menuList;
32
+ if (handledByOsServer || products.length === 0) return products;
33
+ var evaluator = core === null || core === void 0 || (_core$context = core.context) === null || _core$context === void 0 ? void 0 : _core$context.dataVariantEvaluator;
34
+ if (!evaluator || typeof evaluator.resolveProducts !== 'function') {
35
+ return products;
36
+ }
37
+ var strategyContext = queryPayload.strategy_context && _typeof(queryPayload.strategy_context) === 'object' ? queryPayload.strategy_context : {};
38
+ var fatherModule = String(otherParams.fatherModule || '').trim();
39
+ var scheduleModule = (fatherModule ? core === null || core === void 0 ? void 0 : core.getModule("".concat(fatherModule, "_schedule")) : null) || (core === null || core === void 0 ? void 0 : core.getModule('schedule'));
40
+ var moduleScheduleList = scheduleModule === null || scheduleModule === void 0 || (_scheduleModule$getSc = scheduleModule.getScheduleList) === null || _scheduleModule$getSc === void 0 ? void 0 : _scheduleModule$getSc.call(scheduleModule);
41
+ var contextScheduleList = core === null || core === void 0 || (_core$context2 = core.context) === null || _core$context2 === void 0 ? void 0 : _core$context2.scheduleList;
42
+ var contextMenuList = core === null || core === void 0 || (_core$context3 = core.context) === null || _core$context3 === void 0 ? void 0 : _core$context3.menuList;
43
+ var businessData = {
44
+ products: products,
45
+ scheduleDateTime: queryPayload.schedule_datetime || queryPayload.schedule_date,
46
+ scheduleList: Array.isArray(explicitScheduleList) ? explicitScheduleList : Array.isArray(moduleScheduleList) ? moduleScheduleList : Array.isArray(contextScheduleList) ? contextScheduleList : [],
47
+ menuList: Array.isArray(explicitMenuList) ? explicitMenuList : Array.isArray(otherParams.menuList) ? otherParams.menuList : Array.isArray(contextMenuList) ? contextMenuList : [],
48
+ customerId: queryPayload.customer_id,
49
+ channel: strategyContext.channel,
50
+ orderType: strategyContext.orderType || strategyContext.order_type,
51
+ businessCode: (_strategyContext$busi = strategyContext.business_code) !== null && _strategyContext$busi !== void 0 ? _strategyContext$busi : strategyContext.businessCode,
52
+ availableWalletIds: strategyContext.available_wallet_ids,
53
+ custom: strategyContext
54
+ };
55
+ try {
56
+ var result = evaluator.resolveProducts(businessData);
57
+ return Array.isArray(result === null || result === void 0 ? void 0 : result.products) ? result.products : products;
58
+ } catch (error) {
59
+ console.error('[ClientDataVariants] Data Variant 客户端解析失败', error);
60
+ return products;
61
+ }
62
+ }
@@ -25,11 +25,11 @@ export declare class ProductList extends BaseModule implements Module {
25
25
  * @example
26
26
  * const products = await productList.getAddTimeProducts({ schedule_date: '2026-06-16' });
27
27
  */
28
- getAddTimeProducts(params?: ProductListLoadProductsParams): Promise<any>;
28
+ getAddTimeProducts(params?: ProductListLoadProductsParams): Promise<ProductData[]>;
29
29
  loadProducts({ category_ids, product_ids, collection, menu_list_ids, customer_id: paramsCustomerId, with_count, schedule_datetime, schedule_date, cacheId, with_schedule, extension_type, status, strategy_context, }?: ProductListLoadProductsParams, options?: {
30
30
  callback?: (result: any) => void;
31
31
  subscriberId?: string;
32
- }): Promise<any>;
32
+ }): Promise<ProductData[]>;
33
33
  loadProductsPrice({ ids, customer_id, schedule_date, channel, }: {
34
34
  ids?: number[];
35
35
  customer_id?: number;
@@ -1,4 +1,10 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
3
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
6
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
7
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
2
8
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
9
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
10
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
@@ -20,6 +26,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
20
26
  import { BaseModule } from "../BaseModule";
21
27
  import { cloneDeep } from 'lodash-es';
22
28
  import dayjs from 'dayjs';
29
+ import { isProductQueryHandledByOsServer, PRODUCT_QUERY_DATA_VARIANT_RELATIONS, resolveClientDataVariants } from "./clientDataVariants";
23
30
  export * from "./types";
24
31
  export var ProductList = /*#__PURE__*/function (_BaseModule) {
25
32
  _inherits(ProductList, _BaseModule);
@@ -162,9 +169,11 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
162
169
  rawApplicationCode,
163
170
  mappedApplicationCode,
164
171
  queryPayload,
172
+ handledByOsServer,
165
173
  originalCallback,
166
174
  subscriptionCallback,
167
175
  productsData,
176
+ resolvedList,
168
177
  sortedList,
169
178
  _args5 = arguments;
170
179
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
@@ -205,7 +214,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
205
214
  open_quotation: 1,
206
215
  open_bundle: 0,
207
216
  exclude_extension_type: ['product_party', 'product_event', 'product_series_event', 'product_package_ticket', 'ticket', 'event_item'],
208
- with: ['category', 'collection', 'resourceRelation', 'bundleGroup.bundleItem', 'optionGroup.optionItem', 'variantGroup.variantItem', 'dataVariants'],
217
+ with: _toConsumableArray(PRODUCT_QUERY_DATA_VARIANT_RELATIONS),
209
218
  status: status,
210
219
  num: 500,
211
220
  skip: 1,
@@ -231,20 +240,39 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
231
240
  extension_type: extension_type,
232
241
  strategy_context: strategy_context
233
242
  });
243
+ handledByOsServer = isProductQueryHandledByOsServer(this.core, this.request);
234
244
  originalCallback = options === null || options === void 0 ? void 0 : options.callback;
235
- subscriptionCallback = originalCallback ? ( /*#__PURE__*/function () {
245
+ subscriptionCallback = typeof originalCallback === 'function' ? ( /*#__PURE__*/function () {
236
246
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(result) {
237
247
  var _result$data;
238
- var products;
248
+ var callbackList, products;
239
249
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
240
250
  while (1) switch (_context4.prev = _context4.next) {
241
251
  case 0:
242
- products = Array.isArray(result === null || result === void 0 || (_result$data = result.data) === null || _result$data === void 0 ? void 0 : _result$data.list) ? result.data.list : [];
243
- _context4.next = 3;
244
- return _this2.addProduct(products);
245
- case 3:
252
+ callbackList = result === null || result === void 0 || (_result$data = result.data) === null || _result$data === void 0 ? void 0 : _result$data.list;
253
+ if (Array.isArray(callbackList)) {
254
+ _context4.next = 4;
255
+ break;
256
+ }
246
257
  originalCallback(result);
258
+ return _context4.abrupt("return");
247
259
  case 4:
260
+ products = resolveClientDataVariants({
261
+ core: _this2.core,
262
+ otherParams: _this2.otherParams,
263
+ products: callbackList,
264
+ queryPayload: queryPayload,
265
+ handledByOsServer: handledByOsServer
266
+ });
267
+ _context4.next = 7;
268
+ return _this2.addProduct(products);
269
+ case 7:
270
+ originalCallback(handledByOsServer ? result : _objectSpread(_objectSpread({}, result), {}, {
271
+ data: _objectSpread(_objectSpread({}, result.data), {}, {
272
+ list: products
273
+ })
274
+ }));
275
+ case 8:
248
276
  case "end":
249
277
  return _context4.stop();
250
278
  }
@@ -254,16 +282,23 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
254
282
  return _ref2.apply(this, arguments);
255
283
  };
256
284
  }()) : undefined;
257
- _context5.next = 13;
285
+ _context5.next = 14;
258
286
  return this.request.post("/product/query", queryPayload, {
259
287
  osServer: true,
260
288
  callback: subscriptionCallback,
261
289
  subscriberId: options === null || options === void 0 ? void 0 : options.subscriberId,
262
290
  customToast: function customToast() {}
263
291
  });
264
- case 13:
292
+ case 14:
265
293
  productsData = _context5.sent;
266
- sortedList = (productsData.data.list || []).slice().sort(function (a, b) {
294
+ resolvedList = resolveClientDataVariants({
295
+ core: this.core,
296
+ otherParams: this.otherParams,
297
+ products: productsData.data.list || [],
298
+ queryPayload: queryPayload,
299
+ handledByOsServer: handledByOsServer
300
+ });
301
+ sortedList = resolvedList.slice().sort(function (a, b) {
267
302
  return Number(b.sort) - Number(a.sort);
268
303
  }); // if (sortedList.length) {
269
304
  // sortedList.forEach((n: any) => {
@@ -274,7 +309,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
274
309
  // }
275
310
  this.addProduct(sortedList);
276
311
  return _context5.abrupt("return", sortedList);
277
- case 17:
312
+ case 19:
278
313
  case "end":
279
314
  return _context5.stop();
280
315
  }
@@ -495,7 +495,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
495
495
  getUnfulfilledPromotions(): OrderUnfulfilledPromotion[];
496
496
  /** 最近一次促销计算输出的赠品操作 diff。 */
497
497
  getLastGiftActions(): OrderLastGiftActions | null;
498
- getProductList(): Promise<any>;
498
+ getProductList(): Promise<import("../..").ProductData[] | undefined>;
499
499
  getOtherParams(): Record<string, any>;
500
500
  setOtherParams(params: Record<string, any>, { cover }?: {
501
501
  cover?: boolean;
@@ -42,6 +42,7 @@ import { resolvePaymentNumberDevicePrefix, resolvePaymentNumberDevicePrefixFromD
42
42
  import { applyOrderCollectionUidRemaps, getOrderCollectionPersistentId, getOrderCollectionReferenceUid, getOrderCollectionUid, isSameOrderCollectionItem, mergeOrderCollectionItems, normalizeOrderCollection, normalizeOrderCollections, setOrderCollectionUid } from "../../modules/Order/utils/orderCollectionIdentity";
43
43
  import dayjs from 'dayjs';
44
44
  export * from "./types";
45
+ import { isProductQueryHandledByOsServer, PRODUCT_QUERY_DATA_VARIANT_RELATIONS, resolveClientDataVariants } from "../../modules/ProductList/clientDataVariants";
45
46
  import { QuotationModule } from "../../modules/Quotation";
46
47
  import { transformBaseProductToOrderProduct as _transformBaseProductToOrderProduct } from "./utils/transformBaseProductToOrderProduct";
47
48
  import { calculateBaseSalesProductBookingPrice } from "./utils/quotationPrice";
@@ -995,7 +996,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
995
996
  key: "loadProductsForPriceQuery",
996
997
  value: function () {
997
998
  var _loadProductsForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(params) {
998
- var ids, productsById, channel, strategyContext, _response$data, response, list;
999
+ var ids, productsById, channel, strategyContext, handledByOsServer, _response$data, _this$store$schedule, _this$store$schedule$, queryPayload, response, list, resolvedList;
999
1000
  return _regeneratorRuntime().wrap(function _callee8$(_context8) {
1000
1001
  while (1) switch (_context8.prev = _context8.next) {
1001
1002
  case 0:
@@ -1011,14 +1012,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1011
1012
  case 4:
1012
1013
  channel = this.getPriceQueryChannel(params.channel);
1013
1014
  strategyContext = this.getPriceQueryStrategyContext(channel);
1014
- _context8.prev = 6;
1015
- _context8.next = 9;
1016
- return this.request.post('/product/query', _objectSpread({
1015
+ handledByOsServer = isProductQueryHandledByOsServer(this.core, this.request);
1016
+ _context8.prev = 7;
1017
+ queryPayload = _objectSpread({
1017
1018
  ids: ids,
1018
1019
  open_quotation: 1,
1019
1020
  open_bundle: 1,
1021
+ with: _toConsumableArray(PRODUCT_QUERY_DATA_VARIANT_RELATIONS),
1020
1022
  status: 'published',
1021
- num: 1,
1023
+ num: Math.max(ids.length, 1),
1022
1024
  skip: 1,
1023
1025
  customer_id: params.customerId,
1024
1026
  schedule_date: params.schedule.schedule_date,
@@ -1026,38 +1028,48 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1026
1028
  application_code: channel
1027
1029
  }, Object.keys(strategyContext).length ? {
1028
1030
  strategy_context: strategyContext
1029
- } : {}), {
1031
+ } : {});
1032
+ _context8.next = 11;
1033
+ return this.request.post('/product/query', queryPayload, {
1030
1034
  osServer: true,
1031
1035
  customToast: function customToast() {}
1032
1036
  });
1033
- case 9:
1037
+ case 11:
1034
1038
  response = _context8.sent;
1035
1039
  list = (response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.list) || (response === null || response === void 0 ? void 0 : response.list) || [];
1036
1040
  if (Array.isArray(list)) {
1037
- _context8.next = 13;
1041
+ _context8.next = 15;
1038
1042
  break;
1039
1043
  }
1040
1044
  return _context8.abrupt("return", productsById);
1041
- case 13:
1042
- list.forEach(function (item) {
1045
+ case 15:
1046
+ resolvedList = resolveClientDataVariants({
1047
+ core: this.core,
1048
+ otherParams: this.otherParams,
1049
+ products: list,
1050
+ queryPayload: queryPayload,
1051
+ handledByOsServer: handledByOsServer,
1052
+ scheduleList: (_this$store$schedule = this.store.schedule) === null || _this$store$schedule === void 0 || (_this$store$schedule$ = _this$store$schedule.getScheduleList) === null || _this$store$schedule$ === void 0 ? void 0 : _this$store$schedule$.call(_this$store$schedule)
1053
+ });
1054
+ resolvedList.forEach(function (item) {
1043
1055
  var _item$id;
1044
1056
  var productId = Number((_item$id = item === null || item === void 0 ? void 0 : item.id) !== null && _item$id !== void 0 ? _item$id : item === null || item === void 0 ? void 0 : item.product_id);
1045
1057
  if (Number.isFinite(productId)) productsById.set(productId, item);
1046
1058
  });
1047
1059
  return _context8.abrupt("return", productsById);
1048
- case 17:
1049
- _context8.prev = 17;
1050
- _context8.t0 = _context8["catch"](6);
1060
+ case 20:
1061
+ _context8.prev = 20;
1062
+ _context8.t0 = _context8["catch"](7);
1051
1063
  this.logWarning('loadProductsForPriceQuery: 商品批量重查失败,使用入参 fallback', {
1052
1064
  ids: ids,
1053
1065
  error: _context8.t0 instanceof Error ? _context8.t0.message : String(_context8.t0)
1054
1066
  });
1055
1067
  return _context8.abrupt("return", productsById);
1056
- case 21:
1068
+ case 24:
1057
1069
  case "end":
1058
1070
  return _context8.stop();
1059
1071
  }
1060
- }, _callee8, this, [[6, 17]]);
1072
+ }, _callee8, this, [[7, 20]]);
1061
1073
  }));
1062
1074
  function loadProductsForPriceQuery(_x7) {
1063
1075
  return _loadProductsForPriceQuery.apply(this, arguments);
@@ -67,7 +67,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
67
67
  product_ids?: number[];
68
68
  collection?: number | string[];
69
69
  schedule_date?: string;
70
- }): Promise<any>;
70
+ }): Promise<ProductData[]>;
71
71
  /**
72
72
  * 通过 schedule 来读取商品,适用于 session 类商品
73
73
  *
@@ -87,7 +87,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
87
87
  date: string;
88
88
  product_ids?: number[];
89
89
  category_ids?: number[];
90
- }): Promise<any>;
90
+ }): Promise<ProductData[]>;
91
91
  /**
92
92
  * 更新完商品数据、切换日期、或者在较后的流程里登录了,检测当前购物车里是否有商品,如果有,则需要更新购物车里的商品价格
93
93
  *
@@ -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 | 5 | 3 | 4 | 6;
329
+ weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
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
  * 找到多个资源的公共可用时间段
@@ -128,7 +128,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
128
128
  loadProducts(params?: ILoadProductsParams, options?: {
129
129
  callback?: (result: any) => void;
130
130
  subscriberId?: string;
131
- }): Promise<any>;
131
+ }): Promise<ProductData[]>;
132
132
  /**
133
133
  * 获取加时商品列表。
134
134
  *
@@ -0,0 +1,27 @@
1
+ import type { PisellCore } from '../../types';
2
+ import type { RequestPlugin } from '../../plugins';
3
+ import type { ProductData } from '../Product/types';
4
+ export declare const PRODUCT_QUERY_DATA_VARIANT_RELATIONS: readonly ["category", "collection", "resourceRelation", "bundleGroup.bundleItem", "optionGroup.optionItem", "variantGroup.variantItem", "dataVariants"];
5
+ /**
6
+ * 判断当前商品查询是否会被本地 OS Server 接管。
7
+ *
8
+ * H5 RequestPlugin 即使收到 osServer=true 仍会直接请求远端接口,因此必须按
9
+ * RequestPlugin 实际 baseUrl 对应的已注册路由判断,不能只看请求选项。
10
+ */
11
+ export declare function isProductQueryHandledByOsServer(core: PisellCore | undefined, request: RequestPlugin | undefined): boolean;
12
+ export interface ResolveClientDataVariantsParams {
13
+ core: PisellCore | undefined;
14
+ otherParams?: Record<string, any>;
15
+ products: ProductData[];
16
+ queryPayload: Record<string, any>;
17
+ handledByOsServer: boolean;
18
+ scheduleList?: unknown;
19
+ menuList?: unknown;
20
+ }
21
+ /**
22
+ * 未启用商品 OS 路由时,在客户端补做 Data Variant 解析。
23
+ *
24
+ * 商品列表和预约报价必须共用这个边界,避免 H5 的弹窗报价绕过客户端智能定价。
25
+ * OS Server 已接管时直接信任服务端结果,确保同一批商品只评估一次。
26
+ */
27
+ export declare function resolveClientDataVariants({ core, otherParams, products, queryPayload, handledByOsServer, scheduleList: explicitScheduleList, menuList: explicitMenuList, }: ResolveClientDataVariantsParams): ProductData[];
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.PRODUCT_QUERY_DATA_VARIANT_RELATIONS = void 0;
7
+ exports.isProductQueryHandledByOsServer = isProductQueryHandledByOsServer;
8
+ exports.resolveClientDataVariants = resolveClientDataVariants;
9
+ const PRODUCT_QUERY_DATA_VARIANT_RELATIONS = exports.PRODUCT_QUERY_DATA_VARIANT_RELATIONS = ['category', 'collection', 'resourceRelation', 'bundleGroup.bundleItem', 'optionGroup.optionItem', 'variantGroup.variantItem', 'dataVariants'];
10
+
11
+ /**
12
+ * 判断当前商品查询是否会被本地 OS Server 接管。
13
+ *
14
+ * H5 RequestPlugin 即使收到 osServer=true 仍会直接请求远端接口,因此必须按
15
+ * RequestPlugin 实际 baseUrl 对应的已注册路由判断,不能只看请求选项。
16
+ */
17
+ function isProductQueryHandledByOsServer(core, request) {
18
+ const server = core?.server;
19
+ if (!server || typeof server.hasRoute !== 'function') return false;
20
+ const requestBaseUrl = String(request?.baseUrl || '/shop').replace(/\/+$/, '');
21
+ return server.hasRoute('post', `${requestBaseUrl}/product/query`) === true;
22
+ }
23
+ /**
24
+ * 未启用商品 OS 路由时,在客户端补做 Data Variant 解析。
25
+ *
26
+ * 商品列表和预约报价必须共用这个边界,避免 H5 的弹窗报价绕过客户端智能定价。
27
+ * OS Server 已接管时直接信任服务端结果,确保同一批商品只评估一次。
28
+ */
29
+ function resolveClientDataVariants({
30
+ core,
31
+ otherParams = {},
32
+ products,
33
+ queryPayload,
34
+ handledByOsServer,
35
+ scheduleList: explicitScheduleList,
36
+ menuList: explicitMenuList
37
+ }) {
38
+ if (handledByOsServer || products.length === 0) return products;
39
+ const evaluator = core?.context?.dataVariantEvaluator;
40
+ if (!evaluator || typeof evaluator.resolveProducts !== 'function') {
41
+ return products;
42
+ }
43
+ const strategyContext = queryPayload.strategy_context && typeof queryPayload.strategy_context === 'object' ? queryPayload.strategy_context : {};
44
+ const fatherModule = String(otherParams.fatherModule || '').trim();
45
+ const scheduleModule = (fatherModule ? core?.getModule(`${fatherModule}_schedule`) : null) || core?.getModule('schedule');
46
+ const moduleScheduleList = scheduleModule?.getScheduleList?.();
47
+ const contextScheduleList = core?.context?.scheduleList;
48
+ const contextMenuList = core?.context?.menuList;
49
+ const businessData = {
50
+ products,
51
+ scheduleDateTime: queryPayload.schedule_datetime || queryPayload.schedule_date,
52
+ scheduleList: Array.isArray(explicitScheduleList) ? explicitScheduleList : Array.isArray(moduleScheduleList) ? moduleScheduleList : Array.isArray(contextScheduleList) ? contextScheduleList : [],
53
+ menuList: Array.isArray(explicitMenuList) ? explicitMenuList : Array.isArray(otherParams.menuList) ? otherParams.menuList : Array.isArray(contextMenuList) ? contextMenuList : [],
54
+ customerId: queryPayload.customer_id,
55
+ channel: strategyContext.channel,
56
+ orderType: strategyContext.orderType || strategyContext.order_type,
57
+ businessCode: strategyContext.business_code ?? strategyContext.businessCode,
58
+ availableWalletIds: strategyContext.available_wallet_ids,
59
+ custom: strategyContext
60
+ };
61
+ try {
62
+ const result = evaluator.resolveProducts(businessData);
63
+ return Array.isArray(result?.products) ? result.products : products;
64
+ } catch (error) {
65
+ console.error('[ClientDataVariants] Data Variant 客户端解析失败', error);
66
+ return products;
67
+ }
68
+ }
@@ -25,11 +25,11 @@ export declare class ProductList extends BaseModule implements Module {
25
25
  * @example
26
26
  * const products = await productList.getAddTimeProducts({ schedule_date: '2026-06-16' });
27
27
  */
28
- getAddTimeProducts(params?: ProductListLoadProductsParams): Promise<any>;
28
+ getAddTimeProducts(params?: ProductListLoadProductsParams): Promise<ProductData[]>;
29
29
  loadProducts({ category_ids, product_ids, collection, menu_list_ids, customer_id: paramsCustomerId, with_count, schedule_datetime, schedule_date, cacheId, with_schedule, extension_type, status, strategy_context, }?: ProductListLoadProductsParams, options?: {
30
30
  callback?: (result: any) => void;
31
31
  subscriberId?: string;
32
- }): Promise<any>;
32
+ }): Promise<ProductData[]>;
33
33
  loadProductsPrice({ ids, customer_id, schedule_date, channel, }: {
34
34
  ids?: number[];
35
35
  customer_id?: number;
@@ -10,6 +10,7 @@ exports.ProductList = void 0;
10
10
  var _BaseModule = require("../BaseModule");
11
11
  var _lodashEs = require("lodash-es");
12
12
  var _dayjs = _interopRequireDefault(require("dayjs"));
13
+ var _clientDataVariants = require("./clientDataVariants");
13
14
  var _types = require("./types");
14
15
  Object.keys(_types).forEach(function (key) {
15
16
  if (key === "default" || key === "__esModule") return;
@@ -121,7 +122,7 @@ class ProductList extends _BaseModule.BaseModule {
121
122
  open_quotation: 1,
122
123
  open_bundle: 0,
123
124
  exclude_extension_type: ['product_party', 'product_event', 'product_series_event', 'product_package_ticket', 'ticket', 'event_item'],
124
- with: ['category', 'collection', 'resourceRelation', 'bundleGroup.bundleItem', 'optionGroup.optionItem', 'variantGroup.variantItem', 'dataVariants'],
125
+ with: [..._clientDataVariants.PRODUCT_QUERY_DATA_VARIANT_RELATIONS],
125
126
  status,
126
127
  num: 500,
127
128
  skip: 1,
@@ -149,11 +150,29 @@ class ProductList extends _BaseModule.BaseModule {
149
150
  extension_type,
150
151
  strategy_context
151
152
  };
153
+ const handledByOsServer = (0, _clientDataVariants.isProductQueryHandledByOsServer)(this.core, this.request);
152
154
  const originalCallback = options?.callback;
153
- const subscriptionCallback = originalCallback ? async result => {
154
- const products = Array.isArray(result?.data?.list) ? result.data.list : [];
155
+ const subscriptionCallback = typeof originalCallback === 'function' ? async result => {
156
+ const callbackList = result?.data?.list;
157
+ if (!Array.isArray(callbackList)) {
158
+ originalCallback(result);
159
+ return;
160
+ }
161
+ const products = (0, _clientDataVariants.resolveClientDataVariants)({
162
+ core: this.core,
163
+ otherParams: this.otherParams,
164
+ products: callbackList,
165
+ queryPayload,
166
+ handledByOsServer
167
+ });
155
168
  await this.addProduct(products);
156
- originalCallback(result);
169
+ originalCallback(handledByOsServer ? result : {
170
+ ...result,
171
+ data: {
172
+ ...result.data,
173
+ list: products
174
+ }
175
+ });
157
176
  } : undefined;
158
177
  const productsData = await this.request.post(`/product/query`, queryPayload, {
159
178
  osServer: true,
@@ -161,7 +180,14 @@ class ProductList extends _BaseModule.BaseModule {
161
180
  subscriberId: options?.subscriberId,
162
181
  customToast: () => {}
163
182
  });
164
- const sortedList = (productsData.data.list || []).slice().sort((a, b) => Number(b.sort) - Number(a.sort));
183
+ const resolvedList = (0, _clientDataVariants.resolveClientDataVariants)({
184
+ core: this.core,
185
+ otherParams: this.otherParams,
186
+ products: productsData.data.list || [],
187
+ queryPayload,
188
+ handledByOsServer
189
+ });
190
+ const sortedList = resolvedList.slice().sort((a, b) => Number(b.sort) - Number(a.sort));
165
191
  // if (sortedList.length) {
166
192
  // sortedList.forEach((n: any) => {
167
193
  // if (n.is_eject !== 1 && n['schedule.ids'] && n['schedule.ids'].length) {
@@ -495,7 +495,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
495
495
  getUnfulfilledPromotions(): OrderUnfulfilledPromotion[];
496
496
  /** 最近一次促销计算输出的赠品操作 diff。 */
497
497
  getLastGiftActions(): OrderLastGiftActions | null;
498
- getProductList(): Promise<any>;
498
+ getProductList(): Promise<import("../..").ProductData[] | undefined>;
499
499
  getOtherParams(): Record<string, any>;
500
500
  setOtherParams(params: Record<string, any>, { cover }?: {
501
501
  cover?: boolean;
@@ -29,6 +29,7 @@ var _paymentUtils = require("../../modules/Order/payment-utils");
29
29
  var _paymentNumber = require("../../utils/payment-number");
30
30
  var _orderCollectionIdentity = require("../../modules/Order/utils/orderCollectionIdentity");
31
31
  var _dayjs = _interopRequireDefault(require("dayjs"));
32
+ var _clientDataVariants = require("../../modules/ProductList/clientDataVariants");
32
33
  var _Quotation = require("../../modules/Quotation");
33
34
  var _transformBaseProductToOrderProduct = require("./utils/transformBaseProductToOrderProduct");
34
35
  var _quotationPrice = require("./utils/quotationPrice");
@@ -726,13 +727,15 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
726
727
  if (!ids.length || !this.request) return productsById;
727
728
  const channel = this.getPriceQueryChannel(params.channel);
728
729
  const strategyContext = this.getPriceQueryStrategyContext(channel);
730
+ const handledByOsServer = (0, _clientDataVariants.isProductQueryHandledByOsServer)(this.core, this.request);
729
731
  try {
730
- const response = await this.request.post('/product/query', {
732
+ const queryPayload = {
731
733
  ids,
732
734
  open_quotation: 1,
733
735
  open_bundle: 1,
736
+ with: [..._clientDataVariants.PRODUCT_QUERY_DATA_VARIANT_RELATIONS],
734
737
  status: 'published',
735
- num: 1,
738
+ num: Math.max(ids.length, 1),
736
739
  skip: 1,
737
740
  customer_id: params.customerId,
738
741
  schedule_date: params.schedule.schedule_date,
@@ -741,13 +744,22 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
741
744
  ...(Object.keys(strategyContext).length ? {
742
745
  strategy_context: strategyContext
743
746
  } : {})
744
- }, {
747
+ };
748
+ const response = await this.request.post('/product/query', queryPayload, {
745
749
  osServer: true,
746
750
  customToast: () => {}
747
751
  });
748
752
  const list = response?.data?.list || response?.list || [];
749
753
  if (!Array.isArray(list)) return productsById;
750
- list.forEach(item => {
754
+ const resolvedList = (0, _clientDataVariants.resolveClientDataVariants)({
755
+ core: this.core,
756
+ otherParams: this.otherParams,
757
+ products: list,
758
+ queryPayload,
759
+ handledByOsServer,
760
+ scheduleList: this.store.schedule?.getScheduleList?.()
761
+ });
762
+ resolvedList.forEach(item => {
751
763
  const productId = Number(item?.id ?? item?.product_id);
752
764
  if (Number.isFinite(productId)) productsById.set(productId, item);
753
765
  });
@@ -67,7 +67,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
67
67
  product_ids?: number[];
68
68
  collection?: number | string[];
69
69
  schedule_date?: string;
70
- }): Promise<any>;
70
+ }): Promise<ProductData[]>;
71
71
  /**
72
72
  * 通过 schedule 来读取商品,适用于 session 类商品
73
73
  *
@@ -87,7 +87,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
87
87
  date: string;
88
88
  product_ids?: number[];
89
89
  category_ids?: number[];
90
- }): Promise<any>;
90
+ }): Promise<ProductData[]>;
91
91
  /**
92
92
  * 更新完商品数据、切换日期、或者在较后的流程里登录了,检测当前购物车里是否有商品,如果有,则需要更新购物车里的商品价格
93
93
  *
@@ -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 | 5 | 3 | 4 | 6;
329
+ weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
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
  * 找到多个资源的公共可用时间段
@@ -128,7 +128,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
128
128
  loadProducts(params?: ILoadProductsParams, options?: {
129
129
  callback?: (result: any) => void;
130
130
  subscriberId?: string;
131
- }): Promise<any>;
131
+ }): Promise<ProductData[]>;
132
132
  /**
133
133
  * 获取加时商品列表。
134
134
  *
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.3.79",
4
+ "version": "2.3.81",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",