@pisell/pisellos 0.10.49 → 0.10.51

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.
Files changed (62) hide show
  1. package/dist/modules/Discount/types.d.ts +2 -0
  2. package/dist/modules/FulfillmentTiming/index.d.ts +11 -0
  3. package/dist/modules/FulfillmentTiming/index.js +407 -0
  4. package/dist/modules/FulfillmentTiming/types.d.ts +67 -0
  5. package/dist/modules/FulfillmentTiming/types.js +1 -0
  6. package/dist/modules/OpenData/types.d.ts +6 -0
  7. package/dist/modules/Order/index.d.ts +19 -1
  8. package/dist/modules/Order/index.js +362 -217
  9. package/dist/modules/Order/pickupTiming.d.ts +46 -0
  10. package/dist/modules/Order/pickupTiming.js +53 -0
  11. package/dist/modules/Order/types.d.ts +11 -1
  12. package/dist/modules/Order/utils.d.ts +10 -0
  13. package/dist/modules/Order/utils.js +145 -85
  14. package/dist/modules/Rules/index.js +45 -26
  15. package/dist/modules/Rules/types.d.ts +4 -0
  16. package/dist/modules/index.d.ts +1 -0
  17. package/dist/modules/index.js +1 -0
  18. package/dist/server/modules/order/index.d.ts +8 -0
  19. package/dist/server/modules/order/index.js +506 -453
  20. package/dist/server/modules/order/types.d.ts +1 -0
  21. package/dist/server/utils/small-ticket.js +173 -95
  22. package/dist/solution/BaseSales/index.d.ts +23 -0
  23. package/dist/solution/BaseSales/index.js +1216 -1031
  24. package/dist/solution/BaseSales/pickupTiming.d.ts +37 -0
  25. package/dist/solution/BaseSales/pickupTiming.js +482 -0
  26. package/dist/solution/BaseSales/utils/parseSalesResponse.js +3 -0
  27. package/dist/solution/BookingByStep/index.d.ts +1 -1
  28. package/dist/solution/BookingTicket/utils/cartView.js +3 -1
  29. package/dist/solution/UnifiedBookingSales/index.d.ts +2 -0
  30. package/dist/solution/UnifiedBookingSales/index.js +583 -531
  31. package/lib/model/strategy/adapter/promotion/index.js +46 -1
  32. package/lib/modules/Discount/types.d.ts +2 -0
  33. package/lib/modules/FulfillmentTiming/index.d.ts +11 -0
  34. package/lib/modules/FulfillmentTiming/index.js +359 -0
  35. package/lib/modules/FulfillmentTiming/types.d.ts +67 -0
  36. package/lib/modules/FulfillmentTiming/types.js +5 -0
  37. package/lib/modules/OpenData/types.d.ts +6 -0
  38. package/lib/modules/Order/index.d.ts +19 -1
  39. package/lib/modules/Order/index.js +120 -7
  40. package/lib/modules/Order/pickupTiming.d.ts +46 -0
  41. package/lib/modules/Order/pickupTiming.js +61 -0
  42. package/lib/modules/Order/types.d.ts +11 -1
  43. package/lib/modules/Order/utils.d.ts +10 -0
  44. package/lib/modules/Order/utils.js +58 -4
  45. package/lib/modules/Rules/index.js +24 -13
  46. package/lib/modules/Rules/types.d.ts +4 -0
  47. package/lib/modules/index.d.ts +1 -0
  48. package/lib/modules/index.js +11 -0
  49. package/lib/server/modules/order/index.d.ts +8 -0
  50. package/lib/server/modules/order/index.js +19 -0
  51. package/lib/server/modules/order/types.d.ts +1 -0
  52. package/lib/server/utils/small-ticket.js +93 -22
  53. package/lib/solution/BaseSales/index.d.ts +23 -0
  54. package/lib/solution/BaseSales/index.js +104 -1
  55. package/lib/solution/BaseSales/pickupTiming.d.ts +37 -0
  56. package/lib/solution/BaseSales/pickupTiming.js +222 -0
  57. package/lib/solution/BaseSales/utils/parseSalesResponse.js +3 -0
  58. package/lib/solution/BookingByStep/index.d.ts +1 -1
  59. package/lib/solution/BookingTicket/utils/cartView.js +3 -1
  60. package/lib/solution/UnifiedBookingSales/index.d.ts +2 -0
  61. package/lib/solution/UnifiedBookingSales/index.js +20 -0
  62. package/package.json +1 -1
