@pisell/pisellos 2.3.186 → 2.3.189

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 (31) hide show
  1. package/dist/modules/BookingContext/utils/productExtend.d.ts +9 -1
  2. package/dist/modules/BookingContext/utils/productExtend.js +47 -13
  3. package/dist/modules/Order/index.d.ts +15 -5
  4. package/dist/modules/Order/index.js +1161 -921
  5. package/dist/modules/Order/types.d.ts +16 -4
  6. package/dist/modules/ResourcePlanner/planner.js +29 -2
  7. package/dist/modules/ResourcePlanner/types.d.ts +6 -0
  8. package/dist/solution/BaseSales/index.d.ts +4 -0
  9. package/dist/solution/BaseSales/index.js +204 -176
  10. package/dist/solution/BaseSales/types.d.ts +1 -0
  11. package/dist/solution/BaseSales/types.js +1 -0
  12. package/dist/solution/BookingTicket/index.js +52 -31
  13. package/dist/solution/UnifiedBookingSales/index.d.ts +3 -0
  14. package/dist/solution/UnifiedBookingSales/index.js +279 -204
  15. package/dist/solution/UnifiedBookingSales/types.d.ts +6 -1
  16. package/lib/modules/BookingContext/utils/productExtend.d.ts +9 -1
  17. package/lib/modules/BookingContext/utils/productExtend.js +38 -5
  18. package/lib/modules/Order/index.d.ts +15 -5
  19. package/lib/modules/Order/index.js +167 -21
  20. package/lib/modules/Order/types.d.ts +16 -4
  21. package/lib/modules/ResourcePlanner/planner.js +25 -1
  22. package/lib/modules/ResourcePlanner/types.d.ts +6 -0
  23. package/lib/solution/BaseSales/index.d.ts +4 -0
  24. package/lib/solution/BaseSales/index.js +14 -0
  25. package/lib/solution/BaseSales/types.d.ts +1 -0
  26. package/lib/solution/BaseSales/types.js +1 -0
  27. package/lib/solution/BookingTicket/index.js +8 -2
  28. package/lib/solution/UnifiedBookingSales/index.d.ts +3 -0
  29. package/lib/solution/UnifiedBookingSales/index.js +80 -15
  30. package/lib/solution/UnifiedBookingSales/types.d.ts +6 -1
  31. package/package.json +1 -1
