@pisell/pisellos 2.2.313 → 2.2.315

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 (215) hide show
  1. package/dist/index.d.ts +2 -0
  2. package/dist/index.js +3 -1
  3. package/dist/model/strategy/adapter/itemRule/adapter.d.ts +3 -1
  4. package/dist/model/strategy/adapter/itemRule/adapter.js +74 -7
  5. package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +3 -1
  6. package/dist/model/strategy/adapter/itemRule/evaluator.js +13 -0
  7. package/dist/model/strategy/adapter/itemRule/type.d.ts +40 -1
  8. package/dist/model/strategy/adapter/itemRule/type.js +10 -0
  9. package/dist/modules/BookingContext/utils/productExtend.d.ts +7 -0
  10. package/dist/modules/BookingContext/utils/productExtend.js +62 -18
  11. package/dist/modules/BookingContext/utils/resources.js +1 -1
  12. package/dist/modules/BusinessAvailability/index.d.ts +30 -0
  13. package/dist/modules/BusinessAvailability/index.js +204 -0
  14. package/dist/modules/Cart/index.js +4 -3
  15. package/dist/modules/Cart/types.d.ts +2 -0
  16. package/dist/modules/Cart/utils/cartProduct.d.ts +3 -1
  17. package/dist/modules/Cart/utils/cartProduct.js +59 -32
  18. package/dist/modules/FulfillmentTiming/index.d.ts +11 -0
  19. package/dist/modules/FulfillmentTiming/index.js +407 -0
  20. package/dist/modules/FulfillmentTiming/types.d.ts +67 -0
  21. package/dist/modules/FulfillmentTiming/types.js +1 -0
  22. package/dist/modules/OpenData/types.d.ts +14 -0
  23. package/dist/modules/Order/index.d.ts +14 -2
  24. package/dist/modules/Order/index.js +856 -486
  25. package/dist/modules/Order/localEftposState.d.ts +13 -0
  26. package/dist/modules/Order/localEftposState.js +39 -0
  27. package/dist/modules/Order/pickupTiming.d.ts +46 -0
  28. package/dist/modules/Order/pickupTiming.js +53 -0
  29. package/dist/modules/Order/types.d.ts +30 -2
  30. package/dist/modules/Order/utils.js +25 -7
  31. package/dist/modules/Payment/index.js +9 -10
  32. package/dist/modules/Product/types.d.ts +11 -0
  33. package/dist/modules/ProductList/index.js +1 -1
  34. package/dist/modules/ResourcePlanner/planner.d.ts +2 -0
  35. package/dist/modules/ResourcePlanner/planner.js +332 -23
  36. package/dist/modules/ResourcePlanner/types.d.ts +29 -0
  37. package/dist/modules/Schedule/index.d.ts +8 -0
  38. package/dist/modules/Schedule/index.js +141 -39
  39. package/dist/modules/index.d.ts +1 -0
  40. package/dist/modules/index.js +1 -0
  41. package/dist/plugins/request.d.ts +7 -0
  42. package/dist/server/index.d.ts +1 -0
  43. package/dist/server/index.js +1536 -1309
  44. package/dist/server/modules/form/index.d.ts +19 -0
  45. package/dist/server/modules/form/index.js +205 -0
  46. package/dist/server/modules/form/types.d.ts +13 -0
  47. package/dist/server/modules/form/types.js +3 -0
  48. package/dist/server/modules/index.d.ts +3 -0
  49. package/dist/server/modules/index.js +4 -0
  50. package/dist/server/modules/order/index.d.ts +15 -0
  51. package/dist/server/modules/order/index.js +920 -688
  52. package/dist/server/modules/order/types.d.ts +1 -0
  53. package/dist/server/test.json +1 -1
  54. package/dist/server/utils/small-ticket.d.ts +1 -85
  55. package/dist/server/utils/small-ticket.js +2 -2542
  56. package/dist/shared/payment/loadPaymentMethods.d.ts +9 -0
  57. package/dist/shared/payment/loadPaymentMethods.js +66 -0
  58. package/dist/shared/receipt/customerInvoiceLanguages.d.ts +8 -0
  59. package/dist/shared/receipt/customerInvoiceLanguages.js +60 -0
  60. package/dist/shared/receipt/loadCustomerInvoiceLayout.d.ts +27 -0
  61. package/dist/shared/receipt/loadCustomerInvoiceLayout.js +184 -0
  62. package/dist/shared/receipt/small-ticket.d.ts +96 -0
  63. package/dist/shared/receipt/small-ticket.js +2751 -0
  64. package/dist/shared/receipt/templateVisibility.d.ts +23 -0
  65. package/dist/shared/receipt/templateVisibility.js +64 -0
  66. package/dist/shared/sales/loadSalesOrderSnapshot.d.ts +9 -0
  67. package/dist/shared/sales/loadSalesOrderSnapshot.js +21 -0
  68. package/dist/solution/BaseSales/fulfillmentItemRules.d.ts +27 -0
  69. package/dist/solution/BaseSales/fulfillmentItemRules.js +750 -0
  70. package/dist/solution/BaseSales/index.d.ts +39 -16
  71. package/dist/solution/BaseSales/index.js +1754 -1154
  72. package/dist/solution/BaseSales/pickupTiming.d.ts +47 -0
  73. package/dist/solution/BaseSales/pickupTiming.js +616 -0
  74. package/dist/solution/BaseSales/types.d.ts +11 -0
  75. package/dist/solution/BaseSales/utils/parseSalesResponse.js +3 -0
  76. package/dist/solution/BookingByStep/index.d.ts +4 -2
  77. package/dist/solution/BookingByStep/index.js +8 -3
  78. package/dist/solution/BookingTicket/index.d.ts +8 -2
  79. package/dist/solution/BookingTicket/index.js +513 -436
  80. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +0 -1
  81. package/dist/solution/BookingTicket/utils/addProductDecision.js +1 -1
  82. package/dist/solution/BookingTicket/utils/cartView.js +3 -1
  83. package/dist/solution/OrderInvoicePreview/index.d.ts +66 -0
  84. package/dist/solution/OrderInvoicePreview/index.js +340 -0
  85. package/dist/solution/RegisterAndLogin/config.js +54 -11
  86. package/dist/solution/RegisterAndLogin/index.d.ts +2 -0
  87. package/dist/solution/RegisterAndLogin/index.js +1 -1
  88. package/dist/solution/RegisterAndLogin/utils.d.ts +12 -4
  89. package/dist/solution/RegisterAndLogin/utils.js +36 -16
  90. package/dist/solution/Sales/index.js +1 -1
  91. package/dist/solution/UnifiedBookingSales/businessAvailability.d.ts +27 -0
  92. package/dist/solution/UnifiedBookingSales/businessAvailability.js +292 -0
  93. package/dist/solution/UnifiedBookingSales/index.d.ts +36 -4
  94. package/dist/solution/UnifiedBookingSales/index.js +1714 -905
  95. package/dist/solution/UnifiedBookingSales/types.d.ts +16 -2
  96. package/dist/solution/VenueBooking/index.d.ts +15 -2
  97. package/dist/solution/VenueBooking/index.js +1062 -785
  98. package/dist/solution/VenueBooking/types.d.ts +2 -1
  99. package/dist/solution/VenueBooking/types.js +1 -0
  100. package/dist/solution/VenueBooking/utils/dateSummary.d.ts +1 -0
  101. package/dist/solution/VenueBooking/utils/dateSummary.js +7 -4
  102. package/dist/solution/VenueBooking/utils/smartPricing.d.ts +71 -0
  103. package/dist/solution/VenueBooking/utils/smartPricing.js +273 -0
  104. package/dist/solution/VenueBooking/utils/timeSlot.d.ts +1 -0
  105. package/dist/solution/VenueBooking/utils/timeSlot.js +6 -3
  106. package/dist/solution/index.d.ts +1 -0
  107. package/dist/solution/index.js +2 -1
  108. package/lib/index.d.ts +2 -0
  109. package/lib/index.js +21 -1
  110. package/lib/model/strategy/adapter/itemRule/adapter.d.ts +3 -1
  111. package/lib/model/strategy/adapter/itemRule/adapter.js +54 -4
  112. package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +3 -1
  113. package/lib/model/strategy/adapter/itemRule/evaluator.js +9 -0
  114. package/lib/model/strategy/adapter/itemRule/type.d.ts +40 -1
  115. package/lib/model/strategy/adapter/itemRule/type.js +10 -0
  116. package/lib/modules/BookingContext/utils/productExtend.d.ts +7 -0
  117. package/lib/modules/BookingContext/utils/productExtend.js +45 -2
  118. package/lib/modules/BookingContext/utils/resources.js +1 -1
  119. package/lib/modules/BusinessAvailability/index.d.ts +30 -0
  120. package/lib/modules/BusinessAvailability/index.js +146 -0
  121. package/lib/modules/Cart/index.js +4 -2
  122. package/lib/modules/Cart/types.d.ts +2 -0
  123. package/lib/modules/Cart/utils/cartProduct.d.ts +3 -1
  124. package/lib/modules/Cart/utils/cartProduct.js +39 -20
  125. package/lib/modules/FulfillmentTiming/index.d.ts +11 -0
  126. package/lib/modules/FulfillmentTiming/index.js +359 -0
  127. package/lib/modules/FulfillmentTiming/types.d.ts +67 -0
  128. package/lib/modules/FulfillmentTiming/types.js +5 -0
  129. package/lib/modules/OpenData/types.d.ts +14 -0
  130. package/lib/modules/Order/index.d.ts +14 -2
  131. package/lib/modules/Order/index.js +240 -38
  132. package/lib/modules/Order/localEftposState.d.ts +13 -0
  133. package/lib/modules/Order/localEftposState.js +44 -0
  134. package/lib/modules/Order/pickupTiming.d.ts +46 -0
  135. package/lib/modules/Order/pickupTiming.js +61 -0
  136. package/lib/modules/Order/types.d.ts +30 -2
  137. package/lib/modules/Order/utils.js +21 -5
  138. package/lib/modules/Payment/index.js +3 -4
  139. package/lib/modules/Product/types.d.ts +11 -0
  140. package/lib/modules/ProductList/index.js +1 -1
  141. package/lib/modules/ResourcePlanner/planner.d.ts +2 -0
  142. package/lib/modules/ResourcePlanner/planner.js +252 -8
  143. package/lib/modules/ResourcePlanner/types.d.ts +29 -0
  144. package/lib/modules/Schedule/index.d.ts +8 -0
  145. package/lib/modules/Schedule/index.js +68 -12
  146. package/lib/modules/index.d.ts +1 -0
  147. package/lib/modules/index.js +11 -0
  148. package/lib/plugins/request.d.ts +7 -0
  149. package/lib/server/index.d.ts +1 -0
  150. package/lib/server/index.js +158 -37
  151. package/lib/server/modules/form/index.d.ts +19 -0
  152. package/lib/server/modules/form/index.js +73 -0
  153. package/lib/server/modules/form/types.d.ts +13 -0
  154. package/lib/server/modules/form/types.js +9 -0
  155. package/lib/server/modules/index.d.ts +3 -0
  156. package/lib/server/modules/index.js +15 -1
  157. package/lib/server/modules/order/index.d.ts +15 -0
  158. package/lib/server/modules/order/index.js +114 -3
  159. package/lib/server/modules/order/types.d.ts +1 -0
  160. package/lib/server/test.json +1 -1
  161. package/lib/server/utils/small-ticket.d.ts +1 -85
  162. package/lib/server/utils/small-ticket.js +9 -2305
  163. package/lib/shared/payment/loadPaymentMethods.d.ts +9 -0
  164. package/lib/shared/payment/loadPaymentMethods.js +40 -0
  165. package/lib/shared/receipt/customerInvoiceLanguages.d.ts +8 -0
  166. package/lib/shared/receipt/customerInvoiceLanguages.js +58 -0
  167. package/lib/shared/receipt/loadCustomerInvoiceLayout.d.ts +27 -0
  168. package/lib/shared/receipt/loadCustomerInvoiceLayout.js +124 -0
  169. package/lib/shared/receipt/small-ticket.d.ts +96 -0
  170. package/lib/shared/receipt/small-ticket.js +2546 -0
  171. package/lib/shared/receipt/templateVisibility.d.ts +23 -0
  172. package/lib/shared/receipt/templateVisibility.js +63 -0
  173. package/lib/shared/sales/loadSalesOrderSnapshot.d.ts +9 -0
  174. package/lib/shared/sales/loadSalesOrderSnapshot.js +22 -0
  175. package/lib/solution/BaseSales/fulfillmentItemRules.d.ts +27 -0
  176. package/lib/solution/BaseSales/fulfillmentItemRules.js +259 -0
  177. package/lib/solution/BaseSales/index.d.ts +39 -16
  178. package/lib/solution/BaseSales/index.js +333 -31
  179. package/lib/solution/BaseSales/pickupTiming.d.ts +47 -0
  180. package/lib/solution/BaseSales/pickupTiming.js +290 -0
  181. package/lib/solution/BaseSales/types.d.ts +11 -0
  182. package/lib/solution/BaseSales/utils/parseSalesResponse.js +3 -0
  183. package/lib/solution/BookingByStep/index.d.ts +4 -2
  184. package/lib/solution/BookingByStep/index.js +7 -3
  185. package/lib/solution/BookingTicket/index.d.ts +8 -2
  186. package/lib/solution/BookingTicket/index.js +65 -6
  187. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +0 -1
  188. package/lib/solution/BookingTicket/utils/addProductDecision.js +1 -1
  189. package/lib/solution/BookingTicket/utils/cartView.js +3 -1
  190. package/lib/solution/OrderInvoicePreview/index.d.ts +66 -0
  191. package/lib/solution/OrderInvoicePreview/index.js +246 -0
  192. package/lib/solution/RegisterAndLogin/config.js +57 -11
  193. package/lib/solution/RegisterAndLogin/index.d.ts +2 -0
  194. package/lib/solution/RegisterAndLogin/index.js +9 -1
  195. package/lib/solution/RegisterAndLogin/utils.d.ts +12 -4
  196. package/lib/solution/RegisterAndLogin/utils.js +24 -17
  197. package/lib/solution/Sales/index.js +1 -1
  198. package/lib/solution/UnifiedBookingSales/businessAvailability.d.ts +27 -0
  199. package/lib/solution/UnifiedBookingSales/businessAvailability.js +138 -0
  200. package/lib/solution/UnifiedBookingSales/index.d.ts +36 -4
  201. package/lib/solution/UnifiedBookingSales/index.js +561 -74
  202. package/lib/solution/UnifiedBookingSales/types.d.ts +16 -2
  203. package/lib/solution/VenueBooking/index.d.ts +15 -2
  204. package/lib/solution/VenueBooking/index.js +243 -96
  205. package/lib/solution/VenueBooking/types.d.ts +2 -1
  206. package/lib/solution/VenueBooking/types.js +1 -0
  207. package/lib/solution/VenueBooking/utils/dateSummary.d.ts +1 -0
  208. package/lib/solution/VenueBooking/utils/dateSummary.js +7 -4
  209. package/lib/solution/VenueBooking/utils/smartPricing.d.ts +71 -0
  210. package/lib/solution/VenueBooking/utils/smartPricing.js +224 -0
  211. package/lib/solution/VenueBooking/utils/timeSlot.d.ts +1 -0
  212. package/lib/solution/VenueBooking/utils/timeSlot.js +5 -2
  213. package/lib/solution/index.d.ts +1 -0
  214. package/lib/solution/index.js +11 -0
  215. package/package.json +1 -1
