@pisell/pisellos 0.0.213 → 0.0.215

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 (80) hide show
  1. package/dist/core/index.js +2 -1
  2. package/dist/effects/index.d.ts +4 -3
  3. package/dist/effects/index.js +15 -6
  4. package/dist/modules/AccountList/index.d.ts +7 -1
  5. package/dist/modules/AccountList/index.js +81 -14
  6. package/dist/modules/AccountList/types.d.ts +28 -0
  7. package/dist/modules/AccountList/types.js +8 -0
  8. package/dist/modules/Customer/constants.d.ts +7 -0
  9. package/dist/modules/Customer/constants.js +12 -0
  10. package/dist/modules/Customer/index.d.ts +89 -0
  11. package/dist/modules/Customer/index.js +439 -0
  12. package/dist/modules/Customer/types.d.ts +130 -0
  13. package/dist/modules/Customer/types.js +39 -0
  14. package/dist/modules/ProductList/index.d.ts +6 -1
  15. package/dist/modules/ProductList/index.js +8 -4
  16. package/dist/modules/Rules/index.js +7 -5
  17. package/dist/modules/Rules/types.d.ts +1 -0
  18. package/dist/modules/Schedule/utils.js +7 -1
  19. package/dist/modules/index.d.ts +1 -0
  20. package/dist/modules/index.js +1 -0
  21. package/dist/plugins/window.d.ts +1 -0
  22. package/dist/solution/BookingByStep/index.js +8 -15
  23. package/dist/solution/BookingTicket/index.d.ts +127 -0
  24. package/dist/solution/BookingTicket/index.js +494 -0
  25. package/dist/solution/BookingTicket/types.d.ts +66 -0
  26. package/dist/solution/BookingTicket/types.js +41 -0
  27. package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +22 -0
  28. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +147 -0
  29. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +19 -0
  30. package/dist/solution/BookingTicket/utils/scan/handleScan.js +138 -0
  31. package/dist/solution/BookingTicket/utils/scan/index.d.ts +51 -0
  32. package/dist/solution/BookingTicket/utils/scan/index.js +189 -0
  33. package/dist/solution/ShopDiscount/index.js +4 -2
  34. package/dist/solution/index.d.ts +1 -0
  35. package/dist/solution/index.js +1 -0
  36. package/dist/types/index.d.ts +3 -1
  37. package/dist/utils/task.d.ts +31 -0
  38. package/dist/utils/task.js +150 -0
  39. package/dist/utils/watch.d.ts +102 -0
  40. package/dist/utils/watch.js +294 -0
  41. package/lib/core/index.js +1 -1
  42. package/lib/effects/index.d.ts +4 -3
  43. package/lib/effects/index.js +4 -1
  44. package/lib/modules/AccountList/index.d.ts +7 -1
  45. package/lib/modules/AccountList/index.js +27 -0
  46. package/lib/modules/AccountList/types.d.ts +28 -0
  47. package/lib/modules/Customer/constants.d.ts +7 -0
  48. package/lib/modules/Customer/constants.js +39 -0
  49. package/lib/modules/Customer/index.d.ts +89 -0
  50. package/lib/modules/Customer/index.js +304 -0
  51. package/lib/modules/Customer/types.d.ts +130 -0
  52. package/lib/modules/Customer/types.js +35 -0
  53. package/lib/modules/ProductList/index.d.ts +6 -1
  54. package/lib/modules/ProductList/index.js +12 -3
  55. package/lib/modules/Rules/index.js +4 -3
  56. package/lib/modules/Rules/types.d.ts +1 -0
  57. package/lib/modules/Schedule/utils.js +8 -3
  58. package/lib/modules/index.d.ts +1 -0
  59. package/lib/modules/index.js +2 -0
  60. package/lib/plugins/window.d.ts +1 -0
  61. package/lib/solution/BookingByStep/index.js +0 -7
  62. package/lib/solution/BookingTicket/index.d.ts +127 -0
  63. package/lib/solution/BookingTicket/index.js +291 -0
  64. package/lib/solution/BookingTicket/types.d.ts +66 -0
  65. package/lib/solution/BookingTicket/types.js +70 -0
  66. package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +22 -0
  67. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +97 -0
  68. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +19 -0
  69. package/lib/solution/BookingTicket/utils/scan/handleScan.js +95 -0
  70. package/lib/solution/BookingTicket/utils/scan/index.d.ts +51 -0
  71. package/lib/solution/BookingTicket/utils/scan/index.js +153 -0
  72. package/lib/solution/ShopDiscount/index.js +2 -1
  73. package/lib/solution/index.d.ts +1 -0
  74. package/lib/solution/index.js +2 -0
  75. package/lib/types/index.d.ts +3 -1
  76. package/lib/utils/task.d.ts +31 -0
  77. package/lib/utils/task.js +84 -0
  78. package/lib/utils/watch.d.ts +102 -0
  79. package/lib/utils/watch.js +217 -0
  80. package/package.json +1 -1
