@pisell/pisellos 0.10.93 → 0.10.94

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.
@@ -366,7 +366,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
366
366
  * 获取当前的客户搜索条件
367
367
  * @returns 当前搜索条件
368
368
  */
369
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
369
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
370
370
  /**
371
371
  * 获取客户列表状态(包含滚动加载相关状态)
372
372
  * @returns 客户状态
@@ -24,28 +24,23 @@ export declare function buildArrivalCheckoutQuery(order: OrderTempOrder, summary
24
24
  products: import("../../../modules/Order/types").OrderSubmitProduct[];
25
25
  notes?: import("../../../modules/Order/types").SalesNote[] | undefined;
26
26
  summary?: import("../../../modules/Order/types").OrderSummary | undefined;
27
- status: string;
28
- metadata: Record<string, any>;
29
- business_code?: string | undefined;
30
- customer_id: number | null;
31
- type: string;
32
- holder: Record<string, any> | null;
33
- email: string;
34
- phone: string;
35
- note: string;
36
- relation_forms: any[];
37
- holder_relations?: import("../../../modules/Order/types").OrderHolderRelation[] | undefined;
38
- country_calling_code: string;
39
- contacts_info: Record<string, any> | null;
27
+ bookings: any[];
40
28
  order_id: number | null;
41
29
  external_sale_number: string;
42
30
  order_number: string | null;
43
31
  shop_order_number: string | null;
44
32
  shop_full_order_number: string | null;
33
+ type: string;
34
+ business_code?: string | undefined;
45
35
  sales_channel: string;
46
36
  order_sales_channel: string;
37
+ status: string;
47
38
  shipping_status: string;
39
+ customer_id: number | null;
48
40
  customer_name: string;
41
+ country_calling_code: string;
42
+ phone: string;
43
+ email: string;
49
44
  is_price_include_tax: number;
50
45
  tax_title: string;
51
46
  tax_country_code: string;
@@ -56,16 +51,21 @@ export declare function buildArrivalCheckoutQuery(order: OrderTempOrder, summary
56
51
  deposit_amount: string;
57
52
  shop_discount: string;
58
53
  surcharge_fee: string;
54
+ note: string;
59
55
  buzzer?: string | undefined;
60
56
  delivery_type?: string | undefined;
61
57
  table_number?: Record<string, any> | undefined;
62
58
  schedule_date: string;
63
- bookings: any[];
59
+ holder_relations?: import("../../../modules/Order/types").OrderHolderRelation[] | undefined;
64
60
  payments: any[];
65
- order_meta_list?: import("../../../modules/Order/types").OrderMetaList | undefined;
66
61
  refunds?: any[] | undefined;
67
62
  surcharges: any[];
63
+ relation_forms: any[];
68
64
  contacts: any[];
65
+ contacts_info: Record<string, any> | null;
66
+ holder: Record<string, any> | null;
67
+ order_meta_list?: import("../../../modules/Order/types").OrderMetaList | undefined;
68
+ metadata: Record<string, any>;
69
69
  };
70
70
  export declare function describeChangedBookings(before: OrderTempOrder['bookings'], after: OrderTempOrder['bookings']): {
71
71
  schedule_event_id: any;
@@ -33,13 +33,14 @@ export function readArrivalWindow(config) {
33
33
  };
34
34
  }
35
35
  function shiftedSession(booking, now, window) {
36
- if (!window || !booking.start_date || !booking.start_time || !booking.end_time) return;
36
+ if (!window || !booking.start_date || !booking.start_time || !booking.end_time) return null;
37
37
  var start = dayjs("".concat(booking.start_date, " ").concat(booking.start_time));
38
38
  var end = dayjs("".concat(booking.end_date || booking.start_date, " ").concat(booking.end_time));
39
- if (!start.isValid() || !end.isValid() || end.isBefore(start)) return;
39
+ if (!start.isValid() || !end.isValid() || end.isBefore(start)) return null;
40
40
  var delta = dayjs(now).startOf('minute').diff(start, 'minute');
41
41
  var minutes = Math.max(-window.earlyMinutes, Math.min(window.lateMinutes, delta));
42
- if (!Number.isFinite(minutes) || !minutes) return;
42
+ if (!Number.isFinite(minutes)) return null;
43
+ if (!minutes) return;
43
44
  var shiftedStart = start.add(minutes, 'minute');
44
45
  var shiftedEnd = end.add(minutes, 'minute');
45
46
  return {
@@ -70,16 +71,21 @@ export function applyRedeemArrival(order, ids, now, window, onSkip) {
70
71
  _iterator.f();
71
72
  }
72
73
  var alreadyMarked = false;
74
+ var invalidSession = false;
73
75
  var changes = new Map();
74
76
  var bookings = order.bookings.map(function (booking) {
75
77
  var _booking$metadata;
76
78
  var event = redeemEventKey(booking === null || booking === void 0 ? void 0 : booking.schedule_event_id);
77
- if (!event || !selected.has(event) || booking.parent_id === 0) return booking;
79
+ if (!event || !selected.has(event) || String(booking.parent_id) === '0') return booking;
78
80
  if (Number((_booking$metadata = booking.metadata) === null || _booking$metadata === void 0 ? void 0 : _booking$metadata.is_change_by_redeem) === 1) {
79
81
  alreadyMarked = true;
80
82
  return booking;
81
83
  }
82
84
  var shift = shiftedSession(booking, now, window);
85
+ if (shift === null) {
86
+ invalidSession = true;
87
+ return booking;
88
+ }
83
89
  // 准点核销的偏移量为零,也要打标,避免下一张票改变这个时段。
84
90
  changes.set(event, shift);
85
91
  return _objectSpread(_objectSpread(_objectSpread({}, booking), shift), {}, {
@@ -89,7 +95,7 @@ export function applyRedeemArrival(order, ids, now, window, onSkip) {
89
95
  });
90
96
  });
91
97
  if (!changes.size) {
92
- onSkip === null || onSkip === void 0 || onSkip(alreadyMarked ? 'already_marked' : 'no_linked_booking');
98
+ onSkip === null || onSkip === void 0 || onSkip(invalidSession ? 'invalid_booking_time' : alreadyMarked ? 'already_marked' : 'no_linked_booking');
93
99
  return;
94
100
  }
95
101
  var vouchers = order.vouchers.map(function (voucher) {
@@ -366,7 +366,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
366
366
  * 获取当前的客户搜索条件
367
367
  * @returns 当前搜索条件
368
368
  */