@@ -0,0 +1,13 @@
1
+ /** Local reconciliation state; never part of a cloud checkout payload. */
2
+ export declare const LOCAL_EFTPOS_REFRESH_REQUIRED = "_local_eftpos_refresh_required";
3
+ export declare const LOCAL_EFTPOS_FINALIZED = "_local_eftpos_finalized";
4
+ export declare const PAYMENT_REFRESH_MESSAGE = "\u8BA2\u5355\u9700\u8981\u5237\u65B0\uFF0C\u8BF7\u8054\u7F51\u5237\u65B0\u8BA2\u5355\u540E\u518D\u4ED8\u6B3E";
5
+ export interface LocalEftposFinalization {
6
+ saleId: string | number;
7
+ paymentNumber: string;
8
+ result: 'failed' | 'not_started';
9
+ failedTransactionNumbers: string[];
10
+ }
11
+ export declare function requiresLocalPaymentRefresh(order: any): boolean;
12
+ export declare function isLocalFinalizedPayment(payment: any): boolean;
13
+ export declare function stripLocalEftposState<T extends Record<string, any>>(order: T): T;
@@ -0,0 +1,39 @@
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
+ /** Local reconciliation state; never part of a cloud checkout payload. */
8
+ export var LOCAL_EFTPOS_REFRESH_REQUIRED = '_local_eftpos_refresh_required';
9
+ export var LOCAL_EFTPOS_FINALIZED = '_local_eftpos_finalized';
10
+ export var PAYMENT_REFRESH_MESSAGE = '订单需要刷新,请联网刷新订单后再付款';
11
+ export function requiresLocalPaymentRefresh(order) {
12
+ var _order$metadata;
13
+ return (order === null || order === void 0 || (_order$metadata = order.metadata) === null || _order$metadata === void 0 ? void 0 : _order$metadata[LOCAL_EFTPOS_REFRESH_REQUIRED]) === true;
14
+ }
15
+ export function isLocalFinalizedPayment(payment) {
16
+ var _payment$metadata;
17
+ return (payment === null || payment === void 0 ? void 0 : payment.status) === 'voided' && (payment === null || payment === void 0 || (_payment$metadata = payment.metadata) === null || _payment$metadata === void 0 ? void 0 : _payment$metadata[LOCAL_EFTPOS_FINALIZED]) === true;
18
+ }
19
+ export function stripLocalEftposState(order) {
20
+ var result = _objectSpread({}, order);
21
+ if (order.metadata) {
22
+ result.metadata = _objectSpread({}, order.metadata);
23
+ delete result.metadata[LOCAL_EFTPOS_REFRESH_REQUIRED];
24
+ }
25
+ if (Array.isArray(order.payments)) {
26
+ result.payments = order.payments.filter(function (payment) {
27
+ return !isLocalFinalizedPayment(payment);
28
+ }).map(function (payment) {
29
+ var _payment$metadata2;
30
+ if (!((_payment$metadata2 = payment.metadata) !== null && _payment$metadata2 !== void 0 && _payment$metadata2[LOCAL_EFTPOS_FINALIZED])) return payment;
31
+ var metadata = _objectSpread({}, payment.metadata);
32
+ delete metadata[LOCAL_EFTPOS_FINALIZED];
33
+ return _objectSpread(_objectSpread({}, payment), {}, {
34
+ metadata: metadata
35
+ });
36
+ });
37
+ }
38
+ return result;
39
+ }
@@ -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 | '';
@@ -212,6 +213,7 @@ export interface VirtualCurrencySnapshotItem {
212
213
  id: number | string;
213
214
  tag: 'virtual_currency';
214
215
  product_id?: number | string;
216
+ code?: string;
215
217
  product_name: string;
216
218
  par_value: string;
217
219
  used_par_value: string;
@@ -439,16 +441,29 @@ export type AddProductBookingInput = Record<string, any>;
439
441
  */
440
442
  export interface AddProductToOrderOptions {
441
443
  insertAfterProductUid?: string;
444
+ /** 新增商品行插入 products 首位,优先于 insertAfterProductUid。 */
445
+ insertAtStart?: boolean;
442
446
  /** 跳过同商品/规格匹配,始终新增购物车行。 */
443
447
  disableMerge?: boolean;
444
448
  /** 商品行 UID 落定后,由 OrderModule 原子绑定到该行的 Sales Notes 草稿。 */
445
449
  salesNotes?: SalesNoteDraftInput[];
450
+ /**
451
+ * 自动预约加购的同步提交门禁;抛错时不发布本次新增。
452
+ * 带门禁时先在私有草稿中准备全部商品/booking,异步等待后及原子发布前重新调用。
453
+ * 门禁须校验当前订单身份/版本和真实时间;发布前不会因本次拆行改变订单版本。
454
+ * 不传时保留原有人工加购行为。
455
+ */
456
+ availabilityCommitGuard?: () => void;
457
+ /** 发布后的订单/业务归属检查;只用于阻止旧异步收尾写入新单,不再校验截止或 revision。 */
458
+ availabilityCommitTargetGuard?: () => boolean;
446
459
  }
447
460
  /**
448
461
  * 删除商品后的可选位置保持策略。
449
462
  * 预约合并行减量时仍删除最新真实行,再把剩余代表行移动到被删除代表行原位置。
450
463
  */
451
464
  export interface RemoveProductsFromOrderOptions {
465
+ /** 自动购物车写入的订单归属检查;失效时不再变更或发布异步收尾结果。 */
466
+ isCurrentOrder?: () => boolean;
452
467
  preserveDisplayPosition?: {
453
468
  remainingProductUid: string;
454
469
  anchorProductUid: string;
@@ -516,7 +531,15 @@ export type OrderProductMergeDecisionResult = boolean | {
516
531
  reason?: string;
517
532
  [key: string]: any;
518
533
  };
534
+ export interface OrderCartIntentCommitContext {
535
+ action: 'add_product' | 'update_product' | 'increase_quantity' | 'scan_promotion';
536
+ tempOrder: OrderTempOrder | null;
537
+ }
519
538
  export interface OrderHooksConfig {
539
+ /** Optional customer-order guard; called synchronously before the first cart write. */
540
+ beforeCartIntentCommit?: (context: OrderCartIntentCommitContext) => void;
541
+ /** Captures tenant/business runtime identity for asynchronous cart intents. */
542
+ getCartIntentScope?: () => unknown;
520
543
  onBeforeMergeProductToOrder?: (context: OrderProductMergeDecisionContext) => OrderProductMergeDecisionResult | Promise<OrderProductMergeDecisionResult>;
521
544
  }
522
545
  /**
@@ -863,6 +886,9 @@ export interface OrderModuleAPI {
863
886
  updateTempOrderCustomer: (customer: UpdateTempOrderCustomerInput) => OrderSnapshot['customer'];
864
887
  updateTempOrderPickupReferenceMode: (mode: PickupReferenceMode) => ShopServiceData;
865
888
  updateTempOrderServiceType: (serviceType: ShopServiceType) => ShopServiceData;
889
+ getPickupTimingBooking: () => PickupTimingBooking | null;
890
+ setPickupTimingBooking: (input: PickupTimingBookingInput) => PickupTimingBooking;
891
+ clearPickupTimingBooking: () => void;
866
892
  updateTempOrderBuzzer: (buzzer: string) => string;
867
893
  updateTempOrderContactsInfo: (contactsInfo: Record<string, any> | null) => Record<string, any> | null;
868
894
  addProductToOrder: (product: Partial<OrderProduct> & OrderProductIdentity, booking?: AddProductBookingInput, options?: AddProductToOrderOptions) => Promise<OrderProduct[]>;
@@ -875,7 +901,9 @@ export interface OrderModuleAPI {
875
901
  updateOrderProduct: (params: UpdateOrderProductParams) => Promise<OrderProduct[]>;
876
902
  /** 批量更新购物车行,末尾仅触发一次促销重算与 summary 刷新 */
877
903
  updateOrderProducts: (paramsList: UpdateOrderProductParams[]) => Promise<OrderProduct[]>;
878
- updateOrderProductQuantity: (params: UpdateOrderProductQuantityParams) => Promise<OrderProduct[]>;
904
+ updateOrderProductQuantity: (params: UpdateOrderProductQuantityParams, options?: {
905
+ isCurrentOrder?: () => boolean;
906
+ }) => Promise<OrderProduct[]>;
879
907
  updateOrderBooking: (params: UpdateOrderBookingParams) => any[];
880
908
  removeProductFromOrder: (identity: OrderProductIdentity, options?: RemoveProductsFromOrderOptions) => Promise<OrderProduct[]>;
881
909
  /** 批量删除购物车行,末尾仅触发一次促销重算与 summary 刷新 */
@@ -31,6 +31,7 @@ import { getProductHolderConfig } from "../Holder/utils";
31
31
  import { buildProductLineFingerprint, createEmptySummary } from "../../solution/ScanOrder/utils";
32
32
  import { createUuidV4 } from "./utils/orderCollectionIdentity";
33
33
  import { encodeSalesNotes } from "./salesNotes";
34
+ import { isFulfillmentTimingBooking } from "./pickupTiming";
34
35
  dayjs.extend(customParseFormat);
35
36
  var POINT_CARD_SNAPSHOT_TAG = 'point_card';
36
37
  var VIRTUAL_CURRENCY_SNAPSHOT_TAG = 'virtual_currency';
@@ -187,6 +188,10 @@ export function normalizeVirtualCurrencySnapshotItem(value) {
187
188
  if (productId !== undefined) {
188
189
  snapshot.product_id = productId;
189
190
  }
191
+ var code = normalizeSnapshotScalar(value.code);
192
+ if (code !== undefined) {
193
+ snapshot.code = String(code).trim();
194
+ }
190
195
  return snapshot;
191
196
  }
192
197
  function normalizeVirtualCurrencySnapshotList(value) {
@@ -218,6 +223,10 @@ export function buildVirtualCurrencySnapshotFromList(value) {
218
223
  if (productId !== undefined) {
219
224
  snapshot.product_id = productId;
220
225
  }
226
+ var code = normalizeSnapshotScalar(item.code);
227
+ if (code !== undefined) {
228
+ snapshot.code = String(code).trim();
229
+ }
221
230
  result.push(snapshot);
222
231
  return result;
223
232
  }, []);
@@ -1287,7 +1296,7 @@ function normalizeSubmitProduct(product) {
1287
1296
  payment_price: formatOptions.virtualSettlementMode ? virtualPrice : (_submitProduct$paymen = submitProduct.payment_price) !== null && _submitProduct$paymen !== void 0 ? _submitProduct$paymen : submitProduct.selling_price
1288
1297
  });
1289
1298
  }
1290
- var SUBMIT_BOOKING_METADATA_WHITELIST = ['unique_identification_number', 'collect_pax', 'capacity', 'holder_id', 'resource_select_type', 'holder'];
1299
+ var SUBMIT_BOOKING_METADATA_WHITELIST = ['unique_identification_number', 'collect_pax', 'capacity', 'holder_id', 'resource_select_type', 'holder', 'is_fulfillment_timing', 'fulfillment_timing'];
1291
1300
  export function normalizeBookingIsAll(booking) {
1292
1301
  return booking.is_all === true || booking.is_all === 1 || booking.is_all === '1' || booking.is_all === 'true' ? 1 : 0;
1293
1302
  }
@@ -1315,16 +1324,22 @@ export function normalizeSubmitBooking(booking) {
1315
1324
  } finally {
1316
1325
  _iterator7.f();
1317
1326
  }
1318
- if (cleanMetadata.holder_id === undefined) cleanMetadata.holder_id = null;
1327
+ if (cleanMetadata.holder_id === undefined && !isFulfillmentTimingBooking(booking)) {
1328
+ cleanMetadata.holder_id = null;
1329
+ }
1319
1330
  var bookingRecord = booking;
1320
1331
  var startDate = bookingRecord.start_date;
1321
1332
  var shouldRestoreSelectDate = bookingRecord.select_date === undefined || bookingRecord.select_date === null || bookingRecord.select_date === '';
1322
1333
  var selectDateFromStartDate = typeof startDate === 'string' ? startDate.split(/\s+/)[0] : startDate;
1323
- return _objectSpread(_objectSpread(_objectSpread({}, booking), shouldRestoreSelectDate && selectDateFromStartDate ? {
1334
+ return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, booking), shouldRestoreSelectDate && selectDateFromStartDate ? {
1324
1335
  select_date: selectDateFromStartDate
1325
1336
  } : {}), {}, {
1326
1337
  is_all: normalizeBookingIsAll(bookingRecord),
1327
- sub_type: normalizeBookingSubType(bookingRecord),
1338
+ sub_type: normalizeBookingSubType(bookingRecord)
1339
+ }, isFulfillmentTimingBooking(booking) ? {
1340
+ like_status: bookingRecord.like_status || 'common',
1341
+ schedule_id: bookingRecord.schedule_id || 0
1342
+ } : {}), {}, {
1328
1343
  metadata: cleanMetadata
1329
1344
  });
