@pisell/pisellos 2.2.288 → 2.2.290
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/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/modules/SalesSummary/index.js +6 -4
- package/dist/server/index.js +10 -6
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/BookingTicket/index.d.ts +13 -1
- package/lib/model/strategy/adapter/promotion/index.js +1 -46
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/SalesSummary/index.js +3 -1
- package/lib/server/index.js +8 -6
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/BookingTicket/index.d.ts +13 -1
- package/package.json +1 -1
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// 导出评估器
|
|
2
|
-
export { PromotionEvaluator } from "./evaluator";
|
|
3
|
-
|
|
4
|
-
// 导出适配器
|
|
5
|
-
export { PromotionAdapter } from "./adapter";
|
|
6
|
-
export { default } from "./adapter";
|
|
7
|
-
|
|
8
|
-
// 导出策略配置示例常量
|
|
9
|
-
export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY, ITEM_REWARD_STRATEGY } from "./examples";
|
|
@@ -512,7 +512,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
512
512
|
generateIdempotencyToken(): string;
|
|
513
513
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
514
514
|
createOrder(params: CommitOrderParams['query']): {
|
|
515
|
-
type: "
|
|
515
|
+
type: "virtual" | "appointment_booking";
|
|
516
516
|
platform: string;
|
|
517
517
|
sales_channel: string;
|
|
518
518
|
order_sales_channel: string;
|
|
@@ -212,8 +212,8 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
212
212
|
key: "getSummary",
|
|
213
213
|
value: function () {
|
|
214
214
|
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
|
|
215
|
-
var _this$store$surcharge, _ref;
|
|
216
|
-
var _params$products, products, isPriceIncludeTax, taxRate, shopDiscount, channel, summaryChannel, taxConfig, summarySchedule, needScheduleIds, scheduleList, scheduleById, _iterator, _step, item, summary, summaryWithTaxMeta;
|
|
215
|
+
var _this$otherParams2, _this$store$surcharge, _ref;
|
|
216
|
+
var _params$products, products, isPriceIncludeTax, taxRate, shopDiscount, channel, summaryChannel, taxConfig, fatherModuleName, scheduleModuleName, summarySchedule, needScheduleIds, scheduleList, scheduleById, _iterator, _step, item, summary, summaryWithTaxMeta;
|
|
217
217
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
218
218
|
while (1) switch (_context4.prev = _context4.next) {
|
|
219
219
|
case 0:
|
|
@@ -227,7 +227,9 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
227
227
|
return this.getSurchargeList(summaryChannel);
|
|
228
228
|
case 5:
|
|
229
229
|
taxConfig = this.getTaxConfig();
|
|
230
|
-
|
|
230
|
+
fatherModuleName = ((_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.fatherModule) || this.name.replace(/_salesSummary$/, '');
|
|
231
|
+
scheduleModuleName = "".concat(fatherModuleName, "_schedule");
|
|
232
|
+
summarySchedule = this.core.getModule(scheduleModuleName);
|
|
231
233
|
needScheduleIds = (((_this$store$surcharge = this.store.surchargeList) === null || _this$store$surcharge === void 0 || (_this$store$surcharge = _this$store$surcharge.map(function (item) {
|
|
232
234
|
return item.available_schedule_ids;
|
|
233
235
|
})) === null || _this$store$surcharge === void 0 ? void 0 : _this$store$surcharge.flat()) || []).filter(function (id) {
|
|
@@ -264,7 +266,7 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
264
266
|
});
|
|
265
267
|
this.store.summary = summaryWithTaxMeta;
|
|
266
268
|
return _context4.abrupt("return", summaryWithTaxMeta);
|
|
267
|
-
case
|
|
269
|
+
case 17:
|
|
268
270
|
case "end":
|
|
269
271
|
return _context4.stop();
|
|
270
272
|
}
|
package/dist/server/index.js
CHANGED
|
@@ -5358,29 +5358,33 @@ var Server = /*#__PURE__*/function () {
|
|
|
5358
5358
|
if (!Array.isArray(bookings)) return '';
|
|
5359
5359
|
var values = [];
|
|
5360
5360
|
var seen = new Set();
|
|
5361
|
-
var visitResource = function visitResource(resource) {
|
|
5362
|
-
var identifier = _this13.getCheckoutResourceIdentifier(resource);
|
|
5361
|
+
var visitResource = function visitResource(resource, fallbackName) {
|
|
5362
|
+
var identifier = _this13.getCheckoutResourceIdentifier(resource, fallbackName);
|
|
5363
5363
|
if (identifier && !seen.has(identifier)) {
|
|
5364
5364
|
seen.add(identifier);
|
|
5365
5365
|
values.push(identifier);
|
|
5366
5366
|
}
|
|
5367
5367
|
if (Array.isArray(resource === null || resource === void 0 ? void 0 : resource.children)) {
|
|
5368
|
-
resource.children.forEach(
|
|
5368
|
+
resource.children.forEach(function (child) {
|
|
5369
|
+
return visitResource(child);
|
|
5370
|
+
});
|
|
5369
5371
|
}
|
|
5370
5372
|
};
|
|
5371
5373
|
bookings.forEach(function (booking) {
|
|
5372
5374
|
if (Array.isArray(booking === null || booking === void 0 ? void 0 : booking.resources)) {
|
|
5373
|
-
booking.resources.forEach(
|
|
5375
|
+
booking.resources.forEach(function (resource, index) {
|
|
5376
|
+
visitResource(resource, index === 0 ? booking === null || booking === void 0 ? void 0 : booking.relation_form_name : undefined);
|
|
5377
|
+
});
|
|
5374
5378
|
}
|
|
5375
5379
|
});
|
|
5376
5380
|
return values.join(',');
|
|
5377
5381
|
}
|
|
5378
5382
|
}, {
|
|
5379
5383
|
key: "getCheckoutResourceIdentifier",
|
|
5380
|
-
value: function getCheckoutResourceIdentifier(resource) {
|
|
5384
|
+
value: function getCheckoutResourceIdentifier(resource, fallbackName) {
|
|
5381
5385
|
var _resource$metadata, _resource$metadata2;
|
|
5382
5386
|
if (!resource || _typeof(resource) !== 'object') return '';
|
|
5383
|
-
var candidates = [resource.main_field, resource.name, resource.title, (_resource$metadata = resource.metadata) === null || _resource$metadata === void 0 ? void 0 : _resource$metadata.resource_name, (_resource$metadata2 = resource.metadata) === null || _resource$metadata2 === void 0 ? void 0 : _resource$metadata2.name, resource.relation_id, resource.id];
|
|
5387
|
+
var candidates = [resource.main_field, resource.name, resource.title, (_resource$metadata = resource.metadata) === null || _resource$metadata === void 0 ? void 0 : _resource$metadata.resource_name, (_resource$metadata2 = resource.metadata) === null || _resource$metadata2 === void 0 ? void 0 : _resource$metadata2.name, fallbackName, resource.relation_id, resource.id];
|
|
5384
5388
|
for (var _i2 = 0, _candidates = candidates; _i2 < _candidates.length; _i2++) {
|
|
5385
5389
|
var candidate = _candidates[_i2];
|
|
5386
5390
|
var value = this.stringifyCheckoutResourceIdentifier(candidate);
|
|
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
326
326
|
date: string;
|
|
327
327
|
status: string;
|
|
328
328
|
week: string;
|
|
329
|
-
weekNum: 0 | 1 | 2 |
|
|
329
|
+
weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|
|
@@ -345,7 +345,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
345
345
|
count: number;
|
|
346
346
|
left: number;
|
|
347
347
|
summaryCount: number;
|
|
348
|
-
status: "
|
|
348
|
+
status: "lots_of_space" | "filling_up_fast" | "sold_out";
|
|
349
349
|
}[];
|
|
350
350
|
/**
|
|
351
351
|
* 找到多个资源的公共可用时间段
|
|
@@ -453,7 +453,19 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
453
453
|
* 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
|
|
454
454
|
* 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
|
|
455
455
|
*/
|
|
456
|
-
decideAddProduct(item: any, options?: Partial<AddProductDecideContext>):
|
|
456
|
+
decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): {
|
|
457
|
+
action: "reloadCatalog";
|
|
458
|
+
} | {
|
|
459
|
+
action: "add";
|
|
460
|
+
cacheItem: any;
|
|
461
|
+
} | {
|
|
462
|
+
action: "requiresDetail";
|
|
463
|
+
payload: AddProductRequiresDetailPayload;
|
|
464
|
+
} | {
|
|
465
|
+
action: "requiresBookingEdit";
|
|
466
|
+
cacheItem: any;
|
|
467
|
+
payload: import("./utils/addProductDecision").AddProductRequiresBookingEditPayload;
|
|
468
|
+
};
|
|
457
469
|
/** 规格弹窗 callback 后的第二段决策。 */
|
|
458
470
|
decideAfterDetail(cacheItem: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
|
|
459
471
|
/**
|
|
@@ -1,46 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "BUY_X_GET_Y_FREE_STRATEGY", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _examples.BUY_X_GET_Y_FREE_STRATEGY;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "ITEM_REWARD_STRATEGY", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _examples.ITEM_REWARD_STRATEGY;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "PromotionAdapter", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _adapter.PromotionAdapter;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "PromotionEvaluator", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () {
|
|
27
|
-
return _evaluator.PromotionEvaluator;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(exports, "X_ITEMS_FOR_Y_PRICE_STRATEGY", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function () {
|
|
33
|
-
return _examples.X_ITEMS_FOR_Y_PRICE_STRATEGY;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
Object.defineProperty(exports, "default", {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function () {
|
|
39
|
-
return _adapter.default;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
var _evaluator = require("./evaluator");
|
|
43
|
-
var _adapter = _interopRequireWildcard(require("./adapter"));
|
|
44
|
-
var _examples = require("./examples");
|
|
45
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
46
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
1
|
+
"use strict";
|
|
@@ -512,7 +512,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
512
512
|
generateIdempotencyToken(): string;
|
|
513
513
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
514
514
|
createOrder(params: CommitOrderParams['query']): {
|
|
515
|
-
type: "
|
|
515
|
+
type: "virtual" | "appointment_booking";
|
|
516
516
|
platform: string;
|
|
517
517
|
sales_channel: string;
|
|
518
518
|
order_sales_channel: string;
|
|
@@ -133,7 +133,9 @@ class SalesSummaryModule extends _BaseModule.BaseModule {
|
|
|
133
133
|
await this.getSurchargeList(summaryChannel);
|
|
134
134
|
}
|
|
135
135
|
const taxConfig = this.getTaxConfig();
|
|
136
|
-
const
|
|
136
|
+
const fatherModuleName = this.otherParams?.fatherModule || this.name.replace(/_salesSummary$/, '');
|
|
137
|
+
const scheduleModuleName = `${fatherModuleName}_schedule`;
|
|
138
|
+
const summarySchedule = this.core.getModule(scheduleModuleName);
|
|
137
139
|
const needScheduleIds = (this.store.surchargeList?.map(item => item.available_schedule_ids)?.flat() || []).filter(id => id !== undefined && id !== null && id !== '');
|
|
138
140
|
const scheduleList = needScheduleIds.length > 0 ? summarySchedule?.getScheduleListByIds(needScheduleIds) : [];
|
|
139
141
|
const scheduleById = {};
|
package/lib/server/index.js
CHANGED
|
@@ -3383,26 +3383,28 @@ class Server {
|
|
|
3383
3383
|
if (!Array.isArray(bookings)) return '';
|
|
3384
3384
|
const values = [];
|
|
3385
3385
|
const seen = new Set();
|
|
3386
|
-
const visitResource = resource => {
|
|
3387
|
-
const identifier = this.getCheckoutResourceIdentifier(resource);
|
|
3386
|
+
const visitResource = (resource, fallbackName) => {
|
|
3387
|
+
const identifier = this.getCheckoutResourceIdentifier(resource, fallbackName);
|
|
3388
3388
|
if (identifier && !seen.has(identifier)) {
|
|
3389
3389
|
seen.add(identifier);
|
|
3390
3390
|
values.push(identifier);
|
|
3391
3391
|
}
|
|
3392
3392
|
if (Array.isArray(resource?.children)) {
|
|
3393
|
-
resource.children.forEach(visitResource);
|
|
3393
|
+
resource.children.forEach(child => visitResource(child));
|
|
3394
3394
|
}
|
|
3395
3395
|
};
|
|
3396
3396
|
bookings.forEach(booking => {
|
|
3397
3397
|
if (Array.isArray(booking?.resources)) {
|
|
3398
|
-
booking.resources.forEach(
|
|
3398
|
+
booking.resources.forEach((resource, index) => {
|
|
3399
|
+
visitResource(resource, index === 0 ? booking?.relation_form_name : undefined);
|
|
3400
|
+
});
|
|
3399
3401
|
}
|
|
3400
3402
|
});
|
|
3401
3403
|
return values.join(',');
|
|
3402
3404
|
}
|
|
3403
|
-
getCheckoutResourceIdentifier(resource) {
|
|
3405
|
+
getCheckoutResourceIdentifier(resource, fallbackName) {
|
|
3404
3406
|
if (!resource || typeof resource !== 'object') return '';
|
|
3405
|
-
const candidates = [resource.main_field, resource.name, resource.title, resource.metadata?.resource_name, resource.metadata?.name, resource.relation_id, resource.id];
|
|
3407
|
+
const candidates = [resource.main_field, resource.name, resource.title, resource.metadata?.resource_name, resource.metadata?.name, fallbackName, resource.relation_id, resource.id];
|
|
3406
3408
|
for (const candidate of candidates) {
|
|
3407
3409
|
const value = this.stringifyCheckoutResourceIdentifier(candidate);
|
|
3408
3410
|
if (value) return value;
|
|
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
326
326
|
date: string;
|
|
327
327
|
status: string;
|
|
328
328
|
week: string;
|
|
329
|
-
weekNum: 0 | 1 | 2 |
|
|
329
|
+
weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|
|
@@ -345,7 +345,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
345
345
|
count: number;
|
|
346
346
|
left: number;
|
|
347
347
|
summaryCount: number;
|
|
348
|
-
status: "
|
|
348
|
+
status: "lots_of_space" | "filling_up_fast" | "sold_out";
|
|
349
349
|
}[];
|
|
350
350
|
/**
|
|
351
351
|
* 找到多个资源的公共可用时间段
|
|
@@ -453,7 +453,19 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
453
453
|
* 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
|
|
454
454
|
* 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
|
|
455
455
|
*/
|
|
456
|
-
decideAddProduct(item: any, options?: Partial<AddProductDecideContext>):
|
|
456
|
+
decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): {
|
|
457
|
+
action: "reloadCatalog";
|
|
458
|
+
} | {
|
|
459
|
+
action: "add";
|
|
460
|
+
cacheItem: any;
|
|
461
|
+
} | {
|
|
462
|
+
action: "requiresDetail";
|
|
463
|
+
payload: AddProductRequiresDetailPayload;
|
|
464
|
+
} | {
|
|
465
|
+
action: "requiresBookingEdit";
|
|
466
|
+
cacheItem: any;
|
|
467
|
+
payload: import("./utils/addProductDecision").AddProductRequiresBookingEditPayload;
|
|
468
|
+
};
|
|
457
469
|
/** 规格弹窗 callback 后的第二段决策。 */
|
|
458
470
|
decideAfterDetail(cacheItem: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
|
|
459
471
|
/**
|