@pisell/private-materials 3.2.21 → 3.2.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 (183) 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.css +1 -1
  8. package/build/lowcode/render/default/view.js +8 -8
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +8 -8
  11. package/es/components/appointmentBooking/assets/guests.svg +1 -0
  12. package/es/components/appointmentBooking/components/Cart/ContinueButton/index.js +83 -104
  13. package/es/components/appointmentBooking/components/Cart/Item/Total.js +1 -0
  14. package/es/components/appointmentBooking/components/Cart/Item/index.js +36 -17
  15. package/es/components/appointmentBooking/components/Cart/Item/index.less +7 -4
  16. package/es/components/appointmentBooking/components/Cart/index.d.ts +0 -1
  17. package/es/components/appointmentBooking/components/Content/index.js +11 -11
  18. package/es/components/appointmentBooking/components/Date/index.js +49 -32
  19. package/es/components/appointmentBooking/components/Date/index.less +5 -0
  20. package/es/components/appointmentBooking/components/Guest/index.js +8 -21
  21. package/es/components/appointmentBooking/components/Header/index.js +44 -7
  22. package/es/components/appointmentBooking/components/Resource/index.d.ts +1 -1
  23. package/es/components/appointmentBooking/components/Resource/index.js +28 -20
  24. package/es/components/appointmentBooking/components/Resource/index.less +5 -0
  25. package/es/components/appointmentBooking/components/Services/index.js +20 -9
  26. package/es/components/appointmentBooking/components/TimeSlicing/index.js +47 -32
  27. package/es/components/appointmentBooking/components/TimeSlicing/index.less +4 -0
  28. package/es/components/appointmentBooking/components/Voucher/index.d.ts +4 -0
  29. package/es/components/appointmentBooking/components/Voucher/index.js +238 -0
  30. package/es/components/appointmentBooking/components/Voucher/index.less +26 -0
  31. package/es/components/appointmentBooking/context.d.ts +2 -0
  32. package/es/components/appointmentBooking/context.js +7 -1
  33. package/es/components/appointmentBooking/hooks.d.ts +46 -9
  34. package/es/components/appointmentBooking/hooks.js +162 -121
  35. package/es/components/appointmentBooking/index.js +12 -7
  36. package/es/components/appointmentBooking/locales.d.ts +57 -0
  37. package/es/components/appointmentBooking/locales.js +60 -3
  38. package/es/components/appointmentBooking/utils.d.ts +19 -0
  39. package/es/components/appointmentBooking/utils.js +71 -2
  40. package/es/components/booking/addons/index.js +1 -0
  41. package/es/components/booking/components/TabProduct/index.d.ts +1 -0
  42. package/es/components/booking/components/TabProduct/productItem/index.d.ts +1 -0
  43. package/es/components/booking/components/footer/index.js +5 -1
  44. package/es/components/booking/components/footer/utils.js +18 -2
  45. package/es/components/booking/components/voucher/index.d.ts +3 -0
  46. package/es/components/booking/components/voucher/index.js +238 -0
  47. package/es/components/booking/components/voucher/index.less +88 -0
  48. package/es/components/booking/components/voucher/pisellGoodPassCard/index.d.ts +47 -0
  49. package/es/components/booking/components/voucher/pisellGoodPassCard/index.js +115 -0
  50. package/es/components/booking/components/voucher/pisellGoodPassCard/index.less +52 -0
  51. package/es/components/booking/hooks/useIsBooking4Shop.d.ts +1 -0
  52. package/es/components/booking/hooks/useIsBooking4Shop.js +10 -0
  53. package/es/components/booking/info/clientVariant/hooks/useClientFn.d.ts +1 -0
  54. package/es/components/booking/info/date/index.d.ts +1 -0
  55. package/es/components/booking/info/dateRange/index.d.ts +1 -0
  56. package/es/components/booking/info/notes/index.d.ts +1 -0
  57. package/es/components/booking/info/service/actions/index.d.ts +1 -0
  58. package/es/components/booking/info/service/editService/BookingList/index.d.ts +1 -0
  59. package/es/components/booking/info/service/serviceItem/index.d.ts +1 -0
  60. package/es/components/booking/info/service/serviceList/index.d.ts +1 -0
  61. package/es/components/booking/info/service2/Lists.d.ts +1 -0
  62. package/es/components/booking/info/utils.js +1 -1
  63. package/es/components/booking/info2/service/actions/index.d.ts +1 -0
  64. package/es/components/booking/info2/service/editService/index.js +9 -0
  65. package/es/components/booking/info2/service/serviceItem/index.d.ts +1 -0
  66. package/es/components/booking/info2/service/serviceList/index.d.ts +1 -0
  67. package/es/components/booking/locales.d.ts +18 -0
  68. package/es/components/booking/locales.js +21 -3
  69. package/es/components/booking/materiels/duration/index.d.ts +1 -0
  70. package/es/components/booking/materiels/holder/index.d.ts +1 -0
  71. package/es/components/booking/materiels/startTime/index.d.ts +1 -0
  72. package/es/components/booking/payments/index.js +1 -0
  73. package/es/components/booking/utils.d.ts +2 -2
  74. package/es/components/eftposPay/hooks.d.ts +2 -2
  75. package/es/components/eftposPay/store/index.d.ts +6 -6
  76. package/es/components/eventBooking/components/Provider/Cart/index.d.ts +0 -1
  77. package/es/components/eventBooking/components/Provider/Content/index.d.ts +0 -1
  78. package/es/components/eventBooking/components/Provider/Information/index.d.ts +3 -0
  79. package/es/components/productExtension/fields/Actor/index.d.ts +1 -0
  80. package/es/components/productExtension/fields/SelectProducts/index.d.ts +1 -0
  81. package/es/components/shoppingCart/components/Cart/Product.js +3 -0
  82. package/es/components/shoppingCart/components/Cart/index.d.ts +1 -0
  83. package/es/components/shoppingCart/components/Empty/index.d.ts +1 -0
  84. package/es/components/shoppingCart/components/Render/index.d.ts +1 -0
  85. package/es/components/shoppingCart/hooks/useAddService.d.ts +1 -0
  86. package/es/components/shoppingCart/hooks/useClearCart.js +4 -3
  87. package/es/components/shoppingCart/index.d.ts +1 -0
  88. package/es/components/shoppingCart/type.d.ts +1 -0
  89. package/es/components/wallet/Detail/index.js +20 -14
  90. package/es/components/wallet/Voucher/index.js +1 -0
  91. package/es/components/wallet/index.js +15 -1
  92. package/es/components/wallet/locales.d.ts +3 -0
  93. package/es/components/wallet/locales.js +3 -0
  94. package/es/components/wallet/model.d.ts +1 -1
  95. package/es/components/wallet/utils/formatUtils.js +1 -1
  96. package/es/components/walletList/index.js +5 -1
  97. package/lib/components/appointmentBooking/assets/guests.svg +1 -0
  98. package/lib/components/appointmentBooking/components/Cart/ContinueButton/index.js +37 -27
  99. package/lib/components/appointmentBooking/components/Cart/Item/Total.js +1 -0
  100. package/lib/components/appointmentBooking/components/Cart/Item/index.js +24 -11
  101. package/lib/components/appointmentBooking/components/Cart/Item/index.less +7 -4
  102. package/lib/components/appointmentBooking/components/Cart/index.d.ts +0 -1
  103. package/lib/components/appointmentBooking/components/Content/index.js +3 -5
  104. package/lib/components/appointmentBooking/components/Date/index.js +53 -47
  105. package/lib/components/appointmentBooking/components/Date/index.less +5 -0
  106. package/lib/components/appointmentBooking/components/Guest/index.js +6 -5
  107. package/lib/components/appointmentBooking/components/Header/index.js +25 -3
  108. package/lib/components/appointmentBooking/components/Resource/index.d.ts +1 -1
  109. package/lib/components/appointmentBooking/components/Resource/index.js +16 -17
  110. package/lib/components/appointmentBooking/components/Resource/index.less +5 -0
  111. package/lib/components/appointmentBooking/components/Services/index.js +21 -2
  112. package/lib/components/appointmentBooking/components/TimeSlicing/index.js +23 -21
  113. package/lib/components/appointmentBooking/components/TimeSlicing/index.less +4 -0
  114. package/lib/components/appointmentBooking/components/Voucher/index.d.ts +4 -0
  115. package/lib/components/appointmentBooking/components/Voucher/index.js +221 -0
  116. package/lib/components/appointmentBooking/components/Voucher/index.less +26 -0
  117. package/lib/components/appointmentBooking/context.d.ts +2 -0
  118. package/lib/components/appointmentBooking/context.js +4 -1
  119. package/lib/components/appointmentBooking/hooks.d.ts +46 -9
  120. package/lib/components/appointmentBooking/hooks.js +36 -43
  121. package/lib/components/appointmentBooking/index.js +11 -7
  122. package/lib/components/appointmentBooking/locales.d.ts +57 -0
  123. package/lib/components/appointmentBooking/locales.js +60 -3
  124. package/lib/components/appointmentBooking/utils.d.ts +19 -0
  125. package/lib/components/appointmentBooking/utils.js +42 -2
  126. package/lib/components/booking/addons/index.js +1 -1
  127. package/lib/components/booking/components/TabProduct/index.d.ts +1 -0
  128. package/lib/components/booking/components/TabProduct/productItem/index.d.ts +1 -0
  129. package/lib/components/booking/components/footer/index.js +2 -1
  130. package/lib/components/booking/components/footer/utils.js +4 -1
  131. package/lib/components/booking/components/voucher/index.d.ts +3 -0
  132. package/lib/components/booking/components/voucher/index.js +222 -0
  133. package/lib/components/booking/components/voucher/index.less +88 -0
  134. package/lib/components/booking/components/voucher/pisellGoodPassCard/index.d.ts +47 -0
  135. package/lib/components/booking/components/voucher/pisellGoodPassCard/index.js +109 -0
  136. package/lib/components/booking/components/voucher/pisellGoodPassCard/index.less +52 -0
  137. package/lib/components/booking/hooks/useIsBooking4Shop.d.ts +1 -0
  138. package/lib/components/booking/hooks/useIsBooking4Shop.js +51 -0
  139. package/lib/components/booking/info/clientVariant/hooks/useClientFn.d.ts +1 -0
  140. package/lib/components/booking/info/date/index.d.ts +1 -0
  141. package/lib/components/booking/info/dateRange/index.d.ts +1 -0
  142. package/lib/components/booking/info/notes/index.d.ts +1 -0
  143. package/lib/components/booking/info/service/actions/index.d.ts +1 -0
  144. package/lib/components/booking/info/service/editService/BookingList/index.d.ts +1 -0
  145. package/lib/components/booking/info/service/serviceItem/index.d.ts +1 -0
  146. package/lib/components/booking/info/service/serviceList/index.d.ts +1 -0
  147. package/lib/components/booking/info/service2/Lists.d.ts +1 -0
  148. package/lib/components/booking/info/utils.js +1 -1
  149. package/lib/components/booking/info2/service/actions/index.d.ts +1 -0
  150. package/lib/components/booking/info2/service/editService/index.js +8 -0
  151. package/lib/components/booking/info2/service/serviceItem/index.d.ts +1 -0
  152. package/lib/components/booking/info2/service/serviceList/index.d.ts +1 -0
  153. package/lib/components/booking/locales.d.ts +18 -0
  154. package/lib/components/booking/locales.js +21 -3
  155. package/lib/components/booking/materiels/duration/index.d.ts +1 -0
  156. package/lib/components/booking/materiels/holder/index.d.ts +1 -0
  157. package/lib/components/booking/materiels/startTime/index.d.ts +1 -0
  158. package/lib/components/booking/payments/index.js +1 -1
  159. package/lib/components/booking/utils.d.ts +2 -2
  160. package/lib/components/eftposPay/hooks.d.ts +2 -2
  161. package/lib/components/eftposPay/store/index.d.ts +6 -6
  162. package/lib/components/eventBooking/components/Provider/Cart/index.d.ts +0 -1
  163. package/lib/components/eventBooking/components/Provider/Content/index.d.ts +0 -1
  164. package/lib/components/eventBooking/components/Provider/Information/index.d.ts +3 -0
  165. package/lib/components/productExtension/fields/Actor/index.d.ts +1 -0
  166. package/lib/components/productExtension/fields/SelectProducts/index.d.ts +1 -0
  167. package/lib/components/shoppingCart/components/Cart/Product.js +1 -0
  168. package/lib/components/shoppingCart/components/Cart/index.d.ts +1 -0
  169. package/lib/components/shoppingCart/components/Empty/index.d.ts +1 -0
  170. package/lib/components/shoppingCart/components/Render/index.d.ts +1 -0
  171. package/lib/components/shoppingCart/hooks/useAddService.d.ts +1 -0
  172. package/lib/components/shoppingCart/hooks/useClearCart.js +3 -2
  173. package/lib/components/shoppingCart/index.d.ts +1 -0
  174. package/lib/components/shoppingCart/type.d.ts +1 -0
  175. package/lib/components/wallet/Detail/index.js +6 -1
  176. package/lib/components/wallet/Voucher/index.js +1 -0
  177. package/lib/components/wallet/index.js +15 -1
  178. package/lib/components/wallet/locales.d.ts +3 -0
  179. package/lib/components/wallet/locales.js +3 -0
  180. package/lib/components/wallet/model.d.ts +1 -1
  181. package/lib/components/wallet/utils/formatUtils.js +1 -1
  182. package/lib/components/walletList/index.js +6 -2
  183. package/package.json +3 -3