1330
1345
  }
@@ -1413,6 +1428,7 @@ function hasBoundBookingResource(bookings) {
1413
1428
  if (!Array.isArray(bookings)) return false;
1414
1429
  return bookings.some(function (booking) {
1415
1430
  if (!booking || _typeof(booking) !== 'object') return false;
1431
+ if (isFulfillmentTimingBooking(booking)) return false;
1416
1432
  if (Number(booking.parent_id) === 0) return false;
1417
1433
  var resources = booking.resources;
1418
1434
  if (!Array.isArray(resources)) return false;
@@ -1447,7 +1463,9 @@ export function resolveSubmitOrderType(params) {
1447
1463
  return 'table-order';
1448
1464
  }
1449
1465
  if (currentType) return currentType;
1450
- if (Array.isArray(bookings) && bookings.length > 0) {
1466
+ if (Array.isArray(bookings) && bookings.some(function (booking) {
1467
+ return !isFulfillmentTimingBooking(booking);
1468
+ })) {
1451
1469
  return businessCode === 'dine_in' ? 'table-order' : 'appointment_booking';
1452
1470
  }
1453
1471
  return 'virtual';
@@ -1527,11 +1545,11 @@ export function buildSubmitPayload(params) {
1527
1545
  shop_discount: tempOrder.shop_discount || '0.00',
1528
1546
  surcharge_fee: tempOrder.surcharge_fee || '0.00',
1529
1547
  note: tempOrder.note || '',
1530
- delivery_type: tempOrder.delivery_type || 'nil',
1548
+ delivery_type: tempOrder.delivery_type || 'shop_service',
1531
1549
  schedule_date: scheduleDate,
1532
1550
  // created_at: tempOrder.created_at || formatDateTime(now), 和后端协定这个字段先不提交到接口
1533
1551
  bookings: (tempOrder.bookings || []).filter(function (booking) {
1534
- return Number(booking.parent_id) !== 0;
1552
+ return isFulfillmentTimingBooking(booking) || Number(booking.parent_id) !== 0;
1535
1553
  }).map(function (booking) {
1536
1554
  return normalizeSubmitBooking(booking);
1537
1555
  }),
@@ -20,6 +20,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
20
20
  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; }
21
21
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
22
22
  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); }
23
+ import { loadPaymentMethods } from "../../shared/payment/loadPaymentMethods";
23
24
  import { BaseModule } from "../BaseModule";
24
25
  import { PaymentStatus, PaymentMethodType, RoundingRule } from "./types";
25
26
  import { getUniqueId } from "../Cart/utils";
@@ -363,37 +364,35 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
363
364
  key: "getPayMethodListAsync",
364
365
  value: (function () {
365
366
  var _getPayMethodListAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
366
- var response, payMethods;
367
+ var payMethods;
367
368
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
368
369
  while (1) switch (_context3.prev = _context3.next) {
369
370
  case 0:
370
371
  this.logInfo('Starting getPayMethodListAsync');
371
372
  _context3.prev = 1;
372
373
  _context3.next = 4;
373
- return this.request.get('/pay/custom-payment/all', {
374
+ return loadPaymentMethods(this.request, {
375
+ transport: 'os-server',
374
376
  filterPaymentMethods: true
375
- }, {
376
- osServer: true
377
377
  });
378
378
  case 4:
379
- response = _context3.sent;
380
- payMethods = (response === null || response === void 0 ? void 0 : response.data) || response || [];
379
+ payMethods = _context3.sent;
381
380
  this.logInfo('getPayMethodListAsync completed successfully', {
382
381
  payMethods: payMethods
383
382
  });
384
383
  return _context3.abrupt("return", payMethods);
385
- case 10:
386
- _context3.prev = 10;
384
+ case 9:
385
+ _context3.prev = 9;
387
386
  _context3.t0 = _context3["catch"](1);
388
387
  console.error('[PaymentModule] 获取支付方式列表失败', _context3.t0);
389
388
  this.logError('getPayMethodListAsync failed', _context3.t0);
390
389
  // 如果所有操作都失败,返回空数组
391
390
  return _context3.abrupt("return", []);
392
- case 15:
391
+ case 14:
393
392
  case "end":
394
393
  return _context3.stop();
395
394
  }
396
- }, _callee3, this, [[1, 10]]);
395
+ }, _callee3, this, [[1, 9]]);
397
396
  }));
