@pisell/pisellos 0.0.9 → 0.0.11

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 (136) hide show
  1. package/dist/core/index.js +4 -1
  2. package/dist/effects/index.d.ts +1 -1
  3. package/dist/effects/index.js +3 -3
  4. package/dist/modules/Account/index.d.ts +5 -3
  5. package/dist/modules/Account/index.js +23 -36
  6. package/dist/modules/Account/types.d.ts +2 -1
  7. package/dist/modules/AccountList/index.d.ts +2 -0
  8. package/dist/modules/AccountList/index.js +34 -11
  9. package/dist/modules/Cart/index.d.ts +17 -11
  10. package/dist/modules/Cart/index.js +179 -121
  11. package/dist/modules/Cart/types.d.ts +98 -9
  12. package/dist/modules/Cart/types.js +8 -0
  13. package/dist/modules/Cart/utils.d.ts +114 -0
  14. package/dist/modules/Cart/utils.js +345 -0
  15. package/dist/modules/Date/index.d.ts +11 -12
  16. package/dist/modules/Date/index.js +104 -60
  17. package/dist/modules/Date/types.d.ts +51 -20
  18. package/dist/modules/Date/types.js +2 -5
  19. package/dist/modules/Date/utils.d.ts +35 -0
  20. package/dist/modules/Date/utils.js +211 -0
  21. package/dist/modules/Discount/index.d.ts +26 -0
  22. package/dist/modules/Discount/index.js +234 -0
  23. package/dist/modules/Discount/types.d.ts +66 -0
  24. package/dist/modules/Discount/types.js +5 -0
  25. package/dist/modules/Order/index.d.ts +16 -12
  26. package/dist/modules/Order/index.js +38 -166
  27. package/dist/modules/Order/types.d.ts +18 -41
  28. package/dist/modules/Order/types.js +0 -14
  29. package/dist/modules/Payment/index.d.ts +0 -2
  30. package/dist/modules/Payment/index.js +45 -76
  31. package/dist/modules/Payment/types.d.ts +0 -2
  32. package/dist/modules/Payment/types.js +2 -0
  33. package/dist/modules/Product/types.d.ts +50 -1
  34. package/dist/modules/ProductList/index.d.ts +1 -0
  35. package/dist/modules/ProductList/index.js +23 -2
  36. package/dist/modules/ProductList/types.d.ts +1 -0
  37. package/dist/modules/Resource/types.d.ts +6 -2
  38. package/dist/modules/Rules/index.d.ts +32 -0
  39. package/dist/modules/Rules/index.js +423 -0
  40. package/dist/modules/Rules/types.d.ts +46 -0
  41. package/dist/modules/Rules/types.js +5 -0
  42. package/dist/modules/Summary/index.d.ts +13 -0
  43. package/dist/modules/Summary/index.js +80 -0
  44. package/dist/modules/Summary/types.d.ts +13 -0
  45. package/dist/modules/Summary/types.js +1 -0
  46. package/dist/modules/Summary/utils.d.ts +19 -0
  47. package/dist/modules/Summary/utils.js +56 -0
  48. package/dist/plugins/index.d.ts +3 -2
  49. package/dist/plugins/index.js +2 -1
  50. package/dist/plugins/request.d.ts +4 -3
  51. package/dist/plugins/request.js +30 -30
  52. package/dist/plugins/shopStore.d.ts +4 -0
  53. package/dist/plugins/shopStore.js +1 -0
  54. package/dist/solution/BookingByStep/index.d.ts +73 -10
  55. package/dist/solution/BookingByStep/index.js +641 -74
  56. package/dist/solution/BookingByStep/types.d.ts +2 -0
  57. package/dist/solution/BookingByStep/types.js +11 -8
  58. package/dist/solution/BookingByStep/utils/products.d.ts +11 -0
  59. package/dist/solution/BookingByStep/utils/products.js +47 -0
  60. package/dist/solution/BookingByStep/utils/resources.d.ts +59 -10
  61. package/dist/solution/BookingByStep/utils/resources.js +144 -79
  62. package/dist/solution/ShopDiscount/index.d.ts +50 -0
  63. package/dist/solution/ShopDiscount/index.js +546 -0
  64. package/dist/solution/ShopDiscount/types.d.ts +24 -0
  65. package/dist/solution/ShopDiscount/types.js +10 -0
  66. package/dist/solution/ShopDiscount/utils.d.ts +1 -0
  67. package/dist/solution/ShopDiscount/utils.js +7 -0
  68. package/dist/solution/index.d.ts +1 -0
  69. package/dist/solution/index.js +2 -1
  70. package/lib/core/index.js +1 -1
  71. package/lib/effects/index.d.ts +1 -1
  72. package/lib/effects/index.js +1 -1
  73. package/lib/modules/Account/index.d.ts +5 -3
  74. package/lib/modules/Account/index.js +14 -3
  75. package/lib/modules/Account/types.d.ts +2 -1
  76. package/lib/modules/AccountList/index.d.ts +2 -0
  77. package/lib/modules/AccountList/index.js +17 -0
  78. package/lib/modules/Cart/index.d.ts +17 -11
  79. package/lib/modules/Cart/index.js +72 -21
  80. package/lib/modules/Cart/types.d.ts +98 -9
  81. package/lib/modules/Cart/utils.d.ts +114 -0
  82. package/lib/modules/Cart/utils.js +320 -0
  83. package/lib/modules/Date/index.d.ts +11 -12
  84. package/lib/modules/Date/index.js +50 -31
  85. package/lib/modules/Date/types.d.ts +51 -20
  86. package/lib/modules/Date/types.js +0 -4
  87. package/lib/modules/Date/utils.d.ts +35 -0
  88. package/lib/modules/Date/utils.js +167 -0
  89. package/lib/modules/Discount/index.d.ts +26 -0
  90. package/lib/modules/Discount/index.js +118 -0
  91. package/lib/modules/Discount/types.d.ts +66 -0
  92. package/lib/modules/Discount/types.js +33 -0
  93. package/lib/modules/Order/index.d.ts +16 -12
  94. package/lib/modules/Order/index.js +23 -51
  95. package/lib/modules/Order/types.d.ts +18 -41
  96. package/lib/modules/Payment/index.d.ts +0 -2
  97. package/lib/modules/Payment/index.js +6 -17
  98. package/lib/modules/Payment/types.d.ts +0 -2
  99. package/lib/modules/Product/types.d.ts +50 -1
  100. package/lib/modules/ProductList/index.d.ts +1 -0
  101. package/lib/modules/ProductList/index.js +6 -1
  102. package/lib/modules/ProductList/types.d.ts +1 -0
  103. package/lib/modules/Resource/types.d.ts +6 -2
  104. package/lib/modules/Rules/index.d.ts +32 -0
  105. package/lib/modules/Rules/index.js +283 -0
  106. package/lib/modules/Rules/types.d.ts +46 -0
  107. package/lib/modules/Rules/types.js +33 -0
  108. package/lib/modules/Summary/index.d.ts +13 -0
  109. package/lib/modules/Summary/index.js +49 -0
  110. package/lib/modules/Summary/types.d.ts +13 -0
  111. package/lib/modules/Summary/types.js +17 -0
  112. package/lib/modules/Summary/utils.d.ts +19 -0
  113. package/lib/modules/Summary/utils.js +79 -0
  114. package/lib/plugins/index.d.ts +3 -2
  115. package/lib/plugins/index.js +3 -1
  116. package/lib/plugins/request.d.ts +4 -3
  117. package/lib/plugins/request.js +4 -20
  118. package/lib/plugins/shopStore.d.ts +4 -0
  119. package/lib/plugins/shopStore.js +17 -0
  120. package/lib/solution/BookingByStep/index.d.ts +73 -10
  121. package/lib/solution/BookingByStep/index.js +452 -20
  122. package/lib/solution/BookingByStep/types.d.ts +2 -0
  123. package/lib/solution/BookingByStep/types.js +3 -0
  124. package/lib/solution/BookingByStep/utils/products.d.ts +11 -0
  125. package/lib/solution/BookingByStep/utils/products.js +60 -0
  126. package/lib/solution/BookingByStep/utils/resources.d.ts +59 -10
  127. package/lib/solution/BookingByStep/utils/resources.js +106 -49
  128. package/lib/solution/ShopDiscount/index.d.ts +50 -0
  129. package/lib/solution/ShopDiscount/index.js +321 -0
  130. package/lib/solution/ShopDiscount/types.d.ts +24 -0
  131. package/lib/solution/ShopDiscount/types.js +38 -0
  132. package/lib/solution/ShopDiscount/utils.d.ts +1 -0
  133. package/lib/solution/ShopDiscount/utils.js +32 -0
  134. package/lib/solution/index.d.ts +1 -0
  135. package/lib/solution/index.js +3 -1
  136. package/package.json +8 -7
