@pisell/private-materials 3.4.22 → 3.4.23

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 (151) 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 +8 -8
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +7 -7
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +7 -7
  11. package/es/components/appointmentBooking/components/Cart/Item/Total.d.ts +1 -0
  12. package/es/components/appointmentBooking/components/Cart/Item/index.d.ts +1 -0
  13. package/es/components/appointmentBooking/components/ConfirmInformation/index.js +27 -3
  14. package/es/components/appointmentBooking/components/Content/index.js +3 -3
  15. package/es/components/appointmentBooking/components/Deposit/index.d.ts +1 -0
  16. package/es/components/appointmentBooking/components/Footer/index.d.ts +1 -0
  17. package/es/components/appointmentBooking/components/Voucher/index.js +6 -5
  18. package/es/components/appointmentBooking/hooks.js +4 -2
  19. package/es/components/appointmentBooking/index.js +10 -0
  20. package/es/components/booking/components/TabProduct/index.d.ts +1 -0
  21. package/es/components/booking/components/TabProduct/productItem/index.d.ts +1 -0
  22. package/es/components/booking/components/voucher/index.js +8 -5
  23. package/es/components/booking/forms/single/index.d.ts +1 -0
  24. package/es/components/booking/materiels/contacts/index.d.ts +1 -0
  25. package/es/components/eftpos/form/index.d.ts +1 -0
  26. package/es/components/eftpos/hooks.d.ts +1 -0
  27. package/es/components/eftpos/index.d.ts +1 -0
  28. package/es/components/eftpos/pos.d.ts +1 -0
  29. package/es/components/eftposPay/amount.d.ts +1 -0
  30. package/es/components/eftposPay/component/fail/failCustom.d.ts +1 -0
  31. package/es/components/eftposPay/component/fail/index.d.ts +1 -0
  32. package/es/components/eftposPay/component/fail/network.d.ts +1 -0
  33. package/es/components/eftposPay/component/fail/unknow.d.ts +1 -0
  34. package/es/components/eftposPay/component/manual/index.d.ts +1 -0
  35. package/es/components/eftposPay/component/signature/index.d.ts +1 -0
  36. package/es/components/eftposPay/hooks.d.ts +1 -1
  37. package/es/components/eftposPay/pay.d.ts +1 -0
  38. package/es/components/eftposPay/store/index.d.ts +1 -1
  39. package/es/components/eventBooking/components/Provider/Cart/ContinueButton/index.js +34 -8
  40. package/es/components/eventBooking/components/Provider/Cart/Deposit/index.d.ts +1 -0
  41. package/es/components/eventBooking/components/Provider/Cart/Item/index.d.ts +1 -0
  42. package/es/components/eventBooking/components/Provider/Cart/index.d.ts +1 -0
  43. package/es/components/eventBooking/components/Provider/Content/index.d.ts +1 -0
  44. package/es/components/eventBooking/components/Provider/Event/index.d.ts +1 -0
  45. package/es/components/eventBooking/components/Provider/Footer/index.d.ts +1 -0
  46. package/es/components/eventBooking/components/Provider/Header/index.d.ts +1 -0
  47. package/es/components/eventBooking/components/Provider/Information/index.d.ts +1 -0
  48. package/es/components/eventBooking/components/Provider/Resource/index.d.ts +1 -0
  49. package/es/components/eventBooking/components/Provider/SelectHolderModal.d.ts +1 -0
  50. package/es/components/eventBooking/components/bookingDetailModal/components/BookingOptions.d.ts +1 -0
  51. package/es/components/eventBooking/components/bookingDetailModal/components/Resource.d.ts +1 -0
  52. package/es/components/eventBooking/components/bookingDetailModal/components/Schedule.d.ts +1 -0
  53. package/es/components/eventBooking/components/scheduleCalendar/ProductItem/index.d.ts +1 -0
  54. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/index.d.ts +1 -0
  55. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/index.d.ts +1 -0
  56. package/es/components/pisellSelectCustomerModal/RightPanel/Add/index.d.ts +1 -0
  57. package/es/components/productExtension/fields/Actor/index.d.ts +1 -0
  58. package/es/components/productExtension/fields/Forms/index.d.ts +1 -0
  59. package/es/components/productExtension/fields/SelectProducts/ProductItem/index.d.ts +1 -0
  60. package/es/components/productExtension/fields/SelectProducts/index.d.ts +1 -0
  61. package/es/components/schedules/components/ScheduleList/index.d.ts +1 -0
  62. package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/MaxParticipantsModule/index.d.ts +1 -0
  63. package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/index.d.ts +1 -0
  64. package/es/components/schedules/products/ProductDetailDrawer/index.d.ts +1 -0
  65. package/es/components/schedules/products/index.d.ts +1 -0
  66. package/es/components/schedules/resources/index.d.ts +1 -0
  67. package/es/components/schedules/resources/relationProduct/index.d.ts +1 -0
  68. package/es/components/schedules/schedules/AllSchedules/index.d.ts +1 -0
  69. package/es/components/schedules/schedules/ScheduleDetailDrawer/index.d.ts +1 -0
  70. package/es/components/schedules/schedules/index.d.ts +1 -0
  71. package/es/components/wallet/Detail/index.js +248 -62
  72. package/es/components/wallet/Detail/locales.d.ts +51 -0
  73. package/es/components/wallet/Detail/locales.js +57 -3
  74. package/es/components/wallet/Detail/serve.js +5 -1
  75. package/es/components/wallet/components/UsageRules/index.d.ts +23 -0
  76. package/es/components/wallet/components/UsageRules/index.js +147 -0
  77. package/es/components/wallet/components/UsageRules/index.less +157 -0
  78. package/es/components/wallet/components/index.d.ts +1 -0
  79. package/es/components/wallet/components/index.js +2 -1
  80. package/es/components/wallet/hooks/useWalletCard.d.ts +1 -0
  81. package/lib/components/appointmentBooking/components/Cart/Item/Total.d.ts +1 -0
  82. package/lib/components/appointmentBooking/components/Cart/Item/index.d.ts +1 -0
  83. package/lib/components/appointmentBooking/components/ConfirmInformation/index.js +22 -2
  84. package/lib/components/appointmentBooking/components/Content/index.js +2 -2
  85. package/lib/components/appointmentBooking/components/Deposit/index.d.ts +1 -0
  86. package/lib/components/appointmentBooking/components/Footer/index.d.ts +1 -0
  87. package/lib/components/appointmentBooking/components/Voucher/index.js +2 -1
  88. package/lib/components/appointmentBooking/hooks.js +4 -2
  89. package/lib/components/appointmentBooking/index.js +6 -0
  90. package/lib/components/booking/components/TabProduct/index.d.ts +1 -0
  91. package/lib/components/booking/components/TabProduct/productItem/index.d.ts +1 -0
  92. package/lib/components/booking/components/voucher/index.js +3 -1
  93. package/lib/components/booking/forms/single/index.d.ts +1 -0
  94. package/lib/components/booking/materiels/contacts/index.d.ts +1 -0
  95. package/lib/components/eftpos/form/index.d.ts +1 -0
  96. package/lib/components/eftpos/hooks.d.ts +1 -0
  97. package/lib/components/eftpos/index.d.ts +1 -0
  98. package/lib/components/eftpos/pos.d.ts +1 -0
  99. package/lib/components/eftposPay/amount.d.ts +1 -0
  100. package/lib/components/eftposPay/component/fail/failCustom.d.ts +1 -0
  101. package/lib/components/eftposPay/component/fail/index.d.ts +1 -0
  102. package/lib/components/eftposPay/component/fail/network.d.ts +1 -0
  103. package/lib/components/eftposPay/component/fail/unknow.d.ts +1 -0
  104. package/lib/components/eftposPay/component/manual/index.d.ts +1 -0
  105. package/lib/components/eftposPay/component/signature/index.d.ts +1 -0
  106. package/lib/components/eftposPay/hooks.d.ts +1 -1
  107. package/lib/components/eftposPay/pay.d.ts +1 -0
  108. package/lib/components/eftposPay/store/index.d.ts +1 -1
  109. package/lib/components/eventBooking/components/Provider/Cart/ContinueButton/index.js +30 -8
  110. package/lib/components/eventBooking/components/Provider/Cart/Deposit/index.d.ts +1 -0
  111. package/lib/components/eventBooking/components/Provider/Cart/Item/index.d.ts +1 -0
  112. package/lib/components/eventBooking/components/Provider/Cart/index.d.ts +1 -0
  113. package/lib/components/eventBooking/components/Provider/Content/index.d.ts +1 -0
  114. package/lib/components/eventBooking/components/Provider/Event/index.d.ts +1 -0
  115. package/lib/components/eventBooking/components/Provider/Footer/index.d.ts +1 -0
  116. package/lib/components/eventBooking/components/Provider/Header/index.d.ts +1 -0
  117. package/lib/components/eventBooking/components/Provider/Information/index.d.ts +1 -0
  118. package/lib/components/eventBooking/components/Provider/Resource/index.d.ts +1 -0
  119. package/lib/components/eventBooking/components/Provider/SelectHolderModal.d.ts +1 -0
  120. package/lib/components/eventBooking/components/bookingDetailModal/components/BookingOptions.d.ts +1 -0
  121. package/lib/components/eventBooking/components/bookingDetailModal/components/Resource.d.ts +1 -0
  122. package/lib/components/eventBooking/components/bookingDetailModal/components/Schedule.d.ts +1 -0
  123. package/lib/components/eventBooking/components/scheduleCalendar/ProductItem/index.d.ts +1 -0
  124. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/index.d.ts +1 -0
  125. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/index.d.ts +1 -0
  126. package/lib/components/pisellSelectCustomerModal/RightPanel/Add/index.d.ts +1 -0
  127. package/lib/components/productExtension/fields/Actor/index.d.ts +1 -0
  128. package/lib/components/productExtension/fields/Forms/index.d.ts +1 -0
  129. package/lib/components/productExtension/fields/SelectProducts/ProductItem/index.d.ts +1 -0
  130. package/lib/components/productExtension/fields/SelectProducts/index.d.ts +1 -0
  131. package/lib/components/schedules/components/ScheduleList/index.d.ts +1 -0
  132. package/lib/components/schedules/products/ProductDetailDrawer/ProductDetail/MaxParticipantsModule/index.d.ts +1 -0
  133. package/lib/components/schedules/products/ProductDetailDrawer/ProductDetail/index.d.ts +1 -0
  134. package/lib/components/schedules/products/ProductDetailDrawer/index.d.ts +1 -0
  135. package/lib/components/schedules/products/index.d.ts +1 -0
  136. package/lib/components/schedules/resources/index.d.ts +1 -0
  137. package/lib/components/schedules/resources/relationProduct/index.d.ts +1 -0
  138. package/lib/components/schedules/schedules/AllSchedules/index.d.ts +1 -0
  139. package/lib/components/schedules/schedules/ScheduleDetailDrawer/index.d.ts +1 -0
  140. package/lib/components/schedules/schedules/index.d.ts +1 -0
  141. package/lib/components/wallet/Detail/index.js +125 -6
  142. package/lib/components/wallet/Detail/locales.d.ts +51 -0
  143. package/lib/components/wallet/Detail/locales.js +57 -3
  144. package/lib/components/wallet/Detail/serve.js +6 -1
  145. package/lib/components/wallet/components/UsageRules/index.d.ts +23 -0
  146. package/lib/components/wallet/components/UsageRules/index.js +113 -0
  147. package/lib/components/wallet/components/UsageRules/index.less +157 -0
  148. package/lib/components/wallet/components/index.d.ts +1 -0
  149. package/lib/components/wallet/components/index.js +3 -0
  150. package/lib/components/wallet/hooks/useWalletCard.d.ts +1 -0
  151. package/package.json +1 -1