@@ -13,6 +13,7 @@ import type { SubmitPayloadEnhancer } from '../../modules/Order/utils';
13
13
  export declare const BaseSalesHookNames: {
14
14
  readonly onInited: "onInited";
15
15
  readonly onDestroy: "onDestroy";
16
+ readonly onOrderSessionChanged: "onOrderSessionChanged";
16
17
  readonly onRetryInit: "onRetryInit";
17
18
  readonly onRefresh: "onRefresh";
18
19
  readonly onCartValidationChanged: "onCartValidationChanged";
@@ -5,6 +5,7 @@
5
5
  export var BaseSalesHookNames = {
6
6
  onInited: 'onInited',
7
7
  onDestroy: 'onDestroy',
8
+ onOrderSessionChanged: 'onOrderSessionChanged',
8
9
  onRetryInit: 'onRetryInit',
9
10
  onRefresh: 'onRefresh',
10
11
  onCartValidationChanged: 'onCartValidationChanged',
@@ -2737,16 +2737,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2737
2737
  }, {
2738
2738
  key: "buildBookingCalcContext",
2739
2739
  value: function buildBookingCalcContext(extra) {
2740
- var _extra$date, _extra$presetStartTim;
2740
+ var _extra$date,
2741
+ _extra$presetStartTim,
2742
+ _this$getOrderSession,
2743
+ _this8 = this;
2741
2744
  var state = this.store.bookingContext.getState();
2742
2745
  var date = (_extra$date = extra === null || extra === void 0 ? void 0 : extra.date) !== null && _extra$date !== void 0 ? _extra$date : state.date;
2743
- return _objectSpread({
2746
+ return _objectSpread(_objectSpread({
2744
2747
  bookingConfig: state.bookingConfig,
2745
2748
  resourcesOrigin: state.resourcesOrigin,
2746
2749
  resourcesOriginMap: state.resourcesOriginMap,
2747
2750
  date: date,
2748
2751
  presetStartTime: (_extra$presetStartTim = extra === null || extra === void 0 ? void 0 : extra.presetStartTime) !== null && _extra$presetStartTim !== void 0 ? _extra$presetStartTim : derivePresetStartTimeFromDate(date)
2749
- }, extra || {});
2752
+ }, extra || {}), {}, {
2753
+ orderSessionId: (_this$getOrderSession = this.getOrderSessionId()) !== null && _this$getOrderSession !== void 0 ? _this$getOrderSession : undefined,
2754
+ isOrderSessionCurrent: function isOrderSessionCurrent(sessionId) {
2755
+ return _this8.isOrderSessionCurrent(sessionId);
2756
+ }
2757
+ });
2750
2758
  }
2751
2759
 
2752
2760
  /**
@@ -2840,7 +2848,14 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2840
2848
  }, {
2841
2849
  key: "buildAddProductCtx",
2842
2850
  value: function buildAddProductCtx(extra) {
2843
- var _extra$date2, _ref14, _this$getOrderCustome4, _this$getOrderCustome5, _this$store$order$get5, _extra$presetStartTim2;
2851
+ var _extra$date2,
2852
+ _ref14,
2853
+ _this$getOrderCustome4,
2854
+ _this$getOrderCustome5,
2855
+ _this$store$order$get5,
2856
+ _extra$presetStartTim2,
2857
+ _this$getOrderSession2,
2858
+ _this9 = this;
2844
2859
  var bookingContextState = this.store.bookingContext.getState();
2845
2860
  var date = (_extra$date2 = extra === null || extra === void 0 ? void 0 : extra.date) !== null && _extra$date2 !== void 0 ? _extra$date2 : bookingContextState.date;
2846
2861
  var orderCustomerId = (_ref14 = (_this$getOrderCustome4 = (_this$getOrderCustome5 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome5 === void 0 ? void 0 : _this$getOrderCustome5.id) !== null && _this$getOrderCustome4 !== void 0 ? _this$getOrderCustome4 : (_this$store$order$get5 = this.store.order.getTempOrder()) === null || _this$store$order$get5 === void 0 ? void 0 : _this$store$order$get5.customer_id) !== null && _ref14 !== void 0 ? _ref14 : undefined;
@@ -2852,7 +2867,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2852
2867
  presetStartTime: (_extra$presetStartTim2 = extra === null || extra === void 0 ? void 0 : extra.presetStartTime) !== null && _extra$presetStartTim2 !== void 0 ? _extra$presetStartTim2 : derivePresetStartTimeFromDate(date),
2853
2868
  customerId: orderCustomerId
2854
2869
  }, extra || {}), {}, {
2855
- channel: this.getSubmitOrderSalesChannel()
2870
+ channel: this.getSubmitOrderSalesChannel(),
2871
+ orderSessionId: (_this$getOrderSession2 = this.getOrderSessionId()) !== null && _this$getOrderSession2 !== void 0 ? _this$getOrderSession2 : undefined,
2872
+ isOrderSessionCurrent: function isOrderSessionCurrent(sessionId) {
2873
+ return _this9.isOrderSessionCurrent(sessionId);
2874
+ }
2856
2875
  });
2857
2876
  }
2858
2877
 
@@ -2988,7 +3007,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2988
3007
  key: "handleGlobalScanCode",
2989
3008
  value: (function () {
2990
3009
  var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(code, bridge) {
2991
- var _this8 = this;
3010
+ var _this10 = this;
2992
3011
  var trimmed, _bridge$onNotify, _bridge$refresh, beforeScanCommit, beforeScanDialog, guardCallback, guardedBridge, _promotion$isAccepted, promotion, localSearch, scanCallback, raw, formatted, _bridge$onNotify2, host, _result8, _bridge$onNotify3, _bridge$isCurrent;
2993
3012
  return _regeneratorRuntime().wrap(function _callee40$(_context40) {
2994
3013
  while (1) switch (_context40.prev = _context40.next) {
@@ -3056,7 +3075,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3056
3075
  });
3057
3076
  case 16:
3058
3077
  localSearch = function localSearch(v) {
3059
- return _this8.store.products.findProductsByCodeOrBarcode(v);
3078
+ return _this10.store.products.findProductsByCodeOrBarcode(v);
3060
3079
  };
3061
3080
  scanCallback = handleGlobalScan(this.request, localSearch, this.getSubmitOrderSalesChannel());
3062
3081
  _context40.next = 20;
@@ -3080,40 +3099,40 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3080
3099
  host = {
3081
3100
  setOrderCustomer: function setOrderCustomer(customer) {
3082
3101
  beforeScanCommit();
3083
- _this8.setOrderCustomer(customer);
3102
+ _this10.setOrderCustomer(customer);
3084
3103
  },
3085
3104
  getOrderCustomerSnapshot: function getOrderCustomerSnapshot() {
3086
- return _this8.getOrderCustomerSnapshot();
3105
+ return _this10.getOrderCustomerSnapshot();
3087
3106
  },
3088
3107
  resolveCustomerById: function resolveCustomerById(customerId) {
3089
- return _this8.resolveCustomerById(customerId);
3108
+ return _this10.resolveCustomerById(customerId);
3090
3109
  },
3091
3110
  getBusinessCode: function getBusinessCode() {
3092
- var _this8$otherParams;
3093
- return (_this8$otherParams = _this8.otherParams) === null || _this8$otherParams === void 0 ? void 0 : _this8$otherParams.businessCode;
3111
+ var _this10$otherParams;
3112
+ return (_this10$otherParams = _this10.otherParams) === null || _this10$otherParams === void 0 ? void 0 : _this10$otherParams.businessCode;
3094
3113
  },
3095
3114
  buildAddProductCtx: function buildAddProductCtx(extra) {
3096
- return _this8.buildAddProductCtx(extra);
3115
+ return _this10.buildAddProductCtx(extra);
3097
3116
  },
3098
3117
  decideAddProduct: function decideAddProduct(item, options) {
3099
- return _this8.decideAddProduct(item, options);
3118
+ return _this10.decideAddProduct(item, options);
3100
3119
  },
3101
3120
  decideAfterDetail: function decideAfterDetail(cacheItem, options) {
3102
- return _this8.decideAfterDetail(cacheItem, options);
3121
+ return _this10.decideAfterDetail(cacheItem, options);
3103
3122
  },
3104
3123
  transformDetailToProductAndBooking: function transformDetailToProductAndBooking(input) {
3105
- return _this8.transformDetailToProductAndBooking(input);
3124
+ return _this10.transformDetailToProductAndBooking(input);
3106
3125
  },
3107
3126
  addProductToOrder: function addProductToOrder(product, booking) {
3108
3127
  beforeScanCommit();
3109
- return _this8.addProductToOrder(product, booking);
3128
+ return _this10.addProductToOrder(product, booking);
3110
3129
  },
3111
3130
  refreshWalletAssets: function refreshWalletAssets(params) {
3112
- return _this8.refreshWalletAssets(params);
3131
+ return _this10.refreshWalletAssets(params);
3113
3132
  },
3114
3133
  scanWalletAsset: function scanWalletAsset(scanCode) {
3115
3134
  beforeScanCommit();
3116
- return _this8.scanWalletAsset(scanCode);
3135
+ return _this10.scanWalletAsset(scanCode);
3117
3136
  }
3118
3137
  };
3119
3138
  if (!((guardedBridge === null || guardedBridge === void 0 ? void 0 : guardedBridge.scanScope) === 'product-voucher-collection')) {
@@ -3124,13 +3143,13 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3124
3143
  return applyProductVoucherCollectionScan(_objectSpread(_objectSpread({}, host), {}, {
3125
3144
  loadCustomerDiscounts: function () {
3126
3145
  var _loadCustomerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
3127
- var _this8$getOrderCustom;
3146
+ var _this10$getOrderCusto;
3128
3147
  var customerId;
3129
3148
  return _regeneratorRuntime().wrap(function _callee39$(_context39) {
3130
3149
  while (1) switch (_context39.prev = _context39.next) {
3131
3150
  case 0:
3132
3151
  beforeScanCommit();
3133
- customerId = Number(((_this8$getOrderCustom = _this8.getOrderCustomer()) === null || _this8$getOrderCustom === void 0 ? void 0 : _this8$getOrderCustom.customer_id) || 0);
3152
+ customerId = Number(((_this10$getOrderCusto = _this10.getOrderCustomer()) === null || _this10$getOrderCusto === void 0 ? void 0 : _this10$getOrderCusto.customer_id) || 0);
3134
3153
  if (!(customerId <= 1)) {
3135
3154
  _context39.next = 4;
3136
3155
  break;
@@ -3138,10 +3157,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3138
3157
  return _context39.abrupt("return", []);
3139
3158
  case 4:
3140
3159
  _context39.next = 6;
3141
- return _this8.refreshDiscountConfigAfterOrderCustomerChange(customerId);
3160
+ return _this10.refreshDiscountConfigAfterOrderCustomerChange(customerId);
3142
3161
  case 6:
3143
3162
  beforeScanCommit();
3144
- return _context39.abrupt("return", _this8.getDiscountList());
3163
+ return _context39.abrupt("return", _this10.getDiscountList());
3145
3164
  case 8:
3146
3165
  case "end":
3147
3166
  return _context39.stop();
@@ -3208,7 +3227,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3208
3227
  key: "getGlobalScanCodeType",
3209
3228
  value: (function () {
3210
3229
  var _getGlobalScanCodeType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(code) {
3211
- var _this9 = this,
3230
+ var _this11 = this,
3212
3231
  _formatGlobalScanResu,
3213
3232
  _formatGlobalScanResu2;
3214
3233
  var trimmed, scan, raw;
@@ -3223,7 +3242,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3223
3242
  return _context41.abrupt("return", null);
3224
3243
  case 3:
3225
3244
  scan = handleGlobalScan(this.request, function (value) {
3226
- return _this9.store.products.findProductsByCodeOrBarcode(value);
3245
+ return _this11.store.products.findProductsByCodeOrBarcode(value);
3227
3246
  }, this.getSubmitOrderSalesChannel());
3228
3247
  _context41.next = 6;
3229
3248
  return scan({
@@ -3356,7 +3375,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3356
3375
  key: "addAddTimeProductsToBooking",
3357
3376
  value: (function () {
3358
3377
  var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(input) {
3359
- var _this10 = this,
3378
+ var _this12 = this,
3360
3379
  _input$bookingPatch;
3361
3380
  var bookingUid, orderLines, coveredMinutes, bookingTimePatch, result, _iterator2, _step2, line;
3362
3381
  return _regeneratorRuntime().wrap(function _callee43$(_context43) {
@@ -3371,7 +3390,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3371
3390
  case 3:
3372
3391
  orderLines = (input.products || []).map(function (line) {
3373
3392
  return {
3374
- product: _this10.buildAddTimeOrderLine(line, bookingUid)
3393
+ product: _this12.buildAddTimeOrderLine(line, bookingUid)
3375
3394
  };
3376
3395
  });
3377
3396
  if (this.store.order) {
@@ -3446,7 +3465,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3446
3465
  key: "setOtherParams",
3447
3466
  value: function () {
3448
3467
  var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params) {
3449
- var _this11 = this;
3468
+ var _this13 = this;
3450
3469
  var _ref21,
3451
3470
  _ref21$cover,
3452
3471
  cover,
@@ -3459,8 +3478,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3459
3478
  _ref21 = _args44.length > 1 && _args44[1] !== undefined ? _args44[1] : {}, _ref21$cover = _ref21.cover, cover = _ref21$cover === void 0 ? false : _ref21$cover;
3460
3479
  nextParams = cover ? params : _objectSpread(_objectSpread({}, this.otherParams), params);
3461
3480
  if (['businessCode', 'business_code', 'channel', 'platform', 'shop_id', 'tenantId', 'cacheId'].some(function (key) {
3462
- var _this11$otherParams;
3463
- return (nextParams === null || nextParams === void 0 ? void 0 : nextParams[key]) !== ((_this11$otherParams = _this11.otherParams) === null || _this11$otherParams === void 0 ? void 0 : _this11$otherParams[key]);
3481
+ var _this13$otherParams;
3482
+ return (nextParams === null || nextParams === void 0 ? void 0 : nextParams[key]) !== ((_this13$otherParams = _this13.otherParams) === null || _this13$otherParams === void 0 ? void 0 : _this13$otherParams[key]);
3464
3483
  })) this.orderCustomerContactRequest = null;
3465
3484
  _context44.next = 5;
3466
3485
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "setOtherParams", this).call(this, params, {
@@ -3600,7 +3619,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3600
3619
  _context46.next = 11;
3601
3620
  return this.replaceTempOrder(_objectSpread(_objectSpread({}, tempOrder), {}, {
3602
3621
  vouchers: nextVouchers
3603
- }));
3622
+ }), {
3623
+ preserveOrderSessionId: this.getOrderSessionId() || undefined
3624
+ });
3604
3625
  case 11:
3605
3626
  this.core.effects.emit("".concat(this.name, ":onVouchersChange"), {});
3606
3627
  if (!(voucherIds.length === 0)) {
@@ -131,6 +131,9 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
131
131
  private cloneAvailabilityPrepareParams;
132
132
  private getAvailabilityDurationCandidateAnchorAt;
133
133
  private createAvailabilityContextRef;
134
+ /** Accept the v2 interval only within the POS order that recorded it. */
135
+ private resolveOrderRememberedTimes;
136
+ private assertRememberedOrderSession;
134
137
  private emitAvailabilityDiagnostic;
135
138
  private touchAvailabilityContext;
136
139
  private touchAvailabilityProjection;