@@ -0,0 +1,546 @@
1
+ var _excluded = ["wallet_pass_list"];
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 _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; }
4
+ 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; }
5
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
6
+ 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."); }
7
+ 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); }
8
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
9
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
10
+ 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; }
11
+ 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; }
12
+ 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; }
13
+ 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; }
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 { BaseModule } from "../../modules/BaseModule";
30
+ import { ShopDiscountHooks } from "./types";
31
+ import { DiscountModule } from "../../modules/Discount";
32
+ import { RulesModule } from "../../modules/Rules";
33
+ import { uniqueById } from "./utils";
34
+ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
35
+ _inherits(ShopDiscountImpl, _BaseModule);
36
+ var _super = _createSuper(ShopDiscountImpl);
37
+ function ShopDiscountImpl(name, version) {
38
+ var _this;
39
+ _classCallCheck(this, ShopDiscountImpl);
40
+ _this = _super.call(this, name, version);
41
+ // 初始化所有必要的状态属性
42
+ _defineProperty(_assertThisInitialized(_this), "defaultName", "shopDiscount");
43
+ _defineProperty(_assertThisInitialized(_this), "defaultVersion", "1.0.0");
44
+ _defineProperty(_assertThisInitialized(_this), "isSolution", true);
45
+ _defineProperty(_assertThisInitialized(_this), "request", void 0);
46
+ _defineProperty(_assertThisInitialized(_this), "window", void 0);
47
+ _defineProperty(_assertThisInitialized(_this), "store", void 0);
48
+ _defineProperty(_assertThisInitialized(_this), "options", {});
49
+ _this.store = {
50
+ customer: null,
51
+ productList: [],
52
+ discount: null,
53
+ rules: null
54
+ };
55
+ return _this;
56
+ }
57
+
58
+ // =========== 生命周期方法 ===========
59
+ _createClass(ShopDiscountImpl, [{
60
+ key: "initialize",
61
+ value: function () {
62
+ var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
63
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
64
+ while (1) switch (_context.prev = _context.next) {
65
+ case 0:
66
+ this.core = core;
67
+ this.options = options;
68
+ this.store = _objectSpread(_objectSpread({}, this.store), options.store || {});
69
+ console.log("[ShopDiscount] 初始化完成");
70
+
71
+ // 获取依赖的插件
72
+ this.initializePlugins();
73
+
74
+ // 注册依赖模块
75
+ this.registerDependentModules();
76
+
77
+ // 注册事件监听
78
+ this.registerEventListeners();
79
+ case 7:
80
+ case "end":
81
+ return _context.stop();
82
+ }
83
+ }, _callee, this);
84
+ }));
85
+ function initialize(_x, _x2) {
86
+ return _initialize.apply(this, arguments);
87
+ }
88
+ return initialize;
89
+ }()
90
+ }, {
91
+ key: "destroy",
92
+ value: function () {
93
+ var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
94
+ var _this$store$discount, _this$store$rules;
95
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
96
+ while (1) switch (_context2.prev = _context2.next) {
97
+ case 0:
98
+ this.store.productList = [];
99
+ this.store.customer = null;
100
+ (_this$store$discount = this.store.discount) === null || _this$store$discount === void 0 || _this$store$discount.destroy();
101
+ (_this$store$rules = this.store.rules) === null || _this$store$rules === void 0 || _this$store$rules.destroy();
102
+ this.core.effects.offByModuleDestroy(this.name);
103
+ _context2.next = 7;
104
+ return this.core.effects.emit(ShopDiscountHooks.onDestroy, {});
105
+ case 7:
106
+ console.log("[ShopDiscount] 已销毁");
107
+ case 8:
108
+ case "end":
109
+ return _context2.stop();
110
+ }
111
+ }, _callee2, this);
112
+ }));
113
+ function destroy() {
114
+ return _destroy.apply(this, arguments);
115
+ }
116
+ return destroy;
117
+ }()
118
+ }, {
119
+ key: "clear",
120
+ value: function () {
121
+ var _clear = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
122
+ var _this$store$discount2, _this$store$rules2;
123
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
124
+ while (1) switch (_context3.prev = _context3.next) {
125
+ case 0:
126
+ this.store.productList = [];
127
+ this.store.customer = null;
128
+ (_this$store$discount2 = this.store.discount) === null || _this$store$discount2 === void 0 || _this$store$discount2.clear();
129
+ (_this$store$rules2 = this.store.rules) === null || _this$store$rules2 === void 0 || _this$store$rules2.clear();
130
+ console.log("[ShopDiscount] clear");
131
+ case 5:
132
+ case "end":
133
+ return _context3.stop();
134
+ }
135
+ }, _callee3, this);
136
+ }));
137
+ function clear() {
138
+ return _clear.apply(this, arguments);
139
+ }
140
+ return clear;
141
+ }() // =========== 初始化辅助方法 ===========
142
+ }, {
143
+ key: "initializePlugins",
144
+ value: function initializePlugins() {
145
+ this.request = this.core.getPlugin("request");
146
+ this.window = this.core.getPlugin("window");
147
+ if (!this.request) {
148
+ throw new Error("ShopDiscount需要 request 插件支持");
149
+ }
150
+ if (!this.window) {
151
+ throw new Error("ShopDiscount需要 window 插件支持");
152
+ }
153
+ }
154
+ }, {
155
+ key: "registerDependentModules",
156
+ value: function registerDependentModules() {
157
+ var _this$options$otherPa, _this$options$otherPa2;
158
+ // 注册优惠模块
159
+ var discount = new DiscountModule("".concat(this.name, "_discount"));
160
+ this.core.registerModule(discount, {
161
+ hooks: (_this$options$otherPa = this.options.otherParams) === null || _this$options$otherPa === void 0 || (_this$options$otherPa = _this$options$otherPa.discount) === null || _this$options$otherPa === void 0 ? void 0 : _this$options$otherPa.hooks
162
+ });
163
+ this.store.discount = discount;
164
+
165
+ // 注册规则模块
166
+ var rules = new RulesModule("".concat(this.name, "_rules"));
167
+ this.core.registerModule(rules, {
168
+ hooks: (_this$options$otherPa2 = this.options.otherParams) === null || _this$options$otherPa2 === void 0 || (_this$options$otherPa2 = _this$options$otherPa2.rules) === null || _this$options$otherPa2 === void 0 ? void 0 : _this$options$otherPa2.hooks
169
+ });
170
+ this.store.rules = rules;
171
+ }
172
+ }, {
173
+ key: "registerEventListeners",
174
+ value: function registerEventListeners() {
175
+ var _this2 = this;
176
+ this.core.effects.on(ShopDiscountHooks.onCustomerChange, function (customer) {
177
+ _this2.loadPrepareConfig({
178
+ customerId: customer.id,
179
+ action: "create",
180
+ with_good_pass: 1
181
+ });
182
+ });
183
+ }
184
+
185
+ // =========== 公共 API ===========
186
+
187
+ // 设置客户
188
+ }, {
189
+ key: "setCustomer",
190
+ value: function () {
191
+ var _setCustomer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(customer) {
192
+ var _this$store$customer;
193
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
194
+ while (1) switch (_context4.prev = _context4.next) {
195
+ case 0:
196
+ if (!(((_this$store$customer = this.store.customer) === null || _this$store$customer === void 0 ? void 0 : _this$store$customer.id) !== customer.id)) {
197
+ _context4.next = 4;
198
+ break;
199
+ }
200
+ this.store.customer = customer;
201
+ _context4.next = 4;
202
+ return this.core.effects.emit(ShopDiscountHooks.onCustomerChange, customer);
203
+ case 4:
204
+ case "end":
205
+ return _context4.stop();
206
+ }
207
+ }, _callee4, this);
208
+ }));
209
+ function setCustomer(_x3) {
210
+ return _setCustomer.apply(this, arguments);
211
+ }
212
+ return setCustomer;
213
+ }() // 计算优惠券
214
+ }, {
215
+ key: "calcDiscount",
216
+ value: function calcDiscount(productList, options) {
217
+ var rulesModule = this.core.getModule("".concat(this.name, "_rules"));
218
+ if (!rulesModule) {
219
+ return {
220
+ productList: productList,
221
+ discountList: this.getDiscountList()
222
+ };
223
+ }
224
+ var _ref = rulesModule.calcDiscount({
225
+ productList: productList,
226
+ discountList: this.getDiscountList()
227
+ }, options) || {
228
+ productList: productList,
229
+ discountList: this.getDiscountList()
230
+ },
231
+ newProductList = _ref.productList,
232
+ newDiscountList = _ref.discountList;
233
+ if (newDiscountList) {
234
+ this.setDiscountList(newDiscountList);
235
+ }
236
+ return {
237
+ productList: newProductList || productList,
238
+ discountList: newDiscountList || this.getDiscountList()
239
+ };
240
+ }
241
+
242
+ // 设置优惠券使用状态
243
+ }, {
244
+ key: "setDiscountSelected",
245
+ value: function setDiscountSelected(_ref2) {
246
+ var discountId = _ref2.discountId,
247
+ isSelected = _ref2.isSelected;
248
+ // 获取当前优惠券列表
249
+ var discountList = this.getDiscountList();
250
+
251
+ // 找到需要修改状态的优惠券
252
+ var newDiscountList = discountList.map(function (discount) {
253
+ if (discount.id === discountId) {
254
+ return _objectSpread(_objectSpread({}, discount), {}, {
255
+ isSelected: isSelected,
256
+ // 手动设置不使用
257
+ isManualSelect: !isSelected,
258
+ isUsed: isSelected
259
+ });
260
+ }
261
+ return discount;
262
+ });
263
+
264
+ // 更新优惠券列表
265
+ this.setDiscountList(newDiscountList);
266
+
267
+ // 如果取消选择优惠券,需要重新计算其他可用优惠券
268
+ return this.calcDiscount(this.store.productList || [], {
269
+ discountId: discountId,
270
+ isSelected: isSelected
271
+ });
272
+ }
273
+ }, {
274
+ key: "setProductList",
275
+ value: function setProductList(productList) {
276
+ this.store.productList = productList;
277
+ }
278
+
279
+ // 扫码输入code
280
+ }, {
281
+ key: "scanCode",
282
+ value: function () {
283
+ var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(code) {
284
+ var _this$store$discount3, resultDiscountList, rulesModule, _ref3, newProductList, newDiscountList, isAvailable;
285
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
286
+ while (1) switch (_context5.prev = _context5.next) {
287
+ case 0:
288
+ _context5.prev = 0;
289
+ _context5.next = 3;
290
+ return (_this$store$discount3 = this.store.discount) === null || _this$store$discount3 === void 0 ? void 0 : _this$store$discount3.batchSearch(code);
291
+ case 3:
292
+ _context5.t0 = _context5.sent;
293
+ if (_context5.t0) {
294
+ _context5.next = 6;
295
+ break;
296
+ }
297
+ _context5.t0 = [];
298
+ case 6:
299
+ resultDiscountList = _context5.t0;
300
+ rulesModule = this.store.rules;
301
+ if (rulesModule) {
302
+ _context5.next = 10;
303
+ break;
304
+ }
305
+ return _context5.abrupt("return", {
306
+ isAvailable: false,
307
+ productList: this.store.productList || [],
308
+ discountList: this.getDiscountList()
309
+ });
310
+ case 10:
311
+ _ref3 = rulesModule.isDiscountListAvailable({
312
+ productList: this.store.productList || [],
313
+ oldDiscountList: this.getDiscountList(),
314
+ newDiscountList: resultDiscountList
315
+ }) || {
316
+ isAvailable: false,
317
+ productList: this.store.productList || [],
318
+ discountList: this.getDiscountList()
319
+ }, newProductList = _ref3.productList, newDiscountList = _ref3.discountList, isAvailable = _ref3.isAvailable;
320
+ if (!isAvailable) {
321
+ _context5.next = 17;
322
+ break;
323
+ }
324
+ this.setDiscountList(newDiscountList || []);
325
+ this.setProductList(newProductList || []);
326
+ if (!(this.isWalkIn() && resultDiscountList.length)) {
327
+ _context5.next = 17;
328
+ break;
329
+ }
330
+ _context5.next = 17;
331
+ return this.getCustomerWallet(resultDiscountList[0].customer_id);
332
+ case 17:
333
+ return _context5.abrupt("return", {
334
+ isAvailable: isAvailable || false,
335
+ productList: newProductList || this.store.productList || [],
336
+ discountList: newDiscountList || this.getDiscountList()
337
+ });
338
+ case 20:
339
+ _context5.prev = 20;
340
+ _context5.t1 = _context5["catch"](0);
341
+ console.error("[ShopDiscount] 扫码出错:", _context5.t1);
342
+ return _context5.abrupt("return", {
343
+ isAvailable: false,
344
+ productList: this.store.productList || [],
345
+ discountList: this.getDiscountList()
346
+ });
347
+ case 24:
348
+ case "end":
349
+ return _context5.stop();
350
+ }
351
+ }, _callee5, this, [[0, 20]]);
352
+ }));
353
+ function scanCode(_x4) {
354
+ return _scanCode.apply(this, arguments);
355
+ }
356
+ return scanCode;
357
+ }()
358
+ }, {
359
+ key: "calcDiscountApplicableProductTotalPrice",
360
+ value: function calcDiscountApplicableProductTotalPrice(discount) {
361
+ var _this$store$discount4;
362
+ return (_this$store$discount4 = this.store.discount) === null || _this$store$discount4 === void 0 ? void 0 : _this$store$discount4.calcDiscountApplicableProductTotalPrice(discount);
363
+ }
364
+
365
+ // =========== 私有辅助方法 ===========
366
+
367
+ // 获取客户
368
+ }, {
369
+ key: "getCustomer",
370
+ value: function getCustomer() {
371
+ return this.store.customer;
372
+ }
373
+
374
+ // 是否是walkIn
375
+ }, {
376
+ key: "isWalkIn",
377
+ value: function isWalkIn() {
378
+ var _this$getCustomer;
379
+ return (((_this$getCustomer = this.getCustomer()) === null || _this$getCustomer === void 0 ? void 0 : _this$getCustomer.id) || 1) === 1;
380
+ }
381
+
382
+ // 触发优惠列表变更事件
383
+ }, {
384
+ key: "emitDiscountListChange",
385
+ value: function () {
386
+ var _emitDiscountListChange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(discountList) {
387
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
388
+ while (1) switch (_context6.prev = _context6.next) {
389
+ case 0:
390
+ _context6.next = 2;
391
+ return this.core.effects.emit(ShopDiscountHooks.onDiscountListChange, discountList);
392
+ case 2:
393
+ case "end":
394
+ return _context6.stop();
395
+ }
396
+ }, _callee6, this);
397
+ }));
398
+ function emitDiscountListChange(_x5) {
399
+ return _emitDiscountListChange.apply(this, arguments);
400
+ }
401
+ return emitDiscountListChange;
402
+ }() // 设置优惠券列表
403
+ }, {
404
+ key: "setDiscountList",
405
+ value: function () {
406
+ var _setDiscountList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(discountList) {
407
+ var _this$store$discount5;
408
+ var productList, editModeDiscountList, newDiscountList;
409
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
410
+ while (1) switch (_context7.prev = _context7.next) {
411
+ case 0:
412
+ productList = this.store.productList || [];
413
+ editModeDiscountList = [];
414
+ productList.forEach(function (item) {
415
+ if (item.booking_id) {
416
+ editModeDiscountList.push.apply(editModeDiscountList, _toConsumableArray((item.discount_list || []).map(function (item) {
417
+ return _objectSpread(_objectSpread({}, item), {}, {
418
+ isEditMode: true,
419
+ limited_relation_product_data: {},
420
+ savedAmount: item.amount,
421
+ isAvailable: true,
422
+ id: item.discount.resource_id,
423
+ format_title: item.discount.title,
424
+ isDisabled: true,
425
+ isSelected: true,
426
+ product_id: item.discount.product_id
427
+ });
428
+ })));
429
+ }
430
+ });
431
+ newDiscountList = uniqueById([].concat(editModeDiscountList, _toConsumableArray(discountList)), "product_id");
432
+ (_this$store$discount5 = this.store.discount) === null || _this$store$discount5 === void 0 || _this$store$discount5.setDiscountList(newDiscountList);
433
+ _context7.next = 7;
434
+ return this.emitDiscountListChange(newDiscountList);
435
+ case 7:
436
+ case "end":
437
+ return _context7.stop();
438
+ }
439
+ }, _callee7, this);
440
+ }));
441
+ function setDiscountList(_x6) {
442
+ return _setDiscountList.apply(this, arguments);
443
+ }
444
+ return setDiscountList;
445
+ }() // 获取优惠券列表
446
+ }, {
447
+ key: "getDiscountList",
448
+ value: function getDiscountList() {
449
+ var _this$store$discount6;
450
+ return ((_this$store$discount6 = this.store.discount) === null || _this$store$discount6 === void 0 ? void 0 : _this$store$discount6.getDiscountList()) || [];
451
+ }
452
+
453
+ // 获取客户钱包信息
454
+ }, {
455
+ key: "getCustomerWallet",
456
+ value: function () {
457
+ var _getCustomerWallet = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(id) {
458
+ var result, _result$data, wallet_pass_list, customer;
459
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
460
+ while (1) switch (_context8.prev = _context8.next) {
461
+ case 0:
462
+ _context8.prev = 0;
463
+ _context8.next = 3;
464
+ return this.request.get("/customer/info/wallet/".concat(id), {
465
+ wallet_pass_tags: ["good_pass"]
466
+ });
467
+ case 3:
468
+ result = _context8.sent;
469
+ if (result !== null && result !== void 0 && result.data) {
470
+ _result$data = result.data, wallet_pass_list = _result$data.wallet_pass_list, customer = _objectWithoutProperties(_result$data, _excluded);
471
+ this.setCustomer(customer);
472
+ }
473
+ _context8.next = 10;
474
+ break;
475
+ case 7:
476
+ _context8.prev = 7;
477
+ _context8.t0 = _context8["catch"](0);
478
+ console.error("[ShopDiscount] 获取客户钱包信息出错:", _context8.t0);
479
+ case 10:
480
+ case "end":
481
+ return _context8.stop();
482
+ }
483
+ }, _callee8, this, [[0, 7]]);
484
+ }));
485
+ function getCustomerWallet(_x7) {
486
+ return _getCustomerWallet.apply(this, arguments);
487
+ }
488
+ return getCustomerWallet;
489
+ }() // 加载准备配置
490
+ }, {
491
+ key: "loadPrepareConfig",
492
+ value: function () {
493
+ var _loadPrepareConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(params) {
494
+ var _this$getCustomer2, _this$store$discount7, _this$store$productLi, customerId, goodPassList, result;
495
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
496
+ while (1) switch (_context9.prev = _context9.next) {
497
+ case 0:
498
+ _context9.prev = 0;
499
+ customerId = params.customerId || ((_this$getCustomer2 = this.getCustomer()) === null || _this$getCustomer2 === void 0 ? void 0 : _this$getCustomer2.id);
500
+ if (!(customerId === 1 || !customerId)) {
501
+ _context9.next = 4;
502
+ break;
503
+ }
504
+ return _context9.abrupt("return");
505
+ case 4:
506
+ _context9.next = 6;
507
+ return (_this$store$discount7 = this.store.discount) === null || _this$store$discount7 === void 0 ? void 0 : _this$store$discount7.loadPrepareConfig({
508
+ customer_id: customerId,
509
+ action: "create",
510
+ with_good_pass: 1
511
+ });
512
+ case 6:
513
+ goodPassList = _context9.sent;
514
+ this.setDiscountList(goodPassList || []);
515
+ if (!((_this$store$productLi = this.store.productList) !== null && _this$store$productLi !== void 0 && _this$store$productLi.length)) {
516
+ _context9.next = 12;
517
+ break;
518
+ }
519
+ result = this.calcDiscount(this.store.productList);
520
+ _context9.next = 12;
521
+ return this.core.effects.emit(ShopDiscountHooks.onLoadPrepareCalcResult, result);
522
+ case 12:
523
+ _context9.next = 14;
524
+ return this.core.effects.emit(ShopDiscountHooks.onLoadDiscountList, goodPassList);
525
+ case 14:
526
+ _context9.next = 19;
527
+ break;
528
+ case 16:
529
+ _context9.prev = 16;
530
+ _context9.t0 = _context9["catch"](0);
531
+ console.error("[ShopDiscount] 加载准备配置出错:", _context9.t0);
532
+ case 19:
533
+ case "end":
534
+ return _context9.stop();
535
+ }
536
+ }, _callee9, this, [[0, 16]]);
537
+ }));
538
+ function loadPrepareConfig(_x8) {
539
+ return _loadPrepareConfig.apply(this, arguments);
540
+ }
541
+ return loadPrepareConfig;
542
+ }()
543
+ }]);
544
+ return ShopDiscountImpl;
545
+ }(BaseModule);
546
+ export default ShopDiscountImpl;
@@ -0,0 +1,24 @@
1
+ import { DiscountModule } from "../../modules/Discount";
2
+ import { RulesModule } from "../../modules/Rules";
3
+ export declare enum ShopDiscountHooks {
4
+ onInited = "shopDiscount:onInited",
5
+ onDestroy = "shopDiscount:onDestroy",
6
+ onLoadDiscountList = "shopDiscount:onLoadDiscountList",
7
+ onCustomerChange = "shopDiscount:onCustomerChange",
8
+ onDiscountListChange = "shopDiscount:onDiscountListChange",
9
+ onRulesListChange = "shopDiscount:onRulesListChange",
10
+ onLoadPrepareCalcResult = "shopDiscount:onLoadPrepareCalcResult"
11
+ }
12
+ export type Customer = {
13
+ id: string | number;
14
+ name: string;
15
+ email: string;
16
+ phone: string;
17
+ address: string;
18
+ };
19
+ export interface ShopDiscountState {
20
+ customer: null | Customer;
21
+ discount: DiscountModule | null;
22
+ rules: RulesModule | null;
23
+ productList: Record<string, any>[];
24
+ }
@@ -0,0 +1,10 @@
1
+ export var ShopDiscountHooks = /*#__PURE__*/function (ShopDiscountHooks) {
2
+ ShopDiscountHooks["onInited"] = "shopDiscount:onInited";
3
+ ShopDiscountHooks["onDestroy"] = "shopDiscount:onDestroy";
4
+ ShopDiscountHooks["onLoadDiscountList"] = "shopDiscount:onLoadDiscountList";
5
+ ShopDiscountHooks["onCustomerChange"] = "shopDiscount:onCustomerChange";
6
+ ShopDiscountHooks["onDiscountListChange"] = "shopDiscount:onDiscountListChange";
7
+ ShopDiscountHooks["onRulesListChange"] = "shopDiscount:onRulesListChange";
8
+ ShopDiscountHooks["onLoadPrepareCalcResult"] = "shopDiscount:onLoadPrepareCalcResult";
9
+ return ShopDiscountHooks;
10
+ }({});
@@ -0,0 +1 @@
1
+ export declare const uniqueById: <T>(arr: T[], key?: string) => T[];
@@ -0,0 +1,7 @@
1
+ export var uniqueById = function uniqueById(arr) {
2
+ var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "id";
3
+ var seen = new Set();
4
+ return arr.filter(function (item) {
5
+ return !seen.has(item[key]) && seen.add(item[key]);
6
+ });
7
+ };
@@ -1,2 +1,3 @@
1
1
  export * from './BuyTickets';
