@pisell/pisellos 3.0.76 → 3.0.77

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 (308) hide show
  1. package/dist/core/index.js +1 -2
  2. package/dist/effects/index.d.ts +3 -5
  3. package/dist/effects/index.js +8 -40
  4. package/dist/modules/Account/index.js +3 -2
  5. package/dist/modules/AccountList/index.d.ts +1 -7
  6. package/dist/modules/AccountList/index.js +14 -81
  7. package/dist/modules/AccountList/types.d.ts +0 -28
  8. package/dist/modules/AccountList/types.js +0 -8
  9. package/dist/modules/BaseModule.d.ts +0 -3
  10. package/dist/modules/BaseModule.js +0 -15
  11. package/dist/modules/Cart/index.d.ts +0 -1
  12. package/dist/modules/Cart/index.js +1 -2
  13. package/dist/modules/Discount/index.d.ts +0 -1
  14. package/dist/modules/Discount/index.js +1 -1
  15. package/dist/modules/Guests/index.js +9 -9
  16. package/dist/modules/Order/index.d.ts +1 -25
  17. package/dist/modules/Order/index.js +3 -224
  18. package/dist/modules/Order/types.d.ts +0 -45
  19. package/dist/modules/Order/types.js +0 -8
  20. package/dist/modules/Order/utils.js +1 -1
  21. package/dist/modules/Payment/index.d.ts +9 -184
  22. package/dist/modules/Payment/index.js +109 -2084
  23. package/dist/modules/Payment/types.d.ts +30 -772
  24. package/dist/modules/Payment/types.js +12 -236
  25. package/dist/modules/ProductList/index.d.ts +1 -12
  26. package/dist/modules/ProductList/index.js +15 -37
  27. package/dist/modules/Resource/index.js +1 -1
  28. package/dist/modules/Rules/index.d.ts +1 -2
  29. package/dist/modules/Rules/index.js +26 -66
  30. package/dist/modules/Rules/types.d.ts +0 -1
  31. package/dist/modules/Schedule/index.d.ts +0 -9
  32. package/dist/modules/Schedule/index.js +0 -77
  33. package/dist/modules/index.d.ts +0 -1
  34. package/dist/modules/index.js +0 -1
  35. package/dist/plugins/window.d.ts +0 -1
  36. package/dist/solution/BookingByStep/index.js +13 -43
  37. package/dist/solution/BookingByStep/utils/capacity.js +1 -1
  38. package/dist/solution/BookingByStep/utils/products.d.ts +0 -6
  39. package/dist/solution/BookingByStep/utils/products.js +0 -10
  40. package/dist/solution/BuyTickets/index.js +8 -7
  41. package/dist/solution/ShopDiscount/index.d.ts +10 -10
  42. package/dist/solution/ShopDiscount/index.js +57 -107
  43. package/dist/solution/ShopDiscount/types.d.ts +0 -8
  44. package/dist/solution/ShopDiscount/utils.js +1 -0
  45. package/dist/solution/index.d.ts +0 -2
  46. package/dist/solution/index.js +1 -3
  47. package/dist/types/index.d.ts +1 -4
  48. package/lib/core/index.js +1 -1
  49. package/lib/effects/index.d.ts +3 -5
  50. package/lib/effects/index.js +1 -17
  51. package/lib/modules/Account/index.js +3 -2
  52. package/lib/modules/AccountList/index.d.ts +1 -7
  53. package/lib/modules/AccountList/index.js +0 -27
  54. package/lib/modules/AccountList/types.d.ts +0 -28
  55. package/lib/modules/BaseModule.d.ts +0 -3
  56. package/lib/modules/BaseModule.js +0 -9
  57. package/lib/modules/Cart/index.d.ts +0 -1
  58. package/lib/modules/Cart/index.js +2 -5
  59. package/lib/modules/Discount/index.d.ts +0 -1
  60. package/lib/modules/Discount/index.js +1 -1
  61. package/lib/modules/Guests/index.js +9 -9
  62. package/lib/modules/Order/index.d.ts +1 -25
  63. package/lib/modules/Order/index.js +1 -186
  64. package/lib/modules/Order/types.d.ts +0 -45
  65. package/lib/modules/Order/utils.js +1 -1
  66. package/lib/modules/Payment/index.d.ts +9 -184
  67. package/lib/modules/Payment/index.js +51 -1084
  68. package/lib/modules/Payment/types.d.ts +30 -772
  69. package/lib/modules/Payment/types.js +6 -79
  70. package/lib/modules/ProductList/index.d.ts +1 -12
  71. package/lib/modules/ProductList/index.js +12 -31
  72. package/lib/modules/Resource/index.js +1 -1
  73. package/lib/modules/Rules/index.d.ts +1 -2
  74. package/lib/modules/Rules/index.js +24 -41
  75. package/lib/modules/Rules/types.d.ts +0 -1
  76. package/lib/modules/Schedule/index.d.ts +0 -9
  77. package/lib/modules/Schedule/index.js +0 -60
  78. package/lib/modules/index.d.ts +0 -1
  79. package/lib/modules/index.js +0 -2
  80. package/lib/plugins/window.d.ts +0 -1
  81. package/lib/solution/BookingByStep/index.js +6 -18
  82. package/lib/solution/BookingByStep/utils/capacity.js +1 -1
  83. package/lib/solution/BookingByStep/utils/products.d.ts +0 -6
  84. package/lib/solution/BookingByStep/utils/products.js +2 -8
  85. package/lib/solution/BuyTickets/index.js +8 -7
  86. package/lib/solution/ShopDiscount/index.d.ts +10 -10
  87. package/lib/solution/ShopDiscount/index.js +21 -47
  88. package/lib/solution/ShopDiscount/types.d.ts +0 -8
  89. package/lib/solution/index.d.ts +0 -2
  90. package/lib/solution/index.js +1 -5
  91. package/lib/types/index.d.ts +1 -4
  92. package/package.json +1 -3
  93. package/dist/modules/Customer/constants.d.ts +0 -7
  94. package/dist/modules/Customer/constants.js +0 -12
  95. package/dist/modules/Customer/index.d.ts +0 -122
  96. package/dist/modules/Customer/index.js +0 -696
  97. package/dist/modules/Customer/types.d.ts +0 -146
  98. package/dist/modules/Customer/types.js +0 -41
  99. package/dist/modules/Payment/cash.d.ts +0 -19
  100. package/dist/modules/Payment/cash.js +0 -97
  101. package/dist/modules/Payment/cashRecommendationAlgorithm.d.ts +0 -22
  102. package/dist/modules/Payment/cashRecommendationAlgorithm.js +0 -423
  103. package/dist/modules/Payment/eftpos.d.ts +0 -11
  104. package/dist/modules/Payment/eftpos.js +0 -80
  105. package/dist/modules/Payment/mx51.d.ts +0 -0
  106. package/dist/modules/Payment/mx51.js +0 -0
  107. package/dist/modules/Payment/utils.d.ts +0 -17
  108. package/dist/modules/Payment/utils.js +0 -62
  109. package/dist/modules/Payment/walletpass.d.ts +0 -99
  110. package/dist/modules/Payment/walletpass.js +0 -711
  111. package/dist/plugins/app-types/app/app.d.ts +0 -83
  112. package/dist/plugins/app-types/app/const.d.ts +0 -4
  113. package/dist/plugins/app-types/app/index.d.ts +0 -14
  114. package/dist/plugins/app-types/applicationManager/application.d.ts +0 -50
  115. package/dist/plugins/app-types/applicationManager/index.d.ts +0 -13
  116. package/dist/plugins/app-types/config.d.ts +0 -3
  117. package/dist/plugins/app-types/cookie/index.d.ts +0 -13
  118. package/dist/plugins/app-types/data/index.d.ts +0 -8
  119. package/dist/plugins/app-types/history/config.d.ts +0 -24
  120. package/dist/plugins/app-types/history/index.d.ts +0 -20
  121. package/dist/plugins/app-types/history/type.d.ts +0 -2
  122. package/dist/plugins/app-types/hooks/index.d.ts +0 -12
  123. package/dist/plugins/app-types/hooks/useDelayedValue/index.d.ts +0 -2
  124. package/dist/plugins/app-types/hooks/useDispatch/index.d.ts +0 -2
  125. package/dist/plugins/app-types/hooks/useLowCode/index.d.ts +0 -13
  126. package/dist/plugins/app-types/hooks/useStore/index.d.ts +0 -6
  127. package/dist/plugins/app-types/index.d.ts +0 -6
  128. package/dist/plugins/app-types/indexDB/index.d.ts +0 -178
  129. package/dist/plugins/app-types/locales/en.d.ts +0 -3
  130. package/dist/plugins/app-types/locales/index.d.ts +0 -37
  131. package/dist/plugins/app-types/locales/original.d.ts +0 -3
  132. package/dist/plugins/app-types/locales/type.d.ts +0 -19
  133. package/dist/plugins/app-types/locales/zh-CN.d.ts +0 -3
  134. package/dist/plugins/app-types/locales/zh-HK.d.ts +0 -3
  135. package/dist/plugins/app-types/logger/feishu.d.ts +0 -11
  136. package/dist/plugins/app-types/logger/index.d.ts +0 -122
  137. package/dist/plugins/app-types/menuManager/hooks.d.ts +0 -17
  138. package/dist/plugins/app-types/menuManager/index.d.ts +0 -28
  139. package/dist/plugins/app-types/models/global.d.ts +0 -32
  140. package/dist/plugins/app-types/models/index.d.ts +0 -45
  141. package/dist/plugins/app-types/models/type.d.ts +0 -2
  142. package/dist/plugins/app-types/package.json +0 -15
  143. package/dist/plugins/app-types/plugin/index.d.ts +0 -0
  144. package/dist/plugins/app-types/pubsub/example.d.ts +0 -5
  145. package/dist/plugins/app-types/pubsub/index.d.ts +0 -63
  146. package/dist/plugins/app-types/request/cache.d.ts +0 -46
  147. package/dist/plugins/app-types/request/cancelToken.d.ts +0 -38
  148. package/dist/plugins/app-types/request/config.d.ts +0 -3
  149. package/dist/plugins/app-types/request/constants.d.ts +0 -2
  150. package/dist/plugins/app-types/request/index.d.ts +0 -24
  151. package/dist/plugins/app-types/request/pisell2Request.d.ts +0 -6
  152. package/dist/plugins/app-types/request/type.d.ts +0 -41
  153. package/dist/plugins/app-types/request/utils.d.ts +0 -46
  154. package/dist/plugins/app-types/routes/config.d.ts +0 -7
  155. package/dist/plugins/app-types/routes/index.d.ts +0 -28
  156. package/dist/plugins/app-types/socket/components/SocketMonitorPage.d.ts +0 -6
  157. package/dist/plugins/app-types/socket/components/index.d.ts +0 -2
  158. package/dist/plugins/app-types/socket/constants.d.ts +0 -33
  159. package/dist/plugins/app-types/socket/events.d.ts +0 -31
  160. package/dist/plugins/app-types/socket/heartbeat.d.ts +0 -66
  161. package/dist/plugins/app-types/socket/index.d.ts +0 -61
  162. package/dist/plugins/app-types/socket/monitor.d.ts +0 -169
  163. package/dist/plugins/app-types/socket/reconnect.d.ts +0 -61
  164. package/dist/plugins/app-types/socket/socket.d.ts +0 -129
  165. package/dist/plugins/app-types/socket/types.d.ts +0 -85
  166. package/dist/plugins/app-types/storage/index.d.ts +0 -17
  167. package/dist/plugins/app-types/tasks/index.d.ts +0 -77
  168. package/dist/plugins/app-types/tasks/type.d.ts +0 -62
  169. package/dist/plugins/app-types/tasks/useTasks.d.ts +0 -5
  170. package/dist/plugins/app-types/type.d.ts +0 -2
  171. package/dist/plugins/app-types/variables/VariablesProvider.d.ts +0 -7
  172. package/dist/plugins/app-types/variables/config.d.ts +0 -3
  173. package/dist/plugins/app-types/variables/index.d.ts +0 -6
  174. package/dist/plugins/app-types/variables/type.d.ts +0 -2
  175. package/dist/plugins/app-types/website/index.d.ts +0 -6
  176. package/dist/plugins/app.d.ts +0 -8
  177. package/dist/plugins/app.js +0 -1
  178. package/dist/solution/BookingTicket/index.d.ts +0 -184
  179. package/dist/solution/BookingTicket/index.js +0 -698
  180. package/dist/solution/BookingTicket/types.d.ts +0 -68
  181. package/dist/solution/BookingTicket/types.js +0 -43
  182. package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +0 -22
  183. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +0 -159
  184. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +0 -22
  185. package/dist/solution/BookingTicket/utils/scan/handleScan.js +0 -189
  186. package/dist/solution/BookingTicket/utils/scan/index.d.ts +0 -85
  187. package/dist/solution/BookingTicket/utils/scan/index.js +0 -294
  188. package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
  189. package/dist/solution/BookingTicket/utils/scan/scanCache.js +0 -305
  190. package/dist/solution/Checkout/appointmentDemo.json +0 -1
  191. package/dist/solution/Checkout/index.d.ts +0 -432
  192. package/dist/solution/Checkout/index.js +0 -4452
  193. package/dist/solution/Checkout/types.d.ts +0 -727
  194. package/dist/solution/Checkout/types.js +0 -104
  195. package/dist/solution/Checkout/utils/index.d.ts +0 -121
  196. package/dist/solution/Checkout/utils/index.js +0 -511
  197. package/dist/utils/task.d.ts +0 -40
  198. package/dist/utils/task.js +0 -171
  199. package/dist/utils/watch.d.ts +0 -102
  200. package/dist/utils/watch.js +0 -294
  201. package/lib/modules/Customer/constants.d.ts +0 -7
  202. package/lib/modules/Customer/constants.js +0 -39
  203. package/lib/modules/Customer/index.d.ts +0 -122
  204. package/lib/modules/Customer/index.js +0 -439
  205. package/lib/modules/Customer/types.d.ts +0 -146
  206. package/lib/modules/Customer/types.js +0 -37
  207. package/lib/modules/Payment/cash.d.ts +0 -19
  208. package/lib/modules/Payment/cash.js +0 -64
  209. package/lib/modules/Payment/cashRecommendationAlgorithm.d.ts +0 -22
  210. package/lib/modules/Payment/cashRecommendationAlgorithm.js +0 -342
  211. package/lib/modules/Payment/eftpos.d.ts +0 -11
  212. package/lib/modules/Payment/eftpos.js +0 -51
  213. package/lib/modules/Payment/mx51.d.ts +0 -0
  214. package/lib/modules/Payment/mx51.js +0 -0
  215. package/lib/modules/Payment/utils.d.ts +0 -17
  216. package/lib/modules/Payment/utils.js +0 -67
  217. package/lib/modules/Payment/walletpass.d.ts +0 -99
  218. package/lib/modules/Payment/walletpass.js +0 -484
  219. package/lib/plugins/app-types/app/app.d.ts +0 -83
  220. package/lib/plugins/app-types/app/const.d.ts +0 -4
  221. package/lib/plugins/app-types/app/index.d.ts +0 -14
  222. package/lib/plugins/app-types/applicationManager/application.d.ts +0 -50
  223. package/lib/plugins/app-types/applicationManager/index.d.ts +0 -13
  224. package/lib/plugins/app-types/config.d.ts +0 -3
  225. package/lib/plugins/app-types/cookie/index.d.ts +0 -13
  226. package/lib/plugins/app-types/data/index.d.ts +0 -8
  227. package/lib/plugins/app-types/history/config.d.ts +0 -24
  228. package/lib/plugins/app-types/history/index.d.ts +0 -20
  229. package/lib/plugins/app-types/history/type.d.ts +0 -2
  230. package/lib/plugins/app-types/hooks/index.d.ts +0 -12
  231. package/lib/plugins/app-types/hooks/useDelayedValue/index.d.ts +0 -2
  232. package/lib/plugins/app-types/hooks/useDispatch/index.d.ts +0 -2
  233. package/lib/plugins/app-types/hooks/useLowCode/index.d.ts +0 -13
  234. package/lib/plugins/app-types/hooks/useStore/index.d.ts +0 -6
  235. package/lib/plugins/app-types/index.d.ts +0 -6
  236. package/lib/plugins/app-types/indexDB/index.d.ts +0 -178
  237. package/lib/plugins/app-types/locales/en.d.ts +0 -3
  238. package/lib/plugins/app-types/locales/index.d.ts +0 -37
  239. package/lib/plugins/app-types/locales/original.d.ts +0 -3
  240. package/lib/plugins/app-types/locales/type.d.ts +0 -19
  241. package/lib/plugins/app-types/locales/zh-CN.d.ts +0 -3
  242. package/lib/plugins/app-types/locales/zh-HK.d.ts +0 -3
  243. package/lib/plugins/app-types/logger/feishu.d.ts +0 -11
  244. package/lib/plugins/app-types/logger/index.d.ts +0 -122
  245. package/lib/plugins/app-types/menuManager/hooks.d.ts +0 -17
  246. package/lib/plugins/app-types/menuManager/index.d.ts +0 -28
  247. package/lib/plugins/app-types/models/global.d.ts +0 -32
  248. package/lib/plugins/app-types/models/index.d.ts +0 -45
  249. package/lib/plugins/app-types/models/type.d.ts +0 -2
  250. package/lib/plugins/app-types/package.json +0 -15
  251. package/lib/plugins/app-types/plugin/index.d.ts +0 -0
  252. package/lib/plugins/app-types/pubsub/example.d.ts +0 -5
  253. package/lib/plugins/app-types/pubsub/index.d.ts +0 -63
  254. package/lib/plugins/app-types/request/cache.d.ts +0 -46
  255. package/lib/plugins/app-types/request/cancelToken.d.ts +0 -38
  256. package/lib/plugins/app-types/request/config.d.ts +0 -3
  257. package/lib/plugins/app-types/request/constants.d.ts +0 -2
  258. package/lib/plugins/app-types/request/index.d.ts +0 -24
  259. package/lib/plugins/app-types/request/pisell2Request.d.ts +0 -6
  260. package/lib/plugins/app-types/request/type.d.ts +0 -41
  261. package/lib/plugins/app-types/request/utils.d.ts +0 -46
  262. package/lib/plugins/app-types/routes/config.d.ts +0 -7
  263. package/lib/plugins/app-types/routes/index.d.ts +0 -28
  264. package/lib/plugins/app-types/socket/components/SocketMonitorPage.d.ts +0 -6
  265. package/lib/plugins/app-types/socket/components/index.d.ts +0 -2
  266. package/lib/plugins/app-types/socket/constants.d.ts +0 -33
  267. package/lib/plugins/app-types/socket/events.d.ts +0 -31
  268. package/lib/plugins/app-types/socket/heartbeat.d.ts +0 -66
  269. package/lib/plugins/app-types/socket/index.d.ts +0 -61
  270. package/lib/plugins/app-types/socket/monitor.d.ts +0 -169
  271. package/lib/plugins/app-types/socket/reconnect.d.ts +0 -61
  272. package/lib/plugins/app-types/socket/socket.d.ts +0 -129
  273. package/lib/plugins/app-types/socket/types.d.ts +0 -85
  274. package/lib/plugins/app-types/storage/index.d.ts +0 -17
  275. package/lib/plugins/app-types/tasks/index.d.ts +0 -77
  276. package/lib/plugins/app-types/tasks/type.d.ts +0 -62
  277. package/lib/plugins/app-types/tasks/useTasks.d.ts +0 -5
  278. package/lib/plugins/app-types/type.d.ts +0 -2
  279. package/lib/plugins/app-types/variables/VariablesProvider.d.ts +0 -7
  280. package/lib/plugins/app-types/variables/config.d.ts +0 -3
  281. package/lib/plugins/app-types/variables/index.d.ts +0 -6
  282. package/lib/plugins/app-types/variables/type.d.ts +0 -2
  283. package/lib/plugins/app-types/website/index.d.ts +0 -6
  284. package/lib/plugins/app.d.ts +0 -8
  285. package/lib/plugins/app.js +0 -17
  286. package/lib/solution/BookingTicket/index.d.ts +0 -184
  287. package/lib/solution/BookingTicket/index.js +0 -426
  288. package/lib/solution/BookingTicket/types.d.ts +0 -68
  289. package/lib/solution/BookingTicket/types.js +0 -72
  290. package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +0 -22
  291. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +0 -117
  292. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +0 -22
  293. package/lib/solution/BookingTicket/utils/scan/handleScan.js +0 -132
  294. package/lib/solution/BookingTicket/utils/scan/index.d.ts +0 -85
  295. package/lib/solution/BookingTicket/utils/scan/index.js +0 -216
  296. package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
  297. package/lib/solution/BookingTicket/utils/scan/scanCache.js +0 -231
  298. package/lib/solution/Checkout/appointmentDemo.json +0 -1
  299. package/lib/solution/Checkout/index.d.ts +0 -432
  300. package/lib/solution/Checkout/index.js +0 -2776
  301. package/lib/solution/Checkout/types.d.ts +0 -727
  302. package/lib/solution/Checkout/types.js +0 -63
  303. package/lib/solution/Checkout/utils/index.d.ts +0 -121
  304. package/lib/solution/Checkout/utils/index.js +0 -362
  305. package/lib/utils/task.d.ts +0 -40
  306. package/lib/utils/task.js +0 -109
  307. package/lib/utils/watch.d.ts +0 -102
  308. package/lib/utils/watch.js +0 -217