369
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
369
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
370
370
  /**
371
371
  * 获取客户列表状态(包含滚动加载相关状态)
372
372
  * @returns 客户状态
@@ -24,28 +24,23 @@ export declare function buildArrivalCheckoutQuery(order: OrderTempOrder, summary
24
24
  products: import("../../../modules/Order/types").OrderSubmitProduct[];
25
25
  notes?: import("../../../modules/Order/types").SalesNote[] | undefined;
26
26
  summary?: import("../../../modules/Order/types").OrderSummary | undefined;
27
- status: string;
28
- metadata: Record<string, any>;
29
- business_code?: string | undefined;
30
- customer_id: number | null;
31
- type: string;
32
- holder: Record<string, any> | null;
33
- email: string;
34
- phone: string;
35
- note: string;
36
- relation_forms: any[];
37
- holder_relations?: import("../../../modules/Order/types").OrderHolderRelation[] | undefined;
38
- country_calling_code: string;
39
- contacts_info: Record<string, any> | null;
27
+ bookings: any[];
40
28
  order_id: number | null;
41
29
  external_sale_number: string;
42
30
  order_number: string | null;
43
31
  shop_order_number: string | null;
44
32
  shop_full_order_number: string | null;
33
+ type: string;
34
+ business_code?: string | undefined;
45
35
  sales_channel: string;
46
36
  order_sales_channel: string;
37
+ status: string;
47
38
  shipping_status: string;
39
+ customer_id: number | null;
48
40
  customer_name: string;
41
+ country_calling_code: string;
42
+ phone: string;
43
+ email: string;
49
44
  is_price_include_tax: number;
50
45
  tax_title: string;
51
46
  tax_country_code: string;
@@ -56,16 +51,21 @@ export declare function buildArrivalCheckoutQuery(order: OrderTempOrder, summary
56
51
  deposit_amount: string;
57
52
  shop_discount: string;
58
53
  surcharge_fee: string;
54
+ note: string;
59
55
  buzzer?: string | undefined;
60
56
  delivery_type?: string | undefined;
61
57
  table_number?: Record<string, any> | undefined;
62
58
  schedule_date: string;
63
- bookings: any[];
59
+ holder_relations?: import("../../../modules/Order/types").OrderHolderRelation[] | undefined;
64
60
  payments: any[];
65
- order_meta_list?: import("../../../modules/Order/types").OrderMetaList | undefined;
66
61
  refunds?: any[] | undefined;
67
62
  surcharges: any[];
63
+ relation_forms: any[];
68
64
  contacts: any[];
65
+ contacts_info: Record<string, any> | null;
66
+ holder: Record<string, any> | null;
67
+ order_meta_list?: import("../../../modules/Order/types").OrderMetaList | undefined;
68
+ metadata: Record<string, any>;
69
69
  };
70
70
  export declare function describeChangedBookings(before: OrderTempOrder['bookings'], after: OrderTempOrder['bookings']): {
71
71
  schedule_event_id: any;
@@ -28,13 +28,14 @@ function readArrivalWindow(config) {
28
28
  };
29
29
  }
30
30
  function shiftedSession(booking, now, window) {
31
- if (!window || !booking.start_date || !booking.start_time || !booking.end_time) return;
31
+ if (!window || !booking.start_date || !booking.start_time || !booking.end_time) return null;
32
32
  const start = (0, _dayjs.default)(`${booking.start_date} ${booking.start_time}`);
33
33
  const end = (0, _dayjs.default)(`${booking.end_date || booking.start_date} ${booking.end_time}`);
34
- if (!start.isValid() || !end.isValid() || end.isBefore(start)) return;
34
+ if (!start.isValid() || !end.isValid() || end.isBefore(start)) return null;
35
35
  const delta = (0, _dayjs.default)(now).startOf('minute').diff(start, 'minute');
36
36
  const minutes = Math.max(-window.earlyMinutes, Math.min(window.lateMinutes, delta));
37
- if (!Number.isFinite(minutes) || !minutes) return;
37
+ if (!Number.isFinite(minutes)) return null;
38
+ if (!minutes) return;
38
39
  const shiftedStart = start.add(minutes, 'minute');
39
40
  const shiftedEnd = end.add(minutes, 'minute');
40
41
  return {
@@ -55,15 +56,20 @@ function applyRedeemArrival(order, ids, now, window, onSkip) {
55
56
  if (event && ids.has(String(voucher.voucher_id))) selected.add(event);
56
57
  }
57
58
  let alreadyMarked = false;
59
+ let invalidSession = false;
58
60
  const changes = new Map();
59
61
  const bookings = order.bookings.map(booking => {
60
62
  const event = (0, _utils.redeemEventKey)(booking?.schedule_event_id);
61
- if (!event || !selected.has(event) || booking.parent_id === 0) return booking;
63
+ if (!event || !selected.has(event) || String(booking.parent_id) === '0') return booking;
62
64
  if (Number(booking.metadata?.is_change_by_redeem) === 1) {
63
65
  alreadyMarked = true;
64
66
  return booking;
65
67
  }
66
68
  const shift = shiftedSession(booking, now, window);
69
+ if (shift === null) {
70
+ invalidSession = true;
71
+ return booking;
72
+ }
67
73
  // 准点核销的偏移量为零,也要打标,避免下一张票改变这个时段。
68
74
  changes.set(event, shift);
69
75
  return {
@@ -76,7 +82,7 @@ function applyRedeemArrival(order, ids, now, window, onSkip) {
76
82
  };
77
83
  });
78
84
  if (!changes.size) {
79
- onSkip?.(alreadyMarked ? 'already_marked' : 'no_linked_booking');
85
+ onSkip?.(invalidSession ? 'invalid_booking_time' : alreadyMarked ? 'already_marked' : 'no_linked_booking');
80
86
  return;
81
87
  }
82
88
  const vouchers = order.vouchers.map(voucher => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.10.93",
4
+ "version": "0.10.94",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",