@pisell/private-materials 3.4.1 → 3.4.3

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 (125) 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 +13 -13
  7. package/build/lowcode/render/default/view.js +4 -4
  8. package/build/lowcode/view.js +7 -7
  9. package/es/components/booking/addons/model.d.ts +1 -10
  10. package/es/components/booking/components/TabProduct/tabs/index.js +5 -1
  11. package/es/components/booking/components/browserSelect/index.js +1 -1
  12. package/es/components/booking/forms/model.d.ts +1 -10
  13. package/es/components/booking/forms/model.js +5 -5
  14. package/es/components/booking/info/model.d.ts +1 -10
  15. package/es/components/booking/info/service/like/index.js +1 -1
  16. package/es/components/booking/info2/index.js +6 -4
  17. package/es/components/booking/materiels/startTime/index.js +1 -1
  18. package/es/components/booking/model.d.ts +1 -9
  19. package/es/components/booking/notes/NoteBlock/NoteItem/index.js +1 -1
  20. package/es/components/booking/notes/NoteBlock/index.js +11 -11
  21. package/es/components/booking/notes/model.d.ts +1 -10
  22. package/es/components/booking/notes/model.js +5 -5
  23. package/es/components/booking/payments/model.d.ts +1 -10
  24. package/es/components/booking/payments/model.js +5 -5
  25. package/es/components/listComponent/index.js +5 -5
  26. package/es/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +44 -18
  27. package/es/components/pay/toC/PaymentMethods/index.js +70 -21
  28. package/es/components/pay/toC/index.js +46 -14
  29. package/es/components/pay/toC/model.d.ts +1 -9
  30. package/es/components/productExtension/card/index.js +3 -3
  31. package/es/components/productExtension/fields/Actor/CutOffTime/index.js +1 -1
  32. package/es/components/productExtension/fields/Forms/index.js +12 -12
  33. package/es/components/productExtension/fields/SelectProducts/ProductItemPreview/index.js +1 -1
  34. package/es/components/productExtension/fields/SelectProducts/server.js +2 -2
  35. package/es/components/productExtension/fields/SelectResourcesTable/server.js +2 -2
  36. package/es/components/productExtension/server.js +2 -2
  37. package/es/components/ruleSetting/ruleBorder/index.js +1 -1
  38. package/es/components/schedules/calendar/index.js +4 -4
  39. package/es/components/schedules/calendar/serve.js +2 -2
  40. package/es/components/schedules/components/CurrentDay/index.js +5 -5
  41. package/es/components/schedules/components/CurrentDay/serve.js +2 -2
  42. package/es/components/schedules/components/DropdownSort/index.js +1 -1
  43. package/es/components/schedules/components/ResourceList/index.js +1 -1
  44. package/es/components/schedules/components/Search/index.js +5 -5
  45. package/es/components/schedules/model.d.ts +1 -9
  46. package/es/components/schedules/model.js +5 -5
  47. package/es/components/schedules/openHours/index.js +1 -1
  48. package/es/components/schedules/openHours/serve.js +2 -2
  49. package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/MaxParticipantsModule/index.js +1 -1
  50. package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/ResourcesModule/index.js +5 -5
  51. package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/SchedulesModule/index.js +4 -4
  52. package/es/components/schedules/products/ProductDetailDrawer/index.js +3 -3
  53. package/es/components/schedules/products/serve.js +2 -2
  54. package/es/components/schedules/products/utils.js +5 -5
  55. package/es/components/schedules/resources/detail/detailContent.js +2 -2
  56. package/es/components/schedules/resources/detail/index.js +10 -10
  57. package/es/components/schedules/resources/list/index.js +2 -2
  58. package/es/components/schedules/resources/relationProduct/index.js +1 -1
  59. package/es/components/schedules/resources/serve.js +2 -2
  60. package/es/components/schedules/schedules/ScheduleDetailDrawer/index.js +9 -9
  61. package/es/components/schedules/utils.d.ts +1 -1
  62. package/es/components/schedules/utils.js +4 -4
  63. package/es/components/selectModal/index.js +2 -2
  64. package/es/components/ticketBooking/components/ticketBooking/index.js +121 -2
  65. package/es/components/ticketBooking/locales.js +195 -147
  66. package/es/components/ticketBooking/utils/formatProductMessage.d.ts +2 -0
  67. package/es/components/ticketBooking/utils/formatProductMessage.js +62 -0
  68. package/es/components/ticketBooking/utils/formatTime.d.ts +31 -0
  69. package/es/components/ticketBooking/utils/formatTime.js +144 -0
  70. package/es/components/wallet/Detail/model.d.ts +1 -13
  71. package/es/components/wallet/DiscountCard/model.d.ts +1 -14
  72. package/es/components/wallet/PointCard/model.d.ts +1 -13
  73. package/es/components/wallet/RechargeableCard/model.d.ts +1 -29
  74. package/es/components/wallet/Voucher/model.d.ts +1 -13
  75. package/es/components/wallet/model.d.ts +1 -9
  76. package/es/hooks/useComponents.js +1 -1
  77. package/es/utils/index.d.ts +1 -1
  78. package/lib/components/booking/addons/model.d.ts +1 -10
  79. package/lib/components/booking/forms/model.d.ts +1 -10
  80. package/lib/components/booking/info/model.d.ts +1 -10
  81. package/lib/components/booking/info2/index.js +21 -11
  82. package/lib/components/booking/model.d.ts +1 -9
  83. package/lib/components/booking/notes/model.d.ts +1 -10
  84. package/lib/components/booking/payments/model.d.ts +1 -10
  85. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +66 -47
  86. package/lib/components/pay/toC/PaymentMethods/index.js +30 -2
  87. package/lib/components/pay/toC/index.js +29 -9
  88. package/lib/components/pay/toC/model.d.ts +1 -9
  89. package/lib/components/schedules/model.d.ts +1 -9
  90. package/lib/components/schedules/utils.d.ts +1 -1
  91. package/lib/components/schedules/utils.js +1 -1
  92. package/lib/components/ticketBooking/components/ticketBooking/index.js +141 -22
  93. package/lib/components/ticketBooking/locales.js +22 -4
  94. package/lib/components/ticketBooking/utils/formatProductMessage.d.ts +2 -0
  95. package/lib/components/ticketBooking/utils/formatProductMessage.js +84 -0
  96. package/lib/components/ticketBooking/utils/formatTime.d.ts +31 -0
  97. package/lib/components/ticketBooking/utils/formatTime.js +139 -0
  98. package/lib/components/wallet/Detail/model.d.ts +1 -13
  99. package/lib/components/wallet/DiscountCard/model.d.ts +1 -14
  100. package/lib/components/wallet/PointCard/model.d.ts +1 -13
  101. package/lib/components/wallet/RechargeableCard/model.d.ts +1 -29
  102. package/lib/components/wallet/Voucher/model.d.ts +1 -13
  103. package/lib/components/wallet/model.d.ts +1 -9
  104. package/lib/utils/index.d.ts +1 -1
  105. package/package.json +3 -3
  106. package/es/components/Sales/Customer/index.d.ts +0 -25
  107. package/es/components/appointmentBooking/components/Form/index.d.ts +0 -4
  108. package/es/components/appointmentBooking/components/Form/utils.d.ts +0 -8
  109. package/es/components/booking/info/service/Lists.d.ts +0 -2
  110. package/es/components/booking/info2/service/index.d.ts +0 -4
  111. package/es/components/booking/info2/utils.d.ts +0 -4
  112. package/es/components/pay/toC/PaymentMethods/WalletPass/serve.d.ts +0 -113
  113. package/es/components/pay/toC/utils.d.ts +0 -57
  114. package/es/components/shoppingCart/components/Cart/Product.d.ts +0 -3
  115. package/es/components/ticketBooking/locales.d.ts +0 -153
  116. package/lib/components/Sales/Customer/index.d.ts +0 -25
  117. package/lib/components/appointmentBooking/components/Form/index.d.ts +0 -4
  118. package/lib/components/appointmentBooking/components/Form/utils.d.ts +0 -8
  119. package/lib/components/booking/info/service/Lists.d.ts +0 -2
  120. package/lib/components/booking/info2/service/index.d.ts +0 -4
  121. package/lib/components/booking/info2/utils.d.ts +0 -4
  122. package/lib/components/pay/toC/PaymentMethods/WalletPass/serve.d.ts +0 -113
  123. package/lib/components/pay/toC/utils.d.ts +0 -57
  124. package/lib/components/shoppingCart/components/Cart/Product.d.ts +0 -3
  125. package/lib/components/ticketBooking/locales.d.ts +0 -153
