@pisell/pisellos 3.0.56 → 3.0.57

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 (268) 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/Cart/index.js +1 -1
  9. package/dist/modules/Cart/utils/changePrice.d.ts +2 -2
  10. package/dist/modules/Cart/utils/changePrice.js +1 -1
  11. package/dist/modules/Customer/constants.d.ts +7 -0
  12. package/dist/modules/Customer/constants.js +12 -0
  13. package/dist/modules/Customer/index.d.ts +122 -0
  14. package/dist/modules/Customer/index.js +697 -0
  15. package/dist/modules/Customer/types.d.ts +146 -0
  16. package/dist/modules/Customer/types.js +41 -0
  17. package/dist/modules/Payment/cash.d.ts +11 -0
  18. package/dist/modules/Payment/cash.js +78 -0
  19. package/dist/modules/Payment/eftpos.d.ts +11 -0
  20. package/dist/modules/Payment/eftpos.js +80 -0
  21. package/dist/modules/Payment/index.d.ts +273 -9
  22. package/dist/modules/Payment/index.js +2525 -109
  23. package/dist/modules/Payment/types.d.ts +382 -30
  24. package/dist/modules/Payment/types.js +116 -14
  25. package/dist/modules/Payment/wallet.d.ts +11 -0
  26. package/dist/modules/Payment/wallet.js +78 -0
  27. package/dist/modules/Payment/walletpass.d.ts +0 -0
  28. package/dist/modules/Payment/walletpass.js +0 -0
  29. package/dist/modules/ProductList/index.d.ts +13 -3
  30. package/dist/modules/ProductList/index.js +52 -42
  31. package/dist/modules/ProductList/types.d.ts +0 -1
  32. package/dist/modules/Rules/index.js +27 -14
  33. package/dist/modules/Rules/types.d.ts +1 -0
  34. package/dist/modules/index.d.ts +1 -0
  35. package/dist/modules/index.js +1 -0
  36. package/dist/plugins/app-types/app/app.d.ts +83 -0
  37. package/dist/plugins/app-types/app/const.d.ts +4 -0
  38. package/dist/plugins/app-types/app/index.d.ts +14 -0
  39. package/dist/plugins/app-types/applicationManager/application.d.ts +50 -0
  40. package/dist/plugins/app-types/applicationManager/index.d.ts +13 -0
  41. package/dist/plugins/app-types/config.d.ts +3 -0
  42. package/dist/plugins/app-types/cookie/index.d.ts +13 -0
  43. package/dist/plugins/app-types/data/index.d.ts +8 -0
  44. package/dist/plugins/app-types/history/config.d.ts +24 -0
  45. package/dist/plugins/app-types/history/index.d.ts +20 -0
  46. package/dist/plugins/app-types/history/type.d.ts +2 -0
  47. package/dist/plugins/app-types/hooks/index.d.ts +12 -0
  48. package/dist/plugins/app-types/hooks/useDelayedValue/index.d.ts +2 -0
  49. package/dist/plugins/app-types/hooks/useDispatch/index.d.ts +2 -0
  50. package/dist/plugins/app-types/hooks/useLowCode/index.d.ts +13 -0
  51. package/dist/plugins/app-types/hooks/useStore/index.d.ts +6 -0
  52. package/dist/plugins/app-types/index.d.ts +6 -0
  53. package/dist/plugins/app-types/indexDB/index.d.ts +178 -0
  54. package/dist/plugins/app-types/locales/en.d.ts +3 -0
  55. package/dist/plugins/app-types/locales/index.d.ts +37 -0
  56. package/dist/plugins/app-types/locales/original.d.ts +3 -0
  57. package/dist/plugins/app-types/locales/type.d.ts +19 -0
  58. package/dist/plugins/app-types/locales/zh-CN.d.ts +3 -0
  59. package/dist/plugins/app-types/locales/zh-HK.d.ts +3 -0
  60. package/dist/plugins/app-types/logger/feishu.d.ts +11 -0
  61. package/dist/plugins/app-types/logger/index.d.ts +122 -0
  62. package/dist/plugins/app-types/menuManager/hooks.d.ts +17 -0
  63. package/dist/plugins/app-types/menuManager/index.d.ts +28 -0
  64. package/dist/plugins/app-types/models/global.d.ts +32 -0
  65. package/dist/plugins/app-types/models/index.d.ts +45 -0
  66. package/dist/plugins/app-types/models/type.d.ts +2 -0
  67. package/dist/plugins/app-types/package.json +15 -0
  68. package/dist/plugins/app-types/plugin/index.d.ts +0 -0
  69. package/dist/plugins/app-types/pubsub/example.d.ts +5 -0
  70. package/dist/plugins/app-types/pubsub/index.d.ts +63 -0
  71. package/dist/plugins/app-types/request/cache.d.ts +46 -0
  72. package/dist/plugins/app-types/request/cancelToken.d.ts +38 -0
  73. package/dist/plugins/app-types/request/config.d.ts +3 -0
  74. package/dist/plugins/app-types/request/constants.d.ts +2 -0
  75. package/dist/plugins/app-types/request/index.d.ts +24 -0
  76. package/dist/plugins/app-types/request/pisell2Request.d.ts +6 -0
  77. package/dist/plugins/app-types/request/type.d.ts +41 -0
  78. package/dist/plugins/app-types/request/utils.d.ts +46 -0
  79. package/dist/plugins/app-types/routes/config.d.ts +7 -0
  80. package/dist/plugins/app-types/routes/index.d.ts +28 -0
  81. package/dist/plugins/app-types/socket/components/SocketMonitorPage.d.ts +6 -0
  82. package/dist/plugins/app-types/socket/components/index.d.ts +2 -0
  83. package/dist/plugins/app-types/socket/constants.d.ts +33 -0
  84. package/dist/plugins/app-types/socket/events.d.ts +31 -0
  85. package/dist/plugins/app-types/socket/heartbeat.d.ts +66 -0
  86. package/dist/plugins/app-types/socket/index.d.ts +61 -0
  87. package/dist/plugins/app-types/socket/monitor.d.ts +169 -0
  88. package/dist/plugins/app-types/socket/reconnect.d.ts +61 -0
  89. package/dist/plugins/app-types/socket/socket.d.ts +129 -0
  90. package/dist/plugins/app-types/socket/types.d.ts +85 -0
  91. package/dist/plugins/app-types/storage/index.d.ts +17 -0
  92. package/dist/plugins/app-types/tasks/index.d.ts +77 -0
  93. package/dist/plugins/app-types/tasks/type.d.ts +62 -0
  94. package/dist/plugins/app-types/tasks/useTasks.d.ts +5 -0
  95. package/dist/plugins/app-types/type.d.ts +2 -0
  96. package/dist/plugins/app-types/variables/VariablesProvider.d.ts +7 -0
  97. package/dist/plugins/app-types/variables/config.d.ts +3 -0
  98. package/dist/plugins/app-types/variables/index.d.ts +6 -0
  99. package/dist/plugins/app-types/variables/type.d.ts +2 -0
  100. package/dist/plugins/app-types/website/index.d.ts +6 -0
  101. package/dist/plugins/app.d.ts +8 -0
  102. package/dist/plugins/app.js +1 -0
  103. package/dist/plugins/window.d.ts +1 -0
  104. package/dist/solution/BookingByStep/index.js +59 -35
  105. package/dist/solution/BookingByStep/types.d.ts +3 -2
  106. package/dist/solution/BookingTicket/index.d.ts +172 -0
  107. package/dist/solution/BookingTicket/index.js +665 -0
  108. package/dist/solution/BookingTicket/types.d.ts +68 -0
  109. package/dist/solution/BookingTicket/types.js +43 -0
  110. package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +22 -0
  111. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +159 -0
  112. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +16 -0
  113. package/dist/solution/BookingTicket/utils/scan/handleScan.js +174 -0
  114. package/dist/solution/BookingTicket/utils/scan/index.d.ts +81 -0
  115. package/dist/solution/BookingTicket/utils/scan/index.js +285 -0
  116. package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +78 -0
  117. package/dist/solution/BookingTicket/utils/scan/scanCache.js +305 -0
  118. package/dist/solution/BuyTickets/index.d.ts +2 -2
  119. package/dist/solution/BuyTickets/index.js +1 -1
  120. package/dist/solution/Checkout/appointmentDemo.json +1 -0
  121. package/dist/solution/Checkout/index.d.ts +181 -0
  122. package/dist/solution/Checkout/index.js +1596 -0
  123. package/dist/solution/Checkout/types.d.ts +550 -0
  124. package/dist/solution/Checkout/types.js +132 -0
  125. package/dist/solution/Checkout/utils/index.d.ts +73 -0
  126. package/dist/solution/Checkout/utils/index.js +371 -0
  127. package/dist/solution/ShopDiscount/index.js +4 -2
  128. package/dist/solution/index.d.ts +2 -0
  129. package/dist/solution/index.js +3 -1
  130. package/dist/types/index.d.ts +3 -1
  131. package/dist/utils/task.d.ts +40 -0
  132. package/dist/utils/task.js +171 -0
  133. package/dist/utils/watch.d.ts +102 -0
  134. package/dist/utils/watch.js +294 -0
  135. package/lib/core/index.js +1 -1
  136. package/lib/effects/index.d.ts +4 -3
  137. package/lib/effects/index.js +4 -1
  138. package/lib/modules/AccountList/index.d.ts +7 -1
  139. package/lib/modules/AccountList/index.js +27 -0
  140. package/lib/modules/AccountList/types.d.ts +28 -0
  141. package/lib/modules/Cart/index.js +1 -1
  142. package/lib/modules/Cart/utils/changePrice.d.ts +2 -2
  143. package/lib/modules/Cart/utils/changePrice.js +1 -1
  144. package/lib/modules/Customer/constants.d.ts +7 -0
  145. package/lib/modules/Customer/constants.js +39 -0
  146. package/lib/modules/Customer/index.d.ts +122 -0
  147. package/lib/modules/Customer/index.js +440 -0
  148. package/lib/modules/Customer/types.d.ts +146 -0
  149. package/lib/modules/Customer/types.js +37 -0
  150. package/lib/modules/Payment/cash.d.ts +11 -0
  151. package/lib/modules/Payment/cash.js +51 -0
  152. package/lib/modules/Payment/eftpos.d.ts +11 -0
  153. package/lib/modules/Payment/eftpos.js +51 -0
  154. package/lib/modules/Payment/index.d.ts +273 -9
  155. package/lib/modules/Payment/index.js +1285 -50
  156. package/lib/modules/Payment/types.d.ts +382 -30
  157. package/lib/modules/Payment/types.js +41 -6
  158. package/lib/modules/Payment/wallet.d.ts +11 -0
  159. package/lib/modules/Payment/wallet.js +51 -0
  160. package/lib/modules/Payment/walletpass.d.ts +0 -0
  161. package/lib/modules/Payment/walletpass.js +0 -0
  162. package/lib/modules/ProductList/index.d.ts +13 -3
  163. package/lib/modules/ProductList/index.js +37 -26
  164. package/lib/modules/ProductList/types.d.ts +0 -1
  165. package/lib/modules/Rules/index.js +20 -12
  166. package/lib/modules/Rules/types.d.ts +1 -0
  167. package/lib/modules/index.d.ts +1 -0
  168. package/lib/modules/index.js +2 -0
  169. package/lib/plugins/app-types/app/app.d.ts +83 -0
  170. package/lib/plugins/app-types/app/const.d.ts +4 -0
  171. package/lib/plugins/app-types/app/index.d.ts +14 -0
  172. package/lib/plugins/app-types/applicationManager/application.d.ts +50 -0
  173. package/lib/plugins/app-types/applicationManager/index.d.ts +13 -0
  174. package/lib/plugins/app-types/config.d.ts +3 -0
  175. package/lib/plugins/app-types/cookie/index.d.ts +13 -0
  176. package/lib/plugins/app-types/data/index.d.ts +8 -0
  177. package/lib/plugins/app-types/history/config.d.ts +24 -0
  178. package/lib/plugins/app-types/history/index.d.ts +20 -0
  179. package/lib/plugins/app-types/history/type.d.ts +2 -0
  180. package/lib/plugins/app-types/hooks/index.d.ts +12 -0
  181. package/lib/plugins/app-types/hooks/useDelayedValue/index.d.ts +2 -0
  182. package/lib/plugins/app-types/hooks/useDispatch/index.d.ts +2 -0
  183. package/lib/plugins/app-types/hooks/useLowCode/index.d.ts +13 -0
  184. package/lib/plugins/app-types/hooks/useStore/index.d.ts +6 -0
  185. package/lib/plugins/app-types/index.d.ts +6 -0
  186. package/lib/plugins/app-types/indexDB/index.d.ts +178 -0
  187. package/lib/plugins/app-types/locales/en.d.ts +3 -0
  188. package/lib/plugins/app-types/locales/index.d.ts +37 -0
  189. package/lib/plugins/app-types/locales/original.d.ts +3 -0
  190. package/lib/plugins/app-types/locales/type.d.ts +19 -0
  191. package/lib/plugins/app-types/locales/zh-CN.d.ts +3 -0
  192. package/lib/plugins/app-types/locales/zh-HK.d.ts +3 -0
  193. package/lib/plugins/app-types/logger/feishu.d.ts +11 -0
  194. package/lib/plugins/app-types/logger/index.d.ts +122 -0
  195. package/lib/plugins/app-types/menuManager/hooks.d.ts +17 -0
  196. package/lib/plugins/app-types/menuManager/index.d.ts +28 -0
  197. package/lib/plugins/app-types/models/global.d.ts +32 -0
  198. package/lib/plugins/app-types/models/index.d.ts +45 -0
  199. package/lib/plugins/app-types/models/type.d.ts +2 -0
  200. package/lib/plugins/app-types/package.json +15 -0
  201. package/lib/plugins/app-types/plugin/index.d.ts +0 -0
  202. package/lib/plugins/app-types/pubsub/example.d.ts +5 -0
  203. package/lib/plugins/app-types/pubsub/index.d.ts +63 -0
  204. package/lib/plugins/app-types/request/cache.d.ts +46 -0
  205. package/lib/plugins/app-types/request/cancelToken.d.ts +38 -0
  206. package/lib/plugins/app-types/request/config.d.ts +3 -0
  207. package/lib/plugins/app-types/request/constants.d.ts +2 -0
  208. package/lib/plugins/app-types/request/index.d.ts +24 -0
  209. package/lib/plugins/app-types/request/pisell2Request.d.ts +6 -0
  210. package/lib/plugins/app-types/request/type.d.ts +41 -0
  211. package/lib/plugins/app-types/request/utils.d.ts +46 -0
  212. package/lib/plugins/app-types/routes/config.d.ts +7 -0
  213. package/lib/plugins/app-types/routes/index.d.ts +28 -0
  214. package/lib/plugins/app-types/socket/components/SocketMonitorPage.d.ts +6 -0
  215. package/lib/plugins/app-types/socket/components/index.d.ts +2 -0
  216. package/lib/plugins/app-types/socket/constants.d.ts +33 -0
  217. package/lib/plugins/app-types/socket/events.d.ts +31 -0
  218. package/lib/plugins/app-types/socket/heartbeat.d.ts +66 -0
  219. package/lib/plugins/app-types/socket/index.d.ts +61 -0
  220. package/lib/plugins/app-types/socket/monitor.d.ts +169 -0
  221. package/lib/plugins/app-types/socket/reconnect.d.ts +61 -0
  222. package/lib/plugins/app-types/socket/socket.d.ts +129 -0
  223. package/lib/plugins/app-types/socket/types.d.ts +85 -0
  224. package/lib/plugins/app-types/storage/index.d.ts +17 -0
  225. package/lib/plugins/app-types/tasks/index.d.ts +77 -0
  226. package/lib/plugins/app-types/tasks/type.d.ts +62 -0
  227. package/lib/plugins/app-types/tasks/useTasks.d.ts +5 -0
  228. package/lib/plugins/app-types/type.d.ts +2 -0
  229. package/lib/plugins/app-types/variables/VariablesProvider.d.ts +7 -0
  230. package/lib/plugins/app-types/variables/config.d.ts +3 -0
  231. package/lib/plugins/app-types/variables/index.d.ts +6 -0
  232. package/lib/plugins/app-types/variables/type.d.ts +2 -0
  233. package/lib/plugins/app-types/website/index.d.ts +6 -0
  234. package/lib/plugins/app.d.ts +8 -0
  235. package/lib/plugins/app.js +17 -0
  236. package/lib/plugins/window.d.ts +1 -0
  237. package/lib/solution/BookingByStep/index.js +40 -29
  238. package/lib/solution/BookingByStep/types.d.ts +3 -2
  239. package/lib/solution/BookingTicket/index.d.ts +172 -0
  240. package/lib/solution/BookingTicket/index.js +399 -0
  241. package/lib/solution/BookingTicket/types.d.ts +68 -0
  242. package/lib/solution/BookingTicket/types.js +72 -0
  243. package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +22 -0
  244. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +117 -0
  245. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +16 -0
  246. package/lib/solution/BookingTicket/utils/scan/handleScan.js +125 -0
  247. package/lib/solution/BookingTicket/utils/scan/index.d.ts +81 -0
  248. package/lib/solution/BookingTicket/utils/scan/index.js +210 -0
  249. package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +78 -0
  250. package/lib/solution/BookingTicket/utils/scan/scanCache.js +231 -0
  251. package/lib/solution/BuyTickets/index.d.ts +2 -2
  252. package/lib/solution/BuyTickets/index.js +1 -1
  253. package/lib/solution/Checkout/appointmentDemo.json +1 -0
  254. package/lib/solution/Checkout/index.d.ts +181 -0
  255. package/lib/solution/Checkout/index.js +864 -0
  256. package/lib/solution/Checkout/types.d.ts +550 -0
  257. package/lib/solution/Checkout/types.js +75 -0
  258. package/lib/solution/Checkout/utils/index.d.ts +73 -0
  259. package/lib/solution/Checkout/utils/index.js +266 -0
  260. package/lib/solution/ShopDiscount/index.js +2 -1
  261. package/lib/solution/index.d.ts +2 -0
  262. package/lib/solution/index.js +5 -1
  263. package/lib/types/index.d.ts +3 -1
  264. package/lib/utils/task.d.ts +40 -0
  265. package/lib/utils/task.js +109 -0
  266. package/lib/utils/watch.d.ts +102 -0
  267. package/lib/utils/watch.js +217 -0
  268. package/package.json +4 -2