2
2
  export * from './BookingByStep';
3
+ export * from './ShopDiscount';
@@ -1,2 +1,3 @@
1
1
  export * from "./BuyTickets";
2
- export * from "./BookingByStep";
2
+ export * from "./BookingByStep";
3
+ export * from "./ShopDiscount";
package/lib/core/index.js CHANGED
@@ -125,7 +125,7 @@ var PisellOSCore = class {
125
125
  module2.name,
126
126
  (path, value) => {
127
127
  console.log("core 检测到模块值更新", module2.name, path, value);
128
- this.effects.emit(`${module2.name}:changed`, path, value);
128
+ this.effects.emit(`${module2.name}:changed`, { path, value });
129
129
  if (module2.storeChange)
130
130
  module2.storeChange(path, value);
131
131
  }
@@ -8,7 +8,7 @@ declare class EffectsManager {
8
8
  off(event: string, callback: EffectCallback): void;
9
9
  offByModuleDestroy(module: string): void;
10
10
  once(event: string, callback: EffectCallback): void;
11
- emit(event: string, payload: any, value: any): Promise<{
11
+ emit(event: string, payload: any): Promise<{
12
12
  status: boolean;
13
13
  data: any;
14
14
  }>;
@@ -51,7 +51,7 @@ var EffectsManager = class {
51
51
  };
52
52
  this.on(event, wrapper);
53
53
  }
54
- async emit(event, payload, value) {
54
+ async emit(event, payload) {
55
55
  const callbacks = this.listeners.get(event);
56
56
  if (!callbacks)
57
57
  return { status: true, data: [] };