@pisell/private-materials 3.2.17 → 3.2.18

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 (144) 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/{Provider/Cart → Cart}/ContinueButton/index.js +19 -10
  12. package/es/components/appointmentBooking/components/{Provider/Cart → Cart}/Item/Total.js +10 -20
  13. package/es/components/appointmentBooking/components/Cart/Item/index.js +73 -0
  14. package/es/components/appointmentBooking/components/Content/index.js +29 -15
  15. package/es/components/appointmentBooking/components/Date/index.js +77 -12
  16. package/es/components/appointmentBooking/components/Date/index.less +1 -0
  17. package/es/components/appointmentBooking/components/Footer/index.js +3 -3
  18. package/es/components/appointmentBooking/components/Guest/index.d.ts +3 -0
  19. package/es/components/appointmentBooking/components/{Provider/Information → Guest}/index.js +50 -59
  20. package/es/components/appointmentBooking/components/Header/index.js +6 -4
  21. package/es/components/appointmentBooking/components/Resource/index.d.ts +1 -1
  22. package/es/components/appointmentBooking/components/Resource/index.js +62 -29
  23. package/es/components/appointmentBooking/components/Resource/index.less +6 -0
  24. package/es/components/appointmentBooking/components/Services/index.js +25 -135
  25. package/es/components/appointmentBooking/components/TimeSlicing/index.d.ts +1 -1
  26. package/es/components/appointmentBooking/components/TimeSlicing/index.js +44 -755
  27. package/es/components/appointmentBooking/context.d.ts +23 -0
  28. package/es/components/appointmentBooking/context.js +71 -0
  29. package/es/components/appointmentBooking/hooks.d.ts +6 -8
  30. package/es/components/appointmentBooking/hooks.js +119 -62
  31. package/es/components/appointmentBooking/index.js +2 -3
  32. package/es/components/appointmentBooking/locales.d.ts +12 -0
  33. package/es/components/appointmentBooking/locales.js +21 -3
  34. package/es/components/appointmentBooking/utils.d.ts +12 -0
  35. package/es/components/appointmentBooking/utils.js +70 -0
  36. package/lib/components/appointmentBooking/components/{Provider/Cart → Cart}/ContinueButton/index.js +18 -16
  37. package/lib/components/appointmentBooking/components/{Provider/Cart → Cart}/Item/Total.js +7 -11
  38. package/lib/components/appointmentBooking/components/{Provider/Cart → Cart}/Item/index.js +22 -21
  39. package/lib/components/appointmentBooking/components/{Provider/Cart → Cart}/index.js +1 -1
  40. package/lib/components/appointmentBooking/components/Content/index.js +26 -14
  41. package/lib/components/appointmentBooking/components/Date/index.js +53 -16
  42. package/lib/components/appointmentBooking/components/Date/index.less +1 -0
  43. package/lib/components/appointmentBooking/components/Footer/index.js +3 -3
  44. package/lib/components/appointmentBooking/components/Guest/index.d.ts +3 -0
  45. package/lib/components/appointmentBooking/components/{Provider/Information → Guest}/index.js +43 -52
  46. package/lib/components/appointmentBooking/components/Header/index.js +2 -3
  47. package/lib/components/appointmentBooking/components/Resource/index.d.ts +1 -1
  48. package/lib/components/appointmentBooking/components/Resource/index.js +55 -41
  49. package/lib/components/appointmentBooking/components/Resource/index.less +6 -0
  50. package/lib/components/appointmentBooking/components/Services/index.js +15 -155
  51. package/lib/components/appointmentBooking/components/TimeSlicing/index.d.ts +1 -1
  52. package/lib/components/appointmentBooking/components/TimeSlicing/index.js +17 -941
  53. package/lib/components/appointmentBooking/context.d.ts +23 -0
  54. package/lib/components/appointmentBooking/context.js +85 -0
  55. package/lib/components/appointmentBooking/hooks.d.ts +6 -8
  56. package/lib/components/appointmentBooking/hooks.js +44 -20
  57. package/lib/components/appointmentBooking/index.js +2 -5
  58. package/lib/components/appointmentBooking/locales.d.ts +12 -0
  59. package/lib/components/appointmentBooking/locales.js +15 -3
  60. package/lib/components/appointmentBooking/utils.d.ts +12 -0
  61. package/lib/components/appointmentBooking/utils.js +62 -2
  62. package/package.json +2 -2
  63. package/es/components/appointmentBooking/components/Information/index.d.ts +0 -3
  64. package/es/components/appointmentBooking/components/Information/index.js +0 -178
  65. package/es/components/appointmentBooking/components/Provider/Cart/Item/index.js +0 -68
  66. package/es/components/appointmentBooking/components/Provider/Content/index.d.ts +0 -3
  67. package/es/components/appointmentBooking/components/Provider/Content/index.js +0 -64
  68. package/es/components/appointmentBooking/components/Provider/Content/index.less +0 -31
  69. package/es/components/appointmentBooking/components/Provider/EmptyHolderModal/index.d.ts +0 -3
  70. package/es/components/appointmentBooking/components/Provider/EmptyHolderModal/index.js +0 -34
  71. package/es/components/appointmentBooking/components/Provider/EmptyHolderModal/index.less +0 -17
  72. package/es/components/appointmentBooking/components/Provider/Event/index.d.ts +0 -3
  73. package/es/components/appointmentBooking/components/Provider/Event/index.js +0 -93
  74. package/es/components/appointmentBooking/components/Provider/Event/index.less +0 -20
  75. package/es/components/appointmentBooking/components/Provider/Information/index.d.ts +0 -3
  76. package/es/components/appointmentBooking/components/Provider/InformationOptionsModal/index.d.ts +0 -3
  77. package/es/components/appointmentBooking/components/Provider/InformationOptionsModal/index.js +0 -34
  78. package/es/components/appointmentBooking/components/Provider/InformationOptionsModal/index.less +0 -27
  79. package/es/components/appointmentBooking/components/Provider/OrderProductModal/index.d.ts +0 -3
  80. package/es/components/appointmentBooking/components/Provider/OrderProductModal/index.js +0 -27
  81. package/es/components/appointmentBooking/components/Provider/OrderProductModal/index.less +0 -32
  82. package/es/components/appointmentBooking/components/Provider/RemoveOptionConfirmModal.d.ts +0 -2
  83. package/es/components/appointmentBooking/components/Provider/RemoveOptionConfirmModal.js +0 -31
  84. package/es/components/appointmentBooking/components/Provider/Resource/index.d.ts +0 -3
  85. package/es/components/appointmentBooking/components/Provider/Resource/index.js +0 -79
  86. package/es/components/appointmentBooking/components/Provider/Resource/index.less +0 -46
  87. package/es/components/appointmentBooking/components/Provider/SelectHolderModal.d.ts +0 -2
  88. package/es/components/appointmentBooking/components/Provider/SelectHolderModal.js +0 -90
  89. package/es/components/appointmentBooking/components/Provider/SelectProduct/index.d.ts +0 -4
  90. package/es/components/appointmentBooking/components/Provider/SelectProduct/index.js +0 -77
  91. package/es/components/appointmentBooking/components/Provider/SelectProduct/index.less +0 -131
  92. package/es/components/booking/info/service2/utils.d.ts +0 -240
  93. package/es/components/eventBooking/components/Provider/Information/index.d.ts +0 -3
  94. package/lib/components/appointmentBooking/components/Information/index.d.ts +0 -3
  95. package/lib/components/appointmentBooking/components/Information/index.js +0 -151
  96. package/lib/components/appointmentBooking/components/Information/index.less +0 -92
  97. package/lib/components/appointmentBooking/components/Provider/Cart/Item/index.d.ts +0 -3
  98. package/lib/components/appointmentBooking/components/Provider/Content/index.d.ts +0 -3
  99. package/lib/components/appointmentBooking/components/Provider/Content/index.js +0 -90
  100. package/lib/components/appointmentBooking/components/Provider/Content/index.less +0 -31
  101. package/lib/components/appointmentBooking/components/Provider/EmptyHolderModal/index.d.ts +0 -3
  102. package/lib/components/appointmentBooking/components/Provider/EmptyHolderModal/index.js +0 -60
  103. package/lib/components/appointmentBooking/components/Provider/EmptyHolderModal/index.less +0 -17
  104. package/lib/components/appointmentBooking/components/Provider/Event/index.d.ts +0 -3
  105. package/lib/components/appointmentBooking/components/Provider/Event/index.js +0 -100
  106. package/lib/components/appointmentBooking/components/Provider/Event/index.less +0 -20
  107. package/lib/components/appointmentBooking/components/Provider/Information/index.d.ts +0 -3
  108. package/lib/components/appointmentBooking/components/Provider/Information/index.less +0 -92
  109. package/lib/components/appointmentBooking/components/Provider/InformationOptionsModal/index.d.ts +0 -3
  110. package/lib/components/appointmentBooking/components/Provider/InformationOptionsModal/index.js +0 -67
  111. package/lib/components/appointmentBooking/components/Provider/InformationOptionsModal/index.less +0 -27
  112. package/lib/components/appointmentBooking/components/Provider/OrderProductModal/index.d.ts +0 -3
  113. package/lib/components/appointmentBooking/components/Provider/OrderProductModal/index.js +0 -57
  114. package/lib/components/appointmentBooking/components/Provider/OrderProductModal/index.less +0 -32
  115. package/lib/components/appointmentBooking/components/Provider/RemoveOptionConfirmModal.d.ts +0 -2
  116. package/lib/components/appointmentBooking/components/Provider/RemoveOptionConfirmModal.js +0 -62
  117. package/lib/components/appointmentBooking/components/Provider/Resource/index.d.ts +0 -3
  118. package/lib/components/appointmentBooking/components/Provider/Resource/index.js +0 -90
  119. package/lib/components/appointmentBooking/components/Provider/Resource/index.less +0 -46
  120. package/lib/components/appointmentBooking/components/Provider/SelectHolderModal.d.ts +0 -2
  121. package/lib/components/appointmentBooking/components/Provider/SelectHolderModal.js +0 -97
  122. package/lib/components/appointmentBooking/components/Provider/SelectProduct/index.d.ts +0 -4
  123. package/lib/components/appointmentBooking/components/Provider/SelectProduct/index.js +0 -69
  124. package/lib/components/appointmentBooking/components/Provider/SelectProduct/index.less +0 -131
  125. package/lib/components/booking/info/service2/utils.d.ts +0 -240
  126. package/lib/components/eventBooking/components/Provider/Cart/Item/index.d.ts +0 -3
  127. package/lib/components/eventBooking/components/Provider/Information/index.d.ts +0 -3
  128. /package/es/components/appointmentBooking/components/{Provider/Cart → Cart}/ContinueButton/index.d.ts +0 -0
  129. /package/es/components/appointmentBooking/components/{Provider/Cart → Cart}/ContinueButton/index.less +0 -0
  130. /package/es/components/appointmentBooking/components/{Provider/Cart → Cart}/Item/Total.d.ts +0 -0
  131. /package/es/components/appointmentBooking/components/{Provider/Cart → Cart}/Item/index.d.ts +0 -0
  132. /package/es/components/appointmentBooking/components/{Provider/Cart → Cart}/Item/index.less +0 -0
  133. /package/es/components/appointmentBooking/components/{Provider/Cart → Cart}/index.d.ts +0 -0
  134. /package/es/components/appointmentBooking/components/{Provider/Cart → Cart}/index.js +0 -0
  135. /package/es/components/appointmentBooking/components/{Provider/Cart → Cart}/index.less +0 -0
  136. /package/es/components/appointmentBooking/components/{Information → Guest}/index.less +0 -0
  137. /package/lib/components/appointmentBooking/components/{Provider/Cart → Cart}/ContinueButton/index.d.ts +0 -0
  138. /package/lib/components/appointmentBooking/components/{Provider/Cart → Cart}/ContinueButton/index.less +0 -0
  139. /package/lib/components/appointmentBooking/components/{Provider/Cart → Cart}/Item/Total.d.ts +0 -0
  140. /package/{es/components/eventBooking/components/Provider → lib/components/appointmentBooking/components}/Cart/Item/index.d.ts +0 -0
  141. /package/lib/components/appointmentBooking/components/{Provider/Cart → Cart}/Item/index.less +0 -0
  142. /package/lib/components/appointmentBooking/components/{Provider/Cart → Cart}/index.d.ts +0 -0
  143. /package/lib/components/appointmentBooking/components/{Provider/Cart → Cart}/index.less +0 -0
  144. /package/{es/components/appointmentBooking/components/Provider/Information → lib/components/appointmentBooking/components/Guest}/index.less +0 -0
