@pisell/private-materials 3.0.78 → 3.0.80

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 (67) 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 +9 -9
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +8 -8
  11. package/es/components/booking/components/addButton/index.js +3 -3
  12. package/es/components/booking/components/customSelect/index.d.ts +2 -0
  13. package/es/components/booking/components/customSelect/index.js +6 -1
  14. package/es/components/booking/components/drawer/index.d.ts +1 -0
  15. package/es/components/booking/components/drawer/index.js +4 -2
  16. package/es/components/booking/components/footer/index.js +0 -1
  17. package/es/components/booking/info/client/index.js +3 -0
  18. package/es/components/booking/info/clientVariant/hooks/useClientFn.d.ts +39 -0
  19. package/es/components/booking/info/clientVariant/hooks/useClientFn.js +378 -0
  20. package/es/components/booking/info/clientVariant/index.d.ts +1 -0
  21. package/es/components/booking/info/clientVariant/index.js +1 -0
  22. package/es/components/booking/info/clientVariant/vertical/SelectDrawer.d.ts +22 -0
  23. package/es/components/booking/info/clientVariant/vertical/SelectDrawer.js +321 -0
  24. package/es/components/booking/info/clientVariant/vertical/SelectDrawer.less +66 -0
  25. package/es/components/booking/info/clientVariant/vertical/index.d.ts +8 -0
  26. package/es/components/booking/info/clientVariant/vertical/index.js +205 -0
  27. package/es/components/booking/info/clientVariant/vertical/index.less +61 -0
  28. package/es/components/booking/info/index.js +1 -1
  29. package/es/components/booking/info/pet/index.d.ts +10 -1
  30. package/es/components/booking/info/pet/index.js +22 -14
  31. package/es/components/booking/info/service/addService/index.js +1 -1
  32. package/es/components/booking/info/utils.d.ts +1 -0
  33. package/es/components/booking/info/utils.js +12 -0
  34. package/es/components/booking/locales.d.ts +6 -0
  35. package/es/components/booking/locales.js +9 -3
  36. package/es/components/booking/model.d.ts +2 -0
  37. package/es/index.d.ts +1 -0
  38. package/es/index.js +1 -0
  39. package/lib/components/booking/components/addButton/index.js +2 -2
  40. package/lib/components/booking/components/customSelect/index.d.ts +2 -0
  41. package/lib/components/booking/components/customSelect/index.js +6 -1
  42. package/lib/components/booking/components/drawer/index.d.ts +1 -0
  43. package/lib/components/booking/components/drawer/index.js +2 -2
  44. package/lib/components/booking/components/footer/index.js +0 -1
  45. package/lib/components/booking/info/client/index.js +2 -1
  46. package/lib/components/booking/info/clientVariant/hooks/useClientFn.d.ts +39 -0
  47. package/lib/components/booking/info/clientVariant/hooks/useClientFn.js +308 -0
  48. package/lib/components/booking/info/clientVariant/index.d.ts +1 -0
  49. package/lib/components/booking/info/clientVariant/index.js +39 -0
  50. package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.d.ts +22 -0
  51. package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.js +344 -0
  52. package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.less +66 -0
  53. package/lib/components/booking/info/clientVariant/vertical/index.d.ts +8 -0
  54. package/lib/components/booking/info/clientVariant/vertical/index.js +230 -0
  55. package/lib/components/booking/info/clientVariant/vertical/index.less +61 -0
  56. package/lib/components/booking/info/index.js +1 -1
  57. package/lib/components/booking/info/pet/index.d.ts +10 -1
  58. package/lib/components/booking/info/pet/index.js +15 -8
  59. package/lib/components/booking/info/service/addService/index.js +1 -1
  60. package/lib/components/booking/info/utils.d.ts +1 -0
  61. package/lib/components/booking/info/utils.js +16 -2
  62. package/lib/components/booking/locales.d.ts +6 -0
  63. package/lib/components/booking/locales.js +9 -3
  64. package/lib/components/booking/model.d.ts +2 -0
  65. package/lib/index.d.ts +1 -0
  66. package/lib/index.js +5 -2
  67. package/package.json +2 -2
