@pisell/pisellos 2.1.149 → 2.1.151
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/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/model/strategy/adapter/promotion/evaluator.js +99 -26
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +2 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.js +61 -8
- package/dist/model/strategy/adapter/walletPass/locales.js +12 -3
- package/dist/model/strategy/engine.d.ts +18 -5
- package/dist/model/strategy/engine.js +145 -45
- package/dist/model/strategy/type.d.ts +17 -0
- package/dist/model/strategy/type.js +4 -0
- package/dist/modules/Cart/types.d.ts +2 -0
- package/dist/modules/Cart/utils/cartProduct.js +56 -25
- package/dist/modules/Discount/types.d.ts +19 -1
- package/dist/modules/Order/index.d.ts +1 -65
- package/dist/modules/Order/index.js +30 -899
- package/dist/modules/Order/types.d.ts +12 -174
- package/dist/modules/Order/types.js +0 -2
- package/dist/modules/Order/utils.d.ts +0 -118
- package/dist/modules/Order/utils.js +2 -586
- package/dist/modules/Payment/index.d.ts +2 -1
- package/dist/modules/Payment/index.js +10 -7
- package/dist/modules/Payment/utils.js +3 -0
- package/dist/modules/Payment/walletpass.d.ts +23 -0
- package/dist/modules/Payment/walletpass.js +191 -95
- package/dist/modules/Product/utils.js +2 -2
- package/dist/modules/ProductList/index.d.ts +1 -1
- package/dist/modules/ProductList/index.js +3 -4
- package/dist/modules/Rules/index.d.ts +9 -5
- package/dist/modules/Rules/index.js +677 -168
- package/dist/modules/Rules/types.d.ts +2 -0
- package/dist/modules/Schedule/getDateIsInSchedule.js +18 -11
- package/dist/modules/Schedule/utils.d.ts +1 -1
- package/dist/modules/Summary/types.d.ts +2 -0
- package/dist/modules/Summary/utils.d.ts +9 -3
- package/dist/modules/Summary/utils.js +52 -41
- package/dist/modules/index.d.ts +0 -4
- package/dist/modules/index.js +1 -5
- package/dist/plugins/window.d.ts +2 -0
- package/dist/solution/BookingByStep/index.d.ts +3 -2
- package/dist/solution/BookingByStep/index.js +43 -46
- package/dist/solution/BookingByStep/types.d.ts +1 -3
- package/dist/solution/BookingByStep/types.js +1 -5
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +1 -3
- package/dist/solution/BookingByStep/utils/timeslots.js +12 -19
- package/dist/solution/Checkout/index.js +2 -0
- package/dist/solution/ShopDiscount/index.d.ts +1 -0
- package/dist/solution/ShopDiscount/index.js +23 -7
- package/dist/solution/ShopDiscount/types.d.ts +1 -0
- package/dist/solution/ShopDiscount/types.js +2 -1
- package/dist/solution/ShopDiscount/utils.js +26 -12
- package/dist/solution/index.d.ts +0 -2
- package/dist/solution/index.js +1 -3
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -1
- package/lib/model/strategy/adapter/promotion/evaluator.js +57 -8
- package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +2 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.js +34 -3
- package/lib/model/strategy/adapter/walletPass/locales.js +12 -3
- package/lib/model/strategy/engine.d.ts +18 -5
- package/lib/model/strategy/engine.js +85 -21
- package/lib/model/strategy/type.d.ts +17 -0
- package/lib/modules/Cart/types.d.ts +2 -0
- package/lib/modules/Cart/utils/cartProduct.js +39 -12
- package/lib/modules/Discount/types.d.ts +19 -1
- package/lib/modules/Order/index.d.ts +1 -65
- package/lib/modules/Order/index.js +1 -513
- package/lib/modules/Order/types.d.ts +12 -174
- package/lib/modules/Order/utils.d.ts +0 -118
- package/lib/modules/Order/utils.js +2 -483
- package/lib/modules/Payment/index.d.ts +2 -1
- package/lib/modules/Payment/index.js +1 -0
- package/lib/modules/Payment/utils.js +3 -0
- package/lib/modules/Payment/walletpass.d.ts +23 -0
- package/lib/modules/Payment/walletpass.js +94 -17
- package/lib/modules/Product/utils.js +2 -2
- package/lib/modules/ProductList/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +3 -5
- package/lib/modules/Rules/index.d.ts +9 -5
- package/lib/modules/Rules/index.js +780 -288
- package/lib/modules/Rules/types.d.ts +2 -0
- package/lib/modules/Schedule/getDateIsInSchedule.js +11 -9
- package/lib/modules/Schedule/utils.d.ts +1 -1
- package/lib/modules/Summary/types.d.ts +2 -0
- package/lib/modules/Summary/utils.d.ts +9 -3
- package/lib/modules/Summary/utils.js +31 -22
- package/lib/modules/index.d.ts +0 -4
- package/lib/modules/index.js +1 -9
- package/lib/plugins/window.d.ts +2 -0
- package/lib/solution/BookingByStep/index.d.ts +3 -2
- package/lib/solution/BookingByStep/index.js +4 -6
- package/lib/solution/BookingByStep/types.d.ts +1 -3
- package/lib/solution/BookingByStep/types.js +0 -10
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +1 -3
- package/lib/solution/BookingByStep/utils/timeslots.js +11 -19
- package/lib/solution/Checkout/index.js +2 -0
- package/lib/solution/ShopDiscount/index.d.ts +1 -0
- package/lib/solution/ShopDiscount/index.js +22 -8
- package/lib/solution/ShopDiscount/types.d.ts +1 -0
- package/lib/solution/ShopDiscount/utils.js +10 -6
- package/lib/solution/index.d.ts +0 -2
- package/lib/solution/index.js +1 -5
- package/package.json +1 -1
- package/dist/apis/picoding.d.ts +0 -0
- package/dist/apis/picoding.js +0 -1
- package/dist/modules/OpenData/index.d.ts +0 -24
- package/dist/modules/OpenData/index.js +0 -173
- package/dist/modules/OpenData/types.d.ts +0 -73
- package/dist/modules/OpenData/types.js +0 -1
- package/dist/modules/OpenData/utils.d.ts +0 -2
- package/dist/modules/OpenData/utils.js +0 -75
- package/dist/modules/Quotation/index.d.ts +0 -48
- package/dist/modules/Quotation/index.js +0 -248
- package/dist/modules/Quotation/types.d.ts +0 -42
- package/dist/modules/Quotation/types.js +0 -1
- package/dist/modules/SalesSummary/index.d.ts +0 -63
- package/dist/modules/SalesSummary/index.js +0 -174
- package/dist/modules/SalesSummary/types.d.ts +0 -60
- package/dist/modules/SalesSummary/types.js +0 -1
- package/dist/modules/SalesSummary/utils.d.ts +0 -30
- package/dist/modules/SalesSummary/utils.js +0 -480
- package/dist/modules/ScanOrderLogger/index.d.ts +0 -23
- package/dist/modules/ScanOrderLogger/index.js +0 -174
- package/dist/modules/ScanOrderLogger/providers/feishu.d.ts +0 -2
- package/dist/modules/ScanOrderLogger/providers/feishu.js +0 -221
- package/dist/modules/ScanOrderLogger/providers/grafana.d.ts +0 -2
- package/dist/modules/ScanOrderLogger/providers/grafana.js +0 -50
- package/dist/modules/ScanOrderLogger/types.d.ts +0 -53
- package/dist/modules/ScanOrderLogger/types.js +0 -1
- package/dist/solution/ScanOrder/index.d.ts +0 -152
- package/dist/solution/ScanOrder/index.js +0 -3132
- package/dist/solution/ScanOrder/types.d.ts +0 -287
- package/dist/solution/ScanOrder/types.js +0 -35
- package/dist/solution/ScanOrder/utils.d.ts +0 -167
- package/dist/solution/ScanOrder/utils.js +0 -764
- package/dist/solution/VenueBooking/index.d.ts +0 -199
- package/dist/solution/VenueBooking/index.js +0 -3459
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +0 -343
- package/dist/solution/VenueBooking/types.d.ts +0 -154
- package/dist/solution/VenueBooking/types.js +0 -21
- package/dist/solution/VenueBooking/utils/dateSummary.d.ts +0 -11
- package/dist/solution/VenueBooking/utils/dateSummary.js +0 -104
- package/dist/solution/VenueBooking/utils/resource.d.ts +0 -14
- package/dist/solution/VenueBooking/utils/resource.js +0 -131
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +0 -38
- package/dist/solution/VenueBooking/utils/slotMerge.js +0 -239
- package/dist/solution/VenueBooking/utils/timeSlot.d.ts +0 -32
- package/dist/solution/VenueBooking/utils/timeSlot.js +0 -453
- package/dist/solution/VenueBooking/utils.d.ts +0 -1
- package/dist/solution/VenueBooking/utils.js +0 -1
- package/lib/apis/picoding.d.ts +0 -0
- package/lib/apis/picoding.js +0 -0
- package/lib/modules/OpenData/index.d.ts +0 -24
- package/lib/modules/OpenData/index.js +0 -119
- package/lib/modules/OpenData/types.d.ts +0 -73
- package/lib/modules/OpenData/types.js +0 -17
- package/lib/modules/OpenData/utils.d.ts +0 -2
- package/lib/modules/OpenData/utils.js +0 -111
- package/lib/modules/Quotation/index.d.ts +0 -48
- package/lib/modules/Quotation/index.js +0 -152
- package/lib/modules/Quotation/types.d.ts +0 -42
- package/lib/modules/Quotation/types.js +0 -17
- package/lib/modules/SalesSummary/index.d.ts +0 -63
- package/lib/modules/SalesSummary/index.js +0 -105
- package/lib/modules/SalesSummary/types.d.ts +0 -60
- package/lib/modules/SalesSummary/types.js +0 -17
- package/lib/modules/SalesSummary/utils.d.ts +0 -30
- package/lib/modules/SalesSummary/utils.js +0 -420
- package/lib/modules/ScanOrderLogger/index.d.ts +0 -23
- package/lib/modules/ScanOrderLogger/index.js +0 -147
- package/lib/modules/ScanOrderLogger/providers/feishu.d.ts +0 -2
- package/lib/modules/ScanOrderLogger/providers/feishu.js +0 -157
- package/lib/modules/ScanOrderLogger/providers/grafana.d.ts +0 -2
- package/lib/modules/ScanOrderLogger/providers/grafana.js +0 -52
- package/lib/modules/ScanOrderLogger/types.d.ts +0 -53
- package/lib/modules/ScanOrderLogger/types.js +0 -17
- package/lib/solution/ScanOrder/index.d.ts +0 -152
- package/lib/solution/ScanOrder/index.js +0 -1901
- package/lib/solution/ScanOrder/types.d.ts +0 -287
- package/lib/solution/ScanOrder/types.js +0 -36
- package/lib/solution/ScanOrder/utils.d.ts +0 -167
- package/lib/solution/ScanOrder/utils.js +0 -635
- package/lib/solution/VenueBooking/index.d.ts +0 -199
- package/lib/solution/VenueBooking/index.js +0 -1926
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -343
- package/lib/solution/VenueBooking/types.d.ts +0 -154
- package/lib/solution/VenueBooking/types.js +0 -44
- package/lib/solution/VenueBooking/utils/dateSummary.d.ts +0 -11
- package/lib/solution/VenueBooking/utils/dateSummary.js +0 -110
- package/lib/solution/VenueBooking/utils/resource.d.ts +0 -14
- package/lib/solution/VenueBooking/utils/resource.js +0 -92
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +0 -38
- package/lib/solution/VenueBooking/utils/slotMerge.js +0 -237
- package/lib/solution/VenueBooking/utils/timeSlot.d.ts +0 -32
- package/lib/solution/VenueBooking/utils/timeSlot.js +0 -339
- package/lib/solution/VenueBooking/utils.d.ts +0 -1
- package/lib/solution/VenueBooking/utils.js +0 -69
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// src/modules/ScanOrderLogger/providers/feishu.ts
|
|
20
|
-
var feishu_exports = {};
|
|
21
|
-
__export(feishu_exports, {
|
|
22
|
-
feishuLoggerProvider: () => feishuLoggerProvider
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(feishu_exports);
|
|
25
|
-
var DEFAULT_THROTTLE_MS = 3e3;
|
|
26
|
-
var pendingQueue = [];
|
|
27
|
-
var flushTimer = null;
|
|
28
|
-
var cachedProviderConfig;
|
|
29
|
-
function safeStringify(value) {
|
|
30
|
-
if (value === void 0 || value === null)
|
|
31
|
-
return "";
|
|
32
|
-
if (typeof value === "string")
|
|
33
|
-
return value;
|
|
34
|
-
if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") {
|
|
35
|
-
return String(value);
|
|
36
|
-
}
|
|
37
|
-
try {
|
|
38
|
-
return JSON.stringify(value);
|
|
39
|
-
} catch (error) {
|
|
40
|
-
return `[unserializable: ${String(error)}]`;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
function isWebhookUsable(webhook) {
|
|
44
|
-
if (!webhook)
|
|
45
|
-
return false;
|
|
46
|
-
if (webhook.includes("REPLACE_ME"))
|
|
47
|
-
return false;
|
|
48
|
-
return true;
|
|
49
|
-
}
|
|
50
|
-
function buildRecordSegments(record) {
|
|
51
|
-
const context = record.context || {};
|
|
52
|
-
return [
|
|
53
|
-
[{ tag: "text", text: `[${record.level}] ${record.timestamp} ${record.title}
|
|
54
|
-
` }],
|
|
55
|
-
[{ tag: "text", text: `缓存标识: ${safeStringify(context.cacheId)}
|
|
56
|
-
` }],
|
|
57
|
-
[{ tag: "text", text: `日志来源: ${safeStringify(context)}
|
|
58
|
-
` }],
|
|
59
|
-
[{ tag: "text", text: `日志内容: ${safeStringify(record.payload)}
|
|
60
|
-
` }],
|
|
61
|
-
[{ tag: "text", text: `扩展信息: ${safeStringify(record.extra)}
|
|
62
|
-
` }],
|
|
63
|
-
[{ tag: "text", text: "------\n" }]
|
|
64
|
-
];
|
|
65
|
-
}
|
|
66
|
-
function buildFeishuBody(records) {
|
|
67
|
-
const title = records.length === 1 ? records[0].title : `ScanOrder 日志批量 (${records.length} 条)`;
|
|
68
|
-
const content = [];
|
|
69
|
-
records.forEach((record) => {
|
|
70
|
-
buildRecordSegments(record).forEach((segment) => content.push(segment));
|
|
71
|
-
});
|
|
72
|
-
return JSON.stringify({
|
|
73
|
-
msg_type: "post",
|
|
74
|
-
content: JSON.stringify({
|
|
75
|
-
post: {
|
|
76
|
-
zh_cn: {
|
|
77
|
-
title,
|
|
78
|
-
content
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
})
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
async function postToFeishu(webhook, body) {
|
|
85
|
-
await fetch(webhook, {
|
|
86
|
-
method: "POST",
|
|
87
|
-
headers: {
|
|
88
|
-
"Content-Type": "application/json"
|
|
89
|
-
},
|
|
90
|
-
body
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
async function flushQueue() {
|
|
94
|
-
var _a;
|
|
95
|
-
flushTimer = null;
|
|
96
|
-
if (!pendingQueue.length)
|
|
97
|
-
return;
|
|
98
|
-
const records = pendingQueue.splice(0, pendingQueue.length);
|
|
99
|
-
const webhook = (_a = cachedProviderConfig == null ? void 0 : cachedProviderConfig.feishu) == null ? void 0 : _a.webhook;
|
|
100
|
-
if (!isWebhookUsable(webhook)) {
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
if (typeof fetch !== "function") {
|
|
104
|
-
console.warn("[ScanOrderLogger] 当前环境不支持 fetch,跳过 Feishu 日志批量上报");
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
try {
|
|
108
|
-
await postToFeishu(webhook, buildFeishuBody(records));
|
|
109
|
-
} catch (error) {
|
|
110
|
-
console.warn("[ScanOrderLogger] Feishu 批量上报失败", error);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
var feishuLoggerProvider = {
|
|
114
|
-
async send(payload) {
|
|
115
|
-
var _a, _b, _c, _d, _e, _f;
|
|
116
|
-
cachedProviderConfig = payload.providerConfig;
|
|
117
|
-
const webhook = (_b = (_a = payload.providerConfig) == null ? void 0 : _a.feishu) == null ? void 0 : _b.webhook;
|
|
118
|
-
const errorHook = (_d = (_c = payload.providerConfig) == null ? void 0 : _c.feishu) == null ? void 0 : _d.errorHook;
|
|
119
|
-
if (typeof fetch !== "function") {
|
|
120
|
-
console.warn("[ScanOrderLogger] 当前环境不支持 fetch,跳过 Feishu 日志上报");
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
if (payload.record.level === "error" && isWebhookUsable(errorHook)) {
|
|
124
|
-
try {
|
|
125
|
-
await postToFeishu(errorHook, buildFeishuBody([payload.record]));
|
|
126
|
-
} catch (error) {
|
|
127
|
-
console.warn("[ScanOrderLogger] Feishu errorHook 上报失败", error);
|
|
128
|
-
}
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
if (!webhook) {
|
|
132
|
-
console.warn("[ScanOrderLogger] Feishu webhook 未配置,跳过日志上报");
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
if (!isWebhookUsable(webhook))
|
|
136
|
-
return;
|
|
137
|
-
const throttleMs = ((_f = (_e = payload.providerConfig) == null ? void 0 : _e.feishu) == null ? void 0 : _f.throttleMs) ?? DEFAULT_THROTTLE_MS;
|
|
138
|
-
if (throttleMs <= 0) {
|
|
139
|
-
try {
|
|
140
|
-
await postToFeishu(webhook, buildFeishuBody([payload.record]));
|
|
141
|
-
} catch (error) {
|
|
142
|
-
console.warn("[ScanOrderLogger] Feishu 日志上报失败", error);
|
|
143
|
-
}
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
pendingQueue.push(payload.record);
|
|
147
|
-
if (!flushTimer) {
|
|
148
|
-
flushTimer = setTimeout(() => {
|
|
149
|
-
void flushQueue();
|
|
150
|
-
}, throttleMs);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
155
|
-
0 && (module.exports = {
|
|
156
|
-
feishuLoggerProvider
|
|
157
|
-
});
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// src/modules/ScanOrderLogger/providers/grafana.ts
|
|
20
|
-
var grafana_exports = {};
|
|
21
|
-
__export(grafana_exports, {
|
|
22
|
-
grafanaLoggerProvider: () => grafanaLoggerProvider
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(grafana_exports);
|
|
25
|
-
var grafanaLoggerProvider = {
|
|
26
|
-
async send(payload) {
|
|
27
|
-
var _a, _b, _c, _d;
|
|
28
|
-
const endpoint = (_b = (_a = payload.providerConfig) == null ? void 0 : _a.grafana) == null ? void 0 : _b.endpoint;
|
|
29
|
-
if (!endpoint) {
|
|
30
|
-
console.warn("[ScanOrderLogger] Grafana endpoint 未配置,跳过日志上报");
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
if (typeof fetch !== "function") {
|
|
34
|
-
console.warn("[ScanOrderLogger] 当前环境不支持 fetch,跳过 Grafana 日志上报");
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
await fetch(endpoint, {
|
|
38
|
-
method: "POST",
|
|
39
|
-
headers: {
|
|
40
|
-
"Content-Type": "application/json",
|
|
41
|
-
...((_d = (_c = payload.providerConfig) == null ? void 0 : _c.grafana) == null ? void 0 : _d.headers) || {}
|
|
42
|
-
},
|
|
43
|
-
body: JSON.stringify({
|
|
44
|
-
record: payload.record
|
|
45
|
-
})
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
50
|
-
0 && (module.exports = {
|
|
51
|
-
grafanaLoggerProvider
|
|
52
|
-
});
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
export type ScanOrderLogLevel = 'info' | 'warning' | 'error' | 'debug';
|
|
2
|
-
export type ScanOrderLoggerProviderType = 'feishu' | 'grafana';
|
|
3
|
-
export interface ScanOrderLoggerProviderFeishuConfig {
|
|
4
|
-
webhook?: string;
|
|
5
|
-
errorHook?: string;
|
|
6
|
-
/**
|
|
7
|
-
* 节流窗口毫秒数,默认 3000ms
|
|
8
|
-
* - >0:首条日志进入队列并启动定时器,窗口结束后合并成一条 Feishu post 统一发送
|
|
9
|
-
* - <=0:关闭节流,保持每条日志立即单独发送
|
|
10
|
-
*/
|
|
11
|
-
throttleMs?: number;
|
|
12
|
-
}
|
|
13
|
-
export interface ScanOrderLoggerProviderGrafanaConfig {
|
|
14
|
-
endpoint?: string;
|
|
15
|
-
headers?: Record<string, string>;
|
|
16
|
-
}
|
|
17
|
-
export interface ScanOrderLoggerProviderConfig {
|
|
18
|
-
feishu?: ScanOrderLoggerProviderFeishuConfig;
|
|
19
|
-
grafana?: ScanOrderLoggerProviderGrafanaConfig;
|
|
20
|
-
}
|
|
21
|
-
export interface ScanOrderLoggerContext {
|
|
22
|
-
cacheId?: string;
|
|
23
|
-
solutionName?: string;
|
|
24
|
-
moduleName?: string;
|
|
25
|
-
[key: string]: any;
|
|
26
|
-
}
|
|
27
|
-
export interface ScanOrderLogInput {
|
|
28
|
-
level?: ScanOrderLogLevel;
|
|
29
|
-
title: string;
|
|
30
|
-
payload?: Record<string, any>;
|
|
31
|
-
extra?: Record<string, any>;
|
|
32
|
-
timestamp?: string;
|
|
33
|
-
}
|
|
34
|
-
export interface ScanOrderLogRecord {
|
|
35
|
-
level: ScanOrderLogLevel;
|
|
36
|
-
title: string;
|
|
37
|
-
timestamp: string;
|
|
38
|
-
payload: Record<string, any>;
|
|
39
|
-
extra: Record<string, any>;
|
|
40
|
-
context: ScanOrderLoggerContext;
|
|
41
|
-
}
|
|
42
|
-
export interface ScanOrderLoggerDispatchPayload {
|
|
43
|
-
record: ScanOrderLogRecord;
|
|
44
|
-
providerConfig?: ScanOrderLoggerProviderConfig;
|
|
45
|
-
}
|
|
46
|
-
export interface ScanOrderLoggerProvider {
|
|
47
|
-
send: (payload: ScanOrderLoggerDispatchPayload) => Promise<void>;
|
|
48
|
-
}
|
|
49
|
-
export interface ScanOrderLoggerState {
|
|
50
|
-
provider: ScanOrderLoggerProviderType;
|
|
51
|
-
providerConfig: ScanOrderLoggerProviderConfig;
|
|
52
|
-
context: ScanOrderLoggerContext;
|
|
53
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
-
}
|
|
11
|
-
return to;
|
|
12
|
-
};
|
|
13
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
-
|
|
15
|
-
// src/modules/ScanOrderLogger/types.ts
|
|
16
|
-
var types_exports = {};
|
|
17
|
-
module.exports = __toCommonJS(types_exports);
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import { Module, ModuleOptions, PisellCore } from '../../types';
|
|
2
|
-
import { BaseModule } from '../../modules/BaseModule';
|
|
3
|
-
import { ScanOrderAddLogParams, ScanOrderAvailabilityInfo, ScanOrderOrderProduct, ScanOrderOrderProductIdentity, ScanOrderScanCodeResult } from './types';
|
|
4
|
-
import type { UpdateProductInOrderParams } from '../../modules/Order/types';
|
|
5
|
-
import type { Discount } from '../../modules/Discount/types';
|
|
6
|
-
import { type CartItemSummary, type PaxInfo, type QuantityCheckResult, type QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
|
|
7
|
-
import type { StrategyConfig } from '../../model/strategy/type';
|
|
8
|
-
import type { ProductData } from '../../modules/Product/types';
|
|
9
|
-
export * from './types';
|
|
10
|
-
interface ScanOrderItemRuleRuntimeConfig {
|
|
11
|
-
strategyConfigs?: StrategyConfig[];
|
|
12
|
-
pax?: Partial<PaxInfo>;
|
|
13
|
-
historicalItems?: CartItemSummary[];
|
|
14
|
-
serviceType?: string;
|
|
15
|
-
submissionIndex?: number;
|
|
16
|
-
custom?: Record<string, any>;
|
|
17
|
-
}
|
|
18
|
-
export declare class ScanOrderImpl extends BaseModule implements Module {
|
|
19
|
-
protected defaultName: string;
|
|
20
|
-
protected defaultVersion: string;
|
|
21
|
-
isSolution: boolean;
|
|
22
|
-
private initializeOptions;
|
|
23
|
-
private store;
|
|
24
|
-
private otherParams;
|
|
25
|
-
private cacheId;
|
|
26
|
-
private window;
|
|
27
|
-
private request;
|
|
28
|
-
private itemRuleEvaluator;
|
|
29
|
-
private itemRuleConfigs;
|
|
30
|
-
private itemRuleConfigsPromise;
|
|
31
|
-
private itemRulePrefillApplied;
|
|
32
|
-
private itemRuleRuntimeConfig;
|
|
33
|
-
/** 最近一次 checkResourceAvailable 从预约规则 link 拉取的商品快照 */
|
|
34
|
-
private enabledReservationRuleProducts;
|
|
35
|
-
private loginEffectDisposers;
|
|
36
|
-
private customerLoginRefreshInFlight;
|
|
37
|
-
private customerLoginRefreshIdInFlight;
|
|
38
|
-
private static readonly PISELL1_LOGIN_SUCCESS;
|
|
39
|
-
private getScanOrderLoggerContext;
|
|
40
|
-
private safeStringify;
|
|
41
|
-
private pickErrorMessage;
|
|
42
|
-
private serializeError;
|
|
43
|
-
private addScanOrderLog;
|
|
44
|
-
private logMethodStart;
|
|
45
|
-
private logMethodSuccess;
|
|
46
|
-
private logMethodError;
|
|
47
|
-
private assertProductListLoaded;
|
|
48
|
-
addLog(params: ScanOrderAddLogParams): Promise<void>;
|
|
49
|
-
private normalizeCustomerId;
|
|
50
|
-
private resolveCustomerIdFromLoginPayload;
|
|
51
|
-
private clearLoginEffectListeners;
|
|
52
|
-
private registerLoginEffect;
|
|
53
|
-
private registerCustomerLoginListeners;
|
|
54
|
-
private refreshOrderMarketingAfterLogin;
|
|
55
|
-
constructor(name?: string, version?: string);
|
|
56
|
-
/** 与 `otherParams.cacheId` 一致,供宿主在 URL 变化时判断是否需要重新注册模块 */
|
|
57
|
-
getCacheId(): string | undefined;
|
|
58
|
-
private destroyRegisteredChildModules;
|
|
59
|
-
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
60
|
-
destroy(): Promise<void>;
|
|
61
|
-
retryInit(): Promise<void>;
|
|
62
|
-
refresh(): Promise<void>;
|
|
63
|
-
getStatus(): import("./types").ScanOrderStatus;
|
|
64
|
-
getEntryContext(): import("./types").ScanOrderEntryContext | null;
|
|
65
|
-
getConfig(): Record<string, any>;
|
|
66
|
-
getItemRuleQuantityLimits(): QuantityLimitResult[];
|
|
67
|
-
getCartValidationPassed(): boolean | null;
|
|
68
|
-
getCartValidation(): {
|
|
69
|
-
passed: boolean | null;
|
|
70
|
-
failures: QuantityCheckResult[];
|
|
71
|
-
};
|
|
72
|
-
getTempOrder(): import("./types").ScanOrderTempOrder | null;
|
|
73
|
-
updateTempOrderNote(note: string): string;
|
|
74
|
-
setPickupReferenceMode(mode: 'counter_pickup' | 'table_service'): {
|
|
75
|
-
service_type: 'dine_in';
|
|
76
|
-
pickup_reference_mode: 'counter_pickup' | 'table_service';
|
|
77
|
-
};
|
|
78
|
-
setPickupRef(buzzer: string): string;
|
|
79
|
-
private ensureTempOrder;
|
|
80
|
-
addNewOrder(): Promise<import("./types").ScanOrderTempOrder>;
|
|
81
|
-
restoreOrder(): Promise<import("./types").ScanOrderTempOrder>;
|
|
82
|
-
getOrderProducts(): ScanOrderOrderProduct[];
|
|
83
|
-
getSummary(): Promise<import("./types").ScanOrderSummary>;
|
|
84
|
-
getDiscountList(): Discount[];
|
|
85
|
-
scanCode(code: string, customerId?: number): Promise<ScanOrderScanCodeResult>;
|
|
86
|
-
setDiscountSelected(params: {
|
|
87
|
-
discountId: number;
|
|
88
|
-
isSelected: boolean;
|
|
89
|
-
}): Promise<void>;
|
|
90
|
-
onCustomerLogin(params: {
|
|
91
|
-
customerId: number;
|
|
92
|
-
}): Promise<void>;
|
|
93
|
-
private findReservationRuleResource;
|
|
94
|
-
private buildScanOrderResourceMetadata;
|
|
95
|
-
private buildSubmitPayloadEnhancer;
|
|
96
|
-
submitScanOrder<T = any>(): Promise<T>;
|
|
97
|
-
addProductToOrder(product: Partial<ScanOrderOrderProduct> & ScanOrderOrderProductIdentity): Promise<ScanOrderOrderProduct[]>;
|
|
98
|
-
updateProductInOrder(params: UpdateProductInOrderParams): Promise<ScanOrderOrderProduct[]>;
|
|
99
|
-
/**
|
|
100
|
-
* 设置单行商品备注(与整单 `updateTempOrderNote` 区分)。
|
|
101
|
-
* 多行同 SKU 时必须传入与删除/更新一致的 identity(如 `identity_key`)。
|
|
102
|
-
*/
|
|
103
|
-
setOrderProductLineNote(identity: ScanOrderOrderProductIdentity, note: string): Promise<ScanOrderOrderProduct[]>;
|
|
104
|
-
removeProductFromOrder(identity: ScanOrderOrderProductIdentity): Promise<ScanOrderOrderProduct[]>;
|
|
105
|
-
private loadRuntimeConfigs;
|
|
106
|
-
private syncItemRuleConfigsFromDineInConfig;
|
|
107
|
-
private fetchItemRuleConfigsByModelIds;
|
|
108
|
-
private buildPrefillProductSourceMap;
|
|
109
|
-
private getItemRuleRuntimeConfig;
|
|
110
|
-
private ensureItemRuleConfigsLoaded;
|
|
111
|
-
private refreshItemRuleQuantityLimits;
|
|
112
|
-
private applyPrefillByItemRule;
|
|
113
|
-
applyItemRulePrefill(): Promise<void>;
|
|
114
|
-
private evaluateCartValidationByItemRule;
|
|
115
|
-
private validateBeforeSubmitByItemRule;
|
|
116
|
-
private refreshCartValidationPassed;
|
|
117
|
-
setItemRuleRuntimeConfig(config?: ScanOrderItemRuleRuntimeConfig): Promise<void>;
|
|
118
|
-
private normalizeResourceState;
|
|
119
|
-
private resolveResourceSelectType;
|
|
120
|
-
private fetchResourceOccupyDetailByResourceId;
|
|
121
|
-
checkResourceAvailable(resourceId: string, hasOrderId: boolean): Promise<ScanOrderAvailabilityInfo>;
|
|
122
|
-
getAdditionalOrderInfo(): Promise<{
|
|
123
|
-
orderId: string;
|
|
124
|
-
orderStatus: 'pending' | 'processing' | 'completed' | 'cancelled';
|
|
125
|
-
orderTime: string;
|
|
126
|
-
orderAmount: number;
|
|
127
|
-
orderItems: any[];
|
|
128
|
-
}>;
|
|
129
|
-
getProductList(): Promise<ProductData[]>;
|
|
130
|
-
getOtherParams(): Record<string, any>;
|
|
131
|
-
setOtherParams(params: Record<string, any>, { cover }?: {
|
|
132
|
-
cover?: boolean;
|
|
133
|
-
}): Promise<void>;
|
|
134
|
-
private static readonly UI_STATE_KEY_PREFIX;
|
|
135
|
-
private getUIStateBucketKey;
|
|
136
|
-
private readUIStateBucket;
|
|
137
|
-
private writeUIStateBucket;
|
|
138
|
-
setUIState(key: string, value: any): void;
|
|
139
|
-
getUIState<T = any>(key: string): T | undefined;
|
|
140
|
-
deleteUIState(key: string): void;
|
|
141
|
-
clearUIState(): void;
|
|
142
|
-
setEntryPaxNumber(number: number): Promise<void>;
|
|
143
|
-
getEntryPaxNumber(): number | null;
|
|
144
|
-
getFulfillmentModes(): {
|
|
145
|
-
enablePickup: boolean;
|
|
146
|
-
enableTableService: boolean;
|
|
147
|
-
};
|
|
148
|
-
checkManualPickupRef(): {
|
|
149
|
-
enabled: boolean;
|
|
150
|
-
manualInputType?: string;
|
|
151
|
-
};
|
|
152
|
-
}
|