@@ -0,0 +1,23 @@
1
+ import { ReactNode } from 'react';
2
+ interface AppointmentBookingContextType {
3
+ appointmentBooking: any;
4
+ times: any[];
5
+ resources: any[];
6
+ setTimes: (times: any[]) => void;
7
+ setResources: (lists: any[]) => void;
8
+ products: any[];
9
+ carts: any[];
10
+ summary: any;
11
+ setProducts: (val: any[]) => void;
12
+ setCarts: (val: any[]) => void;
13
+ setSummary: (val: any) => void;
14
+ currentStep: any;
15
+ isLastStep?: boolean;
16
+ setIsLastStep: (val: boolean) => void;
17
+ setCurrentStep: (val: any) => void;
18
+ }
19
+ export declare const AppointmentBookingProvider: ({ children, }: {
20
+ children: ReactNode;
21
+ }) => JSX.Element;
22
+ export declare const useAppointmentBookingContext: () => AppointmentBookingContextType;
23
+ export {};
@@ -0,0 +1,85 @@
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/context.tsx
30
+ var context_exports = {};
31
+ __export(context_exports, {
32
+ AppointmentBookingProvider: () => AppointmentBookingProvider,
33
+ useAppointmentBookingContext: () => useAppointmentBookingContext
34
+ });
35
+ module.exports = __toCommonJS(context_exports);
36
+ var import_react = __toESM(require("react"));
37
+ var import_hooks = require("./hooks");
38
+ var AppointmentBookingContext = (0, import_react.createContext)(void 0);
39
+ var AppointmentBookingProvider = ({
40
+ children
41
+ }) => {
42
+ const appointmentBooking = (0, import_hooks.useAppointmentBooking)();
43
+ const [products, setProducts] = (0, import_react.useState)([]);
44
+ const [summary, setSummary] = (0, import_react.useState)({});
45
+ const [times, setTimes] = (0, import_react.useState)([]);
46
+ const [resources, setResources] = (0, import_react.useState)([]);
47
+ const [currentStep, setCurrentStep] = (0, import_react.useState)(
48
+ appointmentBooking.getCurrentStep()
49
+ );
50
+ const [isLastStep, setIsLastStep] = (0, import_react.useState)(false);
51
+ const [carts, setCarts] = (0, import_react.useState)([]);
52
+ console.log(3234234, times, resources);
53
+ const value = {
54
+ appointmentBooking,
55
+ times,
56
+ resources,
57
+ products,
58
+ summary,
59
+ currentStep,
60
+ isLastStep,
61
+ carts,
62
+ setTimes,
63
+ setResources,
64
+ setProducts,
65
+ setSummary,
66
+ setCurrentStep,
67
+ setIsLastStep,
68
+ setCarts
69
+ };
70
+ return /* @__PURE__ */ import_react.default.createElement(AppointmentBookingContext.Provider, { value }, children);
71
+ };
72
+ var useAppointmentBookingContext = () => {
73
+ const context = (0, import_react.useContext)(AppointmentBookingContext);
74
+ if (context === void 0) {
75
+ throw new Error(
76
+ "useAppointmentBookingContext must be used within a AppointmentBookingProvider"
77
+ );
78
+ }
79
+ return context;
80
+ };
81
+ // Annotate the CommonJS export names for ESM import in node:
82
+ 0 && (module.exports = {
83
+ AppointmentBookingProvider,
84
+ useAppointmentBookingContext
85
+ });
@@ -1,14 +1,8 @@
1
1
  export declare const useAppointmentBooking: () => any;