@@ -45,7 +45,8 @@ var import_useEngineContext = __toESM(require("../../../../../../hooks/useEngine
45
45
  var import_index = require("./index.less");
46
46
  var import_utils3 = require("../../../../../appointmentBooking/utils");
47
47
  var ContinueButton = () => {
48
- var _a, _b;
48
+ var _a, _b, _c, _d, _e;
49
+ const hasSubscribedRef = (0, import_react.useRef)(false);
49
50
  const { data } = (0, import_Sales.useSales)();
50
51
  const { onHolderOpen } = (0, import_Sales.useHolder)();
51
52
  const { checkHolder, onCloseCart, cartData, getWithoutCartItemsHolderNames } = (0, import_Sales.useCart)();
@@ -64,14 +65,17 @@ var ContinueButton = () => {
64
65
  const [openEmptyHolder, setOpenEmptyHolder] = (0, import_react.useState)(false);
65
66
  const { setData, removeSessionStorage } = (0, import_Sales.useSales)();
66
67
  const context = (0, import_useEngineContext.default)();
67
- const { store, action, getStore } = ((_a = context.appHelper) == null ? void 0 : _a.utils) || {};
68
+ const config = ((_b = (_a = context == null ? void 0 : context.appHelper) == null ? void 0 : _a.constants) == null ? void 0 : _b.config) || {};
69
+ const utils = ((_c = context == null ? void 0 : context.appHelper) == null ? void 0 : _c.utils) || {};
70
+ const { pubsub } = context.appHelper.utils;
71
+ const { store, action, getStore } = ((_d = context.appHelper) == null ? void 0 : _d.utils) || {};
68
72
  const handleCheckout = async () => {
69
73
  const params = (0, import_utils2.getFormParams)(data);
70
74
  action == null ? void 0 : action({
71
75
  type: "pisell1.goProductForm",
72
76
  data: params,
73
77
  callback: async (e) => {
74
- var _a2, _b2, _c;
78
+ var _a2, _b2, _c2;
75
79
  if ((e == null ? void 0 : e.type) === "close") {
76
80
  return;
77
81
  }
@@ -88,7 +92,7 @@ var ContinueButton = () => {
88
92
  removeSessionStorage();
89
93
  } else {
90
94
  (0, import_materials.PisellToast)({
91
- content: ((_c = result == null ? void 0 : result.err) == null ? void 0 : _c.message) || ""
95
+ content: ((_c2 = result == null ? void 0 : result.err) == null ? void 0 : _c2.message) || ""
92
96
  });
93
97
  }
94
98
  }
@@ -234,13 +238,13 @@ var ContinueButton = () => {
234
238
  handleNextStep();
235
239
  };
236
240
  const handleContinue = async () => {
237
- var _a2, _b2, _c;
241
+ var _a2, _b2, _c2;
238
242
  if (isLastStep) {
239
243
  const value = (0, import_utils2.formatValues)({
240
244
  state: data,
241
245
  platform: (_b2 = (_a2 = context == null ? void 0 : context.appHelper) == null ? void 0 : _a2.constants) == null ? void 0 : _b2.platform
242
246
  });
243
- if ((deposit == null ? void 0 : deposit.hasDeposit) && ((_c = deposit == null ? void 0 : deposit.protocols) == null ? void 0 : _c.length) > 0 && !isAgreeDepositPolicy) {
247
+ if ((deposit == null ? void 0 : deposit.hasDeposit) && ((_c2 = deposit == null ? void 0 : deposit.protocols) == null ? void 0 : _c2.length) > 0 && !isAgreeDepositPolicy) {
244
248
  (0, import_utils3.Toast)(import_utils.locales.getText("pisell2.appointment.deposit.agree.policy"));
245
249
  return;
246
250
  }
@@ -270,6 +274,24 @@ var ContinueButton = () => {
270
274
  }
271
275
  handleHolder();
272
276
  };
277
+ const handleSubmit = () => {
278
+ var _a2, _b2, _c2, _d2;
279
+ if ((_b2 = (_a2 = utils == null ? void 0 : utils.businessUtils) == null ? void 0 : _a2.isGuestUser) == null ? void 0 : _b2.call(_a2)) {
280
+ if (!hasSubscribedRef.current) {
281
+ pubsub.subscribe("bind.guest.user", handleContinue);
282
+ hasSubscribedRef.current = true;
283
+ }
284
+ (_d2 = (_c2 = utils == null ? void 0 : utils.businessUtils) == null ? void 0 : _c2.openRegisterModal) == null ? void 0 : _d2.call(_c2, true);
285
+ return;
286
+ }
287
+ handleContinue();
288
+ };
289
+ (0, import_react.useEffect)(() => {
290
+ return () => {
291
+ pubsub.unsubscribe("bind.guest.user", handleContinue);
292
+ hasSubscribedRef.current = false;
293
+ };
294
+ }, []);
273
295
  const continueText = (0, import_react.useMemo)(() => {
274
296
  if (isLastStep) {
275
297
  return import_utils.locales.getText("pisell2.event.checkout");
@@ -289,10 +311,10 @@ var ContinueButton = () => {
289
311
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
290
312
  import_materials.Button,
291
313
  {
292
- disabled: !((_b = cartData == null ? void 0 : cartData.cartItems) == null ? void 0 : _b.length),
314
+ disabled: !((_e = cartData == null ? void 0 : cartData.cartItems) == null ? void 0 : _e.length),
293
315
  size: "large",
294
316
  type: "primary",
295
- onClick: () => handleContinue(),
317
+ onClick: () => isLastStep ? handleSubmit() : handleContinue(),
296
318
  loading: confirmLoading
297
319
  },
298
320
  continueText
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  declare const Deposit: () => JSX.Element;
2
3
  export default Deposit;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  declare const CartItem: () => JSX.Element;
3
4
  export default CartItem;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  declare const Cart: ({ open, onCancel }: any) => JSX.Element;
3
4
  export default Cart;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  declare const Layout: () => JSX.Element;
3
4
  export default Layout;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  declare const Event: () => JSX.Element;
3
4
  export default Event;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  declare const Footer: () => JSX.Element;
3
4
  export default Footer;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  declare const Header: () => JSX.Element;
3
4
  export default Header;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  declare const Information: () => JSX.Element;
3
4
  export default Information;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  declare const Resource: () => JSX.Element;
3
4
  export default Resource;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  declare const SelectHolderModal: (props: any) => JSX.Element;
2
3
  export default SelectHolderModal;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  declare const BookingOptions: (props: {
2
3
  onChangeBookingOption?: ((bookingOption: any) => void) | undefined;
3
4
  }) => JSX.Element;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  declare const Resource: (props: any) => JSX.Element;
2
3
  export default Resource;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  declare const Schedule: () => JSX.Element;
2
3
  export default Schedule;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  declare type Item = any;
3
4
  interface ProductItemProps {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  declare const StripeSDK: ({ public_key, client_secret, children, lang, }: {
2
3
  public_key: string;
3
4
  client_secret?: string | undefined;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.module.less';
2
3
  declare const StripePayment: () => JSX.Element;
3
4
  export default StripePayment;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  interface AddClientProps {
3
4
  onChange: (value: any) => void;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  declare const Actor: ({ name }: {
2
3
  name: string;
3
4
  }) => JSX.Element;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export interface InfoProps {
2
3
  relation_id: any;
3
4
  action: any;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  declare const ProductItem: ({ item, onClick, amountSymbol, style, className, }: any) => JSX.Element;
3
4
  export default ProductItem;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  interface valueType {
3
4
  }
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { ButtonProps } from 'antd';
2
3
  import { ScheduleItem } from '../../type';
3
4
  import './index.less';
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import "./index.less";
2
3
  declare const MaxParticipantsModule: ({ form, value, onChange, useSchedule, isAutoChange, onData, }: {
3
4
  form: any;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import "./index.less";
2
3
  declare const ProductDetail: ({ form, currentProduct, }: {
3
4
  form: any;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import "./index.less";
2
3
  declare const ProductDetailDrawer: () => JSX.Element;
3
4
  export default ProductDetailDrawer;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  declare const Products: () => JSX.Element;
3
4
  export default Products;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  declare const Resources: () => JSX.Element;
3
4
  export default Resources;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import "./index.less";
2
3
  declare const RelationProduct: ({ value, onChange, }: {
3
4
  value?: any;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { ScheduleItem } from '../../type';
2
3
  import './index.less';
3
4
  declare type AllSchedulesPropsType = {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { DrawerProps } from "antd";
2
3
  import { ScheduleItem } from "../../type";
3
4
  import "./index.less";
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  declare const SchedulesConnect: () => JSX.Element;
2
3
  export default SchedulesConnect;
@@ -67,8 +67,94 @@ var Detail = (0, import_react.forwardRef)((props, ref) => {
67
67
  expire_date = "",
68
68
  product = {}
69
69
  } = detail;
70
- const { description = "" } = product || {};
70
+ const { description = "", extension_data = [], customer_order_behavior_count = 0 } = product || {};
71
71
  const context = (0, import_useEngineContext.default)();
72
+ const [extensionData, setExtensionData] = (0, import_react.useState)([]);
73
+ const [customerOrderBehaviorCount, setCustomerOrderBehaviorCount] = (0, import_react.useState)(0);
74
+ const [totalOrderBehaviorCount, setTotalOrderBehaviorCount] = (0, import_react.useState)(0);
75
+ const [todayOrderBehaviorCount, setTodayOrderBehaviorCount] = (0, import_react.useState)(0);
76
+ const [weekOrderBehaviorCount, setWeekOrderBehaviorCount] = (0, import_react.useState)(0);
77
+ const [monthOrderBehaviorCount, setMonthOrderBehaviorCount] = (0, import_react.useState)(0);
78
+ const [usageCreditsData, setUsageCreditsData] = (0, import_react.useState)(null);
79
+ const [shouldShowUsageRules, setShouldShowUsageRules] = (0, import_react.useState)(false);
80
+ const generateUsageRules = (creditsData) => {
81
+ if (!creditsData) return [];
82
+ const rules = [];
83
+ if (creditsData.max_per_day > 0) {
84
+ rules.push({
85
+ type: "daily",
86
+ limit: creditsData.max_per_day,
87
+ description: "",
88
+ // Will be filled by localized text
89
+ resetTime: ""
90
+ // Will be filled by localized text
91
+ });
92
+ }
93
+ if (creditsData.max_per_week > 0) {
94
+ rules.push({
95
+ type: "weekly",
96
+ limit: creditsData.max_per_week,
97
+ description: "",
98
+ // Will be filled by localized text
99
+ resetTime: ""
100
+ // Will be filled by localized text
101
+ });
102
+ }
103
+ if (creditsData.max_per_month > 0) {
104
+ rules.push({
105
+ type: "monthly",
106
+ limit: creditsData.max_per_month,
107
+ description: "",
108
+ // Will be filled by localized text
109
+ resetTime: ""
110
+ // Will be filled by localized text
111
+ });
112
+ }
113
+ return rules;
114
+ };
115
+ const generatePersonalLimit = (creditsData, usedCount = { totalOrderBehaviorCount: 0, customerOrderBehaviorCount: 0 }) => {
116
+ if (!creditsData) return void 0;
117
+ const totalCredits = creditsData.total_credits || 0;
118
+ const perUserLimit = creditsData.per_user_limit || 0;
119
+ let total = 0;
120
+ if (totalCredits > 0 && perUserLimit > 0) {
121
+ total = Math.min(totalCredits, perUserLimit);
122
+ } else {
123
+ total = Math.max(totalCredits, perUserLimit);
124
+ }
125
+ let total_remaining = 0;
126
+ if (totalCredits > 0) {
127
+ total_remaining = totalCredits - usedCount.totalOrderBehaviorCount;
128
+ }
129
+ let perUser_remaining = 0;
130
+ if (perUserLimit > 0) {
131
+ perUser_remaining = perUserLimit - usedCount.customerOrderBehaviorCount;
132
+ }
133
+ let remaining = 0;
134
+ if (total_remaining > 0 && perUser_remaining > 0) {
135
+ remaining = Math.min(total_remaining, perUser_remaining);
136
+ } else {
137
+ if (total_remaining === 0) {
138
+ if (totalCredits === 0) {
139
+ remaining = perUser_remaining;
140
+ } else {
141
+ remaining = 0;
142
+ }
143
+ } else {
144
+ if (perUser_remaining === 0) {
145
+ remaining = 0;
146
+ }
147
+ }
148
+ }
149
+ return {
150
+ total,
151
+ remaining,
152
+ note: ""
153
+ // Will be filled by localized text
154
+ };
155
+ };
156
+ const usageRules = generateUsageRules(usageCreditsData);
157
+ const personalLimit = generatePersonalLimit(usageCreditsData, { totalOrderBehaviorCount, customerOrderBehaviorCount });
72
158
  const utils = ((_a = context == null ? void 0 : context.appHelper) == null ? void 0 : _a.utils) || {};
73
159
  const dvaStore = (_c = (_b = utils == null ? void 0 : utils.getStore) == null ? void 0 : _b.call(utils)) == null ? void 0 : _c.getState();
74
160
  const [TimeLineData, setTimeLineData] = (0, import_react.useState)([]);
@@ -182,9 +268,37 @@ var Detail = (0, import_react.forwardRef)((props, ref) => {
182
268
  return isNegative ? `-${!["point_card", "good_pass"].includes(tag) ? symbol : ""}${absAmount}` : `${!["point_card", "good_pass"].includes(tag) ? symbol : ""}${amount}`;
183
269
  };
184
270
  const getDetail = async () => {
185
- const { apple_wallet_url: apple_wallet_url2 = "", google_wallet_url: google_wallet_url2 = "" } = await (0, import_serve.getDetailApi)({ id: detail.id || "" });
271
+ const {
272
+ apple_wallet_url: apple_wallet_url2 = "",
273
+ google_wallet_url: google_wallet_url2 = "",
274
+ extension_data: extension_data2 = [],
275
+ customer_order_behavior_count: customer_order_behavior_count2 = 0,
276
+ total_order_behavior_count = 0,
277
+ today_order_behavior_count = 0,
278
+ week_order_behavior_count = 0,
279
+ month_order_behavior_count = 0
280
+ } = await (0, import_serve.getDetailApi)({ id: detail.id || "" });
186
281
  setAppleWalletUrl(apple_wallet_url2);
187
282
  setGoogleWalletUrl(google_wallet_url2);
283
+ setExtensionData(extension_data2);
284
+ setCustomerOrderBehaviorCount(customer_order_behavior_count2);
285
+ setTotalOrderBehaviorCount(total_order_behavior_count);
286
+ setTodayOrderBehaviorCount(today_order_behavior_count);
287
+ setWeekOrderBehaviorCount(week_order_behavior_count);
288
+ setMonthOrderBehaviorCount(month_order_behavior_count);
289
+ if (Array.isArray(extension_data2) && extension_data2.length > 0) {
290
+ const usageCreditsItem = extension_data2.find((item) => item.field_key === "usage_credits");
291
+ if (usageCreditsItem == null ? void 0 : usageCreditsItem.value) {
292
+ setUsageCreditsData(usageCreditsItem.value);
293
+ setShouldShowUsageRules(true);
294
+ } else {
295
+ setUsageCreditsData(null);
296
+ setShouldShowUsageRules(false);
297
+ }
298
+ } else {
299
+ setUsageCreditsData(null);
300
+ setShouldShowUsageRules(false);
301
+ }
188
302
  };
189
303
  (0, import_react.useEffect)(() => {
190
304
  if (detail.id) {
@@ -604,10 +718,15 @@ var Detail = (0, import_react.forwardRef)((props, ref) => {
604
718
  isHasBorder: false
605
719
  }
606
720
  ),
607
- /* @__PURE__ */ import_react.default.createElement("div", { className: "wallet-detail-card-content-tip" }, description ? (
608
- // @ts-ignore 忽略TypeScript错误,React类型定义问题
609
- /* @__PURE__ */ import_react.default.createElement("div", { dangerouslySetInnerHTML: { __html: description } })
610
- ) : null)
721
+ description && /* @__PURE__ */ import_react.default.createElement("div", { className: "wallet-detail-card-content-tip" }, /* @__PURE__ */ import_react.default.createElement("div", { dangerouslySetInnerHTML: { __html: description } })),
722
+ shouldShowUsageRules && /* @__PURE__ */ import_react.default.createElement(
723
+ import_components.UsageRules,
724
+ {
725
+ locales: import_utils.locales,
726
+ rules: usageRules,
727
+ personalLimit
728
+ }
729
+ )
611
730
  ),
612
731
  /* @__PURE__ */ import_react.default.createElement(
613
732
  "section",
@@ -29,6 +29,23 @@ declare const _default: {
29
29
  'page.wallet.openedInBrowser': string;
30
30
  'page.wallet.openFailed': string;
31
31
  'page.wallet.loading': string;
32
+ 'page.wallet.usageRules': string;
33
+ 'page.wallet.usageRulesSubtitle': string;
34
+ 'page.wallet.timeUsageLimits': string;
35
+ 'page.wallet.totalQuantityControl': string;
36
+ 'page.wallet.dailyLimit': string;
37
+ 'page.wallet.weeklyLimit': string;
38
+ 'page.wallet.monthlyLimit': string;
39
+ 'page.wallet.personalLimit': string;
40
+ 'page.wallet.dailyLimitDesc': string;
41
+ 'page.wallet.weeklyLimitDesc': string;
42
+ 'page.wallet.monthlyLimitDesc': string;
43
+ 'page.wallet.monthlyLimitUnlimited': string;
44
+ 'page.wallet.personalLimitDesc': string;
45
+ 'page.wallet.dailyReset': string;
46
+ 'page.wallet.weeklyReset': string;
47
+ 'page.wallet.monthlyReset': string;
48
+ 'page.wallet.voucherExpireNote': string;
32
49
  };
33
50
  'zh-CN': {
34
51
  'page.wallet.copyTitle': string;
@@ -60,6 +77,23 @@ declare const _default: {
60
77
  'page.wallet.openedInBrowser': string;
61
78
  'page.wallet.openFailed': string;
62
79
  'page.wallet.loading': string;
80
+ 'page.wallet.usageRules': string;
81
+ 'page.wallet.usageRulesSubtitle': string;
82
+ 'page.wallet.timeUsageLimits': string;
83
+ 'page.wallet.totalQuantityControl': string;
84
+ 'page.wallet.dailyLimit': string;
85
+ 'page.wallet.weeklyLimit': string;
86
+ 'page.wallet.monthlyLimit': string;
87
+ 'page.wallet.personalLimit': string;
88
+ 'page.wallet.dailyLimitDesc': string;
89
+ 'page.wallet.weeklyLimitDesc': string;
90
+ 'page.wallet.monthlyLimitDesc': string;
91
+ 'page.wallet.monthlyLimitUnlimited': string;
92
+ 'page.wallet.personalLimitDesc': string;
93
+ 'page.wallet.dailyReset': string;
94
+ 'page.wallet.weeklyReset': string;
95
+ 'page.wallet.monthlyReset': string;
96
+ 'page.wallet.voucherExpireNote': string;
63
97
  };
64
98
  'zh-HK': {
65
99
  'page.wallet.copyTitle': string;
@@ -91,6 +125,23 @@ declare const _default: {
91
125
  'page.wallet.openedInBrowser': string;
92
126
  'page.wallet.openFailed': string;
93
127
  'page.wallet.loading': string;
128
+ 'page.wallet.usageRules': string;
129
+ 'page.wallet.usageRulesSubtitle': string;
130
+ 'page.wallet.timeUsageLimits': string;
131
+ 'page.wallet.totalQuantityControl': string;
132
+ 'page.wallet.dailyLimit': string;
133
+ 'page.wallet.weeklyLimit': string;
134
+ 'page.wallet.monthlyLimit': string;
135
+ 'page.wallet.personalLimit': string;
136
+ 'page.wallet.dailyLimitDesc': string;
137
+ 'page.wallet.weeklyLimitDesc': string;
138
+ 'page.wallet.monthlyLimitDesc': string;
139
+ 'page.wallet.monthlyLimitUnlimited': string;
140
+ 'page.wallet.personalLimitDesc': string;
141
+ 'page.wallet.dailyReset': string;
142
+ 'page.wallet.weeklyReset': string;
143
+ 'page.wallet.monthlyReset': string;
144
+ 'page.wallet.voucherExpireNote': string;
94
145
  };
95
146
  };
96
147
  export default _default;
@@ -55,7 +55,25 @@ var locales_default = {
55
55
  "page.wallet.useAppleInstead": "You are using an iOS device, would you like to use Apple Wallet instead of Google Wallet?",
56
56
  "page.wallet.openedInBrowser": "Opened in browser",
57
57
  "page.wallet.openFailed": "Failed to open wallet link",
58
- "page.wallet.loading": "Loading wallet..."
58
+ "page.wallet.loading": "Loading wallet...",
59
+ // Usage Rules
60
+ "page.wallet.usageRules": "Terms & Conditions",
61
+ "page.wallet.usageRulesSubtitle": "Please read the following usage conditions carefully",
62
+ "page.wallet.timeUsageLimits": "Time Window Restrictions",
63
+ "page.wallet.totalQuantityControl": "Total Usage Control",
64
+ "page.wallet.dailyLimit": "Daily Limit:",
65
+ "page.wallet.weeklyLimit": "Weekly Limit:",
66
+ "page.wallet.monthlyLimit": "Monthly Limit:",
67
+ "page.wallet.personalLimit": "Personal Limit:",
68
+ "page.wallet.dailyLimitDesc": "Maximum {limit} uses from 12:00 AM to 11:59 PM each day",
69
+ "page.wallet.weeklyLimitDesc": "Maximum {limit} uses from Monday 12:00 AM to Sunday 11:59 PM",
70
+ "page.wallet.monthlyLimitDesc": "Maximum {limit} uses from 1st 12:00 AM to end of month 11:59 PM",
71
+ "page.wallet.monthlyLimitUnlimited": "Unlimited",
72
+ "page.wallet.personalLimitDesc": "You can use this voucher maximum {total} times ({remaining} remaining)",
73
+ "page.wallet.dailyReset": "Counter resets automatically at midnight",
74
+ "page.wallet.weeklyReset": "Counter resets every Monday at midnight",
75
+ "page.wallet.monthlyReset": "Counter resets on 1st of each month at midnight",
76
+ "page.wallet.voucherExpireNote": "Voucher will automatically expire when limit is reached"
59
77
  },
60
78
  "zh-CN": {
61
79
  // 简体中文翻译
@@ -89,7 +107,25 @@ var locales_default = {
89
107
  "page.wallet.useAppleInstead": "您正在使用iOS设备,是否使用Apple Wallet代替Google Wallet?",
90
108
  "page.wallet.openedInBrowser": "已在浏览器中打开",
91
109
  "page.wallet.openFailed": "打开钱包链接失败",
92
- "page.wallet.loading": "正在加载钱包..."
110
+ "page.wallet.loading": "正在加载钱包...",
111
+ // Usage Rules
112
+ "page.wallet.usageRules": "使用规则",
113
+ "page.wallet.usageRulesSubtitle": "请仔细阅读以下使用条件",
114
+ "page.wallet.timeUsageLimits": "时间使用限制",
115
+ "page.wallet.totalQuantityControl": "总量控制",
116
+ "page.wallet.dailyLimit": "每日限制:",
117
+ "page.wallet.weeklyLimit": "每周限制:",
118
+ "page.wallet.monthlyLimit": "每月限制:",
119
+ "page.wallet.personalLimit": "个人限额:",
120
+ "page.wallet.dailyLimitDesc": "每天0点-24点最多使用{limit}次",
121
+ "page.wallet.weeklyLimitDesc": "每周一0点-周日24点最多使用{limit}次",
122
+ "page.wallet.monthlyLimitDesc": "每月1号0点-月末24点最多使用{limit}次",
123
+ "page.wallet.monthlyLimitUnlimited": "无限制",
124
+ "page.wallet.personalLimitDesc": "您最多可使用此券{total}次(剩余{remaining}次)",
125
+ "page.wallet.dailyReset": "每天0点自动重置计数",
126
+ "page.wallet.weeklyReset": "每周一0点自动重置计数",
127
+ "page.wallet.monthlyReset": "每月1号0点自动重置计数",
128
+ "page.wallet.voucherExpireNote": "用完后此券将自动失效"
93
129
  },
94
130
  "zh-HK": {
95
131
  // 繁体中文翻译
@@ -123,6 +159,24 @@ var locales_default = {
123
159
  "page.wallet.useAppleInstead": "您正在使用iOS設備,是否使用Apple Wallet代替Google Wallet?",
124
160
  "page.wallet.openedInBrowser": "已在瀏覽器中打開",
125
161
  "page.wallet.openFailed": "打開錢包連結失敗",
126
- "page.wallet.loading": "正在加載錢包..."
162
+ "page.wallet.loading": "正在加載錢包...",
163
+ // Usage Rules
164
+ "page.wallet.usageRules": "使用規則",
165
+ "page.wallet.usageRulesSubtitle": "請仔細閱讀以下使用條件",
166
+ "page.wallet.timeUsageLimits": "時間使用限制",
167
+ "page.wallet.totalQuantityControl": "總量控制",
168
+ "page.wallet.dailyLimit": "每日限制:",
169
+ "page.wallet.weeklyLimit": "每週限制:",
170
+ "page.wallet.monthlyLimit": "每月限制:",
171
+ "page.wallet.personalLimit": "個人限額:",
172
+ "page.wallet.dailyLimitDesc": "每天0點-24點最多使用{limit}次",
173
+ "page.wallet.weeklyLimitDesc": "每週一0點-週日24點最多使用{limit}次",
174
+ "page.wallet.monthlyLimitDesc": "每月1號0點-月末24點最多使用{limit}次",
175
+ "page.wallet.monthlyLimitUnlimited": "無限制",
176
+ "page.wallet.personalLimitDesc": "您最多可使用此券{total}次(剩餘{remaining}次)",
177
+ "page.wallet.dailyReset": "每天0點自動重置計數",
178
+ "page.wallet.weeklyReset": "每週一0點自動重置計數",
179
+ "page.wallet.monthlyReset": "每月1號0點自動重置計數",
180
+ "page.wallet.voucherExpireNote": "用完後此券將自動失效"
127
181
  }
128
182
  };
@@ -29,7 +29,12 @@ var getAssetList = async (params) => {
29
29
  return data;
30
30
  };
31
31
  var getDetailApi = async (params) => {
32
- const { data } = await import_utils.request.getRequest().get(`/h5/machinecode/lowcode/detail/${params.id}`, {});
32
+ const { data } = await import_utils.request.getRequest().get(`/h5/machinecode/lowcode/detail/${params.id}`, {
33
+ order_behavior_count: 1,
34
+ // 订单行为次数
35
+ order_behavior_count_customer: 1
36
+ // 客户订单行为次数
37
+ });
33
38
  return data;
34
39
  };
35
40
  // Annotate the CommonJS export names for ESM import in node:
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ interface UsageRule {
4
+ type: 'daily' | 'weekly' | 'monthly';
5
+ limit: number;
6
+ description: string;
7
+ resetTime?: string;
8
+ }
9
+ interface UsageRulesProps {
10
+ className?: string;
11
+ style?: React.CSSProperties;
12
+ rules?: UsageRule[];
13
+ personalLimit?: {
14
+ total: number;
15
+ remaining: number;
16
+ note?: string;
17
+ };
18
+ locales?: {
19
+ getText: (key: string) => string;
20
+ };
21
+ }
22
+ declare function UsageRules({ className, style, rules, personalLimit, locales }: UsageRulesProps): JSX.Element;
23
+ export default UsageRules;