@pisell/pisellos 3.0.57 → 3.0.58

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 (256) hide show
  1. package/dist/core/index.js +1 -2
  2. package/dist/effects/index.d.ts +3 -4
  3. package/dist/effects/index.js +6 -15
  4. package/dist/modules/AccountList/index.d.ts +1 -7
  5. package/dist/modules/AccountList/index.js +14 -81
  6. package/dist/modules/AccountList/types.d.ts +0 -28
  7. package/dist/modules/AccountList/types.js +0 -8
  8. package/dist/modules/Cart/index.js +1 -1
  9. package/dist/modules/Payment/index.d.ts +9 -273
  10. package/dist/modules/Payment/index.js +109 -2525
  11. package/dist/modules/Payment/types.d.ts +30 -382
  12. package/dist/modules/Payment/types.js +14 -116
  13. package/dist/modules/ProductList/index.d.ts +1 -12
  14. package/dist/modules/ProductList/index.js +3 -27
  15. package/dist/modules/Rules/index.js +14 -27
  16. package/dist/modules/Rules/types.d.ts +0 -1
  17. package/dist/modules/index.d.ts +0 -1
  18. package/dist/modules/index.js +0 -1
  19. package/dist/plugins/window.d.ts +0 -1
  20. package/dist/solution/BookingByStep/index.js +1 -9
  21. package/dist/solution/ShopDiscount/index.js +2 -4
  22. package/dist/solution/index.d.ts +0 -2
  23. package/dist/solution/index.js +1 -3
  24. package/dist/types/index.d.ts +1 -3
  25. package/lib/core/index.js +1 -1
  26. package/lib/effects/index.d.ts +3 -4
  27. package/lib/effects/index.js +1 -4
  28. package/lib/modules/AccountList/index.d.ts +1 -7
  29. package/lib/modules/AccountList/index.js +0 -27
  30. package/lib/modules/AccountList/types.d.ts +0 -28
  31. package/lib/modules/Cart/index.js +1 -1
  32. package/lib/modules/Payment/index.d.ts +9 -273
  33. package/lib/modules/Payment/index.js +50 -1285
  34. package/lib/modules/Payment/types.d.ts +30 -382
  35. package/lib/modules/Payment/types.js +6 -41
  36. package/lib/modules/ProductList/index.d.ts +1 -12
  37. package/lib/modules/ProductList/index.js +2 -29
  38. package/lib/modules/Rules/index.js +12 -20
  39. package/lib/modules/Rules/types.d.ts +0 -1
  40. package/lib/modules/index.d.ts +0 -1
  41. package/lib/modules/index.js +0 -2
  42. package/lib/plugins/window.d.ts +0 -1
  43. package/lib/solution/BookingByStep/index.js +2 -1
  44. package/lib/solution/ShopDiscount/index.js +1 -2
  45. package/lib/solution/index.d.ts +0 -2
  46. package/lib/solution/index.js +1 -5
  47. package/lib/types/index.d.ts +1 -3
  48. package/package.json +2 -4
  49. package/dist/modules/Customer/constants.d.ts +0 -7
  50. package/dist/modules/Customer/constants.js +0 -12
  51. package/dist/modules/Customer/index.d.ts +0 -122
  52. package/dist/modules/Customer/index.js +0 -697
  53. package/dist/modules/Customer/types.d.ts +0 -146
  54. package/dist/modules/Customer/types.js +0 -41
  55. package/dist/modules/Payment/cash.d.ts +0 -11
  56. package/dist/modules/Payment/cash.js +0 -78
  57. package/dist/modules/Payment/eftpos.d.ts +0 -11
  58. package/dist/modules/Payment/eftpos.js +0 -80
  59. package/dist/modules/Payment/wallet.d.ts +0 -11
  60. package/dist/modules/Payment/wallet.js +0 -78
  61. package/dist/modules/Payment/walletpass.d.ts +0 -0
  62. package/dist/modules/Payment/walletpass.js +0 -0
  63. package/dist/plugins/app-types/app/app.d.ts +0 -83
  64. package/dist/plugins/app-types/app/const.d.ts +0 -4
  65. package/dist/plugins/app-types/app/index.d.ts +0 -14
  66. package/dist/plugins/app-types/applicationManager/application.d.ts +0 -50
  67. package/dist/plugins/app-types/applicationManager/index.d.ts +0 -13
  68. package/dist/plugins/app-types/config.d.ts +0 -3
  69. package/dist/plugins/app-types/cookie/index.d.ts +0 -13
  70. package/dist/plugins/app-types/data/index.d.ts +0 -8
  71. package/dist/plugins/app-types/history/config.d.ts +0 -24
  72. package/dist/plugins/app-types/history/index.d.ts +0 -20
  73. package/dist/plugins/app-types/history/type.d.ts +0 -2
  74. package/dist/plugins/app-types/hooks/index.d.ts +0 -12
  75. package/dist/plugins/app-types/hooks/useDelayedValue/index.d.ts +0 -2
  76. package/dist/plugins/app-types/hooks/useDispatch/index.d.ts +0 -2
  77. package/dist/plugins/app-types/hooks/useLowCode/index.d.ts +0 -13
  78. package/dist/plugins/app-types/hooks/useStore/index.d.ts +0 -6
  79. package/dist/plugins/app-types/index.d.ts +0 -6
  80. package/dist/plugins/app-types/indexDB/index.d.ts +0 -178
  81. package/dist/plugins/app-types/locales/en.d.ts +0 -3
  82. package/dist/plugins/app-types/locales/index.d.ts +0 -37
  83. package/dist/plugins/app-types/locales/original.d.ts +0 -3
  84. package/dist/plugins/app-types/locales/type.d.ts +0 -19
  85. package/dist/plugins/app-types/locales/zh-CN.d.ts +0 -3
  86. package/dist/plugins/app-types/locales/zh-HK.d.ts +0 -3
  87. package/dist/plugins/app-types/logger/feishu.d.ts +0 -11
  88. package/dist/plugins/app-types/logger/index.d.ts +0 -122
  89. package/dist/plugins/app-types/menuManager/hooks.d.ts +0 -17
  90. package/dist/plugins/app-types/menuManager/index.d.ts +0 -28
  91. package/dist/plugins/app-types/models/global.d.ts +0 -32
  92. package/dist/plugins/app-types/models/index.d.ts +0 -45
  93. package/dist/plugins/app-types/models/type.d.ts +0 -2
  94. package/dist/plugins/app-types/package.json +0 -15
  95. package/dist/plugins/app-types/plugin/index.d.ts +0 -0
  96. package/dist/plugins/app-types/pubsub/example.d.ts +0 -5
  97. package/dist/plugins/app-types/pubsub/index.d.ts +0 -63
  98. package/dist/plugins/app-types/request/cache.d.ts +0 -46
  99. package/dist/plugins/app-types/request/cancelToken.d.ts +0 -38
  100. package/dist/plugins/app-types/request/config.d.ts +0 -3
  101. package/dist/plugins/app-types/request/constants.d.ts +0 -2
  102. package/dist/plugins/app-types/request/index.d.ts +0 -24
  103. package/dist/plugins/app-types/request/pisell2Request.d.ts +0 -6
  104. package/dist/plugins/app-types/request/type.d.ts +0 -41
  105. package/dist/plugins/app-types/request/utils.d.ts +0 -46
  106. package/dist/plugins/app-types/routes/config.d.ts +0 -7
  107. package/dist/plugins/app-types/routes/index.d.ts +0 -28
  108. package/dist/plugins/app-types/socket/components/SocketMonitorPage.d.ts +0 -6
  109. package/dist/plugins/app-types/socket/components/index.d.ts +0 -2
  110. package/dist/plugins/app-types/socket/constants.d.ts +0 -33
  111. package/dist/plugins/app-types/socket/events.d.ts +0 -31
  112. package/dist/plugins/app-types/socket/heartbeat.d.ts +0 -66
  113. package/dist/plugins/app-types/socket/index.d.ts +0 -61
  114. package/dist/plugins/app-types/socket/monitor.d.ts +0 -169
  115. package/dist/plugins/app-types/socket/reconnect.d.ts +0 -61
  116. package/dist/plugins/app-types/socket/socket.d.ts +0 -129
  117. package/dist/plugins/app-types/socket/types.d.ts +0 -85
  118. package/dist/plugins/app-types/storage/index.d.ts +0 -17
  119. package/dist/plugins/app-types/tasks/index.d.ts +0 -77
  120. package/dist/plugins/app-types/tasks/type.d.ts +0 -62
  121. package/dist/plugins/app-types/tasks/useTasks.d.ts +0 -5
  122. package/dist/plugins/app-types/type.d.ts +0 -2
  123. package/dist/plugins/app-types/variables/VariablesProvider.d.ts +0 -7
  124. package/dist/plugins/app-types/variables/config.d.ts +0 -3
  125. package/dist/plugins/app-types/variables/index.d.ts +0 -6
  126. package/dist/plugins/app-types/variables/type.d.ts +0 -2
  127. package/dist/plugins/app-types/website/index.d.ts +0 -6
  128. package/dist/plugins/app.d.ts +0 -8
  129. package/dist/plugins/app.js +0 -1
  130. package/dist/solution/BookingTicket/index.d.ts +0 -172
  131. package/dist/solution/BookingTicket/index.js +0 -665
  132. package/dist/solution/BookingTicket/types.d.ts +0 -68
  133. package/dist/solution/BookingTicket/types.js +0 -43
  134. package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +0 -22
  135. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +0 -159
  136. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +0 -16
  137. package/dist/solution/BookingTicket/utils/scan/handleScan.js +0 -174
  138. package/dist/solution/BookingTicket/utils/scan/index.d.ts +0 -81
  139. package/dist/solution/BookingTicket/utils/scan/index.js +0 -285
  140. package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
  141. package/dist/solution/BookingTicket/utils/scan/scanCache.js +0 -305
  142. package/dist/solution/Checkout/appointmentDemo.json +0 -1
  143. package/dist/solution/Checkout/index.d.ts +0 -181
  144. package/dist/solution/Checkout/index.js +0 -1596
  145. package/dist/solution/Checkout/types.d.ts +0 -550
  146. package/dist/solution/Checkout/types.js +0 -132
  147. package/dist/solution/Checkout/utils/index.d.ts +0 -73
  148. package/dist/solution/Checkout/utils/index.js +0 -371
  149. package/dist/utils/task.d.ts +0 -40
  150. package/dist/utils/task.js +0 -171
  151. package/dist/utils/watch.d.ts +0 -102
  152. package/dist/utils/watch.js +0 -294
  153. package/lib/modules/Customer/constants.d.ts +0 -7
  154. package/lib/modules/Customer/constants.js +0 -39
  155. package/lib/modules/Customer/index.d.ts +0 -122
  156. package/lib/modules/Customer/index.js +0 -440
  157. package/lib/modules/Customer/types.d.ts +0 -146
  158. package/lib/modules/Customer/types.js +0 -37
  159. package/lib/modules/Payment/cash.d.ts +0 -11
  160. package/lib/modules/Payment/cash.js +0 -51
  161. package/lib/modules/Payment/eftpos.d.ts +0 -11
  162. package/lib/modules/Payment/eftpos.js +0 -51
  163. package/lib/modules/Payment/wallet.d.ts +0 -11
  164. package/lib/modules/Payment/wallet.js +0 -51
  165. package/lib/modules/Payment/walletpass.d.ts +0 -0
  166. package/lib/modules/Payment/walletpass.js +0 -0
  167. package/lib/plugins/app-types/app/app.d.ts +0 -83
  168. package/lib/plugins/app-types/app/const.d.ts +0 -4
  169. package/lib/plugins/app-types/app/index.d.ts +0 -14
  170. package/lib/plugins/app-types/applicationManager/application.d.ts +0 -50
  171. package/lib/plugins/app-types/applicationManager/index.d.ts +0 -13
  172. package/lib/plugins/app-types/config.d.ts +0 -3
  173. package/lib/plugins/app-types/cookie/index.d.ts +0 -13
  174. package/lib/plugins/app-types/data/index.d.ts +0 -8
  175. package/lib/plugins/app-types/history/config.d.ts +0 -24
  176. package/lib/plugins/app-types/history/index.d.ts +0 -20
  177. package/lib/plugins/app-types/history/type.d.ts +0 -2
  178. package/lib/plugins/app-types/hooks/index.d.ts +0 -12
  179. package/lib/plugins/app-types/hooks/useDelayedValue/index.d.ts +0 -2
  180. package/lib/plugins/app-types/hooks/useDispatch/index.d.ts +0 -2
  181. package/lib/plugins/app-types/hooks/useLowCode/index.d.ts +0 -13
  182. package/lib/plugins/app-types/hooks/useStore/index.d.ts +0 -6
  183. package/lib/plugins/app-types/index.d.ts +0 -6
  184. package/lib/plugins/app-types/indexDB/index.d.ts +0 -178
  185. package/lib/plugins/app-types/locales/en.d.ts +0 -3
  186. package/lib/plugins/app-types/locales/index.d.ts +0 -37
  187. package/lib/plugins/app-types/locales/original.d.ts +0 -3
  188. package/lib/plugins/app-types/locales/type.d.ts +0 -19
  189. package/lib/plugins/app-types/locales/zh-CN.d.ts +0 -3
  190. package/lib/plugins/app-types/locales/zh-HK.d.ts +0 -3
  191. package/lib/plugins/app-types/logger/feishu.d.ts +0 -11
  192. package/lib/plugins/app-types/logger/index.d.ts +0 -122
  193. package/lib/plugins/app-types/menuManager/hooks.d.ts +0 -17
  194. package/lib/plugins/app-types/menuManager/index.d.ts +0 -28
  195. package/lib/plugins/app-types/models/global.d.ts +0 -32
  196. package/lib/plugins/app-types/models/index.d.ts +0 -45
  197. package/lib/plugins/app-types/models/type.d.ts +0 -2
  198. package/lib/plugins/app-types/package.json +0 -15
  199. package/lib/plugins/app-types/plugin/index.d.ts +0 -0
  200. package/lib/plugins/app-types/pubsub/example.d.ts +0 -5
  201. package/lib/plugins/app-types/pubsub/index.d.ts +0 -63
  202. package/lib/plugins/app-types/request/cache.d.ts +0 -46
  203. package/lib/plugins/app-types/request/cancelToken.d.ts +0 -38
  204. package/lib/plugins/app-types/request/config.d.ts +0 -3
  205. package/lib/plugins/app-types/request/constants.d.ts +0 -2
  206. package/lib/plugins/app-types/request/index.d.ts +0 -24
  207. package/lib/plugins/app-types/request/pisell2Request.d.ts +0 -6
  208. package/lib/plugins/app-types/request/type.d.ts +0 -41
  209. package/lib/plugins/app-types/request/utils.d.ts +0 -46
  210. package/lib/plugins/app-types/routes/config.d.ts +0 -7
  211. package/lib/plugins/app-types/routes/index.d.ts +0 -28
  212. package/lib/plugins/app-types/socket/components/SocketMonitorPage.d.ts +0 -6
  213. package/lib/plugins/app-types/socket/components/index.d.ts +0 -2
  214. package/lib/plugins/app-types/socket/constants.d.ts +0 -33
  215. package/lib/plugins/app-types/socket/events.d.ts +0 -31
  216. package/lib/plugins/app-types/socket/heartbeat.d.ts +0 -66
  217. package/lib/plugins/app-types/socket/index.d.ts +0 -61
  218. package/lib/plugins/app-types/socket/monitor.d.ts +0 -169
  219. package/lib/plugins/app-types/socket/reconnect.d.ts +0 -61
  220. package/lib/plugins/app-types/socket/socket.d.ts +0 -129
  221. package/lib/plugins/app-types/socket/types.d.ts +0 -85
  222. package/lib/plugins/app-types/storage/index.d.ts +0 -17
  223. package/lib/plugins/app-types/tasks/index.d.ts +0 -77
  224. package/lib/plugins/app-types/tasks/type.d.ts +0 -62
  225. package/lib/plugins/app-types/tasks/useTasks.d.ts +0 -5
  226. package/lib/plugins/app-types/type.d.ts +0 -2
  227. package/lib/plugins/app-types/variables/VariablesProvider.d.ts +0 -7
  228. package/lib/plugins/app-types/variables/config.d.ts +0 -3
  229. package/lib/plugins/app-types/variables/index.d.ts +0 -6
  230. package/lib/plugins/app-types/variables/type.d.ts +0 -2
  231. package/lib/plugins/app-types/website/index.d.ts +0 -6
  232. package/lib/plugins/app.d.ts +0 -8
  233. package/lib/plugins/app.js +0 -17
  234. package/lib/solution/BookingTicket/index.d.ts +0 -172
  235. package/lib/solution/BookingTicket/index.js +0 -399
  236. package/lib/solution/BookingTicket/types.d.ts +0 -68
  237. package/lib/solution/BookingTicket/types.js +0 -72
  238. package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +0 -22
  239. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +0 -117
  240. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +0 -16
  241. package/lib/solution/BookingTicket/utils/scan/handleScan.js +0 -125
  242. package/lib/solution/BookingTicket/utils/scan/index.d.ts +0 -81
  243. package/lib/solution/BookingTicket/utils/scan/index.js +0 -210
  244. package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
  245. package/lib/solution/BookingTicket/utils/scan/scanCache.js +0 -231
  246. package/lib/solution/Checkout/appointmentDemo.json +0 -1
  247. package/lib/solution/Checkout/index.d.ts +0 -181
  248. package/lib/solution/Checkout/index.js +0 -864
  249. package/lib/solution/Checkout/types.d.ts +0 -550
  250. package/lib/solution/Checkout/types.js +0 -75
  251. package/lib/solution/Checkout/utils/index.d.ts +0 -73
  252. package/lib/solution/Checkout/utils/index.js +0 -266
  253. package/lib/utils/task.d.ts +0 -40
  254. package/lib/utils/task.js +0 -109
  255. package/lib/utils/watch.d.ts +0 -102
  256. package/lib/utils/watch.js +0 -217