2
- export declare const useAppointmentBookingStep: () => {
3
- currentStep: any;
4
- isLastStep: any;
5
- };
6
- export declare const useAppointmentBookingProduct: () => {
7
- products: any;
8
- };
2
+ export declare const useAppointmentBookingStep: () => void;
3
+ export declare const useAppointmentBookingProduct: () => void;
9
4
  export declare const useAppointmentBookingCart: () => {
10
5
  cart: any;
11
- products: any;
12
6
  };
13
7
  export declare const useAppointmentBookingLogin: () => {
14
8
  isLogin: boolean;
@@ -23,3 +17,7 @@ export declare const useAppointmentBookingAccount: () => {
23
17
  };
24
18
  accountLists: any;
25
19
  };
20
+ export declare const useAppointmentBookingResource: () => {
21
+ getResourceTimeSlot: (params: any) => Promise<void>;
22
+ getResourceList: () => Promise<void>;
23
+ };
@@ -34,13 +34,16 @@ __export(hooks_exports, {
34
34
  useAppointmentBookingCart: () => useAppointmentBookingCart,
35
35
  useAppointmentBookingLogin: () => useAppointmentBookingLogin,
36
36
  useAppointmentBookingProduct: () => useAppointmentBookingProduct,
37
+ useAppointmentBookingResource: () => useAppointmentBookingResource,
37
38
  useAppointmentBookingStep: () => useAppointmentBookingStep
38
39
  });
