@pisell/pisellos 2.3.30 → 2.3.32
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.
- package/dist/model/strategy/adapter/dataVariant/adapter.d.ts +50 -0
- package/dist/model/strategy/adapter/dataVariant/adapter.js +167 -0
- package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +89 -0
- package/dist/model/strategy/adapter/dataVariant/evaluator.js +780 -0
- package/dist/model/strategy/adapter/dataVariant/examples.d.ts +39 -0
- package/dist/model/strategy/adapter/dataVariant/examples.js +277 -0
- package/dist/model/strategy/adapter/dataVariant/index.d.ts +4 -0
- package/dist/model/strategy/adapter/dataVariant/index.js +4 -0
- package/dist/model/strategy/adapter/dataVariant/type.d.ts +148 -0
- package/dist/model/strategy/adapter/dataVariant/type.js +54 -0
- package/dist/model/strategy/adapter/index.d.ts +4 -0
- package/dist/model/strategy/adapter/index.js +5 -1
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/modules/Discount/index.d.ts +5 -2
- package/dist/modules/Discount/index.js +30 -7
- package/dist/modules/Discount/types.d.ts +4 -0
- package/dist/modules/Order/index.d.ts +2 -1
- package/dist/modules/Order/index.js +25 -11
- package/dist/modules/Order/types.d.ts +2 -0
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/Product/types.d.ts +22 -0
- package/dist/modules/ProductList/index.d.ts +1 -1
- package/dist/modules/ProductList/index.js +4 -2
- package/dist/modules/ProductList/types.d.ts +2 -0
- package/dist/server/index.d.ts +50 -0
- package/dist/server/index.js +1095 -849
- package/dist/server/modules/order/index.d.ts +8 -3
- package/dist/server/modules/order/index.js +765 -675
- package/dist/server/modules/products/index.d.ts +26 -7
- package/dist/server/modules/products/index.js +167 -76
- package/dist/server/modules/products/types.d.ts +14 -0
- package/dist/solution/BaseSales/index.d.ts +2 -0
- package/dist/solution/BaseSales/index.js +23 -13
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/types.d.ts +2 -0
- package/dist/solution/ShopDiscount/index.js +15 -14
- package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +50 -0
- package/lib/model/strategy/adapter/dataVariant/adapter.js +149 -0
- package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +89 -0
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +583 -0
- package/lib/model/strategy/adapter/dataVariant/examples.d.ts +39 -0
- package/lib/model/strategy/adapter/dataVariant/examples.js +293 -0
- package/lib/model/strategy/adapter/dataVariant/index.d.ts +4 -0
- package/lib/model/strategy/adapter/dataVariant/index.js +38 -0
- package/lib/model/strategy/adapter/dataVariant/type.d.ts +148 -0
- package/lib/model/strategy/adapter/dataVariant/type.js +31 -0
- package/lib/model/strategy/adapter/index.d.ts +4 -0
- package/lib/model/strategy/adapter/index.js +13 -2
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/modules/Discount/index.d.ts +5 -2
- package/lib/modules/Discount/index.js +23 -3
- package/lib/modules/Discount/types.d.ts +4 -0
- package/lib/modules/Order/index.d.ts +2 -1
- package/lib/modules/Order/index.js +13 -1
- package/lib/modules/Order/types.d.ts +2 -0
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Product/types.d.ts +22 -0
- package/lib/modules/ProductList/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +4 -2
- package/lib/modules/ProductList/types.d.ts +2 -0
- package/lib/server/index.d.ts +50 -0
- package/lib/server/index.js +206 -29
- package/lib/server/modules/order/index.d.ts +8 -3
- package/lib/server/modules/order/index.js +152 -43
- package/lib/server/modules/products/index.d.ts +26 -7
- package/lib/server/modules/products/index.js +114 -35
- package/lib/server/modules/products/types.d.ts +14 -0
- package/lib/solution/BaseSales/index.d.ts +2 -0
- package/lib/solution/BaseSales/index.js +12 -3
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/types.d.ts +2 -0
- package/lib/solution/ShopDiscount/index.js +2 -1
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
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 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
|
-
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
2
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
5
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."); }
|
|
6
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); }
|
|
7
5
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
6
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
9
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; }
|
|
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; }
|
|
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; }
|
|
10
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; }
|
|
11
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); } }
|
|
12
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); }); }; }
|
|
@@ -151,12 +151,22 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
151
151
|
value: function getOriginalDiscountList() {
|
|
152
152
|
return this.store.originalDiscountList || [];
|
|
153
153
|
}
|
|
154
|
+
}, {
|
|
155
|
+
key: "normalizePositiveNumberIds",
|
|
156
|
+
value: function normalizePositiveNumberIds(values) {
|
|
157
|
+
var ids = values.map(function (value) {
|
|
158
|
+
return Number(value);
|
|
159
|
+
}).filter(function (value) {
|
|
160
|
+
return Number.isFinite(value) && value > 0;
|
|
161
|
+
});
|
|
162
|
+
return Array.from(new Set(ids));
|
|
163
|
+
}
|
|
154
164
|
}, {
|
|
155
165
|
key: "loadPrepareConfig",
|
|
156
166
|
value: function () {
|
|
157
167
|
var _loadPrepareConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
|
|
158
|
-
var _prepareConfig$data, _prepareConfig$data2;
|
|
159
|
-
var prepareConfig, rawDiscountList, goodPassList;
|
|
168
|
+
var _params$with_availabl, _params$with_availabl2, _prepareConfig$data, _prepareConfig$data2, _prepareConfig$data3, _prepareConfig$data4, _prepareConfig$data5;
|
|
169
|
+
var prepareConfig, rawDiscountList, availableWalletList, availableWalletPassList, availableWalletIds, goodPassList;
|
|
160
170
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
161
171
|
while (1) switch (_context4.prev = _context4.next) {
|
|
162
172
|
case 0:
|
|
@@ -164,13 +174,26 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
164
174
|
params.order_id = undefined;
|
|
165
175
|
}
|
|
166
176
|
_context4.next = 3;
|
|
167
|
-
return this.request.post("/order/prepare/config", params)
|
|
177
|
+
return this.request.post("/order/prepare/config", _objectSpread(_objectSpread({}, params), {}, {
|
|
178
|
+
with_available_wallet_flag: (_params$with_availabl = params.with_available_wallet_flag) !== null && _params$with_availabl !== void 0 ? _params$with_availabl : 1,
|
|
179
|
+
with_available_wallet_pass_flag: (_params$with_availabl2 = params.with_available_wallet_pass_flag) !== null && _params$with_availabl2 !== void 0 ? _params$with_availabl2 : 1
|
|
180
|
+
}));
|
|
168
181
|
case 3:
|
|
169
182
|
prepareConfig = _context4.sent;
|
|
170
183
|
rawDiscountList = [].concat(_toConsumableArray((prepareConfig === null || prepareConfig === void 0 || (_prepareConfig$data = prepareConfig.data) === null || _prepareConfig$data === void 0 ? void 0 : _prepareConfig$data.good_pass_list) || []), _toConsumableArray((prepareConfig === null || prepareConfig === void 0 || (_prepareConfig$data2 = prepareConfig.data) === null || _prepareConfig$data2 === void 0 ? void 0 : _prepareConfig$data2.discount_card_list) || []));
|
|
184
|
+
availableWalletList = [].concat(_toConsumableArray((prepareConfig === null || prepareConfig === void 0 || (_prepareConfig$data3 = prepareConfig.data) === null || _prepareConfig$data3 === void 0 ? void 0 : _prepareConfig$data3.avaiable_wallet_list) || []), _toConsumableArray((prepareConfig === null || prepareConfig === void 0 || (_prepareConfig$data4 = prepareConfig.data) === null || _prepareConfig$data4 === void 0 ? void 0 : _prepareConfig$data4.available_wallet_list) || []));
|
|
185
|
+
availableWalletPassList = (prepareConfig === null || prepareConfig === void 0 || (_prepareConfig$data5 = prepareConfig.data) === null || _prepareConfig$data5 === void 0 ? void 0 : _prepareConfig$data5.available_wallet_pass_list) || [];
|
|
186
|
+
availableWalletIds = this.normalizePositiveNumberIds([].concat(_toConsumableArray(availableWalletList.map(function (item) {
|
|
187
|
+
return item === null || item === void 0 ? void 0 : item.wallet_id;
|
|
188
|
+
})), _toConsumableArray(availableWalletPassList.map(function (item) {
|
|
189
|
+
return item === null || item === void 0 ? void 0 : item.product_id;
|
|
190
|
+
}))));
|
|
171
191
|
goodPassList = this.filterEnabledDiscountList(rawDiscountList) || []; // this.setDiscountList(goodPassList);
|
|
172
|
-
return _context4.abrupt("return",
|
|
173
|
-
|
|
192
|
+
return _context4.abrupt("return", {
|
|
193
|
+
discountList: goodPassList,
|
|
194
|
+
availableWalletIds: availableWalletIds
|
|
195
|
+
});
|
|
196
|
+
case 10:
|
|
174
197
|
case "end":
|
|
175
198
|
return _context4.stop();
|
|
176
199
|
}
|
|
@@ -68,6 +68,10 @@ export interface DiscountWithReason {
|
|
|
68
68
|
discountList: Discount[];
|
|
69
69
|
unavailableReasonKey: DiscountFilterRejectKey | null;
|
|
70
70
|
}
|
|
71
|
+
export interface DiscountPrepareConfigResult {
|
|
72
|
+
discountList: Discount[];
|
|
73
|
+
availableWalletIds: number[];
|
|
74
|
+
}
|
|
71
75
|
interface ExtensionData {
|
|
72
76
|
id: number;
|
|
73
77
|
shop_id: number;
|
|
@@ -76,6 +76,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
76
76
|
apply?: boolean;
|
|
77
77
|
}): Promise<Discount[]>;
|
|
78
78
|
getDiscountList(): Discount[];
|
|
79
|
+
getAvailableWalletIds(): number[];
|
|
79
80
|
private syncScannedDiscountsToOriginalDiscountList;
|
|
80
81
|
private ensureEditDiscountConfigForProductChange;
|
|
81
82
|
scanCode(code: string, customerId?: number): Promise<{
|
|
@@ -484,7 +485,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
484
485
|
generateIdempotencyToken(): string;
|
|
485
486
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
486
487
|
createOrder(params: CommitOrderParams['query']): {
|
|
487
|
-
type: "
|
|
488
|
+
type: "appointment_booking" | "virtual";
|
|
488
489
|
platform: string;
|
|
489
490
|
sales_channel: string;
|
|
490
491
|
order_sales_channel: string;
|
|
@@ -299,14 +299,17 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
299
299
|
if (!this.store.summary) {
|
|
300
300
|
this.store.summary = createEmptySummary();
|
|
301
301
|
}
|
|
302
|
+
if (!Array.isArray(this.store.availableWalletIds)) {
|
|
303
|
+
this.store.availableWalletIds = [];
|
|
304
|
+
}
|
|
302
305
|
this.request = this.core.getPlugin('request');
|
|
303
306
|
this.appPlugin = this.core.getPlugin('app');
|
|
304
307
|
if (this.appPlugin) {
|
|
305
|
-
_context.next =
|
|
308
|
+
_context.next = 9;
|
|
306
309
|
break;
|
|
307
310
|
}
|
|
308
311
|
throw new Error('Order 模块需要 app 插件支持');
|
|
309
|
-
case
|
|
312
|
+
case 9:
|
|
310
313
|
app = this.appPlugin.getApp();
|
|
311
314
|
this.logger = app.logger;
|
|
312
315
|
this.window = this.core.getPlugin('window');
|
|
@@ -319,7 +322,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
319
322
|
this.otherParams = otherParams;
|
|
320
323
|
this.registerDiscountModules(options);
|
|
321
324
|
this.logInfo('OrderModule initialized successfully');
|
|
322
|
-
case
|
|
325
|
+
case 21:
|
|
323
326
|
case "end":
|
|
324
327
|
return _context.stop();
|
|
325
328
|
}
|
|
@@ -496,7 +499,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
496
499
|
value: function () {
|
|
497
500
|
var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
|
|
498
501
|
var _this$store$tempOrder, _this$store$discount, _this$store$tempOrder2;
|
|
499
|
-
var orderId, discountList, _this$store$discount2, _this$store$discount3, _this$store$discount4, currentDiscountList, currentEditDiscounts, currentScanDiscounts, currentScanDiscountIds, runtimeDiscountIds, runtimeDiscounts, mergedDiscountList;
|
|
502
|
+
var orderId, prepareConfigResult, discountList, _this$store$discount2, _this$store$discount3, _this$store$discount4, currentDiscountList, currentEditDiscounts, currentScanDiscounts, currentScanDiscountIds, runtimeDiscountIds, runtimeDiscounts, mergedDiscountList;
|
|
500
503
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
501
504
|
while (1) switch (_context3.prev = _context3.next) {
|
|
502
505
|
case 0:
|
|
@@ -508,14 +511,18 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
508
511
|
with_good_pass: 1,
|
|
509
512
|
with_discount_card: 1,
|
|
510
513
|
with_wallet_pass_holder: 1,
|
|
514
|
+
with_available_wallet_flag: 1,
|
|
515
|
+
with_available_wallet_pass_flag: 1,
|
|
511
516
|
request_timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
512
517
|
}, orderId ? {
|
|
513
518
|
order_id: orderId
|
|
514
519
|
} : {}));
|
|
515
520
|
case 3:
|
|
516
|
-
|
|
521
|
+
prepareConfigResult = _context3.sent;
|
|
522
|
+
discountList = prepareConfigResult === null || prepareConfigResult === void 0 ? void 0 : prepareConfigResult.discountList;
|
|
523
|
+
this.store.availableWalletIds = (prepareConfigResult === null || prepareConfigResult === void 0 ? void 0 : prepareConfigResult.availableWalletIds) || [];
|
|
517
524
|
if (!discountList) {
|
|
518
|
-
_context3.next =
|
|
525
|
+
_context3.next = 18;
|
|
519
526
|
break;
|
|
520
527
|
}
|
|
521
528
|
currentDiscountList = ((_this$store$discount2 = this.store.discount) === null || _this$store$discount2 === void 0 ? void 0 : _this$store$discount2.getDiscountList()) || [];
|
|
@@ -536,17 +543,17 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
536
543
|
return true;
|
|
537
544
|
});
|
|
538
545
|
mergedDiscountList = [].concat(_toConsumableArray(currentEditDiscounts), _toConsumableArray(currentScanDiscounts), _toConsumableArray(runtimeDiscounts));
|
|
539
|
-
_context3.next = 14;
|
|
540
|
-
return (_this$store$discount3 = this.store.discount) === null || _this$store$discount3 === void 0 ? void 0 : _this$store$discount3.setOriginalDiscountList(mergedDiscountList);
|
|
541
|
-
case 14:
|
|
542
546
|
_context3.next = 16;
|
|
543
|
-
return (_this$store$
|
|
547
|
+
return (_this$store$discount3 = this.store.discount) === null || _this$store$discount3 === void 0 ? void 0 : _this$store$discount3.setOriginalDiscountList(mergedDiscountList);
|
|
544
548
|
case 16:
|
|
549
|
+
_context3.next = 18;
|
|
550
|
+
return (_this$store$discount4 = this.store.discount) === null || _this$store$discount4 === void 0 ? void 0 : _this$store$discount4.setDiscountList(mergedDiscountList);
|
|
551
|
+
case 18:
|
|
545
552
|
if (params.apply !== false && (_this$store$tempOrder2 = this.store.tempOrder) !== null && _this$store$tempOrder2 !== void 0 && (_this$store$tempOrder2 = _this$store$tempOrder2.products) !== null && _this$store$tempOrder2 !== void 0 && _this$store$tempOrder2.length) {
|
|
546
553
|
this.applyDiscount();
|
|
547
554
|
}
|
|
548
555
|
return _context3.abrupt("return", this.getDiscountList());
|
|
549
|
-
case
|
|
556
|
+
case 20:
|
|
550
557
|
case "end":
|
|
551
558
|
return _context3.stop();
|
|
552
559
|
}
|
|
@@ -563,6 +570,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
563
570
|
var _this$store$discount5;
|
|
564
571
|
return ((_this$store$discount5 = this.store.discount) === null || _this$store$discount5 === void 0 ? void 0 : _this$store$discount5.getDiscountList()) || [];
|
|
565
572
|
}
|
|
573
|
+
}, {
|
|
574
|
+
key: "getAvailableWalletIds",
|
|
575
|
+
value: function getAvailableWalletIds() {
|
|
576
|
+
return Array.isArray(this.store.availableWalletIds) ? _toConsumableArray(this.store.availableWalletIds) : [];
|
|
577
|
+
}
|
|
566
578
|
}, {
|
|
567
579
|
key: "syncScannedDiscountsToOriginalDiscountList",
|
|
568
580
|
value: function () {
|
|
@@ -3223,6 +3235,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3223
3235
|
}
|
|
3224
3236
|
var nextCustomerId = (_tempOrder$customer_i5 = tempOrder.customer_id) !== null && _tempOrder$customer_i5 !== void 0 ? _tempOrder$customer_i5 : null;
|
|
3225
3237
|
if (String(previousCustomerId !== null && previousCustomerId !== void 0 ? previousCustomerId : '') !== String(nextCustomerId !== null && nextCustomerId !== void 0 ? nextCustomerId : '')) {
|
|
3238
|
+
this.store.availableWalletIds = [];
|
|
3226
3239
|
clearTempOrderHolderAssignments(tempOrder);
|
|
3227
3240
|
this.clearCustomerBoundDiscounts(tempOrder);
|
|
3228
3241
|
this.applyDiscount();
|
|
@@ -3267,6 +3280,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3267
3280
|
tempOrder.email = '';
|
|
3268
3281
|
tempOrder.customer = null;
|
|
3269
3282
|
if (tempOrder._extend) delete tempOrder._extend.customerSnapshot;
|
|
3283
|
+
this.store.availableWalletIds = [];
|
|
3270
3284
|
this.clearCustomerBoundDiscounts(tempOrder);
|
|
3271
3285
|
this.persistTempOrder();
|
|
3272
3286
|
this.saveDraftInBackground();
|
|
@@ -309,6 +309,7 @@ export interface OrderState {
|
|
|
309
309
|
lastOrderInfo?: Record<string, any>;
|
|
310
310
|
syncState?: OrderSyncState;
|
|
311
311
|
discountList: any[];
|
|
312
|
+
availableWalletIds?: number[];
|
|
312
313
|
discount: DiscountModule | null;
|
|
313
314
|
rules: RulesModule | null;
|
|
314
315
|
}
|
|
@@ -807,6 +808,7 @@ export interface OrderModuleAPI {
|
|
|
807
808
|
apply?: boolean;
|
|
808
809
|
}) => Promise<Discount[]>;
|
|
809
810
|
getDiscountList: () => Discount[];
|
|
811
|
+
getAvailableWalletIds: () => number[];
|
|
810
812
|
applyDiscount: () => void;
|
|
811
813
|
/**
|
|
812
814
|
* 注入促销评估器。
|
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "normal" | "duration" | "session";
|
|
53
53
|
}
|
|
@@ -9,6 +9,26 @@ export interface ProductCollection {
|
|
|
9
9
|
/** 商品集合封面 */
|
|
10
10
|
cover: string;
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* 商品 Data Variant 记录,结构与后端 data_variant 表对齐。
|
|
14
|
+
*/
|
|
15
|
+
export interface ProductDataVariant {
|
|
16
|
+
/** 变体记录 id */
|
|
17
|
+
id: number;
|
|
18
|
+
/** 店铺 id */
|
|
19
|
+
shop_id: number;
|
|
20
|
+
/** 所属模块,商品场景固定为 product */
|
|
21
|
+
module: string;
|
|
22
|
+
/** 模块数据 id,商品场景对应 product.id */
|
|
23
|
+
module_data_id: number;
|
|
24
|
+
/** 关联 data_variant_rule.id */
|
|
25
|
+
data_variant_rule_id: number;
|
|
26
|
+
/** 命中策略后覆盖到商品上的字段 */
|
|
27
|
+
data: Record<string, any>;
|
|
28
|
+
created_at: string | null;
|
|
29
|
+
updated_at: string | null;
|
|
30
|
+
deleted_at: string | null;
|
|
31
|
+
}
|
|
12
32
|
/**
|
|
13
33
|
* 商品基本信息接口
|
|
14
34
|
*/
|
|
@@ -214,6 +234,8 @@ export interface ProductData {
|
|
|
214
234
|
bundle_group_count: number;
|
|
215
235
|
/** 选项组数量 */
|
|
216
236
|
option_group_count: number;
|
|
237
|
+
/** 智能定价变体列表,/product/query with dataVariants 返回 */
|
|
238
|
+
data_variants?: ProductDataVariant[];
|
|
217
239
|
/** 服务时长 */
|
|
218
240
|
service_times?: any;
|
|
219
241
|
}
|
|
@@ -26,7 +26,7 @@ export declare class ProductList extends BaseModule implements Module {
|
|
|
26
26
|
* const products = await productList.getAddTimeProducts({ schedule_date: '2026-06-16' });
|
|
27
27
|
*/
|
|
28
28
|
getAddTimeProducts(params?: ProductListLoadProductsParams): Promise<any>;
|
|
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, }?: ProductListLoadProductsParams, options?: {
|
|
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
32
|
}): Promise<any>;
|
|
@@ -152,6 +152,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
152
152
|
extension_type,
|
|
153
153
|
_ref$status,
|
|
154
154
|
status,
|
|
155
|
+
strategy_context,
|
|
155
156
|
options,
|
|
156
157
|
userPlugin,
|
|
157
158
|
customer_id,
|
|
@@ -162,7 +163,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
162
163
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
163
164
|
while (1) switch (_context4.prev = _context4.next) {
|
|
164
165
|
case 0:
|
|
165
|
-
_ref = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {}, _ref$category_ids = _ref.category_ids, category_ids = _ref$category_ids === void 0 ? [] : _ref$category_ids, _ref$product_ids = _ref.product_ids, product_ids = _ref$product_ids === void 0 ? [] : _ref$product_ids, _ref$collection = _ref.collection, collection = _ref$collection === void 0 ? [] : _ref$collection, _ref$menu_list_ids = _ref.menu_list_ids, menu_list_ids = _ref$menu_list_ids === void 0 ? [] : _ref$menu_list_ids, paramsCustomerId = _ref.customer_id, _ref$with_count = _ref.with_count, with_count = _ref$with_count === void 0 ? [] : _ref$with_count, schedule_datetime = _ref.schedule_datetime, schedule_date = _ref.schedule_date, cacheId = _ref.cacheId, with_schedule = _ref.with_schedule, extension_type = _ref.extension_type, _ref$status = _ref.status, status = _ref$status === void 0 ? 'published' : _ref$status;
|
|
166
|
+
_ref = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {}, _ref$category_ids = _ref.category_ids, category_ids = _ref$category_ids === void 0 ? [] : _ref$category_ids, _ref$product_ids = _ref.product_ids, product_ids = _ref$product_ids === void 0 ? [] : _ref$product_ids, _ref$collection = _ref.collection, collection = _ref$collection === void 0 ? [] : _ref$collection, _ref$menu_list_ids = _ref.menu_list_ids, menu_list_ids = _ref$menu_list_ids === void 0 ? [] : _ref$menu_list_ids, paramsCustomerId = _ref.customer_id, _ref$with_count = _ref.with_count, with_count = _ref$with_count === void 0 ? [] : _ref$with_count, schedule_datetime = _ref.schedule_datetime, schedule_date = _ref.schedule_date, cacheId = _ref.cacheId, with_schedule = _ref.with_schedule, extension_type = _ref.extension_type, _ref$status = _ref.status, status = _ref$status === void 0 ? 'published' : _ref$status, strategy_context = _ref.strategy_context;
|
|
166
167
|
options = _args4.length > 1 ? _args4[1] : undefined;
|
|
167
168
|
// // 如果 schedule_ids 为空,则需要尝试从 schedule 模块里获取
|
|
168
169
|
// if (!schedule_ids?.length) {
|
|
@@ -206,7 +207,8 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
206
207
|
is_eject: 1,
|
|
207
208
|
with_schedule: with_schedule,
|
|
208
209
|
schedule_datetime: schedule_datetime,
|
|
209
|
-
extension_type: extension_type
|
|
210
|
+
extension_type: extension_type,
|
|
211
|
+
strategy_context: strategy_context
|
|
210
212
|
}, {
|
|
211
213
|
osServer: true,
|
|
212
214
|
callback: options === null || options === void 0 ? void 0 : options.callback,
|
|
@@ -12,6 +12,8 @@ export interface ProductListLoadProductsParams {
|
|
|
12
12
|
with_schedule?: number;
|
|
13
13
|
extension_type?: string[];
|
|
14
14
|
status?: string;
|
|
15
|
+
/** 智能定价条件上下文,仅影响策略命中,不参与商品集合筛选 */
|
|
16
|
+
strategy_context?: Record<string, any>;
|
|
15
17
|
}
|
|
16
18
|
export interface ProductListData {
|
|
17
19
|
list: ProductData[];
|
package/dist/server/index.d.ts
CHANGED
|
@@ -47,6 +47,8 @@ declare class Server {
|
|
|
47
47
|
private prefixRouterGet;
|
|
48
48
|
router: Router;
|
|
49
49
|
private productQuerySubscribers;
|
|
50
|
+
/** subscriberId → 智能定价变价时间点定时器句柄(与 subscriber 分离存储,便于 clear) */
|
|
51
|
+
private productQueryScheduleTimers;
|
|
50
52
|
private orderQuerySubscribers;
|
|
51
53
|
private bookingQuerySubscribers;
|
|
52
54
|
private bookingRemoteQuerySubscribers;
|
|
@@ -211,6 +213,48 @@ declare class Server {
|
|
|
211
213
|
* 根据 subscriberId 移除商品查询订阅者
|
|
212
214
|
*/
|
|
213
215
|
removeProductQuerySubscriber(subscriberId?: string): void;
|
|
216
|
+
/**
|
|
217
|
+
* 构建商品 query 响应 data 段,附带智能定价 schedule_time_points 元数据。
|
|
218
|
+
*/
|
|
219
|
+
private buildProductQueryResultPayload;
|
|
220
|
+
/**
|
|
221
|
+
* 是否启用商品 query 订阅的 schedule 时间点定时重算。
|
|
222
|
+
* strategy_context.enable_schedule_reload === false 时关闭。
|
|
223
|
+
*/
|
|
224
|
+
private shouldScheduleProductQueryReload;
|
|
225
|
+
/**
|
|
226
|
+
* 清除指定 subscriber 的全部 schedule 定时器,防止重复 query 或 unsubscribe 后泄漏。
|
|
227
|
+
*/
|
|
228
|
+
private clearSubscriberScheduleTimers;
|
|
229
|
+
/**
|
|
230
|
+
* 从 productQueryScheduleTimers 移除已触发的 timer 引用。
|
|
231
|
+
*/
|
|
232
|
+
private removeScheduleTimerRef;
|
|
233
|
+
/**
|
|
234
|
+
* 计算 schedule 变价时间点到当前时刻的延迟(ms)。已过期返回 -1。
|
|
235
|
+
*/
|
|
236
|
+
private computeScheduleTimePointDelayMs;
|
|
237
|
+
/**
|
|
238
|
+
* 定时重算前刷新 subscriber schedule 上下文:使用执行瞬间时间,禁止沿用首次 query 的 schedule_datetime。
|
|
239
|
+
*/
|
|
240
|
+
private refreshSubscriberScheduleAtExecution;
|
|
241
|
+
/**
|
|
242
|
+
* 为 subscriber 注册智能定价 scheduleTimePoints 定时重算。
|
|
243
|
+
* 必须先 clearSubscriberScheduleTimers,再调用本方法。
|
|
244
|
+
*/
|
|
245
|
+
private scheduleSubscriberTimePointReloads;
|
|
246
|
+
/**
|
|
247
|
+
* schedule 变价时间点定时器触发:刷新 schedule_datetime 后重算并 callback。
|
|
248
|
+
*/
|
|
249
|
+
private onScheduleTimePointTimerFire;
|
|
250
|
+
/**
|
|
251
|
+
* 对单个商品 query 订阅者重算并推送(定时路径;不新建 schedule timer)。
|
|
252
|
+
*/
|
|
253
|
+
private recomputeAndNotifySubscriber;
|
|
254
|
+
/**
|
|
255
|
+
* query 完成后为 subscriber 同步 schedule 定时器(先 clear 再 schedule)。
|
|
256
|
+
*/
|
|
257
|
+
private syncProductQueryScheduleTimers;
|
|
214
258
|
/**
|
|
215
259
|
* 处理商品查询请求
|
|
216
260
|
* 存储订阅者信息,便于数据变更时推送最新结果
|
|
@@ -584,6 +628,12 @@ declare class Server {
|
|
|
584
628
|
* @param options.changedIds 变更的商品 IDs,用于增量更新价格缓存
|
|
585
629
|
*/
|
|
586
630
|
private computeProductQueryResult;
|
|
631
|
+
/**
|
|
632
|
+
* 构建商品格式化上下文。
|
|
633
|
+
*
|
|
634
|
+
* 智能定价条件使用全量 menuList/scheduleList;Product Query 顶层参数只保留筛选商品集合所需字段。
|
|
635
|
+
*/
|
|
636
|
+
private buildProductFormatterContext;
|
|
587
637
|
/**
|
|
588
638
|
* 数据变更后,遍历所有订阅者重新计算查询结果并通过 callback 推送
|
|
589
639
|
* 由 ProductsModule 的 onProductsSyncCompleted 事件触发
|