@@ -0,0 +1,439 @@
1
+ var _excluded = ["skip", "num", "search"];
2
+ 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); }
3
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
4
+ 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."); }
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); }
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
+ 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; }
9
+ 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; }
10
+ 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; }
11
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
12
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
13
+ 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; }
14
+ 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); } }
15
+ 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); }); }; }
16
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
17
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
18
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
19
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
20
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
21
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
22
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
23
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
24
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
25
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
26
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
27
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
28
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
29
+ import { cloneDeep } from 'lodash-es';
30
+ import { BaseModule } from "../BaseModule";
31
+ import { CustomerHooks } from "./types";
32
+ import { DEFAULT_CUSTOMER, DEFAULT_PAGE_SIZE, SORT_BY } from "./constants";
33
+ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
34
+ _inherits(CustomerModule, _BaseModule);
35
+ var _super = _createSuper(CustomerModule);
36
+ function CustomerModule(name, version) {
37
+ var _this;
38
+ _classCallCheck(this, CustomerModule);
39
+ _this = _super.call(this, name, version);
40
+ _defineProperty(_assertThisInitialized(_this), "defaultName", 'customer');
41
+ _defineProperty(_assertThisInitialized(_this), "defaultVersion", '1.0.0');
42
+ _defineProperty(_assertThisInitialized(_this), "store", {
43
+ customerList: [],
44
+ selectedCustomer: null,
45
+ total: 0,
46
+ currentPage: 1,
47
+ pageSize: DEFAULT_PAGE_SIZE,
48
+ loading: false,
49
+ error: null
50
+ });
51
+ _defineProperty(_assertThisInitialized(_this), "request", void 0);
52
+ _defineProperty(_assertThisInitialized(_this), "cacheId", void 0);
53
+ _defineProperty(_assertThisInitialized(_this), "openCache", false);
54
+ _defineProperty(_assertThisInitialized(_this), "fatherModule", void 0);
55
+ return _this;
56
+ }
57
+ _createClass(CustomerModule, [{
58
+ key: "initialize",
59
+ value: function () {
60
+ var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
61
+ var _options$initialState, _options$initialState2, _options$initialState3, _options$initialState4, _options$initialState5, _options$otherParams, _options$otherParams2;
62
+ var customerList;
63
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
64
+ while (1) switch (_context.prev = _context.next) {
65
+ case 0:
66
+ this.core = core;
67
+ this.store = options === null || options === void 0 ? void 0 : options.store;
68
+ this.request = this.core.getPlugin('request');
69
+
70
+ // 初始化状态
71
+ if (Array.isArray(options === null || options === void 0 || (_options$initialState = options.initialState) === null || _options$initialState === void 0 ? void 0 : _options$initialState.customerList)) {
72
+ customerList = cloneDeep(options.initialState.customerList || []);
73
+ this.store.customerList = customerList;
74
+ } else {
75
+ this.store.customerList = [];
76
+ }
77
+ if (options !== null && options !== void 0 && (_options$initialState2 = options.initialState) !== null && _options$initialState2 !== void 0 && _options$initialState2.selectedCustomer) {
78
+ this.store.selectedCustomer = cloneDeep(options.initialState.selectedCustomer);
79
+ } else {
80
+ this.store.selectedCustomer = null;
81
+ }
82
+ if (typeof (options === null || options === void 0 || (_options$initialState3 = options.initialState) === null || _options$initialState3 === void 0 ? void 0 : _options$initialState3.total) === 'number') {
83
+ this.store.total = options.initialState.total;
84
+ } else {
85
+ this.store.total = 0;
86
+ }
87
+ if (typeof (options === null || options === void 0 || (_options$initialState4 = options.initialState) === null || _options$initialState4 === void 0 ? void 0 : _options$initialState4.currentPage) === 'number') {
88
+ this.store.currentPage = options.initialState.currentPage;
89
+ } else {
90
+ this.store.currentPage = 1;
91
+ }
92
+ if (typeof (options === null || options === void 0 || (_options$initialState5 = options.initialState) === null || _options$initialState5 === void 0 ? void 0 : _options$initialState5.pageSize) === 'number') {
93
+ this.store.pageSize = options.initialState.pageSize;
94
+ } else {
95
+ this.store.pageSize = DEFAULT_PAGE_SIZE;
96
+ }
97
+
98
+ // 缓存配置
99
+ if (options !== null && options !== void 0 && (_options$otherParams = options.otherParams) !== null && _options$otherParams !== void 0 && _options$otherParams.cacheId) {
100
+ this.openCache = options.otherParams.openCache;
101
+ this.cacheId = options.otherParams.cacheId;
102
+ }
103
+ if (options !== null && options !== void 0 && (_options$otherParams2 = options.otherParams) !== null && _options$otherParams2 !== void 0 && _options$otherParams2.fatherModule) {
104
+ this.fatherModule = options.otherParams.fatherModule;
105
+ }
106
+ case 10:
107
+ case "end":
108
+ return _context.stop();
109
+ }
110
+ }, _callee, this);
111
+ }));
112
+ function initialize(_x, _x2) {
113
+ return _initialize.apply(this, arguments);
114
+ }
115
+ return initialize;
116
+ }()
117
+ /**
118
+ * 获取客户列表
119
+ * @param params 查询参数
120
+ * @returns 客户列表响应
121
+ */
122
+ }, {
123
+ key: "getCustomerList",
124
+ value: (function () {
125
+ var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
126
+ var params,
127
+ url,
128
+ _params$skip,
129
+ skip,
130
+ _params$num,
131
+ num,
132
+ search,
133
+ otherParams,
134
+ _res$data,
135
+ _res$data2,
136
+ queryParams,
137
+ res,
138
+ customerList,
139
+ total,
140
+ page,
141
+ pageSize,
142
+ response,
143
+ _args2 = arguments;
144
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
145
+ while (1) switch (_context2.prev = _context2.next) {
146
+ case 0:
147
+ params = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
148
+ url = '/customer/select-list';
149
+ _params$skip = params.skip, skip = _params$skip === void 0 ? 1 : _params$skip, _params$num = params.num, num = _params$num === void 0 ? DEFAULT_PAGE_SIZE : _params$num, search = params.search, otherParams = _objectWithoutProperties(params, _excluded);
150
+ _context2.prev = 3;
151
+ this.store.loading = true;
152
+ this.store.error = null;
153
+ queryParams = _objectSpread(_objectSpread({
154
+ skip: skip,
155
+ num: num,
156
+ sort_by: SORT_BY,
157
+ with: ['latestWalletDetail.wallet'],
158
+ search_wallet_pass_flag: 1
159
+ }, search && {
160
+ search: search
161
+ }), otherParams);
162
+ _context2.next = 9;
163
+ return this.request.get(url, queryParams);
164
+ case 9:
165
+ res = _context2.sent;
166
+ if (!((res === null || res === void 0 ? void 0 : res.code) !== 200)) {
167
+ _context2.next = 12;
168
+ break;
169
+ }
170
+ throw new Error(res === null || res === void 0 ? void 0 : res.message);
171
+ case 12:
172
+ customerList = (res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.list) || [];
173
+ total = (res === null || res === void 0 || (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.count) || 0; // skip直接作为page使用,num作为pageSize
174
+ page = skip;
175
+ pageSize = num; // 更新分页状态
176
+ this.store.currentPage = page;
177
+ this.store.pageSize = pageSize;
178
+ this.store.total = total;
179
+
180
+ // 设置客户列表
181
+ this.store.customerList = cloneDeep(customerList);
182
+ _context2.next = 22;
183
+ return this.core.effects.emit(CustomerHooks.OnCustomerListUpdate, this.store);
184
+ case 22:
185
+ // 触发分页变化事件
186
+ this.triggerPaginationChange({
187
+ page: page,
188
+ pageSize: pageSize,
189
+ total: total,
190
+ totalPages: Math.ceil(total / pageSize)
191
+ });
192
+ response = {
193
+ list: customerList,
194
+ total: total,
195
+ page: page,
196
+ pageSize: pageSize
197
+ };
198
+ return _context2.abrupt("return", response);
199
+ case 27:
200
+ _context2.prev = 27;
201
+ _context2.t0 = _context2["catch"](3);
202
+ console.error('Failed to fetch customer list:', _context2.t0);
203
+ this.store.error = _context2.t0 instanceof Error ? _context2.t0.message : 'Failed to fetch customer list';
204
+ _context2.next = 33;
205
+ return this.core.effects.emit(CustomerHooks.OnCustomerListError, this.store.error);
206
+ case 33:
207
+ throw _context2.t0;
208
+ case 34:
209
+ _context2.prev = 34;
210
+ this.store.loading = false;
211
+ this.storeChange();
212
+ return _context2.finish(34);
213
+ case 38:
214
+ case "end":
215
+ return _context2.stop();
216
+ }
217
+ }, _callee2, this, [[3, 27, 34, 38]]);
218
+ }));
219
+ function getCustomerList() {
220
+ return _getCustomerList.apply(this, arguments);
221
+ }
222
+ return getCustomerList;
223
+ }()
224
+ /**
225
+ * 设置客户列表
226
+ * @param customers 客户列表
227
+ * @param total 总数
228
+ */
229
+ )
230
+ }, {
231
+ key: "setCustomerList",
232
+ value: function setCustomerList(customers, total) {
233
+ this.store.customerList = cloneDeep(customers);
234
+ if (typeof total === 'number') {
235
+ this.store.total = total;
236
+ }
237
+ this.storeChange();
238
+ }
239
+
240
+ /**
241
+ * 设置当前选择的客户
242
+ * @param customer 选择的客户
243
+ */
244
+ }, {
245
+ key: "setSelectedCustomer",
246
+ value: function setSelectedCustomer(customer) {
247
+ this.store.selectedCustomer = !customer ? DEFAULT_CUSTOMER : cloneDeep(customer);
248
+ this.core.effects.emit(CustomerHooks.OnCustomerSelected, this.store.selectedCustomer);
249
+ this.storeChange();
250
+ }
251
+
252
+ /**
253
+ * 获取当前选择的客户
254
+ * @returns 当前选择的客户
255
+ */
256
+ }, {
257
+ key: "getSelectedCustomer",
258
+ value: function getSelectedCustomer() {
259
+ return this.store.selectedCustomer;
260
+ }
261
+
262
+ /**
263
+ * 获取客户列表
264
+ * @returns 客户列表
265
+ */
266
+ }, {
267
+ key: "getCustomers",
268
+ value: function getCustomers() {
269
+ return _toConsumableArray(this.store.customerList);
270
+ }
271
+
272
+ /**
273
+ * 根据ID查找客户
274
+ * @param id 客户ID
275
+ * @returns 客户信息
276
+ */
277
+ }, {
278
+ key: "getCustomerById",
279
+ value: function getCustomerById(id) {
280
+ return this.store.customerList.find(function (customer) {
281
+ return customer.id === id;
282
+ }) || null;
283
+ }
284
+
285
+ /**
286
+ * 清空客户列表
287
+ */
288
+ }, {
289
+ key: "clearCustomers",
290
+ value: function clearCustomers() {
291
+ this.store.customerList = [];
292
+ this.store.selectedCustomer = null;
293
+ this.store.total = 0;
294
+ this.store.currentPage = 1;
295
+ this.store.pageSize = DEFAULT_PAGE_SIZE;
296
+ this.core.effects.emit(CustomerHooks.OnCustomerListUpdate, this.store);
297
+ this.storeChange();
298
+ }
299
+
300
+ /**
301
+ * 添加客户到列表第一位
302
+ * @param customer 要添加的客户信息
303
+ */
304
+ }, {
305
+ key: "addCustomerToFirst",
306
+ value: function addCustomerToFirst(customer) {
307
+ // 深拷贝客户对象以避免引用问题
308
+ var newCustomer = cloneDeep(customer);
309
+
310
+ // 将客户添加到列表第一位
311
+ this.store.customerList = [newCustomer].concat(_toConsumableArray(this.store.customerList));
312
+
313
+ // 更新总数
314
+ this.store.total += 1;
315
+
316
+ // 触发客户列表更新事件
317
+ this.core.effects.emit(CustomerHooks.OnCustomerListUpdate, this.store);
318
+
319
+ // 保存状态变化
320
+ this.storeChange();
321
+ }
322
+
323
+ /**
324
+ * 获取当前状态
325
+ * @returns 当前状态
326
+ */
327
+ }, {
328
+ key: "getState",
329
+ value: function getState() {
330
+ return cloneDeep(this.store);
331
+ }
332
+
333
+ /**
334
+ * 获取分页信息
335
+ * @returns 分页信息
336
+ */
337
+ }, {
338
+ key: "getPaginationInfo",
339
+ value: function getPaginationInfo() {
340
+ return {
341
+ page: this.store.currentPage,
342
+ pageSize: this.store.pageSize,
343
+ total: this.store.total,
344
+ totalPages: Math.ceil(this.store.total / this.store.pageSize)
345
+ };
346
+ }
347
+
348
+ /**
349
+ * 触发分页变化事件
350
+ * @param pagination 分页信息
351
+ */
352
+ }, {
353
+ key: "triggerPaginationChange",
354
+ value: function triggerPaginationChange(pagination) {
355
+ this.core.effects.emit(CustomerHooks.OnPaginationChange, pagination);
356
+ }
357
+
358
+ /**
359
+ * 设置分页信息
360
+ * @param page 页码
361
+ * @param pageSize 每页数量
362
+ */
363
+ }, {
364
+ key: "setPaginationInfo",
365
+ value: function setPaginationInfo(page, pageSize) {
366
+ this.store.currentPage = page;
367
+ this.store.pageSize = pageSize;
368
+ this.storeChange();
369
+
370
+ // 触发分页变化事件
371
+ this.triggerPaginationChange({
372
+ page: page,
373
+ pageSize: pageSize,
374
+ total: this.store.total,
375
+ totalPages: Math.ceil(this.store.total / pageSize)
376
+ });
377
+ }
378
+
379
+ /**
380
+ * 便捷方法:切换分页并自动获取数据
381
+ * @param page 页码
382
+ * @param pageSize 每页数量(可选,不传则使用当前pageSize)
383
+ * @returns 客户列表响应
384
+ */
385
+ }, {
386
+ key: "changeCustomerPage",
387
+ value: (function () {
388
+ var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(page, pageSize) {
389
+ var targetPageSize, skip, num;
390
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
391
+ while (1) switch (_context3.prev = _context3.next) {
392
+ case 0:
393
+ targetPageSize = pageSize || this.store.pageSize; // 先更新分页状态
394
+ this.setPaginationInfo(page, targetPageSize);
395
+
396
+ // skip直接使用page,num使用pageSize
397
+ skip = page;
398
+ num = targetPageSize; // 自动调用获取客户列表
399
+ _context3.next = 6;
400
+ return this.getCustomerList({
401
+ skip: skip,
402
+ num: num
403
+ });
404
+ case 6:
405
+ return _context3.abrupt("return", _context3.sent);
406
+ case 7:
407
+ case "end":
408
+ return _context3.stop();
409
+ }
410
+ }, _callee3, this);
411
+ }));
412
+ function changeCustomerPage(_x3, _x4) {
413
+ return _changeCustomerPage.apply(this, arguments);
414
+ }
415
+ return changeCustomerPage;
416
+ }()
417
+ /**
418
+ * 缓存状态变化
419
+ */
420
+ )
421
+ }, {
422
+ key: "storeChange",
423
+ value: function storeChange() {
424
+ if (this.openCache) {
425
+ var store = cloneDeep(this.store);
426
+ this.checkSaveCache({
427
+ cacheId: this.cacheId,
428
+ fatherModule: this.fatherModule,
429
+ store: store,
430
+ cacheKey: ['customerList', 'selectedCustomer', 'total', 'currentPage', 'pageSize']
431
+ });
432
+ }
433
+ }
434
+ }]);
435
+ return CustomerModule;
436
+ }(BaseModule);
437
+
438
+ // 导出类型和模块
439
+ export * from "./types";
@@ -0,0 +1,130 @@
1
+ import { ICustomer } from "../AccountList/types";
2
+ export declare enum CustomerHooks {
3
+ OnCustomerListUpdate = "customer:onUpdate",
4
+ OnCustomerListError = "customer:onError",
5
+ OnCustomerSelected = "customer:onSelected",
6
+ OnPaginationChange = "customer:onPaginationChange"
7
+ }
8
+ /**
9
+ * 客户数据
10
+ */
11
+ export interface ShopCustomer extends ICustomer {
12
+ /** 客户ID */
13
+ id: string | number;
14
+ /** 客户姓名 */
15
+ name: string;
16
+ /** 客户电话 */
17
+ phone?: string;
18
+ /** 客户邮箱 */
19
+ email?: string;
20
+ /** 客户创建时间 */
21
+ created_at?: string;
22
+ /** 客户更新时间 */
23
+ updated_at?: string;
24
+ /** 其他客户信息 */
25
+ [key: string]: any;
26
+ }
27
+ /**
28
+ * 客户列表关联查询参数
29
+ *
30
+ * formRecord: 用户表单记录
31
+ * walletDetails.wallet: 用户所有wallet
32
+ * latestWalletDetail.wallet: 用户最新wallet
33
+ */
34
+ type CustomerWith = 'formRecord' | 'walletDetails.wallet' | 'latestWalletDetail.wallet';
35
+ /**
36
+ * 获取客户列表参数
37
+ */
38
+ export interface ShopGetCustomerListParams {
39
+ /** 页码 */
40
+ skip?: number;
41
+ /** 每页数量 */
42
+ num?: number;
43
+ /** 搜索关键词 */
44
+ search?: string;
45
+ /** 关联查询参数 */
46
+ with?: CustomerWith[];
47
+ /** wallet搜索标识 */
48
+ search_wallet_flag?: 0 | 1;
49
+ /** wallet pass搜索标识 */
50
+ search_wallet_pass_flag?: 0 | 1;
51
+ /** 其他筛选参数 */
52
+ [key: string]: any;
53
+ }
54
+ /**
55
+ * 分页信息
56
+ */
57
+ export interface IPaginationInfo {
58
+ /** 当前页码 */
59
+ page: number;
60
+ /** 每页数量 */
61
+ pageSize: number;
62
+ /** 总数 */
63
+ total: number;
64
+ /** 总页数 */
65
+ totalPages: number;
66
+ }
67
+ /**
68
+ * 客户列表响应
69
+ */
70
+ export interface ICustomerListResponse {
71
+ /** 客户列表 */
72
+ list: ShopCustomer[];
73
+ /** 总数 */
74
+ total: number;
75
+ /** 当前页 */
76
+ page?: number;
77
+ /** 每页数量 */
78
+ pageSize?: number;
79
+ }
80
+ /**
81
+ * 客户列表状态
82
+ */
83
+ export interface CustomerState {
84
+ /** 客户列表 */
85
+ customerList: ShopCustomer[];
86
+ /** 当前选择的客户 */
87
+ selectedCustomer: ShopCustomer | null;
88
+ /** 列表总数 */
89
+ total: number;
90
+ /** 当前页码 */
91
+ currentPage: number;
92
+ /** 每页数量 */
93
+ pageSize: number;
94
+ /** 加载状态 */
95
+ loading: boolean;
96
+ /** 错误信息 */
97
+ error: string | null;
98
+ }
99
+ /**
100
+ * 客户模块 API
101
+ */
102
+ export interface CustomerModuleAPI {
103
+ /** 获取客户列表 */
104
+ getCustomerList: (params?: ShopGetCustomerListParams) => Promise<ICustomerListResponse>;
105
+ /** 设置客户列表 */
106
+ setCustomerList: (customers: ShopCustomer[], total?: number) => void;
107
+ /** 设置当前选择的客户 */
108
+ setSelectedCustomer: (customer: ShopCustomer | null) => void;
109
+ /** 获取当前选择的客户 */
110
+ getSelectedCustomer: () => ShopCustomer | null;
111
+ /** 获取客户列表 */
112
+ getCustomers: () => ShopCustomer[];
113
+ /** 根据ID查找客户 */
114
+ getCustomerById: (id: string | number) => ShopCustomer | null;
115
+ /** 清空客户列表 */
116
+ clearCustomers: () => void;
117
+ /** 添加客户到列表第一位 */
118
+ addCustomerToFirst: (customer: ShopCustomer) => void;
119
+ /** 获取当前状态 */
120
+ getState: () => CustomerState;
121
+ /** 获取分页信息 */
122
+ getPaginationInfo: () => IPaginationInfo;
123
+ /** 触发分页变化事件 */
124
+ triggerPaginationChange: (pagination: IPaginationInfo) => void;
125
+ /** 设置分页信息 */
126
+ setPaginationInfo: (page: number, pageSize: number) => void;
127
+ /** 便捷方法:切换分页并自动获取数据 */
128
+ changeCustomerPage: (page: number, pageSize?: number) => Promise<ICustomerListResponse>;
129
+ }
130
+ export {};
@@ -0,0 +1,39 @@
1
+ export var CustomerHooks = /*#__PURE__*/function (CustomerHooks) {
2
+ CustomerHooks["OnCustomerListUpdate"] = "customer:onUpdate";
3
+ CustomerHooks["OnCustomerListError"] = "customer:onError";
4
+ CustomerHooks["OnCustomerSelected"] = "customer:onSelected";
5
+ CustomerHooks["OnPaginationChange"] = "customer:onPaginationChange";
6
+ return CustomerHooks;
7
+ }({});
8
+
9
+ /**
10
+ * 客户数据
11
+ */
12
+
13
+ /**
14
+ * 客户列表关联查询参数
15
+ *
16
+ * formRecord: 用户表单记录
17
+ * walletDetails.wallet: 用户所有wallet
18
+ * latestWalletDetail.wallet: 用户最新wallet
19
+ */
20
+
21
+ /**
22
+ * 获取客户列表参数
23
+ */
24
+
25
+ /**
26
+ * 分页信息
27
+ */
28
+
29
+ /**
30
+ * 客户列表响应
31
+ */
32
+
33
+ /**
34
+ * 客户列表状态
35
+ */
36
+
37
+ /**
38
+ * 客户模块 API
39
+ */
@@ -11,12 +11,17 @@ export declare class ProductList extends BaseModule implements Module {
11
11
  constructor(name?: string, version?: string);
12
12
  initialize(core: PisellCore, options: any): Promise<void>;
13
13
  storeChange(path?: string, value?: any): Promise<void>;
14
- loadProducts({ category_ids, product_ids, collection, schedule_date, cacheId }: {
14
+ loadProducts({ category_ids, product_ids, collection, menu_list_ids, customer_id: paramsCustomerId, with_count, schedule_datetime, schedule_date, cacheId, with_schedule, }: {
15
15
  category_ids?: number[];
16
16
  product_ids?: number[];
17
17
  collection?: number | string[];
18
18
  schedule_date?: string;
19
19
  cacheId?: string;
20
+ customer_id?: number;
21
+ menu_list_ids?: number[];
22
+ schedule_datetime?: string;
23
+ with_count?: string[];
24
+ with_schedule?: number;
20
25
  }): Promise<any>;
21
26
  loadProductsPrice({ ids, customer_id, schedule_date, channel, }: {
22
27
  ids?: number[];