@@ -0,0 +1,46 @@
1
+ export type PickupTimingSelectionMode = 'asap' | 'scheduled';
2
+ export type PickupTimingSource = 'asap' | 'schedule' | 'pos_manual';
3
+ export interface PickupTimingBookingInput {
4
+ mode: PickupTimingSelectionMode;
5
+ source: PickupTimingSource;
6
+ /** Store-local calendar date and minute; the caller validates availability. */
7
+ date: string;
8
+ time: string;
9
+ /** Absolute timestamp disambiguates a repeated local minute at a DST change. */
10
+ instant?: string;
11
+ timezone?: string;
12
+ frozen?: boolean;
13
+ }
14
+ export interface PickupTimingBookingMetadata {
15
+ unique_identification_number: string;
16
+ is_fulfillment_timing: true;
17
+ fulfillment_timing: {
18
+ method: 'pick_up';
19
+ mode: PickupTimingSelectionMode;
20
+ source: PickupTimingSource;
21
+ instant?: string;
22
+ timezone?: string;
23
+ frozen?: boolean;
24
+ };
25
+ [key: string]: any;
26
+ }
27
+ export interface PickupTimingBooking {
28
+ schedule_id: number | string;
29
+ start_date: string;
30
+ end_date: string;
31
+ start_time: string;
32
+ end_time: string;
33
+ select_date: string;
34
+ duration: 0;
35
+ is_all: 0;
36
+ sub_type: 'minutes';
37
+ like_status: string;
38
+ resources: [];
39
+ metadata: PickupTimingBookingMetadata;
40
+ schedule_event_id?: number | string;
41
+ [key: string]: any;
42
+ }
43
+ /** The explicit marker is the only authority; unlinked ordinary bookings remain ordinary. */
44
+ export declare function isFulfillmentTimingBooking(booking: unknown): boolean;
45
+ /** Update an independent pickup appointment without changing its persisted row identity. */
46
+ export declare function buildPickupTimingBooking(input: PickupTimingBookingInput, existing?: Record<string, any> | null): PickupTimingBooking;
@@ -0,0 +1,53 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ import { createUuidV4 } from "./utils/orderCollectionIdentity";
8
+ /** The explicit marker is the only authority; unlinked ordinary bookings remain ordinary. */
9
+ export function isFulfillmentTimingBooking(booking) {
10
+ var _metadata;
11
+ return (booking === null || booking === void 0 || (_metadata = booking.metadata) === null || _metadata === void 0 ? void 0 : _metadata.is_fulfillment_timing) === true;
12
+ }
13
+
14
+ /** Update an independent pickup appointment without changing its persisted row identity. */
15
+ export function buildPickupTimingBooking(input, existing) {
16
+ var booking = _objectSpread({}, existing || {});
17
+ var metadata = _objectSpread({}, booking.metadata || {});
18
+ // A fulfillment appointment never becomes a product/resource/holder purchase line.
19
+ for (var _i = 0, _arr = ['product_uid', 'product', 'holder', 'holder_id', 'collect_pax', 'capacity']; _i < _arr.length; _i++) {
20
+ var _key = _arr[_i];
21
+ delete booking[_key];
22
+ delete metadata[_key];
23
+ }
24
+ delete metadata.booking_uid;
25
+ return _objectSpread(_objectSpread({}, booking), {}, {
26
+ schedule_id: booking.schedule_id || 0,
27
+ start_date: input.date,
28
+ end_date: input.date,
29
+ start_time: input.time,
30
+ end_time: input.time,
31
+ select_date: input.date,
32
+ duration: 0,
33
+ is_all: 0,
34
+ sub_type: 'minutes',
35
+ like_status: booking.like_status || 'common',
36
+ resources: [],
37
+ metadata: _objectSpread(_objectSpread({}, metadata), {}, {
38
+ unique_identification_number: String(metadata.unique_identification_number || createUuidV4()),
39
+ is_fulfillment_timing: true,
40
+ fulfillment_timing: _objectSpread(_objectSpread(_objectSpread({
41
+ method: 'pick_up',
42
+ mode: input.mode,
43
+ source: input.source
44
+ }, input.instant !== undefined ? {
45
+ instant: input.instant
46
+ } : {}), input.timezone !== undefined ? {
47
+ timezone: input.timezone
48
+ } : {}), input.frozen !== undefined ? {
49
+ frozen: input.frozen
50
+ } : {})
51
+ })
52
+ });
53
+ }
@@ -7,9 +7,10 @@ import type { SubmitPayloadEnhancer } from './utils';
7
7
  import type { PaymentItem } from '../Payment/types';
