@pisell/pisellos 2.1.118 → 2.1.120
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/apis/picoding.d.ts +0 -0
- package/dist/apis/picoding.js +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/model/strategy/adapter/index.d.ts +4 -0
- package/dist/model/strategy/adapter/index.js +4 -1
- package/dist/model/strategy/adapter/itemRule/adapter.d.ts +59 -0
- package/dist/model/strategy/adapter/itemRule/adapter.js +439 -0
- package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +43 -0
- package/dist/model/strategy/adapter/itemRule/evaluator.js +169 -0
- package/dist/model/strategy/adapter/itemRule/examples.d.ts +64 -0
- package/dist/model/strategy/adapter/itemRule/examples.js +315 -0
- package/dist/model/strategy/adapter/itemRule/index.d.ts +5 -0
- package/dist/model/strategy/adapter/itemRule/index.js +5 -0
- package/dist/model/strategy/adapter/itemRule/type.d.ts +206 -0
- package/dist/model/strategy/adapter/itemRule/type.js +101 -0
- package/dist/model/strategy/adapter/promotion/adapter.d.ts +66 -0
- package/dist/model/strategy/adapter/promotion/adapter.js +271 -0
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +213 -0
- package/dist/model/strategy/adapter/promotion/evaluator.js +1206 -0
- package/dist/model/strategy/adapter/promotion/examples.d.ts +138 -0
- package/dist/model/strategy/adapter/promotion/examples.js +166 -0
- package/dist/model/strategy/adapter/promotion/index.d.ts +4 -0
- package/dist/model/strategy/adapter/promotion/index.js +0 -0
- package/dist/model/strategy/adapter/promotion/type.d.ts +447 -0
- package/dist/model/strategy/adapter/promotion/type.js +209 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.js +4 -1
- package/dist/model/strategy/engine.d.ts +106 -0
- package/dist/model/strategy/engine.js +611 -0
- package/dist/model/strategy/index.d.ts +2 -93
- package/dist/model/strategy/index.js +6 -549
- package/dist/modules/Cart/types.d.ts +0 -2
- package/dist/modules/Cart/utils/cartProduct.js +25 -56
- package/dist/modules/Discount/types.d.ts +0 -18
- package/dist/modules/OpenData/index.d.ts +23 -0
- package/dist/modules/OpenData/index.js +167 -0
- package/dist/modules/OpenData/types.d.ts +73 -0
- package/dist/modules/OpenData/types.js +1 -0
- package/dist/modules/OpenData/utils.d.ts +2 -0
- package/dist/modules/OpenData/utils.js +75 -0
- package/dist/modules/Order/index.d.ts +58 -1
- package/dist/modules/Order/index.js +780 -29
- package/dist/modules/Order/types.d.ts +144 -12
- package/dist/modules/Order/utils.d.ts +25 -0
- package/dist/modules/Order/utils.js +225 -1
- package/dist/modules/Payment/index.d.ts +1 -2
- package/dist/modules/Payment/index.js +7 -10
- package/dist/modules/Payment/utils.js +0 -3
- package/dist/modules/Payment/walletpass.d.ts +0 -23
- package/dist/modules/Payment/walletpass.js +95 -191
- package/dist/modules/Product/utils.js +2 -2
- package/dist/modules/ProductList/index.d.ts +1 -1
- package/dist/modules/ProductList/index.js +2 -1
- package/dist/modules/Quotation/index.d.ts +48 -0
- package/dist/modules/Quotation/index.js +245 -0
- package/dist/modules/Quotation/types.d.ts +42 -0
- package/dist/modules/Quotation/types.js +1 -0
- package/dist/modules/Rules/index.d.ts +5 -9
- package/dist/modules/Rules/index.js +164 -673
- package/dist/modules/Rules/types.d.ts +0 -2
- package/dist/modules/SalesSummary/index.d.ts +63 -0
- package/dist/modules/SalesSummary/index.js +174 -0
- package/dist/modules/SalesSummary/types.d.ts +59 -0
- package/dist/modules/SalesSummary/types.js +1 -0
- package/dist/modules/SalesSummary/utils.d.ts +30 -0
- package/dist/modules/SalesSummary/utils.js +513 -0
- package/dist/modules/ScanOrderLogger/index.d.ts +21 -0
- package/dist/modules/ScanOrderLogger/index.js +161 -0
- package/dist/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/providers/feishu.js +95 -0
- package/dist/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/providers/grafana.js +50 -0
- package/dist/modules/ScanOrderLogger/types.d.ts +46 -0
- package/dist/modules/ScanOrderLogger/types.js +1 -0
- package/dist/modules/Schedule/getDateIsInSchedule.js +11 -18
- package/dist/modules/Summary/types.d.ts +0 -2
- package/dist/modules/Summary/utils.d.ts +3 -9
- package/dist/modules/Summary/utils.js +4 -25
- package/dist/modules/index.d.ts +4 -0
- package/dist/modules/index.js +5 -1
- package/dist/plugins/window.d.ts +0 -2
- package/dist/solution/BookingByStep/index.d.ts +1 -2
- package/dist/solution/BookingByStep/index.js +44 -42
- package/dist/solution/BookingByStep/types.d.ts +3 -1
- package/dist/solution/BookingByStep/types.js +5 -1
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/dist/solution/BookingByStep/utils/timeslots.js +19 -12
- package/dist/solution/Checkout/index.js +0 -2
- package/dist/solution/ScanOrder/index.d.ts +90 -0
- package/dist/solution/ScanOrder/index.js +1853 -0
- package/dist/solution/ScanOrder/types.d.ts +210 -0
- package/dist/solution/ScanOrder/types.js +16 -0
- package/dist/solution/ScanOrder/utils.d.ts +93 -0
- package/dist/solution/ScanOrder/utils.js +397 -0
- package/dist/solution/ShopDiscount/index.d.ts +0 -1
- package/dist/solution/ShopDiscount/index.js +7 -23
- package/dist/solution/ShopDiscount/types.d.ts +0 -1
- package/dist/solution/ShopDiscount/types.js +1 -2
- package/dist/solution/ShopDiscount/utils.js +12 -26
- package/dist/solution/VenueBooking/index.d.ts +158 -0
- package/dist/solution/VenueBooking/index.js +2873 -0
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +343 -0
- package/dist/solution/VenueBooking/types.d.ts +130 -0
- package/dist/solution/VenueBooking/types.js +21 -0
- package/dist/solution/VenueBooking/utils/dateSummary.d.ts +10 -0
- package/dist/solution/VenueBooking/utils/dateSummary.js +102 -0
- package/dist/solution/VenueBooking/utils/resource.d.ts +4 -0
- package/dist/solution/VenueBooking/utils/resource.js +94 -0
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +29 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +204 -0
- package/dist/solution/VenueBooking/utils/timeSlot.d.ts +32 -0
- package/dist/solution/VenueBooking/utils/timeSlot.js +256 -0
- package/dist/solution/VenueBooking/utils.d.ts +1 -0
- package/dist/solution/VenueBooking/utils.js +1 -0
- package/dist/solution/index.d.ts +2 -0
- package/dist/solution/index.js +3 -1
- package/lib/apis/picoding.d.ts +0 -0
- package/lib/apis/picoding.js +0 -0
- package/lib/index.d.ts +0 -1
- package/lib/index.js +1 -3
- package/lib/model/strategy/adapter/index.d.ts +4 -0
- package/lib/model/strategy/adapter/index.js +12 -0
- package/lib/model/strategy/adapter/itemRule/adapter.d.ts +59 -0
- package/lib/model/strategy/adapter/itemRule/adapter.js +338 -0
- package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +43 -0
- package/lib/model/strategy/adapter/itemRule/evaluator.js +124 -0
- package/lib/model/strategy/adapter/itemRule/examples.d.ts +64 -0
- package/lib/model/strategy/adapter/itemRule/examples.js +269 -0
- package/lib/model/strategy/adapter/itemRule/index.d.ts +5 -0
- package/lib/model/strategy/adapter/itemRule/index.js +58 -0
- package/lib/model/strategy/adapter/itemRule/type.d.ts +206 -0
- package/lib/model/strategy/adapter/itemRule/type.js +46 -0
- package/lib/model/strategy/adapter/promotion/adapter.d.ts +66 -0
- package/lib/model/strategy/adapter/promotion/adapter.js +217 -0
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +213 -0
- package/lib/model/strategy/adapter/promotion/evaluator.js +844 -0
- package/lib/model/strategy/adapter/promotion/examples.d.ts +138 -0
- package/lib/model/strategy/adapter/promotion/examples.js +192 -0
- package/lib/model/strategy/adapter/promotion/index.d.ts +4 -0
- package/lib/model/strategy/adapter/promotion/index.js +0 -0
- package/lib/model/strategy/adapter/promotion/type.d.ts +447 -0
- package/lib/model/strategy/adapter/promotion/type.js +51 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.js +2 -1
- package/lib/model/strategy/engine.d.ts +106 -0
- package/lib/model/strategy/engine.js +450 -0
- package/lib/model/strategy/index.d.ts +2 -93
- package/lib/model/strategy/index.js +6 -381
- package/lib/modules/Cart/types.d.ts +0 -2
- package/lib/modules/Cart/utils/cartProduct.js +12 -39
- package/lib/modules/Discount/types.d.ts +0 -18
- package/lib/modules/OpenData/index.d.ts +23 -0
- package/lib/modules/OpenData/index.js +116 -0
- package/lib/modules/OpenData/types.d.ts +73 -0
- package/lib/modules/OpenData/types.js +17 -0
- package/lib/modules/OpenData/utils.d.ts +2 -0
- package/lib/modules/OpenData/utils.js +111 -0
- package/lib/modules/Order/index.d.ts +58 -1
- package/lib/modules/Order/index.js +423 -1
- package/lib/modules/Order/types.d.ts +144 -12
- package/lib/modules/Order/utils.d.ts +25 -0
- package/lib/modules/Order/utils.js +229 -0
- package/lib/modules/Payment/index.d.ts +1 -2
- package/lib/modules/Payment/index.js +0 -1
- package/lib/modules/Payment/utils.js +0 -3
- package/lib/modules/Payment/walletpass.d.ts +0 -23
- package/lib/modules/Payment/walletpass.js +17 -94
- package/lib/modules/Product/utils.js +2 -2
- package/lib/modules/ProductList/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +2 -1
- package/lib/modules/Quotation/index.d.ts +48 -0
- package/lib/modules/Quotation/index.js +149 -0
- package/lib/modules/Quotation/types.d.ts +42 -0
- package/lib/modules/Quotation/types.js +17 -0
- package/lib/modules/Rules/index.d.ts +5 -9
- package/lib/modules/Rules/index.js +286 -778
- package/lib/modules/Rules/types.d.ts +0 -2
- package/lib/modules/SalesSummary/index.d.ts +63 -0
- package/lib/modules/SalesSummary/index.js +105 -0
- package/lib/modules/SalesSummary/types.d.ts +59 -0
- package/lib/modules/SalesSummary/types.js +17 -0
- package/lib/modules/SalesSummary/utils.d.ts +30 -0
- package/lib/modules/SalesSummary/utils.js +452 -0
- package/lib/modules/ScanOrderLogger/index.d.ts +21 -0
- package/lib/modules/ScanOrderLogger/index.js +135 -0
- package/lib/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/providers/feishu.js +82 -0
- package/lib/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/providers/grafana.js +52 -0
- package/lib/modules/ScanOrderLogger/types.d.ts +46 -0
- package/lib/modules/ScanOrderLogger/types.js +17 -0
- package/lib/modules/Schedule/getDateIsInSchedule.js +9 -11
- package/lib/modules/Summary/types.d.ts +0 -2
- package/lib/modules/Summary/utils.d.ts +3 -9
- package/lib/modules/Summary/utils.js +4 -19
- package/lib/modules/index.d.ts +4 -0
- package/lib/modules/index.js +9 -1
- package/lib/plugins/window.d.ts +0 -2
- package/lib/solution/BookingByStep/index.d.ts +1 -2
- package/lib/solution/BookingByStep/index.js +4 -2
- package/lib/solution/BookingByStep/types.d.ts +3 -1
- package/lib/solution/BookingByStep/types.js +10 -0
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/lib/solution/BookingByStep/utils/timeslots.js +19 -11
- package/lib/solution/Checkout/index.js +0 -2
- package/lib/solution/ScanOrder/index.d.ts +90 -0
- package/lib/solution/ScanOrder/index.js +1071 -0
- package/lib/solution/ScanOrder/types.d.ts +210 -0
- package/lib/solution/ScanOrder/types.js +36 -0
- package/lib/solution/ScanOrder/utils.d.ts +93 -0
- package/lib/solution/ScanOrder/utils.js +359 -0
- package/lib/solution/ShopDiscount/index.d.ts +0 -1
- package/lib/solution/ShopDiscount/index.js +8 -22
- package/lib/solution/ShopDiscount/types.d.ts +0 -1
- package/lib/solution/ShopDiscount/utils.js +6 -10
- package/lib/solution/VenueBooking/index.d.ts +158 -0
- package/lib/solution/VenueBooking/index.js +1545 -0
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +343 -0
- package/lib/solution/VenueBooking/types.d.ts +130 -0
- package/lib/solution/VenueBooking/types.js +44 -0
- package/lib/solution/VenueBooking/utils/dateSummary.d.ts +10 -0
- package/lib/solution/VenueBooking/utils/dateSummary.js +101 -0
- package/lib/solution/VenueBooking/utils/resource.d.ts +4 -0
- package/lib/solution/VenueBooking/utils/resource.js +80 -0
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +29 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +209 -0
- package/lib/solution/VenueBooking/utils/timeSlot.d.ts +32 -0
- package/lib/solution/VenueBooking/utils/timeSlot.js +200 -0
- package/lib/solution/VenueBooking/utils.d.ts +1 -0
- package/lib/solution/VenueBooking/utils.js +69 -0
- package/lib/solution/index.d.ts +2 -0
- package/lib/solution/index.js +5 -1
- package/package.json +1 -1
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { ScheduleItem } from '../Schedule/types';
|
|
2
|
+
export interface MultiLangObject {
|
|
3
|
+
en?: string;
|
|
4
|
+
ja?: string;
|
|
5
|
+
pt?: string;
|
|
6
|
+
'zh-CN'?: string;
|
|
7
|
+
'zh-HK'?: string;
|
|
8
|
+
original?: string;
|
|
9
|
+
[key: string]: string | undefined;
|
|
10
|
+
}
|
|
11
|
+
export interface OpenDataConfig {
|
|
12
|
+
'basic.enable'?: boolean;
|
|
13
|
+
'basic.code'?: string | null;
|
|
14
|
+
'basic.name'?: string | MultiLangObject;
|
|
15
|
+
'basic.unavailable_message'?: string | MultiLangObject;
|
|
16
|
+
'availability.paused'?: boolean;
|
|
17
|
+
'availability.pause_message'?: string | MultiLangObject;
|
|
18
|
+
'availability.pause_behavior'?: string;
|
|
19
|
+
'availability.closed_behavior'?: string;
|
|
20
|
+
'availability.closed_message'?: string | MultiLangObject;
|
|
21
|
+
'availability.operating_hours'?: number[];
|
|
22
|
+
'reservation.enable'?: boolean;
|
|
23
|
+
'reservation.auto_confirm'?: boolean;
|
|
24
|
+
'reservation.auto_confirm_mode'?: string;
|
|
25
|
+
'reservation.auto_confirm_delay_seconds'?: number;
|
|
26
|
+
'sale.allow_item_notes'?: boolean;
|
|
27
|
+
'sale.allow_order_notes'?: boolean;
|
|
28
|
+
'sale.enable_item_rules'?: boolean;
|
|
29
|
+
'sale.enable_short_number'?: boolean;
|
|
30
|
+
'sale.short_number_daily_reset'?: boolean;
|
|
31
|
+
'sale.short_number_start_number'?: number;
|
|
32
|
+
'sale.short_number_prefix'?: string | null;
|
|
33
|
+
'sale.sale_number_prefix'?: string | null;
|
|
34
|
+
'sale.enabled_item_rules'?: number[];
|
|
35
|
+
'fulfillment.enable_pickup'?: boolean;
|
|
36
|
+
'fulfillment.overdue_reminder'?: boolean;
|
|
37
|
+
'fulfillment.manual_input_type'?: string;
|
|
38
|
+
'fulfillment.enable_auto_complete'?: boolean;
|
|
39
|
+
'fulfillment.enable_table_service'?: boolean;
|
|
40
|
+
'fulfillment.fulfillment_ref_mode'?: string;
|
|
41
|
+
'fulfillment.advance_warning_minutes'?: number;
|
|
42
|
+
'fulfillment.update_end_time_on_auto_complete'?: string;
|
|
43
|
+
'menu.associated_menus'?: Array<{
|
|
44
|
+
label: string;
|
|
45
|
+
value: number;
|
|
46
|
+
}>;
|
|
47
|
+
[key: string]: any;
|
|
48
|
+
}
|
|
49
|
+
export interface OpenDataState {
|
|
50
|
+
data: OpenDataConfig | null;
|
|
51
|
+
lastFetchedAt: number | null;
|
|
52
|
+
}
|
|
53
|
+
export interface OpenDataFetchParams {
|
|
54
|
+
scope: string;
|
|
55
|
+
target: string;
|
|
56
|
+
section_code: string[];
|
|
57
|
+
}
|
|
58
|
+
export interface OpenDataApiResponse {
|
|
59
|
+
status: boolean;
|
|
60
|
+
code: number;
|
|
61
|
+
message: string;
|
|
62
|
+
data: OpenDataConfig;
|
|
63
|
+
}
|
|
64
|
+
export type OpenDataUnavailableReason = 'shop_disabled' | 'paused' | 'closed' | 'reservation_disabled';
|
|
65
|
+
export interface OpenDataAvailabilityResult {
|
|
66
|
+
available: boolean;
|
|
67
|
+
reason: OpenDataUnavailableReason | null;
|
|
68
|
+
message: string | MultiLangObject | null;
|
|
69
|
+
}
|
|
70
|
+
export interface ComputeAvailabilityParams {
|
|
71
|
+
config: OpenDataConfig | null;
|
|
72
|
+
scheduleList?: ScheduleItem[];
|
|
73
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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/OpenData/types.ts
|
|
16
|
+
var types_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(types_exports);
|
|
@@ -0,0 +1,111 @@
|
|
|
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/modules/OpenData/utils.ts
|
|
30
|
+
var utils_exports = {};
|
|
31
|
+
__export(utils_exports, {
|
|
32
|
+
computeAvailability: () => computeAvailability
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(utils_exports);
|
|
35
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
36
|
+
var import_getDateIsInSchedule = require("../Schedule/getDateIsInSchedule");
|
|
37
|
+
function toBoolean(value) {
|
|
38
|
+
if (typeof value === "boolean")
|
|
39
|
+
return value;
|
|
40
|
+
if (typeof value === "string")
|
|
41
|
+
return value === "true" || value === "1";
|
|
42
|
+
if (typeof value === "number")
|
|
43
|
+
return value !== 0;
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
function resolveMessage(...candidates) {
|
|
47
|
+
for (const val of candidates) {
|
|
48
|
+
if (!val)
|
|
49
|
+
continue;
|
|
50
|
+
if (typeof val === "string" && val.length > 0)
|
|
51
|
+
return val;
|
|
52
|
+
if (typeof val === "object" && val !== null && !Array.isArray(val))
|
|
53
|
+
return val;
|
|
54
|
+
}
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
function computeAvailability(params) {
|
|
58
|
+
const { config, scheduleList } = params;
|
|
59
|
+
if (!config) {
|
|
60
|
+
return { available: true, reason: null, message: null };
|
|
61
|
+
}
|
|
62
|
+
if (config["basic.enable"] === false) {
|
|
63
|
+
return {
|
|
64
|
+
available: false,
|
|
65
|
+
reason: "shop_disabled",
|
|
66
|
+
message: resolveMessage(
|
|
67
|
+
config["basic.unavailable_message"],
|
|
68
|
+
config["availability.closed_message"]
|
|
69
|
+
)
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
if (toBoolean(config["availability.paused"])) {
|
|
73
|
+
return {
|
|
74
|
+
available: false,
|
|
75
|
+
reason: "paused",
|
|
76
|
+
message: resolveMessage(
|
|
77
|
+
config["availability.pause_message"],
|
|
78
|
+
config["availability.closed_message"]
|
|
79
|
+
)
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
const operatingHourIds = config["availability.operating_hours"];
|
|
83
|
+
if (Array.isArray(operatingHourIds) && operatingHourIds.length > 0 && (scheduleList == null ? void 0 : scheduleList.length)) {
|
|
84
|
+
const relevantSchedules = scheduleList.filter(
|
|
85
|
+
(s) => operatingHourIds.includes(s.id)
|
|
86
|
+
);
|
|
87
|
+
if (relevantSchedules.length > 0) {
|
|
88
|
+
const now = (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss");
|
|
89
|
+
const isOpen = (0, import_getDateIsInSchedule.getDateIsInSchedule)(now, relevantSchedules);
|
|
90
|
+
if (!isOpen) {
|
|
91
|
+
return {
|
|
92
|
+
available: false,
|
|
93
|
+
reason: "closed",
|
|
94
|
+
message: resolveMessage(config["availability.closed_message"])
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (config["reservation.enable"] === false) {
|
|
100
|
+
return {
|
|
101
|
+
available: false,
|
|
102
|
+
reason: "reservation_disabled",
|
|
103
|
+
message: resolveMessage(config["availability.closed_message"])
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
return { available: true, reason: null, message: null };
|
|
107
|
+
}
|
|
108
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
109
|
+
0 && (module.exports = {
|
|
110
|
+
computeAvailability
|
|
111
|
+
});
|
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
2
2
|
import { BaseModule } from '../BaseModule';
|
|
3
|
-
import { OrderModuleAPI, CommitOrderParams, CheckoutOrderParams } from './types';
|
|
3
|
+
import { OrderModuleAPI, CommitOrderParams, SubmitScanOrderParams, ScanOrderMoreParams, CheckoutOrderParams } from './types';
|
|
4
4
|
import { CartItem } from '../Cart/types';
|
|
5
|
+
import type { ScanOrderOrderProduct, ScanOrderOrderProductIdentity, ScanOrderSummary, ScanOrderTempOrder } from '../../solution/ScanOrder/types';
|
|
6
|
+
import type { Discount } from '../Discount/types';
|
|
7
|
+
import { UnavailableReason } from '../Rules/types';
|
|
5
8
|
export declare class OrderModule extends BaseModule implements Module, OrderModuleAPI {
|
|
6
9
|
protected defaultName: string;
|
|
7
10
|
protected defaultVersion: string;
|
|
8
11
|
private store;
|
|
9
12
|
private request;
|
|
10
13
|
private logger;
|
|
14
|
+
private window;
|
|
15
|
+
private cacheId;
|
|
16
|
+
private salesSummaryModuleName;
|
|
17
|
+
private rulesHooksOverride?;
|
|
18
|
+
/**
|
|
19
|
+
* Populate `savedAmount` on each discount based on product-level discount details.
|
|
20
|
+
* Only selected discounts get a non-zero value.
|
|
21
|
+
*/
|
|
22
|
+
static populateSavedAmounts(productList: Array<Record<string, any>>, discountList: Array<Record<string, any>>): void;
|
|
11
23
|
constructor(name?: string, version?: string);
|
|
12
24
|
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
13
25
|
/**
|
|
@@ -22,6 +34,49 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
22
34
|
* 记录错误日志
|
|
23
35
|
*/
|
|
24
36
|
private logError;
|
|
37
|
+
private registerDiscountModules;
|
|
38
|
+
private createDefaultRulesHooks;
|
|
39
|
+
loadDiscountConfig(params: {
|
|
40
|
+
customerId: number;
|
|
41
|
+
action?: 'create';
|
|
42
|
+
}): Promise<void>;
|
|
43
|
+
getDiscountList(): Discount[];
|
|
44
|
+
scanCode(code: string, customerId?: number): Promise<{
|
|
45
|
+
isAvailable: boolean;
|
|
46
|
+
discountList: Discount[];
|
|
47
|
+
type: 'server' | 'clientCalc';
|
|
48
|
+
unavailableReason?: UnavailableReason;
|
|
49
|
+
}>;
|
|
50
|
+
applyDiscount(): void;
|
|
51
|
+
initTempOrder(params: {
|
|
52
|
+
cacheId?: string;
|
|
53
|
+
salesSummaryModuleName?: string;
|
|
54
|
+
}): void;
|
|
55
|
+
private getTempOrderStorageKey;
|
|
56
|
+
private restoreTempOrderFromStorage;
|
|
57
|
+
persistTempOrder(): void;
|
|
58
|
+
private createDefaultTempOrderInstance;
|
|
59
|
+
ensureTempOrder(): ScanOrderTempOrder;
|
|
60
|
+
getTempOrder(): ScanOrderTempOrder | null;
|
|
61
|
+
addNewOrder(): Promise<ScanOrderTempOrder>;
|
|
62
|
+
getOrderProducts(): ScanOrderOrderProduct[];
|
|
63
|
+
private getSalesSummary;
|
|
64
|
+
recalculateSummary(options?: {
|
|
65
|
+
createIfMissing?: boolean;
|
|
66
|
+
}): Promise<ScanOrderSummary | null>;
|
|
67
|
+
getScanOrderSummary(): Promise<ScanOrderSummary>;
|
|
68
|
+
updateTempOrderNote(note: string): string;
|
|
69
|
+
updateTempOrderContactsInfo(contactsInfo: any[]): any[];
|
|
70
|
+
addProductToOrder(product: Partial<ScanOrderOrderProduct> & ScanOrderOrderProductIdentity): Promise<ScanOrderOrderProduct[]>;
|
|
71
|
+
updateProductInOrder(params: {
|
|
72
|
+
product_id: number | null;
|
|
73
|
+
product_variant_id: number;
|
|
74
|
+
updates: Partial<ScanOrderOrderProduct>;
|
|
75
|
+
}): Promise<ScanOrderOrderProduct[]>;
|
|
76
|
+
removeProductFromOrder(identity: ScanOrderOrderProductIdentity): Promise<ScanOrderOrderProduct[]>;
|
|
77
|
+
submitTempOrder<T = any>(params?: {
|
|
78
|
+
cacheId?: string;
|
|
79
|
+
}): Promise<T>;
|
|
25
80
|
createOrder(params: CommitOrderParams['query']): {
|
|
26
81
|
type: "virtual" | "appointment_booking";
|
|
27
82
|
platform: string;
|
|
@@ -51,4 +106,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
51
106
|
* @returns 后端返回的订单数据(包含订单ID等)
|
|
52
107
|
*/
|
|
53
108
|
createOrderByCheckout(params: CheckoutOrderParams): Promise<any>;
|
|
109
|
+
submitScanOrder<T = any>(params: SubmitScanOrderParams): Promise<T>;
|
|
110
|
+
scanOrderMore<T = any>(params: ScanOrderMoreParams): Promise<T>;
|
|
54
111
|
}
|