@pisell/pisellos 2.2.161 → 2.2.163
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/Order/index.d.ts +1 -1
- package/dist/server/index.js +1 -0
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/Sales/index.d.ts +1 -0
- package/dist/solution/Sales/index.js +20 -8
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/server/index.js +1 -0
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/Sales/index.d.ts +1 -0
- package/lib/solution/Sales/index.js +12 -6
- package/package.json +1 -1
|
@@ -173,7 +173,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
173
173
|
private logSubmitBackendRejected;
|
|
174
174
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
175
175
|
createOrder(params: CommitOrderParams['query']): {
|
|
176
|
-
type: "
|
|
176
|
+
type: "virtual" | "appointment_booking";
|
|
177
177
|
platform: string;
|
|
178
178
|
sales_channel: string;
|
|
179
179
|
order_sales_channel: string;
|
package/dist/server/index.js
CHANGED
|
@@ -2995,6 +2995,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
2995
2995
|
if (field === undefined || field === null || field === '') return;
|
|
2996
2996
|
searchParams.append('with[]', String(field));
|
|
2997
2997
|
});
|
|
2998
|
+
searchParams.append('lookup_mode', 'multi');
|
|
2998
2999
|
var query = searchParams.toString();
|
|
2999
3000
|
return "/shop/order/sales/".concat(encodeURIComponent(orderId)).concat(query ? "?".concat(query) : '');
|
|
3000
3001
|
}
|
|
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
311
311
|
date: string;
|
|
312
312
|
status: string;
|
|
313
313
|
week: string;
|
|
314
|
-
weekNum: 0 | 1 |
|
|
314
|
+
weekNum: 0 | 1 | 2 | 6 | 3 | 5 | 4;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|
|
@@ -330,7 +330,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
330
330
|
count: number;
|
|
331
331
|
left: number;
|
|
332
332
|
summaryCount: number;
|
|
333
|
-
status: "
|
|
333
|
+
status: "lots_of_space" | "filling_up_fast" | "sold_out";
|
|
334
334
|
}[];
|
|
335
335
|
/**
|
|
336
336
|
* 找到多个资源的公共可用时间段
|
|
@@ -81,6 +81,7 @@ export declare class SalesImpl extends BaseModule implements Module, SalesModule
|
|
|
81
81
|
private getBookingStatus;
|
|
82
82
|
private getResourceId;
|
|
83
83
|
private getBookingAppointmentStatus;
|
|
84
|
+
private isBookingIncludedInStats;
|
|
84
85
|
private getBookingOrderPaymentStatus;
|
|
85
86
|
private countBookingOrders;
|
|
86
87
|
private countCompletedBookings;
|
|
@@ -403,6 +403,12 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
403
403
|
var _ref4, _booking$appointment_2;
|
|
404
404
|
return String((_ref4 = (_booking$appointment_2 = booking.appointment_status) !== null && _booking$appointment_2 !== void 0 ? _booking$appointment_2 : booking.status) !== null && _ref4 !== void 0 ? _ref4 : '');
|
|
405
405
|
}
|
|
406
|
+
}, {
|
|
407
|
+
key: "isBookingIncludedInStats",
|
|
408
|
+
value: function isBookingIncludedInStats(booking) {
|
|
409
|
+
var appointmentStatus = this.getBookingAppointmentStatus(booking);
|
|
410
|
+
return appointmentStatus !== 'new' && appointmentStatus !== 'rejected' && appointmentStatus !== 'cancelled';
|
|
411
|
+
}
|
|
406
412
|
}, {
|
|
407
413
|
key: "getBookingOrderPaymentStatus",
|
|
408
414
|
value: function getBookingOrderPaymentStatus(booking) {
|
|
@@ -789,9 +795,12 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
789
795
|
var resourceId = _this6.getResourceId(resource);
|
|
790
796
|
var rawMatchedBookings = rawBookingMap.get(String(resourceId)) || [];
|
|
791
797
|
var matchedBookings = bookingMap.get(String(resourceId)) || [];
|
|
792
|
-
var
|
|
793
|
-
|
|
794
|
-
|
|
798
|
+
var statsBookings = rawMatchedBookings.filter(function (booking) {
|
|
799
|
+
return _this6.isBookingIncludedInStats(booking);
|
|
800
|
+
});
|
|
801
|
+
var orderCount = _this6.countBookingOrders(statsBookings);
|
|
802
|
+
var bookingCount = statsBookings.length;
|
|
803
|
+
var compeleteBookingCount = _this6.countCompletedBookings(statsBookings);
|
|
795
804
|
var bookings = _this6.pickBookingsForCurrentPoint(current, matchedBookings);
|
|
796
805
|
return _objectSpread(_objectSpread({}, resource), {}, {
|
|
797
806
|
resource_id: resourceId,
|
|
@@ -831,7 +840,7 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
831
840
|
_resourceResponse$dat4,
|
|
832
841
|
_this7 = this,
|
|
833
842
|
_params$bookingList;
|
|
834
|
-
var current, deviceCurrent, resourceResponse, resourceList, targetResource, resourceId, matchedBookingList, completedBookingList, unpaidBookingList, bookings, completedBookings, unpaidBookings, orderCount, bookingCount, compeleteBookingCount;
|
|
843
|
+
var current, deviceCurrent, resourceResponse, resourceList, targetResource, resourceId, matchedBookingList, statsBookingList, completedBookingList, unpaidBookingList, bookings, completedBookings, unpaidBookings, orderCount, bookingCount, compeleteBookingCount;
|
|
835
844
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
836
845
|
while (1) switch (_context6.prev = _context6.next) {
|
|
837
846
|
case 0:
|
|
@@ -881,6 +890,9 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
881
890
|
matchedBookingList = params.bookingList.filter(function (booking) {
|
|
882
891
|
return _this7.isBookingMatchedResource(booking, resourceId);
|
|
883
892
|
});
|
|
893
|
+
statsBookingList = matchedBookingList.filter(function (booking) {
|
|
894
|
+
return _this7.isBookingIncludedInStats(booking);
|
|
895
|
+
});
|
|
884
896
|
completedBookingList = matchedBookingList.filter(function (booking) {
|
|
885
897
|
return _this7.getBookingAppointmentStatus(booking) === 'completed';
|
|
886
898
|
});
|
|
@@ -900,9 +912,9 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
900
912
|
});
|
|
901
913
|
});
|
|
902
914
|
unpaidBookings = this.pickBookingsForCurrentPoint(current, this.normalizeResourceBookings(current, deviceCurrent, unpaidBookingList));
|
|
903
|
-
orderCount = this.countBookingOrders(
|
|
904
|
-
bookingCount =
|
|
905
|
-
compeleteBookingCount =
|
|
915
|
+
orderCount = this.countBookingOrders(statsBookingList);
|
|
916
|
+
bookingCount = statsBookingList.length;
|
|
917
|
+
compeleteBookingCount = this.countCompletedBookings(statsBookingList);
|
|
906
918
|
this.logger.addLog({
|
|
907
919
|
type: 'info',
|
|
908
920
|
title: 'getResourceBookingItem',
|
|
@@ -928,7 +940,7 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
928
940
|
completedBookings: completedBookings,
|
|
929
941
|
unpaidBookings: unpaidBookings
|
|
930
942
|
}));
|
|
931
|
-
case
|
|
943
|
+
case 28:
|
|
932
944
|
case "end":
|
|
933
945
|
return _context6.stop();
|
|
934
946
|
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/model/strategy/adapter/promotion/index.ts
|
|
30
|
-
var promotion_exports = {};
|
|
31
|
-
__export(promotion_exports, {
|
|
32
|
-
BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
|
|
33
|
-
PromotionAdapter: () => import_adapter.PromotionAdapter,
|
|
34
|
-
PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
|
|
35
|
-
X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
|
|
36
|
-
default: () => import_adapter2.default
|
|
37
|
-
});
|
|
38
|
-
module.exports = __toCommonJS(promotion_exports);
|
|
39
|
-
var import_evaluator = require("./evaluator");
|
|
40
|
-
var import_adapter = require("./adapter");
|
|
41
|
-
var import_adapter2 = __toESM(require("./adapter"));
|
|
42
|
-
var import_examples = require("./examples");
|
|
43
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
-
0 && (module.exports = {
|
|
45
|
-
BUY_X_GET_Y_FREE_STRATEGY,
|
|
46
|
-
PromotionAdapter,
|
|
47
|
-
PromotionEvaluator,
|
|
48
|
-
X_ITEMS_FOR_Y_PRICE_STRATEGY
|
|
49
|
-
});
|
|
@@ -173,7 +173,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
173
173
|
private logSubmitBackendRejected;
|
|
174
174
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
175
175
|
createOrder(params: CommitOrderParams['query']): {
|
|
176
|
-
type: "
|
|
176
|
+
type: "virtual" | "appointment_booking";
|
|
177
177
|
platform: string;
|
|
178
178
|
sales_channel: string;
|
|
179
179
|
order_sales_channel: string;
|
package/lib/server/index.js
CHANGED
|
@@ -1870,6 +1870,7 @@ var Server = class {
|
|
|
1870
1870
|
return;
|
|
1871
1871
|
searchParams.append("with[]", String(field));
|
|
1872
1872
|
});
|
|
1873
|
+
searchParams.append("lookup_mode", "multi");
|
|
1873
1874
|
const query = searchParams.toString();
|
|
1874
1875
|
return `/shop/order/sales/${encodeURIComponent(orderId)}${query ? `?${query}` : ""}`;
|
|
1875
1876
|
}
|
|
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
311
311
|
date: string;
|
|
312
312
|
status: string;
|
|
313
313
|
week: string;
|
|
314
|
-
weekNum: 0 | 1 |
|
|
314
|
+
weekNum: 0 | 1 | 2 | 6 | 3 | 5 | 4;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|
|
@@ -330,7 +330,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
330
330
|
count: number;
|
|
331
331
|
left: number;
|
|
332
332
|
summaryCount: number;
|
|
333
|
-
status: "
|
|
333
|
+
status: "lots_of_space" | "filling_up_fast" | "sold_out";
|
|
334
334
|
}[];
|
|
335
335
|
/**
|
|
336
336
|
* 找到多个资源的公共可用时间段
|
|
@@ -81,6 +81,7 @@ export declare class SalesImpl extends BaseModule implements Module, SalesModule
|
|
|
81
81
|
private getBookingStatus;
|
|
82
82
|
private getResourceId;
|
|
83
83
|
private getBookingAppointmentStatus;
|
|
84
|
+
private isBookingIncludedInStats;
|
|
84
85
|
private getBookingOrderPaymentStatus;
|
|
85
86
|
private countBookingOrders;
|
|
86
87
|
private countCompletedBookings;
|
|
@@ -250,6 +250,10 @@ var SalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
250
250
|
getBookingAppointmentStatus(booking) {
|
|
251
251
|
return String(booking.appointment_status ?? booking.status ?? "");
|
|
252
252
|
}
|
|
253
|
+
isBookingIncludedInStats(booking) {
|
|
254
|
+
const appointmentStatus = this.getBookingAppointmentStatus(booking);
|
|
255
|
+
return appointmentStatus !== "new" && appointmentStatus !== "rejected" && appointmentStatus !== "cancelled";
|
|
256
|
+
}
|
|
253
257
|
getBookingOrderPaymentStatus(booking) {
|
|
254
258
|
var _a;
|
|
255
259
|
return String(((_a = booking.order) == null ? void 0 : _a.payment_status) ?? "");
|
|
@@ -571,9 +575,10 @@ var SalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
571
575
|
const resourceId = this.getResourceId(resource);
|
|
572
576
|
const rawMatchedBookings = rawBookingMap.get(String(resourceId)) || [];
|
|
573
577
|
const matchedBookings = bookingMap.get(String(resourceId)) || [];
|
|
574
|
-
const
|
|
575
|
-
const
|
|
576
|
-
const
|
|
578
|
+
const statsBookings = rawMatchedBookings.filter((booking) => this.isBookingIncludedInStats(booking));
|
|
579
|
+
const orderCount = this.countBookingOrders(statsBookings);
|
|
580
|
+
const bookingCount = statsBookings.length;
|
|
581
|
+
const compeleteBookingCount = this.countCompletedBookings(statsBookings);
|
|
577
582
|
const bookings = this.pickBookingsForCurrentPoint(current, matchedBookings);
|
|
578
583
|
return {
|
|
579
584
|
...resource,
|
|
@@ -622,6 +627,7 @@ var SalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
622
627
|
const matchedBookingList = params.bookingList.filter(
|
|
623
628
|
(booking) => this.isBookingMatchedResource(booking, resourceId)
|
|
624
629
|
);
|
|
630
|
+
const statsBookingList = matchedBookingList.filter((booking) => this.isBookingIncludedInStats(booking));
|
|
625
631
|
const completedBookingList = matchedBookingList.filter(
|
|
626
632
|
(booking) => this.getBookingAppointmentStatus(booking) === "completed"
|
|
627
633
|
);
|
|
@@ -648,9 +654,9 @@ var SalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
648
654
|
current,
|
|
649
655
|
this.normalizeResourceBookings(current, deviceCurrent, unpaidBookingList)
|
|
650
656
|
);
|
|
651
|
-
const orderCount = this.countBookingOrders(
|
|
652
|
-
const bookingCount =
|
|
653
|
-
const compeleteBookingCount =
|
|
657
|
+
const orderCount = this.countBookingOrders(statsBookingList);
|
|
658
|
+
const bookingCount = statsBookingList.length;
|
|
659
|
+
const compeleteBookingCount = this.countCompletedBookings(statsBookingList);
|
|
654
660
|
this.logger.addLog({
|
|
655
661
|
type: "info",
|
|
656
662
|
title: "getResourceBookingItem",
|