@pisell/pisellos 0.10.94 → 0.10.96
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/OpenData/index.d.ts +13 -0
- package/dist/modules/OpenData/index.js +243 -93
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/SalesSummary/index.d.ts +3 -0
- package/dist/modules/SalesSummary/index.js +104 -56
- package/dist/server/index.d.ts +7 -0
- package/dist/server/index.js +1036 -598
- package/dist/server/modules/order/index.d.ts +1 -0
- package/dist/server/modules/order/index.js +51 -51
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/BookingTicket/utils/redeemArrival.d.ts +8 -8
- package/dist/solution/Sales/index.d.ts +2 -1
- package/dist/solution/Sales/index.js +154 -48
- package/dist/solution/Sales/types.d.ts +12 -0
- package/dist/solution/Sales/types.js +2 -0
- package/dist/solution/UnifiedBookingSales/index.d.ts +1 -0
- package/dist/solution/UnifiedBookingSales/index.js +48 -49
- package/dist/solution/UnifiedBookingSales/sessionResourceCache.d.ts +4 -0
- package/dist/solution/UnifiedBookingSales/sessionResourceCache.js +91 -14
- package/lib/modules/OpenData/index.d.ts +13 -0
- package/lib/modules/OpenData/index.js +97 -18
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/SalesSummary/index.d.ts +3 -0
- package/lib/modules/SalesSummary/index.js +36 -15
- package/lib/server/index.d.ts +7 -0
- package/lib/server/index.js +240 -18
- package/lib/server/modules/order/index.d.ts +1 -0
- package/lib/server/modules/order/index.js +4 -3
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/BookingTicket/utils/redeemArrival.d.ts +8 -8
- package/lib/solution/Sales/index.d.ts +2 -1
- package/lib/solution/Sales/index.js +53 -0
- package/lib/solution/Sales/types.d.ts +12 -0
- package/lib/solution/Sales/types.js +1 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +1 -0
- package/lib/solution/UnifiedBookingSales/index.js +11 -10
- package/lib/solution/UnifiedBookingSales/sessionResourceCache.d.ts +4 -0
- package/lib/solution/UnifiedBookingSales/sessionResourceCache.js +69 -4
- package/package.json +1 -1
|
@@ -46,6 +46,7 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
46
46
|
_defineProperty(_assertThisInitialized(_this), "surchargeListModuleName", 'surchargeList');
|
|
47
47
|
_defineProperty(_assertThisInitialized(_this), "otherParams", {});
|
|
48
48
|
_defineProperty(_assertThisInitialized(_this), "surchargeListChannel", DEFAULT_SURCHARGE_CHANNEL);
|
|
49
|
+
_defineProperty(_assertThisInitialized(_this), "surchargeLoads", new Map());
|
|
49
50
|
return _this;
|
|
50
51
|
}
|
|
51
52
|
_createClass(SalesSummaryModule, [{
|
|
@@ -61,6 +62,7 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
61
62
|
this.appPlugin = this.core.getPlugin('app');
|
|
62
63
|
this.request = this.core.getPlugin('request');
|
|
63
64
|
this.otherParams = options.otherParams || {};
|
|
65
|
+
this.surchargeLoads = new Map();
|
|
64
66
|
this.store.surchargeList = ((_options$initialState = options.initialState) === null || _options$initialState === void 0 ? void 0 : _options$initialState.surchargeList) || [];
|
|
65
67
|
this.store.summary = ((_options$initialState2 = options.initialState) === null || _options$initialState2 === void 0 ? void 0 : _options$initialState2.summary) || createEmptySalesSummary();
|
|
66
68
|
this.surchargeListModuleName = ((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.surchargeListModuleName) || 'surchargeList';
|
|
@@ -69,14 +71,14 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
69
71
|
// throw new Error('SalesSummaryModule 需要 app 插件支持');
|
|
70
72
|
// }
|
|
71
73
|
if (this.request) {
|
|
72
|
-
_context.next =
|
|
74
|
+
_context.next = 11;
|
|
73
75
|
break;
|
|
74
76
|
}
|
|
75
77
|
throw new Error('SalesSummaryModule 需要 request 插件支持');
|
|
76
|
-
case
|
|
77
|
-
_context.next =
|
|
78
|
+
case 11:
|
|
79
|
+
_context.next = 13;
|
|
78
80
|
return this.getSurchargeList();
|
|
79
|
-
case
|
|
81
|
+
case 13:
|
|
80
82
|
case "end":
|
|
81
83
|
return _context.stop();
|
|
82
84
|
}
|
|
@@ -97,23 +99,25 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
97
99
|
key: "updateOtherParams",
|
|
98
100
|
value: (function () {
|
|
99
101
|
var _updateOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
|
|
100
|
-
var
|
|
102
|
+
var _params$shopId, _this$otherParams$sho, _params$tenantId, _this$otherParams$ten;
|
|
103
|
+
var previousChannel, nextSurchargeListModuleName, nextChannel, sourceChanged;
|
|
101
104
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
102
105
|
while (1) switch (_context2.prev = _context2.next) {
|
|
103
106
|
case 0:
|
|
104
107
|
previousChannel = this.resolveChannel();
|
|
105
108
|
nextSurchargeListModuleName = (params === null || params === void 0 ? void 0 : params.surchargeListModuleName) || 'surchargeList';
|
|
106
109
|
nextChannel = this.resolveChannel(params);
|
|
107
|
-
|
|
110
|
+
sourceChanged = nextSurchargeListModuleName !== this.surchargeListModuleName || ((_params$shopId = params === null || params === void 0 ? void 0 : params.shopId) !== null && _params$shopId !== void 0 ? _params$shopId : params === null || params === void 0 ? void 0 : params.shop_id) !== ((_this$otherParams$sho = this.otherParams.shopId) !== null && _this$otherParams$sho !== void 0 ? _this$otherParams$sho : this.otherParams.shop_id) || ((_params$tenantId = params === null || params === void 0 ? void 0 : params.tenantId) !== null && _params$tenantId !== void 0 ? _params$tenantId : params === null || params === void 0 ? void 0 : params.tenant_id) !== ((_this$otherParams$ten = this.otherParams.tenantId) !== null && _this$otherParams$ten !== void 0 ? _this$otherParams$ten : this.otherParams.tenant_id);
|
|
108
111
|
this.otherParams = params || {};
|
|
109
112
|
this.surchargeListModuleName = nextSurchargeListModuleName;
|
|
110
|
-
if (
|
|
111
|
-
|
|
113
|
+
if (sourceChanged) this.surchargeLoads = new Map();
|
|
114
|
+
if (!(sourceChanged || nextChannel !== previousChannel)) {
|
|
115
|
+
_context2.next = 10;
|
|
112
116
|
break;
|
|
113
117
|
}
|
|
114
|
-
_context2.next =
|
|
118
|
+
_context2.next = 10;
|
|
115
119
|
return this.getSurchargeList(nextChannel);
|
|
116
|
-
case
|
|
120
|
+
case 10:
|
|
117
121
|
case "end":
|
|
118
122
|
return _context2.stop();
|
|
119
123
|
}
|
|
@@ -135,57 +139,91 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
135
139
|
value: function () {
|
|
136
140
|
var _getSurchargeList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
137
141
|
var channel,
|
|
138
|
-
surchargeListModule,
|
|
139
|
-
surchargeList,
|
|
140
142
|
_args3 = arguments;
|
|
141
143
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
142
144
|
while (1) switch (_context3.prev = _context3.next) {
|
|
143
145
|
case 0:
|
|
144
146
|
channel = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : this.resolveChannel();
|
|
145
|
-
_context3.
|
|
147
|
+
_context3.next = 3;
|
|
148
|
+
return this.loadSurcharges(channel);
|
|
149
|
+
case 3:
|
|
150
|
+
case "end":
|
|
151
|
+
return _context3.stop();
|
|
152
|
+
}
|
|
153
|
+
}, _callee3, this);
|
|
154
|
+
}));
|
|
155
|
+
function getSurchargeList() {
|
|
156
|
+
return _getSurchargeList.apply(this, arguments);
|
|
157
|
+
}
|
|
158
|
+
return getSurchargeList;
|
|
159
|
+
}()
|
|
160
|
+
}, {
|
|
161
|
+
key: "loadSurcharges",
|
|
162
|
+
value: function loadSurcharges(channel) {
|
|
163
|
+
var _this2 = this;
|
|
164
|
+
this.surchargeListChannel = channel;
|
|
165
|
+
var loads = this.surchargeLoads;
|
|
166
|
+
var pending = loads.get(channel);
|
|
167
|
+
if (pending) return pending;
|
|
168
|
+
|
|
169
|
+
// The core exposes the summary module while initialization is still pending.
|
|
170
|
+
// All calculations for this channel must wait for the same configuration, even when it is empty.
|
|
171
|
+
var load = this.fetchSurcharges(channel).then(function (list) {
|
|
172
|
+
loads.delete(channel);
|
|
173
|
+
if (loads === _this2.surchargeLoads && channel === _this2.surchargeListChannel) {
|
|
174
|
+
_this2.store.surchargeList = list;
|
|
175
|
+
}
|
|
176
|
+
return list;
|
|
177
|
+
});
|
|
178
|
+
loads.set(channel, load);
|
|
179
|
+
return load;
|
|
180
|
+
}
|
|
181
|
+
}, {
|
|
182
|
+
key: "fetchSurcharges",
|
|
183
|
+
value: function () {
|
|
184
|
+
var _fetchSurcharges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(channel) {
|
|
185
|
+
var surchargeListModule, surchargeList;
|
|
186
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
187
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
188
|
+
case 0:
|
|
189
|
+
_context4.prev = 0;
|
|
146
190
|
surchargeListModule = this.core.getModule(this.surchargeListModuleName);
|
|
147
191
|
if (!(surchargeListModule !== null && surchargeListModule !== void 0 && surchargeListModule.getSurchargeList)) {
|
|
148
|
-
|
|
192
|
+
_context4.next = 6;
|
|
149
193
|
break;
|
|
150
194
|
}
|
|
151
|
-
|
|
195
|
+
_context4.next = 5;
|
|
152
196
|
return surchargeListModule.getSurchargeList({
|
|
153
197
|
channel: channel
|
|
154
198
|
});
|
|
199
|
+
case 5:
|
|
200
|
+
return _context4.abrupt("return", _context4.sent);
|
|
155
201
|
case 6:
|
|
156
|
-
|
|
157
|
-
this.surchargeListChannel = channel;
|
|
158
|
-
return _context3.abrupt("return");
|
|
159
|
-
case 9:
|
|
160
|
-
_context3.next = 11;
|
|
202
|
+
_context4.next = 8;
|
|
161
203
|
return this.request.get('/order/custom-surcharge/available/v2', {
|
|
162
204
|
channel: channel,
|
|
163
205
|
is_assemble_product_data: 1,
|
|
164
206
|
is_assemble_schedule_data: 1,
|
|
165
207
|
with: ['relationSchedule']
|
|
166
208
|
});
|
|
167
|
-
case
|
|
168
|
-
surchargeList =
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
209
|
+
case 8:
|
|
210
|
+
surchargeList = _context4.sent;
|
|
211
|
+
return _context4.abrupt("return", (surchargeList === null || surchargeList === void 0 ? void 0 : surchargeList.data) || []);
|
|
212
|
+
case 12:
|
|
213
|
+
_context4.prev = 12;
|
|
214
|
+
_context4.t0 = _context4["catch"](0);
|
|
215
|
+
console.warn('[SalesSummaryModule] 加载附加费配置失败', _context4.t0);
|
|
216
|
+
return _context4.abrupt("return", []);
|
|
173
217
|
case 16:
|
|
174
|
-
_context3.prev = 16;
|
|
175
|
-
_context3.t0 = _context3["catch"](1);
|
|
176
|
-
console.warn('[SalesSummaryModule] 加载附加费配置失败', _context3.t0);
|
|
177
|
-
this.store.surchargeList = [];
|
|
178
|
-
this.surchargeListChannel = channel;
|
|
179
|
-
case 21:
|
|
180
218
|
case "end":
|
|
181
|
-
return
|
|
219
|
+
return _context4.stop();
|
|
182
220
|
}
|
|
183
|
-
},
|
|
221
|
+
}, _callee4, this, [[0, 12]]);
|
|
184
222
|
}));
|
|
185
|
-
function
|
|
186
|
-
return
|
|
223
|
+
function fetchSurcharges(_x4) {
|
|
224
|
+
return _fetchSurcharges.apply(this, arguments);
|
|
187
225
|
}
|
|
188
|
-
return
|
|
226
|
+
return fetchSurcharges;
|
|
189
227
|
}()
|
|
190
228
|
}, {
|
|
191
229
|
key: "getAppData",
|
|
@@ -211,28 +249,36 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
211
249
|
}, {
|
|
212
250
|
key: "getSummary",
|
|
213
251
|
value: function () {
|
|
214
|
-
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
215
|
-
var _this$otherParams2,
|
|
216
|
-
var _params$products, products, isPriceIncludeTax, taxRate, shopDiscount, channel, _params$virtualSettle, virtualSettlementMode, summaryChannel, taxConfig, fatherModuleName, scheduleModuleName, summarySchedule, needScheduleIds, scheduleList, scheduleById, _iterator, _step, item, summary, summaryWithTaxMeta;
|
|
217
|
-
return _regeneratorRuntime().wrap(function
|
|
218
|
-
while (1) switch (
|
|
252
|
+
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(params) {
|
|
253
|
+
var _this$otherParams2, _surchargeList$map, _ref;
|
|
254
|
+
var _params$products, products, isPriceIncludeTax, taxRate, shopDiscount, channel, _params$virtualSettle, virtualSettlementMode, summaryChannel, loads, surchargeList, taxConfig, fatherModuleName, scheduleModuleName, summarySchedule, needScheduleIds, scheduleList, scheduleById, _iterator, _step, item, summary, summaryWithTaxMeta;
|
|
255
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
256
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
219
257
|
case 0:
|
|
220
258
|
_params$products = params.products, products = _params$products === void 0 ? [] : _params$products, isPriceIncludeTax = params.isPriceIncludeTax, taxRate = params.taxRate, shopDiscount = params.shopDiscount, channel = params.channel, _params$virtualSettle = params.virtualSettlementMode, virtualSettlementMode = _params$virtualSettle === void 0 ? false : _params$virtualSettle;
|
|
221
259
|
summaryChannel = channel || this.resolveChannel();
|
|
222
|
-
|
|
223
|
-
|
|
260
|
+
loads = this.surchargeLoads;
|
|
261
|
+
if (!(loads.has(summaryChannel) || summaryChannel !== this.surchargeListChannel)) {
|
|
262
|
+
_context5.next = 9;
|
|
224
263
|
break;
|
|
225
264
|
}
|
|
226
|
-
|
|
227
|
-
return this.
|
|
228
|
-
case
|
|
265
|
+
_context5.next = 6;
|
|
266
|
+
return this.loadSurcharges(summaryChannel);
|
|
267
|
+
case 6:
|
|
268
|
+
_context5.t0 = _context5.sent;
|
|
269
|
+
_context5.next = 10;
|
|
270
|
+
break;
|
|
271
|
+
case 9:
|
|
272
|
+
_context5.t0 = this.store.surchargeList;
|
|
273
|
+
case 10:
|
|
274
|
+
surchargeList = _context5.t0;
|
|
229
275
|
taxConfig = this.getTaxConfig();
|
|
230
276
|
fatherModuleName = ((_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.fatherModule) || this.name.replace(/_salesSummary$/, '');
|
|
231
277
|
scheduleModuleName = "".concat(fatherModuleName, "_schedule");
|
|
232
278
|
summarySchedule = this.core.getModule(scheduleModuleName);
|
|
233
|
-
needScheduleIds = ((
|
|
279
|
+
needScheduleIds = ((surchargeList === null || surchargeList === void 0 || (_surchargeList$map = surchargeList.map(function (item) {
|
|
234
280
|
return item.available_schedule_ids;
|
|
235
|
-
})) === null ||
|
|
281
|
+
})) === null || _surchargeList$map === void 0 ? void 0 : _surchargeList$map.flat()) || []).filter(function (id) {
|
|
236
282
|
return id !== undefined && id !== null && id !== '';
|
|
237
283
|
});
|
|
238
284
|
scheduleList = needScheduleIds.length > 0 ? summarySchedule === null || summarySchedule === void 0 ? void 0 : summarySchedule.getScheduleListByIds(needScheduleIds) : [];
|
|
@@ -254,7 +300,7 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
254
300
|
products: products,
|
|
255
301
|
isPriceIncludeTax: (_ref = isPriceIncludeTax !== null && isPriceIncludeTax !== void 0 ? isPriceIncludeTax : taxConfig.isPriceIncludeTax) !== null && _ref !== void 0 ? _ref : 1,
|
|
256
302
|
taxRate: taxRate !== null && taxRate !== void 0 ? taxRate : taxConfig.taxRate,
|
|
257
|
-
surchargeList:
|
|
303
|
+
surchargeList: surchargeList,
|
|
258
304
|
scheduleById: scheduleById,
|
|
259
305
|
isInScheduleByDate: ScheduleModule.isInScheduleByDate,
|
|
260
306
|
shopDiscount: shopDiscount,
|
|
@@ -265,15 +311,17 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
265
311
|
tax_rate: taxRate !== null && taxRate !== void 0 ? taxRate : taxConfig.taxRate,
|
|
266
312
|
tax_country_code: taxConfig.taxCountryCode || ''
|
|
267
313
|
});
|
|
268
|
-
this.
|
|
269
|
-
|
|
270
|
-
|
|
314
|
+
if (loads === this.surchargeLoads && summaryChannel === this.surchargeListChannel) {
|
|
315
|
+
this.store.summary = summaryWithTaxMeta;
|
|
316
|
+
}
|
|
317
|
+
return _context5.abrupt("return", summaryWithTaxMeta);
|
|
318
|
+
case 23:
|
|
271
319
|
case "end":
|
|
272
|
-
return
|
|
320
|
+
return _context5.stop();
|
|
273
321
|
}
|
|
274
|
-
},
|
|
322
|
+
}, _callee5, this);
|
|
275
323
|
}));
|
|
276
|
-
function getSummary(
|
|
324
|
+
function getSummary(_x5) {
|
|
277
325
|
return _getSummary.apply(this, arguments);
|
|
278
326
|
}
|
|
279
327
|
return getSummary;
|
package/dist/server/index.d.ts
CHANGED
|
@@ -66,6 +66,7 @@ declare class Server {
|
|
|
66
66
|
private localPaymentUpdateQueues;
|
|
67
67
|
private paymentIdentityRefreshes;
|
|
68
68
|
private receiptFulfillmentConfigInFlight;
|
|
69
|
+
private cloudInvoiceSubmissions;
|
|
69
70
|
private floorPlanQuerySubscribers;
|
|
70
71
|
private moduleRegistry;
|
|
71
72
|
constructor(core: PisellCore);
|
|
@@ -547,8 +548,14 @@ declare class Server {
|
|
|
547
548
|
private shouldLookupLocalPrintOrder;
|
|
548
549
|
private getLocalPrintOrderLookup;
|
|
549
550
|
private mergeLocalPrintOrderInput;
|
|
551
|
+
private getCloudInvoiceDevice;
|
|
552
|
+
private assertCloudInvoiceContext;
|
|
553
|
+
private loadCloudInvoiceOrder;
|
|
554
|
+
private resolveCloudOrderInvoice;
|
|
555
|
+
private handleCloudOrderInvoice;
|
|
550
556
|
private handleLocalPrintOrder;
|
|
551
557
|
private normalizeRequestedReceiptLocales;
|
|
558
|
+
private rebuildOrderReceipt;
|
|
552
559
|
private handleLocalOrderReceiptSnapshot;
|
|
553
560
|
private handleMachinecodeBatchMeta;
|
|
554
561
|
private resolveMachinecodeBatchMetadataLookup;
|