@pisell/pisellos 2.3.62 → 2.3.64

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.
Files changed (56) hide show
  1. package/dist/core/index.d.ts +0 -7
  2. package/dist/core/index.js +65 -109
  3. package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -1
  4. package/dist/model/strategy/adapter/walletPass/utils.js +0 -2
  5. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +7 -3
  6. package/dist/modules/Customer/index.d.ts +4 -0
  7. package/dist/modules/Customer/index.js +91 -59
  8. package/dist/modules/Customer/types.d.ts +2 -0
  9. package/dist/modules/Order/index.js +4 -1
  10. package/dist/modules/Order/utils.js +36 -30
  11. package/dist/modules/Payment/walletpass.js +4 -5
  12. package/dist/modules/Quotation/index.d.ts +0 -6
  13. package/dist/modules/Quotation/index.js +19 -75
  14. package/dist/plugins/request.d.ts +0 -1
  15. package/dist/server/index.d.ts +2 -6
  16. package/dist/server/index.js +92 -133
  17. package/dist/server/modules/floor-plan/index.d.ts +0 -4
  18. package/dist/server/modules/floor-plan/index.js +98 -240
  19. package/dist/server/modules/menu/index.js +23 -48
  20. package/dist/server/modules/order/index.d.ts +8 -12
  21. package/dist/server/modules/order/index.js +348 -342
  22. package/dist/server/modules/products/index.d.ts +2 -8
  23. package/dist/server/modules/products/index.js +75 -167
  24. package/dist/server/modules/resource/index.js +13 -21
  25. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +6 -3
  26. package/dist/solution/BookingTicket/index.d.ts +2 -0
  27. package/dist/solution/BookingTicket/index.js +34 -10
  28. package/lib/core/index.d.ts +0 -7
  29. package/lib/core/index.js +2 -20
  30. package/lib/model/strategy/adapter/promotion/index.js +0 -51
  31. package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -1
  32. package/lib/model/strategy/adapter/walletPass/utils.js +0 -1
  33. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -0
  34. package/lib/modules/Customer/index.d.ts +4 -0
  35. package/lib/modules/Customer/index.js +11 -0
  36. package/lib/modules/Customer/types.d.ts +2 -0
  37. package/lib/modules/Order/index.js +3 -2
  38. package/lib/modules/Order/utils.js +3 -0
  39. package/lib/modules/Payment/walletpass.js +0 -1
  40. package/lib/modules/Quotation/index.d.ts +0 -6
  41. package/lib/modules/Quotation/index.js +5 -49
  42. package/lib/plugins/request.d.ts +0 -1
  43. package/lib/server/index.d.ts +2 -6
  44. package/lib/server/index.js +12 -34
  45. package/lib/server/modules/floor-plan/index.d.ts +0 -4
  46. package/lib/server/modules/floor-plan/index.js +6 -54
  47. package/lib/server/modules/menu/index.js +5 -31
  48. package/lib/server/modules/order/index.d.ts +8 -12
  49. package/lib/server/modules/order/index.js +94 -145
  50. package/lib/server/modules/products/index.d.ts +2 -8
  51. package/lib/server/modules/products/index.js +24 -97
  52. package/lib/server/modules/resource/index.js +2 -7
  53. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +1 -0
  54. package/lib/solution/BookingTicket/index.d.ts +2 -0
  55. package/lib/solution/BookingTicket/index.js +18 -2
  56. package/package.json +1 -1
@@ -1,10 +1,6 @@
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
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
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
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
5
- 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
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
7
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
8
4
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
9
5
  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); }
10
6
  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; }
@@ -40,15 +36,12 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
40
36
  list: []
41
37
  });
42
38
  _defineProperty(_assertThisInitialized(_this), "scheduleResolver", void 0);
43
- _defineProperty(_assertThisInitialized(_this), "app", void 0);
44
- _defineProperty(_assertThisInitialized(_this), "quotationListUpdatedListener", void 0);
45
39
  return _this;
46
40
  }