@@ -0,0 +1,665 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _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; }
3
+ 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; }
4
+ 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; }
5
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
6
+ 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); }); }; }
7
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
8
+ 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); } }
9
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
10
+ 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); }
11
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
12
+ 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); }; }
13
+ 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); }
14
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
15
+ 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; } }
16
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
17
+ 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; }
18
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
19
+ 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); }
20
+ import { BaseModule } from "../../modules/BaseModule";
21
+ import { BookingTicketHooks, createModule } from "./types";
22
+ import Scan from "./utils/scan";
23
+ import { handleGlobalScan, handleCustomerScan } from "./utils/scan/handleScan";
24
+ import scanCache from "./utils/scan/scanCache";
25
+ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
26
+ _inherits(BookingTicketImpl, _BaseModule);
27
+ var _super = _createSuper(BookingTicketImpl);
28
+ function BookingTicketImpl() {
29
+ var _this;
30
+ _classCallCheck(this, BookingTicketImpl);
31
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
32
+ args[_key] = arguments[_key];
33
+ }
34
+ _this = _super.call.apply(_super, [this].concat(args));
35
+ _defineProperty(_assertThisInitialized(_this), "defaultName", 'bookingTicket');
36
+ _defineProperty(_assertThisInitialized(_this), "defaultVersion", '1.0.0');
37
+ _defineProperty(_assertThisInitialized(_this), "isSolution", true);
38
+ _defineProperty(_assertThisInitialized(_this), "request", void 0);
39
+ _defineProperty(_assertThisInitialized(_this), "window", void 0);
40
+ _defineProperty(_assertThisInitialized(_this), "shopStore", void 0);
41
+ _defineProperty(_assertThisInitialized(_this), "store", void 0);
42
+ _defineProperty(_assertThisInitialized(_this), "otherParams", {});
43
+ _defineProperty(_assertThisInitialized(_this), "cacheId", void 0);
44
+ _defineProperty(_assertThisInitialized(_this), "platform", void 0);
45
+ // 平台类型,用于判断是 PC / H5
46
+ _defineProperty(_assertThisInitialized(_this), "scan", void 0);
47
+ return _this;
48
+ }
49
+ _createClass(BookingTicketImpl, [{
50
+ key: "initialize",
51
+ value: function () {
52
+ var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
53
+ var _this$otherParams,
54
+ _this$otherParams2,
55
+ _this$otherParams3,
56
+ _this2 = this;
57
+ var targetCacheData, sessionData, _data, moduleArr;
58
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
59
+ while (1) switch (_context.prev = _context.next) {
60
+ case 0:
61
+ this.core = core;
62
+ this.store = options.store || {};
63
+ this.otherParams = options.otherParams || {};
64
+ console.log('[BookingTicket] 初始化完成');
65
+
66
+ // 获取依赖的插件
67
+ this.request = core.getPlugin('request');
68
+ this.window = core.getPlugin('window');
69
+ this.shopStore = core.getPlugin('shopStore');
70
+ if (this.request) {
71
+ _context.next = 9;
72
+ break;
73
+ }
74
+ throw new Error('bookingTicket解决方案需要 request 插件支持');
75
+ case 9:
76
+ if (this.shopStore) {
77
+ _context.next = 11;
78
+ break;
79
+ }
80
+ throw new Error('bookingTicket解决方案需要 shopStore 插件支持');
81
+ case 11:
82
+ // 如果有传 cacheid,默认需要收集上面这些模块里用户操作选中的数据
83
+ targetCacheData = {};
84
+ this.cacheId = (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.cacheId;
85
+ this.platform = (_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.platform;
86
+ this.scan = new Scan(this, 'BOOKING_TICKET_SCAN');
87
+ if ((_this$otherParams3 = this.otherParams) !== null && _this$otherParams3 !== void 0 && _this$otherParams3.cacheId) {
88
+ sessionData = this.window.sessionStorage.getItem(this.name);
89
+ if (sessionData) {
90
+ _data = JSON.parse(sessionData);
91
+ targetCacheData = _data[this.otherParams.cacheId];
92
+ }
93
+ }
94
+ moduleArr = ['cart', 'products', 'accountList', 'customer', 'order'];
95
+ moduleArr.forEach(function (step) {
96
+ var targetModule = createModule(step, _this2.name);
97
+ if (targetModule) {
98
+ var _targetCacheData, _this2$otherParams, _this2$otherParams2;
99
+ _this2.store[step] = targetModule;
100
+ _this2.core.registerModule(targetModule, {
101
+ initialState: (_targetCacheData = targetCacheData) === null || _targetCacheData === void 0 ? void 0 : _targetCacheData[targetModule.name],
102
+ otherParams: _objectSpread(_objectSpread({}, _this2.otherParams), {}, {
103
+ fatherModule: _this2.name,
104
+ openCache: (_this2$otherParams = _this2.otherParams) !== null && _this2$otherParams !== void 0 && _this2$otherParams.cacheId ? true : false,
105
+ cacheId: (_this2$otherParams2 = _this2.otherParams) === null || _this2$otherParams2 === void 0 ? void 0 : _this2$otherParams2.cacheId
106
+ })
107
+ });
108
+ } else {
109
+ throw new Error("\u6A21\u5757 ".concat(step, " \u4E0D\u5B58\u5728"));
110
+ }
111
+ });
112
+ this.core.effects.emit(BookingTicketHooks.onInited, {});
113
+ case 19:
114
+ case "end":
115
+ return _context.stop();
116
+ }
117
+ }, _callee, this);
118
+ }));
119
+ function initialize(_x, _x2) {
120
+ return _initialize.apply(this, arguments);
121
+ }
122
+ return initialize;
123
+ }()
124
+ /**
125
+ * 获取商品列表
126
+ * @param params 包含 schedule_date 的参数
127
+ * @returns 商品列表
128
+ */
129
+ }, {
130
+ key: "loadProducts",
131
+ value: (function () {
132
+ var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
133
+ var params,
134
+ schedule_date,
135
+ customer_id,
136
+ menu_list_ids,
137
+ schedule_datetime,
138
+ result,
139
+ _args2 = arguments;
140
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
141
+ while (1) switch (_context2.prev = _context2.next) {
142
+ case 0:
143
+ params = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
144
+ schedule_date = params.schedule_date, customer_id = params.customer_id, menu_list_ids = params.menu_list_ids, schedule_datetime = params.schedule_datetime;
145
+ _context2.prev = 2;
146
+ _context2.next = 5;
147
+ return this.store.products.loadProducts(_objectSpread(_objectSpread({
148
+ with_count: ['bundleGroup', 'optionGroup'],
149
+ with_schedule: 1
150
+ }, params), {}, {
151
+ cacheId: this.cacheId
152
+ }));
153
+ case 5:
154
+ result = _context2.sent;
155
+ this.core.effects.emit(BookingTicketHooks.onProductsLoaded, result);
156
+ return _context2.abrupt("return", result);
157
+ case 10:
158
+ _context2.prev = 10;
159
+ _context2.t0 = _context2["catch"](2);
160
+ console.error('Failed to load products:', _context2.t0);
161
+ throw _context2.t0;
162
+ case 14:
163
+ case "end":
164
+ return _context2.stop();
165
+ }
166
+ }, _callee2, this, [[2, 10]]);
167
+ }));
168
+ function loadProducts() {
169
+ return _loadProducts.apply(this, arguments);
170
+ }
171
+ return loadProducts;
172
+ }()
173
+ /**
174
+ * 获取商品列表(不加载到模块中)
175
+ * @returns 商品列表
176
+ */
177
+ )
178
+ }, {
179
+ key: "getProducts",
180
+ value: (function () {
181
+ var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
182
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
183
+ while (1) switch (_context3.prev = _context3.next) {
184
+ case 0:
185
+ return _context3.abrupt("return", this.store.products.getProducts());
186
+ case 1:
187
+ case "end":
188
+ return _context3.stop();
189
+ }
190
+ }, _callee3, this);
191
+ }));
192
+ function getProducts() {
193
+ return _getProducts.apply(this, arguments);
194
+ }
195
+ return getProducts;
196
+ }()
197
+ /**
198
+ * 获取客户列表
199
+ * @param params 查询参数
200
+ * @returns 客户列表响应
201
+ */
202
+ )
203
+ }, {
204
+ key: "getCustomerList",
205
+ value: (function () {
206
+ var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
207
+ var params,
208
+ result,
209
+ _args4 = arguments;
210
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
211
+ while (1) switch (_context4.prev = _context4.next) {
212
+ case 0:
213
+ params = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};
214
+ _context4.prev = 1;
215
+ _context4.next = 4;
216
+ return this.store.customer.getCustomerList(params);
217
+ case 4:
218
+ result = _context4.sent;
219
+ return _context4.abrupt("return", result);
220
+ case 8:
221
+ _context4.prev = 8;
222
+ _context4.t0 = _context4["catch"](1);
223
+ console.error('Failed to get customer list:', _context4.t0);
224
+ throw _context4.t0;
225
+ case 12:
226
+ case "end":
227
+ return _context4.stop();
228
+ }
229
+ }, _callee4, this, [[1, 8]]);
230
+ }));
231
+ function getCustomerList() {
232
+ return _getCustomerList.apply(this, arguments);
233
+ }
234
+ return getCustomerList;
235
+ }()
236
+ /**
237
+ * 设置活跃客户
238
+ * @param customer 客户信息
239
+ */
240
+ )
241
+ }, {
242
+ key: "setActiveCustomer",
243
+ value: function setActiveCustomer(customer) {
244
+ this.store.customer.setSelectedCustomer(customer);
245
+ this.core.effects.emit(BookingTicketHooks.onCustomerSelected, {
246
+ customer: customer
247
+ });
248
+ }
249
+
250
+ /**
251
+ * 获取当前活跃客户
252
+ * @returns 当前活跃客户
253
+ */
254
+ }, {
255
+ key: "getActiveCustomer",
256
+ value: function getActiveCustomer() {
257
+ return this.store.customer.getSelectedCustomer();
258
+ }
259
+
260
+ /**
261
+ * 根据ID设置选中的客户
262
+ * @param customerId 客户ID
263
+ */
264
+ }, {
265
+ key: "setSelectedCustomerById",
266
+ value: function setSelectedCustomerById(customerId) {
267
+ var customer = this.store.customer.getCustomerById(customerId);
268
+ if (customer) {
269
+ this.store.customer.setSelectedCustomer(customer);
270
+ this.core.effects.emit(BookingTicketHooks.onCustomerSelected, {
271
+ customer: customer
272
+ });
273
+ }
274
+ }
275
+
276
+ /**
277
+ * 获取所有客户
278
+ * @returns 客户列表
279
+ */
280
+ }, {
281
+ key: "getCustomers",
282
+ value: function getCustomers() {
283
+ return this.store.customer.getCustomers();
284
+ }
285
+
286
+ /**
287
+ * 根据ID获取客户
288
+ * @param customerId 客户ID
289
+ * @returns 客户信息
290
+ */
291
+ }, {
292
+ key: "getCustomerById",
293
+ value: function getCustomerById(customerId) {
294
+ return this.store.customer.getCustomerById(customerId);
295
+ }
296
+
297
+ /**
298
+ * 清空客户列表
299
+ */
300
+ }, {
301
+ key: "clearCustomers",
302
+ value: function clearCustomers() {
303
+ this.store.customer.clearCustomers();
304
+ }
305
+
306
+ /**
307
+ * 添加客户到列表第一位
308
+ * @param customer 要添加的客户信息
309
+ */
310
+ }, {
311
+ key: "addCustomerToFirst",
312
+ value: function addCustomerToFirst(customer) {
313
+ this.store.customer.addCustomerToFirst(customer);
314
+ }
315
+
316
+ /**
317
+ * 获取客户分页信息
318
+ * @returns 分页信息
319
+ */
320
+ }, {
321
+ key: "getCustomerPaginationInfo",
322
+ value: function getCustomerPaginationInfo() {
323
+ return this.store.customer.getPaginationInfo();
324
+ }
325
+
326
+ /**
327
+ * 获取客户列表总数
328
+ * @returns 总数
329
+ */
330
+ }, {
331
+ key: "getCustomerTotal",
332
+ value: function getCustomerTotal() {
333
+ return this.store.customer.getState().total;
334
+ }
335
+
336
+ /**
337
+ * 设置客户分页信息
338
+ * @param page 页码
339
+ * @param pageSize 每页数量
340
+ */
341
+ }, {
342
+ key: "setCustomerPaginationInfo",
343
+ value: function setCustomerPaginationInfo(page, pageSize) {
344
+ this.store.customer.setPaginationInfo(page, pageSize);
345
+ }
346
+
347
+ /**
348
+ * 便捷方法:切换客户分页并自动获取数据
349
+ * @param page 页码
350
+ * @param pageSize 每页数量(可选)
351
+ * @returns 客户列表响应
352
+ */
353
+ }, {
354
+ key: "changeCustomerPage",
355
+ value: (function () {
356
+ var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(page, pageSize) {
357
+ var result;
358
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
359
+ while (1) switch (_context5.prev = _context5.next) {
360
+ case 0:
361
+ _context5.prev = 0;
362
+ _context5.next = 3;
363
+ return this.store.customer.changeCustomerPage(page, pageSize);
364
+ case 3:
365
+ result = _context5.sent;
366
+ return _context5.abrupt("return", result);
367
+ case 7:
368
+ _context5.prev = 7;
369
+ _context5.t0 = _context5["catch"](0);
370
+ console.error('Failed to change customer page:', _context5.t0);
371
+ throw _context5.t0;
372
+ case 11:
373
+ case "end":
374
+ return _context5.stop();
375
+ }
376
+ }, _callee5, this, [[0, 7]]);
377
+ }));
378
+ function changeCustomerPage(_x3, _x4) {
379
+ return _changeCustomerPage.apply(this, arguments);
380
+ }
381
+ return changeCustomerPage;
382
+ }()
383
+ /**
384
+ * 滚动加载更多客户数据 - 数据会追加到现有列表中
385
+ * @returns 客户列表响应
386
+ */
387
+ )
388
+ }, {
389
+ key: "loadMoreCustomers",
390
+ value: (function () {
391
+ var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
392
+ var result;
393
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
394
+ while (1) switch (_context6.prev = _context6.next) {
395
+ case 0:
396
+ _context6.prev = 0;
397
+ _context6.next = 3;
398
+ return this.store.customer.loadMoreCustomers();
399
+ case 3:
400
+ result = _context6.sent;
401
+ this.core.effects.emit(BookingTicketHooks.onCustomerListUpdate, result);
402
+ return _context6.abrupt("return", result);
403
+ case 8:
404
+ _context6.prev = 8;
405
+ _context6.t0 = _context6["catch"](0);
406
+ console.error('Failed to load more customers:', _context6.t0);
407
+ throw _context6.t0;
408
+ case 12:
409
+ case "end":
410
+ return _context6.stop();
411
+ }
412
+ }, _callee6, this, [[0, 8]]);
413
+ }));
414
+ function loadMoreCustomers() {
415
+ return _loadMoreCustomers.apply(this, arguments);
416
+ }
417
+ return loadMoreCustomers;
418
+ }()
419
+ /**
420
+ * 重置并重新开始滚动加载客户数据
421
+ * @param params 查询参数
422
+ * @returns 客户列表响应
423
+ */
424
+ )
425
+ }, {
426
+ key: "resetAndLoadCustomers",
427
+ value: (function () {
428
+ var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
429
+ var params,
430
+ result,
431
+ _args7 = arguments;
432
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
433
+ while (1) switch (_context7.prev = _context7.next) {
434
+ case 0:
435
+ params = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {};
436
+ _context7.prev = 1;
437
+ _context7.next = 4;
438
+ return this.store.customer.resetAndLoadCustomers(params);
439
+ case 4:
440
+ result = _context7.sent;
441
+ this.core.effects.emit(BookingTicketHooks.onCustomerListReset, result);
442
+ return _context7.abrupt("return", result);
443
+ case 9:
444
+ _context7.prev = 9;
445
+ _context7.t0 = _context7["catch"](1);
446
+ console.error('Failed to reset and load customers:', _context7.t0);
447
+ throw _context7.t0;
448
+ case 13:
449
+ case "end":
450
+ return _context7.stop();
451
+ }
452
+ }, _callee7, this, [[1, 9]]);
453
+ }));
454
+ function resetAndLoadCustomers() {
455
+ return _resetAndLoadCustomers.apply(this, arguments);
456
+ }
457
+ return resetAndLoadCustomers;
458
+ }()
459
+ /**
460
+ * 检查是否还有更多客户数据可以加载
461
+ * @returns 是否还有更多数据
462
+ */
463
+ )
464
+ }, {
465
+ key: "hasMoreCustomers",
466
+ value: function hasMoreCustomers() {
467
+ return this.store.customer.hasMoreCustomers();
468
+ }
469
+
470
+ /**
471
+ * 获取当前的客户搜索条件
472
+ * @returns 当前搜索条件
473
+ */
474
+ }, {
475
+ key: "getCurrentCustomerSearchParams",
476
+ value: function getCurrentCustomerSearchParams() {
477
+ return this.store.customer.getCurrentSearchParams();
478
+ }
479
+
480
+ /**
481
+ * 获取客户列表状态(包含滚动加载相关状态)
482
+ * @returns 客户状态
483
+ */
484
+ }, {
485
+ key: "getCustomerState",
486
+ value: function getCustomerState() {
487
+ return this.store.customer.getState();
488
+ }
489
+
490
+ /**
491
+ * 全局扫描监听
492
+ * @param callback 回调
493
+ */
494
+ }, {
495
+ key: "scanGlobalListener",
496
+ value: function scanGlobalListener(callback) {
497
+ var _this3 = this;
498
+ var localSearch = function localSearch(v) {
499
+ return _this3.store.products.findProductsByCodeOrBarcode(v);
500
+ };
501
+ var scanCallback = handleGlobalScan(this.request, localSearch);
502
+ var safeCallback = function safeCallback(d) {
503
+ try {
504
+ callback(d);
505
+ } catch (error) {
506
+ console.error('scanGlobalListener回掉函数异常', error);
507
+ }
508
+ };
509
+ var listener = {
510
+ key: 'global',
511
+ callback: safeCallback
512
+ };
513
+ var removeListener = this.scan.addListener(listener, scanCallback);
514
+ return removeListener;
515
+ }
516
+
517
+ /**
518
+ * 客户扫描监听
519
+ * @param callback 回调
520
+ */
521
+ }, {
522
+ key: "scanCustomerListener",
523
+ value: function scanCustomerListener(callback) {
524
+ var scanCallback = handleCustomerScan();
525
+ var safeCallback = function safeCallback(d) {
526
+ try {
527
+ callback(d);
528
+ } catch (error) {
529
+ console.error('scanCustomerListener回掉函数异常', error);
530
+ }
531
+ };
532
+ var listener = {
533
+ key: 'customer',
534
+ callback: safeCallback
535
+ };
536
+ var removeListener = this.scan.addListener(listener, scanCallback);
537
+ return removeListener;
538
+ }
539
+
540
+ /**
541
+ * 调用摄像头
542
+ * @param data 用户自定义数据
543
+ */
544
+ }, {
545
+ key: "activateCamera",
546
+ value: function activateCamera(data) {
547
+ var _this$window, _this$window$postMess;
548
+ (_this$window = this.window) === null || _this$window === void 0 || (_this$window = _this$window.interaction) === null || _this$window === void 0 || (_this$window = _this$window.utils) === null || _this$window === void 0 || (_this$window$postMess = _this$window.postMessageToApp) === null || _this$window$postMess === void 0 || _this$window$postMess.call(_this$window, {
549
+ module: 'global',
550
+ key: 'active_native_scanner',
551
+ data: data
552
+ });
553
+ }
554
+
555
+ /**
556
+ * 禁用所有扫描监听
557
+ */
558
+ }, {
559
+ key: "disableAllScanListeners",
560
+ value: function disableAllScanListeners() {
561
+ this.scan.disableAllListeners();
562
+ }
563
+
564
+ /**
565
+ * 启用所有扫描监听
566
+ */
567
+ }, {
568
+ key: "enableAllScanListeners",
569
+ value: function enableAllScanListeners() {
570
+ this.scan.enableAllListeners();
571
+ }
572
+
573
+ /**
574
+ * 清空所有扫描监听对应的任务执行队列
575
+ */
576
+ }, {
577
+ key: "clearAllScanListenersTaskQueue",
578
+ value: function clearAllScanListenersTaskQueue() {
579
+ this.scan.clearTaskQueue();
580
+ }
581
+
582
+ /**
583
+ * 设置其他参数
584
+ * @param params 参数
585
+ * @param options 选项
586
+ */
587
+ }, {
588
+ key: "setOtherParams",
589
+ value: (function () {
590
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(params) {
591
+ var _ref,
592
+ _ref$cover,
593
+ cover,
594
+ _args8 = arguments;
595
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
596
+ while (1) switch (_context8.prev = _context8.next) {
597
+ case 0:
598
+ _ref = _args8.length > 1 && _args8[1] !== undefined ? _args8[1] : {}, _ref$cover = _ref.cover, cover = _ref$cover === void 0 ? false : _ref$cover;
599
+ if (cover) {
600
+ this.otherParams = params;
601
+ } else {
602
+ this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), params);
603
+ }
604
+ case 2:
605
+ case "end":
606
+ return _context8.stop();
607
+ }
608
+ }, _callee8, this);
609
+ }));
610
+ function setOtherParams(_x5) {
611
+ return _setOtherParams.apply(this, arguments);
612
+ }
613
+ return setOtherParams;
614
+ }()
615
+ /**
616
+ * 获取其他参数
617
+ * @returns 其他参数
618
+ */
619
+ )
620
+ }, {
621
+ key: "getOtherParams",
622
+ value: (function () {
623
+ var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
624
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
625
+ while (1) switch (_context9.prev = _context9.next) {
626
+ case 0:
627
+ return _context9.abrupt("return", this.otherParams);
628
+ case 1:
629
+ case "end":
630
+ return _context9.stop();
631
+ }
632
+ }, _callee9, this);
633
+ }));
634
+ function getOtherParams() {
635
+ return _getOtherParams.apply(this, arguments);
636
+ }
637
+ return getOtherParams;
638
+ }()
639
+ /**
640
+ * 销毁模块
641
+ */
642
+ )
643
+ }, {
644
+ key: "destroy",
645
+ value: function destroy() {
646
+ var _this$store$cart, _this$store$products, _this$store$accountLi, _this$store$customer, _this$store$order;
647
+ (_this$store$cart = this.store.cart) === null || _this$store$cart === void 0 || _this$store$cart.destroy();
648
+ (_this$store$products = this.store.products) === null || _this$store$products === void 0 || _this$store$products.destroy();
649
+ (_this$store$accountLi = this.store.accountList) === null || _this$store$accountLi === void 0 || _this$store$accountLi.destroy();
650
+ (_this$store$customer = this.store.customer) === null || _this$store$customer === void 0 || _this$store$customer.destroy();
651
+ (_this$store$order = this.store.order) === null || _this$store$order === void 0 || _this$store$order.destroy();
652
+ this.core.effects.offByModuleDestroy(this.name);
653
+ this.core.unregisterModule(this);
654
+ // 清除所有的监听
655
+ this.scan.removeAllListeners();
656
+ // 清除scan数据内存缓存
657
+ scanCache.clear();
658
+ }
659
+ }]);
660
+ return BookingTicketImpl;
661
+ }(BaseModule);
662
+
663
+ // 导出相关类型和实现
664
+ export * from "./types";
665
+ export { BookingTicketImpl as BookingTicket };