39
40
  module.exports = __toCommonJS(hooks_exports);
40
41
  var import_useEngineContext = require("../../hooks/useEngineContext");
41
42
  var import_useEngineContext2 = __toESM(require("../../hooks/useEngineContext"));
42
43
  var import_utils = require("@pisell/utils");
44
+ var import_utils2 = require("./utils");
43
45
  var import_react = require("react");
46
+ var import_context = require("./context");
44
47
  var useAppointmentBooking = () => {
45
48
  const pisellOS = (0, import_useEngineContext.usePisellOS)();
46
49
  return pisellOS.getModule("appointmentBooking");
@@ -48,55 +51,53 @@ var useAppointmentBooking = () => {
48
51
  var useAppointmentBookingStep = () => {
49
52
  var _a, _b, _c;
50
53
  const pisellOS = (0, import_useEngineContext.usePisellOS)();
51
- const appointmentBooking = useAppointmentBooking();
54
+ const { appointmentBooking, setCurrentStep, setIsLastStep } = (0, import_context.useAppointmentBookingContext)();
52
55
  const stepList = ((_c = (_b = (_a = appointmentBooking == null ? void 0 : appointmentBooking.store) == null ? void 0 : _a.step) == null ? void 0 : _b.store) == null ? void 0 : _c.stepList) || [];
53
- const [currentStep, setCurrentStep] = (0, import_react.useState)(appointmentBooking.getCurrentStep());
54
- const [isLastStep, setIsLastStep] = (0, import_react.useState)(false);
55
56
  (0, import_react.useEffect)(() => {
56
57
  pisellOS.effects.on(
57
58
  "appointmentBooking_step:changed",
58
59
  async (res) => {
59
- console.log("appointmentBooking_step:changed", res);
60
60
  if (res.path === "currentStep") {
61
- setCurrentStep(appointmentBooking.getCurrentStep());
61
+ const _currentStep = appointmentBooking.getCurrentStep();
62
+ setCurrentStep(_currentStep);
63
+ setIsLastStep((_currentStep == null ? void 0 : _currentStep.index) === stepList.length - 1);
62
64
  }
63
65
  }
64
66
  );
65
67
  }, []);
66
- (0, import_react.useEffect)(() => {
67
- setIsLastStep((currentStep == null ? void 0 : currentStep.index) === stepList.length - 1);
68
- }, [currentStep == null ? void 0 : currentStep.index]);
69
- return { currentStep, isLastStep };
70
68
  };
71
69
  var useAppointmentBookingProduct = () => {
72
- const appointmentBooking = useAppointmentBooking();
73
- const [products, setProducts] = (0, import_react.useState)([]);
70
+ const { appointmentBooking, setProducts } = (0, import_context.useAppointmentBookingContext)();
74
71
  const { productModuleParams } = appointmentBooking.otherParams;
75
72
  (0, import_react.useEffect)(() => {
76
73
  appointmentBooking.loadProducts(productModuleParams).then((res) => {
74
+ console.log(res, "loadProductsloadProducts");
77
75
  setProducts(res || []);
78
76
  });
79
77
  }, []);
80
- return { products };
81
78
  };
82
79
  var useAppointmentBookingCart = () => {
83
80
  var _a, _b;
84
81
  const pisellOS = (0, import_useEngineContext.usePisellOS)();
85
- const appointmentBooking = useAppointmentBooking();
82
+ const { appointmentBooking, setCarts, setSummary } = (0, import_context.useAppointmentBookingContext)();
86
83
  const cart = (_b = (_a = appointmentBooking == null ? void 0 : appointmentBooking.store) == null ? void 0 : _a.cart) == null ? void 0 : _b.store;
87
- const [products, setProducts] = (0, import_react.useState)([]);
88
- const [selectedHolderIds, setSelectedHolderIds] = (0, import_react.useState)([]);
89
- const [holders, setHolders] = (0, import_react.useState)([]);
90
- console.log(appointmentBooking, cart, "appointmentBooking3333555");
91
84
  (0, import_react.useEffect)(() => {
85
+ var _a2;
92
86
  pisellOS.effects.on(
93
87
  "appointmentBooking_cart:changed",
94
88
  async (res) => {
95
- setProducts((res == null ? void 0 : res.products) || []);
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
94
  }
97
95
  );
96
+ (_a2 = appointmentBooking == null ? void 0 : appointmentBooking.getCart) == null ? void 0 : _a2.call(appointmentBooking).then((data) => {
97
+ setCarts(data || []);
98
+ });
98
99
  }, []);
99
- return { cart, products };
100
+ return { cart };
100
101
  };
101
102
  var useAppointmentBookingLogin = () => {
102
103
  var _a, _b;
@@ -135,14 +136,36 @@ var useAppointmentBookingAccount = () => {
135
136
  async (res) => {
136
137
  if (res.path === "accounts") {
137
138
  appointmentBooking.getAccounts().then((data) => {
138
- console.log(data, "wh98976");
139
+ setAccountLists(data || []);
139
140
  });
140
141
  }
141
142
  }
142
143
  );
144
+ appointmentBooking.getAccounts().then((data) => {
145
+ setAccountLists(data || []);
146
+ });
143
147
  }, []);
144
148
  return { currentUser, accountLists };
145
149
  };
