@pisell/private-materials 6.3.74 → 6.3.76

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 (50) 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/render/default/view.js +1 -1
  7. package/build/lowcode/view.js +1 -1
  8. package/es/components/appointmentBooking/components/Header/index.js +12 -12
  9. package/es/components/appointmentBooking/components/TimeSlicing/components/SelectDateOS.d.ts +2 -0
  10. package/es/components/appointmentBooking/components/TimeSlicing/components/SelectDateOS.js +82 -0
  11. package/es/components/appointmentBooking/components/TimeSlicing/index.js +46 -5
  12. package/es/components/appointmentBooking/components/Voucher/index.js +12 -2
  13. package/es/components/appointmentBooking/hooks.d.ts +1 -1
  14. package/es/components/appointmentBooking/hooks.js +6 -13
  15. package/es/components/appointmentBooking/utils.d.ts +23 -0
  16. package/es/components/appointmentBooking/utils.js +159 -0
  17. package/es/components/booking/addons/model.d.ts +1 -10
  18. package/es/components/booking/forms/model.d.ts +1 -10
  19. package/es/components/booking/info/model.d.ts +1 -10
  20. package/es/components/booking/info/service/addService/utils.d.ts +1 -1
  21. package/es/components/booking/info/service2/utils.js +38 -36
  22. package/es/components/booking/info2/service/addService/utils.d.ts +1 -1
  23. package/es/components/booking/model.d.ts +1 -9
  24. package/es/components/booking/notes/model.d.ts +1 -10
  25. package/es/components/booking/payments/model.d.ts +1 -10
  26. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/index.d.ts +0 -1
  27. package/es/components/pay/toC/model.d.ts +1 -9
  28. package/es/components/schedules/model.d.ts +1 -9
  29. package/lib/components/appointmentBooking/components/Header/index.js +3 -8
  30. package/lib/components/appointmentBooking/components/TimeSlicing/components/SelectDateOS.d.ts +2 -0
  31. package/lib/components/appointmentBooking/components/TimeSlicing/components/SelectDateOS.js +89 -0
  32. package/lib/components/appointmentBooking/components/TimeSlicing/index.js +27 -7
  33. package/lib/components/appointmentBooking/components/Voucher/index.js +12 -2
  34. package/lib/components/appointmentBooking/hooks.d.ts +1 -1
  35. package/lib/components/appointmentBooking/hooks.js +6 -11
  36. package/lib/components/appointmentBooking/utils.d.ts +23 -0
  37. package/lib/components/appointmentBooking/utils.js +103 -0
  38. package/lib/components/booking/addons/model.d.ts +1 -10
  39. package/lib/components/booking/forms/model.d.ts +1 -10
  40. package/lib/components/booking/info/model.d.ts +1 -10
  41. package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
  42. package/lib/components/booking/info/service2/utils.js +3 -1
  43. package/lib/components/booking/info2/service/addService/utils.d.ts +1 -1
  44. package/lib/components/booking/model.d.ts +1 -9
  45. package/lib/components/booking/notes/model.d.ts +1 -10
  46. package/lib/components/booking/payments/model.d.ts +1 -10
  47. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/index.d.ts +0 -1
  48. package/lib/components/pay/toC/model.d.ts +1 -9
  49. package/lib/components/schedules/model.d.ts +1 -9
  50. package/package.json +3 -3