8
8
  import type { ICustomer } from '../AccountList/types';
9
9
  import type { OrderProductDiscountItem } from '../../server/modules/order/types';
10
+ import type { PickupTimingBooking, PickupTimingBookingInput } from './pickupTiming';
10
11
  export type { OrderProductDiscountItem } from '../../server/modules/order/types';
11
12
  export type PickupReferenceMode = 'counter_pickup' | 'table_service';
12
- export type ShopServiceType = 'dine_in' | 'takeaway';
13
+ export type ShopServiceType = 'dine_in' | 'takeaway' | 'pick_up' | 'delivery';
13
14
  export interface ShopServiceData {
14
15
  pickup_reference_mode?: PickupReferenceMode;
15
16
  service_type?: ShopServiceType | '';
@@ -199,10 +200,15 @@ export interface PointCardSnapshotItem {
199
200
  id: number | string;
200
201
  tag: 'point_card';
201
202
  product_id?: number | string;
203
+ code?: string;
202
204
  product_name: string;
203
205
  par_value: string;
204
206
  used_par_value: string;
205
207
  }
208
+ export interface PointCardSnapshotMergeContext {
209
+ customerId?: number | string | null;
210
+ orderIdentity?: OrderIdentitySnapshot | null;
211
+ }
206
212
  export interface VirtualCurrencySnapshotItem {
207
213
  id: number | string;
208
214
  tag: 'virtual_currency';
@@ -858,6 +864,9 @@ export interface OrderModuleAPI {
858
864
  updateTempOrderCustomer: (customer: UpdateTempOrderCustomerInput) => OrderSnapshot['customer'];
859
865
  updateTempOrderPickupReferenceMode: (mode: PickupReferenceMode) => ShopServiceData;
860
866
  updateTempOrderServiceType: (serviceType: ShopServiceType) => ShopServiceData;
867
+ getPickupTimingBooking: () => PickupTimingBooking | null;
868
+ setPickupTimingBooking: (input: PickupTimingBookingInput) => PickupTimingBooking;
869
+ clearPickupTimingBooking: () => void;
861
870
  updateTempOrderBuzzer: (buzzer: string) => string;
862
871
  updateTempOrderContactsInfo: (contactsInfo: Record<string, any> | null) => Record<string, any> | null;
863
872
  addProductToOrder: (product: Partial<OrderProduct> & OrderProductIdentity, booking?: AddProductBookingInput, options?: AddProductToOrderOptions) => Promise<OrderProduct[]>;
@@ -975,6 +984,7 @@ export interface OrderModuleAPI {
975
984
  getDiscountList: () => Discount[];
976
985
  getAvailableWalletIds: () => number[];
977
986
  getCustomerWalletPrepareConfigEpoch: () => number;
987
+ mergePointCardSnapshotCodes: (walletPassList: unknown, context?: PointCardSnapshotMergeContext) => PointCardSnapshotItem[];
978
988
  applyDiscount: () => void;
979
989
  /**
980
990
  * 注入促销评估器。
@@ -18,6 +18,16 @@ export interface OrderProductsDepositSummary {
18
18
  import type { WindowPlugin } from '../../plugins';
19
19
  export declare function normalizePointCardSnapshotItem(value: unknown): PointCardSnapshotItem | null;
20
20
  export declare function buildPointCardSnapshotFromWalletPassList(value: unknown): PointCardSnapshotItem[];
21
+ export declare function collectPointCardSnapshotCodeCandidates(value: unknown): Array<{
22
+ id: string;
23
+ code: string;
24
+ }>;
25
+ /**
26
+ * Payment 的 WalletPass 列表包含实例 code,而 prepare/config 通常只提供
27
+ * 卡名称和余额。按实例 ID 仅补齐 Snapshot 缺失的 code,避免后到的运行态
28
+ * 数据覆盖下单时已经冻结的卡名称和余额。
29
+ */
30
+ export declare function mergePointCardSnapshotCodes(snapshotsValue: unknown, walletPassesValue: unknown): PointCardSnapshotItem[];
21
31
  export declare function normalizeVirtualCurrencySnapshotItem(value: unknown): VirtualCurrencySnapshotItem | null;
22
32
  export declare function buildVirtualCurrencySnapshotFromList(value: unknown): VirtualCurrencySnapshotItem[];
23
33
  export declare function normalizeOrderMetaList(value: unknown): OrderMetaList | undefined;