@pisell/pisellos 2.2.39 → 2.2.41
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/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/modules/Cart/types.d.ts +0 -2
- package/dist/modules/Cart/utils/cartProduct.js +0 -11
- package/dist/modules/Discount/types.d.ts +0 -15
- package/dist/modules/Payment/index.d.ts +1 -2
- package/dist/modules/Payment/index.js +7 -10
- package/dist/modules/Payment/utils.js +0 -3
- package/dist/modules/Payment/walletpass.d.ts +0 -23
- package/dist/modules/Payment/walletpass.js +95 -191
- package/dist/modules/Rules/index.d.ts +3 -8
- package/dist/modules/Rules/index.js +23 -143
- package/dist/modules/Rules/types.d.ts +0 -1
- package/dist/modules/Schedule/index.d.ts +9 -0
- package/dist/modules/Schedule/index.js +18 -2
- package/dist/modules/Summary/types.d.ts +0 -2
- package/dist/modules/Summary/utils.d.ts +0 -6
- package/dist/modules/Summary/utils.js +0 -21
- package/dist/plugins/window.d.ts +0 -2
- package/dist/solution/BookingByStep/index.d.ts +0 -1
- package/dist/solution/Checkout/index.js +0 -2
- package/dist/solution/RegisterAndLogin/config.js +339 -1
- package/dist/solution/ShopDiscount/index.d.ts +0 -1
- package/dist/solution/ShopDiscount/index.js +3 -13
- package/dist/solution/ShopDiscount/types.d.ts +0 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +1 -3
- package/lib/modules/Cart/types.d.ts +0 -2
- package/lib/modules/Cart/utils/cartProduct.js +0 -9
- package/lib/modules/Discount/types.d.ts +0 -15
- package/lib/modules/Payment/index.d.ts +1 -2
- package/lib/modules/Payment/index.js +0 -1
- package/lib/modules/Payment/utils.js +0 -3
- package/lib/modules/Payment/walletpass.d.ts +0 -23
- package/lib/modules/Payment/walletpass.js +17 -94
- package/lib/modules/Rules/index.d.ts +3 -8
- package/lib/modules/Rules/index.js +187 -352
- package/lib/modules/Rules/types.d.ts +0 -1
- package/lib/modules/Schedule/index.d.ts +9 -0
- package/lib/modules/Schedule/index.js +11 -0
- package/lib/modules/Summary/types.d.ts +0 -2
- package/lib/modules/Summary/utils.d.ts +0 -6
- package/lib/modules/Summary/utils.js +0 -15
- package/lib/plugins/window.d.ts +0 -2
- package/lib/solution/BookingByStep/index.d.ts +0 -1
- package/lib/solution/Checkout/index.js +0 -2
- package/lib/solution/RegisterAndLogin/config.js +265 -1
- package/lib/solution/ShopDiscount/index.d.ts +0 -1
- package/lib/solution/ShopDiscount/index.js +2 -8
- package/lib/solution/ShopDiscount/types.d.ts +0 -1
- package/package.json +1 -1
- package/dist/model/index.d.ts +0 -1
- package/dist/model/index.js +0 -1
- package/dist/model/strategy/adapter/index.d.ts +0 -3
- package/dist/model/strategy/adapter/index.js +0 -4
- package/dist/model/strategy/adapter/type.d.ts +0 -28
- package/dist/model/strategy/adapter/type.js +0 -1
- package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +0 -84
- package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -497
- package/dist/model/strategy/adapter/walletPass/example.d.ts +0 -4
- package/dist/model/strategy/adapter/walletPass/example.js +0 -258
- package/dist/model/strategy/adapter/walletPass/index.d.ts +0 -32
- package/dist/model/strategy/adapter/walletPass/index.js +0 -182
- package/dist/model/strategy/adapter/walletPass/locales.d.ts +0 -1
- package/dist/model/strategy/adapter/walletPass/locales.js +0 -23
- package/dist/model/strategy/adapter/walletPass/type.d.ts +0 -165
- package/dist/model/strategy/adapter/walletPass/type.js +0 -1
- package/dist/model/strategy/adapter/walletPass/utils.d.ts +0 -50
- package/dist/model/strategy/adapter/walletPass/utils.js +0 -965
- package/dist/model/strategy/index.d.ts +0 -94
- package/dist/model/strategy/index.js +0 -551
- package/dist/model/strategy/strategy-example.d.ts +0 -5
- package/dist/model/strategy/strategy-example.js +0 -331
- package/dist/model/strategy/type.d.ts +0 -228
- package/dist/model/strategy/type.js +0 -94
- package/lib/model/index.d.ts +0 -1
- package/lib/model/index.js +0 -23
- package/lib/model/strategy/adapter/index.d.ts +0 -3
- package/lib/model/strategy/adapter/index.js +0 -45
- package/lib/model/strategy/adapter/type.d.ts +0 -28
- package/lib/model/strategy/adapter/type.js +0 -17
- package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +0 -84
- package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -421
- package/lib/model/strategy/adapter/walletPass/example.d.ts +0 -4
- package/lib/model/strategy/adapter/walletPass/example.js +0 -207
- package/lib/model/strategy/adapter/walletPass/index.d.ts +0 -32
- package/lib/model/strategy/adapter/walletPass/index.js +0 -142
- package/lib/model/strategy/adapter/walletPass/locales.d.ts +0 -1
- package/lib/model/strategy/adapter/walletPass/locales.js +0 -51
- package/lib/model/strategy/adapter/walletPass/type.d.ts +0 -165
- package/lib/model/strategy/adapter/walletPass/type.js +0 -17
- package/lib/model/strategy/adapter/walletPass/utils.d.ts +0 -50
- package/lib/model/strategy/adapter/walletPass/utils.js +0 -660
- package/lib/model/strategy/index.d.ts +0 -94
- package/lib/model/strategy/index.js +0 -413
- package/lib/model/strategy/strategy-example.d.ts +0 -5
- package/lib/model/strategy/strategy-example.js +0 -318
- package/lib/model/strategy/type.d.ts +0 -228
- package/lib/model/strategy/type.js +0 -44
|
@@ -31,7 +31,6 @@ var WalletPassPaymentImpl = class {
|
|
|
31
31
|
this.userIdentificationCodes = [];
|
|
32
32
|
this.searchResults = [];
|
|
33
33
|
this.walletParams = null;
|
|
34
|
-
this.walletInitData = null;
|
|
35
34
|
}
|
|
36
35
|
/**
|
|
37
36
|
* 发送事件的辅助方法
|
|
@@ -43,9 +42,7 @@ var WalletPassPaymentImpl = class {
|
|
|
43
42
|
const fullEventName = `${this.paymentModule.name}:${eventName}`;
|
|
44
43
|
this.paymentModule.core.effects.emit(fullEventName, data);
|
|
45
44
|
} catch (error) {
|
|
46
|
-
this.paymentModule.logError("[WalletPass] 发送事件失败", error, {
|
|
47
|
-
hook
|
|
48
|
-
});
|
|
45
|
+
this.paymentModule.logError("[WalletPass] 发送事件失败", error, { hook });
|
|
49
46
|
}
|
|
50
47
|
}
|
|
51
48
|
/**
|
|
@@ -118,10 +115,7 @@ var WalletPassPaymentImpl = class {
|
|
|
118
115
|
if (Number(((_a = businessData == null ? void 0 : businessData.amountInfo) == null ? void 0 : _a.totalAmount) || 0) < 0 || Number(((_b = businessData == null ? void 0 : businessData.amountInfo) == null ? void 0 : _b.subTotal) || 0) < 0) {
|
|
119
116
|
return {
|
|
120
117
|
walletRecommendList: [],
|
|
121
|
-
userIdentificationCodes: []
|
|
122
|
-
transformList: [],
|
|
123
|
-
noApplicableVoucher: [],
|
|
124
|
-
products: []
|
|
118
|
+
userIdentificationCodes: []
|
|
125
119
|
};
|
|
126
120
|
}
|
|
127
121
|
if ([1, 0].includes((walletParams == null ? void 0 : walletParams.customer_id) || 0)) {
|
|
@@ -168,28 +162,11 @@ var WalletPassPaymentImpl = class {
|
|
|
168
162
|
endTime,
|
|
169
163
|
duration
|
|
170
164
|
});
|
|
171
|
-
this.paymentModule.logError(
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
customer_id: businessData.customer_id,
|
|
177
|
-
totalAmount: (_h = businessData.amountInfo) == null ? void 0 : _h.totalAmount
|
|
178
|
-
}
|
|
179
|
-
);
|
|
180
|
-
throw error;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* 获取订单基础详情
|
|
185
|
-
*/
|
|
186
|
-
async getOrderBasicDetailAsync(orderId) {
|
|
187
|
-
try {
|
|
188
|
-
const response = await this.paymentModule.request.get(
|
|
189
|
-
`/order/order/${orderId}/basic-detail`
|
|
190
|
-
);
|
|
191
|
-
return (response == null ? void 0 : response.data) || {};
|
|
192
|
-
} catch (error) {
|
|
165
|
+
this.paymentModule.logError(`[WalletPass] 从业务数据初始化钱包数据失败`, error, {
|
|
166
|
+
duration: `${duration}ms`,
|
|
167
|
+
customer_id: businessData.customer_id,
|
|
168
|
+
totalAmount: (_h = businessData.amountInfo) == null ? void 0 : _h.totalAmount
|
|
169
|
+
});
|
|
193
170
|
throw error;
|
|
194
171
|
}
|
|
195
172
|
}
|
|
@@ -198,49 +175,19 @@ var WalletPassPaymentImpl = class {
|
|
|
198
175
|
* 先获取推荐列表,再获取用户识别码列表(顺序执行)
|
|
199
176
|
*/
|
|
200
177
|
async initializeWalletDataAsync(baseParams) {
|
|
201
|
-
var _a, _b;
|
|
202
178
|
try {
|
|
179
|
+
const walletRecommendList = await this.getWalletPassRecommendListAsync(baseParams);
|
|
203
180
|
const identificationParams = {
|
|
204
181
|
...baseParams,
|
|
205
182
|
available: 2,
|
|
206
|
-
prepare_payments:
|
|
183
|
+
prepare_payments: this.formatWalletPassList2PreparePayments(walletRecommendList),
|
|
207
184
|
other_exact_codes: [],
|
|
208
185
|
filter_prepare_wallet_pass: 1
|
|
209
186
|
};
|
|
210
|
-
const
|
|
211
|
-
this.getUserIdentificationCodeListAsync(identificationParams),
|
|
212
|
-
baseParams.payment_order_id ? this.getOrderBasicDetailAsync(baseParams.payment_order_id) : Promise.resolve(null)
|
|
213
|
-
]);
|
|
214
|
-
const walletPassEvaluator = (_b = (_a = this.paymentModule.window) == null ? void 0 : _a.getWalletPassEvaluator) == null ? void 0 : _b.call(_a);
|
|
215
|
-
if (!walletPassEvaluator) {
|
|
216
|
-
return {
|
|
217
|
-
walletRecommendList: [],
|
|
218
|
-
userIdentificationCodes: [],
|
|
219
|
-
transformList: [],
|
|
220
|
-
noApplicableVoucher: [],
|
|
221
|
-
products: []
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
const products = (orderBasicDetail == null ? void 0 : orderBasicDetail.detail) || baseParams.products;
|
|
225
|
-
const res = walletPassEvaluator == null ? void 0 : walletPassEvaluator.getRecommendedVouchers({
|
|
226
|
-
orderTotalAmount: baseParams.order_wait_pay_amount,
|
|
227
|
-
products,
|
|
228
|
-
vouchers: allList
|
|
229
|
-
});
|
|
230
|
-
const { recommended, transformList, noApplicableVoucher, recommendedAmount } = res;
|
|
231
|
-
console.log(res, "resres12");
|
|
232
|
-
this.walletRecommendList = recommended;
|
|
233
|
-
this.walletInitData = {
|
|
234
|
-
transformList,
|
|
235
|
-
noApplicableVoucher,
|
|
236
|
-
products: products || []
|
|
237
|
-
};
|
|
187
|
+
const userIdentificationCodes = await this.getUserIdentificationCodeListAsync(identificationParams);
|
|
238
188
|
return {
|
|
239
|
-
walletRecommendList
|
|
240
|
-
userIdentificationCodes
|
|
241
|
-
transformList,
|
|
242
|
-
noApplicableVoucher,
|
|
243
|
-
products: products || []
|
|
189
|
+
walletRecommendList,
|
|
190
|
+
userIdentificationCodes
|
|
244
191
|
};
|
|
245
192
|
} catch (error) {
|
|
246
193
|
this.paymentModule.logError("[WalletPass] 初始化钱包数据失败", error, {
|
|
@@ -323,14 +270,10 @@ var WalletPassPaymentImpl = class {
|
|
|
323
270
|
});
|
|
324
271
|
return this.userIdentificationCodes;
|
|
325
272
|
} catch (error) {
|
|
326
|
-
this.paymentModule.logError(
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
customer_id: params.customer_id,
|
|
331
|
-
available: params.available
|
|
332
|
-
}
|
|
333
|
-
);
|
|
273
|
+
this.paymentModule.logError("[WalletPass] 获取用户识别码列表失败", error, {
|
|
274
|
+
customer_id: params.customer_id,
|
|
275
|
+
available: params.available
|
|
276
|
+
});
|
|
334
277
|
return [];
|
|
335
278
|
}
|
|
336
279
|
}
|
|
@@ -528,19 +471,6 @@ var WalletPassPaymentImpl = class {
|
|
|
528
471
|
this.searchResults = [];
|
|
529
472
|
this.paymentModule.logInfo("[WalletPass] 搜索结果缓存已清除");
|
|
530
473
|
}
|
|
531
|
-
/**
|
|
532
|
-
* 获取存储的钱包初始化数据
|
|
533
|
-
*/
|
|
534
|
-
getStoredWalletInitData() {
|
|
535
|
-
return this.walletInitData;
|
|
536
|
-
}
|
|
537
|
-
/**
|
|
538
|
-
* 清除存储的钱包初始化数据
|
|
539
|
-
*/
|
|
540
|
-
clearStoredWalletInitData() {
|
|
541
|
-
this.walletInitData = null;
|
|
542
|
-
this.paymentModule.logInfo("[WalletPass] 钱包初始化数据已清除");
|
|
543
|
-
}
|
|
544
474
|
/**
|
|
545
475
|
* 清除所有缓存数据
|
|
546
476
|
*/
|
|
@@ -549,18 +479,11 @@ var WalletPassPaymentImpl = class {
|
|
|
549
479
|
this.userIdentificationCodes = [];
|
|
550
480
|
this.searchResults = [];
|
|
551
481
|
this.walletParams = null;
|
|
552
|
-
this.walletInitData = null;
|
|
553
482
|
this.emitEvent(import_types.WalletPassHooks.OnWalletCacheCleared, {
|
|
554
483
|
clearedTypes: ["all"]
|
|
555
484
|
});
|
|
556
485
|
this.paymentModule.logInfo("[WalletPass] 所有缓存数据已清除", {
|
|
557
|
-
cleared_types: [
|
|
558
|
-
"walletRecommendList",
|
|
559
|
-
"userIdentificationCodes",
|
|
560
|
-
"searchResults",
|
|
561
|
-
"walletParams",
|
|
562
|
-
"walletInitData"
|
|
563
|
-
]
|
|
486
|
+
cleared_types: ["walletRecommendList", "userIdentificationCodes", "searchResults", "walletParams"]
|
|
564
487
|
});
|
|
565
488
|
}
|
|
566
489
|
};
|
|
@@ -1,26 +1,22 @@
|
|
|
1
1
|
import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
2
2
|
import { BaseModule } from '../BaseModule';
|
|
3
3
|
import { Rules, RulesModuleAPI, DiscountResult } from './types';
|
|
4
|
-
import { Discount } from
|
|
4
|
+
import { Discount } from "../Discount/types";
|
|
5
5
|
import { SetDiscountSelectedParams } from '../../solution/ShopDiscount/types';
|
|
6
|
-
import { WindowPlugin } from '../../plugins';
|
|
7
6
|
export declare class RulesModule extends BaseModule implements Module, RulesModuleAPI {
|
|
8
7
|
protected defaultName: string;
|
|
9
8
|
protected defaultVersion: string;
|
|
10
9
|
private store;
|
|
11
|
-
window: WindowPlugin;
|
|
12
10
|
private hooks;
|
|
13
11
|
constructor(name?: string, version?: string);
|
|
14
12
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
15
13
|
setRulesList(rulesList: Rules[]): Promise<void>;
|
|
16
14
|
getRulesList(): Rules[];
|
|
17
|
-
getWalletPassEvaluator(): import("../..").WalletPassEvaluator | undefined;
|
|
18
15
|
private checkHolderMatch;
|
|
19
|
-
isDiscountListAvailable({ oldDiscountList, newDiscountList, productList,
|
|
16
|
+
isDiscountListAvailable({ oldDiscountList, newDiscountList, productList, holders, isFormSubject, }: {
|
|
20
17
|
oldDiscountList: Discount[];
|
|
21
18
|
newDiscountList: Discount[];
|
|
22
19
|
productList: any[];
|
|
23
|
-
orderTotalAmount: number;
|
|
24
20
|
holders: {
|
|
25
21
|
form_record_id: number;
|
|
26
22
|
}[];
|
|
@@ -30,14 +26,13 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
|
|
|
30
26
|
discountList: Discount[];
|
|
31
27
|
productList: any[];
|
|
32
28
|
};
|
|
33
|
-
calcDiscount({ discountList, productList, holders, isFormSubject,
|
|
29
|
+
calcDiscount({ discountList, productList, holders, isFormSubject, }: {
|
|
34
30
|
discountList: Discount[];
|
|
35
31
|
productList: any[];
|
|
36
32
|
holders: {
|
|
37
33
|
form_record_id: number;
|
|
38
34
|
}[];
|
|
39
35
|
isFormSubject: boolean;
|
|
40
|
-
orderTotalAmount: number;
|
|
41
36
|
}, options?: {
|
|
42
37
|
isSelected?: boolean;
|
|
43
38
|
discountId?: number;
|