@pisell/pisellos 2.3.230 → 2.3.232

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 (56) hide show
  1. package/dist/model/strategy/adapter/promotion/adapter.js +14 -2
  2. package/dist/model/strategy/adapter/promotion/evaluator.js +23 -8
  3. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  4. package/dist/model/strategy/adapter/promotion/type.d.ts +10 -2
  5. package/dist/modules/Customer/types.d.ts +0 -4
  6. package/dist/modules/Order/index.d.ts +1 -1
  7. package/dist/modules/Order/index.js +1411 -1318
  8. package/dist/modules/Order/types.d.ts +13 -36
  9. package/dist/modules/Order/types.js +2 -0
  10. package/dist/modules/Order/utils.js +0 -2
  11. package/dist/modules/Product/index.d.ts +1 -1
  12. package/dist/solution/BaseSales/index.js +0 -3
  13. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +5 -18
  14. package/dist/solution/BaseSales/utils/cartPromotion.js +252 -168
  15. package/dist/solution/BookingByStep/index.d.ts +3 -3
  16. package/dist/solution/BookingTicket/index.d.ts +1 -1
  17. package/dist/solution/BookingTicket/index.js +45 -21
  18. package/dist/solution/BookingTicket/utils/redeemArrival.d.ts +9 -9
  19. package/dist/solution/Checkout/index.js +69 -104
  20. package/dist/solution/Checkout/types.d.ts +0 -1
  21. package/dist/solution/ScanOrder/index.d.ts +1 -0
  22. package/dist/solution/ScanOrder/index.js +54 -48
  23. package/dist/solution/ScanOrder/menuAvailability.js +3 -25
  24. package/dist/solution/ScanOrder/shopTime.d.ts +6 -0
  25. package/dist/solution/ScanOrder/shopTime.js +36 -0
  26. package/dist/solution/VenueBooking/index.js +490 -522
  27. package/lib/model/strategy/adapter/promotion/adapter.js +10 -1
  28. package/lib/model/strategy/adapter/promotion/evaluator.js +18 -6
  29. package/lib/model/strategy/adapter/promotion/type.d.ts +10 -2
  30. package/lib/modules/Customer/types.d.ts +0 -4
  31. package/lib/modules/Order/index.d.ts +1 -1
  32. package/lib/modules/Order/index.js +109 -76
  33. package/lib/modules/Order/types.d.ts +13 -36
  34. package/lib/modules/Order/types.js +1 -0
  35. package/lib/modules/Order/utils.js +1 -5
  36. package/lib/modules/Product/index.d.ts +1 -1
  37. package/lib/solution/BaseSales/index.js +0 -3
  38. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +5 -18
  39. package/lib/solution/BaseSales/utils/cartPromotion.js +87 -40
  40. package/lib/solution/BookingByStep/index.d.ts +3 -3
  41. package/lib/solution/BookingTicket/index.d.ts +1 -1
  42. package/lib/solution/BookingTicket/index.js +28 -11
  43. package/lib/solution/BookingTicket/utils/redeemArrival.d.ts +9 -9
  44. package/lib/solution/Checkout/index.js +0 -21
  45. package/lib/solution/Checkout/types.d.ts +0 -1
  46. package/lib/solution/ScanOrder/index.d.ts +1 -0
  47. package/lib/solution/ScanOrder/index.js +26 -19
  48. package/lib/solution/ScanOrder/menuAvailability.js +3 -20
  49. package/lib/solution/ScanOrder/shopTime.d.ts +6 -0
  50. package/lib/solution/ScanOrder/shopTime.js +37 -0
  51. package/lib/solution/VenueBooking/index.js +1 -6
  52. package/package.json +1 -1
  53. package/dist/modules/Order/utils/bookingUuid.d.ts +0 -4
  54. package/dist/modules/Order/utils/bookingUuid.js +0 -24
  55. package/lib/modules/Order/utils/bookingUuid.d.ts +0 -4
  56. package/lib/modules/Order/utils/bookingUuid.js +0 -25
@@ -342,7 +342,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
342
342
  date: string;
343
343
  status: string;
344
344
  week: string;
345
- weekNum: 0 | 1 | 2 | 5 | 4 | 3 | 6;
345
+ weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
346
346
  }[]>;
347
347
  submitTimeSlot(timeSlots: TimeSliceItem): void;
348
348
  private getScheduleDataByIds;
@@ -361,7 +361,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
361
361
  count: number;
362
362
  left: number;
363
363
  summaryCount: number;
364
- status: "sold_out" | "lots_of_space" | "filling_up_fast";
364
+ status: "lots_of_space" | "filling_up_fast" | "sold_out";
365
365
  }[];
