@pisell/pisellos 2.3.76 → 2.3.78
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/ResourcePlanner/planner.js +4 -1
- package/dist/modules/ResourcePlanner/types.d.ts +1 -0
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/BookingTicket/index.d.ts +2 -14
- package/dist/solution/UnifiedBookingSales/index.d.ts +5 -1
- package/dist/solution/UnifiedBookingSales/index.js +459 -415
- package/dist/solution/UnifiedBookingSales/types.d.ts +10 -0
- package/lib/model/strategy/adapter/promotion/index.js +46 -1
- package/lib/modules/ResourcePlanner/planner.js +2 -0
- package/lib/modules/ResourcePlanner/types.d.ts +1 -0
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/BookingTicket/index.d.ts +2 -14
- package/lib/solution/UnifiedBookingSales/index.d.ts +5 -1
- package/lib/solution/UnifiedBookingSales/index.js +29 -3
- package/lib/solution/UnifiedBookingSales/types.d.ts +10 -0
- package/package.json +1 -1
|
@@ -6,6 +6,16 @@ import type { BookingTicketState } from '../BookingTicket/types';
|
|
|
6
6
|
export type { AvailabilityAbsoluteRange, AvailabilityAssignment, AvailabilityCell, AvailabilityDateRange, AvailabilityDisplayRange, AvailabilityErrorCode, AvailabilityId, AvailabilityMode, AvailabilityOccupancy, AvailabilityProduct, AvailabilityProductKind, AvailabilityProjection, AvailabilityProjectionInput, AvailabilityProjectionMeta, AvailabilityQuery, AvailabilityQueryResult, AvailabilityRequirementGroup, AvailabilityRequirementGroupResult, AvailabilityRequirementSelection, AvailabilityResource, AvailabilityResourceOption, AvailabilityResourceType, AvailabilityResourceWindow, AvailabilityScheduleMode, AvailabilityScheduleRef, AvailabilityScheduleRule, AvailabilitySelectionValidationParams, AvailabilitySelectionValidationResult, AvailabilitySessionRange, AvailabilityStatus, DateAvailabilityGroup, DateAvailabilityItem, DateAvailabilityQuery, DateAvailabilityQueryResult, GetProductTimeRangesRequest, ProductAvailabilityGroup, ProductAvailabilityItem, ProductAvailabilityQuery, ProductAvailabilityQueryResult, ProductTimeRange, ProductTimeRangeGroup, QueryAvailabilityBaseRequest, ResourceAvailabilityGroup, ResourceAvailabilityQuery, ResourceAvailabilityQueryResult, ResourceAvailabilityRangeGroup, TimeAvailabilityGroup, TimeAvailabilityItem, TimeAvailabilityQuery, TimeAvailabilityQueryResult, } from '../../modules/ResourcePlanner';
|
|
7
7
|
export interface UnifiedBookingSalesState extends BookingTicketState {
|
|
8
8
|
}
|
|
9
|
+
export interface UnifiedBookingSalesPolicy {
|
|
10
|
+
id?: AvailabilityId;
|
|
11
|
+
title?: unknown;
|
|
12
|
+
content?: string;
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
}
|
|
15
|
+
export interface UnifiedBookingSalesPolicyResponse {
|
|
16
|
+
data?: UnifiedBookingSalesPolicy;
|
|
17
|
+
[key: string]: unknown;
|
|
18
|
+
}
|
|
9
19
|
export declare enum UnifiedBookingSalesHooks {
|
|
10
20
|
onAvailabilityProjectionPrepared = "unifiedBookingSales:onAvailabilityProjectionPrepared",
|
|
11
21
|
onAvailabilitySelectionCommitted = "unifiedBookingSales:onAvailabilitySelectionCommitted",
|
|
@@ -1 +1,46 @@
|
|
|
1
|
-
"use strict";
|
|
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; }
|
|
@@ -1319,6 +1319,7 @@ function evaluateCandidate(projection, candidate, request) {
|
|
|
1319
1319
|
resourceId: resource.id,
|
|
1320
1320
|
resourceName: resource.name,
|
|
1321
1321
|
resourceFormId: resource.formId,
|
|
1322
|
+
policyId: resource.raw?.policy_id,
|
|
1322
1323
|
resourceType: resource.resourceType,
|
|
1323
1324
|
status: isPast ? 'past' : 'unavailable',
|
|
1324
1325
|
maxPartySize: 0,
|
|
@@ -1341,6 +1342,7 @@ function evaluateCandidate(projection, candidate, request) {
|
|
|
1341
1342
|
resourceId: resource.id,
|
|
1342
1343
|
resourceName: resource.name,
|
|
1343
1344
|
resourceFormId: resource.formId,
|
|
1345
|
+
policyId: resource.raw?.policy_id,
|
|
1344
1346
|
resourceType: resource.resourceType,
|
|
1345
1347
|
status,
|
|
1346
1348
|
remainingCapacity,
|
|
@@ -258,6 +258,7 @@ export interface AvailabilityResourceOption {
|
|
|
258
258
|
resourceId: AvailabilityId;
|
|
259
259
|
resourceName?: string;
|
|
260
260
|
resourceFormId?: AvailabilityId;
|
|
261
|
+
policyId?: AvailabilityId;
|
|
261
262
|
resourceType: AvailabilityResourceType;
|
|
262
263
|
status: AvailabilityStatus;
|
|
263
264
|
remainingCapacity?: number;
|
|
@@ -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 |
|
|
329
|
+
weekNum: 0 | 1 | 2 | 5 | 4 | 3 | 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: "sold_out" | "lots_of_space" | "filling_up_fast";
|
|
349
349
|
}[];
|
|
350
350
|
/**
|
|
351
351
|
* 找到多个资源的公共可用时间段
|
|
@@ -334,7 +334,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
334
334
|
* 获取当前的客户搜索条件
|
|
335
335
|
* @returns 当前搜索条件
|
|
336
336
|
*/
|
|
337
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
337
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
338
338
|
/**
|
|
339
339
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
340
340
|
* @returns 客户状态
|
|
@@ -453,19 +453,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
453
453
|
* 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
|
|
454
454
|
* 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
|
|
455
455
|
*/
|
|
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
|
-
};
|
|
456
|
+
decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
|
|
469
457
|
/** 规格弹窗 callback 后的第二段决策。 */
|
|
470
458
|
decideAfterDetail(cacheItem: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
|
|
471
459
|
/**
|
|
@@ -4,7 +4,7 @@ import type { OpenDataConfig } from '../../modules/OpenData';
|
|
|
4
4
|
import type { LoadScheduleAvailableDateParams, ScheduleItem } from '../../modules/Schedule/types';
|
|
5
5
|
import type { ProductListLoadProductsParams } from '../../modules/ProductList';
|
|
6
6
|
import type { AvailabilityDateRange, AvailabilityOccupancy, AvailabilityProduct, AvailabilityResource, GetProductTimeRangesRequest } from '../../modules/ResourcePlanner';
|
|
7
|
-
import type { AvailabilityContextRef, ContextualAvailabilityQuery, ContextualAvailabilityQueryResult, ContextualCommitAvailabilitySelectionParams, ContextualProductTimeRangeGroup, UnifiedBookingSalesAddRetailProductParams, UnifiedBookingSalesApplyPlannerDiscountsParams, UnifiedBookingSalesCommitAvailabilitySelectionResult, UnifiedBookingSalesDiscountResult, UnifiedBookingSalesLoadProductsByScheduleDateParams, UnifiedBookingSalesLoadOpenDataParams, UnifiedBookingSalesPrepareAvailabilityProjectionParams, UnifiedBookingSalesStageRetailProductsParams, UnifiedBookingSalesState } from './types';
|
|
7
|
+
import type { AvailabilityContextRef, ContextualAvailabilityQuery, ContextualAvailabilityQueryResult, ContextualCommitAvailabilitySelectionParams, ContextualProductTimeRangeGroup, UnifiedBookingSalesAddRetailProductParams, UnifiedBookingSalesApplyPlannerDiscountsParams, UnifiedBookingSalesCommitAvailabilitySelectionResult, UnifiedBookingSalesDiscountResult, UnifiedBookingSalesLoadProductsByScheduleDateParams, UnifiedBookingSalesLoadOpenDataParams, UnifiedBookingSalesPrepareAvailabilityProjectionParams, UnifiedBookingSalesPolicyResponse, UnifiedBookingSalesStageRetailProductsParams, UnifiedBookingSalesState } from './types';
|
|
8
8
|
import { BookingTicket } from '../BookingTicket';
|
|
9
9
|
export * from './types';
|
|
10
10
|
export { AvailabilityError } from '../../modules/ResourcePlanner';
|
|
@@ -147,6 +147,10 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
147
147
|
*/
|
|
148
148
|
loadOpenData(params: UnifiedBookingSalesLoadOpenDataParams): Promise<OpenDataConfig>;
|
|
149
149
|
getOpenData(): Promise<OpenDataConfig | null>;
|
|
150
|
+
/**
|
|
151
|
+
* Load a resource policy without depending on the legacy appointmentBooking solution.
|
|
152
|
+
*/
|
|
153
|
+
getProtocol(policyId: string | number): Promise<UnifiedBookingSalesPolicyResponse>;
|
|
150
154
|
/**
|
|
151
155
|
* Loads the product catalog used by both UI and Planner. Schedule data is requested with each
|
|
152
156
|
* product because session products carry their fixed intervals there.
|
|
@@ -906,7 +906,9 @@ function buildBookingFromAvailabilitySelection(params) {
|
|
|
906
906
|
candidate,
|
|
907
907
|
product,
|
|
908
908
|
resources = [],
|
|
909
|
-
bookingUid
|
|
909
|
+
bookingUid,
|
|
910
|
+
holder,
|
|
911
|
+
holderIds
|
|
910
912
|
} = params;
|
|
911
913
|
const bookingStartAt = candidate.bookingStartAt || candidate.startAt;
|
|
912
914
|
const bookingEndAt = candidate.bookingEndAt || candidate.endAt;
|
|
@@ -921,6 +923,8 @@ function buildBookingFromAvailabilitySelection(params) {
|
|
|
921
923
|
scheduleRefs: candidate.scheduleRefs
|
|
922
924
|
});
|
|
923
925
|
}
|
|
926
|
+
const normalizedHolder = holder && typeof holder === 'object' ? (0, _lodashEs.cloneDeep)(holder) : undefined;
|
|
927
|
+
const normalizedHolderIds = Array.isArray(holderIds) ? (0, _lodashEs.cloneDeep)(holderIds) : holderIds;
|
|
924
928
|
return {
|
|
925
929
|
start_date: bookingStartAt.slice(0, 10),
|
|
926
930
|
start_time: bookingStartAt.slice(11, 16),
|
|
@@ -929,6 +933,9 @@ function buildBookingFromAvailabilitySelection(params) {
|
|
|
929
933
|
duration: Math.max(1, Math.trunc((endScalar - startScalar) / (60 * 1000))),
|
|
930
934
|
like_status: 'common',
|
|
931
935
|
schedule_id: scheduleId ?? 0,
|
|
936
|
+
...(normalizedHolder ? {
|
|
937
|
+
holder: normalizedHolder
|
|
938
|
+
} : {}),
|
|
932
939
|
resources: assignments.map(assignment => {
|
|
933
940
|
// requirementSelections 的提交协议只携带资源 ID;购物车展示则需要名称。
|
|
934
941
|
// commit 此时仍持有本次不可变 projection,因此直接按 ID 取回名称并
|
|
@@ -963,7 +970,13 @@ function buildBookingFromAvailabilitySelection(params) {
|
|
|
963
970
|
...(timeSlotId == null ? {} : {
|
|
964
971
|
time_slot_id: timeSlotId
|
|
965
972
|
}),
|
|
966
|
-
product_kind: product.kind
|
|
973
|
+
product_kind: product.kind,
|
|
974
|
+
...(normalizedHolderIds === undefined ? {} : {
|
|
975
|
+
holder_id: normalizedHolderIds
|
|
976
|
+
}),
|
|
977
|
+
...(normalizedHolder ? {
|
|
978
|
+
holder: (0, _lodashEs.cloneDeep)(normalizedHolder)
|
|
979
|
+
} : {})
|
|
967
980
|
}
|
|
968
981
|
};
|
|
969
982
|
}
|
|
@@ -1508,6 +1521,17 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
1508
1521
|
});
|
|
1509
1522
|
}
|
|
1510
1523
|
|
|
1524
|
+
/**
|
|
1525
|
+
* Load a resource policy without depending on the legacy appointmentBooking solution.
|
|
1526
|
+
*/
|
|
1527
|
+
async getProtocol(policyId) {
|
|
1528
|
+
const normalizedPolicyId = String(policyId ?? '').trim();
|
|
1529
|
+
if (!normalizedPolicyId) {
|
|
1530
|
+
throw new Error('[UnifiedBookingSales] getProtocol 需要 policyId');
|
|
1531
|
+
}
|
|
1532
|
+
return this.request.get(`/shop-policy/${encodeURIComponent(normalizedPolicyId)}`);
|
|
1533
|
+
}
|
|
1534
|
+
|
|
1511
1535
|
/**
|
|
1512
1536
|
* Loads the product catalog used by both UI and Planner. Schedule data is requested with each
|
|
1513
1537
|
* product because session products carry their fixed intervals there.
|
|
@@ -2939,7 +2963,9 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
2939
2963
|
candidate: refreshedCandidate,
|
|
2940
2964
|
product,
|
|
2941
2965
|
resources: refreshedProjection.resources,
|
|
2942
|
-
bookingUid: existingBookingUid || undefined
|
|
2966
|
+
bookingUid: existingBookingUid || undefined,
|
|
2967
|
+
holder: params.orderProduct?._extend?.holder ?? existingBooking?.holder ?? existingBooking?.metadata?.holder,
|
|
2968
|
+
holderIds: params.orderProduct?._extend?.holder_id ?? params.orderProduct?._extend?.holder?.form_record ?? existingBooking?.metadata?.holder_id ?? existingBooking?.holder?.form_record
|
|
2943
2969
|
});
|
|
2944
2970
|
const transformed = this.buildUnifiedOrderProduct({
|
|
2945
2971
|
...params.orderProduct,
|
|
@@ -6,6 +6,16 @@ import type { BookingTicketState } from '../BookingTicket/types';
|
|
|
6
6
|
export type { AvailabilityAbsoluteRange, AvailabilityAssignment, AvailabilityCell, AvailabilityDateRange, AvailabilityDisplayRange, AvailabilityErrorCode, AvailabilityId, AvailabilityMode, AvailabilityOccupancy, AvailabilityProduct, AvailabilityProductKind, AvailabilityProjection, AvailabilityProjectionInput, AvailabilityProjectionMeta, AvailabilityQuery, AvailabilityQueryResult, AvailabilityRequirementGroup, AvailabilityRequirementGroupResult, AvailabilityRequirementSelection, AvailabilityResource, AvailabilityResourceOption, AvailabilityResourceType, AvailabilityResourceWindow, AvailabilityScheduleMode, AvailabilityScheduleRef, AvailabilityScheduleRule, AvailabilitySelectionValidationParams, AvailabilitySelectionValidationResult, AvailabilitySessionRange, AvailabilityStatus, DateAvailabilityGroup, DateAvailabilityItem, DateAvailabilityQuery, DateAvailabilityQueryResult, GetProductTimeRangesRequest, ProductAvailabilityGroup, ProductAvailabilityItem, ProductAvailabilityQuery, ProductAvailabilityQueryResult, ProductTimeRange, ProductTimeRangeGroup, QueryAvailabilityBaseRequest, ResourceAvailabilityGroup, ResourceAvailabilityQuery, ResourceAvailabilityQueryResult, ResourceAvailabilityRangeGroup, TimeAvailabilityGroup, TimeAvailabilityItem, TimeAvailabilityQuery, TimeAvailabilityQueryResult, } from '../../modules/ResourcePlanner';
|
|
7
7
|
export interface UnifiedBookingSalesState extends BookingTicketState {
|
|
8
8
|
}
|
|
9
|
+
export interface UnifiedBookingSalesPolicy {
|
|
10
|
+
id?: AvailabilityId;
|
|
11
|
+
title?: unknown;
|
|
12
|
+
content?: string;
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
}
|
|
15
|
+
export interface UnifiedBookingSalesPolicyResponse {
|
|
16
|
+
data?: UnifiedBookingSalesPolicy;
|
|
17
|
+
[key: string]: unknown;
|
|
18
|
+
}
|
|
9
19
|
export declare enum UnifiedBookingSalesHooks {
|
|
10
20
|
onAvailabilityProjectionPrepared = "unifiedBookingSales:onAvailabilityProjectionPrepared",
|
|
11
21
|
onAvailabilitySelectionCommitted = "unifiedBookingSales:onAvailabilitySelectionCommitted",
|