@pisell/private-materials 6.3.17 → 6.3.19

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 (71) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +150 -150
  7. package/build/lowcode/render/default/view.js +1 -1
  8. package/build/lowcode/view.js +8 -8
  9. package/es/components/appointmentBooking/components/Guest/components/InformationOptionsModal/index.d.ts +0 -1
  10. package/es/components/appointmentBooking/components/Services/index.js +36 -18
  11. package/es/components/appointmentBooking/hooks.js +6 -0
  12. package/es/components/booking/components/formItemChildrenWrap/index.d.ts +0 -1
  13. package/es/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.d.ts +0 -1
  14. package/es/components/booking/info/service/like/index.d.ts +0 -1
  15. package/es/components/booking/locales.d.ts +6 -0
  16. package/es/components/booking/locales.js +12 -0
  17. package/es/components/eftpos/deviceList/index.d.ts +0 -1
  18. package/es/components/eftpos/group/index.d.ts +0 -1
  19. package/es/components/eftpos/icon/apiKey.d.ts +0 -1
  20. package/es/components/eftpos/icon/device.d.ts +0 -1
  21. package/es/components/eftpos/receipt/index.d.ts +0 -1
  22. package/es/components/eftposPay/component/alert/warn.d.ts +0 -1
  23. package/es/components/eftposPay/component/header/titlebar.d.ts +0 -1
  24. package/es/components/eftposPay/component/step/index.d.ts +0 -1
  25. package/es/components/eftposPay/component/step/step.d.ts +0 -1
  26. package/es/components/eftposPay/hooks.d.ts +1 -1
  27. package/es/components/eftposPay/store/index.d.ts +1 -1
  28. package/es/components/eftposPay/tyro/hooks.d.ts +0 -1
  29. package/es/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
  30. package/es/components/eventBooking/components/Provider/InformationOptionsModal/index.d.ts +0 -1
  31. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
  32. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
  33. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/DayItem/index.d.ts +0 -1
  34. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/index.d.ts +0 -1
  35. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/index.d.ts +0 -1
  36. package/es/components/pay/toC/PaymentMethods/WalletPass/utils.js +1 -1
  37. package/es/components/schedules/utils.d.ts +1 -1
  38. package/es/components/workSpaceList/components/Modal/index.d.ts +0 -1
  39. package/es/utils/index.d.ts +1 -1
  40. package/lib/components/appointmentBooking/components/Guest/components/InformationOptionsModal/index.d.ts +0 -1
  41. package/lib/components/appointmentBooking/components/Services/index.js +13 -3
  42. package/lib/components/appointmentBooking/hooks.js +6 -0
  43. package/lib/components/booking/components/formItemChildrenWrap/index.d.ts +0 -1
  44. package/lib/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.d.ts +0 -1
  45. package/lib/components/booking/info/service/like/index.d.ts +0 -1
  46. package/lib/components/booking/locales.d.ts +6 -0
  47. package/lib/components/booking/locales.js +6 -0
  48. package/lib/components/eftpos/deviceList/index.d.ts +0 -1
  49. package/lib/components/eftpos/group/index.d.ts +0 -1
  50. package/lib/components/eftpos/icon/apiKey.d.ts +0 -1
  51. package/lib/components/eftpos/icon/device.d.ts +0 -1
  52. package/lib/components/eftpos/receipt/index.d.ts +0 -1
  53. package/lib/components/eftposPay/component/alert/warn.d.ts +0 -1
  54. package/lib/components/eftposPay/component/header/titlebar.d.ts +0 -1
  55. package/lib/components/eftposPay/component/step/index.d.ts +0 -1
  56. package/lib/components/eftposPay/component/step/step.d.ts +0 -1
  57. package/lib/components/eftposPay/hooks.d.ts +1 -1
  58. package/lib/components/eftposPay/store/index.d.ts +1 -1
  59. package/lib/components/eftposPay/tyro/hooks.d.ts +0 -1
  60. package/lib/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
  61. package/lib/components/eventBooking/components/Provider/InformationOptionsModal/index.d.ts +0 -1
  62. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
  63. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
  64. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/DayItem/index.d.ts +0 -1
  65. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/index.d.ts +0 -1
  66. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/index.d.ts +0 -1
  67. package/lib/components/pay/toC/PaymentMethods/WalletPass/utils.js +1 -1
  68. package/lib/components/schedules/utils.d.ts +1 -1
  69. package/lib/components/workSpaceList/components/Modal/index.d.ts +0 -1
  70. package/lib/utils/index.d.ts +1 -1
  71. package/package.json +3 -3
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  declare const GuestOptionsModal: (props: any) => JSX.Element;
4
3
  export default GuestOptionsModal;