@@ -1,125 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
-
29
- // src/solution/BookingTicket/utils/scan/handleScan.ts
30
- var handleScan_exports = {};
31
- __export(handleScan_exports, {
32
- handleCustomerScan: () => handleCustomerScan,
33
- handleGlobalScan: () => handleGlobalScan
34
- });
35
- module.exports = __toCommonJS(handleScan_exports);
36
- var import_cloudSearch = require("./cloudSearch");
37
- var import_scanCache = __toESM(require("./scanCache"));
38
- var promiseAny = async (promises) => {
39
- if (promises.length === 0) {
40
- throw new Error("No promises provided");
41
- }
42
- const errors = [];
43
- let completedCount = 0;
44
- return new Promise((resolve, reject) => {
45
- promises.forEach((promise, index) => {
46
- promise.then((result) => {
47
- resolve(result);
48
- }).catch((error) => {
49
- errors[index] = error;
50
- completedCount++;
51
- if (completedCount === promises.length) {
52
- const errorMessage = `All promises were rejected. Errors: ${errors.map((e) => e.message).join(", ")}`;
53
- const combinedError = new Error(errorMessage);
54
- combinedError.errors = errors;
55
- reject(combinedError);
56
- }
57
- });
58
- });
59
- });
60
- };
61
- var handleScanFn = (getRequestList, localSearch) => {
62
- return async (scanResult) => {
63
- const { value } = scanResult || {};
64
- try {
65
- const localResult = localSearch == null ? void 0 : localSearch(value);
66
- if ((localResult == null ? void 0 : localResult.length) > 0) {
67
- console.log("本地搜索到数据>>>>>>>", localResult);
68
- return {
69
- searchType: "local_product",
70
- response: { data: { list: localResult } }
71
- };
72
- } else {
73
- console.log("本地搜索无数据>>>>>>>");
74
- }
75
- } catch (error) {
76
- console.error("本地搜索到数据失败>>>>>>>", error);
77
- }
78
- try {
79
- if (import_scanCache.default.has(value)) {
80
- const result = import_scanCache.default.get(value);
81
- console.log("缓存中搜索到数据>>>>>>>", result);
82
- return result;
83
- } else {
84
- console.log("缓存中无数据>>>>>>>");
85
- }
86
- } catch (error) {
87
- console.error("缓存中搜索数据失败>>>>>>>", error);
88
- }
89
- const requestList = (getRequestList == null ? void 0 : getRequestList(value)) || [];
90
- if (requestList.length === 0) {
91
- throw new Error("requestList is empty");
92
- }
93
- try {
94
- const result = await promiseAny(requestList);
95
- import_scanCache.default.set(value, result);
96
- return result;
97
- } catch (error) {
98
- throw error;
99
- }
100
- };
101
- };
102
- var handleGlobalScan = (request, localSearch) => {
103
- const getRequestList = (value) => {
104
- let requestList = [];
105
- if (value.startsWith("WL")) {
106
- requestList = [(0, import_cloudSearch.searchWallet)(request, value)];
107
- } else {
108
- requestList = [
109
- (0, import_cloudSearch.searchWalletPass)(request, value),
110
- (0, import_cloudSearch.searchWallet)(request, value),
111
- (0, import_cloudSearch.searchProduct)(request, value)
112
- ];
113
- }
114
- return requestList;
115
- };
116
- return handleScanFn(getRequestList, localSearch);
117
- };
118
- var handleCustomerScan = () => {
119
- return () => Promise.resolve({});
120
- };
121
- // Annotate the CommonJS export names for ESM import in node:
122
- 0 && (module.exports = {
123
- handleCustomerScan,
124
- handleGlobalScan
125
- });
@@ -1,81 +0,0 @@
1
- import { WatchEventItem } from '../../../../utils/watch';
2
- import { BookingTicketImpl } from '../../index';
3
- import Tasks from '../../../../utils/task';
4
- interface ScanResult {
5
- type: ScanResultType;
6
- value: string;
7
- data?: {
8
- [key: string]: any;
9
- };
10
- }
11
- declare enum ScanResultType {
12
- Scanner = "scanner",
13
- NFC = "nfc",
14
- NativeScanner = "nativeScanner"
15
- }
16
- export default class Scan {
17
- private solution;
18
- private watchKey;
19
- private listenerConfig;
20
- constructor(solution: BookingTicketImpl, watchKey: string);
21
- /**
22
- * 处理扫码事件
23
- * @param eventKey 事件key
24
- * @param value 扫码结果
25
- */
26
- handleScan(result: {
27
- type: string;
28
- value: string;
29
- }): void;
30
- /**
31
- * 生成uuid
32
- * @returns uuid
33
- */
34
- generateUuid(): string;
35
- /**
36
- * 添加扫码信息监听
37
- * @param watchKey 监听的key
38
- * @param event 事件
39
- */
40
- addListener(event: WatchEventItem, scanCallback?: (result: ScanResult) => Promise<any>): {
41
- remove: () => void;
42
- };
43
- /**
44
- * 移除扫码信息监听
45
- * @param watchKey 监听的key
46
- * @param event 事件
47
- */
48
- removeListener(event: WatchEventItem): void;
49
- /**
50
- * 移除所有监听
51
- */
52
- removeAllListeners(): void;
53
- /**
54
- * 启用所有监听
55
- */
56
- enableAllListeners(): void;
57
- /**
58
- * 禁用所有监听,并清空任务执行队列
59
- */
60
- disableAllListeners(): void;
61
- /**
62
- * 清空监听对应的任务执行队列,不传入eventKey则清空所有监听对应的任务执行队列
63
- * @param eventKey 事件key
64
- */
65
- clearTaskQueue(eventKey?: string): void;
66
- /**
67
- * 获取监听配置
68
- * @param eventKey 事件key
69
- * @returns 监听配置
70
- */
71
- getListenerConfig(eventKey: string): {
72
- scanCallback?: ((result: ScanResult) => Promise<any>) | undefined;
73
- task: Tasks;
74
- } | undefined;
75
- /**
76
- * 扫码任务执行函数
77
- * @param args 参数
78
- */
79
- scanTaskAction(...args: any[]): Promise<void>;
80
- }
81
- export {};
@@ -1,210 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
-
29
- // src/solution/BookingTicket/utils/scan/index.ts
30
- var scan_exports = {};
31
- __export(scan_exports, {
32
- default: () => Scan
33
- });
34
- module.exports = __toCommonJS(scan_exports);
35
- var import_watch = __toESM(require("../../../../utils/watch"));
36
- var import_task = __toESM(require("../../../../utils/task"));
37
- var Scan = class {
38
- constructor(solution, watchKey) {
39
- this.listenerConfig = /* @__PURE__ */ new Map();
40
- var _a, _b, _c, _d, _e;
41
- this.solution = solution;
42
- this.watchKey = watchKey;
43
- (_e = (_d = (_c = (_b = (_a = this.solution) == null ? void 0 : _a.window) == null ? void 0 : _b.interaction) == null ? void 0 : _c.utils) == null ? void 0 : _d.mountFunction) == null ? void 0 : _e.call(
44
- _d,
45
- "global",
46
- "peripheralsResult",
47
- (strVal) => {
48
- try {
49
- const result = JSON.parse(strVal);
50
- console.log("nativeScannerResult>>>>>>>", result);
51
- this.handleScan(result);
52
- } catch (err) {
53
- console.error(err);
54
- }
55
- }
56
- );
57
- }
58
- /**
59
- * 处理扫码事件
60
- * @param eventKey 事件key
61
- * @param value 扫码结果
62
- */
63
- handleScan(result) {
64
- const lastEnableEventKey = import_watch.default.getLastEnableEventKey(this.watchKey);
65
- if (lastEnableEventKey) {
66
- const listenerConfig = this.listenerConfig.get(lastEnableEventKey);
67
- if (listenerConfig) {
68
- listenerConfig.task.addTask({
69
- uuid: this.generateUuid(),
70
- type: lastEnableEventKey,
71
- actionParams: {
72
- scanResult: result
73
- }
74
- });
75
- }
76
- }
77
- }
78
- /**
79
- * 生成uuid
80
- * @returns uuid
81
- */
82
- generateUuid() {
83
- return Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15) + Date.now().toString(36);
84
- }
85
- /**
86
- * 添加扫码信息监听
87
- * @param watchKey 监听的key
88
- * @param event 事件
89
- */
90
- addListener(event, scanCallback) {
91
- import_watch.default.subscribe(this.watchKey, event);
92
- const task = new import_task.default();
93
- task.addAction(
94
- event.key,
95
- (...args) => this.scanTaskAction(event.key, ...args)
96
- );
97
- this.listenerConfig.set(event.key, { scanCallback, task });
98
- return {
99
- remove: () => {
100
- this.removeListener(event);
101
- }
102
- };
103
- }
104
- /**
105
- * 移除扫码信息监听
106
- * @param watchKey 监听的key
107
- * @param event 事件
108
- */
109
- removeListener(event) {
110
- var _a, _b;
111
- import_watch.default.unsubscribe(this.watchKey, event);
112
- (_b = (_a = this.listenerConfig.get(event.key)) == null ? void 0 : _a.task) == null ? void 0 : _b.clear();
113
- this.listenerConfig.delete(event.key);
114
- }
115
- /**
116
- * 移除所有监听
117
- */
118
- removeAllListeners() {
119
- var _a, _b, _c, _d;
120
- import_watch.default.clearEvent(this.watchKey);
121
- (_b = (_a = this.listenerConfig) == null ? void 0 : _a.forEach) == null ? void 0 : _b.call(_a, (item) => {
122
- var _a2;
123
- (_a2 = item == null ? void 0 : item.task) == null ? void 0 : _a2.clear();
124
- });
125
- (_d = (_c = this.listenerConfig) == null ? void 0 : _c.clear) == null ? void 0 : _d.call(_c);
126
- }
127
- /**
128
- * 启用所有监听
129
- */
130
- enableAllListeners() {
131
- import_watch.default.enableAllEventByWatchKey(this.watchKey);
132
- }
133
- /**
134
- * 禁用所有监听,并清空任务执行队列
135
- */
136
- disableAllListeners() {
137
- var _a, _b;
138
- import_watch.default.disabledAllEventByWatchKey(this.watchKey);
139
- (_b = (_a = this.listenerConfig) == null ? void 0 : _a.forEach) == null ? void 0 : _b.call(_a, (item) => {
140
- var _a2;
141
- (_a2 = item == null ? void 0 : item.task) == null ? void 0 : _a2.clearTaskQueue();
142
- });
143
- }
144
- /**
145
- * 清空监听对应的任务执行队列,不传入eventKey则清空所有监听对应的任务执行队列
146
- * @param eventKey 事件key
147
- */
148
- clearTaskQueue(eventKey) {
149
- var _a, _b, _c;
150
- console.log("clearTaskQueue>>>>>>>", eventKey);
151
- if (eventKey) {
152
- (_a = this.listenerConfig.get(eventKey)) == null ? void 0 : _a.task.clearTaskQueue();
153
- } else {
154
- (_c = (_b = this.listenerConfig) == null ? void 0 : _b.forEach) == null ? void 0 : _c.call(_b, (item) => {
155
- var _a2;
156
- (_a2 = item == null ? void 0 : item.task) == null ? void 0 : _a2.clearTaskQueue();
157
- });
158
- }
159
- }
160
- /**
161
- * 获取监听配置
162
- * @param eventKey 事件key
163
- * @returns 监听配置
164
- */
165
- getListenerConfig(eventKey) {
166
- var _a;
167
- return (_a = this.listenerConfig) == null ? void 0 : _a.get(eventKey);
168
- }
169
- /**
170
- * 扫码任务执行函数
171
- * @param args 参数
172
- */
173
- async scanTaskAction(...args) {
174
- const [eventKey, other] = args;
175
- const { type, value, data } = (other == null ? void 0 : other.scanResult) || {};
176
- const taskItemUuid = other == null ? void 0 : other.uuid;
177
- const { scanCallback, task } = this.getListenerConfig(eventKey) || {};
178
- if (scanCallback) {
179
- try {
180
- const result = await scanCallback({ type, value });
181
- console.log(`${eventKey}_result>>>>>>>`, result);
182
- if (taskItemUuid && (task == null ? void 0 : task.isTaskExist(taskItemUuid))) {
183
- import_watch.default.publishByEventKey(this.watchKey, eventKey, {
184
- type: eventKey,
185
- status: "success",
186
- scanType: type,
187
- scanCode: value,
188
- scanData: data,
189
- result
190
- });
191
- } else {
192
- console.warn(`${eventKey}_result_task_not_exist>>>>>>>`, task);
193
- }
194
- } catch (error) {
195
- console.log(`${eventKey}_result_error>>>>>>>`, error);
196
- if (taskItemUuid && (task == null ? void 0 : task.isTaskExist(taskItemUuid))) {
197
- import_watch.default.publishByEventKey(this.watchKey, eventKey, {
198
- type: eventKey,
199
- status: "failed",
200
- scanType: type,
201
- scanCode: value,
202
- scanData: data
203
- });
204
- } else {
205
- console.warn(`${eventKey}_result_error_task_not_exist>>>>>>>`, task);
206
- }
207
- }
208
- }
209
- }
210
- };
@@ -1,78 +0,0 @@
1
- /**
2
- * LRU缓存类,用于缓存接口数据
3
- * 限制最多存储100条数据,超过时移除最久未使用的数据
4
- * 支持数据压缩以减小缓存压力
5
- * 尾部优先策略:新节点插入尾部,最近使用的节点移动到尾部,删除头部节点
6
- */
7
- declare class LRUCache<T> {
8
- private head;
9
- private tail;
10
- private keyMap;
11
- private readonly maxSize;
12
- constructor(maxSize?: number);
13
- /**
14
- * 将节点移动到链表尾部(最近使用)
15
- * @param node 要移动的节点
16
- */
17
- private moveToTail;
18
- /**
19
- * 添加新节点到链表尾部
20
- * @param key 缓存键
21
- * @param compressedData 压缩后的数据
22
- * @param timestamp 时间戳
23
- */
24
- private addToTail;
25
- /**
26
- * 从链表中移除节点
27
- * @param node 要移除的节点
28
- */
29
- private removeNode;
30
- /**
31
- * 移除最久未使用的节点(链表头部)
32
- */
33
- private removeOldest;
34
- /**
35
- * 设置缓存
36
- * @param key 缓存键
37
- * @param data 缓存数据
38
- */
39
- set(key: string, data: T): void;
40
- /**
41
- * 获取缓存
42
- * @param key 缓存键
43
- * @returns 缓存数据或undefined
44
- */
45
- get(key: string): T | undefined;
46
- /**
47
- * 检查是否存在缓存
48
- * @param key 缓存键
49
- * @returns 是否存在
50
- */
51
- has(key: string): boolean;
52
- /**
53
- * 清除所有缓存
54
- */
55
- clear(): void;
56
- /**
57
- * 获取缓存大小
58
- * @returns 当前缓存数量
59
- */
60
- size(): number;
61
- /**
62
- * 获取缓存统计信息
63
- * @returns 缓存统计信息
64
- */
65
- getStats(): {
66
- size: number;
67
- maxSize: number;
68
- usage: number;
69
- };
70
- /**
71
- * 删除指定的缓存项
72
- * @param key 要删除的缓存键
73
- * @returns 是否删除成功
74
- */
75
- delete(key: string): boolean;
76
- }
77
- declare const scanCache: LRUCache<any>;
78
- export default scanCache;