@@ -23,6 +23,7 @@ __export(utils_exports, {
23
23
  checkAndGoNext: () => checkAndGoNext,
24
24
  checkAndMarkCartRenderError: () => checkAndMarkCartRenderError,
25
25
  checkHasFormStep: () => checkHasFormStep,
26
+ clearDataByStepKey: () => clearDataByStepKey,
26
27
  currentAppointmentBoard: () => currentAppointmentBoard,
27
28
  currentRenderLists: () => currentRenderLists,
28
29
  formatCarts: () => formatCarts,
@@ -42,6 +43,7 @@ __export(utils_exports, {
42
43
  getResourceTitle: () => getResourceTitle,
43
44
  hasResourceFormId: () => hasResourceFormId,
44
45
  openForm: () => openForm,
46
+ processResourceList: () => processResourceList,
45
47
  sortResources: () => sortResources,
46
48
  updateBookingFormStorage: () => updateBookingFormStorage,
47
49
  updateCartResources: () => updateCartResources,
@@ -165,6 +167,18 @@ var sortResources = (resources, resourceSort) => {
165
167
  console.log(error, "wh2222");
166
168
  }
167
169
  };
170
+ var processResourceList = (resources, resourceSort) => {
171
+ var _a;
172
+ const processedResources = resources.map((item) => {
173
+ return {
174
+ ...item,
175
+ resources: sortResources((item == null ? void 0 : item.resources) || [], resourceSort)
176
+ };
177
+ });
178
+ const _resources = ((_a = processedResources == null ? void 0 : processedResources[0]) == null ? void 0 : _a.resources) || [];
179
+ const resourceCodes = _resources.map((item) => item.code);
180
+ return { resources: processedResources, resourceCodes };
181
+ };
168
182
  var getMeAccount = (val) => {
169
183
  return val == null ? void 0 : val.find((d) => !(d == null ? void 0 : d.isGuest));
170
184
  };
@@ -487,12 +501,100 @@ var updateCartResources = (item, value, currentSelectedResources) => {
487
501
  }
488
502
  return newResource || [];
489
503
  };
504
+ var STEP_CLEAR_CONFIG = {
505
+ "select-time": ["time"],
506
+ "fill-form": ["time", "form"],
507
+ "select-resource": ["time", "form", "resource"],
508
+ "select-date": ["time", "form", "resource", "date"],
509
+ "select-service": ["time", "form", "resource", "date"]
510
+ };
511
+ var getMatchedStepKey = (key) => {
512
+ if (STEP_CLEAR_CONFIG[key]) {
513
+ return key;
514
+ }
515
+ const matchedKey = Object.keys(STEP_CLEAR_CONFIG).find(
516
+ (stepKey) => key.startsWith(stepKey)
517
+ );
518
+ return matchedKey || null;
519
+ };
520
+ var createClearActions = (appointmentBooking, setTimes) => {
521
+ return {
522
+ time: () => {
523
+ appointmentBooking.deleteCartItemInfo("time");
524
+ setTimes == null ? void 0 : setTimes([]);
525
+ },
526
+ resource: () => {
527
+ appointmentBooking.deleteCartItemInfo("resource");
528
+ },
529
+ form: () => {
530
+ appointmentBooking.deleteCartItemInfo("relationForms");
531
+ appointmentBooking.removeStep("fill-form");
532
+ },
533
+ date: () => {
534
+ var _a;
535
+ const { bookingProcess } = ((_a = appointmentBooking == null ? void 0 : appointmentBooking.otherParams) == null ? void 0 : _a.productModuleParams) || {};
536
+ if (bookingProcess !== "date_first") {
537
+ appointmentBooking.clearDateRange();
538
+ }
539
+ }
540
+ };
541
+ };
542
+ var clearServiceRelatedSteps = (appointmentBooking) => {
543
+ const stepList = (appointmentBooking == null ? void 0 : appointmentBooking.getStepList()) || [];
544
+ const stepKeysToRemove = ["select-resource_", "fill-form_"];
545
+ stepList.forEach((item) => {
546
+ if (item == null ? void 0 : item.isSkip) {
547
+ appointmentBooking.updateStep(item.key, {
548
+ key: item.key,
549
+ isSkip: false
550
+ });
551
+ }
552
+ const shouldRemove = stepKeysToRemove.some(
553
+ (prefix) => {
554
+ var _a;
555
+ return (_a = item.key) == null ? void 0 : _a.startsWith(prefix);
556
+ }
557
+ );
558
+ if (shouldRemove) {
559
+ appointmentBooking.removeStep(item.key);
560
+ }
561
+ });
562
+ };
563
+ var executeClearActions = (dataTypes, clearActions) => {
564
+ const uniqueTypes = Array.from(new Set(dataTypes));
565
+ uniqueTypes.forEach((type) => {
566
+ const action = clearActions[type];
567
+ if (action) {
568
+ action();
569
+ }
570
+ });
571
+ };
572
+ var clearDataByStepKey = (key, appointmentBooking, setTimes) => {
573
+ if (!key || !appointmentBooking) {
574
+ return;
575
+ }
576
+ if (key === "select-service") {
577
+ clearServiceRelatedSteps(appointmentBooking);
578
+ }
579
+ const stepKey = getMatchedStepKey(key);
580
+ if (!stepKey) {
581
+ return;
582
+ }
583
+ const clearDataTypes = STEP_CLEAR_CONFIG[stepKey] || [];
584
+ if (clearDataTypes.length === 0) {
585
+ return clearDataTypes;
586
+ }
587
+ const clearActions = createClearActions(appointmentBooking, setTimes);
588
+ executeClearActions(clearDataTypes, clearActions);
589
+ return clearDataTypes;
590
+ };
490
591
  // Annotate the CommonJS export names for ESM import in node:
491
592
  0 && (module.exports = {
492
593
  Toast,
493
594
  checkAndGoNext,
494
595
  checkAndMarkCartRenderError,
495
596
  checkHasFormStep,
597
+ clearDataByStepKey,
496
598
  currentAppointmentBoard,
497
599
  currentRenderLists,
498
600
  formatCarts,
@@ -512,6 +614,7 @@ var updateCartResources = (item, value, currentSelectedResources) => {
512
614
  getResourceTitle,
513
615
  hasResourceFormId,
514
616
  openForm,
617
+ processResourceList,
515
618
  sortResources,
516
619
  updateBookingFormStorage,
517
620
  updateCartResources,
@@ -1,10 +1 @@
1
- /// <reference types="react" />
2
- import { FormState } from "../model";
3
- export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
4
- state: FormState;
5
- } & {
6
- dispatch: (params: {
7
- type: string;
8
- payload: any;
9
- }) => void;
10
- }>;
1
+ export declare const Provider: any, Context: any;
@@ -1,10 +1 @@
1
- /// <reference types="react" />
2
- import { FormState } from "../model";
3
- export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
4
- state: FormState;
5
- } & {
6
- dispatch: (params: {
7
- type: string;
8
- payload: any;
9
- }) => void;
10
- }>;
1
+ export declare const Provider: any, Context: any;
@@ -1,14 +1,5 @@
1
- /// <reference types="react" />
2
- import { FormState } from '../model';
3
1
  export declare const walkInData: {
4
2
  id: number;
5
3
  nickname: string;
6
4
  };
7
- export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
8
- state: FormState;
9
- } & {
10
- dispatch: (params: {
11
- type: string;
12
- payload: any;
13
- }) => void;
14
- }>;
5
+ export declare const Provider: any, Context: any;
@@ -6,7 +6,7 @@ export declare const getDurationProps: ({ cacheItem, useStartTime, currentResour
6
6
  type: string;
7
7
  value: number;
8
8
  };
9
- locale: string;
9
+ locale: any;
10
10
  slice: any;
11
11
  selectProps: {
12
12
  size: string;
@@ -173,7 +173,9 @@ var currentResource = (state, useResource, cacheItem) => {
173
173
  };
174
174
  var handleChangeHolder = (products, currentItem, other) => {
175
175
  return products.map((item) => {
176
- if (item._id === currentItem._id) {
176
+ var _a, _b, _c, _d;
177
+ const isSameGroup = ((_a = item == null ? void 0 : item._extend) == null ? void 0 : _a.groupId) && ((_b = item._extend) == null ? void 0 : _b.groupId) === ((_d = (_c = currentItem == null ? void 0 : currentItem._origin) == null ? void 0 : _c._extend) == null ? void 0 : _d.groupId);
178
+ if (item._id === currentItem._id || isSameGroup) {
177
179
  return {
178
180
  ...item,
179
181
  _extend: {
@@ -7,7 +7,7 @@ export declare const getDurationProps: ({ cacheItem, useStartTime, currentResour
7
7
  type: string;
8
8
  value: number;
9
9
  };
10
- locale: string;
10
+ locale: any;
11
11
  slice: any;
12
12
  selectProps: {
13
13
  size: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export interface FormState {
3
2
  amountSymbol: string;
4
3
  apis: {
@@ -110,11 +109,4 @@ export declare const walkInData: {
110
109
  id: number;
111
110
  nickname: string;
112
111
  };
113
- export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
114
- state: FormState;
115
- } & {
116
- dispatch: (params: {
117
- type: string;
118
- payload: any;
119
- }) => void;
120
- }>;
112
+ export declare const Provider: any, Context: any;
@@ -1,10 +1 @@
1
- /// <reference types="react" />
2
- import { FormState } from "../model";
3
- export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
4
- state: FormState;
5
- } & {
6
- dispatch: (params: {
7
- type: string;
8
- payload: any;
9
- }) => void;
10
- }>;
1
+ export declare const Provider: any, Context: any;
@@ -1,10 +1 @@
1
- /// <reference types="react" />
2
- import { FormState } from "../model";
3
- export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
4
- state: FormState;
5
- } & {
6
- dispatch: (params: {
7
- type: string;
8
- payload: any;
9
- }) => void;
10
- }>;
1
+ export declare const Provider: any, Context: any;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.module.less';
3
2
  declare const StripePayment: () => JSX.Element;
4
3
  export default StripePayment;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export interface FormState {
3
2
  platform: 'pc' | 'h5' | '' | undefined;
4
3
  order: any;
@@ -30,11 +29,4 @@ export interface PayGroup {
30
29
  _order: any;
31
30
  front_order_uuid?: string;
32
31
  }
33
- export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
34
- state: FormState;
35
- } & {
36
- dispatch: (params: {
37
- type: string;
38
- payload: any;
39
- }) => void;
40
- }>;
32
+ export declare const Provider: any, Context: any;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { CalendarDataItem, ScheduleItem } from "./type";
3
2
  import dayjs from "dayjs";
4
3
  export interface FormState {
@@ -69,11 +68,4 @@ export interface FormState {
69
68
  };
70
69
  setGlobalState: Function | null;
71
70
  }
72
- export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
73
- state: FormState;
74
- } & {
75
- dispatch: (params: {
76
- type: string;
77
- payload: any;
78
- }) => void;
79
- }>;
71
+ export declare const Provider: any, Context: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "6.3.74",
3
+ "version": "6.3.76",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -76,10 +76,10 @@
76
76
  "react-infinite-scroll-component": "^6.1.0",
77
77
  "react-resizable": "^3.0.5",
78
78
  "styled-components": "^6.0.0-rc.3",
79
+ "@pisell/utils": "3.0.5",
79
80
  "@pisell/icon": "0.0.11",
80
81
  "@pisell/date-picker": "3.0.8",
81
- "@pisell/materials": "6.3.23",
82
- "@pisell/utils": "3.0.5"
82
+ "@pisell/materials": "6.3.23"
83
83
  },
84
84
  "peerDependencies": {
85
85
  "react": "^18.0.0",