@@ -0,0 +1,308 @@
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/booking/info/clientVariant/hooks/useClientFn.tsx
30
+ var useClientFn_exports = {};
31
+ __export(useClientFn_exports, {
32
+ default: () => useClientFn_default
33
+ });
34
+ module.exports = __toCommonJS(useClientFn_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_utils = require("../../../utils");
37
+ var import_serve = require("../../client/serve");
38
+ var import_model = require("../../model");
39
+ var import_utils2 = require("@pisell/utils");
40
+ var import_antd = require("antd");
41
+ var useClientFn = (_params) => {
42
+ var _a, _b, _c, _d, _e, _f, _g, _h;
43
+ const { state, setGlobalState, modalRef } = _params;
44
+ const [loadLoading, setLoadLoading] = (0, import_react.useState)(false);
45
+ const [loading, setLoading] = (0, import_react.useState)(false);
46
+ const [franchiseeLoading, setFranchiseeLoading] = (0, import_react.useState)(0);
47
+ const [params, setParams] = (0, import_react.useState)({
48
+ skip: 1,
49
+ num: 50,
50
+ total: 0,
51
+ search: "",
52
+ with: ["formRecord"],
53
+ relation_form_id: (_d = (_c = (_b = (_a = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _a.config) == null ? void 0 : _b.basic) == null ? void 0 : _c.appointment_subject) == null ? void 0 : _d.form_id
54
+ });
55
+ const paramsRef = (0, import_react.useRef)(params);
56
+ paramsRef.current = params;
57
+ (0, import_react.useEffect)(() => {
58
+ setParams((v) => {
59
+ var _a2, _b2, _c2, _d2;
60
+ return {
61
+ ...v,
62
+ relation_form_id: (_d2 = (_c2 = (_b2 = (_a2 = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _a2.config) == null ? void 0 : _b2.basic) == null ? void 0 : _c2.appointment_subject) == null ? void 0 : _d2.form_id
63
+ };
64
+ });
65
+ }, [(_g = (_f = (_e = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _e.config) == null ? void 0 : _f.basic) == null ? void 0 : _g.appointment_subject]);
66
+ const stateRef = (0, import_react.useRef)(state);
67
+ stateRef.current = state;
68
+ const isWalkIn = (0, import_react.useMemo)(() => {
69
+ var _a2;
70
+ return (0, import_utils.isWalkIn)((_a2 = state.client.value) == null ? void 0 : _a2.id);
71
+ }, [(_h = state.client.value) == null ? void 0 : _h.id]);
72
+ const getClients = async ({
73
+ customer_id,
74
+ ...resetParams
75
+ }) => {
76
+ let _setLoading = resetParams.skip === 1 ? setLoading : setLoadLoading;
77
+ _setLoading(true);
78
+ const api = state.isFranchisee ? import_serve.getFranchiseeCustomerList : state.apis.getClients;
79
+ const data = await api({
80
+ ...resetParams,
81
+ ...!state.isFranchisee ? { _config: { abort: true } } : {}
82
+ });
83
+ const list = ((data == null ? void 0 : data.list) || []).map((d) => {
84
+ return {
85
+ ...d,
86
+ name: getNickname(d),
87
+ id: d.franchisee_customer_id || d.id,
88
+ form_record: d.form_record.map((item) => ({
89
+ ...item,
90
+ ...item.data,
91
+ form_record_id: item.id
92
+ }))
93
+ };
94
+ });
95
+ let _payload = {
96
+ clients: list
97
+ };
98
+ if (!(0, import_utils.isWalkIn)(customer_id)) {
99
+ const customerItem = list.find((d) => d.id === customer_id);
100
+ if (customerItem) {
101
+ _payload.value = customerItem;
102
+ _payload.edit = true;
103
+ }
104
+ }
105
+ let totalList = [...state.client.clients];
106
+ if (resetParams.skip === 1) {
107
+ totalList = list;
108
+ } else {
109
+ totalList = totalList.concat(list);
110
+ }
111
+ _payload.clients = totalList;
112
+ setParams({
113
+ ...params,
114
+ ...resetParams,
115
+ total: (data == null ? void 0 : data.count) || 0
116
+ });
117
+ setGlobalState({
118
+ client: {
119
+ ...stateRef.current.client,
120
+ ..._payload
121
+ }
122
+ });
123
+ _setLoading(false);
124
+ return {};
125
+ };
126
+ const handleOpenClientModal = () => {
127
+ var _a2;
128
+ if (state.disabledEdit) {
129
+ return;
130
+ }
131
+ setClient({
132
+ showModal: true
133
+ });
134
+ getClients({ ...paramsRef.current, search: "", skip: 1 });
135
+ (_a2 = modalRef.current) == null ? void 0 : _a2.open();
136
+ };
137
+ const handleViewClient = () => {
138
+ state.action({
139
+ type: "pisell1.handleOpenCustomerModal",
140
+ data: { id: state.client.value.id },
141
+ callback: (data) => {
142
+ if (state.disabledEdit) {
143
+ return;
144
+ }
145
+ if (data) {
146
+ handleSelectClient([data]);
147
+ }
148
+ getClients({
149
+ ...state.client.clientsParams,
150
+ search: "",
151
+ customer_id: data == null ? void 0 : data.id,
152
+ skip: 1
153
+ });
154
+ }
155
+ });
156
+ };
157
+ const menus = (0, import_react.useMemo)(() => {
158
+ let list = [
159
+ // { key: "view", label: locales.getText("pisell2.text.view-profile") },
160
+ { key: "change", label: import_utils2.locales.getText("pisell2.text.change-customer") },
161
+ { key: "remove", label: import_utils2.locales.getText("pisell2.text.remove-customer") }
162
+ ];
163
+ if (state.disabledEdit) {
164
+ list = list.filter((d) => d.key === "view");
165
+ }
166
+ return list;
167
+ }, [state.disabledEdit]);
168
+ const handleRemoveClient = () => {
169
+ if (state.disabledEdit) {
170
+ return;
171
+ }
172
+ handleSelectClient([import_model.walkInData]);
173
+ };
174
+ const menuChange = (e) => {
175
+ e.domEvent.stopPropagation();
176
+ let maps = {
177
+ view: handleViewClient,
178
+ change: handleOpenClientModal,
179
+ remove: handleRemoveClient
180
+ };
181
+ maps[e.key]();
182
+ };
183
+ const setClient = (client) => {
184
+ setGlobalState({
185
+ client: {
186
+ ...stateRef.current.client,
187
+ ...client
188
+ }
189
+ });
190
+ };
191
+ const _getFranchiseeCustomerInfo = async (customer) => {
192
+ try {
193
+ setFranchiseeLoading(customer.id);
194
+ const res = await (0, import_serve.getFranchiseeCustomerInfo)({
195
+ franchisor_customer_id: customer.id
196
+ });
197
+ setFranchiseeLoading(0);
198
+ return {
199
+ ...customer,
200
+ id: res.franchisee_customer_id
201
+ };
202
+ } catch (err) {
203
+ setFranchiseeLoading(0);
204
+ }
205
+ };
206
+ const getNickname = (0, import_react.useCallback)(
207
+ (item) => {
208
+ if ((0, import_utils.isWalkIn)(item == null ? void 0 : item.id)) {
209
+ return import_utils2.locales.getText("pisell2.text.select-a-customer");
210
+ }
211
+ return item.name || (item.display_name || "").trim() || (item.nickname || "").trim() || "";
212
+ },
213
+ [import_utils2.locales.localeMap]
214
+ );
215
+ (0, import_react.useEffect)(() => {
216
+ if (state.action) {
217
+ state.action({
218
+ type: "pisell1.registerPlugin",
219
+ data: {
220
+ pluginList: ["CustomerDetailPlugin"]
221
+ }
222
+ });
223
+ }
224
+ }, []);
225
+ const handleSelectClient = async (value) => {
226
+ let _value = (value == null ? void 0 : value[value.length - 1]) || import_model.walkInData;
227
+ if (_value.loading) {
228
+ return;
229
+ }
230
+ if (state.isFranchisee && _value.franchisee_customer_id === 0) {
231
+ try {
232
+ _value = await _getFranchiseeCustomerInfo(_value);
233
+ } catch (err) {
234
+ }
235
+ if (!_value) {
236
+ return;
237
+ }
238
+ }
239
+ setClient({
240
+ value: {
241
+ ..._value,
242
+ name: getNickname(_value)
243
+ },
244
+ edit: true
245
+ });
246
+ return new Promise((resolve) => {
247
+ resolve(0);
248
+ });
249
+ };
250
+ const handleCreateItem = () => {
251
+ state.action({
252
+ type: "pisell1.handleOpenAddCustomerModal",
253
+ data: {
254
+ showReceiveAddress: false,
255
+ showAcceptsMarketing: false
256
+ },
257
+ callback: (customer_id) => {
258
+ getClients({
259
+ ...state.client.clientsParams,
260
+ search: "",
261
+ customer_id,
262
+ skip: 1
263
+ });
264
+ }
265
+ });
266
+ };
267
+ const searchChange = (search) => {
268
+ let _params2 = {
269
+ ...paramsRef.current,
270
+ skip: 1,
271
+ search
272
+ };
273
+ getClients({ ..._params2 });
274
+ };
275
+ const loadMore = (0, import_react.useMemo)(() => {
276
+ const show = state.client.clients.length < params.total || 0;
277
+ return show ? /* @__PURE__ */ import_react.default.createElement("div", { className: "", style: { textAlign: "center", padding: "16px 0" } }, /* @__PURE__ */ import_react.default.createElement(
278
+ import_antd.Button,
279
+ {
280
+ loading: loadLoading,
281
+ onClick: () => {
282
+ let _params2 = {
283
+ ...params,
284
+ skip: params.skip + 1
285
+ };
286
+ getClients({ ..._params2 });
287
+ }
288
+ },
289
+ import_utils2.locales.getText("pisell2.text.load-more")
290
+ )) : null;
291
+ }, [loadLoading, params, state.client.clients.length]);
292
+ return {
293
+ setClient,
294
+ isWalkIn,
295
+ handleSelectClient,
296
+ menuChange,
297
+ handleViewClient,
298
+ menus,
299
+ handleCreateItem,
300
+ getClients,
301
+ params,
302
+ searchChange,
303
+ loading,
304
+ loadMore,
305
+ handleOpenClientModal
306
+ };
307
+ };
308
+ var useClientFn_default = useClientFn;
@@ -0,0 +1 @@
1
+ export { default as VerticalClient } from './vertical';
@@ -0,0 +1,39 @@
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/booking/info/clientVariant/index.tsx
30
+ var clientVariant_exports = {};
31
+ __export(clientVariant_exports, {
32
+ VerticalClient: () => import_vertical.default
33
+ });
34
+ module.exports = __toCommonJS(clientVariant_exports);
35
+ var import_vertical = __toESM(require("./vertical"));
36
+ // Annotate the CommonJS export names for ESM import in node:
37
+ 0 && (module.exports = {
38
+ VerticalClient
39
+ });
@@ -0,0 +1,22 @@
1
+ import React from "react";
2
+ import "./SelectDrawer.less";
3
+ interface SelectDrawerProps {
4
+ autoFocus?: boolean;
5
+ onClose: () => void;
6
+ handleSelectClient: (val: any) => void;
7
+ handleCreateItem: () => void;
8
+ handleSelectPet: (val: any) => void;
9
+ childrenValue: any[];
10
+ formData: any;
11
+ searchChange: (val: string) => void;
12
+ options: any;
13
+ loading: boolean;
14
+ client: any;
15
+ loadMore: any;
16
+ showPet: boolean;
17
+ holder: any;
18
+ handleAddPet: any;
19
+ modalOpen: boolean;
20
+ }
21
+ declare const _default: React.ForwardRefExoticComponent<SelectDrawerProps & React.RefAttributes<unknown>>;
22
+ export default _default;