@pisell/pisellos 3.0.5 → 3.0.7
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/modules/Account/index.d.ts +2 -6
- package/dist/modules/Account/index.js +21 -103
- package/dist/modules/Account/types.d.ts +12 -1
- package/dist/modules/AccountList/index.d.ts +20 -1
- package/dist/modules/AccountList/index.js +243 -75
- package/dist/modules/AccountList/types.d.ts +33 -1
- package/dist/modules/AccountList/types.js +8 -0
- package/dist/modules/AccountList/utils.d.ts +9 -0
- package/dist/modules/AccountList/utils.js +25 -0
- package/dist/modules/BaseModule.d.ts +2 -2
- package/dist/modules/BaseModule.js +1 -1
- package/dist/modules/Cart/index.d.ts +8 -5
- package/dist/modules/Cart/index.js +101 -25
- package/dist/modules/Cart/types.d.ts +82 -5
- package/dist/modules/Cart/types.js +22 -0
- package/dist/modules/Cart/utils.d.ts +106 -13
- package/dist/modules/Cart/utils.js +289 -76
- package/dist/modules/Date/index.d.ts +6 -6
- package/dist/modules/Date/index.js +41 -58
- package/dist/modules/Date/types.d.ts +22 -6
- package/dist/modules/Date/utils.d.ts +4 -3
- package/dist/modules/Date/utils.js +81 -30
- package/dist/modules/Discount/index.d.ts +4 -4
- package/dist/modules/Discount/index.js +11 -11
- package/dist/modules/Order/index.d.ts +11 -5
- package/dist/modules/Order/index.js +47 -18
- package/dist/modules/Order/types.d.ts +10 -3
- package/dist/modules/Order/utils.d.ts +10 -0
- package/dist/modules/Order/utils.js +15 -0
- package/dist/modules/Product/index.d.ts +14 -1
- package/dist/modules/Product/index.js +35 -0
- package/dist/modules/Product/types.d.ts +27 -3
- package/dist/modules/ProductList/index.js +11 -5
- package/dist/modules/Resource/types.d.ts +1 -0
- package/dist/modules/Resource/utils.js +1 -1
- package/dist/modules/Rules/index.d.ts +3 -3
- package/dist/modules/Rules/index.js +97 -29
- package/dist/modules/Rules/types.d.ts +5 -1
- package/dist/modules/Schedule/index.d.ts +18 -0
- package/dist/modules/Schedule/index.js +111 -0
- package/dist/modules/Schedule/type.d.ts +157 -0
- package/dist/modules/Schedule/type.js +1 -0
- package/dist/modules/Schedule/types.d.ts +182 -0
- package/dist/modules/Schedule/types.js +1 -0
- package/dist/modules/Schedule/utils.d.ts +67 -0
- package/dist/modules/Schedule/utils.js +729 -0
- package/dist/modules/Step/index.d.ts +14 -3
- package/dist/modules/Step/index.js +54 -2
- package/dist/modules/Summary/index.d.ts +12 -5
- package/dist/modules/Summary/index.js +33 -7
- package/dist/modules/Summary/types.d.ts +23 -2
- package/dist/modules/Summary/utils.d.ts +14 -4
- package/dist/modules/Summary/utils.js +46 -4
- package/dist/modules/index.d.ts +10 -0
- package/dist/modules/index.js +11 -1
- package/dist/plugins/index.d.ts +3 -3
- package/dist/plugins/request.d.ts +3 -3
- package/dist/plugins/request.js +30 -30
- package/dist/plugins/shopStore.d.ts +1 -1
- package/dist/solution/BookingByStep/index.d.ts +97 -24
- package/dist/solution/BookingByStep/index.js +1024 -322
- package/dist/solution/BookingByStep/types.d.ts +3 -10
- package/dist/solution/BookingByStep/types.js +11 -15
- package/dist/solution/BookingByStep/utils/products.d.ts +1 -1
- package/dist/solution/BookingByStep/utils/products.js +3 -0
- package/dist/solution/BookingByStep/utils/resources.d.ts +60 -6
- package/dist/solution/BookingByStep/utils/resources.js +293 -52
- package/dist/solution/ShopDiscount/index.d.ts +4 -4
- package/dist/solution/ShopDiscount/index.js +29 -24
- package/dist/solution/ShopDiscount/types.d.ts +3 -2
- package/dist/solution/ShopDiscount/types.js +1 -0
- package/dist/solution/ShopDiscount/utils.js +1 -1
- package/lib/core/index.js +7 -2
- package/lib/modules/Account/index.d.ts +2 -6
- package/lib/modules/Account/index.js +15 -30
- package/lib/modules/Account/types.d.ts +12 -1
- package/lib/modules/AccountList/index.d.ts +20 -1
- package/lib/modules/AccountList/index.js +122 -13
- package/lib/modules/AccountList/types.d.ts +33 -1
- package/lib/modules/AccountList/utils.d.ts +9 -0
- package/lib/modules/AccountList/utils.js +39 -0
- package/lib/modules/BaseModule.d.ts +2 -2
- package/lib/modules/BaseModule.js +14 -3
- package/lib/modules/Cart/index.d.ts +8 -5
- package/lib/modules/Cart/index.js +81 -8
- package/lib/modules/Cart/types.d.ts +82 -5
- package/lib/modules/Cart/types.js +20 -2
- package/lib/modules/Cart/utils.d.ts +106 -13
- package/lib/modules/Cart/utils.js +188 -45
- package/lib/modules/Date/index.d.ts +6 -6
- package/lib/modules/Date/index.js +13 -28
- package/lib/modules/Date/types.d.ts +22 -6
- package/lib/modules/Date/utils.d.ts +4 -3
- package/lib/modules/Date/utils.js +47 -13
- package/lib/modules/Discount/index.d.ts +4 -4
- package/lib/modules/Discount/index.js +9 -2
- package/lib/modules/Guests/index.js +4 -1
- package/lib/modules/Order/index.d.ts +11 -5
- package/lib/modules/Order/index.js +24 -3
- package/lib/modules/Order/types.d.ts +10 -3
- package/lib/modules/Order/utils.d.ts +10 -0
- package/lib/modules/Order/utils.js +45 -0
- package/lib/modules/Payment/index.js +1 -6
- package/lib/modules/Product/index.d.ts +14 -1
- package/lib/modules/Product/index.js +19 -0
- package/lib/modules/Product/types.d.ts +27 -3
- package/lib/modules/ProductList/index.js +21 -7
- package/lib/modules/Resource/index.js +4 -1
- package/lib/modules/Resource/types.d.ts +1 -0
- package/lib/modules/Resource/utils.js +7 -4
- package/lib/modules/Rules/index.d.ts +3 -3
- package/lib/modules/Rules/index.js +100 -25
- package/lib/modules/Rules/types.d.ts +5 -1
- package/lib/modules/Schedule/index.d.ts +18 -0
- package/lib/modules/Schedule/index.js +81 -0
- package/lib/modules/Schedule/type.d.ts +157 -0
- package/lib/modules/Schedule/type.js +17 -0
- package/lib/modules/Schedule/types.d.ts +182 -0
- package/lib/modules/Schedule/types.js +17 -0
- package/lib/modules/Schedule/utils.d.ts +67 -0
- package/lib/modules/Schedule/utils.js +600 -0
- package/lib/modules/Step/index.d.ts +14 -3
- package/lib/modules/Step/index.js +38 -1
- package/lib/modules/Summary/index.d.ts +12 -5
- package/lib/modules/Summary/index.js +15 -1
- package/lib/modules/Summary/types.d.ts +23 -2
- package/lib/modules/Summary/utils.d.ts +14 -4
- package/lib/modules/Summary/utils.js +30 -1
- package/lib/modules/index.d.ts +10 -0
- package/lib/modules/index.js +21 -1
- package/lib/plugins/index.d.ts +3 -3
- package/lib/plugins/request.d.ts +3 -3
- package/lib/plugins/request.js +48 -11
- package/lib/plugins/shopStore.d.ts +1 -1
- package/lib/solution/BookingByStep/index.d.ts +97 -24
- package/lib/solution/BookingByStep/index.js +693 -145
- package/lib/solution/BookingByStep/types.d.ts +3 -10
- package/lib/solution/BookingByStep/types.js +37 -14
- package/lib/solution/BookingByStep/utils/products.d.ts +1 -1
- package/lib/solution/BookingByStep/utils/products.js +3 -0
- package/lib/solution/BookingByStep/utils/resources.d.ts +60 -6
- package/lib/solution/BookingByStep/utils/resources.js +286 -54
- package/lib/solution/BuyTickets/index.js +34 -20
- package/lib/solution/ShopDiscount/index.d.ts +4 -4
- package/lib/solution/ShopDiscount/index.js +14 -2
- package/lib/solution/ShopDiscount/types.d.ts +3 -2
- package/lib/solution/ShopDiscount/types.js +1 -0
- package/package.json +4 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
2
2
|
import { BaseModule } from '../BaseModule';
|
|
3
|
-
import { Account
|
|
3
|
+
import { Account } from './types';
|
|
4
4
|
export * from './types';
|
|
5
|
-
export declare class AccountModule extends BaseModule implements Module
|
|
5
|
+
export declare class AccountModule extends BaseModule implements Module {
|
|
6
6
|
protected defaultName: string;
|
|
7
7
|
protected defaultVersion: string;
|
|
8
8
|
isGuest: boolean;
|
|
@@ -14,13 +14,9 @@ export declare class AccountModule extends BaseModule implements Module, Account
|
|
|
14
14
|
username: string;
|
|
15
15
|
password: string;
|
|
16
16
|
}): Promise<void>;
|
|
17
|
-
logout(): Promise<void>;
|
|
18
|
-
register(account: Omit<Account, 'id'>): Promise<void>;
|
|
19
17
|
getCurrentAccount(): Account | null;
|
|
20
18
|
updateProfile(updates: Partial<Account>): Promise<void>;
|
|
21
19
|
isLoggedIn(): boolean;
|
|
22
|
-
resetPassword(email: string): Promise<void>;
|
|
23
|
-
updatePassword(oldPassword: string, newPassword: string): Promise<void>;
|
|
24
20
|
getLoginStatus(): boolean;
|
|
25
21
|
getAccount(): Account | null;
|
|
26
22
|
setAccountInfo(account: Account): void;
|
|
@@ -31,7 +31,7 @@ export var AccountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
31
31
|
_defineProperty(_assertThisInitialized(_this), "defaultVersion", '1.0.0');
|
|
32
32
|
_defineProperty(_assertThisInitialized(_this), "isGuest", false);
|
|
33
33
|
_defineProperty(_assertThisInitialized(_this), "store", {
|
|
34
|
-
|
|
34
|
+
accountInfo: null,
|
|
35
35
|
isLoggedIn: false,
|
|
36
36
|
active: false
|
|
37
37
|
});
|
|
@@ -61,8 +61,8 @@ export var AccountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
61
61
|
}, {
|
|
62
62
|
key: "getId",
|
|
63
63
|
value: function getId() {
|
|
64
|
-
var _this$store$
|
|
65
|
-
return ((_this$store$
|
|
64
|
+
var _this$store$accountIn;
|
|
65
|
+
return ((_this$store$accountIn = this.store.accountInfo) === null || _this$store$accountIn === void 0 ? void 0 : _this$store$accountIn.id) || '';
|
|
66
66
|
}
|
|
67
67
|
}, {
|
|
68
68
|
key: "login",
|
|
@@ -79,9 +79,10 @@ export var AccountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
79
79
|
username: credentials.username,
|
|
80
80
|
email: "".concat(credentials.username, "@example.com"),
|
|
81
81
|
name: credentials.username,
|
|
82
|
-
isGuest: false
|
|
82
|
+
isGuest: false,
|
|
83
|
+
type: 'account'
|
|
83
84
|
};
|
|
84
|
-
this.store.
|
|
85
|
+
this.store.accountInfo = account;
|
|
85
86
|
this.store.isLoggedIn = true;
|
|
86
87
|
_context2.next = 5;
|
|
87
88
|
return this.core.effects.emit(AccountHooks.OnLogin, account);
|
|
@@ -96,83 +97,34 @@ export var AccountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
96
97
|
}
|
|
97
98
|
return login;
|
|
98
99
|
}()
|
|
99
|
-
}, {
|
|
100
|
-
key: "logout",
|
|
101
|
-
value: function () {
|
|
102
|
-
var _logout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
103
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
104
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
105
|
-
case 0:
|
|
106
|
-
this.store.currentAccount = null;
|
|
107
|
-
this.store.isLoggedIn = false;
|
|
108
|
-
_context3.next = 4;
|
|
109
|
-
return this.core.effects.emit(AccountHooks.OnLogout, {});
|
|
110
|
-
case 4:
|
|
111
|
-
case "end":
|
|
112
|
-
return _context3.stop();
|
|
113
|
-
}
|
|
114
|
-
}, _callee3, this);
|
|
115
|
-
}));
|
|
116
|
-
function logout() {
|
|
117
|
-
return _logout.apply(this, arguments);
|
|
118
|
-
}
|
|
119
|
-
return logout;
|
|
120
|
-
}()
|
|
121
|
-
}, {
|
|
122
|
-
key: "register",
|
|
123
|
-
value: function () {
|
|
124
|
-
var _register = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(account) {
|
|
125
|
-
var newAccount;
|
|
126
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
127
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
128
|
-
case 0:
|
|
129
|
-
// 这里应该调用实际的注册 API
|
|
130
|
-
newAccount = _objectSpread({
|
|
131
|
-
id: '1'
|
|
132
|
-
}, account);
|
|
133
|
-
this.store.currentAccount = newAccount;
|
|
134
|
-
this.store.isLoggedIn = true;
|
|
135
|
-
_context4.next = 5;
|
|
136
|
-
return this.core.effects.emit(AccountHooks.OnRegister, newAccount);
|
|
137
|
-
case 5:
|
|
138
|
-
case "end":
|
|
139
|
-
return _context4.stop();
|
|
140
|
-
}
|
|
141
|
-
}, _callee4, this);
|
|
142
|
-
}));
|
|
143
|
-
function register(_x4) {
|
|
144
|
-
return _register.apply(this, arguments);
|
|
145
|
-
}
|
|
146
|
-
return register;
|
|
147
|
-
}()
|
|
148
100
|
}, {
|
|
149
101
|
key: "getCurrentAccount",
|
|
150
102
|
value: function getCurrentAccount() {
|
|
151
|
-
return this.store.
|
|
103
|
+
return this.store.accountInfo;
|
|
152
104
|
}
|
|
153
105
|
}, {
|
|
154
106
|
key: "updateProfile",
|
|
155
107
|
value: function () {
|
|
156
|
-
var _updateProfile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
157
|
-
return _regeneratorRuntime().wrap(function
|
|
158
|
-
while (1) switch (
|
|
108
|
+
var _updateProfile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(updates) {
|
|
109
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
110
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
159
111
|
case 0:
|
|
160
|
-
if (this.store.
|
|
161
|
-
|
|
112
|
+
if (this.store.accountInfo) {
|
|
113
|
+
_context3.next = 2;
|
|
162
114
|
break;
|
|
163
115
|
}
|
|
164
|
-
return
|
|
116
|
+
return _context3.abrupt("return");
|
|
165
117
|
case 2:
|
|
166
|
-
this.store.
|
|
167
|
-
|
|
168
|
-
return this.core.effects.emit(AccountHooks.OnProfileUpdate, this.store.
|
|
118
|
+
this.store.accountInfo = _objectSpread(_objectSpread({}, this.store.accountInfo), updates);
|
|
119
|
+
_context3.next = 5;
|
|
120
|
+
return this.core.effects.emit(AccountHooks.OnProfileUpdate, this.store.accountInfo);
|
|
169
121
|
case 5:
|
|
170
122
|
case "end":
|
|
171
|
-
return
|
|
123
|
+
return _context3.stop();
|
|
172
124
|
}
|
|
173
|
-
},
|
|
125
|
+
}, _callee3, this);
|
|
174
126
|
}));
|
|
175
|
-
function updateProfile(
|
|
127
|
+
function updateProfile(_x4) {
|
|
176
128
|
return _updateProfile.apply(this, arguments);
|
|
177
129
|
}
|
|
178
130
|
return updateProfile;
|
|
@@ -182,40 +134,6 @@ export var AccountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
182
134
|
value: function isLoggedIn() {
|
|
183
135
|
return this.store.isLoggedIn;
|
|
184
136
|
}
|
|
185
|
-
}, {
|
|
186
|
-
key: "resetPassword",
|
|
187
|
-
value: function () {
|
|
188
|
-
var _resetPassword = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(email) {
|
|
189
|
-
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
190
|
-
while (1) switch (_context6.prev = _context6.next) {
|
|
191
|
-
case 0:
|
|
192
|
-
case "end":
|
|
193
|
-
return _context6.stop();
|
|
194
|
-
}
|
|
195
|
-
}, _callee6);
|
|
196
|
-
}));
|
|
197
|
-
function resetPassword(_x6) {
|
|
198
|
-
return _resetPassword.apply(this, arguments);
|
|
199
|
-
}
|
|
200
|
-
return resetPassword;
|
|
201
|
-
}()
|
|
202
|
-
}, {
|
|
203
|
-
key: "updatePassword",
|
|
204
|
-
value: function () {
|
|
205
|
-
var _updatePassword = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(oldPassword, newPassword) {
|
|
206
|
-
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
207
|
-
while (1) switch (_context7.prev = _context7.next) {
|
|
208
|
-
case 0:
|
|
209
|
-
case "end":
|
|
210
|
-
return _context7.stop();
|
|
211
|
-
}
|
|
212
|
-
}, _callee7);
|
|
213
|
-
}));
|
|
214
|
-
function updatePassword(_x7, _x8) {
|
|
215
|
-
return _updatePassword.apply(this, arguments);
|
|
216
|
-
}
|
|
217
|
-
return updatePassword;
|
|
218
|
-
}()
|
|
219
137
|
}, {
|
|
220
138
|
key: "getLoginStatus",
|
|
221
139
|
value: function getLoginStatus() {
|
|
@@ -224,12 +142,12 @@ export var AccountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
224
142
|
}, {
|
|
225
143
|
key: "getAccount",
|
|
226
144
|
value: function getAccount() {
|
|
227
|
-
return this.store.
|
|
145
|
+
return this.store.accountInfo;
|
|
228
146
|
}
|
|
229
147
|
}, {
|
|
230
148
|
key: "setAccountInfo",
|
|
231
149
|
value: function setAccountInfo(account) {
|
|
232
|
-
this.store.
|
|
150
|
+
this.store.accountInfo = account;
|
|
233
151
|
if (account.isGuest) {
|
|
234
152
|
this.isGuest = true;
|
|
235
153
|
}
|
|
@@ -9,19 +9,30 @@ export declare enum AccountHooks {
|
|
|
9
9
|
*/
|
|
10
10
|
export interface Account {
|
|
11
11
|
id: string | number;
|
|
12
|
+
/** 用户名 */
|
|
12
13
|
username: string;
|
|
14
|
+
/** 邮箱 */
|
|
13
15
|
email?: string;
|
|
16
|
+
/** 手机号 */
|
|
14
17
|
phone?: string;
|
|
18
|
+
/** 昵称 */
|
|
15
19
|
name?: string;
|
|
20
|
+
/** 头像 */
|
|
16
21
|
avatar?: string;
|
|
22
|
+
/** 元数据 */
|
|
17
23
|
metadata?: Record<string, any>;
|
|
24
|
+
/** 是否为游客 */
|
|
18
25
|
isGuest?: boolean;
|
|
26
|
+
/** 账户类型 */
|
|
27
|
+
type?: 'account' | 'holder';
|
|
28
|
+
/** 账户信息原始数据 */
|
|
29
|
+
_origin?: Record<string, any>;
|
|
19
30
|
}
|
|
20
31
|
/**
|
|
21
32
|
* 账户模块状态
|
|
22
33
|
*/
|
|
23
34
|
export interface AccountState {
|
|
24
|
-
|
|
35
|
+
accountInfo: Account | null;
|
|
25
36
|
isLoggedIn: boolean;
|
|
26
37
|
active: boolean;
|
|
27
38
|
}
|
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
2
2
|
import { AccountModule, Account } from '../Account';
|
|
3
3
|
import { BaseModule } from '../BaseModule';
|
|
4
|
+
import { IFetchHolderAccountsParams, IHolder } from './types';
|
|
4
5
|
export declare class AccountListModule extends BaseModule implements Module {
|
|
5
6
|
protected defaultName: string;
|
|
6
7
|
protected defaultVersion: string;
|
|
7
8
|
private store;
|
|
9
|
+
private request;
|
|
8
10
|
private cacheId;
|
|
9
11
|
private openCache;
|
|
10
12
|
private fatherModule;
|
|
11
13
|
constructor(name?: string, version?: string);
|
|
12
14
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
13
|
-
|
|
15
|
+
/**
|
|
16
|
+
* 创建账号并添加到列表中
|
|
17
|
+
* @param account 账号信息
|
|
18
|
+
* @param needEmit 是否需要触发事件
|
|
19
|
+
*/
|
|
20
|
+
private createAccountAndAdd;
|
|
21
|
+
addAccount(account: Account): Promise<AccountModule>;
|
|
14
22
|
updateAccount(id: string, updates: Account): Promise<void>;
|
|
15
23
|
updateAccountListById(id: string | number, updates: Account): Promise<void>;
|
|
16
24
|
removeAccount(id: string): Promise<void>;
|
|
@@ -20,4 +28,15 @@ export declare class AccountListModule extends BaseModule implements Module {
|
|
|
20
28
|
setActiveAccount(id: string | number): void;
|
|
21
29
|
getActiveAccount(): AccountModule | null;
|
|
22
30
|
storeChange(): void;
|
|
31
|
+
/**
|
|
32
|
+
* 批量添加holder类型账号
|
|
33
|
+
* @param holders 账号信息列表
|
|
34
|
+
* @param customerId 账户id
|
|
35
|
+
*/
|
|
36
|
+
addHolderAccounts(holders: IHolder[], customerId: number): Promise<AccountModule[]>;
|
|
37
|
+
/**
|
|
38
|
+
* 获取holder类型账户列表
|
|
39
|
+
* @param params
|
|
40
|
+
*/
|
|
41
|
+
fetchHolderAccounts(params: IFetchHolderAccountsParams): Promise<void>;
|
|
23
42
|
}
|