@pisell/pisellos 2.1.38 → 2.2.1
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/core/index.d.ts +8 -1
- package/dist/core/index.js +116 -42
- package/dist/effects/index.d.ts +1 -0
- package/dist/effects/index.js +29 -6
- package/dist/modules/Account/index.js +2 -3
- package/dist/modules/BaseModule.d.ts +3 -0
- package/dist/modules/BaseModule.js +15 -0
- package/dist/modules/Customer/index.js +9 -10
- 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 +63 -73
- package/dist/modules/Payment/walletpass.js +4 -1
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/Product/types.d.ts +19 -0
- package/dist/modules/ProductList/index.js +5 -14
- package/dist/modules/Resource/index.js +1 -1
- package/dist/modules/Rules/index.js +2 -3
- package/dist/modules/Schedule/types.d.ts +2 -0
- package/dist/plugins/request.d.ts +1 -0
- package/dist/server/index.d.ts +152 -0
- package/dist/server/index.js +946 -0
- package/dist/server/modules/index.d.ts +16 -0
- package/dist/server/modules/index.js +21 -0
- package/dist/server/modules/menu/index.d.ts +63 -0
- package/dist/server/modules/menu/index.js +476 -0
- package/dist/server/modules/menu/types.d.ts +68 -0
- package/dist/server/modules/menu/types.js +16 -0
- package/dist/server/modules/products/index.d.ts +141 -0
- package/dist/server/modules/products/index.js +768 -0
- package/dist/server/modules/products/types.d.ts +94 -0
- package/dist/server/modules/products/types.js +43 -0
- package/dist/server/modules/quotation/index.d.ts +47 -0
- package/dist/server/modules/quotation/index.js +367 -0
- package/dist/server/modules/quotation/types.d.ts +50 -0
- package/dist/server/modules/quotation/types.js +20 -0
- package/dist/server/modules/schedule/index.d.ts +62 -0
- package/dist/server/modules/schedule/index.js +431 -0
- package/dist/server/modules/schedule/types.d.ts +1 -0
- package/dist/server/modules/schedule/types.js +2 -0
- package/dist/server/modules/schedule/utils.d.ts +32 -0
- package/dist/server/modules/schedule/utils.js +747 -0
- package/dist/server/types.d.ts +64 -0
- package/dist/server/types.js +1 -0
- package/dist/server/utils/index.d.ts +5 -0
- package/dist/server/utils/index.js +6 -0
- package/dist/server/utils/product.d.ts +18 -0
- package/dist/server/utils/product.js +339 -0
- package/dist/server/utils/schedule.d.ts +14 -0
- package/dist/server/utils/schedule.js +108 -0
- package/dist/server/utils/time.d.ts +18 -0
- package/dist/server/utils/time.js +53 -0
- package/dist/solution/BookingByStep/index.d.ts +1 -17
- package/dist/solution/BookingByStep/index.js +23 -468
- package/dist/solution/BookingByStep/utils/capacity.d.ts +2 -7
- package/dist/solution/BookingByStep/utils/capacity.js +8 -24
- package/dist/solution/BookingTicket/index.d.ts +12 -0
- package/dist/solution/BookingTicket/index.js +122 -79
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +4 -0
- package/dist/solution/BookingTicket/utils/scan/index.js +25 -16
- package/dist/solution/BuyTickets/index.js +7 -8
- package/dist/solution/Checkout/index.d.ts +1 -46
- package/dist/solution/Checkout/index.js +530 -850
- package/dist/solution/ShopDiscount/index.js +9 -10
- package/dist/types/index.d.ts +27 -0
- package/lib/core/index.d.ts +8 -1
- package/lib/core/index.js +48 -1
- package/lib/effects/index.d.ts +1 -0
- package/lib/effects/index.js +13 -0
- package/lib/modules/Account/index.js +2 -3
- package/lib/modules/BaseModule.d.ts +3 -0
- package/lib/modules/BaseModule.js +9 -0
- package/lib/modules/Customer/index.js +9 -10
- 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 +56 -43
- package/lib/modules/Payment/walletpass.js +3 -1
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Product/types.d.ts +19 -0
- package/lib/modules/ProductList/index.js +4 -13
- package/lib/modules/Resource/index.js +1 -1
- package/lib/modules/Rules/index.js +2 -3
- package/lib/modules/Schedule/types.d.ts +2 -0
- package/lib/plugins/request.d.ts +1 -0
- package/lib/server/index.d.ts +152 -0
- package/lib/server/index.js +555 -0
- package/lib/server/modules/index.d.ts +16 -0
- package/lib/server/modules/index.js +47 -0
- package/lib/server/modules/menu/index.d.ts +63 -0
- package/lib/server/modules/menu/index.js +234 -0
- package/lib/server/modules/menu/types.d.ts +68 -0
- package/lib/server/modules/menu/types.js +33 -0
- package/lib/server/modules/products/index.d.ts +141 -0
- package/lib/server/modules/products/index.js +434 -0
- package/lib/server/modules/products/types.d.ts +94 -0
- package/lib/server/modules/products/types.js +35 -0
- package/lib/server/modules/quotation/index.d.ts +47 -0
- package/lib/server/modules/quotation/index.js +177 -0
- package/lib/server/modules/quotation/types.d.ts +50 -0
- package/lib/server/modules/quotation/types.js +33 -0
- package/lib/server/modules/schedule/index.d.ts +62 -0
- package/lib/server/modules/schedule/index.js +231 -0
- package/lib/server/modules/schedule/types.d.ts +1 -0
- package/lib/server/modules/schedule/types.js +23 -0
- package/lib/server/modules/schedule/utils.d.ts +32 -0
- package/lib/server/modules/schedule/utils.js +451 -0
- package/lib/server/types.d.ts +64 -0
- package/lib/server/types.js +17 -0
- package/lib/server/utils/index.d.ts +5 -0
- package/lib/server/utils/index.js +25 -0
- package/lib/server/utils/product.d.ts +18 -0
- package/lib/server/utils/product.js +262 -0
- package/lib/server/utils/schedule.d.ts +14 -0
- package/lib/server/utils/schedule.js +88 -0
- package/lib/server/utils/time.d.ts +18 -0
- package/lib/server/utils/time.js +70 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -17
- package/lib/solution/BookingByStep/index.js +40 -312
- package/lib/solution/BookingByStep/utils/capacity.d.ts +2 -7
- package/lib/solution/BookingByStep/utils/capacity.js +8 -21
- package/lib/solution/BookingTicket/index.d.ts +12 -0
- package/lib/solution/BookingTicket/index.js +25 -6
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +4 -0
- package/lib/solution/BookingTicket/utils/scan/index.js +7 -1
- package/lib/solution/BuyTickets/index.js +7 -8
- package/lib/solution/Checkout/index.d.ts +1 -46
- package/lib/solution/Checkout/index.js +92 -289
- package/lib/solution/ShopDiscount/index.js +10 -11
- package/lib/types/index.d.ts +27 -0
- package/package.json +2 -2
|
@@ -34,7 +34,6 @@ __export(ShopDiscount_exports, {
|
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(ShopDiscount_exports);
|
|
36
36
|
var import_BaseModule = require("../../modules/BaseModule");
|
|
37
|
-
var import_types = require("./types");
|
|
38
37
|
var import_Discount = require("../../modules/Discount");
|
|
39
38
|
var import_Rules = require("../../modules/Rules");
|
|
40
39
|
var import_decimal = __toESM(require("decimal.js"));
|
|
@@ -73,7 +72,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
73
72
|
(_a = this.store.discount) == null ? void 0 : _a.destroy();
|
|
74
73
|
(_b = this.store.rules) == null ? void 0 : _b.destroy();
|
|
75
74
|
this.core.effects.offByModuleDestroy(this.name);
|
|
76
|
-
await this.core.effects.emit(
|
|
75
|
+
await this.core.effects.emit(`${this.name}:onDestroy`, {});
|
|
77
76
|
console.log("[ShopDiscount] 已销毁");
|
|
78
77
|
}
|
|
79
78
|
async clear() {
|
|
@@ -123,8 +122,8 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
123
122
|
this.store.rules = rules;
|
|
124
123
|
}
|
|
125
124
|
registerEventListeners() {
|
|
126
|
-
this.core.effects.
|
|
127
|
-
|
|
125
|
+
this.core.effects.only(
|
|
126
|
+
`${this.name}:onCustomerChange`,
|
|
128
127
|
(customer) => {
|
|
129
128
|
var _a;
|
|
130
129
|
if (((_a = this.options.otherParams) == null ? void 0 : _a.cacheId) && this.getDiscountList().length) {
|
|
@@ -146,7 +145,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
146
145
|
if (((_a = this.store.customer) == null ? void 0 : _a.id) !== customer.id) {
|
|
147
146
|
this.store.customer = customer;
|
|
148
147
|
await this.core.effects.emit(
|
|
149
|
-
|
|
148
|
+
`${this.name}:onCustomerChange`,
|
|
150
149
|
customer
|
|
151
150
|
);
|
|
152
151
|
}
|
|
@@ -292,7 +291,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
292
291
|
// 触发优惠列表变更事件
|
|
293
292
|
async emitDiscountListChange(discountList) {
|
|
294
293
|
await this.core.effects.emit(
|
|
295
|
-
|
|
294
|
+
`${this.name}:onDiscountListChange`,
|
|
296
295
|
discountList
|
|
297
296
|
);
|
|
298
297
|
}
|
|
@@ -390,7 +389,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
390
389
|
const { ...customer } = result.data;
|
|
391
390
|
this.setCustomer(customer);
|
|
392
391
|
await this.core.effects.emit(
|
|
393
|
-
|
|
392
|
+
`${this.name}:onScanCustomerChange`,
|
|
394
393
|
customer
|
|
395
394
|
);
|
|
396
395
|
}
|
|
@@ -406,12 +405,12 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
406
405
|
const result = this.calcDiscount(this.store.productList);
|
|
407
406
|
cb == null ? void 0 : cb(result);
|
|
408
407
|
await this.core.effects.emit(
|
|
409
|
-
|
|
408
|
+
`${this.name}:onLoadPrepareCalcResult`,
|
|
410
409
|
result
|
|
411
410
|
);
|
|
412
411
|
}
|
|
413
412
|
await this.core.effects.emit(
|
|
414
|
-
|
|
413
|
+
`${this.name}:onLoadDiscountList`,
|
|
415
414
|
newDiscountList
|
|
416
415
|
);
|
|
417
416
|
}
|
|
@@ -437,12 +436,12 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
437
436
|
if ((_d = this.store.productList) == null ? void 0 : _d.length) {
|
|
438
437
|
const result = this.calcDiscount(this.store.productList);
|
|
439
438
|
await this.core.effects.emit(
|
|
440
|
-
|
|
439
|
+
`${this.name}:onLoadPrepareCalcResult`,
|
|
441
440
|
result
|
|
442
441
|
);
|
|
443
442
|
}
|
|
444
443
|
await this.core.effects.emit(
|
|
445
|
-
|
|
444
|
+
`${this.name}:onLoadDiscountList`,
|
|
446
445
|
newDiscountList
|
|
447
446
|
);
|
|
448
447
|
} catch (error) {
|
package/lib/types/index.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ export interface PisellCore {
|
|
|
40
40
|
effects: {
|
|
41
41
|
on: (event: string, callback: (payload: any) => void) => () => void;
|
|
42
42
|
once: (event: string, callback: (payload: any) => void) => () => void;
|
|
43
|
+
only: (event: string, callback: (payload: any) => void) => () => void;
|
|
43
44
|
off: (event: string, callback: (payload: any) => void) => void;
|
|
44
45
|
emit: (event: string, payload: any, value?: any) => Promise<{
|
|
45
46
|
status: boolean;
|
|
@@ -74,6 +75,26 @@ export interface ModuleContextConfig {
|
|
|
74
75
|
name: string;
|
|
75
76
|
validations: ContextValidationRule[];
|
|
76
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* Server 模块配置
|
|
80
|
+
*/
|
|
81
|
+
export interface ServerModuleConfig {
|
|
82
|
+
/** 模块名称 */
|
|
83
|
+
name: string;
|
|
84
|
+
/** 是否自动预加载数据 */
|
|
85
|
+
preload?: boolean;
|
|
86
|
+
/** 模块配置参数 */
|
|
87
|
+
config?: Record<string, any>;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Server 配置选项
|
|
91
|
+
*/
|
|
92
|
+
export interface ServerOptions {
|
|
93
|
+
/** 要启用的模块列表 */
|
|
94
|
+
modules?: string[] | ServerModuleConfig[];
|
|
95
|
+
/** 是否自动初始化数据 */
|
|
96
|
+
autoInitData?: boolean;
|
|
97
|
+
}
|
|
77
98
|
export interface PisellOSOptions {
|
|
78
99
|
debug?: boolean;
|
|
79
100
|
plugins?: Array<{
|
|
@@ -85,4 +106,10 @@ export interface PisellOSOptions {
|
|
|
85
106
|
options?: ModuleOptions;
|
|
86
107
|
}>;
|
|
87
108
|
context?: BusinessContext;
|
|
109
|
+
/** Server 配置 */
|
|
110
|
+
server?: ServerOptions;
|
|
111
|
+
}
|
|
112
|
+
export interface InitializeServerOptions {
|
|
113
|
+
onModuleLoad?: (module: string) => void;
|
|
114
|
+
onModuleLoadComplete?: (module: string) => void;
|
|
88
115
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"private": false,
|
|
3
3
|
"name": "@pisell/pisellos",
|
|
4
|
-
"version": "2.1
|
|
4
|
+
"version": "2.2.1",
|
|
5
5
|
"description": "一个可扩展的前端模块化SDK框架,支持插件系统",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -69,4 +69,4 @@
|
|
|
69
69
|
"publishConfig": {
|
|
70
70
|
"access": "public"
|
|
71
71
|
}
|
|
72
|
-
}
|
|
72
|
+
}
|