@@ -46,6 +46,9 @@ var import_utils2 = require("../../utils");
46
46
  var import_addServiceVariant = __toESM(require("../addServiceVariant"));
47
47
  var import_timeBar = __toESM(require("../timeBar"));
48
48
  var import_index = require("./index.less");
49
+ var import_utils3 = require("../../../booking/info/service2/utils");
50
+ var import_amount = require("../../../booking/components/footer/amount");
51
+ var import_formatProductMessage = __toESM(require("../../utils/formatProductMessage"));
49
52
  var _formatBookingDetail = (data, modalState) => {
50
53
  var _a, _b, _c, _d;
51
54
  let {
@@ -185,18 +188,28 @@ var _formatBookingDetail = (data, modalState) => {
185
188
  };
186
189
  };
187
190
  var TicketBooking = () => {
188
- var _a;
191
+ var _a, _b, _c;
189
192
  const [state, setState] = (0, import_miniRedux.useStore)();
190
193
  const engineContext = (0, import_useEngineContext.default)();
191
194
  const { props: engineProps } = engineContext.engine;
192
- const { action, isTerminal, lowcodeRef, interaction, store, storage, Toast } = (_a = engineContext.appHelper) == null ? void 0 : _a.utils;
195
+ const {
196
+ action,
197
+ isTerminal,
198
+ lowcodeRef,
199
+ interaction,
200
+ store,
201
+ storage,
202
+ Toast,
203
+ getSymbolic,
204
+ translation
205
+ } = (_a = engineContext.appHelper) == null ? void 0 : _a.utils;
193
206
  const _persistentRef = (0, import_react.useRef)(false);
194
207
  const _initStateRef = (0, import_react.useRef)({});
195
208
  const _listTimerRef = (0, import_react.useRef)();
196
209
  const _timerRef = (0, import_react.useRef)();
197
210
  const _callbackFnRef = (0, import_react.useRef)();
198
211
  (0, import_react.useEffect)(() => {
199
- var _a2, _b, _c, _d, _e, _f;
212
+ var _a2, _b2, _c2, _d, _e, _f;
200
213
  _persistentRef.current = storage.get(`drawer-booking`) === "true" ? true : isTerminal();
201
214
  if (lowcodeRef) {
202
215
  lowcodeRef.onReady(void 0);
@@ -221,7 +234,7 @@ var TicketBooking = () => {
221
234
  });
222
235
  setState(
223
236
  {
224
- amountSymbol: ((_d = (_c = (_b = store == null ? void 0 : store.getState) == null ? void 0 : _b.call(store)) == null ? void 0 : _c.global) == null ? void 0 : _d.symbol) || "$"
237
+ amountSymbol: ((_d = (_c2 = (_b2 = store == null ? void 0 : store.getState) == null ? void 0 : _b2.call(store)) == null ? void 0 : _c2.global) == null ? void 0 : _d.symbol) || "$"
225
238
  },
226
239
  () => {
227
240
  _initStateRef.current = JSON.parse(JSON.stringify(state));
@@ -276,14 +289,120 @@ var TicketBooking = () => {
276
289
  intervalSetTime: isInterval
277
290
  });
278
291
  };
292
+ (0, import_react.useEffect)(() => {
293
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j;
294
+ const cartItems = (_b2 = (_a2 = state == null ? void 0 : state.modalState) == null ? void 0 : _a2.service) == null ? void 0 : _b2.value;
295
+ if (!Array.isArray(cartItems) || cartItems.length === 0) {
296
+ (_d = (_c2 = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _c2.postMessageToApp) == null ? void 0 : _d.call(_c2, {
297
+ module: "cds",
298
+ key: "cartUpdate",
299
+ data: {
300
+ currency_symbol: getSymbolic(),
301
+ total: "0",
302
+ // 小计
303
+ products: [],
304
+ fees: []
305
+ }
306
+ });
307
+ }
308
+ const total = (0, import_amount.getSumTotal)(state.modalState, true);
309
+ let formatedProducts = [];
310
+ try {
311
+ formatedProducts = (0, import_utils3.formatProducts)(
312
+ cartItems,
313
+ state.modalState,
314
+ false,
315
+ true,
316
+ true
317
+ );
318
+ } catch (error) {
319
+ console.error(error);
320
+ }
321
+ console.log("formatedProducts", total, formatedProducts);
322
+ let fees = [];
323
+ let products = [];
324
+ for (const item of formatedProducts) {
325
+ const { id, name, image, origin_total, total: total2, num, note, _origin } = item;
326
+ (_e = _origin == null ? void 0 : _origin.discount_list) == null ? void 0 : _e.forEach((dl) => {
327
+ fees.push({
328
+ isReduce: dl.type === "good_pass",
329
+ title: translation(dl == null ? void 0 : dl.discount.title),
330
+ price: dl.amount,
331
+ type: dl.type
332
+ });
333
+ });
334
+ let msg = "";
335
+ try {
336
+ msg = (0, import_formatProductMessage.default)(
337
+ {
338
+ ...item,
339
+ currency_symbol: getSymbolic()
340
+ },
341
+ (_f = engineContext.appHelper) == null ? void 0 : _f.utils
342
+ );
343
+ } catch (error) {
344
+ console.error(error);
345
+ }
346
+ let _item = {
347
+ productID: id,
348
+ title: name,
349
+ cover: image,
350
+ // 封面图
351
+ price: total2,
352
+ // 售价
353
+ buyCount: num,
354
+ // 购买数量
355
+ productFormatMessage: msg,
356
+ note
357
+ };
358
+ if (origin_total !== total2) _item.modifyPrice = origin_total;
359
+ products.push(_item);
360
+ }
361
+ console.log(
362
+ "formatedProducts",
363
+ (_g = import_utils.locales.getText("pisell2.product.card.cart-items")) == null ? void 0 : _g(products.length)
364
+ );
365
+ if (products.length > 0) {
366
+ fees.unshift({
367
+ title: import_utils.locales.getText("pisell2.product.card.subtotal"),
368
+ price: total.productAmount,
369
+ type: "subtotal",
370
+ message: (_h = import_utils.locales.getText("pisell2.product.card.cart-items")) == null ? void 0 : _h(
371
+ products.length
372
+ )
373
+ });
374
+ }
375
+ console.log("start post message, config:", {
376
+ module: "cds",
377
+ key: "cartUpdate",
378
+ data: {
379
+ currency_symbol: getSymbolic(),
380
+ total: total.productAmount,
381
+ // 小计
382
+ products,
383
+ fees
384
+ }
385
+ });
386
+ (_j = (_i = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _i.postMessageToApp) == null ? void 0 : _j.call(_i, {
387
+ module: "cds",
388
+ key: "cartUpdate",
389
+ data: {
390
+ currency_symbol: getSymbolic(),
391
+ total: total.expectAmount,
392
+ // 小计
393
+ products,
394
+ fees
395
+ }
396
+ });
397
+ }, [(_c = (_b = state == null ? void 0 : state.modalState) == null ? void 0 : _b.service) == null ? void 0 : _c.value]);
279
398
  const _setModalState = (props) => {
280
- var _a2, _b;
399
+ var _a2, _b2;
281
400
  console.log("同步state到外层", props);
282
401
  let newVal = { ...props };
283
402
  if (newVal.service) {
284
403
  newVal.service.value = ((_a2 = newVal == null ? void 0 : newVal.service) == null ? void 0 : _a2.value) || [];
285
404
  }
286
- console.log((_b = newVal == null ? void 0 : newVal.service) == null ? void 0 : _b.value, "newVal.service.value");
405
+ console.log((_b2 = newVal == null ? void 0 : newVal.service) == null ? void 0 : _b2.value, "newVal.service.value");
287
406
  setState({
288
407
  modalState: {
289
408
  ...state.modalState,
@@ -310,10 +429,10 @@ var TicketBooking = () => {
310
429
  }
311
430
  });
312
431
  setTimeout(() => {
313
- var _a2, _b, _c, _d, _e;
314
- if ((_b = (_a2 = state.modalState.service) == null ? void 0 : _a2.value) == null ? void 0 : _b.length) {
315
- let _list = (_e = (_c = state.bookingFunctions) == null ? void 0 : _c.updateServiceDate) == null ? void 0 : _e.call(
316
- _c,
432
+ var _a2, _b2, _c2, _d, _e;
433
+ if ((_b2 = (_a2 = state.modalState.service) == null ? void 0 : _a2.value) == null ? void 0 : _b2.length) {
434
+ let _list = (_e = (_c2 = state.bookingFunctions) == null ? void 0 : _c2.updateServiceDate) == null ? void 0 : _e.call(
435
+ _c2,
317
436
  (_d = state.modalState.service) == null ? void 0 : _d.value,
318
437
  date,
319
438
  false
@@ -329,8 +448,8 @@ var TicketBooking = () => {
329
448
  }, 100);
330
449
  };
331
450
  const _setShopOpeningHours = () => {
332
- var _a2, _b, _c, _d, _e;
333
- let time = (_e = (_d = (_c = (_b = (_a2 = store == null ? void 0 : store.getState) == null ? void 0 : _a2.call(store)) == null ? void 0 : _b.global) == null ? void 0 : _c.shopDetail) == null ? void 0 : _d.operating_day_boundary) == null ? void 0 : _e.time;
451
+ var _a2, _b2, _c2, _d, _e;
452
+ let time = (_e = (_d = (_c2 = (_b2 = (_a2 = store == null ? void 0 : store.getState) == null ? void 0 : _a2.call(store)) == null ? void 0 : _b2.global) == null ? void 0 : _c2.shopDetail) == null ? void 0 : _d.operating_day_boundary) == null ? void 0 : _e.time;
334
453
  if (time) {
335
454
  localStorage.setItem("shopOpeningHours", time);
336
455
  }
@@ -347,12 +466,12 @@ var TicketBooking = () => {
347
466
  });
348
467
  };
349
468
  const _getBoardConfig = async () => {
350
- var _a2, _b, _c;
469
+ var _a2, _b2, _c2;
351
470
  const { bookingConfigParams } = state;
352
471
  const data = await (0, import_serve.getBookingConfig)({
353
472
  ...bookingConfigParams
354
473
  });
355
- if ((_c = (_b = (_a2 = data == null ? void 0 : data.config) == null ? void 0 : _a2.information_tab) == null ? void 0 : _b.appointment_card) == null ? void 0 : _c.quick_time) {
474
+ if ((_c2 = (_b2 = (_a2 = data == null ? void 0 : data.config) == null ? void 0 : _a2.information_tab) == null ? void 0 : _b2.appointment_card) == null ? void 0 : _c2.quick_time) {
356
475
  _getAddTimeProducts();
357
476
  }
358
477
  setState({
@@ -446,7 +565,7 @@ var TicketBooking = () => {
446
565
  }
447
566
  };
448
567
  const _initBookingData = (type, data) => {
449
- var _a2, _b, _c, _d, _e, _f, _g;
568
+ var _a2, _b2, _c2, _d, _e, _f, _g;
450
569
  let initState = _getInitState({
451
570
  bookingDetail: null,
452
571
  bookingConfig: state.bookingConfig,
@@ -468,14 +587,14 @@ var TicketBooking = () => {
468
587
  if (type === "create") {
469
588
  if ((_a2 = data == null ? void 0 : data.serviceParams) == null ? void 0 : _a2.start_date) {
470
589
  initState.modalState.date.value = (0, import_dayjs.default)(
471
- (_b = data == null ? void 0 : data.serviceParams) == null ? void 0 : _b.start_date
590
+ (_b2 = data == null ? void 0 : data.serviceParams) == null ? void 0 : _b2.start_date
472
591
  );
473
592
  sessionStorage.setItem(
474
593
  "pisell2.booking.serviceParams",
475
594
  JSON.stringify(data)
476
595
  );
477
596
  } else {
478
- let timezone = (_f = (_e = (_d = (_c = store == null ? void 0 : store.getState) == null ? void 0 : _c.call(store)) == null ? void 0 : _d.global) == null ? void 0 : _e.globalConfig) == null ? void 0 : _f.timezone;
597
+ let timezone = (_f = (_e = (_d = (_c2 = store == null ? void 0 : store.getState) == null ? void 0 : _c2.call(store)) == null ? void 0 : _d.global) == null ? void 0 : _e.globalConfig) == null ? void 0 : _f.timezone;
479
598
  initState.modalState.date.value = import_dayjs.default.tz(/* @__PURE__ */ new Date(), timezone);
480
599
  sessionStorage.removeItem("pisell2.booking.serviceParams");
481
600
  }
@@ -493,9 +612,9 @@ var TicketBooking = () => {
493
612
  });
494
613
  };
495
614
  const _rebook = () => {
496
- var _a2, _b, _c;
615
+ var _a2, _b2, _c2;
497
616
  let date = (0, import_utils2.getNextTimeSlice)(
498
- ((_c = (_b = (_a2 = state.bookingConfig) == null ? void 0 : _a2.config) == null ? void 0 : _b.basic) == null ? void 0 : _c.service_time.value) || 10
617
+ ((_c2 = (_b2 = (_a2 = state.bookingConfig) == null ? void 0 : _a2.config) == null ? void 0 : _b2.basic) == null ? void 0 : _c2.service_time.value) || 10
499
618
  );
500
619
  setState({
501
620
  rebookState: {
@@ -583,7 +702,7 @@ var TicketBooking = () => {
583
702
  );
584
703
  };
585
704
  const _scanBookingDetailResult = async (detail) => {
586
- var _a2, _b, _c;
705
+ var _a2, _b2, _c2;
587
706
  (_a2 = Toast == null ? void 0 : Toast.loading) == null ? void 0 : _a2.call(Toast, import_utils.locales.getText("pisell2.ticket-booking.loading"), 6e4);
588
707
  let result = {};
589
708
  try {
@@ -591,7 +710,7 @@ var TicketBooking = () => {
591
710
  } catch (err) {
592
711
  }
593
712
  if (!(result == null ? void 0 : result.value)) {
594
- (_b = import_antd.message) == null ? void 0 : _b.error(
713
+ (_b2 = import_antd.message) == null ? void 0 : _b2.error(
595
714
  import_utils.locales.getText("pisell2.ticket-booking.appointment-not-found")
596
715
  );
597
716
  Toast == null ? void 0 : Toast.hide();
@@ -600,7 +719,7 @@ var TicketBooking = () => {
600
719
  const objDetail = await (0, import_serve.getOrderInfoByCode)({ code: result.value });
601
720
  Toast == null ? void 0 : Toast.hide();
602
721
  if (!(objDetail == null ? void 0 : objDetail.order_id) || (objDetail == null ? void 0 : objDetail.event_id) === 0) {
603
- (_c = import_antd.message) == null ? void 0 : _c.error(
722
+ (_c2 = import_antd.message) == null ? void 0 : _c2.error(
604
723
  import_utils.locales.getText("pisell2.ticket-booking.appointment-not-found")
605
724
  );
606
725
  return;
@@ -23,7 +23,7 @@ __export(locales_exports, {
23
23
  });
24
24
  module.exports = __toCommonJS(locales_exports);
25
25
  var locales_default = {
26
- "en": {
26
+ en: {
27
27
  "pisell2.ticket-booking.info": "Info",
28
28
  "pisell2.ticket-booking.notes": "Notes",
29
29
  "pisell2.ticket-booking.forms": "Forms",
@@ -71,7 +71,13 @@ var locales_default = {
71
71
  "pisell2.ticket-booking.add-to-cart": "Added to Cart",
72
72
  "pisell2.ticket-booking.not-available-title": "Sorry, Not available at current time.",
73
73
  "pisell2.ticket-booking.not-available-ok": "OK",
74
- "pisell2.ticket-booking.in-cart": (number) => `${number} in cart`
74
+ "pisell2.ticket-booking.in-cart": (number) => `${number} in cart`,
75
+ "pisell2.product.card.cart-items": (number) => `${number}items`,
76
+ "pisell2.product.card.subtotal": "Subtotal",
77
+ "pisell2.product.card.hour.minute": (hour, minute) => `${hour > 0 ? `${hour}h` : ""}${hour > 0 && minute > 0 ? " " : ""}${minute > 0 ? `${minute}min` : ""}`,
78
+ "pisell2.product.card.day": (val) => `${val > 1 ? " days" : " day"}`,
79
+ "pisell2.product.card.day.event": (val) => `${val > 1 ? " events" : " event"}`,
80
+ "pisell2.product.card.minute": (val) => `${val > 1 ? " minutes" : " minute"}`
75
81
  },
76
82
  "zh-CN": {
77
83
  "pisell2.ticket-booking.info": "信息",
@@ -121,7 +127,13 @@ var locales_default = {
121
127
  "pisell2.ticket-booking.add-to-cart": "已加入购物车",
122
128
  "pisell2.ticket-booking.not-available-title": "抱歉,目前不在可售时间。",
123
129
  "pisell2.ticket-booking.not-available-ok": "好的",
124
- "pisell2.ticket-booking.in-cart": (number) => `已有${number}件`
130
+ "pisell2.product.card.cart-items": (number) => `${number}件商品`,
131
+ "pisell2.product.card.subtotal": "小计",
132
+ "pisell2.ticket-booking.in-cart": (number) => `已有${number}件`,
133
+ "pisell2.product.card.hour.minute": (hour, minute) => `${hour > 0 ? `${hour}小时` : ""}${minute > 0 ? `${minute}分钟` : ""}`,
134
+ "pisell2.product.card.day": (val) => "天",
135
+ "pisell2.product.card.day.event": (val) => "个活动",
136
+ "pisell2.product.card.minute": (val) => "分钟"
125
137
  },
126
138
  "zh-HK": {
127
139
  "pisell2.ticket-booking.info": "資訊",
@@ -171,6 +183,12 @@ var locales_default = {
171
183
  "pisell2.ticket-booking.add-to-cart": "已加入购物车",
172
184
  "pisell2.ticket-booking.not-available-title": "抱歉,目前不在可售時間。",
173
185
  "pisell2.ticket-booking.not-available-ok": "好的",
174
- "pisell2.ticket-booking.in-cart": (number) => `已有${number}件`
186
+ "pisell2.ticket-booking.in-cart": (number) => `已有${number}件`,
187
+ "pisell2.product.card.cart-items": (number) => `${number}件商品`,
188
+ "pisell2.product.card.subtotal": "小計",
189
+ "pisell2.product.card.hour.minute": (hour, minute) => `${hour > 0 ? `${hour}小時` : ""}${minute > 0 ? `${minute}分鐘` : ""}`,
190
+ "pisell2.product.card.day": (val) => "天",
191
+ "pisell2.product.card.day.event": (val) => "个活動",
192
+ "pisell2.product.card.minute": (val) => "分鐘"
175
193
  }
176
194
  };
@@ -0,0 +1,2 @@
1
+ declare const formatProductMessage: (product: any, utils: any) => string;
2
+ export default formatProductMessage;
@@ -0,0 +1,84 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/components/ticketBooking/utils/formatProductMessage.ts
20
+ var formatProductMessage_exports = {};
21
+ __export(formatProductMessage_exports, {
22
+ default: () => formatProductMessage_default
23
+ });
24
+ module.exports = __toCommonJS(formatProductMessage_exports);
25
+ var import_utils = require("@pisell/utils");
26
+ var import_formatTime = require("./formatTime");
27
+ var formatProductMessage = (product, utils) => {
28
+ const {
29
+ product_option_string,
30
+ options,
31
+ bundle,
32
+ currency_symbol,
33
+ start_date,
34
+ end_date,
35
+ holder_id,
36
+ holders,
37
+ multiResources
38
+ } = product;
39
+ let str = "";
40
+ if (start_date && end_date) {
41
+ str += `${(0, import_formatTime.getServiceTime)(product, start_date, utils)}
42
+ `;
43
+ }
44
+ if (holder_id && Array.isArray(holders)) {
45
+ const targetHolder = holders.find((holder) => holder.id === holder_id);
46
+ if (targetHolder == null ? void 0 : targetHolder.label) {
47
+ str += `${targetHolder.label}
48
+ `;
49
+ }
50
+ }
51
+ if (Array.isArray(multiResources) && multiResources.length > 0) {
52
+ multiResources.forEach((resource) => {
53
+ const { id: ids, lists } = resource;
54
+ if (Array.isArray(ids)) {
55
+ ids.forEach((id) => {
56
+ const targetRes = lists.find((l) => l.id === id);
57
+ if (targetRes == null ? void 0 : targetRes.label) str += `${targetRes == null ? void 0 : targetRes.label}
58
+ `;
59
+ });
60
+ } else {
61
+ const targetRes = lists.find((l) => l.id === ids);
62
+ if (targetRes == null ? void 0 : targetRes.label) str += `${targetRes == null ? void 0 : targetRes.label}
63
+ `;
64
+ }
65
+ });
66
+ }
67
+ if (product_option_string) str += `${product_option_string}
68
+ `;
69
+ if (Array.isArray(options) && options.length) {
70
+ options.forEach((opt) => {
71
+ str += `${opt.name} ${(0, import_utils.formatAmount)(opt == null ? void 0 : opt.price, 2, currency_symbol)} x ${opt.num}
72
+ `;
73
+ });
74
+ }
75
+ if (Array.isArray(bundle) && bundle.length) {
76
+ bundle.forEach((item) => {
77
+ str += `${item.title}
78
+ `;
79
+ str += `${(0, import_utils.formatAmount)(item.price, 2, currency_symbol)} x ${item.num}`;
80
+ });
81
+ }
82
+ return str;
83
+ };
84
+ var formatProductMessage_default = formatProductMessage;
@@ -0,0 +1,31 @@
1
+ import 'dayjs/locale/zh-cn';
2
+ import 'dayjs/locale/en';
3
+ import 'dayjs/locale/zh-tw';
4
+ /**
5
+ * @title: 是否英文
6
+ * @description:
7
+ * @param {any} item
8
+ * @return {*}
9
+ * @Author: WangHan
10
+ * @Date: 2024-12-28 22:49
11
+ */
12
+ export declare const isEn: (item: any) => boolean;
13
+ /**
14
+ * @title: 跨日预约时间
15
+ * @description:
16
+ * @param {any} item
17
+ * @return {*}
18
+ * @Author: WangHan
19
+ * @Date: 2024-12-28 22:50
20
+ */
21
+ export declare const formatMultiDayDate: (item: any) => string;
22
+ /**
23
+ * @title: 格式化服务的 开始时间-结束时间-时长, 用于展示
24
+ * @description:
25
+ * @param {any} item
26
+ * @param {any} currentDate
27
+ * @return {*}
28
+ * @Author: zhiwei.Wang
29
+ * @Date: 2024-04-26 14:04
30
+ */
31
+ export declare const getServiceTime: (item: any, currentDate: any, utils: any) => string;
@@ -0,0 +1,139 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/components/ticketBooking/utils/formatTime.ts
30
+ var formatTime_exports = {};
31
+ __export(formatTime_exports, {
32
+ formatMultiDayDate: () => formatMultiDayDate,
33
+ getServiceTime: () => getServiceTime,
34
+ isEn: () => isEn
35
+ });
36
+ module.exports = __toCommonJS(formatTime_exports);
37
+ var import_dayjs = __toESM(require("dayjs"));
38
+ var import_utils = require("@pisell/utils");
39
+ var import_zh_cn = require("dayjs/locale/zh-cn");
40
+ var import_en = require("dayjs/locale/en");
41
+ var import_zh_tw = require("dayjs/locale/zh-tw");
42
+ var isEn = (item) => {
43
+ const locale = (item == null ? void 0 : item.locale) || "en-US";
44
+ const _isEn = locale === "en-US" || locale === "en";
45
+ const localeTypes = {
46
+ "en-US": "en",
47
+ "zh-CN": "zh-cn",
48
+ "zh-HK": "zh-tw"
49
+ };
50
+ import_dayjs.default.locale(localeTypes[locale]);
51
+ return _isEn;
52
+ };
53
+ var formatMultiDayDate = (item) => {
54
+ const _isEn = isEn(item);
55
+ const startDate = (0, import_dayjs.default)(item == null ? void 0 : item.start_date);
56
+ const endDate = (0, import_dayjs.default)(item == null ? void 0 : item.end_date);
57
+ const _format = _isEn ? "ddd, DD/MM/YYYY" : "YYYY-MM-DD,ddd";
58
+ const date = `${startDate.format(_format)} ~ ${endDate.format(_format)}`;
59
+ return date;
60
+ };
61
+ var getServiceTime = (item, currentDate, utils) => {
62
+ var _a, _b, _c, _d;
63
+ if (!(0, import_dayjs.default)(currentDate).isValid()) return "";
64
+ const locale = (item == null ? void 0 : item.locale) || ((_a = utils == null ? void 0 : utils.storage) == null ? void 0 : _a.get("umi_locale")) || "en-US";
65
+ const isEn2 = locale === "en-US" || locale === "en";
66
+ const localeTypes = {
67
+ "en-US": "en",
68
+ "zh-CN": "zh-cn",
69
+ "zh-HK": "zh-tw"
70
+ };
71
+ import_dayjs.default.locale(localeTypes[locale]);
72
+ let startDate = (0, import_dayjs.default)(item == null ? void 0 : item.start_date);
73
+ let endDate = (0, import_dayjs.default)(item == null ? void 0 : item.end_date);
74
+ let diffInDays = (item == null ? void 0 : item.custom_day_count) || endDate.diff(startDate, "day");
75
+ if (item == null ? void 0 : item.duration_type) {
76
+ const sameDay = startDate.isSame(endDate, "day");
77
+ const dateFormat = isEn2 ? "DD/MM/YYYY" : "YYYY-MM-DD";
78
+ const timeFormat = "HH:mm";
79
+ const startTime = (item == null ? void 0 : item.start_time) || startDate.format(timeFormat);
80
+ const endTime = (item == null ? void 0 : item.end_time) || endDate.format(timeFormat);
81
+ let dateTime = "";
82
+ if (sameDay) {
83
+ if (isEn2) {
84
+ dateTime = `${startTime} ~ ${endTime} ${startDate.format(dateFormat)}`;
85
+ } else {
86
+ dateTime = `${startDate.format(dateFormat)} ${startTime} ~ ${endTime}`;
87
+ }
88
+ } else {
89
+ if (isEn2) {
90
+ dateTime = `${startTime} ${startDate.format(dateFormat)} ~ ${endTime} ${endDate.format(dateFormat)}`;
91
+ } else {
92
+ dateTime = `${startDate.format(dateFormat)} ${startTime} ~ ${endDate.format(dateFormat)} ${endTime}`;
93
+ }
94
+ }
95
+ const startDateTime = `${startDate.format("YYYY-MM-DD")} ${startTime}`;
96
+ const endDateTime = `${endDate.format("YYYY-MM-DD")} ${endTime}`;
97
+ let _duration = (0, import_dayjs.default)(endDateTime).diff((0, import_dayjs.default)(startDateTime), item == null ? void 0 : item.duration_type);
98
+ let durationText = "";
99
+ if ((item == null ? void 0 : item.duration_type) === "minutes") {
100
+ const hours = Math.floor(_duration / 60);
101
+ const minutes = _duration % 60;
102
+ durationText = import_utils.locales.getText("pisell2.product.card.hour.minute")(hours, minutes);
103
+ } else if ((item == null ? void 0 : item.duration_type) === "days") {
104
+ durationText = import_utils.locales.getText("pisell2.product.card.day")(_duration);
105
+ } else {
106
+ durationText = `${_duration}`;
107
+ }
108
+ return `${dateTime} (${durationText})`;
109
+ }
110
+ let _format = isEn2 ? "ddd, DD/MM/YYYY" : "YYYY-MM-DD,ddd";
111
+ if ((item == null ? void 0 : item.hasOwnProperty("format")) && ((_b = item == null ? void 0 : item.format) == null ? void 0 : _b.length) > 0) {
112
+ _format = isEn2 ? (_c = item == null ? void 0 : item.format) == null ? void 0 : _c[0] : (_d = item == null ? void 0 : item.format) == null ? void 0 : _d[1];
113
+ }
114
+ if (item == null ? void 0 : item.show_time) {
115
+ startDate = (0, import_dayjs.default)((item == null ? void 0 : item.start_time) ? `${item == null ? void 0 : item.start_date} ${item == null ? void 0 : item.start_time}` : startDate.format("YYYY-MM-DD HH:mm"));
116
+ endDate = (0, import_dayjs.default)((item == null ? void 0 : item.end_time) ? `${item == null ? void 0 : item.end_date} ${item == null ? void 0 : item.end_time}` : endDate.format("YYYY-MM-DD HH:mm"));
117
+ }
118
+ if ((item == null ? void 0 : item.duration_type) === "minutes") {
119
+ diffInDays = endDate.diff(startDate, "minute");
120
+ }
121
+ const date = `${startDate.format(_format)} ~ ${endDate.format(_format)}`;
122
+ let text = import_utils.locales.getText("pisell2.product.card.day")(diffInDays);
123
+ if (item == null ? void 0 : item.custom_day_count) {
124
+ text = import_utils.locales.getText("pisell2.product.card.day.event")(diffInDays);
125
+ }
126
+ const textTypes = {
127
+ "minutes": import_utils.locales.getText("pisell2.product.card.minute")(diffInDays),
128
+ "event": import_utils.locales.getText("pisell2.product.card.day.event")(diffInDays)
129
+ };
130
+ text = (textTypes == null ? void 0 : textTypes[item == null ? void 0 : item.duration_type]) || text;
131
+ let duration = `${diffInDays}${text}`;
132
+ return `${date} (${duration})`;
133
+ };
134
+ // Annotate the CommonJS export names for ESM import in node:
135
+ 0 && (module.exports = {
136
+ formatMultiDayDate,
137
+ getServiceTime,
138
+ isEn
139
+ });
@@ -1,13 +1 @@
1
- /// <reference types="react" />
2
- interface RechargeState {
3
- addWalletCard: any;
4
- }
5
- export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
6
- walletDetailState: RechargeState;
7
- } & {
8
- dispatch: (params: {
9
- type: string;
10
- payload: any;
11
- }) => void;
12
- }>;
13
- export {};
1
+ export declare const Provider: any, Context: any;
@@ -1,14 +1 @@
1
- /// <reference types="react" />
2
- interface RechargeState {
3
- total: number;
4
- setup?: 'menu' | 'list' | 'detail' | string;
5
- }
6
- export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
7
- state: RechargeState;
8
- } & {
9
- dispatch: (params: {
10
- type: string;
11
- payload: any;
12
- }) => void;
13
- }>;
14
- export {};
1
+ export declare const Provider: any, Context: any;
@@ -1,13 +1 @@
1
- /// <reference types="react" />
2
- interface RechargeState {
3
- total: number;
4
- }
5
- export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
6
- state: RechargeState;
7
- } & {
8
- dispatch: (params: {
9
- type: string;
10
- payload: any;
11
- }) => void;
12
- }>;
13
- export {};
1
+ export declare const Provider: any, Context: any;
@@ -1,29 +1 @@
1
- /// <reference types="react" />
2
- interface RechargeState {
3
- selectedGiftOptionId: string | null;
4
- cardList: Array<{
5
- id: string;
6
- name: string;
7
- price: number;
8
- }>;
9
- selectedItem: {
10
- id?: string;
11
- gift_price?: number;
12
- price?: number;
13
- name?: string;
14
- variant_id?: string;
15
- };
16
- productId?: string;
17
- detailId?: string;
18
- total: string | number;
19
- rechargeModalOpen: boolean;
20
- }
21
- export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
22
- state: RechargeState;
23
- } & {
24
- dispatch: (params: {
25
- type: string;
26
- payload: any;
27
- }) => void;
28
- }>;
29
- export {};
1
+ export declare const Provider: any, Context: any;