47
41
  _createClass(QuotationModule, [{
48
42
  key: "initialize",
49
43
  value: function () {
50
44
  var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
51
- var _core$getPlugin, _core$getPlugin$getAp;
52
45
  return _regeneratorRuntime().wrap(function _callee$(_context) {
53
46
  while (1) switch (_context.prev = _context.next) {
54
47
  case 0:
@@ -60,11 +53,10 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
60
53
  }
61
54
  throw new Error('QuotationModule 需要 request 插件支持');
62
55
  case 4:
63
- this.app = (_core$getPlugin = core.getPlugin('app')) === null || _core$getPlugin === void 0 || (_core$getPlugin$getAp = _core$getPlugin.getApp) === null || _core$getPlugin$getAp === void 0 ? void 0 : _core$getPlugin$getAp.call(_core$getPlugin);
64
56
  this.store = {
65
57
  list: []
66
58
  };
67
- case 6:
59
+ case 5:
68
60
  case "end":
69
61
  return _context.stop();
70
62
  }
@@ -79,8 +71,8 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
79
71
  key: "loadQuotations",
80
72
  value: function () {
81
73
  var _loadQuotations = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
82
- var _this2 = this;
83
- var query, initialResultApplied, applyRemoteUpdate, res;
74
+ var _data;
75
+ var query, res, list;
84
76
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
85
77
  while (1) switch (_context2.prev = _context2.next) {
86
78
  case 0:
@@ -89,27 +81,19 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
89
81
  if ((params === null || params === void 0 ? void 0 : params.channel) === 'online_store') {
90
82
  query.channel = 'online-store';
91
83
  }
92
- initialResultApplied = false;
93
- applyRemoteUpdate = function applyRemoteUpdate(response) {
94
- _this2.applyQuotationResponse(response);
95
- if (initialResultApplied) {
96
- _this2.notifyQuotationListUpdated();
97
- }
98
- };
99
- _context2.next = 7;
84
+ _context2.next = 5;
100
85
  return this.request.get('/quotation/available', query, {
101
- cache: {
102
- type: 'indexDB',
103
- updateCache: true,
104
- cacheKeyData: this.getQuotationCacheKeyData(query)
105
- },
106
- cacheUpdateChange: applyRemoteUpdate
86
+ useCache: false,
87
+ osServer: true
107
88
  });
108
- case 7:
89
+ case 5:
109
90
  res = _context2.sent;
110
- this.applyQuotationResponse(res);
111
- initialResultApplied = true;
112
- case 10:
91
+ list = (res === null || res === void 0 || (_data = res.data) === null || _data === void 0 ? void 0 : _data.list) || (res === null || res === void 0 ? void 0 : res.list) || [];
92
+ list.sort(function (a, b) {
93
+ return b.sort - a.sort;
94
+ });
95
+ this.store.list = list;
96
+ case 9:
113
97
  case "end":
114
98
  return _context2.stop();
115
99
  }
@@ -125,15 +109,10 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
125
109
  value: function getQuotationList() {
126
110
  return this.store.list;
127
111
  }
128
- }, {
129
- key: "setQuotationListUpdatedListener",
130
- value: function setQuotationListUpdatedListener(listener) {
131
- this.quotationListUpdatedListener = listener;
132
- }
133
112
  }, {
134
113
  key: "getQuotationCustomerScopeInfo",
135
114
  value: function getQuotationCustomerScopeInfo() {
136
- var _this3 = this;
115
+ var _this2 = this;
137
116
  var customerById = new Map();
138
117
  var quotationScopes = this.store.list.filter(function (quotation) {
139
118
  return Array.isArray(quotation.customer) && quotation.customer.length > 0;
@@ -143,7 +122,7 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
143
122
  var localSeen = new Set();
144
123
  var quotationCustomers = quotation.customer || [];
145
124
  quotationCustomers.forEach(function (customer) {
146
- var customerId = _this3.normalizeCustomerId(customer === null || customer === void 0 ? void 0 : customer.id);
125
+ var customerId = _this2.normalizeCustomerId(customer === null || customer === void 0 ? void 0 : customer.id);
147
126
  if (!customerId || localSeen.has(customerId)) return;
148
127
  localSeen.add(customerId);
149
128
  customerIds.push(customerId);
@@ -268,41 +247,6 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
268
247
  value: function setScheduleResolver(resolver) {
269
248
  this.scheduleResolver = resolver;
270
249
  }
271
- }, {
272
- key: "applyQuotationResponse",
273
- value: function applyQuotationResponse(response) {
274
- var _data;
275
- var source = (response === null || response === void 0 || (_data = response.data) === null || _data === void 0 ? void 0 : _data.list) || (response === null || response === void 0 ? void 0 : response.list) || [];
276
- this.store.list = _toConsumableArray(source).sort(function (a, b) {
277
- return Number(b.sort || 0) - Number(a.sort || 0);
278
- });
279
- }
280
- }, {
281
- key: "notifyQuotationListUpdated",
282
- value: function notifyQuotationListUpdated() {
283
- try {
284
- var _this$quotationListUp;
285
- (_this$quotationListUp = this.quotationListUpdatedListener) === null || _this$quotationListUp === void 0 || _this$quotationListUp.call(this);
286
- } catch (error) {
287
- console.warn('[QuotationModule] 报价单后台更新回调失败', error);
288
- }
289
- }
290
- }, {
291
- key: "getQuotationCacheKeyData",
292
- value: function getQuotationCacheKeyData(query) {
293
- var shopId = '';
294
- try {
295
- var _this$app, _this$app$getStorage;
296
- var storedCore = (_this$app = this.app) === null || _this$app === void 0 || (_this$app = _this$app.storage) === null || _this$app === void 0 || (_this$app$getStorage = _this$app.getStorage) === null || _this$app$getStorage === void 0 ? void 0 : _this$app$getStorage.call(_this$app, 'core');
297
- var coreInfo = typeof storedCore === 'string' ? JSON.parse(storedCore || '{}') : storedCore || {};
298
- shopId = String((coreInfo === null || coreInfo === void 0 ? void 0 : coreInfo.id) || '');
299
- } catch (_unused) {
300
- // 缓存隔离信息读取失败时仍按请求参数缓存。
301
- }
302
- return _objectSpread(_objectSpread({}, query), {}, {
303
- shop_id: shopId
304
- });
305
- }
306
250
  }, {
307
251
  key: "isQuotationVisibleForCustomer",
308
252
  value: function isQuotationVisibleForCustomer(quotation, customerId) {
@@ -329,17 +273,17 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
329
273
  key: "isQuotationActiveAt",
330
274
  value: function isQuotationActiveAt(quotation, datetime) {
331
275
  var _quotation$schedule,
332
- _this4 = this;
276
+ _this3 = this;
333
277
  if (!((_quotation$schedule = quotation.schedule) !== null && _quotation$schedule !== void 0 && _quotation$schedule.length)) return false;
334
278
  var scheduleItems = [];
335
279
  quotation.schedule.forEach(function (s) {
336
- var _this4$scheduleResolv;
337
- var full = (_this4$scheduleResolv = _this4.scheduleResolver) === null || _this4$scheduleResolv === void 0 ? void 0 : _this4$scheduleResolv.call(_this4, s.id);
280
+ var _this3$scheduleResolv;
281
+ var full = (_this3$scheduleResolv = _this3.scheduleResolver) === null || _this3$scheduleResolv === void 0 ? void 0 : _this3$scheduleResolv.call(_this3, s.id);
338
282
  if (full) {
339
283
  scheduleItems.push(full);
340
284
  return;
341
285
  }
342
- if (_this4.scheduleResolver) {
286
+ if (_this3.scheduleResolver) {
343
287
  return;
344
288
  }
345
289
  var fallbackSchedule = _objectSpread(_objectSpread({}, s), {}, {
@@ -68,7 +68,6 @@ export interface RequestOptions {
68
68
  useCache?: boolean;
69
69
  customToast?: () => void;
70
70
  cache?: CacheProps;
71
- cacheUpdateChange?: (data: any) => void;
72
71
  osServer?: boolean;
73
72
  prefix?: boolean;
74
73
  callback?: (res: any) => void;
@@ -157,17 +157,13 @@ declare class Server {
157
157
  * 重新拉取全量 SSE 接口,更新本地数据后触发 onProductsSyncCompleted
158
158
  * 不影响当前界面展示,适用于切回前台、定时刷新等场景
159
159
  */
160
- refreshProductsInBackground(options?: {
161
- trigger?: string;
162
- }): Promise<void>;
160
+ refreshProductsInBackground(): Promise<void>;
163
161
  /**
164
162
  * 后台静默刷新订单数据
165
163
  * 重新拉取全量 SSE 接口,更新本地数据后触发 onOrdersSyncCompleted
166
164
  * 不影响当前界面展示,适用于切回前台、定时刷新等场景
167
165
  */
168
- refreshOrdersInBackground(options?: {
169
- trigger?: string;
170
- }): Promise<void>;
166
+ refreshOrdersInBackground(): Promise<void>;
171
167
  /**
172
168
  * 编辑正式订单时强制查询 Server 最新快照并覆盖本地缓存。
173
169
  * 商品成员增删由 OrderModule 在 SQLite/Store 更新完成后广播,