366
366
  /**
367
367
  * 找到多个资源的公共可用时间段
@@ -389,7 +389,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
389
389
  };
390
390
  setOtherData(key: string, value: any): void;
391
391
  getOtherData(key: string): any;
392
- getProductTypeById(id: number): Promise<"normal" | "session" | "duration">;
392
+ getProductTypeById(id: number): Promise<"duration" | "normal" | "session">;
393
393
  /**
394
394
  * 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
395
395
  *
@@ -295,7 +295,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
295
295
  private getCustomerContactOrderKey;
296
296
  replaceTempOrder(...args: Parameters<BaseSalesImpl['replaceTempOrder']>): Promise<import("../../modules/Order/types").OrderTempOrder>;
297
297
  private applyDefaultOrderCustomerContactInfo;
298
- private withAccountNameFallback;
298
+ private withAccountContactFallback;
299
299
  private prefillOrderCustomerContactInfo;
300
300
  protected waitForOrderCustomerContactInfo(): Promise<void>;
301
301
  validateContactInfo(): Promise<void>;
@@ -2048,27 +2048,51 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2048
2048
  return applyDefaultOrderCustomerContactInfo;
2049
2049
  }()
2050
2050
  }, {
2051
- key: "withAccountNameFallback",
2052
- value: function withAccountNameFallback(contact, customer) {
2051
+ key: "withAccountContactFallback",
2052
+ value: function withAccountContactFallback(contact, customer) {
2053
2053
  var next = contact;
2054
- // Saved booking contacts take precedence. Only missing name fields fall back
2055
- // to the account profile; phone/email keep their existing contact-info source.
2056
- var _iterator2 = _createForOfIteratorHelper(['first_name', 'last_name']),
2054
+ // Saved booking contacts take precedence. Fill only missing fields from the
2055
+ // account, without mutating its profile or replacing an existing contact number.
2056
+ var _iterator2 = _createForOfIteratorHelper(['first_name', 'last_name', 'email']),
2057
2057
  _step2;
2058
2058
  try {
2059
2059
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
2060
- var field = _step2.value;
2061
- if (typeof (contact === null || contact === void 0 ? void 0 : contact[field]) === 'string' && contact[field].trim()) continue;
2062
- var name = customer[field];
2063
- if (typeof name !== 'string' || !name.trim()) continue;
2060
+ var _field = _step2.value;
2061
+ if (typeof (contact === null || contact === void 0 ? void 0 : contact[_field]) === 'string' && contact[_field].trim()) continue;
2062
+ var _value = customer[_field];
2063
+ if (typeof _value !== 'string' || !_value.trim()) continue;
2064
2064
  if (next === contact) next = _objectSpread({}, contact);
2065
- next[field] = name.trim();
2065
+ next[_field] = _value.trim();
2066
2066
  }
2067
2067
  } catch (err) {
2068
2068
  _iterator2.e(err);
2069
2069
  } finally {
2070
2070
  _iterator2.f();
2071
2071
  }
2072
+ var phone = isContactRecord(contact === null || contact === void 0 ? void 0 : contact.phone) ? contact.phone : null;
2073
+ if (!(typeof (phone === null || phone === void 0 ? void 0 : phone.phone) === 'string' && phone.phone.trim()) && typeof customer.phone === 'string' && customer.phone.trim()) {
2074
+ // The account number must travel with its own dialing code, not an empty
2075
+ // contact form's default country (for example AU for a +86 login number).
2076
+ var accountPhone = _objectSpread(_objectSpread({}, phone), {}, {
2077
+ phone: customer.phone.trim()
2078
+ });
2079
+ var _iterator3 = _createForOfIteratorHelper(['country_calling_code', 'country_code']),
2080
+ _step3;
2081
+ try {
2082
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
2083
+ var field = _step3.value;
2084
+ var value = customer[field];
2085
+ accountPhone[field] = typeof value === 'string' || typeof value === 'number' ? String(value).trim() : '';
2086
+ }
2087
+ } catch (err) {
2088
+ _iterator3.e(err);
2089
+ } finally {
2090
+ _iterator3.f();
2091
+ }
2092
+ next = _objectSpread(_objectSpread({}, next), {}, {
2093
+ phone: accountPhone
2094
+ });
2095
+ }
2072
2096
  return next;
2073
2097
  }
2074
2098
  }, {
@@ -2087,13 +2111,13 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2087
2111
  var contact = (_order$contacts_info = order.contacts_info) !== null && _order$contacts_info !== void 0 ? _order$contacts_info : extractCustomerContactInfo(customer);
2088
2112
  if (contact) {
2089
2113
  this.orderCustomerContactRequest = null;
2090
- var next = this.withAccountNameFallback(contact, customer);
2114
+ var next = this.withAccountContactFallback(contact, customer);
2091
2115
  if (next !== order.contacts_info) void this.applyDefaultOrderCustomerContactInfo(next);
2092
2116
  return;
2093
2117
  }
2094
2118
  // A relation explicitly returned as null is authoritative. Only a missing relation needs fetching.
2095
2119
  if (customer.contacts_info !== undefined) {
2096
- var _next3 = this.withAccountNameFallback(null, customer);
2120
+ var _next3 = this.withAccountContactFallback(null, customer);
2097
2121
  if (_next3) void this.applyDefaultOrderCustomerContactInfo(_next3);
2098
2122
  return;
2099
2123
  }
@@ -2142,7 +2166,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2142
2166
  return _this5.resolveCustomerById(customerId);
2143
2167
  case 9:
2144
2168
  resolved = _context30.sent;
2145
- return _context30.abrupt("return", resolved && Number(resolved.id) === customerId ? _this5.withAccountNameFallback(extractCustomerContactInfo(resolved), resolved) : null);
2169
+ return _context30.abrupt("return", resolved && Number(resolved.id) === customerId ? _this5.withAccountContactFallback(extractCustomerContactInfo(resolved), resolved) : null);
2146
2170
  case 11:
2147
2171
  case "end":
2148
2172
  return _context30.stop();
@@ -2167,7 +2191,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2167
2191
  }
2168
2192
  return _context31.abrupt("return");
2169
2193
  case 3:
2170
- next = _this5.withAccountNameFallback(value, customer);
2194
+ next = _this5.withAccountContactFallback(value, customer);
2171
2195
  if (!next) {
2172
2196
  _context31.next = 7;
2173
2197
  break;
@@ -3547,7 +3571,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3547
3571
  var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(input) {
3548
3572
  var _this13 = this,
3549
3573
  _input$bookingPatch;
3550
- var bookingUid, orderLines, coveredMinutes, bookingTimePatch, result, _iterator3, _step3, line;
3574
+ var bookingUid, orderLines, coveredMinutes, bookingTimePatch, result, _iterator4, _step4, line;
3551
3575
  return _regeneratorRuntime().wrap(function _callee46$(_context46) {
3552
3576
  while (1) switch (_context46.prev = _context46.next) {
3553
3577
  case 0:
@@ -3584,15 +3608,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3584
3608
  return _context46.abrupt("return", this.store.order.addProductsToOrder(orderLines));
3585
3609
  case 11:
3586
3610
  result = [];
3587
- _iterator3 = _createForOfIteratorHelper(orderLines);
3611
+ _iterator4 = _createForOfIteratorHelper(orderLines);
3588
3612
  _context46.prev = 13;
3589
- _iterator3.s();
3613
+ _iterator4.s();
3590
3614
  case 15:
3591
- if ((_step3 = _iterator3.n()).done) {
3615
+ if ((_step4 = _iterator4.n()).done) {
3592
3616
  _context46.next = 29;
3593
3617
  break;
3594
3618
  }
3595
- line = _step3.value;
3619
+ line = _step4.value;
3596
3620
  _context46.t0 = result.splice;
3597
3621
  _context46.t1 = result;
3598
3622
  _context46.t2 = [0, result.length];
@@ -3613,10 +3637,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3613
3637
  case 31:
3614
3638
  _context46.prev = 31;
3615
3639
  _context46.t7 = _context46["catch"](13);
3616
- _iterator3.e(_context46.t7);
3640
+ _iterator4.e(_context46.t7);
3617
3641
  case 34:
3618
3642
  _context46.prev = 34;
3619
- _iterator3.f();
3643
+ _iterator4.f();
3620
3644
  return _context46.finish(34);
3621
3645
  case 37:
3622
3646
  return _context46.abrupt("return", result);
@@ -25,27 +25,28 @@ export declare function buildArrivalCheckoutQuery(order: OrderTempOrder, summary
25
25
  notes?: import("../../../modules/Order/types").SalesNote[] | undefined;
26
26
  summary?: import("../../../modules/Order/types").OrderSummary | undefined;
27
27
  small_ticket_data_flag?: number | undefined;
28
+ status: string;
28
29
  metadata: Record<string, any>;
30
+ business_code?: string | undefined;
31
+ customer_id: number | null;
29
32
  type: string;
30
- note: string;
31
33
  holder: Record<string, any> | null;
34
+ email: string;
35
+ phone: string;
36
+ note: string;
32
37
  relation_forms: any[];
33
38
  holder_relations?: import("../../../modules/Order/types").OrderHolderRelation[] | undefined;
39
+ country_calling_code: string;
40
+ contacts_info: Record<string, any> | null;
34
41
  order_id: number | null;
35
42
  external_sale_number: string;
36
43
  order_number: string | null;
37
44
  shop_order_number: string | null;
38
45
  shop_full_order_number: string | null;
39
- business_code?: string | undefined;
40
46
  sales_channel: string;
41
47
  order_sales_channel: string;
42
- status: string;
43
48
  shipping_status: string;
44
- customer_id: number | null;
45
49
  customer_name: string;
46
- country_calling_code: string;
47
- phone: string;
48
- email: string;
49
50
  is_price_include_tax: number;
50
51
  tax_title: string;
51
52
  tax_country_code: string;
@@ -62,11 +63,10 @@ export declare function buildArrivalCheckoutQuery(order: OrderTempOrder, summary
62
63
  schedule_date: string;
63
64
  bookings: any[];
64
65
  payments: any[];
66
+ order_meta_list?: import("../../../modules/Order/types").OrderMetaList | undefined;
65
67
  refunds?: any[] | undefined;
66
68
  surcharges: any[];
67
69
  contacts: any[];
68
- contacts_info: Record<string, any> | null;
69
- order_meta_list?: import("../../../modules/Order/types").OrderMetaList | undefined;
70
70
  };
71
71
  export declare function describeChangedBookings(before: OrderTempOrder['bookings'], after: OrderTempOrder['bookings']): {
72
72
  schedule_event_id: any;