@pisell/pisellos 2.1.35 → 2.1.36
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.
- package/dist/effects/index.d.ts +0 -1
- package/dist/effects/index.js +6 -29
- package/dist/modules/Account/index.js +3 -2
- package/dist/modules/BaseModule.d.ts +0 -3
- package/dist/modules/BaseModule.js +0 -15
- package/dist/modules/Customer/index.js +10 -9
- package/dist/modules/Customer/types.d.ts +2 -2
- package/dist/modules/Customer/types.js +2 -2
- package/dist/modules/Discount/index.js +1 -1
- package/dist/modules/Guests/index.js +9 -9
- package/dist/modules/Order/index.js +1 -1
- package/dist/modules/Payment/index.js +17 -17
- package/dist/modules/Payment/walletpass.js +1 -4
- package/dist/modules/ProductList/index.js +3 -2
- package/dist/modules/Resource/index.js +1 -1
- package/dist/modules/Rules/index.js +3 -2
- package/dist/solution/BookingByStep/index.js +3 -3
- package/dist/solution/BookingTicket/index.d.ts +0 -4
- package/dist/solution/BookingTicket/index.js +8 -17
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +0 -4
- package/dist/solution/BookingTicket/utils/scan/index.js +16 -25
- package/dist/solution/BuyTickets/index.js +8 -7
- package/dist/solution/Checkout/index.js +35 -35
- package/dist/solution/ShopDiscount/index.js +10 -9
- package/dist/types/index.d.ts +0 -1
- package/lib/effects/index.d.ts +0 -1
- package/lib/effects/index.js +0 -13
- package/lib/modules/Account/index.js +3 -2
- package/lib/modules/BaseModule.d.ts +0 -3
- package/lib/modules/BaseModule.js +0 -9
- package/lib/modules/Customer/index.js +10 -9
- package/lib/modules/Customer/types.d.ts +2 -2
- package/lib/modules/Customer/types.js +2 -2
- package/lib/modules/Discount/index.js +1 -1
- package/lib/modules/Guests/index.js +9 -9
- package/lib/modules/Order/index.js +1 -1
- package/lib/modules/Payment/index.js +16 -16
- package/lib/modules/Payment/walletpass.js +1 -3
- package/lib/modules/ProductList/index.js +3 -2
- package/lib/modules/Resource/index.js +1 -1
- package/lib/modules/Rules/index.js +3 -2
- package/lib/solution/BookingByStep/index.js +2 -2
- package/lib/solution/BookingTicket/index.d.ts +0 -4
- package/lib/solution/BookingTicket/index.js +6 -6
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +0 -4
- package/lib/solution/BookingTicket/utils/scan/index.js +1 -7
- package/lib/solution/BuyTickets/index.js +8 -7
- package/lib/solution/Checkout/index.js +34 -34
- package/lib/solution/ShopDiscount/index.js +11 -10
- package/lib/types/index.d.ts +0 -1
- package/package.json +1 -1
package/dist/effects/index.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ type UnsubscribeFunction = () => void;
|
|
|
6
6
|
declare class EffectsManager {
|
|
7
7
|
private listeners;
|
|
8
8
|
on(event: string, callback: EffectCallback): UnsubscribeFunction;
|
|
9
|
-
only(event: string, callback: EffectCallback): UnsubscribeFunction;
|
|
10
9
|
off(event: string, callback: EffectCallback): void;
|
|
11
10
|
offByModuleDestroy(module: string): void;
|
|
12
11
|
once(event: string, callback: EffectCallback): UnsubscribeFunction;
|
package/dist/effects/index.js
CHANGED
|
@@ -30,51 +30,28 @@ var EffectsManager = /*#__PURE__*/function () {
|
|
|
30
30
|
_this.off(event, callback);
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
// 设置单例监听器,只能存在一个,新的会替换旧的
|
|
35
|
-
}, {
|
|
36
|
-
key: "only",
|
|
37
|
-
value: function only(event, callback) {
|
|
38
|
-
var _this$listeners$get3,
|
|
39
|
-
_this2 = this;
|
|
40
|
-
// 清除该事件的所有现有监听器
|
|
41
|
-
if (this.listeners.has(event)) {
|
|
42
|
-
var _this$listeners$get2;
|
|
43
|
-
(_this$listeners$get2 = this.listeners.get(event)) === null || _this$listeners$get2 === void 0 || _this$listeners$get2.clear();
|
|
44
|
-
} else {
|
|
45
|
-
this.listeners.set(event, new Set());
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// 添加新的监听器
|
|
49
|
-
(_this$listeners$get3 = this.listeners.get(event)) === null || _this$listeners$get3 === void 0 || _this$listeners$get3.add(callback);
|
|
50
|
-
|
|
51
|
-
// 返回取消函数
|
|
52
|
-
return function () {
|
|
53
|
-
_this2.off(event, callback);
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
33
|
}, {
|
|
57
34
|
key: "off",
|
|
58
35
|
value: function off(event, callback) {
|
|
59
|
-
var _this$listeners$
|
|
60
|
-
(_this$listeners$
|
|
36
|
+
var _this$listeners$get2;
|
|
37
|
+
(_this$listeners$get2 = this.listeners.get(event)) === null || _this$listeners$get2 === void 0 || _this$listeners$get2.delete(callback);
|
|
61
38
|
}
|
|
62
39
|
|
|
63
40
|
// 模块销毁时,删除所有以模块名开头的监听
|
|
64
41
|
}, {
|
|
65
42
|
key: "offByModuleDestroy",
|
|
66
43
|
value: function offByModuleDestroy(module) {
|
|
67
|
-
var
|
|
44
|
+
var _this2 = this;
|
|
68
45
|
Array.from(this.listeners.keys()).forEach(function (item) {
|
|
69
46
|
if (item.startsWith(module)) {
|
|
70
|
-
|
|
47
|
+
_this2.listeners.delete(item);
|
|
71
48
|
}
|
|
72
49
|
});
|
|
73
50
|
}
|
|
74
51
|
}, {
|
|
75
52
|
key: "once",
|
|
76
53
|
value: function once(event, callback) {
|
|
77
|
-
var
|
|
54
|
+
var _this3 = this;
|
|
78
55
|
var wrapper = /*#__PURE__*/function () {
|
|
79
56
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(payload) {
|
|
80
57
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -83,7 +60,7 @@ var EffectsManager = /*#__PURE__*/function () {
|
|
|
83
60
|
_context.next = 2;
|
|
84
61
|
return callback(payload);
|
|
85
62
|
case 2:
|
|
86
|
-
|
|
63
|
+
_this3.off(event, wrapper);
|
|
87
64
|
case 3:
|
|
88
65
|
case "end":
|
|
89
66
|
return _context.stop();
|
|
@@ -18,6 +18,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
18
18
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
19
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
20
|
import { BaseModule } from "../BaseModule";
|
|
21
|
+
import { AccountHooks } from "./types";
|
|
21
22
|
export * from "./types";
|
|
22
23
|
export var AccountModule = /*#__PURE__*/function (_BaseModule) {
|
|
23
24
|
_inherits(AccountModule, _BaseModule);
|
|
@@ -84,7 +85,7 @@ export var AccountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
84
85
|
this.store.accountInfo = account;
|
|
85
86
|
this.store.isLoggedIn = true;
|
|
86
87
|
_context2.next = 5;
|
|
87
|
-
return this.core.effects.emit(
|
|
88
|
+
return this.core.effects.emit(AccountHooks.OnLogin, account);
|
|
88
89
|
case 5:
|
|
89
90
|
case "end":
|
|
90
91
|
return _context2.stop();
|
|
@@ -116,7 +117,7 @@ export var AccountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
116
117
|
case 2:
|
|
117
118
|
this.store.accountInfo = _objectSpread(_objectSpread({}, this.store.accountInfo), updates);
|
|
118
119
|
_context3.next = 5;
|
|
119
|
-
return this.core.effects.emit(
|
|
120
|
+
return this.core.effects.emit(AccountHooks.OnProfileUpdate, this.store.accountInfo);
|
|
120
121
|
case 5:
|
|
121
122
|
case "end":
|
|
122
123
|
return _context3.stop();
|
|
@@ -14,7 +14,4 @@ export declare class BaseModule {
|
|
|
14
14
|
store: any;
|
|
15
15
|
cacheKey: string[];
|
|
16
16
|
}): void;
|
|
17
|
-
effectsOn(eventType: string, callback: (payload: any) => void): () => void;
|
|
18
|
-
effectsOff(eventType: string, callback: (payload: any) => void): void;
|
|
19
|
-
effectsOnce(eventType: string, callback: (payload: any) => void): () => void;
|
|
20
17
|
}
|
|
@@ -64,21 +64,6 @@ export var BaseModule = /*#__PURE__*/function () {
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
}, {
|
|
68
|
-
key: "effectsOn",
|
|
69
|
-
value: function effectsOn(eventType, callback) {
|
|
70
|
-
return this.core.effects.on("".concat(this.name, ":").concat(eventType), callback);
|
|
71
|
-
}
|
|
72
|
-
}, {
|
|
73
|
-
key: "effectsOff",
|
|
74
|
-
value: function effectsOff(eventType, callback) {
|
|
75
|
-
return this.core.effects.off("".concat(this.name, ":").concat(eventType), callback);
|
|
76
|
-
}
|
|
77
|
-
}, {
|
|
78
|
-
key: "effectsOnce",
|
|
79
|
-
value: function effectsOnce(eventType, callback) {
|
|
80
|
-
return this.core.effects.once("".concat(this.name, ":").concat(eventType), callback);
|
|
81
|
-
}
|
|
82
67
|
}]);
|
|
83
68
|
return BaseModule;
|
|
84
69
|
}();
|
|
@@ -29,6 +29,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
29
29
|
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); }
|
|
30
30
|
import { cloneDeep } from 'lodash-es';
|
|
31
31
|
import { BaseModule } from "../BaseModule";
|
|
32
|
+
import { CustomerHooks } from "./types";
|
|
32
33
|
import { DEFAULT_CUSTOMER, DEFAULT_PAGE_SIZE, SORT_BY } from "./constants";
|
|
33
34
|
export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
34
35
|
_inherits(CustomerModule, _BaseModule);
|
|
@@ -202,7 +203,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
202
203
|
console.error("Failed to ".concat(operation, ":"), error);
|
|
203
204
|
this.store.error = error instanceof Error ? error.message : "Failed to ".concat(operation);
|
|
204
205
|
_context3.next = 4;
|
|
205
|
-
return this.core.effects.emit(
|
|
206
|
+
return this.core.effects.emit(CustomerHooks.OnCustomerListError, this.store.error);
|
|
206
207
|
case 4:
|
|
207
208
|
case "end":
|
|
208
209
|
return _context3.stop();
|
|
@@ -265,7 +266,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
265
266
|
// 设置客户列表(替换模式)
|
|
266
267
|
this.store.customerList = cloneDeep(customerList);
|
|
267
268
|
_context4.next = 20;
|
|
268
|
-
return this.core.effects.emit(
|
|
269
|
+
return this.core.effects.emit(CustomerHooks.OnCustomerListUpdate, this.store);
|
|
269
270
|
case 20:
|
|
270
271
|
// 触发分页变化事件
|
|
271
272
|
this.triggerPaginationChange({
|
|
@@ -328,7 +329,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
328
329
|
key: "setSelectedCustomer",
|
|
329
330
|
value: function setSelectedCustomer(customer) {
|
|
330
331
|
this.store.selectedCustomer = !customer ? DEFAULT_CUSTOMER : cloneDeep(customer);
|
|
331
|
-
this.core.effects.emit(
|
|
332
|
+
this.core.effects.emit(CustomerHooks.OnCustomerSelected, this.store.selectedCustomer);
|
|
332
333
|
this.storeChange();
|
|
333
334
|
}
|
|
334
335
|
|
|
@@ -379,7 +380,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
379
380
|
this.store.hasMore = true;
|
|
380
381
|
this.store.loadingMore = false;
|
|
381
382
|
this.store.searchParams = {};
|
|
382
|
-
this.core.effects.emit(
|
|
383
|
+
this.core.effects.emit(CustomerHooks.OnCustomerListUpdate, this.store);
|
|
383
384
|
this.storeChange();
|
|
384
385
|
}
|
|
385
386
|
|
|
@@ -400,7 +401,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
400
401
|
this.store.total += 1;
|
|
401
402
|
|
|
402
403
|
// 触发客户列表更新事件
|
|
403
|
-
this.core.effects.emit(
|
|
404
|
+
this.core.effects.emit(CustomerHooks.OnCustomerListUpdate, this.store);
|
|
404
405
|
|
|
405
406
|
// 保存状态变化
|
|
406
407
|
this.storeChange();
|
|
@@ -438,7 +439,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
438
439
|
}, {
|
|
439
440
|
key: "triggerPaginationChange",
|
|
440
441
|
value: function triggerPaginationChange(pagination) {
|
|
441
|
-
this.core.effects.emit(
|
|
442
|
+
this.core.effects.emit(CustomerHooks.OnPaginationChange, pagination);
|
|
442
443
|
}
|
|
443
444
|
|
|
444
445
|
/**
|
|
@@ -551,7 +552,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
551
552
|
|
|
552
553
|
// 触发滚动加载特定事件
|
|
553
554
|
_context6.next = 20;
|
|
554
|
-
return this.core.effects.emit(
|
|
555
|
+
return this.core.effects.emit(CustomerHooks.OnScrollLoadMore, {
|
|
555
556
|
newCustomers: newCustomers,
|
|
556
557
|
allCustomers: this.store.customerList,
|
|
557
558
|
currentPage: page,
|
|
@@ -559,7 +560,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
559
560
|
});
|
|
560
561
|
case 20:
|
|
561
562
|
_context6.next = 22;
|
|
562
|
-
return this.core.effects.emit(
|
|
563
|
+
return this.core.effects.emit(CustomerHooks.OnCustomerListUpdate, this.store);
|
|
563
564
|
case 22:
|
|
564
565
|
// 触发分页变化事件
|
|
565
566
|
this.triggerPaginationChange({
|
|
@@ -633,7 +634,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
633
634
|
case 8:
|
|
634
635
|
response = _context7.sent;
|
|
635
636
|
_context7.next = 11;
|
|
636
|
-
return this.core.effects.emit(
|
|
637
|
+
return this.core.effects.emit(CustomerHooks.OnScrollLoadComplete, {
|
|
637
638
|
customers: this.store.customerList,
|
|
638
639
|
total: this.store.total,
|
|
639
640
|
hasMore: this.store.hasMore
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ICustomer } from "../AccountList/types";
|
|
2
2
|
export declare enum CustomerHooks {
|
|
3
|
-
OnCustomerListUpdate = "customer:
|
|
3
|
+
OnCustomerListUpdate = "customer:onUpdate",
|
|
4
4
|
OnCustomerListError = "customer:onError",
|
|
5
|
-
OnCustomerSelected = "customer:
|
|
5
|
+
OnCustomerSelected = "customer:onSelected",
|
|
6
6
|
OnPaginationChange = "customer:onPaginationChange",
|
|
7
7
|
OnScrollLoadMore = "customer:onScrollLoadMore",
|
|
8
8
|
OnScrollLoadComplete = "customer:onScrollLoadComplete"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export var CustomerHooks = /*#__PURE__*/function (CustomerHooks) {
|
|
2
|
-
CustomerHooks["OnCustomerListUpdate"] = "customer:
|
|
2
|
+
CustomerHooks["OnCustomerListUpdate"] = "customer:onUpdate";
|
|
3
3
|
CustomerHooks["OnCustomerListError"] = "customer:onError";
|
|
4
|
-
CustomerHooks["OnCustomerSelected"] = "customer:
|
|
4
|
+
CustomerHooks["OnCustomerSelected"] = "customer:onSelected";
|
|
5
5
|
CustomerHooks["OnPaginationChange"] = "customer:onPaginationChange";
|
|
6
6
|
CustomerHooks["OnScrollLoadMore"] = "customer:onScrollLoadMore";
|
|
7
7
|
CustomerHooks["OnScrollLoadComplete"] = "customer:onScrollLoadComplete";
|
|
@@ -283,7 +283,7 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
283
283
|
this.store.discountList = [];
|
|
284
284
|
this.core.effects.offByModuleDestroy(this.name);
|
|
285
285
|
_context5.next = 4;
|
|
286
|
-
return this.core.effects.emit(
|
|
286
|
+
return this.core.effects.emit(DiscountHooks.OnDestroy, {});
|
|
287
287
|
case 4:
|
|
288
288
|
console.log('[Discount] 已销毁');
|
|
289
289
|
case 5:
|
|
@@ -70,10 +70,10 @@ export var GuestListModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
70
70
|
case 0:
|
|
71
71
|
this.state.list.push(guest);
|
|
72
72
|
_context2.next = 3;
|
|
73
|
-
return this.core.effects.emit(
|
|
73
|
+
return this.core.effects.emit(GuestHooks.OnGuestAdd, guest);
|
|
74
74
|
case 3:
|
|
75
75
|
_context2.next = 5;
|
|
76
|
-
return this.core.effects.emit(
|
|
76
|
+
return this.core.effects.emit(GuestHooks.OnGuestChange, this.state.list);
|
|
77
77
|
case 5:
|
|
78
78
|
case "end":
|
|
79
79
|
return _context2.stop();
|
|
@@ -107,7 +107,7 @@ export var GuestListModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
107
107
|
return this.core.effects.emit(GuestHooks.OnGuestUpdate, this.state.list[index]);
|
|
108
108
|
case 6:
|
|
109
109
|
_context3.next = 8;
|
|
110
|
-
return this.core.effects.emit(
|
|
110
|
+
return this.core.effects.emit(GuestHooks.OnGuestChange, this.state.list);
|
|
111
111
|
case 8:
|
|
112
112
|
case "end":
|
|
113
113
|
return _context3.stop();
|
|
@@ -138,10 +138,10 @@ export var GuestListModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
138
138
|
case 3:
|
|
139
139
|
_this$state$list$spli = this.state.list.splice(index, 1), _this$state$list$spli2 = _slicedToArray(_this$state$list$spli, 1), removed = _this$state$list$spli2[0];
|
|
140
140
|
_context4.next = 6;
|
|
141
|
-
return this.core.effects.emit(
|
|
141
|
+
return this.core.effects.emit(GuestHooks.OnGuestRemove, removed);
|
|
142
142
|
case 6:
|
|
143
143
|
_context4.next = 8;
|
|
144
|
-
return this.core.effects.emit(
|
|
144
|
+
return this.core.effects.emit(GuestHooks.OnGuestChange, this.state.list);
|
|
145
145
|
case 8:
|
|
146
146
|
case "end":
|
|
147
147
|
return _context4.stop();
|
|
@@ -196,10 +196,10 @@ export var GuestListModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
196
196
|
case 3:
|
|
197
197
|
guest.items.push(item);
|
|
198
198
|
_context6.next = 6;
|
|
199
|
-
return this.core.effects.emit(
|
|
199
|
+
return this.core.effects.emit(GuestHooks.OnGuestUpdate, guest);
|
|
200
200
|
case 6:
|
|
201
201
|
_context6.next = 8;
|
|
202
|
-
return this.core.effects.emit(
|
|
202
|
+
return this.core.effects.emit(GuestHooks.OnGuestChange, this.state.list);
|
|
203
203
|
case 8:
|
|
204
204
|
case "end":
|
|
205
205
|
return _context6.stop();
|
|
@@ -239,10 +239,10 @@ export var GuestListModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
239
239
|
case 6:
|
|
240
240
|
guest.items.splice(index, 1);
|
|
241
241
|
_context7.next = 9;
|
|
242
|
-
return this.core.effects.emit(
|
|
242
|
+
return this.core.effects.emit(GuestHooks.OnGuestUpdate, guest);
|
|
243
243
|
case 9:
|
|
244
244
|
_context7.next = 11;
|
|
245
|
-
return this.core.effects.emit(
|
|
245
|
+
return this.core.effects.emit(GuestHooks.OnGuestChange, this.state.list);
|
|
246
246
|
case 11:
|
|
247
247
|
case "end":
|
|
248
248
|
return _context7.stop();
|
|
@@ -35,7 +35,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
35
35
|
function OrderModule(name, version) {
|
|
36
36
|
var _this;
|
|
37
37
|
_classCallCheck(this, OrderModule);
|
|
38
|
-
_this = _super.call(this, name
|
|
38
|
+
_this = _super.call(this, name, version);
|
|
39
39
|
_defineProperty(_assertThisInitialized(_this), "defaultName", 'order');
|
|
40
40
|
_defineProperty(_assertThisInitialized(_this), "defaultVersion", '1.0.0');
|
|
41
41
|
_defineProperty(_assertThisInitialized(_this), "store", void 0);
|
|
@@ -21,7 +21,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
21
21
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
22
22
|
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); }
|
|
23
23
|
import { BaseModule } from "../BaseModule";
|
|
24
|
-
import { PaymentStatus, PaymentMethodType, RoundingRule } from "./types";
|
|
24
|
+
import { PaymentStatus, PaymentHooks, PaymentMethodType, RoundingRule } from "./types";
|
|
25
25
|
import { getUniqueId } from "../Cart/utils";
|
|
26
26
|
import { CashPaymentImpl } from "./cash";
|
|
27
27
|
import { EftposPaymentImpl } from "./eftpos";
|
|
@@ -73,7 +73,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
73
73
|
function PaymentModule(name, version) {
|
|
74
74
|
var _this;
|
|
75
75
|
_classCallCheck(this, PaymentModule);
|
|
76
|
-
_this = _super.call(this, name
|
|
76
|
+
_this = _super.call(this, name, version);
|
|
77
77
|
// 初始化支付方式实例
|
|
78
78
|
_defineProperty(_assertThisInitialized(_this), "defaultName", 'pay');
|
|
79
79
|
_defineProperty(_assertThisInitialized(_this), "defaultVersion", '1.0.0');
|
|
@@ -338,7 +338,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
338
338
|
console.warn('[PaymentModule] 无法缓存支付方式,pay_method 表不存在');
|
|
339
339
|
case 43:
|
|
340
340
|
_context3.next = 45;
|
|
341
|
-
return this.core.effects.emit(
|
|
341
|
+
return this.core.effects.emit(PaymentHooks.OnPaymentMethodsLoaded, payMethods);
|
|
342
342
|
case 45:
|
|
343
343
|
this.logInfo('getPayMethodListAsync completed successfully', {
|
|
344
344
|
methodCount: payMethods.length,
|
|
@@ -469,7 +469,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
469
469
|
newMethods: newPayMethods
|
|
470
470
|
};
|
|
471
471
|
_context4.next = 54;
|
|
472
|
-
return this.core.effects.emit(
|
|
472
|
+
return this.core.effects.emit(PaymentHooks.OnPaymentMethodsChanged, eventData);
|
|
473
473
|
case 54:
|
|
474
474
|
_context4.next = 57;
|
|
475
475
|
break;
|
|
@@ -782,7 +782,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
782
782
|
return this.dbManager.delete('order', orderUuid);
|
|
783
783
|
case 7:
|
|
784
784
|
_context8.next = 9;
|
|
785
|
-
return this.core.effects.emit(
|
|
785
|
+
return this.core.effects.emit(PaymentHooks.OnOrderDeleted, order);
|
|
786
786
|
case 9:
|
|
787
787
|
console.log('[PaymentModule] 支付订单删除成功:', orderUuid);
|
|
788
788
|
case 10:
|
|
@@ -831,10 +831,10 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
831
831
|
return this.dbManager.update('order', updatedOrder);
|
|
832
832
|
case 9:
|
|
833
833
|
_context9.next = 11;
|
|
834
|
-
return this.core.effects.emit(
|
|
834
|
+
return this.core.effects.emit(PaymentHooks.OnOrderUpdated, updatedOrder);
|
|
835
835
|
case 11:
|
|
836
836
|
_context9.next = 13;
|
|
837
|
-
return this.core.effects.emit(
|
|
837
|
+
return this.core.effects.emit(PaymentHooks.OnOrderChanged, {
|
|
838
838
|
action: 'update',
|
|
839
839
|
order: updatedOrder,
|
|
840
840
|
originalOrder: order
|
|
@@ -929,10 +929,10 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
929
929
|
return this.dbManager.update('order', updatedOrder);
|
|
930
930
|
case 19:
|
|
931
931
|
_context10.next = 21;
|
|
932
|
-
return this.core.effects.emit(
|
|
932
|
+
return this.core.effects.emit(PaymentHooks.OnOrderUpdated, updatedOrder);
|
|
933
933
|
case 21:
|
|
934
934
|
_context10.next = 23;
|
|
935
|
-
return this.core.effects.emit(
|
|
935
|
+
return this.core.effects.emit(PaymentHooks.OnOrderChanged, {
|
|
936
936
|
action: 'order_id_replaced',
|
|
937
937
|
order: updatedOrder,
|
|
938
938
|
originalOrder: existingOrder,
|
|
@@ -1129,7 +1129,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1129
1129
|
return this.dbManager.update('order', order);
|
|
1130
1130
|
case 21:
|
|
1131
1131
|
_context13.next = 23;
|
|
1132
|
-
return this.core.effects.emit(
|
|
1132
|
+
return this.core.effects.emit(PaymentHooks.OnPaymentAdded, {
|
|
1133
1133
|
orderUuid: orderUuid,
|
|
1134
1134
|
payment: newPaymentItem
|
|
1135
1135
|
});
|
|
@@ -1231,13 +1231,13 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1231
1231
|
return this.dbManager.update('order', order);
|
|
1232
1232
|
case 20:
|
|
1233
1233
|
_context14.next = 22;
|
|
1234
|
-
return this.core.effects.emit(
|
|
1234
|
+
return this.core.effects.emit(PaymentHooks.OnPaymentDeleted, {
|
|
1235
1235
|
order: order,
|
|
1236
1236
|
paymentItem: paymentItem
|
|
1237
1237
|
});
|
|
1238
1238
|
case 22:
|
|
1239
1239
|
_context14.next = 24;
|
|
1240
|
-
return this.core.effects.emit(
|
|
1240
|
+
return this.core.effects.emit(PaymentHooks.OnOrderChanged, {
|
|
1241
1241
|
action: 'payment_delete',
|
|
1242
1242
|
order: order,
|
|
1243
1243
|
paymentItem: paymentItem
|
|
@@ -1404,7 +1404,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1404
1404
|
case 50:
|
|
1405
1405
|
updatedOrder = _context15.sent;
|
|
1406
1406
|
_context15.next = 53;
|
|
1407
|
-
return this.core.effects.emit(
|
|
1407
|
+
return this.core.effects.emit(PaymentHooks.OnPaymentAdded, {
|
|
1408
1408
|
orderUuid: orderUuid,
|
|
1409
1409
|
order: updatedOrder,
|
|
1410
1410
|
payment: null // 批量操作不提供单个支付项
|
|
@@ -1483,13 +1483,13 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1483
1483
|
return this.dbManager.update('order', order);
|
|
1484
1484
|
case 14:
|
|
1485
1485
|
_context16.next = 16;
|
|
1486
|
-
return this.core.effects.emit(
|
|
1486
|
+
return this.core.effects.emit(PaymentHooks.OnPaymentUpdated, {
|
|
1487
1487
|
order: order,
|
|
1488
1488
|
paymentItem: paymentItem
|
|
1489
1489
|
});
|
|
1490
1490
|
case 16:
|
|
1491
1491
|
_context16.next = 18;
|
|
1492
|
-
return this.core.effects.emit(
|
|
1492
|
+
return this.core.effects.emit(PaymentHooks.OnOrderChanged, {
|
|
1493
1493
|
action: 'payment_update',
|
|
1494
1494
|
order: order,
|
|
1495
1495
|
paymentItem: paymentItem
|
|
@@ -1668,10 +1668,10 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1668
1668
|
return _context18.abrupt("return");
|
|
1669
1669
|
case 12:
|
|
1670
1670
|
_context18.next = 14;
|
|
1671
|
-
return this.core.effects.emit(
|
|
1671
|
+
return this.core.effects.emit(PaymentHooks.OnPaymentSubmitted, order);
|
|
1672
1672
|
case 14:
|
|
1673
1673
|
_context18.next = 16;
|
|
1674
|
-
return this.core.effects.emit(
|
|
1674
|
+
return this.core.effects.emit(PaymentHooks.OnOrderChanged, {
|
|
1675
1675
|
action: 'submit',
|
|
1676
1676
|
order: order
|
|
1677
1677
|
});
|
|
@@ -40,10 +40,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
40
40
|
key: "emitEvent",
|
|
41
41
|
value: function emitEvent(hook, data) {
|
|
42
42
|
try {
|
|
43
|
-
|
|
44
|
-
var eventName = hook.split(':')[1] || hook.replace(/^[A-Z][a-z]+/, '').replace(/^On/, '').toLowerCase();
|
|
45
|
-
var fullEventName = "".concat(this.paymentModule.name, ":").concat(eventName);
|
|
46
|
-
this.paymentModule.core.effects.emit(fullEventName, data);
|
|
43
|
+
this.paymentModule.core.effects.emit(hook, data);
|
|
47
44
|
} catch (error) {
|
|
48
45
|
this.paymentModule.logError('[WalletPass] 发送事件失败', error, {
|
|
49
46
|
hook: hook
|
|
@@ -16,6 +16,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
16
16
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
17
17
|
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); }
|
|
18
18
|
import { BaseModule } from "../BaseModule";
|
|
19
|
+
import { ProductListHooks } from "./types";
|
|
19
20
|
import { cloneDeep } from 'lodash-es';
|
|
20
21
|
export * from "./types";
|
|
21
22
|
export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
@@ -201,7 +202,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
201
202
|
while (1) switch (_context5.prev = _context5.next) {
|
|
202
203
|
case 0:
|
|
203
204
|
_context5.next = 2;
|
|
204
|
-
return this.core.effects.emit(
|
|
205
|
+
return this.core.effects.emit(ProductListHooks.onGetProducts, this.store.list);
|
|
205
206
|
case 2:
|
|
206
207
|
return _context5.abrupt("return", cloneDeep(this.store.list));
|
|
207
208
|
case 3:
|
|
@@ -224,7 +225,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
224
225
|
while (1) switch (_context6.prev = _context6.next) {
|
|
225
226
|
case 0:
|
|
226
227
|
_context6.next = 2;
|
|
227
|
-
return this.core.effects.emit(
|
|
228
|
+
return this.core.effects.emit(ProductListHooks.onGetProduct, this.store.list);
|
|
228
229
|
case 2:
|
|
229
230
|
product = this.store.list.find(function (product) {
|
|
230
231
|
return product.id === id;
|
|
@@ -89,7 +89,7 @@ export var ResourceListModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
89
89
|
case 3:
|
|
90
90
|
this.store.selectedResource = resource;
|
|
91
91
|
_context3.next = 6;
|
|
92
|
-
return this.core.effects.emit(
|
|
92
|
+
return this.core.effects.emit(ResourceHooks.OnResourceSelect, resource);
|
|
93
93
|
case 6:
|
|
94
94
|
case "end":
|
|
95
95
|
return _context3.stop();
|
|
@@ -24,6 +24,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
24
24
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
25
25
|
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); }
|
|
26
26
|
import { BaseModule } from "../BaseModule";
|
|
27
|
+
import { RulesHooks } from "./types";
|
|
27
28
|
import { uniqueById, getDiscountAmount } from "../../solution/ShopDiscount/utils";
|
|
28
29
|
import { getProductOriginTotalPrice, getProductTotalPrice } from "../Cart/utils";
|
|
29
30
|
import Decimal from 'decimal.js';
|
|
@@ -72,7 +73,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
72
73
|
case 0:
|
|
73
74
|
this.store.rulesList = rulesList;
|
|
74
75
|
_context2.next = 3;
|
|
75
|
-
return this.core.effects.emit(
|
|
76
|
+
return this.core.effects.emit(RulesHooks.OnRulesListChange, rulesList);
|
|
76
77
|
case 3:
|
|
77
78
|
case "end":
|
|
78
79
|
return _context2.stop();
|
|
@@ -664,7 +665,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
664
665
|
case 0:
|
|
665
666
|
this.core.effects.offByModuleDestroy(this.name);
|
|
666
667
|
_context3.next = 3;
|
|
667
|
-
return this.core.effects.emit(
|
|
668
|
+
return this.core.effects.emit(RulesHooks.OnDestroy, {});
|
|
668
669
|
case 3:
|
|
669
670
|
console.log('[Rules] 已销毁');
|
|
670
671
|
case 4:
|
|
@@ -29,7 +29,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
29
29
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
30
30
|
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); }
|
|
31
31
|
import { BaseModule } from "../../modules/BaseModule";
|
|
32
|
-
import { createModule } from "./types";
|
|
32
|
+
import { BookingByStepHooks, createModule } from "./types";
|
|
33
33
|
import { formatProductToCartItem, createCartItemOrigin, getUniqueId, handleVariantProduct, formatDateToCartItem, formatAccountToCartItem } from "../../modules/Cart/utils";
|
|
34
34
|
import { getAvailableProductResources } from "./utils/products";
|
|
35
35
|
import { getResourcesByProduct, getTimeSlicesByResource, getTimeSlicesByResources, getIsUsableByTimeItem, getOthersSelectedResources, getOthersCartSelectedResources, filterScheduleByDateRange, checkSessionProductLeadTime, sortCombinedResources, filterResourcesByFormItem, checkTwoResourcesIntersection, isConflict } from "./utils/resources";
|
|
@@ -137,7 +137,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
137
137
|
}
|
|
138
138
|
});
|
|
139
139
|
this.store.schedule.loadAllSchedule();
|
|
140
|
-
this.core.effects.emit(
|
|
140
|
+
this.core.effects.emit(BookingByStepHooks.onInited, {});
|
|
141
141
|
case 19:
|
|
142
142
|
case "end":
|
|
143
143
|
return _context.stop();
|
|
@@ -1196,7 +1196,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1196
1196
|
date: date
|
|
1197
1197
|
});
|
|
1198
1198
|
// 如果 quantity 大于 1,且是预约商品,则进入购物车拆散成多条数据
|
|
1199
|
-
if (addItemParams.quantity > 1 && !isNormalProduct(productData
|
|
1199
|
+
if (addItemParams.quantity > 1 && !isNormalProduct(productData)) {
|
|
1200
1200
|
for (var i = 0; i < addItemParams.quantity; i++) {
|
|
1201
1201
|
var newAddItemParams = cloneDeep(addItemParams);
|
|
1202
1202
|
newAddItemParams.quantity = 1;
|
|
@@ -22,10 +22,6 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
22
22
|
* @returns 商品列表
|
|
23
23
|
*/
|
|
24
24
|
loadProducts(params?: ILoadProductsParams): Promise<any>;
|
|
25
|
-
/**
|
|
26
|
-
* 初始化外设扫码结果监听
|
|
27
|
-
*/
|
|
28
|
-
initPeripheralsListener(): void;
|
|
29
25
|
/**
|
|
30
26
|
* 获取商品列表(不加载到模块中)
|
|
31
27
|
* @returns 商品列表
|