@pisell/pisellos 0.0.205 → 0.0.207
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 +1 -1
- package/dist/modules/Order/utils.js +8 -2
- package/dist/modules/Rules/types.d.ts +1 -1
- package/dist/modules/Schedule/type.d.ts +7 -7
- package/dist/modules/Schedule/types.d.ts +9 -9
- package/dist/solution/BookingByStep/utils/resources.d.ts +1 -1
- package/dist/solution/ShopDiscount/types.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/lib/core/index.js +27 -28
- package/lib/effects/index.d.ts +1 -1
- package/lib/effects/index.js +3 -7
- package/lib/modules/Account/index.js +9 -10
- package/lib/modules/AccountList/index.js +14 -11
- package/lib/modules/BaseModule.js +6 -3
- package/lib/modules/Cart/index.js +14 -9
- package/lib/modules/Cart/utils/cartProduct.js +3 -6
- package/lib/modules/Date/index.js +8 -4
- package/lib/modules/Date/types.js +1 -0
- package/lib/modules/Discount/index.js +11 -6
- package/lib/modules/Guests/index.js +10 -15
- package/lib/modules/Order/index.js +4 -2
- package/lib/modules/Order/utils.js +3 -2
- package/lib/modules/Payment/cash.js +1 -1
- package/lib/modules/Payment/eftpos.js +1 -1
- package/lib/modules/Payment/index.js +98 -86
- package/lib/modules/Payment/wallet.js +1 -1
- package/lib/modules/Product/index.js +6 -5
- package/lib/modules/ProductList/index.js +5 -4
- package/lib/modules/Resource/index.js +8 -12
- package/lib/modules/Rules/index.js +10 -13
- package/lib/modules/Rules/types.d.ts +1 -1
- package/lib/modules/Schedule/index.js +8 -5
- package/lib/modules/Schedule/type.d.ts +7 -7
- package/lib/modules/Schedule/types.d.ts +9 -9
- package/lib/modules/Schedule/utils.js +2 -4
- package/lib/modules/Step/index.js +7 -4
- package/lib/modules/Summary/index.js +9 -4
- package/lib/plugins/request.js +34 -33
- package/lib/plugins/window.js +101 -113
- package/lib/solution/BookingByStep/index.js +44 -69
- package/lib/solution/BookingByStep/utils/resources.d.ts +1 -1
- package/lib/solution/BookingByStep/utils/resources.js +4 -8
- package/lib/solution/BookingByStep/utils/timeslots.js +6 -12
- package/lib/solution/BuyTickets/index.js +15 -15
- package/lib/solution/ShopDiscount/index.js +15 -11
- package/lib/solution/ShopDiscount/types.d.ts +1 -1
- package/lib/types/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -28,23 +28,26 @@ var import_types = require("./types");
|
|
|
28
28
|
var import_BaseModule = require("../../modules/BaseModule");
|
|
29
29
|
__reExport(BuyTickets_exports, require("./types"), module.exports);
|
|
30
30
|
var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
|
|
31
|
+
// 提供给 baseModule 用的默认名称 和 默认版本
|
|
32
|
+
defaultName = "buyTickets";
|
|
33
|
+
defaultVersion = "1.0.0";
|
|
34
|
+
isSolution = true;
|
|
35
|
+
request;
|
|
36
|
+
window;
|
|
37
|
+
store;
|
|
38
|
+
otherParams = {};
|
|
31
39
|
constructor(name, version) {
|
|
32
40
|
super(name, version);
|
|
33
|
-
// 提供给 baseModule 用的默认名称 和 默认版本
|
|
34
|
-
this.defaultName = "buyTickets";
|
|
35
|
-
this.defaultVersion = "1.0.0";
|
|
36
|
-
this.isSolution = true;
|
|
37
|
-
this.otherParams = {};
|
|
38
41
|
}
|
|
39
42
|
async initialize(core, options) {
|
|
40
43
|
this.core = core;
|
|
41
44
|
this.store = options.store || {};
|
|
42
45
|
this.otherParams = options.otherParams || {};
|
|
43
|
-
console.log("[BuyTickets]
|
|
46
|
+
console.log("[BuyTickets] \u521D\u59CB\u5316\u5B8C\u6210");
|
|
44
47
|
this.request = core.getPlugin("request");
|
|
45
48
|
this.window = core.getPlugin("window");
|
|
46
49
|
if (!this.request) {
|
|
47
|
-
throw new Error("
|
|
50
|
+
throw new Error("\u8D2D\u7269\u8F66\u6A21\u5757\u9700\u8981 request \u63D2\u4EF6\u652F\u6301");
|
|
48
51
|
}
|
|
49
52
|
if (this.otherParams.prodctIds) {
|
|
50
53
|
await this.loadProductsByIds(this.otherParams.prodctIds);
|
|
@@ -76,7 +79,7 @@ var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
|
|
|
76
79
|
}
|
|
77
80
|
async destroy() {
|
|
78
81
|
await this.core.effects.emit(import_types.BuyTicketsHooks.onDestroy, {});
|
|
79
|
-
console.log("[BuyTickets]
|
|
82
|
+
console.log("[BuyTickets] \u5DF2\u9500\u6BC1");
|
|
80
83
|
}
|
|
81
84
|
// 获取当前绑定的所有商品
|
|
82
85
|
async getProducts() {
|
|
@@ -94,10 +97,8 @@ var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
|
|
|
94
97
|
var _a, _b;
|
|
95
98
|
const mainProduct = await ((_a = this.store.mainProducts) == null ? void 0 : _a.getProduct(id));
|
|
96
99
|
const otherProduct = await ((_b = this.store.otherProducts) == null ? void 0 : _b.getProduct(id));
|
|
97
|
-
if (mainProduct)
|
|
98
|
-
|
|
99
|
-
if (otherProduct)
|
|
100
|
-
return otherProduct;
|
|
100
|
+
if (mainProduct) return mainProduct;
|
|
101
|
+
if (otherProduct) return otherProduct;
|
|
101
102
|
return Promise.reject("Not fund product for id: " + id);
|
|
102
103
|
}
|
|
103
104
|
// 商品列表页提交
|
|
@@ -106,13 +107,12 @@ var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
|
|
|
106
107
|
...data,
|
|
107
108
|
products: this.getProducts()
|
|
108
109
|
});
|
|
109
|
-
if (res.status === false)
|
|
110
|
-
return res;
|
|
110
|
+
if (res.status === false) return res;
|
|
111
111
|
this.window.localStorage.setItem(
|
|
112
112
|
"buyTickets:listSubmit",
|
|
113
113
|
JSON.stringify({ ...data, products: this.getProducts() })
|
|
114
114
|
);
|
|
115
|
-
console.log("listSubmit
|
|
115
|
+
console.log("listSubmit \u5E94\u8BE5\u8D70\u903B\u8F91\u5C42\u7684 API \u53D1\u8BF7\u6C42\u4E86");
|
|
116
116
|
}
|
|
117
117
|
// 购物车提交
|
|
118
118
|
async cartSubmit(data) {
|
|
@@ -39,12 +39,16 @@ var import_Discount = require("../../modules/Discount");
|
|
|
39
39
|
var import_Rules = require("../../modules/Rules");
|
|
40
40
|
var import_decimal = __toESM(require("decimal.js"));
|
|
41
41
|
var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
42
|
+
defaultName = "shopDiscount";
|
|
43
|
+
defaultVersion = "1.0.0";
|
|
44
|
+
isSolution = true;
|
|
45
|
+
request;
|
|
46
|
+
window;
|
|
47
|
+
store;
|
|
48
|
+
options = {};
|
|
49
|
+
hooks;
|
|
42
50
|
constructor(name, version) {
|
|
43
51
|
super(name, version);
|
|
44
|
-
this.defaultName = "shopDiscount";
|
|
45
|
-
this.defaultVersion = "1.0.0";
|
|
46
|
-
this.isSolution = true;
|
|
47
|
-
this.options = {};
|
|
48
52
|
this.store = {
|
|
49
53
|
customer: null,
|
|
50
54
|
productList: [],
|
|
@@ -59,7 +63,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
59
63
|
this.options = options;
|
|
60
64
|
this.store = { ...this.store, ...options.store || {} };
|
|
61
65
|
this.hooks = (_b = (_a = options.otherParams) == null ? void 0 : _a.rules) == null ? void 0 : _b.hooks;
|
|
62
|
-
console.log("[ShopDiscount]
|
|
66
|
+
console.log("[ShopDiscount] \u521D\u59CB\u5316\u5B8C\u6210");
|
|
63
67
|
this.initializePlugins();
|
|
64
68
|
this.registerDependentModules();
|
|
65
69
|
this.registerEventListeners();
|
|
@@ -72,7 +76,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
72
76
|
(_b = this.store.rules) == null ? void 0 : _b.destroy();
|
|
73
77
|
this.core.effects.offByModuleDestroy(this.name);
|
|
74
78
|
await this.core.effects.emit(import_types.ShopDiscountHooks.onDestroy, {});
|
|
75
|
-
console.log("[ShopDiscount]
|
|
79
|
+
console.log("[ShopDiscount] \u5DF2\u9500\u6BC1");
|
|
76
80
|
}
|
|
77
81
|
async clear() {
|
|
78
82
|
var _a, _b;
|
|
@@ -87,10 +91,10 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
87
91
|
this.request = this.core.getPlugin("request");
|
|
88
92
|
this.window = this.core.getPlugin("window");
|
|
89
93
|
if (!this.request) {
|
|
90
|
-
throw new Error("ShopDiscount
|
|
94
|
+
throw new Error("ShopDiscount\u9700\u8981 request \u63D2\u4EF6\u652F\u6301");
|
|
91
95
|
}
|
|
92
96
|
if (!this.window) {
|
|
93
|
-
throw new Error("ShopDiscount
|
|
97
|
+
throw new Error("ShopDiscount\u9700\u8981 window \u63D2\u4EF6\u652F\u6301");
|
|
94
98
|
}
|
|
95
99
|
}
|
|
96
100
|
registerDependentModules() {
|
|
@@ -254,7 +258,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
254
258
|
discountList: newDiscountList || this.getDiscountList()
|
|
255
259
|
};
|
|
256
260
|
} catch (error) {
|
|
257
|
-
console.error("[ShopDiscount]
|
|
261
|
+
console.error("[ShopDiscount] \u626B\u7801\u51FA\u9519:", error);
|
|
258
262
|
return {
|
|
259
263
|
type: "clientCalc",
|
|
260
264
|
isAvailable: false,
|
|
@@ -384,7 +388,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
384
388
|
);
|
|
385
389
|
}
|
|
386
390
|
} catch (error) {
|
|
387
|
-
console.error("[ShopDiscount]
|
|
391
|
+
console.error("[ShopDiscount] \u83B7\u53D6\u5BA2\u6237\u94B1\u5305\u4FE1\u606F\u51FA\u9519:", error);
|
|
388
392
|
}
|
|
389
393
|
}
|
|
390
394
|
// 加载准备配置
|
|
@@ -417,7 +421,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
417
421
|
newDiscountList
|
|
418
422
|
);
|
|
419
423
|
} catch (error) {
|
|
420
|
-
console.error("[ShopDiscount]
|
|
424
|
+
console.error("[ShopDiscount] \u52A0\u8F7D\u51C6\u5907\u914D\u7F6E\u51FA\u9519:", error);
|
|
421
425
|
}
|
|
422
426
|
}
|
|
423
427
|
};
|
|
@@ -10,7 +10,7 @@ export declare enum ShopDiscountHooks {
|
|
|
10
10
|
onRulesListChange = "shopDiscount:onRulesListChange",
|
|
11
11
|
onLoadPrepareCalcResult = "shopDiscount:onLoadPrepareCalcResult"
|
|
12
12
|
}
|
|
13
|
-
export type Customer = {
|
|
13
|
+
export declare type Customer = {
|
|
14
14
|
id: string | number;
|
|
15
15
|
name: string;
|
|
16
16
|
email: string;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export interface ModuleOptions {
|
|
|
27
27
|
initialState?: Record<string, any>;
|
|
28
28
|
otherParams?: Record<string, any>;
|
|
29
29
|
}
|
|
30
|
-
export type EventHandler = (data?: any) => void;
|
|
30
|
+
export declare type EventHandler = (data?: any) => void;
|
|
31
31
|
export interface PisellCore {
|
|
32
32
|
registerPlugin: (plugin: Plugin, options?: PluginOptions) => void;
|
|
33
33
|
getPlugin: <T extends Plugin>(name: string) => T | null;
|