@@ -0,0 +1,221 @@
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/appointmentBooking/components/Voucher/index.tsx
30
+ var Voucher_exports = {};
31
+ __export(Voucher_exports, {
32
+ default: () => Voucher_default
33
+ });
34
+ module.exports = __toCommonJS(Voucher_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_ChevronDown = __toESM(require("@pisell/icon/es/ChevronDown"));
37
+ var import_UserCircle = __toESM(require("@pisell/icon/es/UserCircle"));
38
+ var import_classnames = __toESM(require("classnames"));
39
+ var import_antd = require("antd");
40
+ var import_utils = require("@pisell/utils");
41
+ var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
42
+ var import_materials = require("@pisell/materials");
43
+ var import_icons = require("@ant-design/icons");
44
+ var import_hooks = require("../../hooks");
45
+ var import_utils2 = require("../../utils");
46
+ var import_voucher = require("../../../booking/components/voucher/index.less");
47
+ var import_index = require("./index.less");
48
+ var ShopDiscountHooks = {
49
+ onInited: "shopDiscount:onInited",
50
+ onDestroy: "shopDiscount:onDestroy",
51
+ onLoadDiscountList: "shopDiscount:onLoadDiscountList",
52
+ onCustomerChange: "shopDiscount:onCustomerChange",
53
+ onDiscountListChange: "shopDiscount:onDiscountListChange",
54
+ onRulesListChange: "shopDiscount:onRulesListChange",
55
+ onLoadPrepareCalcResult: "shopDiscount:onLoadPrepareCalcResult"
56
+ };
57
+ var VoucherCard = (props) => {
58
+ var _a, _b;
59
+ const { products, currentUser } = props;
60
+ const context = (0, import_useEngineContext.default)();
61
+ const appointmentBooking = (0, import_hooks.useAppointmentBooking)();
62
+ const shopDiscount = (0, import_hooks.useShopDiscount)();
63
+ const [showDetail, setShowDetail] = (0, import_react.useState)(true);
64
+ const { pisellos, action, token, store } = (_a = context.appHelper) == null ? void 0 : _a.utils;
65
+ const { utils } = context.appHelper || {};
66
+ const [code, setCode] = (0, import_react.useState)("");
67
+ const [discountList, setDisCountList] = (0, import_react.useState)([]);
68
+ const productRef = (0, import_react.useRef)(products);
69
+ const { openLoginModal } = (0, import_hooks.useAppointmentBookingLogin)();
70
+ const { accountLists } = (0, import_hooks.useAppointmentBookingAccount)();
71
+ const cart = (_b = appointmentBooking == null ? void 0 : appointmentBooking.store) == null ? void 0 : _b.cart;
72
+ const isUserLoggedIn = (0, import_react.useMemo)(() => {
73
+ var _a2, _b2;
74
+ return !!((_b2 = (_a2 = utils == null ? void 0 : utils.token) == null ? void 0 : _a2.get) == null ? void 0 : _b2.call(_a2)) || false;
75
+ }, [store]);
76
+ const availableData = (0, import_react.useMemo)(() => {
77
+ return discountList.filter((item) => !!item.isAvailable).map((discount) => {
78
+ return {
79
+ ...discount,
80
+ savedAmount: shopDiscount.calcDiscountApplicableProductTotalPrice(discount)
81
+ };
82
+ });
83
+ }, [discountList]);
84
+ (0, import_react.useEffect)(() => {
85
+ if (isUserLoggedIn) {
86
+ const shopDiscount2 = pisellos.getModule("shopDiscount");
87
+ shopDiscount2.setCustomer(currentUser);
88
+ }
89
+ }, [currentUser.id, isUserLoggedIn]);
90
+ (0, import_react.useEffect)(() => {
91
+ shopDiscount.setProductList(products);
92
+ }, [products]);
93
+ const onCartChange = () => {
94
+ const products2 = cart == null ? void 0 : cart.getItems();
95
+ const val = shopDiscount.calcDiscount(products2);
96
+ cart == null ? void 0 : cart.batchSetItems(val.productList);
97
+ };
98
+ (0, import_react.useEffect)(() => {
99
+ const val = shopDiscount.getDiscountList();
100
+ setDisCountList(val);
101
+ pisellos.effects.on(
102
+ ShopDiscountHooks.onLoadPrepareCalcResult,
103
+ (result) => {
104
+ cart == null ? void 0 : cart.batchSetItems(result.productList);
105
+ }
106
+ );
107
+ pisellos.effects.on("appointmentBooking_cart:onAddItem", onCartChange);
108
+ pisellos.effects.on("appointmentBooking_cart:onRemoveItem", onCartChange);
109
+ pisellos.effects.on(
110
+ ShopDiscountHooks.onDiscountListChange,
111
+ (discount) => {
112
+ console.log(discount, "discountChange");
113
+ setDisCountList(discount);
114
+ }
115
+ );
116
+ }, []);
117
+ const onScanCode = async () => {
118
+ const val = await shopDiscount.scanCode(code);
119
+ if (val == null ? void 0 : val.isAvailable) {
120
+ cart == null ? void 0 : cart.batchSetItems(val.productList);
121
+ } else {
122
+ (0, import_materials.PisellToast)({
123
+ content: import_utils.locales.getText("pisell2.text.goodpass.code-invalid")
124
+ });
125
+ }
126
+ };
127
+ const renderLoginCard = () => {
128
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "login-card" }, /* @__PURE__ */ import_react.default.createElement(import_UserCircle.default, { style: { fontSize: 28 } }), /* @__PURE__ */ import_react.default.createElement("div", { className: "text-wrapper" }, /* @__PURE__ */ import_react.default.createElement(
129
+ import_materials.PisellText,
130
+ {
131
+ className: "login-btn",
132
+ onClick: () => {
133
+ if (!action) return;
134
+ openLoginModal({
135
+ callback: (status) => {
136
+ var _a2, _b2, _c;
137
+ const user = (_c = (_b2 = (_a2 = utils.store) == null ? void 0 : _a2.getState()) == null ? void 0 : _b2.global) == null ? void 0 : _c.userInfo;
138
+ const currentUser2 = (0, import_utils2.formatCustomer)(user);
139
+ const meAccount = accountLists == null ? void 0 : accountLists.find((d) => !(d == null ? void 0 : d.isGuest));
140
+ if (status === "success") {
141
+ appointmentBooking.setLoginAccount(
142
+ meAccount == null ? void 0 : meAccount.id,
143
+ currentUser2
144
+ );
145
+ }
146
+ }
147
+ });
148
+ }
149
+ },
150
+ import_utils.locales.getText("pisell2.text.goodpass.login")
151
+ ), /* @__PURE__ */ import_react.default.createElement("span", null, import_utils.locales.getText("pisell2.text.goodpass.login-tip"))));
152
+ };
153
+ const renderVoucherInfo = () => {
154
+ return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { className: "voucher-title" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "voucher-title-left" }, import_utils.locales.getText("pisell2.text.goodpass")), /* @__PURE__ */ import_react.default.createElement(
155
+ "span",
156
+ {
157
+ className: "voucher-title-right",
158
+ onClick: () => {
159
+ console.log("showDetail: ", showDetail);
160
+ setShowDetail(!showDetail);
161
+ }
162
+ },
163
+ import_utils.locales.getText("pisell2.text.details"),
164
+ " ",
165
+ /* @__PURE__ */ import_react.default.createElement(
166
+ import_ChevronDown.default,
167
+ {
168
+ className: (0, import_classnames.default)("voucher-right-icon", {
169
+ show: showDetail
170
+ })
171
+ }
172
+ )
173
+ )), /* @__PURE__ */ import_react.default.createElement(
174
+ "div",
175
+ {
176
+ className: (0, import_classnames.default)("voucher-detail", {
177
+ show: showDetail
178
+ })
179
+ },
180
+ (availableData == null ? void 0 : availableData.length) > 0 ? /* @__PURE__ */ import_react.default.createElement(
181
+ import_materials.PisellGoodPassCard,
182
+ {
183
+ style: { width: "100%" },
184
+ dataSource: availableData,
185
+ onChange: (val) => {
186
+ var _a2, _b2;
187
+ const detail = shopDiscount.setDiscountSelected({
188
+ discountId: val.id,
189
+ isSelected: val.isSelected
190
+ });
191
+ (_b2 = (_a2 = appointmentBooking == null ? void 0 : appointmentBooking.store) == null ? void 0 : _a2.cart) == null ? void 0 : _b2.batchSetItems(
192
+ detail.productList
193
+ );
194
+ }
195
+ }
196
+ ) : null,
197
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "voucher-code-input-wrapper" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "voucher-code-input" }, /* @__PURE__ */ import_react.default.createElement("div", { style: { whiteSpace: "nowrap" } }, import_utils.locales.getText("pisell2.text.goodpass.code"), ":"), /* @__PURE__ */ import_react.default.createElement(
198
+ import_materials.PisellInput,
199
+ {
200
+ value: code,
201
+ onChange: (e) => {
202
+ var _a2;
203
+ setCode((_a2 = e.target) == null ? void 0 : _a2.value);
204
+ },
205
+ size: "small",
206
+ placeholder: import_utils.locales.getText(
207
+ "pisell2.text.goodpass.enter-code"
208
+ ),
209
+ suffix: /* @__PURE__ */ import_react.default.createElement(import_materials.PisellTooltip, { title: "" }, /* @__PURE__ */ import_react.default.createElement(
210
+ import_icons.QuestionCircleOutlined,
211
+ {
212
+ style: { color: "rgba(0,0,0,.45)" }
213
+ }
214
+ ))
215
+ }
216
+ )), /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { size: "small", onClick: onScanCode, disabled: !code }, import_utils.locales.getText("pisell2.text.apply")))
217
+ ));
218
+ };
219
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-footer-voucher-container" }, isUserLoggedIn ? renderVoucherInfo() : renderLoginCard());
220
+ };
221
+ var Voucher_default = VoucherCard;
@@ -0,0 +1,26 @@
1
+ .pisell-lowcode__booking-footer-voucher-container {
2
+ .login-card {
3
+ border-radius: 8px;
4
+ border: 1px solid var(--Gray-300, #d0d5dd);
5
+ background: #fff;
6
+ display: flex;
7
+ padding: 12px;
8
+ justify-content: center;
9
+ align-items: center;
10
+ gap: 10px;
11
+ color: var(--Gray-500, #667085);
12
+ font-family: Inter;
13
+ font-size: 14px;
14
+ font-style: normal;
15
+ font-weight: 600;
16
+
17
+ .text-wrapper {
18
+ max-width: 200px;
19
+ }
20
+
21
+ .login-btn {
22
+ cursor: pointer;
23
+ color: #8157d5;
24
+ }
25
+ }
26
+ }
@@ -19,6 +19,8 @@ interface AppointmentBookingContextType {
19
19
  symbolic?: any;
20
20
  resourceOtherParams?: any;
21
21
  setResourceOtherParams: (val: any) => void;
22
+ selectedTime: any;
23
+ setSelectedTime: (val: any) => void;
22
24
  }
23
25
  export declare const AppointmentBookingProvider: ({ children, }: {
24
26
  children: ReactNode;
@@ -52,6 +52,7 @@ var AppointmentBookingProvider = ({
52
52
  const [isLastStep, setIsLastStep] = (0, import_react.useState)(false);
53
53
  const [carts, setCarts] = (0, import_react.useState)([]);
54
54
  const [resourceOtherParams, setResourceOtherParams] = (0, import_react.useState)({});
55
+ const [selectedTime, setSelectedTime] = (0, import_react.useState)(null);
55
56
  const { appHelper } = (0, import_useEngineContext.default)();
56
57
  const symbolic = (_a = appHelper == null ? void 0 : appHelper.utils) == null ? void 0 : _a.getSymbolic();
57
58
  console.log(3234234, times, resources);
@@ -74,7 +75,9 @@ var AppointmentBookingProvider = ({
74
75
  appHelper,
75
76
  symbolic,
76
77
  resourceOtherParams,
77
- setResourceOtherParams
78
+ setResourceOtherParams,
79
+ selectedTime,
80
+ setSelectedTime
78
81
  };
79
82
  return /* @__PURE__ */ import_react.default.createElement(AppointmentBookingContext.Provider, { value }, children);
80
83
  };
@@ -1,24 +1,61 @@
1
1
  export declare const useAppointmentBooking: () => any;
2
+ export declare const useShopDiscount: () => any;
3
+ /**
4
+ * @title: 监听步骤发生变化
5
+ * @description:
6
+ * @return {*}
7
+ * @Author: WangHan
8
+ * @Date: 2025-04-15 11:11
9
+ */
2
10
  export declare const useAppointmentBookingStep: () => void;
11
+ /**
12
+ * @title: 获取商品数据
13
+ * @description:
14
+ * @return {*}
15
+ * @Author: WangHan
16
+ * @Date: 2025-04-15 11:12
17
+ */
3
18
  export declare const useAppointmentBookingProduct: () => void;
4
- export declare const useAppointmentBookingCart: () => {
5
- cart: any;
6
- };
19
+ /**
20
+ * @title: 更新购物车数据
21
+ * @description:
22
+ * @return {*}
23
+ * @Author: WangHan
24
+ * @Date: 2025-04-15 11:12
25
+ */
26
+ export declare const useAppointmentBookingCart: () => void;
27
+ /**
28
+ * @title: 获取登录状态
29
+ * @description:
30
+ * @return {*}
31
+ * @Author: WangHan
32
+ * @Date: 2025-04-15 11:14
33
+ */
7
34
  export declare const useAppointmentBookingLogin: () => {
8
35
  isLogin: boolean;
9
36
  openLoginModal: (params: {
10
37
  callback: any;
11
38
  }) => void;
12
39
  };
40
+ /**
41
+ * @title: 获取账户
42
+ * @description:
43
+ * @return {*}
44
+ * @Author: WangHan
45
+ * @Date: 2025-04-15 11:15
46
+ */
13
47
  export declare const useAppointmentBookingAccount: () => {
14
- currentUser: {
15
- id: any;
16
- username: string;
17
- };
18
48
  accountLists: any;
19
49
  };
50
+ /**
51
+ * @title: 获取资源数据
52
+ * @description:
53
+ * @return {*}
54
+ * @Author: WangHan
55
+ * @Date: 2025-04-15 11:29
56
+ */
20
57
  export declare const useAppointmentBookingResource: () => {
21
58
  getResourceTimeSlot: (params: any) => Promise<void>;
22
- getResourceList: () => Promise<any>;
23
- autoSelectAllProductResources: (code: string) => Promise<void>;
59
+ getResourceList: () => any;
60
+ autoSelectAllProductResources: (code: string) => Promise<any>;
24
61
  };
@@ -35,19 +35,23 @@ __export(hooks_exports, {
35
35
  useAppointmentBookingLogin: () => useAppointmentBookingLogin,
36
36
  useAppointmentBookingProduct: () => useAppointmentBookingProduct,
37
37
  useAppointmentBookingResource: () => useAppointmentBookingResource,
38
- useAppointmentBookingStep: () => useAppointmentBookingStep
38
+ useAppointmentBookingStep: () => useAppointmentBookingStep,
39
+ useShopDiscount: () => useShopDiscount
39
40
  });
40
41
  module.exports = __toCommonJS(hooks_exports);
42
+ var import_react = require("react");
41
43
  var import_useEngineContext = require("../../hooks/useEngineContext");
42
44
  var import_useEngineContext2 = __toESM(require("../../hooks/useEngineContext"));
43
- var import_utils = require("@pisell/utils");
44
- var import_utils2 = require("./utils");
45
- var import_react = require("react");
45
+ var import_utils = require("./utils");
46
46
  var import_context = require("./context");
47
47
  var useAppointmentBooking = () => {
48
48
  const pisellOS = (0, import_useEngineContext.usePisellOS)();
49
49
  return pisellOS.getModule("appointmentBooking");
50
50
  };
51
+ var useShopDiscount = () => {
52
+ const pisellOS = (0, import_useEngineContext.usePisellOS)();
53
+ return pisellOS.getModule("shopDiscount");
54
+ };
51
55
  var useAppointmentBookingStep = () => {
52
56
  var _a, _b, _c;
53
57
  const pisellOS = (0, import_useEngineContext.usePisellOS)();
@@ -71,33 +75,29 @@ var useAppointmentBookingProduct = () => {
71
75
  const { productModuleParams } = appointmentBooking.otherParams;
72
76
  (0, import_react.useEffect)(() => {
73
77
  appointmentBooking.loadProducts(productModuleParams).then((res) => {
74
- console.log(res, "loadProductsloadProducts");
75
78
  setProducts(res || []);
76
79
  });
77
80
  }, []);
78
81
  };
79
82
  var useAppointmentBookingCart = () => {
80
- var _a, _b;
81
83
  const pisellOS = (0, import_useEngineContext.usePisellOS)();
82
84
  const { appointmentBooking, setCarts, setSummary } = (0, import_context.useAppointmentBookingContext)();
83
- const cart = (_b = (_a = appointmentBooking == null ? void 0 : appointmentBooking.store) == null ? void 0 : _a.cart) == null ? void 0 : _b.store;
85
+ const getCartAndSummary = async () => {
86
+ const carts = await appointmentBooking.getCart();
87
+ setCarts(carts || []);
88
+ const summary = await appointmentBooking.getSummary();
89
+ setSummary(summary || {});
90
+ console.log(carts, summary, "appointmentBooking_cart:changed");
91
+ };
84
92
  (0, import_react.useEffect)(() => {
85
- var _a2;
93
+ getCartAndSummary();
86
94
  pisellOS.effects.on(
87
95
  "appointmentBooking_cart:changed",
88
- async (res) => {
89
- const carts = await appointmentBooking.getCart();
90
- setCarts(carts || []);
91
- const summary = await appointmentBooking.getSummary();
92
- setSummary(summary || {});
93
- console.log(carts, summary, "appointmentBooking_cart:changed");
96
+ async () => {
97
+ getCartAndSummary();
94
98
  }
95
99
  );
96
- (_a2 = appointmentBooking == null ? void 0 : appointmentBooking.getCart) == null ? void 0 : _a2.call(appointmentBooking).then((data) => {
97
- setCarts(data || []);
98
- });
99
100
  }, []);
100
- return { cart };
101
101
  };
102
102
  var useAppointmentBookingLogin = () => {
103
103
  var _a, _b;
@@ -108,71 +108,63 @@ var useAppointmentBookingLogin = () => {
108
108
  const { callback } = params || {};
109
109
  utils.action({
110
110
  type: "pisell1.login",
111
- data: {},
111
+ data: {
112
+ type: "plugin"
113
+ },
112
114
  callback
113
115
  });
114
116
  };
115
117
  return { isLogin, openLoginModal };
116
118
  };
117
119
  var useAppointmentBookingAccount = () => {
118
- var _a, _b;
119
120
  const pisellOS = (0, import_useEngineContext.usePisellOS)();
120
- const context = (0, import_useEngineContext2.default)();
121
- const utils = context.appHelper.utils || {};
122
121
  const appointmentBooking = useAppointmentBooking();
123
122
  const [accountLists, setAccountLists] = (0, import_react.useState)([]);
124
- let userInfo = (_b = (_a = utils.getStore().getState()) == null ? void 0 : _a.global) == null ? void 0 : _b.userInfo;
125
- const localUserInfo = JSON.parse(utils.storage.get("customer") || "{}");
126
- userInfo = (userInfo == null ? void 0 : userInfo.id) ? userInfo : localUserInfo;
127
- let currentUserName = `${userInfo == null ? void 0 : userInfo.first_name} ${userInfo == null ? void 0 : userInfo.last_name}`;
128
- currentUserName = (currentUserName == null ? void 0 : currentUserName.trim()) || (userInfo == null ? void 0 : userInfo.nickname) || "Me";
129
- const currentUser = {
130
- id: (userInfo == null ? void 0 : userInfo.id) || (0, import_utils.getUniqueId)(),
131
- username: currentUserName
123
+ const getAccountLists = async () => {
124
+ var _a, _b, _c;
125
+ const data = await appointmentBooking.getAccounts();
126
+ setAccountLists(data || []);
127
+ console.log("currentUser4455777", appointmentBooking, (_c = (_b = (_a = appointmentBooking.store) == null ? void 0 : _a.accountList) == null ? void 0 : _b.store) == null ? void 0 : _c.accountList, data);
132
128
  };
133
129
  (0, import_react.useEffect)(() => {
134
130
  pisellOS.effects.on(
135
131
  "appointmentBooking_accountList:changed",
136
132
  async (res) => {
137
133
  if (res.path === "accounts") {
138
- appointmentBooking.getAccounts().then((data) => {
139
- setAccountLists(data || []);
140
- });
134
+ getAccountLists();
141
135
  }
142
136
  }
143
137
  );
144
- appointmentBooking.getAccounts().then((data) => {
145
- setAccountLists(data || []);
146
- });
138
+ getAccountLists();
147
139
  }, []);
148
- return { currentUser, accountLists };
140
+ return { accountLists };
149
141
  };
150
142
  var useAppointmentBookingResource = () => {
151
143
  const { appointmentBooking, setResources, setTimes, setResourceOtherParams, resourceOtherParams } = (0, import_context.useAppointmentBookingContext)();
152
144
  const { resourceSort } = (appointmentBooking == null ? void 0 : appointmentBooking.otherParams) || {};
153
- console.log(appointmentBooking, "appointmentBooking22");
154
145
  const getResourceTimeSlot = async (params) => {
155
- const data = await appointmentBooking.getResourceTimeSlot(params);
146
+ const data = await appointmentBooking.getTimeSlotByAllResources(params);
156
147
  setTimes(data || []);
157
148
  };
158
- const getResourceList = async () => {
149
+ const getResourceList = () => {
159
150
  let resources = appointmentBooking.getResourcesList();
160
151
  resources = resources.map((item) => {
161
152
  return {
162
153
  ...item,
163
- resources: (0, import_utils2.sortResources)((item == null ? void 0 : item.resources) || [], resourceSort)
154
+ resources: (0, import_utils.sortResources)((item == null ? void 0 : item.resources) || [], resourceSort)
164
155
  };
165
156
  });
166
157
  setResources(resources || []);
158
+ console.log(resources, "resourcesresources");
167
159
  return resources;
168
160
  };
169
161
  const autoSelectAllProductResources = async (code) => {
170
162
  let res = await appointmentBooking.autoSelectAllProductResources(code);
171
- console.log(res, "autoSelectAllProductResources");
172
163
  setResourceOtherParams({
173
164
  ...resourceOtherParams,
174
165
  ...res
175
166
  });
167
+ return res;
176
168
  };
177
169
  return { getResourceTimeSlot, getResourceList, autoSelectAllProductResources };
178
170
  };
@@ -184,5 +176,6 @@ var useAppointmentBookingResource = () => {
184
176
  useAppointmentBookingLogin,
185
177
  useAppointmentBookingProduct,
186
178
  useAppointmentBookingResource,
187
- useAppointmentBookingStep
179
+ useAppointmentBookingStep,
180
+ useShopDiscount
188
181
  });
@@ -33,24 +33,28 @@ __export(appointmentBooking_exports, {
33
33
  });
34
34
  module.exports = __toCommonJS(appointmentBooking_exports);
35
35
  var import_react = __toESM(require("react"));
36
- var import_Content = __toESM(require("./components/Content"));
37
36
  var import_utils = require("@pisell/utils");
38
37
  var import_useEngineContext = __toESM(require("../../hooks/useEngineContext"));
39
- var import_index = require("./index.less");
40
- var import_locales = __toESM(require("./locales"));
41
38
  var import_context = require("./context");
39
+ var import_Content = __toESM(require("./components/Content"));
40
+ var import_locales = __toESM(require("./locales"));
42
41
  var import_hooks = require("./hooks");
42
+ var import_index = require("./index.less");
43
43
  var AppointmentBooking = () => {
44
44
  var _a;
45
45
  const context = (0, import_useEngineContext.default)();
46
- const appointmentBooking = (0, import_hooks.useAppointmentBooking)();
47
- const appointmentBookingAccount = (0, import_hooks.useAppointmentBookingAccount)();
48
46
  const utils = context.appHelper.utils || {};
49
47
  import_utils.locales.init(import_locales.default, ((_a = utils == null ? void 0 : utils.storage) == null ? void 0 : _a.get("umi_locale")) || "en");
48
+ const appointmentBooking = (0, import_hooks.useAppointmentBooking)();
49
+ const { accountLists } = (0, import_hooks.useAppointmentBookingAccount)();
50
+ console.log(appointmentBooking, "wh97886786currentUser4455777");
50
51
  (0, import_react.useEffect)(() => {
51
- const { currentUser } = appointmentBookingAccount;
52
- appointmentBooking.addAccount([currentUser]);
52
+ const res = appointmentBooking.getAccounts();
53
+ console.log(res, "wh98867");
53
54
  }, []);
55
+ (0, import_react.useEffect)(() => {
56
+ console.log(accountLists, "wh98867555");
57
+ }, [accountLists]);
54
58
  return /* @__PURE__ */ import_react.default.createElement(
55
59
  "div",
56
60
  {
@@ -70,11 +70,30 @@ declare const _default: {
70
70
  'pisell2.event.capacity.limit.reached.title': string;
71
71
  'pisell2.event.capacity.limit.reached.tip': string;
72
72
  'pisell2.appointment.booking.empty.service': string;
73
+ 'pisell2.appointment.booking.empty.time': string;
73
74
  'pisell2.appointment.service.title': (val: number) => string;
74
75
  'pisell2.appointment.add.guest': string;
75
76
  'pisell2.appointment.edit.service': string;
76
77
  'pisell2.appointment.remove.guest': string;
77
78
  'pisell2.appointment.no.available.service': string;
79
+ 'pisell2.appointment.max.guest': string;
80
+ 'pisell2.appointment.no.available.time': string;
81
+ 'pisell2.appointment.monday': string;
82
+ 'pisell2.appointment.tuesday': string;
83
+ 'pisell2.appointment.wednesday': string;
84
+ 'pisell2.appointment.thursday': string;
85
+ 'pisell2.appointment.friday': string;
86
+ 'pisell2.appointment.saturday': string;
87
+ 'pisell2.appointment.sunday': string;
88
+ 'pisell2.text.apply': string;
89
+ 'pisell2.text.goodpass': string;
90
+ 'pisell2.text.goodpass.product-vouchers': string;
91
+ 'pisell2.text.goodpass.view-more': string;
92
+ 'pisell2.text.goodpass.code': string;
93
+ 'pisell2.text.goodpass.enter-code': string;
94
+ 'pisell2.text.goodpass.code-invalid': string;
95
+ 'pisell2.text.goodpass.login': string;
96
+ 'pisell2.text.goodpass.login-tip': string;
78
97
  };
79
98
  'zh-CN': {
80
99
  'pisell2.event.calendar.limit.unavailable': string;
@@ -147,11 +166,30 @@ declare const _default: {
147
166
  'pisell2.event.capacity.limit.reached.title': string;
148
167
  'pisell2.event.capacity.limit.reached.tip': string;
149
168
  'pisell2.appointment.booking.empty.service': string;
169
+ 'pisell2.appointment.booking.empty.time': string;
150
170
  'pisell2.appointment.service.title': (val: number) => string;
151
171
  'pisell2.appointment.add.guest': string;
152
172
  'pisell2.appointment.edit.service': string;
153
173
  'pisell2.appointment.remove.guest': string;
154
174
  'pisell2.appointment.no.available.service': string;
175
+ 'pisell2.appointment.max.guest': string;
176
+ 'pisell2.appointment.no.available.time': string;
177
+ 'pisell2.appointment.monday': string;
178
+ 'pisell2.appointment.tuesday': string;
179
+ 'pisell2.appointment.wednesday': string;
180
+ 'pisell2.appointment.thursday': string;
181
+ 'pisell2.appointment.friday': string;
182
+ 'pisell2.appointment.saturday': string;
183
+ 'pisell2.appointment.sunday': string;
184
+ 'pisell2.text.apply': string;
185
+ 'pisell2.text.goodpass': string;
186
+ 'pisell2.text.goodpass.product-vouchers': string;
187
+ 'pisell2.text.goodpass.view-more': string;
188
+ 'pisell2.text.goodpass.code': string;
189
+ 'pisell2.text.goodpass.enter-code': string;
190
+ 'pisell2.text.goodpass.code-invalid': string;
191
+ 'pisell2.text.goodpass.login': string;
192
+ 'pisell2.text.goodpass.login-tip': string;
155
193
  };
156
194
  'zh-HK': {
157
195
  'pisell2.event.calendar.limit.unavailable': string;
@@ -224,11 +262,30 @@ declare const _default: {
224
262
  'pisell2.event.capacity.limit.reached.title': string;
225
263
  'pisell2.event.capacity.limit.reached.tip': string;
226
264
  'pisell2.appointment.booking.empty.service': string;
265
+ 'pisell2.appointment.booking.empty.time': string;
227
266
  'pisell2.appointment.service.title': (val: number) => string;
228
267
  'pisell2.appointment.add.guest': string;
229
268
  'pisell2.appointment.edit.service': string;
230
269
  'pisell2.appointment.remove.guest': string;
231
270
  'pisell2.appointment.no.available.service': string;
271
+ 'pisell2.appointment.max.guest': string;
272
+ 'pisell2.appointment.no.available.time': string;
273
+ 'pisell2.appointment.monday': string;
274
+ 'pisell2.appointment.tuesday': string;
275
+ 'pisell2.appointment.wednesday': string;
276
+ 'pisell2.appointment.thursday': string;
277
+ 'pisell2.appointment.friday': string;
278
+ 'pisell2.appointment.saturday': string;
279
+ 'pisell2.appointment.sunday': string;
280
+ 'pisell2.text.apply': string;
281
+ 'pisell2.text.goodpass': string;
282
+ 'pisell2.text.goodpass.product-vouchers': string;
283
+ 'pisell2.text.goodpass.view-more': string;
284
+ 'pisell2.text.goodpass.code': string;
285
+ 'pisell2.text.goodpass.enter-code': string;
286
+ 'pisell2.text.goodpass.code-invalid': string;
287
+ 'pisell2.text.goodpass.login': string;
288
+ 'pisell2.text.goodpass.login-tip': string;
232
289
  };
233
290
  };
234
291
  export default _default;