150
+ var useAppointmentBookingResource = () => {
151
+ const { appointmentBooking, setResources, setTimes } = (0, import_context.useAppointmentBookingContext)();
152
+ const { resourceSort } = (appointmentBooking == null ? void 0 : appointmentBooking.otherParams) || {};
153
+ const getResourceTimeSlot = async (params) => {
154
+ const data = await appointmentBooking.getResourceTimeSlot(params);
155
+ setTimes(data || []);
156
+ };
157
+ const getResourceList = async () => {
158
+ let resources = appointmentBooking.getResourcesList();
159
+ resources = resources.map((item) => {
160
+ return {
161
+ ...item,
162
+ resources: (0, import_utils2.sortResources)((item == null ? void 0 : item.resources) || [], resourceSort)
163
+ };
164
+ });
165
+ setResources(resources || []);
166
+ };
167
+ return { getResourceTimeSlot, getResourceList };
168
+ };
146
169
  // Annotate the CommonJS export names for ESM import in node:
147
170
  0 && (module.exports = {
148
171
  useAppointmentBooking,
@@ -150,5 +173,6 @@ var useAppointmentBookingAccount = () => {
150
173
  useAppointmentBookingCart,
151
174
  useAppointmentBookingLogin,
152
175
  useAppointmentBookingProduct,
176
+ useAppointmentBookingResource,
153
177
  useAppointmentBookingStep
154
178
  });
@@ -33,13 +33,12 @@ __export(appointmentBooking_exports, {
33
33
  });
34
34
  module.exports = __toCommonJS(appointmentBooking_exports);
35
35
  var import_react = __toESM(require("react"));
36
- var import_Header = __toESM(require("./components/Header"));
37
- var import_Footer = __toESM(require("./components/Footer"));
38
36
  var import_Content = __toESM(require("./components/Content"));
39
37
  var import_utils = require("@pisell/utils");
40
38
  var import_useEngineContext = __toESM(require("../../hooks/useEngineContext"));
41
39
  var import_index = require("./index.less");
42
40
  var import_locales = __toESM(require("./locales"));
41
+ var import_context = require("./context");
43
42
  var import_hooks = require("./hooks");
44
43
  var AppointmentBooking = () => {
45
44
  var _a;
@@ -57,9 +56,7 @@ var AppointmentBooking = () => {
57
56
  {
58
57
  className: `parallel-booking-wrap ${(0, import_utils.isMobile)() ? "parallel-booking-mobile-wrap" : ""}`
59
58
  },
60
- /* @__PURE__ */ import_react.default.createElement(import_Header.default, null),
61
- /* @__PURE__ */ import_react.default.createElement(import_Content.default, null),
62
- (0, import_utils.isMobile)() ? /* @__PURE__ */ import_react.default.createElement(import_Footer.default, null) : null
59
+ /* @__PURE__ */ import_react.default.createElement(import_context.AppointmentBookingProvider, null, /* @__PURE__ */ import_react.default.createElement(import_Content.default, null))
63
60
  );
64
61
  };
65
62
  var appointmentBooking_default = AppointmentBooking;
@@ -70,6 +70,10 @@ 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.service.title': (val: number) => string;
74
+ 'pisell2.appointment.add.guest': string;
75
+ 'pisell2.appointment.edit.service': string;
76
+ 'pisell2.appointment.remove.guest': string;
73
77
  };
