@pisell/pisellos 2.2.206 → 2.2.208
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/server/index.d.ts +1 -1
- package/dist/server/index.js +359 -320
- package/dist/solution/BookingTicket/index.d.ts +1 -0
- package/dist/solution/BookingTicket/index.js +326 -287
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/server/index.d.ts +1 -1
- package/lib/server/index.js +14 -4
- package/lib/solution/BookingTicket/index.d.ts +1 -0
- package/lib/solution/BookingTicket/index.js +12 -1
- package/package.json +1 -1
|
@@ -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
|
-
});
|
package/lib/server/index.d.ts
CHANGED
|
@@ -381,7 +381,7 @@ declare class Server {
|
|
|
381
381
|
private taskOk;
|
|
382
382
|
private taskFail;
|
|
383
383
|
private taskTimeout;
|
|
384
|
-
private
|
|
384
|
+
private getShortNumberOrDeviceId;
|
|
385
385
|
private buildCheckoutTaskIdempotencyKey;
|
|
386
386
|
private ensureCheckoutOrderNumbers;
|
|
387
387
|
private dispatchCheckoutSyncTask;
|
package/lib/server/index.js
CHANGED
|
@@ -2170,7 +2170,7 @@ var Server = class {
|
|
|
2170
2170
|
}
|
|
2171
2171
|
getAppData(key) {
|
|
2172
2172
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
2173
|
-
const getData = (_b = (_a = this.app) == null ? void 0 : _a.getData) == null ? void 0 : _b.call(_a);
|
|
2173
|
+
const getData = (_b = (_a = this.core.getPlugin("app")) == null ? void 0 : _a.getData) == null ? void 0 : _b.call(_a);
|
|
2174
2174
|
if (typeof getData === "function")
|
|
2175
2175
|
return getData(key);
|
|
2176
2176
|
const directValue = (_d = (_c = this.app) == null ? void 0 : _c.getData) == null ? void 0 : _d.call(_c, key);
|
|
@@ -2181,6 +2181,7 @@ var Server = class {
|
|
|
2181
2181
|
}
|
|
2182
2182
|
getSmallTicketShopInfo() {
|
|
2183
2183
|
const shopInfo = this.getAppData("shop_info") || {};
|
|
2184
|
+
debugger;
|
|
2184
2185
|
return {
|
|
2185
2186
|
...shopInfo,
|
|
2186
2187
|
currency_symbol: shopInfo.currency_symbol || this.getAppData("shop_symbol") || this.getAppData("currency_symbol"),
|
|
@@ -2206,7 +2207,15 @@ var Server = class {
|
|
|
2206
2207
|
error: { code: "TIMEOUT", message }
|
|
2207
2208
|
};
|
|
2208
2209
|
}
|
|
2209
|
-
|
|
2210
|
+
async getShortNumberOrDeviceId() {
|
|
2211
|
+
debugger;
|
|
2212
|
+
const getAsyncIotDeviceInfo = this.getAppData("async_iot_device_info");
|
|
2213
|
+
if (getAsyncIotDeviceInfo) {
|
|
2214
|
+
const res = await (getAsyncIotDeviceInfo == null ? void 0 : getAsyncIotDeviceInfo());
|
|
2215
|
+
if (res.short_number) {
|
|
2216
|
+
return res.short_number;
|
|
2217
|
+
}
|
|
2218
|
+
}
|
|
2210
2219
|
return this.getAppData("device_id") || 0;
|
|
2211
2220
|
}
|
|
2212
2221
|
buildCheckoutTaskIdempotencyKey(data) {
|
|
@@ -2257,7 +2266,7 @@ var Server = class {
|
|
|
2257
2266
|
var _a, _b, _c;
|
|
2258
2267
|
this.registerDeviceTaskActions();
|
|
2259
2268
|
const deviceTask = this.getDeviceTaskPlugin();
|
|
2260
|
-
const debugDeviceId = this.
|
|
2269
|
+
const debugDeviceId = await this.getShortNumberOrDeviceId();
|
|
2261
2270
|
const debugIdempotencyKey = this.buildCheckoutTaskIdempotencyKey(params.data);
|
|
2262
2271
|
if (!(deviceTask == null ? void 0 : deviceTask.dispatch)) {
|
|
2263
2272
|
this.logError(`${params.title}: deviceTask.dispatch 不可用`);
|
|
@@ -2299,9 +2308,10 @@ var Server = class {
|
|
|
2299
2308
|
}
|
|
2300
2309
|
try {
|
|
2301
2310
|
const printIdentity = this.getPrintOrderIdentity(params.syncedOrder);
|
|
2311
|
+
const deviceId = await this.getShortNumberOrDeviceId();
|
|
2302
2312
|
await deviceTask.dispatch({
|
|
2303
2313
|
action: "print_all",
|
|
2304
|
-
device_id: params.deviceId ??
|
|
2314
|
+
device_id: params.deviceId ?? deviceId,
|
|
2305
2315
|
payload: {
|
|
2306
2316
|
type: params.receiptOnly ? "0" : "99",
|
|
2307
2317
|
data: params.receiptOnly ? {
|
|
@@ -43,6 +43,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
43
43
|
private getBookingTicketBusinessCode;
|
|
44
44
|
private getIdGeneratorPlugin;
|
|
45
45
|
private loadOpenDataConfig;
|
|
46
|
+
private getShortNumberOrDeviceId;
|
|
46
47
|
private configureIdGeneratorFromOpenData;
|
|
47
48
|
private normalizePositiveInteger;
|
|
48
49
|
private normalizeIdPrefix;
|
|
@@ -160,6 +160,16 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
160
160
|
this.loadOpenDataConfigInFlight = null;
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
|
+
async getShortNumberOrDeviceId() {
|
|
164
|
+
const getAsyncIotDeviceInfo = this.getAppData("async_iot_device_info");
|
|
165
|
+
if (getAsyncIotDeviceInfo) {
|
|
166
|
+
const res = await (getAsyncIotDeviceInfo == null ? void 0 : getAsyncIotDeviceInfo());
|
|
167
|
+
if (res.short_number) {
|
|
168
|
+
return res.short_number;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return this.getAppData("device_id") || 0;
|
|
172
|
+
}
|
|
163
173
|
async configureIdGeneratorFromOpenData() {
|
|
164
174
|
let openDataConfig = null;
|
|
165
175
|
try {
|
|
@@ -189,12 +199,13 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
189
199
|
);
|
|
190
200
|
const resetReceiptSequenceDaily = typeof openDataConfig["sale.short_number_daily_reset"] === "boolean" ? openDataConfig["sale.short_number_daily_reset"] : true;
|
|
191
201
|
const operatingDayBoundary = this.getAppData("operating_day_boundary");
|
|
202
|
+
const deviceId = await this.getShortNumberOrDeviceId();
|
|
192
203
|
try {
|
|
193
204
|
await idGenerator.configure({
|
|
194
205
|
biz: "ticket",
|
|
195
206
|
config: {
|
|
196
207
|
prefix,
|
|
197
|
-
deviceCode:
|
|
208
|
+
deviceCode: deviceId,
|
|
198
209
|
// TODO 现在 picoding 没这个配置的 key
|
|
199
210
|
padReceiptSequence: true,
|
|
200
211
|
receiptSequenceLength,
|