398
397
  function getPayMethodListAsync() {
399
398
  return _getPayMethodListAsync.apply(this, arguments);
@@ -218,6 +218,17 @@ export interface ProductData {
218
218
  bundle?: any[];
219
219
  /** 商品选项组成 */
220
220
  options?: any[];
221
+ /** 单规格组;用于由已选 option 反查规格项名称、价格等商品快照字段。 */
222
+ option_group?: Array<{
223
+ id: number | string;
224
+ option_item?: Array<{
225
+ id: number | string;
226
+ name?: string | Record<string, any>;
227
+ title?: string | Record<string, any>;
228
+ [key: string]: any;
229
+ }>;
230
+ [key: string]: any;
231
+ }>;
221
232
  /** 商品原信息 */
222
233
  origin?: any;
223
234
  /** 容量 */
@@ -227,7 +227,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
227
227
  online_store: 'online-store',
228
228
  scan_to_order: 'online-store',
229
229
  'scan-to-order': 'online-store',
230
- scan_to_order_2: 'mobile_order',
230
+ scan_to_order_2: 'online-store',
231
231
  scan_to_order_3: 'scantoorder3'
232
232
  };
233
233
  rawApplicationCode = (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.channel;
@@ -1,5 +1,7 @@
1
1
  import type { AvailabilityProjection, AvailabilityProjectionInput, AvailabilityQuery, AvailabilityQueryResult, AvailabilitySelectionValidationParams, AvailabilitySelectionValidationResult, GetProductTimeRangesRequest, GetProductTimeRangesRuntimeOptions, ProductTimeRangeGroup } from './types';
2
2
  export declare function createAvailabilityProjection(input: AvailabilityProjectionInput): AvailabilityProjection;
3
+ /** Resolve the label without changing the real calendar timestamp. */
4
+ export declare function getDurationBusinessDate(projection: AvailabilityProjection, startAt: string): string;
3
5
  export declare function getProductTimeRanges(projection: AvailabilityProjection, request?: GetProductTimeRangesRequest, runtimeOptions?: GetProductTimeRangesRuntimeOptions): ProductTimeRangeGroup[];
4
6
  export declare function queryAvailabilityProjection(projection: AvailabilityProjection, request: AvailabilityQuery, runtimeOptions?: GetProductTimeRangesRuntimeOptions): AvailabilityQueryResult;
5
7
  export declare function validateAvailabilitySelection(projection: AvailabilityProjection, params: AvailabilitySelectionValidationParams, runtimeOptions?: GetProductTimeRangesRuntimeOptions): AvailabilitySelectionValidationResult;