74
78
  'zh-CN': {
75
79
  'pisell2.event.calendar.limit.unavailable': string;
@@ -142,6 +146,10 @@ declare const _default: {
142
146
  'pisell2.event.capacity.limit.reached.title': string;
143
147
  'pisell2.event.capacity.limit.reached.tip': string;
144
148
  'pisell2.appointment.booking.empty.service': string;
149
+ 'pisell2.appointment.service.title': (val: number) => string;
150
+ 'pisell2.appointment.add.guest': string;
151
+ 'pisell2.appointment.edit.service': string;
152
+ 'pisell2.appointment.remove.guest': string;
145
153
  };
146
154
  'zh-HK': {
147
155
  'pisell2.event.calendar.limit.unavailable': string;
@@ -214,6 +222,10 @@ declare const _default: {
214
222
  'pisell2.event.capacity.limit.reached.title': string;
215
223
  'pisell2.event.capacity.limit.reached.tip': string;
216
224
  'pisell2.appointment.booking.empty.service': string;
225
+ 'pisell2.appointment.service.title': (val: number) => string;
226
+ 'pisell2.appointment.add.guest': string;
227
+ 'pisell2.appointment.edit.service': string;
228
+ 'pisell2.appointment.remove.guest': string;
217
229
  };
218
230
  };
219
231
  export default _default;
@@ -93,7 +93,11 @@ var locales_default = {
93
93
  "pisell2.event.event.full.ok": "Ok",
94
94
  "pisell2.event.capacity.limit.reached.title": "Capacity limit reached",
95
95
  "pisell2.event.capacity.limit.reached.tip": "One or more events in your cart are no longer available due to full capacity. Please remove unavailable events from your cart to complete checkout.",
96
- "pisell2.appointment.booking.empty.service": "No service"
96
+ "pisell2.appointment.booking.empty.service": "No service",
97
+ "pisell2.appointment.service.title": (val) => `${val} ${val > 1 ? "services" : "service"}`,
98
+ "pisell2.appointment.add.guest": "Add guest",
99
+ "pisell2.appointment.edit.service": "Edit services",
100
+ "pisell2.appointment.remove.guest": "Remove guest"
97
101
  },
98
102
  "zh-CN": {
99
103
  "pisell2.event.calendar.limit.unavailable": "不可预约",
@@ -165,7 +169,11 @@ var locales_default = {
165
169
  "pisell2.event.event.full.ok": "好的",
166
170
  "pisell2.event.capacity.limit.reached.title": "活动名额已满",
167
171
  "pisell2.event.capacity.limit.reached.tip": "购物车中有一个或多个活动已达预约上限,请将已满额的活动从购物车中移除后再完成结算。",
168
- "pisell2.appointment.booking.empty.service": "暂无服务"
172
+ "pisell2.appointment.booking.empty.service": "暂无服务",
173
+ "pisell2.appointment.service.title": (val) => `${val}个服务`,
174
+ "pisell2.appointment.add.guest": "添加预约人",
175
+ "pisell2.appointment.edit.service": "编辑服务",
176
+ "pisell2.appointment.remove.guest": "移除预约人"
169
177
  },
170
178
  "zh-HK": {
171
179
  "pisell2.event.calendar.limit.unavailable": "不可預約",
@@ -237,6 +245,10 @@ var locales_default = {
237
245
  "pisell2.event.event.full.ok": "好的",
238
246
  "pisell2.event.capacity.limit.reached.title": "活動名額已滿",
239
247
  "pisell2.event.capacity.limit.reached.tip": "購物車中有一個或多個活動已達預約上限,請將已滿額的活動從購物車中移除後再完成結算。",
240
- "pisell2.appointment.booking.empty.service": "暫無服務"
248
+ "pisell2.appointment.booking.empty.service": "暫無服務",
249
+ "pisell2.appointment.service.title": (val) => `${val}个服務`,
250
+ "pisell2.appointment.add.guest": "添加預約人",
251
+ "pisell2.appointment.edit.service": "編輯服務",
252
+ "pisell2.appointment.remove.guest": "移除預約人"
241
253
  }
242
254
  };
@@ -43,3 +43,15 @@ export declare const formatMonthDisplay: (dateString: string) => string;
43
43
  * @Date: 2025-02-11 13:39
44
44
  */
45
45
  export declare const resourceTitle: (data: any) => any;
46
+ export declare const formatHolder: (data: any[]) => any[];
47
+ export declare const formatGuest: (data: any[], products: any) => any[];
48
+ /**
49
+ * @title: 对资源进行排序
50
+ * @description:
51
+ * @param {any} currentResourcesMap
52
+ * @param {any} resourceSort
53
+ * @return {*}
54
+ * @Author: WangHan
55
+ * @Date: 2025-04-14 11:16
56
+ */
57
+ export declare const sortResources: (resources: any[], resourceSort: any[]) => any[] | undefined;
@@ -30,10 +30,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  var utils_exports = {};
31
31
  __export(utils_exports, {
32
32
  formatBackgroundColors: () => formatBackgroundColors,
33
+ formatGuest: () => formatGuest,
34
+ formatHolder: () => formatHolder,
33
35
  formatMonthDisplay: () => formatMonthDisplay,
34
36
  getScheduleColors: () => getScheduleColors,
35
37
  getUsableSchedules: () => getUsableSchedules,
36
- resourceTitle: () => resourceTitle
38
+ resourceTitle: () => resourceTitle,
39
+ sortResources: () => sortResources
37
40
  });
38
41
  module.exports = __toCommonJS(utils_exports);
39
42
  var import_dayjs = __toESM(require("dayjs"));
@@ -80,11 +83,68 @@ var resourceTitle = (data) => {
80
83
  const translation = (_f = (_e = context == null ? void 0 : context.appHelper) == null ? void 0 : _e.utils) == null ? void 0 : _f.translation;
81
84
  return (_g = translation(title)) == null ? void 0 : _g.toLowerCase();
82
85
  };
86
+ var formatHolder = (data) => {
87
+ return data == null ? void 0 : data.map((d) => {
88
+ return {
89
+ ...d,
90
+ key: d == null ? void 0 : d.id,
91
+ label: d == null ? void 0 : d.username,
92
+ name: d == null ? void 0 : d.username
93
+ };
94
+ });
95
+ };
96
+ var formatGuest = (data, products) => {
97
+ return data == null ? void 0 : data.map((d) => {
98
+ const children = products.filter((p) => (p == null ? void 0 : p.holder_id) === (d == null ? void 0 : d.id)).map((p) => {
99
+ return {
100
+ name: p == null ? void 0 : p.name
101
+ };
102
+ });
103
+ return {
104
+ ...d,
105
+ key: d == null ? void 0 : d.id,
106
+ name: d == null ? void 0 : d.username,
107
+ children: children || []
108
+ };
109
+ });
110
+ };
111
+ var sortResources = (resources, resourceSort) => {
112
+ try {
113
+ let sortedResources = resources.sort((a, b) => {
114
+ const aIndex = resourceSort.indexOf(a.code);
115
+ const bIndex = resourceSort.indexOf(b.code);
116
+ return aIndex - bIndex;
117
+ });
118
+ sortedResources = sortedResources.map((resource) => {
119
+ var _a;
120
+ const renderList = (_a = resource == null ? void 0 : resource.renderList) == null ? void 0 : _a.map((d) => {
121
+ var _a2, _b;
122
+ return {
123
+ ...d,
124
+ image: (_b = (_a2 = d == null ? void 0 : d.cover) == null ? void 0 : _a2[0]) == null ? void 0 : _b.url,
125
+ title: d == null ? void 0 : d.main_field,
126
+ subtitle: d == null ? void 0 : d.sub_field
127
+ };
128
+ });
129
+ return {
130
+ ...resource,
131
+ renderList
132
+ };
133
+ });
134
+ console.log(sortedResources, "sortedResources");
135
+ return sortedResources || [];
136
+ } catch (error) {
137
+ console.log(error, "wh2222");
138
+ }
139
+ };
83
140
  // Annotate the CommonJS export names for ESM import in node:
84
141
  0 && (module.exports = {
85
142
  formatBackgroundColors,
143
+ formatGuest,
144
+ formatHolder,
86
145
  formatMonthDisplay,
87
146
  getScheduleColors,
88
147
  getUsableSchedules,
89
- resourceTitle
148
+ resourceTitle,
149
+ sortResources
90
150
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "3.2.17",
3
+ "version": "3.2.18",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -59,8 +59,8 @@
59
59
  "react-infinite-scroll-component": "^6.1.0",
60
60
  "rc-virtual-list": "^3.11.3",
61
61
  "decimal.js": "^10.4.3",
62
+ "@pisell/materials": "3.2.17",
62
63
  "@pisell/utils": "1.0.42",
63
- "@pisell/materials": "3.2.16",
64
64
  "@pisell/icon": "0.0.11",
65
65
  "@pisell/date-picker": "3.0.2"
66
66
  },
@@ -1,3 +0,0 @@
1
- import './index.less';
2
- declare const Information: () => JSX.Element;
3
- export default Information;
@@ -1,178 +0,0 @@
1
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
- import React, { useState } from 'react';
8
- import { Dropdown } from 'antd';
9
- import { Button, Iconfont, PisellCard, PisellAvatar } from '@pisell/materials';
10
- import { locales, isMobile } from '@pisell/utils';
11
- import { useCart, useHolder, useStep } from "../../../Sales";
12
- import SelectHolderModal from "../Provider/SelectHolderModal";
13
- import InformationOptionsModal from "../Provider/InformationOptionsModal/index";
14
- import RemoveOptionConfirmModal from "../Provider/RemoveOptionConfirmModal";
15
- import "./index.less";
16
- var Information = function Information() {
17
- var _useHolder = useHolder(),
18
- onHolderOpen = _useHolder.onHolderOpen,
19
- open = _useHolder.open;
20
- var _useCart = useCart(),
21
- cartDataHolderList = _useCart.cartDataHolderList;
22
- var _useHolder2 = useHolder(),
23
- selectHolder = _useHolder2.selectHolder,
24
- deleteHolderById = _useHolder2.deleteHolderById;
25
- var _useStep = useStep(),
26
- prevStep = _useStep.prevStep;
27
- var _useState = useState(false),
28
- _useState2 = _slicedToArray(_useState, 2),
29
- openOption = _useState2[0],
30
- setOpenOption = _useState2[1];
31
- // 编辑哪个holder
32
- var _useState3 = useState(null),
33
- _useState4 = _slicedToArray(_useState3, 2),
34
- holderItem = _useState4[0],
35
- setHolderItem = _useState4[1];
36
- // 移除确认
37
- var _useState5 = useState(false),
38
- _useState6 = _slicedToArray(_useState5, 2),
39
- removeOpen = _useState6[0],
40
- setRemoveOpen = _useState6[1];
41
-
42
- /**
43
- * @title: 选项
44
- * @description:
45
- * @return {*}
46
- * @Author: WangHan
47
- * @Date: 2025-01-19 10:44
48
- */
49
- var options = [{
50
- key: 'edit',
51
- label: /*#__PURE__*/React.createElement("span", {
52
- className: "dropdown-menu-item"
53
- }, locales.getText('pisell2.event.edit.event'))
54
- }, {
55
- key: 'remove',
56
- label: /*#__PURE__*/React.createElement("span", {
57
- className: 'dropdown-menu-item dropdown-menu-remove-item'
58
- }, locales.getText('pisell2.event.remove'))
59
- }];
60
-
61
- /**
62
- * @title: 点击item触发
63
- * @description:
64
- * @param {string} key
65
- * @return {*}
66
- * @Author: WangHan
67
- * @Date: 2025-01-18 16:14
68
- */
69
- var handleClick = function handleClick(_ref, item) {
70
- var key = _ref.key;
71
- // 编辑holder
72
- if (key === 'edit') {
73
- selectHolder(item || holderItem, 'createCartItem');
74
- prevStep();
75
- return;
76
- }
77
-
78
- // 移除holder
79
- setRemoveOpen(true);
80
- };
81
-
82
- /**
83
- * @title: 渲染options
84
- * @description:
85
- * @param {any} item
86
- * @return {*}
87
- * @Author: WangHan
88
- * @Date: 2025-01-19 11:44
89
- */
90
- var renderOptionButton = function renderOptionButton(item) {
91
- if (isMobile()) {
92
- return /*#__PURE__*/React.createElement(Button, {
93
- size: "large",
94
- onClick: function onClick() {
95
- setHolderItem(item);
96
- setOpenOption(true);
97
- }
98
- }, locales.getText('pisell2.event.option'));
99
- }
100
- return /*#__PURE__*/React.createElement(Dropdown, {
101
- menu: {
102
- items: options,
103
- onClick: function onClick(e) {
104
- setHolderItem(item);
105
- handleClick(e, item);
106
- }
107
- },
108
- placement: "bottomRight",
109
- overlayClassName: "provider-information-custom-dropdown-menu"
110
- }, /*#__PURE__*/React.createElement(Button, null, locales.getText('pisell2.event.option')));
111
- };
112
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
113
- className: "provider-information-wrap"
114
- }, /*#__PURE__*/React.createElement("span", {
115
- className: "title"
116
- }, locales.getText('pisell2.event.confirm.information.tip')), cartDataHolderList === null || cartDataHolderList === void 0 ? void 0 : cartDataHolderList.map(function (item) {
117
- var _item$children;
118
- return /*#__PURE__*/React.createElement(PisellCard, {
119
- key: item.id,
120
- padding: 20,
121
- className: "information-card",
122
- isClickable: false
123
- }, /*#__PURE__*/React.createElement("div", {
124
- className: "information-header"
125
- }, /*#__PURE__*/React.createElement("div", {
126
- className: "information-left"
127
- }, /*#__PURE__*/React.createElement(PisellAvatar, {
128
- src: item.avatar,
129
- size: "md"
130
- }), /*#__PURE__*/React.createElement("div", {
131
- className: "information-title"
132
- }, /*#__PURE__*/React.createElement("span", null, item.name), /*#__PURE__*/React.createElement("span", {
133
- className: "subtitle"
134
- }, "".concat(locales.getText('pisell2.event.title')((_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.length))))), renderOptionButton(item)), item.children.map(function (child) {
135
- return /*#__PURE__*/React.createElement("div", {
136
- className: "child-wrap"
137
- }, child.name);
138
- }));
139
- }), /*#__PURE__*/React.createElement("span", {
140
- className: "add-tip"
141
- }, locales.getText('pisell2.event.confirm.information.other')), /*#__PURE__*/React.createElement(Button, {
142
- size: "large",
143
- style: {
144
- width: 'max-content'
145
- },
146
- onClick: function onClick() {
147
- onHolderOpen();
148
- },
149
- className: "provider-information-add-button"
150
- }, /*#__PURE__*/React.createElement(Iconfont, {
151
- type: "pisell2-plus",
152
- style: {
153
- fontSize: '20px'
154
- }
155
- }), locales.getText('pisell2.event.add.others'))), /*#__PURE__*/React.createElement(SelectHolderModal, {
156
- open: open,
157
- type: "create"
158
- }), /*#__PURE__*/React.createElement(InformationOptionsModal, {
159
- options: options,
160
- open: openOption,
161
- holderItem: holderItem,
162
- onCancel: function onCancel() {
163
- return setOpenOption(false);
164
- },
165
- onClick: handleClick
166
- }), /*#__PURE__*/React.createElement(RemoveOptionConfirmModal, {
167
- removeOpen: removeOpen,
168
- onCancel: function onCancel() {
169
- return setRemoveOpen(false);
170
- },
171
- onOk: function onOk() {
172
- deleteHolderById(holderItem.id);
173
- setRemoveOpen(false);
174
- setOpenOption(false);
175
- }
176
- }));
177
- };
178
- export default Information;