@pisell/pisellos 2.3.80 → 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
+ }
@@ -18,19 +18,6 @@ export declare class ProductList extends BaseModule implements Module {
18
18
  * productList.updateOtherParams({ channel: 'pos' });
19
19
  */
20
20
  updateOtherParams(params: Record<string, any>): void;
21
- /**
22
- * 判断当前商品查询是否会被本地 OS Server 接管。
23
- *
24
- * 不能只看请求参数中的 osServer=true:H5 RequestPlugin 会透传该参数,但仍然直接请求远端接口。
25
- * 这里按 RequestPlugin 实际使用的 baseUrl 检查已注册路由,避免 OS Server 与客户端重复执行
26
- * Data Variant 评估。
27
- */
28
- private isProductQueryHandledByOsServer;
29
- /**
30
- * 未启用商品 OS 路由时,在客户端补做 Data Variant 解析。
31
- * OS Server 已接管时直接信任服务端结果,确保同一批商品只评估一次。
32
- */
33
- private resolveClientDataVariants;
34
21
  storeChange(path?: string, value?: any): Promise<void>;
35
22
  /**
36
23
  * 获取加时商品列表。
@@ -1,6 +1,12 @@
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; }
1
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; }
2
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; }
3
- 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); }
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; }
5
11
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
6
12
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
@@ -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);
@@ -78,64 +85,6 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
78
85
  value: function updateOtherParams(params) {
79
86
  this.otherParams = params || {};
80
87
  }
81
-
82
- /**
83
- * 判断当前商品查询是否会被本地 OS Server 接管。
84
- *
85
- * 不能只看请求参数中的 osServer=true:H5 RequestPlugin 会透传该参数,但仍然直接请求远端接口。
86
- * 这里按 RequestPlugin 实际使用的 baseUrl 检查已注册路由,避免 OS Server 与客户端重复执行
87
- * Data Variant 评估。
88
- */
89
- }, {
90
- key: "isProductQueryHandledByOsServer",
91
- value: function isProductQueryHandledByOsServer() {
92
- var _this$core, _this$request;
93
- var server = (_this$core = this.core) === null || _this$core === void 0 ? void 0 : _this$core.server;
94
- if (!server || typeof server.hasRoute !== 'function') return false;
95
- var requestBaseUrl = String(((_this$request = this.request) === null || _this$request === void 0 ? void 0 : _this$request.baseUrl) || '/shop').replace(/\/+$/, '');
96
- var routePath = "".concat(requestBaseUrl, "/product/query");
97
- return server.hasRoute('post', routePath) === true;
98
- }
99
-
100
- /**
101
- * 未启用商品 OS 路由时,在客户端补做 Data Variant 解析。
102
- * OS Server 已接管时直接信任服务端结果,确保同一批商品只评估一次。
103
- */
104
- }, {
105
- key: "resolveClientDataVariants",
106
- value: function resolveClientDataVariants(products, queryPayload, handledByOsServer) {
107
- var _this$core2, _this$otherParams, _scheduleModule$getSc, _this$core3, _this$core4, _this$otherParams2, _strategyContext$busi;
108
- if (handledByOsServer || products.length === 0) return products;
109
- var evaluator = (_this$core2 = this.core) === null || _this$core2 === void 0 || (_this$core2 = _this$core2.context) === null || _this$core2 === void 0 ? void 0 : _this$core2.dataVariantEvaluator;
110
- if (!evaluator || typeof evaluator.resolveProducts !== 'function') {
111
- return products;
112
- }
113
- var strategyContext = queryPayload.strategy_context && _typeof(queryPayload.strategy_context) === 'object' ? queryPayload.strategy_context : {};
114
- var fatherModule = String(((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.fatherModule) || '').trim();
115
- var scheduleModule = (fatherModule ? this.core.getModule("".concat(fatherModule, "_schedule")) : null) || this.core.getModule('schedule');
116
- var scheduleList = scheduleModule === null || scheduleModule === void 0 || (_scheduleModule$getSc = scheduleModule.getScheduleList) === null || _scheduleModule$getSc === void 0 ? void 0 : _scheduleModule$getSc.call(scheduleModule);
117
- var contextScheduleList = (_this$core3 = this.core) === null || _this$core3 === void 0 || (_this$core3 = _this$core3.context) === null || _this$core3 === void 0 ? void 0 : _this$core3.scheduleList;
118
- var contextMenuList = (_this$core4 = this.core) === null || _this$core4 === void 0 || (_this$core4 = _this$core4.context) === null || _this$core4 === void 0 ? void 0 : _this$core4.menuList;
119
- var businessData = {
120
- products: products,
121
- scheduleDateTime: queryPayload.schedule_datetime || queryPayload.schedule_date,
122
- scheduleList: Array.isArray(scheduleList) ? scheduleList : Array.isArray(contextScheduleList) ? contextScheduleList : [],
123
- menuList: Array.isArray((_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.menuList) ? this.otherParams.menuList : Array.isArray(contextMenuList) ? contextMenuList : [],
124
- customerId: queryPayload.customer_id,
125
- channel: strategyContext.channel,
126
- orderType: strategyContext.orderType || strategyContext.order_type,
127
- businessCode: (_strategyContext$busi = strategyContext.business_code) !== null && _strategyContext$busi !== void 0 ? _strategyContext$busi : strategyContext.businessCode,
128
- availableWalletIds: strategyContext.available_wallet_ids,
129
- custom: strategyContext
130
- };
131
- try {
132
- var _result = evaluator.resolveProducts(businessData);
133
- return Array.isArray(_result === null || _result === void 0 ? void 0 : _result.products) ? _result.products : products;
134
- } catch (error) {
135
- console.error('[ProductList] Data Variant 客户端解析失败', error);
136
- return products;
137
- }
138
- }
139
88
  }, {
140
89
  key: "storeChange",
141
90
  value: function () {
@@ -190,7 +139,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
190
139
  key: "loadProducts",
191
140
  value: function () {
192
141
  var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
193
- var _this$otherParams3,
142
+ var _this$otherParams,
194
143
  _this2 = this;
195
144
  var _ref,
196
145
  _ref$category_ids,
@@ -259,13 +208,13 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
259
208
  scan_to_order_2: 'mobile_order',
260
209
  scan_to_order_3: 'scantoorder3'
261
210
  };
262
- rawApplicationCode = (_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.channel;
211
+ rawApplicationCode = (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.channel;
263
212
  mappedApplicationCode = typeof rawApplicationCode === 'string' ? channelMap[rawApplicationCode] || rawApplicationCode : rawApplicationCode;
264
213
  queryPayload = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
265
214
  open_quotation: 1,
266
215
  open_bundle: 0,
267
216
  exclude_extension_type: ['product_party', 'product_event', 'product_series_event', 'product_package_ticket', 'ticket', 'event_item'],
268
- with: ['category', 'collection', 'resourceRelation', 'bundleGroup.bundleItem', 'optionGroup.optionItem', 'variantGroup.variantItem', 'dataVariants'],
217
+ with: _toConsumableArray(PRODUCT_QUERY_DATA_VARIANT_RELATIONS),
269
218
  status: status,
270
219
  num: 500,
271
220
  skip: 1,
@@ -291,7 +240,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
291
240
  extension_type: extension_type,
292
241
  strategy_context: strategy_context
293
242
  });
294
- handledByOsServer = this.isProductQueryHandledByOsServer();
243
+ handledByOsServer = isProductQueryHandledByOsServer(this.core, this.request);
295
244
  originalCallback = options === null || options === void 0 ? void 0 : options.callback;
296
245
  subscriptionCallback = typeof originalCallback === 'function' ? ( /*#__PURE__*/function () {
297
246
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(result) {
@@ -308,7 +257,13 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
308
257
  originalCallback(result);
309
258
  return _context4.abrupt("return");
310
259
  case 4:
311
- products = _this2.resolveClientDataVariants(callbackList, queryPayload, handledByOsServer);
260
+ products = resolveClientDataVariants({
261
+ core: _this2.core,
262
+ otherParams: _this2.otherParams,
263
+ products: callbackList,
264
+ queryPayload: queryPayload,
265
+ handledByOsServer: handledByOsServer
266
+ });
312
267
  _context4.next = 7;
313
268
  return _this2.addProduct(products);
314
269
  case 7:
@@ -336,7 +291,13 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
336
291
  });
337
292
  case 14:
338
293
  productsData = _context5.sent;
339
- resolvedList = this.resolveClientDataVariants(productsData.data.list || [], queryPayload, handledByOsServer);
294
+ resolvedList = resolveClientDataVariants({
295
+ core: this.core,
296
+ otherParams: this.otherParams,
297
+ products: productsData.data.list || [],
298
+ queryPayload: queryPayload,
299
+ handledByOsServer: handledByOsServer
300
+ });
340
301
  sortedList = resolvedList.slice().sort(function (a, b) {
341
302
  return Number(b.sort) - Number(a.sort);
342
303
  }); // if (sortedList.length) {
@@ -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);
@@ -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 | 5 | 2 | 3 | 4 | 6;
329
+ weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
@@ -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
+ }
@@ -18,19 +18,6 @@ export declare class ProductList extends BaseModule implements Module {
18
18
  * productList.updateOtherParams({ channel: 'pos' });
19
19
  */
20
20
  updateOtherParams(params: Record<string, any>): void;
21
- /**
22
- * 判断当前商品查询是否会被本地 OS Server 接管。
23
- *
24
- * 不能只看请求参数中的 osServer=true:H5 RequestPlugin 会透传该参数,但仍然直接请求远端接口。
25
- * 这里按 RequestPlugin 实际使用的 baseUrl 检查已注册路由,避免 OS Server 与客户端重复执行
26
- * Data Variant 评估。
27
- */
28
- private isProductQueryHandledByOsServer;
29
- /**
30
- * 未启用商品 OS 路由时,在客户端补做 Data Variant 解析。
31
- * OS Server 已接管时直接信任服务端结果,确保同一批商品只评估一次。
32
- */
33
- private resolveClientDataVariants;
34
21
  storeChange(path?: string, value?: any): Promise<void>;
35
22
  /**
36
23
  * 获取加时商品列表。
@@ -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;
@@ -55,58 +56,6 @@ class ProductList extends _BaseModule.BaseModule {
55
56
  updateOtherParams(params) {
56
57
  this.otherParams = params || {};
57
58
  }
58
-
59
- /**
60
- * 判断当前商品查询是否会被本地 OS Server 接管。
61
- *
62
- * 不能只看请求参数中的 osServer=true:H5 RequestPlugin 会透传该参数,但仍然直接请求远端接口。
63
- * 这里按 RequestPlugin 实际使用的 baseUrl 检查已注册路由,避免 OS Server 与客户端重复执行
64
- * Data Variant 评估。
65
- */
66
- isProductQueryHandledByOsServer() {
67
- const server = this.core?.server;
68
- if (!server || typeof server.hasRoute !== 'function') return false;
69
- const requestBaseUrl = String(this.request?.baseUrl || '/shop').replace(/\/+$/, '');
70
- const routePath = `${requestBaseUrl}/product/query`;
71
- return server.hasRoute('post', routePath) === true;
72
- }
73
-
74
- /**
75
- * 未启用商品 OS 路由时,在客户端补做 Data Variant 解析。
76
- * OS Server 已接管时直接信任服务端结果,确保同一批商品只评估一次。
77
- */
78
- resolveClientDataVariants(products, queryPayload, handledByOsServer) {
79
- if (handledByOsServer || products.length === 0) return products;
80
- const evaluator = this.core?.context?.dataVariantEvaluator;
81
- if (!evaluator || typeof evaluator.resolveProducts !== 'function') {
82
- return products;
83
- }
84
- const strategyContext = queryPayload.strategy_context && typeof queryPayload.strategy_context === 'object' ? queryPayload.strategy_context : {};
85
- const fatherModule = String(this.otherParams?.fatherModule || '').trim();
86
- const scheduleModule = (fatherModule ? this.core.getModule(`${fatherModule}_schedule`) : null) || this.core.getModule('schedule');
87
- const scheduleList = scheduleModule?.getScheduleList?.();
88
- const contextScheduleList = this.core?.context?.scheduleList;
89
- const contextMenuList = this.core?.context?.menuList;
90
- const businessData = {
91
- products,
92
- scheduleDateTime: queryPayload.schedule_datetime || queryPayload.schedule_date,
93
- scheduleList: Array.isArray(scheduleList) ? scheduleList : Array.isArray(contextScheduleList) ? contextScheduleList : [],
94
- menuList: Array.isArray(this.otherParams?.menuList) ? this.otherParams.menuList : Array.isArray(contextMenuList) ? contextMenuList : [],
95
- customerId: queryPayload.customer_id,
96
- channel: strategyContext.channel,
97
- orderType: strategyContext.orderType || strategyContext.order_type,
98
- businessCode: strategyContext.business_code ?? strategyContext.businessCode,
99
- availableWalletIds: strategyContext.available_wallet_ids,
100
- custom: strategyContext
101
- };
102
- try {
103
- const result = evaluator.resolveProducts(businessData);
104
- return Array.isArray(result?.products) ? result.products : products;
105
- } catch (error) {
106
- console.error('[ProductList] Data Variant 客户端解析失败', error);
107
- return products;
108
- }
109
- }
110
59
  async storeChange(path, value) {
111
60
  // No longer needed - products are stored as plain objects instead of Product instances
112
61
  }
@@ -173,7 +122,7 @@ class ProductList extends _BaseModule.BaseModule {
173
122
  open_quotation: 1,
174
123
  open_bundle: 0,
175
124
  exclude_extension_type: ['product_party', 'product_event', 'product_series_event', 'product_package_ticket', 'ticket', 'event_item'],
176
- with: ['category', 'collection', 'resourceRelation', 'bundleGroup.bundleItem', 'optionGroup.optionItem', 'variantGroup.variantItem', 'dataVariants'],
125
+ with: [..._clientDataVariants.PRODUCT_QUERY_DATA_VARIANT_RELATIONS],
177
126
  status,
178
127
  num: 500,
179
128
  skip: 1,
@@ -201,7 +150,7 @@ class ProductList extends _BaseModule.BaseModule {
201
150
  extension_type,
202
151
  strategy_context
203
152
  };
204
- const handledByOsServer = this.isProductQueryHandledByOsServer();
153
+ const handledByOsServer = (0, _clientDataVariants.isProductQueryHandledByOsServer)(this.core, this.request);
205
154
  const originalCallback = options?.callback;
206
155
  const subscriptionCallback = typeof originalCallback === 'function' ? async result => {
207
156
  const callbackList = result?.data?.list;
@@ -209,7 +158,13 @@ class ProductList extends _BaseModule.BaseModule {
209
158
  originalCallback(result);
210
159
  return;
211
160
  }
212
- const products = this.resolveClientDataVariants(callbackList, queryPayload, handledByOsServer);
161
+ const products = (0, _clientDataVariants.resolveClientDataVariants)({
162
+ core: this.core,
163
+ otherParams: this.otherParams,
164
+ products: callbackList,
165
+ queryPayload,
166
+ handledByOsServer
167
+ });
213
168
  await this.addProduct(products);
214
169
  originalCallback(handledByOsServer ? result : {
215
170
  ...result,
@@ -225,7 +180,13 @@ class ProductList extends _BaseModule.BaseModule {
225
180
  subscriberId: options?.subscriberId,
226
181
  customToast: () => {}
227
182
  });
228
- const resolvedList = this.resolveClientDataVariants(productsData.data.list || [], queryPayload, handledByOsServer);
183
+ const resolvedList = (0, _clientDataVariants.resolveClientDataVariants)({
184
+ core: this.core,
185
+ otherParams: this.otherParams,
186
+ products: productsData.data.list || [],
187
+ queryPayload,
188
+ handledByOsServer
189
+ });
229
190
  const sortedList = resolvedList.slice().sort((a, b) => Number(b.sort) - Number(a.sort));
230
191
  // if (sortedList.length) {
231
192
  // sortedList.forEach((n: any) => {
@@ -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
  });
@@ -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 | 5 | 2 | 3 | 4 | 6;
329
+ weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.3.80",
4
+ "version": "2.3.81",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",