@@ -99,7 +99,7 @@ var Services = /*#__PURE__*/forwardRef(function (props, ref) {
99
99
  },
100
100
  callback: function () {
101
101
  var _callback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) {
102
- var product, session, startDate, endDate, _data$origin, resources, activeStatus, index, stepList, hasResourceStep, description;
102
+ var product, res, session, startDate, endDate, _res, _data$origin, resources, activeStatus, _res2, index, stepList, hasResourceStep, description;
103
103
  return _regeneratorRuntime().wrap(function _callee$(_context) {
104
104
  while (1) switch (_context.prev = _context.next) {
105
105
  case 0:
@@ -117,7 +117,7 @@ var Services = /*#__PURE__*/forwardRef(function (props, ref) {
117
117
 
118
118
  // 零售模版,直接加入购物车
119
119
  if (!isRetailTemplate) {
120
- _context.next = 10;
120
+ _context.next = 12;
121
121
  break;
122
122
  }
123
123
  if (!(data !== null && data !== void 0 && data.isCancel)) {
@@ -126,51 +126,69 @@ var Services = /*#__PURE__*/forwardRef(function (props, ref) {
126
126
  }
127
127
  return _context.abrupt("return");
128
128
  case 8:
129
- appointmentBooking.storeProduct(product);
129
+ res = appointmentBooking.storeProduct(product);
130
+ if (!(!res.success && res.errorCode === 'not_enough_stock')) {
131
+ _context.next = 11;
132
+ break;
133
+ }
134
+ return _context.abrupt("return", Toast(locales.getText('pisell2.appointment.unuse.stock')));
135
+ case 11:
130
136
  return _context.abrupt("return");
131
- case 10:
137
+ case 12:
132
138
  session = data === null || data === void 0 ? void 0 : data.session;
133
139
  if (!session) {
134
- _context.next = 19;
140
+ _context.next = 24;
135
141
  break;
136
142
  }
137
143
  startDate = dayjs(session === null || session === void 0 ? void 0 : session.start_at).format('YYYY-MM-DD');
138
144
  endDate = dayjs(session === null || session === void 0 ? void 0 : session.end_at).format('YYYY-MM-DD');
139
- appointmentBooking.addProductToCart({
145
+ _res = appointmentBooking.addProductToCart({
140
146
  product: _objectSpread({}, product),
141
147
  date: {
142
148
  startTime: "".concat(startDate, " ").concat(session === null || session === void 0 ? void 0 : session.start_time),
143
149
  endTime: "".concat(endDate, " ").concat(session === null || session === void 0 ? void 0 : session.end_time)
144
150
  }
145
151
  });
146
- _context.next = 17;
152
+ if (!(!_res.success && _res.errorCode === 'not_enough_stock')) {
153
+ _context.next = 19;
154
+ break;
155
+ }
156
+ return _context.abrupt("return", Toast(locales.getText('pisell2.appointment.unuse.stock')));
157
+ case 19:
158
+ appointmentBooking.closeProductDetail();
159
+ _context.next = 22;
147
160
  return appointmentBooking.getAvailableDate({
148
161
  startDate: startDate,
149
162
  endDate: endDate
150
163
  });
151
- case 17:
152
- _context.next = 27;
164
+ case 22:
165
+ _context.next = 34;
153
166
  break;
154
- case 19:
167
+ case 24:
155
168
  resources = (data === null || data === void 0 || (_data$origin = data.origin) === null || _data$origin === void 0 || (_data$origin = _data$origin.product_resource) === null || _data$origin === void 0 ? void 0 : _data$origin.resources) || [];
156
169
  activeStatus = resources.find(function (item) {
157
170
  return item.status === 1;
158
171
  });
159
172
  if (!(!activeStatus && !appointmentBooking.isTargetNormalProduct(data === null || data === void 0 ? void 0 : data.origin))) {
160
- _context.next = 23;
173
+ _context.next = 28;
161
174
  break;
162
175
  }
163
176
  return _context.abrupt("return", Toast(locales.getText('pisell2.appointment.no.available.service')));
164
- case 23:
165
- appointmentBooking.storeProduct(product);
166
- // duration 类型的商品,要获取一下资源,在先选日期的 duration 步骤里目前只能通过这个动作拉取
177
+ case 28:
178
+ _res2 = appointmentBooking.storeProduct(product);
179
+ if (!(!_res2.success && _res2.errorCode === 'not_enough_stock')) {
180
+ _context.next = 31;
181
+ break;
182
+ }
183
+ return _context.abrupt("return", Toast(locales.getText('pisell2.appointment.unuse.stock')));
184
+ case 31:
167
185
  if (!(type === 'duration')) {
168
- _context.next = 27;
186
+ _context.next = 34;
169
187
  break;
170
188
  }
171
- _context.next = 27;
189
+ _context.next = 34;
172
190
  return appointmentBooking.getAvailableDate();
173
- case 27:
191
+ case 34:
174
192
  appointmentBooking.closeProductDetail();
175
193
 
176
194
  // 先选择日期流程
@@ -199,7 +217,7 @@ var Services = /*#__PURE__*/forwardRef(function (props, ref) {
199
217
  removeStep('select-time');
200
218
  }
201
219
  }
202
- case 29:
220
+ case 36:
203
221
  case "end":
204
222
  return _context.stop();
205
223
  }
@@ -206,6 +206,12 @@ export var useAppointmentBookingStep = function useAppointmentBookingStep() {
206
206
  if (!result) {
207
207
  return Toast(locales.getText('pisell2.appointment.unuse.date'));
208
208
  }
209
+ var capacityResult = appointmentBooking.checkMaxDurationCapacity();
210
+ if (!capacityResult.success) {
211
+ var getMessage = locales.getText('pisell2.appointment.unuse.capacity');
212
+ var message = typeof getMessage === 'function' ? getMessage(capacityResult.minAvailableCount) : getMessage;
213
+ return Toast(message);
214
+ }
209
215
  }
210
216
  if (!isRetailTemplate && currentKey !== null && currentKey !== void 0 && currentKey.startsWith('select-resource')) {
211
217
  var _currentSelectedResou;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  declare const FormItemChildrenWrap: (props: any) => JSX.Element;
3
2
  export default FormItemChildrenWrap;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  declare const useIsLowSpeedNetwork: () => import("react").MutableRefObject<boolean>;
3
2
  export default useIsLowSpeedNetwork;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import "./index.less";
3
2
  declare const Like: ({ status, onChange, className, style, }: {
4
3
  style?: any;
@@ -156,6 +156,8 @@ declare const _default: {
156
156
  'pisell2.text.deposit-delete-message': string;
157
157
  'pisell2.text.deposit-paid': string;
158
158
  "pisell2.text.stock": string;
159
+ 'pisell2.appointment.unuse.stock': string;
160
+ 'pisell2.appointment.unuse.capacity': (count: number) => string;
159
161
  'pisell2.text.payment-link': string;
160
162
  'pisell2.text.send-mail': string;
161
163
  'pisell2.text.copy-to-clipboard': string;
@@ -432,6 +434,8 @@ declare const _default: {
432
434
  'pisell2.text.deposit-delete-message': string;
433
435
  'pisell2.text.deposit-paid': string;
434
436
  "pisell2.text.stock": string;
437
+ 'pisell2.appointment.unuse.stock': string;
438
+ 'pisell2.appointment.unuse.capacity': (count: number) => string;
435
439
  'pisell2.text.payment-link': string;
436
440
  'pisell2.text.send-mail': string;
437
441
  'pisell2.text.copy-to-clipboard': string;
@@ -708,6 +712,8 @@ declare const _default: {
708
712
  'pisell2.text.deposit-delete-message': string;
709
713
  'pisell2.text.deposit-paid': string;
710
714
  "pisell2.text.stock": string;
715
+ 'pisell2.appointment.unuse.stock': string;
716
+ 'pisell2.appointment.unuse.capacity': (count: number) => string;
711
717
  'pisell2.text.payment-link': string;
712
718
  'pisell2.text.send-mail': string;
713
719
  'pisell2.text.copy-to-clipboard': string;
@@ -174,6 +174,10 @@ export default {
174
174
  'pisell2.text.deposit-delete-message': "It cannot be restored after deletion. Please confirm the operation.",
175
175
  'pisell2.text.deposit-paid': "Deposit paid",
176
176
  "pisell2.text.stock": "Stock",
177
+ 'pisell2.appointment.unuse.stock': "Not enough stock",
178
+ 'pisell2.appointment.unuse.capacity': function pisell2AppointmentUnuseCapacity(count) {
179
+ return "Only ".concat(count, " spots available. Please reduce quantity.");
180
+ },
177
181
  'pisell2.text.payment-link': "Payment link",
178
182
  'pisell2.text.send-mail': "Send email",
179
183
  'pisell2.text.copy-to-clipboard': "Copy to clipboard",
@@ -497,6 +501,10 @@ export default {
497
501
  'pisell2.text.deposit-delete-message': "删除后不可恢复,请确认操作",
498
502
  'pisell2.text.deposit-paid': "已付定金",
499
503
  "pisell2.text.stock": "库存",
504
+ 'pisell2.appointment.unuse.stock': "库存不足",
505
+ 'pisell2.appointment.unuse.capacity': function pisell2AppointmentUnuseCapacity(count) {
506
+ return "\u4EC5\u53EF\u9884\u7EA6 ".concat(count, " \u4E2A\uFF0C\u8BF7\u51CF\u5C11\u6570\u91CF");
507
+ },
500
508
  'pisell2.text.payment-link': "付款链接",
501
509
  'pisell2.text.send-mail': "发送邮件",
502
510
  'pisell2.text.copy-to-clipboard': "复制到剪切板",
@@ -820,6 +828,10 @@ export default {
820
828
  'pisell2.text.deposit-delete-message': "刪除後不可恢復,請確認操作",
821
829
  'pisell2.text.deposit-paid': "已付定金",
822
830
  "pisell2.text.stock": "庫存",
831
+ 'pisell2.appointment.unuse.stock': "庫存不足",
832
+ 'pisell2.appointment.unuse.capacity': function pisell2AppointmentUnuseCapacity(count) {
833
+ return "\u50C5\u53EF\u9810\u7D04 ".concat(count, " \u500B\uFF0C\u8ACB\u6E1B\u5C11\u6578\u91CF");
834
+ },
823
835
  'pisell2.text.payment-link': "付款鏈接",
824
836
  'pisell2.text.send-mail': "發送郵件",
825
837
  'pisell2.text.copy-to-clipboard': "複製到剪切板",
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  declare const _default: ({ input, ...formItemProps }: any) => JSX.Element;
3
2
  export default _default;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { RadioGroupProps } from 'antd';
3
2
  export declare const CheckboxGroup: ({ direction, options, ...props }: any) => JSX.Element;
4
3
  export declare const RadioGroup: ({ direction, options, ...props }: RadioGroupProps & {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare const _default: ({ color }: {
3
2
  color?: string | undefined;
4
3
  }) => JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare const _default: ({ color }: {
3
2
  color?: string | undefined;
4
3
  }) => JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  /**
3
2
  * @title: 自定义组件设置
4
3
  * @description: 自定义组件设置
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  declare const _default: () => JSX.Element;
3
2
  export default _default;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './titlebar.less';
3
2
  declare enum EPopupTitleBarVariantType {
4
3
  BackTitleClose = "back-title-cancel",
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { StatusType } from '../../const';
3
2
  declare const _default: (props: {
4
3
  status: StatusType;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare const _default: (props: {
3
2
  status: string;
4
3
  pedding?: string;
@@ -19,7 +19,7 @@ export declare const useStoreRef: <T extends {
19
19
  readonly netRef: React.MutableRefObject<boolean | undefined>;
20
20
  readonly symbolRef: React.MutableRefObject<string>;
21
21
  readonly amountRef: React.MutableRefObject<string | number>;
22
- readonly eftposRef: React.MutableRefObject<"stripe" | "tyro" | "windcave" | "payo" | "linkly">;
22
+ readonly eftposRef: React.MutableRefObject<"stripe" | "payo" | "tyro" | "windcave" | "linkly">;
23
23
  readonly clientRef: React.MutableRefObject<ClientEnum>;
24
24
  readonly dataRef: React.MutableRefObject<import("./store").State>;
25
25
  };
@@ -297,7 +297,7 @@ export declare const backUpFree: (payload: Partial<State>) => {
297
297
  amount?: string | number | undefined;
298
298
  mode?: "refund" | "pay" | "fullPay" | "query" | undefined;
299
299
  order_id?: string | number | undefined;
300
- eftpos?: "stripe" | "tyro" | "windcave" | "payo" | "linkly" | undefined;
300
+ eftpos?: "stripe" | "payo" | "tyro" | "windcave" | "linkly" | undefined;
301
301
  action?: "amount" | "pay" | "deviceList" | undefined;
302
302
  key?: number | undefined;
303
303
  step?: number | undefined;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  /**
3
2
  * @title: 获取 Tyro 资源
4
3
  * @description:
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  declare const ErrorTip: ({ text }: any) => JSX.Element;
4
3
  export default ErrorTip;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  declare const InformationOptionsModal: (props: any) => JSX.Element;
4
3
  export default InformationOptionsModal;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  declare const WeekItem: (props: any) => JSX.Element;
4
3
  export default WeekItem;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  declare type CalenDateWeekProps = {
4
3
  currentDate: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  declare const DayItem: (props: any) => JSX.Element;
4
3
  export default DayItem;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  import { CalendarItemProps } from '../../../../../type';
4
3
  declare const Item: (props: CalendarItemProps) => JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  declare const SetupForm: ({ onReady, amount, order_id, payment_method, scene, }: any) => JSX.Element;
4
3
  export default SetupForm;
@@ -46,5 +46,5 @@ export var getDataByIds = function getDataByIds(arr, ids) {
46
46
  * @returns
47
47
  */
48
48
  export var getIsWalletCode = function getIsWalletCode(val) {
49
- return val.startsWith('WL') || val.startsWith('2') && val.length === 10;
49
+ return val.startsWith('WL');
50
50
  };
@@ -17,6 +17,6 @@ declare let modal: Omit<ModalStaticFunctions, "warn">;
17
17
  export declare const setModal: (m: Omit<ModalStaticFunctions, "warn">) => void;
18
18
  export declare const saveConfirm: () => Promise<{
19
19
  destroy: () => void;
20
- update: (configUpdate: import("antd/es/modal/interface").ModalFuncProps | ((prevConfig: import("antd/es/modal/interface").ModalFuncProps) => import("antd/es/modal/interface").ModalFuncProps)) => void;
20
+ update: (configUpdate: import("antd").ModalFuncProps | ((prevConfig: import("antd").ModalFuncProps) => import("antd").ModalFuncProps)) => void;
21
21
  }>;
22
22
  export { modal };
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { Modal as AntModal, ModalFuncProps as AntModalFuncProps, ModalProps as AntModalProps } from 'antd';
3
2
  import './index.less';
4
3
  interface ModalProps extends AntModalProps {
@@ -18,6 +18,6 @@ declare let modal: Omit<ModalStaticFunctions, 'warn'>;
18
18
  export declare const setModal: (m: Omit<ModalStaticFunctions, 'warn'>) => void;
19
19
  export declare const saveConfirm: () => Promise<{
20
20
  destroy: () => void;
21
- update: (configUpdate: import("antd/es/modal/interface").ModalFuncProps | ((prevConfig: import("antd/es/modal/interface").ModalFuncProps) => import("antd/es/modal/interface").ModalFuncProps)) => void;
21
+ update: (configUpdate: import("antd").ModalFuncProps | ((prevConfig: import("antd").ModalFuncProps) => import("antd").ModalFuncProps)) => void;
22
22
  }>;
23
23
  export { modal };
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  declare const GuestOptionsModal: (props: any) => JSX.Element;
4
3
  export default GuestOptionsModal;
@@ -95,20 +95,27 @@ var Services = (0, import_react.forwardRef)((props, ref) => {
95
95
  delete product.option;
96
96
  if (isRetailTemplate) {
97
97
  if (data == null ? void 0 : data.isCancel) return;
98
- appointmentBooking.storeProduct(product);
98
+ const res = appointmentBooking.storeProduct(product);
99
+ if (!res.success && res.errorCode === "not_enough_stock") {
100
+ return (0, import_utils2.Toast)(import_utils.locales.getText("pisell2.appointment.unuse.stock"));
101
+ }
99
102
  return;
100
103
  }
101
104
  const session = data == null ? void 0 : data.session;
102
105
  if (session) {
103
106
  const startDate = (0, import_dayjs.default)(session == null ? void 0 : session.start_at).format("YYYY-MM-DD");
104
107
  const endDate = (0, import_dayjs.default)(session == null ? void 0 : session.end_at).format("YYYY-MM-DD");
105
- appointmentBooking.addProductToCart({
108
+ const res = appointmentBooking.addProductToCart({
106
109
  product: { ...product },
107
110
  date: {
108
111
  startTime: `${startDate} ${session == null ? void 0 : session.start_time}`,
109
112
  endTime: `${endDate} ${session == null ? void 0 : session.end_time}`
110
113
  }
111
114
  });
115
+ if (!res.success && res.errorCode === "not_enough_stock") {
116
+ return (0, import_utils2.Toast)(import_utils.locales.getText("pisell2.appointment.unuse.stock"));
117
+ }
118
+ appointmentBooking.closeProductDetail();
112
119
  await appointmentBooking.getAvailableDate({
113
120
  startDate,
114
121
  endDate
@@ -121,7 +128,10 @@ var Services = (0, import_react.forwardRef)((props, ref) => {
121
128
  import_utils.locales.getText("pisell2.appointment.no.available.service")
122
129
  );
123
130
  }
124
- appointmentBooking.storeProduct(product);
131
+ const res = appointmentBooking.storeProduct(product);
132
+ if (!res.success && res.errorCode === "not_enough_stock") {
133
+ return (0, import_utils2.Toast)(import_utils.locales.getText("pisell2.appointment.unuse.stock"));
134
+ }
125
135
  if (type === "duration") {
126
136
  await appointmentBooking.getAvailableDate();
127
137
  }
@@ -189,6 +189,12 @@ var useAppointmentBookingStep = () => {
189
189
  if (!result) {
190
190
  return (0, import_utils2.Toast)(import_utils.locales.getText("pisell2.appointment.unuse.date"));
191
191
  }
192
+ const capacityResult = appointmentBooking.checkMaxDurationCapacity();
193
+ if (!capacityResult.success) {
194
+ const getMessage = import_utils.locales.getText("pisell2.appointment.unuse.capacity");
195
+ const message = typeof getMessage === "function" ? getMessage(capacityResult.minAvailableCount) : getMessage;
196
+ return (0, import_utils2.Toast)(message);
197
+ }
192
198
  }
193
199
  if (!isRetailTemplate && (currentKey == null ? void 0 : currentKey.startsWith("select-resource"))) {
194
200
  const { hasError, updatedCartList } = (0, import_utils2.checkAndMarkCartRenderError)(currentSelectedResources, appointmentBooking, utils);
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  declare const FormItemChildrenWrap: (props: any) => JSX.Element;
3
2
  export default FormItemChildrenWrap;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  declare const useIsLowSpeedNetwork: () => import("react").MutableRefObject<boolean>;
3
2
  export default useIsLowSpeedNetwork;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import "./index.less";
3
2
  declare const Like: ({ status, onChange, className, style, }: {
4
3
  style?: any;
@@ -156,6 +156,8 @@ declare const _default: {
156
156
  'pisell2.text.deposit-delete-message': string;
157
157
  'pisell2.text.deposit-paid': string;
158
158
  "pisell2.text.stock": string;
159
+ 'pisell2.appointment.unuse.stock': string;
160
+ 'pisell2.appointment.unuse.capacity': (count: number) => string;
159
161
  'pisell2.text.payment-link': string;
160
162
  'pisell2.text.send-mail': string;
161
163
  'pisell2.text.copy-to-clipboard': string;
@@ -432,6 +434,8 @@ declare const _default: {
432
434
  'pisell2.text.deposit-delete-message': string;
433
435
  'pisell2.text.deposit-paid': string;
434
436
  "pisell2.text.stock": string;
437
+ 'pisell2.appointment.unuse.stock': string;
438
+ 'pisell2.appointment.unuse.capacity': (count: number) => string;
435
439
  'pisell2.text.payment-link': string;
436
440
  'pisell2.text.send-mail': string;
437
441
  'pisell2.text.copy-to-clipboard': string;
@@ -708,6 +712,8 @@ declare const _default: {
708
712
  'pisell2.text.deposit-delete-message': string;
709
713
  'pisell2.text.deposit-paid': string;
710
714
  "pisell2.text.stock": string;
715
+ 'pisell2.appointment.unuse.stock': string;
716
+ 'pisell2.appointment.unuse.capacity': (count: number) => string;
711
717
  'pisell2.text.payment-link': string;
712
718
  'pisell2.text.send-mail': string;
713
719
  'pisell2.text.copy-to-clipboard': string;
@@ -200,6 +200,8 @@ var locales_default = {
200
200
  "pisell2.text.deposit-delete-message": "It cannot be restored after deletion. Please confirm the operation.",
201
201
  "pisell2.text.deposit-paid": "Deposit paid",
202
202
  "pisell2.text.stock": "Stock",
203
+ "pisell2.appointment.unuse.stock": "Not enough stock",
204
+ "pisell2.appointment.unuse.capacity": (count) => `Only ${count} spots available. Please reduce quantity.`,
203
205
  "pisell2.text.payment-link": "Payment link",
204
206
  "pisell2.text.send-mail": "Send email",
205
207
  "pisell2.text.copy-to-clipboard": "Copy to clipboard",
@@ -508,6 +510,8 @@ var locales_default = {
508
510
  "pisell2.text.deposit-delete-message": "删除后不可恢复,请确认操作",
509
511
  "pisell2.text.deposit-paid": "已付定金",
510
512
  "pisell2.text.stock": "库存",
513
+ "pisell2.appointment.unuse.stock": "库存不足",
514
+ "pisell2.appointment.unuse.capacity": (count) => `仅可预约 ${count} 个,请减少数量`,
511
515
  "pisell2.text.payment-link": "付款链接",
512
516
  "pisell2.text.send-mail": "发送邮件",
513
517
  "pisell2.text.copy-to-clipboard": "复制到剪切板",
@@ -816,6 +820,8 @@ var locales_default = {
816
820
  "pisell2.text.deposit-delete-message": "刪除後不可恢復,請確認操作",
817
821
  "pisell2.text.deposit-paid": "已付定金",
818
822
  "pisell2.text.stock": "庫存",
823
+ "pisell2.appointment.unuse.stock": "庫存不足",
824
+ "pisell2.appointment.unuse.capacity": (count) => `僅可預約 ${count} 個,請減少數量`,
819
825
  "pisell2.text.payment-link": "付款鏈接",
820
826
  "pisell2.text.send-mail": "發送郵件",
821
827
  "pisell2.text.copy-to-clipboard": "複製到剪切板",
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  declare const _default: ({ input, ...formItemProps }: any) => JSX.Element;
3
2
  export default _default;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { RadioGroupProps } from 'antd';
3
2
  export declare const CheckboxGroup: ({ direction, options, ...props }: any) => JSX.Element;
4
3
  export declare const RadioGroup: ({ direction, options, ...props }: RadioGroupProps & {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare const _default: ({ color }: {
3
2
  color?: string | undefined;
4
3
  }) => JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare const _default: ({ color }: {
3
2
  color?: string | undefined;
4
3
  }) => JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  /**
3
2
  * @title: 自定义组件设置
4
3
  * @description: 自定义组件设置
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  declare const _default: () => JSX.Element;
3
2
  export default _default;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './titlebar.less';
3
2
  declare enum EPopupTitleBarVariantType {
4
3
  BackTitleClose = "back-title-cancel",
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { StatusType } from '../../const';
3
2
  declare const _default: (props: {
4
3
  status: StatusType;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare const _default: (props: {
3
2
  status: string;
4
3
  pedding?: string;
@@ -19,7 +19,7 @@ export declare const useStoreRef: <T extends {
19
19
  readonly netRef: React.MutableRefObject<boolean | undefined>;
20
20
  readonly symbolRef: React.MutableRefObject<string>;
21
21
  readonly amountRef: React.MutableRefObject<string | number>;
22
- readonly eftposRef: React.MutableRefObject<"stripe" | "tyro" | "windcave" | "payo" | "linkly">;
22
+ readonly eftposRef: React.MutableRefObject<"stripe" | "payo" | "tyro" | "windcave" | "linkly">;
23
23
  readonly clientRef: React.MutableRefObject<ClientEnum>;
24
24
  readonly dataRef: React.MutableRefObject<import("./store").State>;
25
25
  };
@@ -297,7 +297,7 @@ export declare const backUpFree: (payload: Partial<State>) => {
297
297
  amount?: string | number | undefined;
298
298
  mode?: "refund" | "pay" | "fullPay" | "query" | undefined;
299
299
  order_id?: string | number | undefined;
300
- eftpos?: "stripe" | "tyro" | "windcave" | "payo" | "linkly" | undefined;
300
+ eftpos?: "stripe" | "payo" | "tyro" | "windcave" | "linkly" | undefined;
301
301
  action?: "amount" | "pay" | "deviceList" | undefined;
302
302
  key?: number | undefined;
303
303
  step?: number | undefined;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  /**
3
2
  * @title: 获取 Tyro 资源
4
3
  * @description:
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  declare const ErrorTip: ({ text }: any) => JSX.Element;
4
3
  export default ErrorTip;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  declare const InformationOptionsModal: (props: any) => JSX.Element;
4
3
  export default InformationOptionsModal;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  declare const WeekItem: (props: any) => JSX.Element;
4
3
  export default WeekItem;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  declare type CalenDateWeekProps = {
4
3
  currentDate: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  declare const DayItem: (props: any) => JSX.Element;
4
3
  export default DayItem;