@pisell/pisellos 0.10.90 → 0.10.93
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/itemRule/adapter.d.ts +3 -1
- package/dist/model/strategy/adapter/itemRule/adapter.js +74 -7
- package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +3 -1
- package/dist/model/strategy/adapter/itemRule/evaluator.js +13 -0
- package/dist/model/strategy/adapter/itemRule/type.d.ts +40 -1
- package/dist/model/strategy/adapter/itemRule/type.js +10 -0
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +2 -1
- package/dist/model/strategy/adapter/promotion/evaluator.js +103 -112
- package/dist/modules/BookingContext/utils/calendarBooking.d.ts +15 -0
- package/dist/modules/BookingContext/utils/calendarBooking.js +207 -0
- package/dist/modules/BookingContext/utils/index.d.ts +1 -0
- package/dist/modules/BookingContext/utils/index.js +1 -0
- package/dist/modules/BookingContext/utils/productExtend.d.ts +21 -0
- package/dist/modules/BookingContext/utils/productExtend.js +132 -33
- package/dist/modules/BookingContext/utils/resources.js +1 -1
- package/dist/modules/Cart/index.js +4 -3
- package/dist/modules/Cart/types.d.ts +2 -0
- package/dist/modules/Cart/utils/cartProduct.d.ts +3 -1
- package/dist/modules/Cart/utils/cartProduct.js +59 -32
- package/dist/modules/Date/index.d.ts +1 -1
- package/dist/modules/Date/index.js +60 -14
- package/dist/modules/Date/types.d.ts +5 -0
- package/dist/modules/OpenData/salesSettings.js +1 -1
- package/dist/modules/OpenData/types.d.ts +9 -0
- package/dist/modules/OpenData/utils.d.ts +1 -1
- package/dist/modules/OpenData/utils.js +3 -2
- package/dist/modules/Order/index.d.ts +22 -7
- package/dist/modules/Order/index.js +1565 -1161
- package/dist/modules/Order/localEftposState.d.ts +13 -0
- package/dist/modules/Order/localEftposState.js +39 -0
- package/dist/modules/Order/types.d.ts +33 -11
- package/dist/modules/Order/types.js +2 -2
- package/dist/modules/Order/unpaidAmountGap.d.ts +6 -0
- package/dist/modules/Order/unpaidAmountGap.js +72 -0
- package/dist/modules/Order/utils.d.ts +4 -1
- package/dist/modules/Order/utils.js +75 -52
- package/dist/modules/Payment/walletpass.js +32 -6
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/Product/types.d.ts +16 -0
- package/dist/modules/ProductList/index.js +1 -1
- package/dist/modules/ResourcePlanner/planner.d.ts +2 -0
- package/dist/modules/ResourcePlanner/planner.js +383 -24
- package/dist/modules/ResourcePlanner/types.d.ts +42 -0
- package/dist/modules/Rules/index.js +86 -54
- package/dist/modules/Schedule/index.d.ts +7 -1
- package/dist/modules/Schedule/index.js +155 -39
- package/dist/modules/Schedule/types.d.ts +2 -0
- package/dist/modules/bookingReadValidation.d.ts +6 -0
- package/dist/modules/bookingReadValidation.js +72 -0
- package/dist/plugins/request.d.ts +2 -0
- package/dist/server/index.d.ts +9 -0
- package/dist/server/index.js +1928 -1462
- package/dist/server/modules/form/index.d.ts +19 -0
- package/dist/server/modules/form/index.js +205 -0
- package/dist/server/modules/form/types.d.ts +13 -0
- package/dist/server/modules/form/types.js +3 -0
- package/dist/server/modules/index.d.ts +3 -0
- package/dist/server/modules/index.js +4 -0
- package/dist/server/modules/order/index.d.ts +21 -0
- package/dist/server/modules/order/index.js +1399 -831
- package/dist/server/modules/order/types.d.ts +3 -0
- package/dist/server/modules/order/utils/filterOrders.js +20 -0
- package/dist/server/modules/products/index.d.ts +28 -7
- package/dist/server/modules/products/index.js +1295 -769
- package/dist/server/modules/products/replication.d.ts +8 -0
- package/dist/server/modules/products/replication.js +69 -0
- package/dist/server/modules/products/types.d.ts +12 -1
- package/dist/server/modules/products/types.js +4 -0
- package/dist/shared/receipt/customerInvoiceLanguages.d.ts +1 -1
- package/dist/shared/receipt/customerInvoiceLanguages.js +5 -3
- package/dist/shared/receipt/small-ticket.d.ts +1 -0
- package/dist/shared/receipt/small-ticket.js +58 -26
- package/dist/shared/receipt/templateVisibility.d.ts +3 -0
- package/dist/shared/receipt/templateVisibility.js +6 -2
- package/dist/solution/BaseSales/fulfillmentItemRules.d.ts +27 -0
- package/dist/solution/BaseSales/fulfillmentItemRules.js +750 -0
- package/dist/solution/BaseSales/index.d.ts +22 -6
- package/dist/solution/BaseSales/index.js +1881 -1347
- package/dist/solution/BaseSales/pickupTiming.d.ts +4 -0
- package/dist/solution/BaseSales/pickupTiming.js +35 -8
- package/dist/solution/BaseSales/types.d.ts +4 -0
- package/dist/solution/BaseSales/types.js +1 -0
- package/dist/solution/BaseSales/utils/posDurationPricing.d.ts +21 -0
- package/dist/solution/BaseSales/utils/posDurationPricing.js +174 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +2 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +8 -8
- package/dist/solution/BookingByStep/index.d.ts +20 -4
- package/dist/solution/BookingByStep/index.js +681 -361
- package/dist/solution/BookingByStep/utils/resources.d.ts +10 -0
- package/dist/solution/BookingByStep/utils/resources.js +117 -76
- package/dist/solution/BookingTicket/index.d.ts +10 -0
- package/dist/solution/BookingTicket/index.js +686 -598
- package/dist/solution/BookingTicket/types.d.ts +1 -1
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +2 -1
- package/dist/solution/BookingTicket/utils/addProductDecision.js +35 -8
- package/dist/solution/BookingTicket/utils/redeemArrival.d.ts +8 -8
- package/dist/solution/BookingTicket/utils/resolveUniqueCartDetail.d.ts +8 -0
- package/dist/solution/BookingTicket/utils/resolveUniqueCartDetail.js +188 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +58 -94
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +1 -3
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +33 -62
- package/dist/solution/OrderInvoicePreview/index.js +4 -3
- package/dist/solution/Sales/index.js +1 -1
- package/dist/solution/ScanOrder/index.d.ts +2 -0
- package/dist/solution/ScanOrder/index.js +230 -97
- package/dist/solution/ScanOrder/menuAvailability.d.ts +24 -0
- package/dist/solution/ScanOrder/menuAvailability.js +363 -0
- package/dist/solution/ScanOrder/types.d.ts +3 -0
- package/dist/solution/UnifiedBookingSales/index.d.ts +42 -10
- package/dist/solution/UnifiedBookingSales/index.js +2493 -1496
- package/dist/solution/UnifiedBookingSales/salesSettings.js +1 -1
- package/dist/solution/UnifiedBookingSales/types.d.ts +20 -5
- package/dist/utils/pos-receipt-auto-print.d.ts +4 -0
- package/dist/utils/pos-receipt-auto-print.js +14 -0
- package/lib/model/strategy/adapter/itemRule/adapter.d.ts +3 -1
- package/lib/model/strategy/adapter/itemRule/adapter.js +54 -4
- package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +3 -1
- package/lib/model/strategy/adapter/itemRule/evaluator.js +9 -0
- package/lib/model/strategy/adapter/itemRule/type.d.ts +40 -1
- package/lib/model/strategy/adapter/itemRule/type.js +10 -0
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +2 -1
- package/lib/model/strategy/adapter/promotion/evaluator.js +22 -21
- package/lib/modules/BookingContext/utils/calendarBooking.d.ts +15 -0
- package/lib/modules/BookingContext/utils/calendarBooking.js +156 -0
- package/lib/modules/BookingContext/utils/index.d.ts +1 -0
- package/lib/modules/BookingContext/utils/index.js +11 -0
- package/lib/modules/BookingContext/utils/productExtend.d.ts +21 -0
- package/lib/modules/BookingContext/utils/productExtend.js +104 -5
- package/lib/modules/BookingContext/utils/resources.js +1 -1
- package/lib/modules/Cart/index.js +4 -2
- package/lib/modules/Cart/types.d.ts +2 -0
- package/lib/modules/Cart/utils/cartProduct.d.ts +3 -1
- package/lib/modules/Cart/utils/cartProduct.js +39 -20
- package/lib/modules/Date/index.d.ts +1 -1
- package/lib/modules/Date/index.js +28 -5
- package/lib/modules/Date/types.d.ts +5 -0
- package/lib/modules/OpenData/salesSettings.js +1 -1
- package/lib/modules/OpenData/types.d.ts +9 -0
- package/lib/modules/OpenData/utils.d.ts +1 -1
- package/lib/modules/OpenData/utils.js +3 -2
- package/lib/modules/Order/index.d.ts +22 -7
- package/lib/modules/Order/index.js +457 -174
- package/lib/modules/Order/localEftposState.d.ts +13 -0
- package/lib/modules/Order/localEftposState.js +44 -0
- package/lib/modules/Order/types.d.ts +33 -11
- package/lib/modules/Order/types.js +2 -2
- package/lib/modules/Order/unpaidAmountGap.d.ts +6 -0
- package/lib/modules/Order/unpaidAmountGap.js +60 -0
- package/lib/modules/Order/utils.d.ts +4 -1
- package/lib/modules/Order/utils.js +29 -3
- package/lib/modules/Payment/walletpass.js +23 -1
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Product/types.d.ts +16 -0
- package/lib/modules/ProductList/index.js +1 -1
- package/lib/modules/ResourcePlanner/planner.d.ts +2 -0
- package/lib/modules/ResourcePlanner/planner.js +299 -9
- package/lib/modules/ResourcePlanner/types.d.ts +42 -0
- package/lib/modules/Rules/index.js +32 -3
- package/lib/modules/Schedule/index.d.ts +7 -1
- package/lib/modules/Schedule/index.js +68 -4
- package/lib/modules/Schedule/types.d.ts +2 -0
- package/lib/modules/bookingReadValidation.d.ts +6 -0
- package/lib/modules/bookingReadValidation.js +56 -0
- package/lib/plugins/request.d.ts +2 -0
- package/lib/server/index.d.ts +9 -0
- package/lib/server/index.js +279 -30
- package/lib/server/modules/form/index.d.ts +19 -0
- package/lib/server/modules/form/index.js +73 -0
- package/lib/server/modules/form/types.d.ts +13 -0
- package/lib/server/modules/form/types.js +9 -0
- package/lib/server/modules/index.d.ts +3 -0
- package/lib/server/modules/index.js +15 -1
- package/lib/server/modules/order/index.d.ts +21 -0
- package/lib/server/modules/order/index.js +344 -35
- package/lib/server/modules/order/types.d.ts +3 -0
- package/lib/server/modules/order/utils/filterOrders.js +18 -0
- package/lib/server/modules/products/index.d.ts +28 -7
- package/lib/server/modules/products/index.js +224 -62
- package/lib/server/modules/products/replication.d.ts +8 -0
- package/lib/server/modules/products/replication.js +30 -0
- package/lib/server/modules/products/types.d.ts +12 -1
- package/lib/server/modules/products/types.js +3 -0
- package/lib/shared/receipt/customerInvoiceLanguages.d.ts +1 -1
- package/lib/shared/receipt/customerInvoiceLanguages.js +5 -3
- package/lib/shared/receipt/small-ticket.d.ts +1 -0
- package/lib/shared/receipt/small-ticket.js +53 -25
- package/lib/shared/receipt/templateVisibility.d.ts +3 -0
- package/lib/shared/receipt/templateVisibility.js +6 -2
- package/lib/solution/BaseSales/fulfillmentItemRules.d.ts +27 -0
- package/lib/solution/BaseSales/fulfillmentItemRules.js +259 -0
- package/lib/solution/BaseSales/index.d.ts +22 -6
- package/lib/solution/BaseSales/index.js +347 -59
- package/lib/solution/BaseSales/pickupTiming.d.ts +4 -0
- package/lib/solution/BaseSales/pickupTiming.js +24 -3
- package/lib/solution/BaseSales/types.d.ts +4 -0
- package/lib/solution/BaseSales/types.js +1 -0
- package/lib/solution/BaseSales/utils/posDurationPricing.d.ts +21 -0
- package/lib/solution/BaseSales/utils/posDurationPricing.js +133 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +2 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +1 -1
- package/lib/solution/BookingByStep/index.d.ts +20 -4
- package/lib/solution/BookingByStep/index.js +229 -17
- package/lib/solution/BookingByStep/utils/resources.d.ts +10 -0
- package/lib/solution/BookingByStep/utils/resources.js +25 -15
- package/lib/solution/BookingTicket/index.d.ts +10 -0
- package/lib/solution/BookingTicket/index.js +57 -6
- package/lib/solution/BookingTicket/types.d.ts +1 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +2 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.js +34 -4
- package/lib/solution/BookingTicket/utils/redeemArrival.d.ts +8 -8
- package/lib/solution/BookingTicket/utils/resolveUniqueCartDetail.d.ts +8 -0
- package/lib/solution/BookingTicket/utils/resolveUniqueCartDetail.js +136 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +2 -14
- package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +1 -3
- package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +17 -34
- package/lib/solution/OrderInvoicePreview/index.js +1 -0
- package/lib/solution/Sales/index.js +1 -1
- package/lib/solution/ScanOrder/index.d.ts +2 -0
- package/lib/solution/ScanOrder/index.js +131 -22
- package/lib/solution/ScanOrder/menuAvailability.d.ts +24 -0
- package/lib/solution/ScanOrder/menuAvailability.js +203 -0
- package/lib/solution/ScanOrder/types.d.ts +3 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +42 -10
- package/lib/solution/UnifiedBookingSales/index.js +717 -144
- package/lib/solution/UnifiedBookingSales/salesSettings.js +1 -1
- package/lib/solution/UnifiedBookingSales/types.d.ts +20 -5
- package/lib/utils/pos-receipt-auto-print.d.ts +4 -0
- package/lib/utils/pos-receipt-auto-print.js +13 -0
- package/package.json +1 -1
|
@@ -12,6 +12,7 @@ var _isSameOrAfter = _interopRequireDefault(require("dayjs/plugin/isSameOrAfter"
|
|
|
12
12
|
var _utils = require("../Date/utils");
|
|
13
13
|
var _utils2 = require("./utils");
|
|
14
14
|
var _getDateIsInSchedule = require("./getDateIsInSchedule");
|
|
15
|
+
var _bookingReadValidation = require("../bookingReadValidation");
|
|
15
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
17
|
_dayjs.default.extend(_isSameOrBefore.default);
|
|
17
18
|
_dayjs.default.extend(_isSameOrAfter.default);
|
|
@@ -28,13 +29,17 @@ class ScheduleModule extends _BaseModule.BaseModule {
|
|
|
28
29
|
scheduleListRequestVersion = 0;
|
|
29
30
|
scheduleCatalogScope = '';
|
|
30
31
|
otherParams = {};
|
|
32
|
+
catalogVersion = 0;
|
|
33
|
+
destroyed = false;
|
|
34
|
+
availabilityRequestVersion = 0;
|
|
31
35
|
constructor(name, version) {
|
|
32
36
|
super(name, version);
|
|
33
37
|
}
|
|
34
38
|
async initialize(core, options) {
|
|
35
39
|
// The store proxies initialState, so capture its input before resets write through it.
|
|
36
40
|
const initialScheduleList = options.initialState?.scheduleList;
|
|
37
|
-
const hasInitialScheduleList = Array.isArray(initialScheduleList);
|
|
41
|
+
const hasInitialScheduleList = options.otherParams?.scheduleCatalogCache !== 'memory' && Array.isArray(initialScheduleList);
|
|
42
|
+
this.destroyed = false;
|
|
38
43
|
this.resetScheduleCatalog();
|
|
39
44
|
this.core = core;
|
|
40
45
|
|
|
@@ -89,6 +94,8 @@ class ScheduleModule extends _BaseModule.BaseModule {
|
|
|
89
94
|
}
|
|
90
95
|
}
|
|
91
96
|
resetScheduleCatalog() {
|
|
97
|
+
this.catalogVersion += 1;
|
|
98
|
+
this.availabilityRequestVersion += 1;
|
|
92
99
|
this.scheduleListRequestVersion += 1;
|
|
93
100
|
this.scheduleListPromise = null;
|
|
94
101
|
this.hasLoadedScheduleList = false;
|
|
@@ -96,6 +103,7 @@ class ScheduleModule extends _BaseModule.BaseModule {
|
|
|
96
103
|
this.store.map = new Map();
|
|
97
104
|
}
|
|
98
105
|
destroy() {
|
|
106
|
+
this.destroyed = true;
|
|
99
107
|
this.resetScheduleCatalog();
|
|
100
108
|
super.destroy();
|
|
101
109
|
}
|
|
@@ -123,15 +131,48 @@ class ScheduleModule extends _BaseModule.BaseModule {
|
|
|
123
131
|
}
|
|
124
132
|
}
|
|
125
133
|
}
|
|
134
|
+
getScheduleCatalogVersion() {
|
|
135
|
+
this.syncScheduleCatalogScope();
|
|
136
|
+
return this.catalogVersion;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/** Resolve only after the current scope has a successful catalog. */
|
|
140
|
+
async ensureScheduleReady() {
|
|
141
|
+
while (!this.destroyed) {
|
|
142
|
+
this.syncScheduleCatalogScope();
|
|
143
|
+
const scope = this.scheduleCatalogScope;
|
|
144
|
+
try {
|
|
145
|
+
await this.loadAllSchedule();
|
|
146
|
+
} catch (error) {
|
|
147
|
+
if (this.destroyed) throw Object.assign(new Error('Schedule catalog was closed'), {
|
|
148
|
+
name: 'AbortError'
|
|
149
|
+
});
|
|
150
|
+
this.syncScheduleCatalogScope();
|
|
151
|
+
if (scope === this.scheduleCatalogScope) throw error;
|
|
152
|
+
// A failed old-scope request does not describe the new scope.
|
|
153
|
+
}
|
|
154
|
+
this.syncScheduleCatalogScope();
|
|
155
|
+
if (!this.destroyed && this.hasLoadedScheduleList && !this.scheduleListPromise) return;
|
|
156
|
+
}
|
|
157
|
+
throw Object.assign(new Error('Schedule catalog was closed'), {
|
|
158
|
+
name: 'AbortError'
|
|
159
|
+
});
|
|
160
|
+
}
|
|
126
161
|
async loadScheduleCatalog(useCache, requestVersion) {
|
|
127
162
|
const response = await this.request.get(`/schedule`, {
|
|
128
163
|
num: 999
|
|
129
164
|
}, {
|
|
130
|
-
useCache
|
|
165
|
+
useCache: this.otherParams.scheduleCatalogCache === 'memory' ? false : useCache,
|
|
166
|
+
...(this.otherParams.bookingRead ? {
|
|
167
|
+
bookingRead: true
|
|
168
|
+
} : {})
|
|
131
169
|
});
|
|
132
170
|
if (response.code !== undefined && Number(response.code) !== 200 || response.status === false || typeof response.status === 'number' && response.status >= 400 || response.success === false) {
|
|
133
171
|
throw new Error(response.message || 'Schedule catalog request failed');
|
|
134
172
|
}
|
|
173
|
+
if ((this.otherParams.bookingRead || this.otherParams.scheduleCatalogCache === 'memory') && !(0, _bookingReadValidation.isBookingScheduleList)(response?.data?.list)) {
|
|
174
|
+
throw new Error('Invalid schedule catalog response');
|
|
175
|
+
}
|
|
135
176
|
this.syncScheduleCatalogScope();
|
|
136
177
|
// A refresh or a different runtime may have superseded this request.
|
|
137
178
|
if (requestVersion === this.scheduleListRequestVersion) {
|
|
@@ -143,6 +184,7 @@ class ScheduleModule extends _BaseModule.BaseModule {
|
|
|
143
184
|
this.store.scheduleList = list;
|
|
144
185
|
this.syncScheduleMap();
|
|
145
186
|
this.hasLoadedScheduleList = true;
|
|
187
|
+
this.catalogVersion += 1;
|
|
146
188
|
}
|
|
147
189
|
syncScheduleMap() {
|
|
148
190
|
this.store.map = new Map((this.store.scheduleList || []).map(schedule => [Number(schedule.id), schedule]));
|
|
@@ -159,8 +201,12 @@ class ScheduleModule extends _BaseModule.BaseModule {
|
|
|
159
201
|
startDate,
|
|
160
202
|
endDate,
|
|
161
203
|
custom_page_id,
|
|
162
|
-
channel
|
|
204
|
+
channel,
|
|
205
|
+
assertCurrent
|
|
163
206
|
}) {
|
|
207
|
+
this.syncScheduleCatalogScope();
|
|
208
|
+
const requestVersion = ++this.availabilityRequestVersion;
|
|
209
|
+
const scope = this.scheduleCatalogScope;
|
|
164
210
|
// 前端传递的 startDate,可能是今天之前的,如果 startDate 小于今天,需要把 startDate 置为今天
|
|
165
211
|
if ((0, _dayjs.default)(startDate).isBefore((0, _dayjs.default)(), 'day')) {
|
|
166
212
|
startDate = (0, _dayjs.default)().format('YYYY-MM-DD');
|
|
@@ -177,7 +223,25 @@ class ScheduleModule extends _BaseModule.BaseModule {
|
|
|
177
223
|
end_date: endDate,
|
|
178
224
|
custom_page_id,
|
|
179
225
|
channel
|
|
226
|
+
}, this.otherParams.bookingRead ? {
|
|
227
|
+
bookingRead: true
|
|
228
|
+
} : undefined).catch(error => {
|
|
229
|
+
assertCurrent?.();
|
|
230
|
+
throw error;
|
|
180
231
|
});
|
|
232
|
+
assertCurrent?.();
|
|
233
|
+
if (this.otherParams.bookingRead) {
|
|
234
|
+
const response = res;
|
|
235
|
+
if (!response || response.code !== undefined && Number(response.code) !== 200 || response.status === false || response.success === false || typeof response.status === 'number' && response.status >= 400 || !(0, _bookingReadValidation.isBookingAvailabilityData)(response.data)) {
|
|
236
|
+
throw new Error(response?.message || 'Invalid schedule availability response');
|
|
237
|
+
}
|
|
238
|
+
this.syncScheduleCatalogScope();
|
|
239
|
+
if (this.destroyed || scope !== this.scheduleCatalogScope || requestVersion !== this.availabilityRequestVersion) {
|
|
240
|
+
throw Object.assign(new Error('Schedule availability context changed'), {
|
|
241
|
+
name: 'AbortError'
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
}
|
|
181
245
|
const responseData = res.data || {};
|
|
182
246
|
const dateList = Array.isArray(responseData.date_list) ? responseData.date_list : [];
|
|
183
247
|
const otherProductIds = Array.isArray(responseData.other_product_ids) ? responseData.other_product_ids : [];
|
|
@@ -232,7 +296,7 @@ class ScheduleModule extends _BaseModule.BaseModule {
|
|
|
232
296
|
cacheId: this.cacheId,
|
|
233
297
|
fatherModule: this.fatherModule,
|
|
234
298
|
store,
|
|
235
|
-
cacheKey: ['scheduleList', 'availabilityDateList', 'otherProductsIds']
|
|
299
|
+
cacheKey: this.otherParams.scheduleCatalogCache === 'memory' ? ['availabilityDateList', 'otherProductsIds'] : ['scheduleList', 'availabilityDateList', 'otherProductsIds']
|
|
236
300
|
});
|
|
237
301
|
}
|
|
238
302
|
}
|
|
@@ -15,6 +15,8 @@ export type ScheduleAvailabilityDateItem = {
|
|
|
15
15
|
* 加载日程可用日期参数接口
|
|
16
16
|
*/
|
|
17
17
|
export interface LoadScheduleAvailableDateParams {
|
|
18
|
+
/** Caller lifecycle guard, checked before committing availability. */
|
|
19
|
+
assertCurrent?: () => void;
|
|
18
20
|
/** 开始日期 */
|
|
19
21
|
startDate: string;
|
|
20
22
|
/** 结束日期 */
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Validate only the catalog fields consumed by booking reads, not display metadata. */
|
|
2
|
+
export declare const isBookingScheduleList: (value: unknown) => boolean;
|
|
3
|
+
/** Empty resource/time/event arrays and zero capacity are valid successful results. */
|
|
4
|
+
export declare const isBookingResourceList: (value: unknown) => boolean;
|
|
5
|
+
/** The availability endpoint may return either or both lists. */
|
|
6
|
+
export declare const isBookingAvailabilityData: (value: unknown) => boolean;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isBookingScheduleList = exports.isBookingResourceList = exports.isBookingAvailabilityData = void 0;
|
|
7
|
+
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
const isRecord = value => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
10
|
+
const isNumericValue = value => (typeof value === 'number' || typeof value === 'string' && value.trim() !== '') && Number.isFinite(Number(value));
|
|
11
|
+
const isDateValue = value => {
|
|
12
|
+
if (typeof value !== 'string' || !value.trim() || !(0, _dayjs.default)(value).isValid()) return false;
|
|
13
|
+
// dayjs accepts overflowing calendar components; do not turn them into another date.
|
|
14
|
+
const dateParts = /^(\d{4})-(\d{2})-(\d{2})(?:$|[ T])/.exec(value);
|
|
15
|
+
if (!dateParts) return true;
|
|
16
|
+
const [, year, month, date] = dateParts.map(Number);
|
|
17
|
+
const calendarDate = new Date(0);
|
|
18
|
+
calendarDate.setUTCFullYear(year, month - 1, date);
|
|
19
|
+
return calendarDate.getUTCFullYear() === year && calendarDate.getUTCMonth() === month - 1 && calendarDate.getUTCDate() === date;
|
|
20
|
+
};
|
|
21
|
+
const isRecordArray = value => Array.isArray(value) && value.every(isRecord);
|
|
22
|
+
|
|
23
|
+
/** Validate only the catalog fields consumed by booking reads, not display metadata. */
|
|
24
|
+
const isBookingScheduleList = value => Array.isArray(value) && value.every(schedule => {
|
|
25
|
+
if (!isRecord(schedule) || !isNumericValue(schedule.id)) return false;
|
|
26
|
+
if (schedule.type === 'time-slots' && !isRecordArray(schedule.time_slot)) return false;
|
|
27
|
+
if (schedule.type === 'designation' && !isRecord(schedule.designation) && !isRecordArray(schedule.designation)) return false;
|
|
28
|
+
if ((schedule.repeat_type === 'daily' || schedule.repeat_type === 'weekly') && !isRecord(schedule.repeat_rule)) return false;
|
|
29
|
+
if (schedule.repeat_rule !== undefined && schedule.repeat_rule !== null) {
|
|
30
|
+
if (!isRecord(schedule.repeat_rule)) return false;
|
|
31
|
+
const rule = schedule.repeat_rule;
|
|
32
|
+
if (rule.end !== undefined && rule.end !== null && !isRecord(rule.end)) return false;
|
|
33
|
+
for (const key of ['excluded_date', 'included_date', 'frequency_date']) {
|
|
34
|
+
if (rule[key] !== undefined && rule[key] !== null && !Array.isArray(rule[key])) return false;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return true;
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
/** Empty resource/time/event arrays and zero capacity are valid successful results. */
|
|
41
|
+
exports.isBookingScheduleList = isBookingScheduleList;
|
|
42
|
+
const isBookingResourceList = value => Array.isArray(value) && value.every(resource => {
|
|
43
|
+
if (!isRecord(resource) || !isNumericValue(resource.id) || !isNumericValue(resource.form_id) || !Array.isArray(resource.times)) return false;
|
|
44
|
+
if (resource.capacity !== undefined && !isNumericValue(resource.capacity)) return false;
|
|
45
|
+
return resource.times.every(time => isRecord(time) && isDateValue(time.start_at) && isDateValue(time.end_at) && (time.event_list === undefined || isRecordArray(time.event_list)));
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
/** The availability endpoint may return either or both lists. */
|
|
49
|
+
exports.isBookingResourceList = isBookingResourceList;
|
|
50
|
+
const isBookingAvailabilityData = value => {
|
|
51
|
+
if (!isRecord(value) || value.date_list === undefined && value.other_product_ids === undefined) return false;
|
|
52
|
+
if (value.date_list !== undefined && (!Array.isArray(value.date_list) || !value.date_list.every(date => isRecord(date) && isDateValue(date.date)))) return false;
|
|
53
|
+
if (value.other_product_ids !== undefined && (!Array.isArray(value.other_product_ids) || !value.other_product_ids.every(isNumericValue))) return false;
|
|
54
|
+
return true;
|
|
55
|
+
};
|
|
56
|
+
exports.isBookingAvailabilityData = isBookingAvailabilityData;
|
package/lib/plugins/request.d.ts
CHANGED
|
@@ -56,6 +56,8 @@ export interface CacheProps {
|
|
|
56
56
|
* 请求配置
|
|
57
57
|
*/
|
|
58
58
|
export interface RequestOptions {
|
|
59
|
+
/** Opt in to the host's bounded retry policy for booking availability GETs. */
|
|
60
|
+
bookingRead?: boolean;
|
|
59
61
|
/** Customer-only, credential-free GET /open/document/{id} on picoding. */
|
|
60
62
|
publicInvoiceDocument?: boolean;
|
|
61
63
|
/** Route through the host's configured picoding environment. */
|
package/lib/server/index.d.ts
CHANGED
|
@@ -64,6 +64,8 @@ declare class Server {
|
|
|
64
64
|
private salesSearchSubscribers;
|
|
65
65
|
private deviceTaskActionsRegistered;
|
|
66
66
|
private localPaymentUpdateQueues;
|
|
67
|
+
private paymentIdentityRefreshes;
|
|
68
|
+
private receiptFulfillmentConfigInFlight;
|
|
67
69
|
private floorPlanQuerySubscribers;
|
|
68
70
|
private moduleRegistry;
|
|
69
71
|
constructor(core: PisellCore);
|
|
@@ -133,6 +135,8 @@ declare class Server {
|
|
|
133
135
|
private resolveKioskCheckoutOperatorId;
|
|
134
136
|
private mergeCheckoutSyncPayments;
|
|
135
137
|
private persistSyncedCheckoutOrder;
|
|
138
|
+
private hasPaidPaymentWithoutId;
|
|
139
|
+
private refreshMissingPaymentIds;
|
|
136
140
|
/**
|
|
137
141
|
* 将普通层 QuotationModule 的报价单计算能力桥接到 Server Products 模块。
|
|
138
142
|
*/
|
|
@@ -500,6 +504,7 @@ declare class Server {
|
|
|
500
504
|
private buildLocalPaymentSurchargeUpdate;
|
|
501
505
|
private handleGetLocalPayment;
|
|
502
506
|
private handleUpdateLocalPayment;
|
|
507
|
+
private handleFinalizeLocalEftposPayment;
|
|
503
508
|
private runLocalPaymentUpdateInQueue;
|
|
504
509
|
private processLocalPaymentUpdate;
|
|
505
510
|
private processSuccessfulLocalPayment;
|
|
@@ -522,6 +527,8 @@ declare class Server {
|
|
|
522
527
|
private extractInvoiceTemplateSettings;
|
|
523
528
|
private applyCheckoutFulfillmentBuzzer;
|
|
524
529
|
private buildCheckoutResourceIdentifierBuzzer;
|
|
530
|
+
/** Refresh derived references on receipt copies; manual references and stored orders stay intact. */
|
|
531
|
+
private withCurrentReceiptResourceReference;
|
|
525
532
|
private getCheckoutResourceIdentifier;
|
|
526
533
|
private stringifyCheckoutResourceIdentifier;
|
|
527
534
|
private normalizeCheckoutSubmitData;
|
|
@@ -560,6 +567,8 @@ declare class Server {
|
|
|
560
567
|
* Android 结账自动小票由当前设备设置控制;其它平台保持原有行为。
|
|
561
568
|
*/
|
|
562
569
|
private shouldAutoPrintCheckoutReceipt;
|
|
570
|
+
/** Only receipt auto-printing uses this policy; vouchers retain their paid-order gate. */
|
|
571
|
+
private shouldAutoPrintReceiptForPaymentStatus;
|
|
563
572
|
private shouldBuildSmallTicketData;
|
|
564
573
|
private shouldPrintSyncedOrder;
|
|
565
574
|
private hasPaymentStatus;
|