@@ -1,63 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // src/solution/Checkout/types.ts
20
- var types_exports = {};
21
- __export(types_exports, {
22
- CheckoutErrorType: () => CheckoutErrorType,
23
- CheckoutHooks: () => CheckoutHooks
24
- });
25
- module.exports = __toCommonJS(types_exports);
26
- var CheckoutErrorType = /* @__PURE__ */ ((CheckoutErrorType2) => {
27
- CheckoutErrorType2["OrderCreationFailed"] = "order_creation_failed";
28
- CheckoutErrorType2["PaymentFailed"] = "payment_failed";
29
- CheckoutErrorType2["ValidationFailed"] = "validation_failed";
30
- CheckoutErrorType2["NetworkError"] = "network_error";
31
- CheckoutErrorType2["UnknownError"] = "unknown_error";
32
- return CheckoutErrorType2;
33
- })(CheckoutErrorType || {});
34
- var CheckoutHooks = /* @__PURE__ */ ((CheckoutHooks2) => {
35
- CheckoutHooks2["OnCheckoutInitialized"] = "checkout:onInitialized";
36
- CheckoutHooks2["OnOrderCreated"] = "checkout:onOrderCreated";
37
- CheckoutHooks2["OnOrderCreationFailed"] = "checkout:onOrderCreationFailed";
38
- CheckoutHooks2["OnPaymentStarted"] = "checkout:onPaymentStarted";
39
- CheckoutHooks2["OnPaymentSuccess"] = "checkout:onPaymentSuccess";
40
- CheckoutHooks2["OnPaymentFailed"] = "checkout:onPaymentFailed";
41
- CheckoutHooks2["OnCheckoutCompleted"] = "checkout:onCompleted";
42
- CheckoutHooks2["OnCheckoutCancelled"] = "checkout:onCancelled";
43
- CheckoutHooks2["OnError"] = "checkout:onError";
44
- CheckoutHooks2["OnStateAmountChanged"] = "checkout:onStateAmountChanged";
45
- CheckoutHooks2["OnBalanceDueAmountChanged"] = "checkout:onBalanceDueAmountChanged";
46
- CheckoutHooks2["OnOrderPaymentCompleted"] = "checkout:onOrderPaymentCompleted";
47
- CheckoutHooks2["OnOrderSynced"] = "checkout:onOrderSynced";
48
- CheckoutHooks2["OnOrderSyncFailed"] = "checkout:onOrderSyncFailed";
49
- CheckoutHooks2["OnOrderNoteChanged"] = "checkout:onOrderNoteChanged";
50
- CheckoutHooks2["OnShopDiscountChanged"] = "checkout:onShopDiscountChanged";
51
- CheckoutHooks2["OnOrderCancelled"] = "checkout:onOrderCancelled";
52
- CheckoutHooks2["OnOrderCleared"] = "checkout:onOrderCleared";
53
- CheckoutHooks2["OnOrderSubmitStart"] = "checkout:onOrderSubmitStart";
54
- CheckoutHooks2["OnOrderSubmitEnd"] = "checkout:onOrderSubmitEnd";
55
- CheckoutHooks2["OnWalletDataInitialized"] = "checkout:onWalletDataInitialized";
56
- CheckoutHooks2["OnPaymentItemAdded"] = "checkout:onPaymentItemAdded";
57
- return CheckoutHooks2;
58
- })(CheckoutHooks || {});
59
- // Annotate the CommonJS export names for ESM import in node:
60
- 0 && (module.exports = {
61
- CheckoutErrorType,
62
- CheckoutHooks
63
- });
@@ -1,121 +0,0 @@
1
- import { CheckoutInitParams, CheckoutError, CheckoutErrorType, LocalOrderData, CartSummaryItem, ExtractedAmountInfo } from '../types';
2
- import { CartItem } from '../../../modules/Cart/types';
3
- /**
4
- * 验证结账数据
5
- */
6
- export declare function validateCheckoutData(params: CheckoutInitParams): {
7
- valid: boolean;
8
- errors: string[];
9
- };
10
- /**
11
- * 创建结账错误对象
12
- */
13
- export declare function createCheckoutError(type: CheckoutErrorType, message: string, details?: any): CheckoutError;
14
- /**
15
- * 格式化金额
16
- */
17
- export declare function formatAmount(amount: string | number): string;
18
- /**
19
- * 验证金额
20
- */
21
- export declare function validateAmount(amount: string | number): boolean;
22
- /**
23
- * 生成唯一订单ID
24
- */
25
- export declare function generateOrderId(prefix?: string): string;
26
- /**
27
- * 检查是否为有效的支付方式代码
28
- */
29
- export declare function isValidPaymentMethodCode(code: string): boolean;
30
- /**
31
- * 安全地解析JSON
32
- */
33
- export declare function safeJsonParse<T>(jsonString: string, defaultValue: T): T;
34
- /**
35
- * 深度克隆对象
36
- */
37
- export declare function deepClone<T>(obj: T): T;
38
- /**
39
- * 防抖函数
40
- */
41
- export declare function debounce<T extends (...args: any[]) => any>(func: T, wait: number): (...args: Parameters<T>) => void;
42
- /**
43
- * 节流函数
44
- */
45
- export declare function throttle<T extends (...args: any[]) => any>(func: T, wait: number): (...args: Parameters<T>) => void;
46
- /**
47
- * 重试函数
48
- */
49
- export declare function retry<T>(fn: () => Promise<T>, maxAttempts?: number, delay?: number): Promise<T>;
50
- /**
51
- * 检查对象是否为空
52
- */
53
- export declare function isEmpty(obj: any): boolean;
54
- /**
55
- * 获取错误消息
56
- */
57
- export declare function getErrorMessage(error: unknown): string;
58
- /**
59
- * 检查是否为生产环境
60
- */
61
- export declare function isProduction(): boolean;
62
- /**
63
- * 日志记录器
64
- */
65
- export declare const logger: {
66
- info: (message: string, ...args: any[]) => void;
67
- warn: (message: string, ...args: any[]) => void;
68
- error: (message: string, ...args: any[]) => void;
69
- debug: (message: string, ...args: any[]) => void;
70
- };
71
- /**
72
- * 验证本地订单数据
73
- */
74
- export declare function validateLocalOrderData(orderData: LocalOrderData): {
75
- valid: boolean;
76
- errors: string[];
77
- };
78
- /**
79
- * 生成本地订单ID
80
- */
81
- export declare function generateLocalOrderId(): string;
82
- /**
83
- * 格式化日期时间为 YYYY-MM-DD hh:mm:ss 格式
84
- *
85
- * @param date 要格式化的日期对象
86
- * @returns 格式化后的日期时间字符串
87
- */
88
- export declare function formatDateTime(date: Date): string;
89
- /**
90
- * 从购物车小计数据中提取金额信息
91
- */
92
- export declare function extractAmountFromCartSummary(cartSummary: CartSummaryItem[]): ExtractedAmountInfo;
93
- /**
94
- * 计算购物车总金额
95
- */
96
- export declare function calculateTotalAmount(cartItems: CartItem[]): string;
97
- /**
98
- * 判断订单ID是否为本地生成的虚拟ID
99
- *
100
- * @param orderId 订单ID
101
- * @returns true 表示是虚拟ID,false 表示是真实的后端ID
102
- */
103
- export declare function isVirtualOrderId(orderId: string): boolean;
104
- /**
105
- * 判断支付方式是否需要同步订单到后端
106
- *
107
- * 现金支付(CASHMANUAL)和自定义支付不需要同步,其他支付方式需要同步
108
- *
109
- * @param paymentCode 支付方式代码
110
- * @param paymentType 支付方式类型
111
- * @returns 是否需要同步订单
112
- */
113
- export declare function shouldSyncOrderForPayment(paymentCode: string, paymentType: string): boolean;
114
- /**
115
- * 判断是否为现金支付
116
- *
117
- * @param paymentCode 支付方式代码
118
- * @param paymentType 支付方式类型
119
- * @returns 是否为现金支付
120
- */
121
- export declare function isCashPayment(paymentCode?: string, paymentType?: string): boolean;
@@ -1,362 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // src/solution/Checkout/utils/index.ts
20
- var utils_exports = {};
21
- __export(utils_exports, {
22
- calculateTotalAmount: () => calculateTotalAmount,
23
- createCheckoutError: () => createCheckoutError,
24
- debounce: () => debounce,
25
- deepClone: () => deepClone,
26
- extractAmountFromCartSummary: () => extractAmountFromCartSummary,
27
- formatAmount: () => formatAmount,
28
- formatDateTime: () => formatDateTime,
29
- generateLocalOrderId: () => generateLocalOrderId,
30
- generateOrderId: () => generateOrderId,
31
- getErrorMessage: () => getErrorMessage,
32
- isCashPayment: () => isCashPayment,
33
- isEmpty: () => isEmpty,
34
- isProduction: () => isProduction,
35
- isValidPaymentMethodCode: () => isValidPaymentMethodCode,
36
- isVirtualOrderId: () => isVirtualOrderId,
37
- logger: () => logger,
38
- retry: () => retry,
39
- safeJsonParse: () => safeJsonParse,
40
- shouldSyncOrderForPayment: () => shouldSyncOrderForPayment,
41
- throttle: () => throttle,
42
- validateAmount: () => validateAmount,
43
- validateCheckoutData: () => validateCheckoutData,
44
- validateLocalOrderData: () => validateLocalOrderData
45
- });
46
- module.exports = __toCommonJS(utils_exports);
47
- var import_types = require("../../../modules/Payment/types");
48
- function validateCheckoutData(params) {
49
- const errors = [];
50
- if (!params.cartItems || params.cartItems.length === 0) {
51
- errors.push("购物车不能为空");
52
- }
53
- if (params.cartItems) {
54
- params.cartItems.forEach((item, index) => {
55
- if (!item.id) {
56
- errors.push(`购物车商品 ${index + 1} 缺少商品ID`);
57
- }
58
- if (!item.price || parseFloat(String(item.price)) < 0) {
59
- errors.push(`购物车商品 ${index + 1} 价格无效`);
60
- }
61
- if (!item.num || item.num <= 0) {
62
- errors.push(`购物车商品 ${index + 1} 数量无效`);
63
- }
64
- });
65
- }
66
- if (params.orderType && !["virtual", "appointment_booking"].includes(params.orderType)) {
67
- errors.push("订单类型无效,必须是 virtual 或 appointment_booking");
68
- }
69
- if (params.platform && !["pc", "h5"].includes(params.platform)) {
70
- errors.push("平台类型无效,必须是 pc 或 h5");
71
- }
72
- return {
73
- valid: errors.length === 0,
74
- errors
75
- };
76
- }
77
- function createCheckoutError(type, message, details) {
78
- return {
79
- type,
80
- message,
81
- details,
82
- timestamp: Date.now()
83
- };
84
- }
85
- function formatAmount(amount) {
86
- const numAmount = typeof amount === "string" ? parseFloat(amount) : amount;
87
- if (isNaN(numAmount))
88
- return "0.00";
89
- return numAmount.toFixed(2);
90
- }
91
- function validateAmount(amount) {
92
- const numAmount = typeof amount === "string" ? parseFloat(amount) : amount;
93
- return !isNaN(numAmount) && numAmount >= 0;
94
- }
95
- function generateOrderId(prefix = "order") {
96
- const timestamp = Date.now();
97
- const random = Math.floor(Math.random() * 1e4).toString().padStart(4, "0");
98
- return `${prefix}_${timestamp}_${random}`;
99
- }
100
- function isValidPaymentMethodCode(code) {
101
- return typeof code === "string" && code.length > 0 && /^[a-zA-Z0-9_-]+$/.test(code);
102
- }
103
- function safeJsonParse(jsonString, defaultValue) {
104
- try {
105
- return JSON.parse(jsonString);
106
- } catch {
107
- return defaultValue;
108
- }
109
- }
110
- function deepClone(obj) {
111
- if (obj === null || typeof obj !== "object") {
112
- return obj;
113
- }
114
- if (obj instanceof Date) {
115
- return new Date(obj.getTime());
116
- }
117
- if (obj instanceof Array) {
118
- return obj.map((item) => deepClone(item));
119
- }
120
- if (typeof obj === "object") {
121
- const clonedObj = {};
122
- for (const key in obj) {
123
- if (obj.hasOwnProperty(key)) {
124
- clonedObj[key] = deepClone(obj[key]);
125
- }
126
- }
127
- return clonedObj;
128
- }
129
- return obj;
130
- }
131
- function debounce(func, wait) {
132
- let timeout = null;
133
- return (...args) => {
134
- if (timeout) {
135
- clearTimeout(timeout);
136
- }
137
- timeout = setTimeout(() => {
138
- func.apply(null, args);
139
- }, wait);
140
- };
141
- }
142
- function throttle(func, wait) {
143
- let lastTime = 0;
144
- return (...args) => {
145
- const now = Date.now();
146
- if (now - lastTime >= wait) {
147
- lastTime = now;
148
- func.apply(null, args);
149
- }
150
- };
151
- }
152
- async function retry(fn, maxAttempts = 3, delay = 1e3) {
153
- let lastError;
154
- for (let attempt = 1; attempt <= maxAttempts; attempt++) {
155
- try {
156
- return await fn();
157
- } catch (error) {
158
- lastError = error;
159
- if (attempt === maxAttempts) {
160
- throw lastError;
161
- }
162
- await new Promise((resolve) => setTimeout(resolve, delay * attempt));
163
- }
164
- }
165
- throw lastError;
166
- }
167
- function isEmpty(obj) {
168
- if (obj == null)
169
- return true;
170
- if (Array.isArray(obj) || typeof obj === "string")
171
- return obj.length === 0;
172
- if (typeof obj === "object")
173
- return Object.keys(obj).length === 0;
174
- return false;
175
- }
176
- function getErrorMessage(error) {
177
- if (error instanceof Error) {
178
- return error.message;
179
- }
180
- if (typeof error === "string") {
181
- return error;
182
- }
183
- if (error && typeof error === "object" && "message" in error) {
184
- return String(error.message);
185
- }
186
- return "未知错误";
187
- }
188
- function isProduction() {
189
- return process.env.NODE_ENV === "production";
190
- }
191
- var logger = {
192
- info: (message, ...args) => {
193
- console.log(`[Checkout] ${message}`, ...args);
194
- },
195
- warn: (message, ...args) => {
196
- console.warn(`[Checkout] ${message}`, ...args);
197
- },
198
- error: (message, ...args) => {
199
- console.error(`[Checkout] ${message}`, ...args);
200
- },
201
- debug: (message, ...args) => {
202
- if (!isProduction()) {
203
- console.debug(`[Checkout] ${message}`, ...args);
204
- }
205
- }
206
- };
207
- function validateLocalOrderData(orderData) {
208
- var _a;
209
- const errors = [];
210
- if (!orderData.type) {
211
- errors.push("订单类型不能为空");
212
- }
213
- if (!orderData.platform) {
214
- errors.push("平台信息不能为空");
215
- }
216
- if ((!orderData.bookings || orderData.bookings.length === 0) && !((_a = orderData == null ? void 0 : orderData.relation_products) == null ? void 0 : _a.length)) {
217
- errors.push("预订信息不能为空");
218
- }
219
- if (orderData.bookings) {
220
- orderData.bookings.forEach((booking, index) => {
221
- if (!booking.product || !booking.product.product_id) {
222
- errors.push(`预订项 ${index + 1} 缺少商品信息`);
223
- }
224
- if (!booking.start_date) {
225
- errors.push(`预订项 ${index + 1} 缺少开始日期`);
226
- }
227
- if (!booking.start_time) {
228
- errors.push(`预订项 ${index + 1} 缺少开始时间`);
229
- }
230
- });
231
- }
232
- return {
233
- valid: errors.length === 0,
234
- errors
235
- };
236
- }
237
- function generateLocalOrderId() {
238
- const timestamp = Date.now();
239
- const random = Math.floor(Math.random() * 1e4).toString().padStart(4, "0");
240
- return `local_order_${timestamp}_${random}`;
241
- }
242
- function formatDateTime(date) {
243
- const year = date.getFullYear();
244
- const month = String(date.getMonth() + 1).padStart(2, "0");
245
- const day = String(date.getDate()).padStart(2, "0");
246
- const hours = String(date.getHours()).padStart(2, "0");
247
- const minutes = String(date.getMinutes()).padStart(2, "0");
248
- const seconds = String(date.getSeconds()).padStart(2, "0");
249
- return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
250
- }
251
- function extractAmountFromCartSummary(cartSummary) {
252
- const result = {
253
- totalAmount: "0.00",
254
- subTotal: "0.00",
255
- taxAmount: "0.00",
256
- discountAmount: "0.00",
257
- shopDiscountAmount: "0.00",
258
- roundingAmount: "0.00"
259
- };
260
- cartSummary.forEach((item) => {
261
- const value = Number(item.value).toFixed(2);
262
- switch (item.key) {
263
- case "expect_amount":
264
- result.totalAmount = value;
265
- break;
266
- case "sub_total":
267
- result.subTotal = value;
268
- break;
269
- case "tax":
270
- result.taxAmount = value;
271
- if (item.tax) {
272
- result.taxDetails = item.tax;
273
- }
274
- break;
275
- case "discount":
276
- result.discountAmount = value;
277
- break;
278
- case "shop_discount":
279
- result.shopDiscountAmount = value;
280
- break;
281
- case "custom_roundingAmount":
282
- result.roundingAmount = value;
283
- break;
284
- default:
285
- if (item.key.includes("deposit")) {
286
- result.depositAmount = value;
287
- }
288
- break;
289
- }
290
- });
291
- console.log("[Checkout] 从购物车小计提取金额信息:", {
292
- totalAmount: result.totalAmount,
293
- subTotal: result.subTotal,
294
- taxAmount: result.taxAmount,
295
- discountAmount: result.discountAmount,
296
- shopDiscountAmount: result.shopDiscountAmount,
297
- roundingAmount: result.roundingAmount
298
- });
299
- return result;
300
- }
301
- function calculateTotalAmount(cartItems) {
302
- const total = cartItems.reduce((sum, item) => {
303
- const price = parseFloat(String(item.price) || "0");
304
- const quantity = item.quantity || 1;
305
- return sum + price * quantity;
306
- }, 0);
307
- return total.toFixed(2);
308
- }
309
- function isVirtualOrderId(orderId) {
310
- return orderId.startsWith("local_order_");
311
- }
312
- function shouldSyncOrderForPayment(paymentCode, paymentType) {
313
- const codeUpper = (paymentCode == null ? void 0 : paymentCode.toUpperCase()) || "";
314
- const typeUpper = (paymentType == null ? void 0 : paymentType.toUpperCase()) || "";
315
- const cashIdentifiers = ["CASHMANUAL", "CASH", "MANUAL"];
316
- if (cashIdentifiers.some(
317
- (id) => codeUpper.includes(id) || typeUpper.includes(id)
318
- )) {
319
- return false;
320
- }
321
- if (paymentCode === import_types.PaymentMethodType.Cash || paymentType === import_types.PaymentMethodType.Cash) {
322
- return false;
323
- }
324
- if (codeUpper.includes("CUSTOM") || typeUpper.includes("CUSTOM")) {
325
- return false;
326
- }
327
- return true;
328
- }
329
- function isCashPayment(paymentCode, paymentType) {
330
- const codeUpper = (paymentCode == null ? void 0 : paymentCode.toUpperCase()) || "";
331
- const typeUpper = (paymentType == null ? void 0 : paymentType.toUpperCase()) || "";
332
- const cashIdentifiers = ["CASH", "CASHMANUAL", "MANUAL"];
333
- return cashIdentifiers.some(
334
- (identifier) => codeUpper.includes(identifier) || typeUpper.includes(identifier)
335
- );
336
- }
337
- // Annotate the CommonJS export names for ESM import in node:
338
- 0 && (module.exports = {
339
- calculateTotalAmount,
340
- createCheckoutError,
341
- debounce,
342
- deepClone,
343
- extractAmountFromCartSummary,
344
- formatAmount,
345
- formatDateTime,
346
- generateLocalOrderId,
347
- generateOrderId,
348
- getErrorMessage,
349
- isCashPayment,
350
- isEmpty,
351
- isProduction,
352
- isValidPaymentMethodCode,
353
- isVirtualOrderId,
354
- logger,
355
- retry,
356
- safeJsonParse,
357
- shouldSyncOrderForPayment,
358
- throttle,
359
- validateAmount,
360
- validateCheckoutData,
361
- validateLocalOrderData
362
- });
@@ -1,40 +0,0 @@
1
- type Action = (...args: any[]) => Promise<any>;
2
- type Task = {
3
- uuid: string;
4
- type: string;
5
- actionParams?: Record<string, any>;
6
- };
7
- declare class Tasks {
8
- private actions;
9
- private taskQueue;
10
- isRunning: boolean;
11
- constructor(actions?: Map<string, Action>);
12
- /**
13
- * 清空所有任务
14
- */
15
- clear(): void;
16
- /**
17
- * 清空任务执行队列
18
- */
19
- clearTaskQueue(): void;
20
- /**
21
- * 添加action
22
- * @param name action名称
23
- * @param action action函数
24
- */
25
- addAction(name: string, action: Action): void;
26
- /**
27
- * 添加任务
28
- * @param task 任务
29
- */
30
- addTask(task: Task): void;
31
- /**
32
- * 执行任务
33
- */
34
- run(): Promise<void>;
35
- /**
36
- * 判定当前的任务是否依然存在
37
- */
38
- isTaskExist(uuid: string): boolean;
39
- }
40
- export default Tasks;
package/lib/utils/task.js DELETED
@@ -1,109 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // src/utils/task.ts
20
- var task_exports = {};
21
- __export(task_exports, {
22
- default: () => task_default
23
- });
24
- module.exports = __toCommonJS(task_exports);
25
- var Tasks = class {
26
- constructor(actions) {
27
- this.actions = /* @__PURE__ */ new Map();
28
- this.taskQueue = [];
29
- this.isRunning = false;
30
- if (actions) {
31
- this.actions = actions;
32
- }
33
- }
34
- /**
35
- * 清空所有任务
36
- */
37
- clear() {
38
- this.actions.clear();
39
- this.taskQueue = [];
40
- this.isRunning = false;
41
- }
42
- /**
43
- * 清空任务执行队列
44
- */
45
- clearTaskQueue() {
46
- this.taskQueue = [];
47
- this.isRunning = false;
48
- }
49
- /**
50
- * 添加action
51
- * @param name action名称
52
- * @param action action函数
53
- */
54
- addAction(name, action) {
55
- this.actions.set(name, action);
56
- }
57
- /**
58
- * 添加任务
59
- * @param task 任务
60
- */
61
- addTask(task) {
62
- this.taskQueue.push(task);
63
- this.run();
64
- }
65
- /**
66
- * 执行任务
67
- */
68
- async run() {
69
- var _a;
70
- if (this.isRunning) {
71
- return;
72
- }
73
- if (this.taskQueue.length === 0) {
74
- this.isRunning = false;
75
- return;
76
- }
77
- this.isRunning = true;
78
- while (this.taskQueue.length > 0) {
79
- const task = (_a = this.taskQueue) == null ? void 0 : _a[0];
80
- if (!task) {
81
- this.isRunning = false;
82
- return;
83
- }
84
- const action = this.actions.get(task.type);
85
- if (action) {
86
- try {
87
- await action({ ...(task == null ? void 0 : task.actionParams) || {}, uuid: task == null ? void 0 : task.uuid });
88
- console.log("task_success>>>>>>>", task);
89
- } catch (error) {
90
- console.error("task_error>>>>>>>", error);
91
- } finally {
92
- const _task = this.taskQueue.shift();
93
- console.log("task_shift>>>>>>>", _task);
94
- }
95
- } else {
96
- const _task = this.taskQueue.shift();
97
- console.log("task_action_not_found>>>>>>>", _task);
98
- }
99
- }
100
- this.isRunning = false;
101
- }
102
- /**
103
- * 判定当前的任务是否依然存在
104
- */
105
- isTaskExist(uuid) {
106
- return this.taskQueue.some((task) => (task == null ? void 0 : task.uuid) === uuid);
107
- }
108
- };
109
- var task_default = Tasks;