@dotss/tictoccroc 0.6.3 → 0.7.1

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.
@@ -1,15 +1,27 @@
1
1
  import { FlexboxProps } from 'node_modules/@dotss/ui/Flexbox/Flexbox';
2
- export type BotMessageType = 'MATCHING_SUCCEEDED' | 'TEACHER_INQUIRED' | 'PARENT_CHANGED_OFFER_SCHEDULE' | 'PARENT_CHANGED_MATCHING_SCHEDULE' | 'TEACHER_APPLIED' | 'PARENT_SENT_OFFER' | 'KOK_MATCHING_SUCCEEDED' | 'APPLICATION_MATCHING_SUCCEEDED' | 'ASSIGNMENT_MATCHING_SUCCEEDED' | 'PARENT_REJECTED_APPLICATION' | 'TEACHER_REFUSED_OFFER' | 'PARENT_CANCELED_MATCHING' | 'TEACHER_CANCELED_MATCHING' | 'TEACHER_COMPLETED_CARE' | 'ADMIN_CANCELED_MATCHING';
2
+ export type BotMessageType = 'TEACHER_INQUIRED' | 'PARENT_CHANGED_OFFER_SCHEDULE' | 'PARENT_CHANGED_MATCHING_SCHEDULE' | 'TEACHER_APPLIED' | 'PARENT_SENT_OFFER' | 'KOK_MATCHING_SUCCEEDED' | 'APPLICATION_MATCHING_SUCCEEDED' | 'ASSIGNMENT_MATCHING_SUCCEEDED' | 'PARENT_REJECTED_APPLICATION' | 'TEACHER_REFUSED_OFFER' | 'PARENT_CANCELED_MATCHING' | 'TEACHER_CANCELED_MATCHING' | 'TEACHER_COMPLETED_CARE' | 'ADMIN_CANCELED_MATCHING' | 'AUTO_MATCHING_SUCCEEDED' | 'PLAY_CONTENT_RECOMMENDED' | 'PARENT_REQUESTED_MATCHING_SCHEDULE_CHANGE' | 'TEACHER_ACCEPTED_MATCHING_SCHEDULE_CHANGE' | 'TEACHER_REFUSED_MATCHING_SCHEDULE_CHANGE' | 'MATCHING_SCHEDULE_CHANGE_EXPIRED' | 'ADMIN_CANCELED_OFFER';
3
3
  export type BotMessageCtaType = 'MY_CLASS_CHECK' | 'OFFER_CHECK' | 'CHANGE_INFO_CHECK' | 'MY_APPLICATION_INFO_VIEW' | 'CARE_NOTE_CHECK' | 'TEACHER_SELECTION' | 'PLAY_CONTENT_EXPLORE';
4
4
  export type BotMessageCtaTargetTable = 'OFFER' | 'MATCHING';
5
5
  export type BotMessageSubCtaTargetTable = 'OFFER' | 'MATCHING';
6
6
  export interface BotMessageOffer {
7
7
  careStartDate: string;
8
8
  careStartTime: string;
9
- careEndTime: string;
10
9
  firstCareType: string;
11
10
  secondCareType: string;
12
11
  totalCareCount: number;
12
+ representativeChildName?: string | null;
13
+ childCount?: number | null;
14
+ }
15
+ export interface BotMessageMatching {
16
+ careStartDate?: string | null;
17
+ careStartTime?: string | null;
18
+ changeReqDate?: string | null;
19
+ changeReqStartTime?: string | null;
20
+ changeReqEndTime?: string | null;
21
+ firstCareType?: string | null;
22
+ secondCareType?: string | null;
23
+ representativeChildName?: string | null;
24
+ childCount?: number | null;
13
25
  }
14
26
  export interface BotMessageProps extends Omit<FlexboxProps, 'id' | 'title'> {
15
27
  id: string | number;
@@ -21,10 +33,12 @@ export interface BotMessageProps extends Omit<FlexboxProps, 'id' | 'title'> {
21
33
  subCtaTargetId?: number | null;
22
34
  mine: boolean;
23
35
  avatarUrl?: string;
24
- title: string;
36
+ title?: string | null;
25
37
  content: string;
26
38
  unreadUserCount: number;
27
- offer: object | null;
39
+ offer: BotMessageOffer | null;
40
+ matchings?: BotMessageMatching[] | null;
41
+ botMessageHeaderImageUrl?: string | null;
28
42
  regDatetime: string;
29
43
  onAction?: (params: {
30
44
  botMessageType: BotMessageType;
@@ -36,5 +50,5 @@ export interface BotMessageProps extends Omit<FlexboxProps, 'id' | 'title'> {
36
50
  }) => void;
37
51
  onView?: () => void;
38
52
  }
39
- declare function BotMessage({ id, botMessageType, ctaType, ctaTargetId, ctaTargetTable, subCtaTargetTable, subCtaTargetId, mine, avatarUrl, title, content, unreadUserCount, offer, regDatetime, onAction, onView, inlineCSS, ...props }: BotMessageProps): import("@emotion/react/jsx-runtime").JSX.Element;
53
+ declare function BotMessage({ id, botMessageType, ctaType, ctaTargetId, ctaTargetTable, subCtaTargetTable, subCtaTargetId, mine, avatarUrl, title, content, unreadUserCount, offer, matchings, botMessageHeaderImageUrl, regDatetime, onAction, onView, inlineCSS, ...props }: BotMessageProps): import("@emotion/react/jsx-runtime").JSX.Element;
40
54
  export default BotMessage;
@@ -1,152 +1,142 @@
1
1
  import e from "../../../hooks/useInView/index.mjs";
2
2
  import t from "../../Image/index.mjs";
3
- import n from "../../../utils/getCareTypeLabel/index.mjs";
4
- import { getClassInfo as r, getCtaButtonText as i } from "./BotMessage.utils.mjs";
5
- import { useEffect as a, useRef as o } from "react";
6
- import { Button as s, Flexbox as c, Typography as l } from "@dotss/ui";
7
- import u from "@dotss/ui/core/useTheme";
8
- import d from "dayjs";
9
- import { jsx as f, jsxs as p } from "react/jsx-runtime";
3
+ import { getClassInfo as n, getCtaButtonText as r } from "./BotMessage.utils.mjs";
4
+ import { useEffect as i, useRef as a } from "react";
5
+ import { Button as o, Flexbox as s, Typography as c } from "@dotss/ui";
6
+ import l from "@dotss/ui/core/useTheme";
7
+ import u from "dayjs";
8
+ import { jsx as d, jsxs as f } from "react/jsx-runtime";
10
9
  //#region shared/components/ChatKit/BotMessage/BotMessage.tsx
11
- function m({ id: m, botMessageType: h, ctaType: g, ctaTargetId: _, ctaTargetTable: v, subCtaTargetTable: y, subCtaTargetId: b, mine: x, avatarUrl: S, title: C, content: w, unreadUserCount: T, offer: E, regDatetime: D, onAction: O, onView: k, inlineCSS: A, ...j }) {
12
- let { palette: { brand: M, grey: N, background: P }, spacing: F } = u(), I = o(null), { isInView: L } = e(I), R = i(g), z = E, B = [n(z?.firstCareType), n(z?.secondCareType)].filter(Boolean).filter((e) => e !== "-").join("+"), V = r(z), H = () => O?.({
13
- botMessageType: h,
14
- ctaType: g,
15
- ctaTargetId: _,
16
- ctaTargetTable: v,
17
- subCtaTargetTable: y,
18
- subCtaTargetId: b
10
+ function p({ id: p, botMessageType: m, ctaType: h, ctaTargetId: g, ctaTargetTable: _, subCtaTargetTable: v, subCtaTargetId: y, mine: b, avatarUrl: x, title: S, content: C, unreadUserCount: w, offer: T, matchings: E, botMessageHeaderImageUrl: D, regDatetime: O, onAction: k, onView: A, inlineCSS: j, ...M }) {
11
+ let { palette: { brand: N, grey: P }, spacing: F } = l(), I = a(null), { isInView: L } = e(I), R = r(h), z = n({
12
+ offer: T,
13
+ matchings: E,
14
+ botMessageType: m
15
+ }), B = () => k?.({
16
+ botMessageType: m,
17
+ ctaType: h,
18
+ ctaTargetId: g,
19
+ ctaTargetTable: _,
20
+ subCtaTargetTable: v,
21
+ subCtaTargetId: y
19
22
  });
20
- return a(() => {
21
- L && k?.();
22
- }, [L, k]), /* @__PURE__ */ p(c, {
23
+ return i(() => {
24
+ L && A?.();
25
+ }, [L, A]), /* @__PURE__ */ f(s, {
23
26
  ref: I,
24
27
  alignItems: "flex-end",
25
28
  justifyContent: "flex-end",
26
29
  gap: 1,
27
30
  pl: 4,
28
31
  pr: 4,
29
- flexDirection: x ? "row" : "row-reverse",
30
- ...j,
32
+ flexDirection: b ? "row" : "row-reverse",
33
+ ...M,
31
34
  inlineCSS: {
32
35
  overflowAnchor: "none",
33
- ...A
36
+ ...j
34
37
  },
35
38
  children: [
36
- /* @__PURE__ */ f(l, {
39
+ /* @__PURE__ */ d(c, {
37
40
  visuallyHidden: !0,
38
41
  children: "안내"
39
42
  }),
40
- /* @__PURE__ */ p(c, {
43
+ /* @__PURE__ */ f(s, {
41
44
  flexDirection: "column",
42
- alignItems: x ? "flex-end" : "flex-start",
45
+ alignItems: b ? "flex-end" : "flex-start",
43
46
  inlineCSS: { whiteSpace: "nowrap" },
44
- children: [x && T > 0 && /* @__PURE__ */ f(l, {
47
+ children: [b && w > 0 && /* @__PURE__ */ d(c, {
45
48
  tag: "span",
46
49
  variant: "c5B",
47
50
  "aria-hidden": !0,
48
- inlineCSS: { color: M.primary.text },
49
- children: T
50
- }), /* @__PURE__ */ f(l, {
51
+ inlineCSS: { color: N.primary.text },
52
+ children: w
53
+ }), /* @__PURE__ */ d(c, {
51
54
  tag: "span",
52
55
  variant: "c5R",
53
56
  color: "etc.dimmed01",
54
57
  "aria-hidden": !0,
55
58
  inlineCSS: { whiteSpace: "nowrap" },
56
- children: d(D).format("A h:mm")
59
+ children: u(O).format("A h:mm")
57
60
  })]
58
61
  }),
59
- /* @__PURE__ */ p(c, {
62
+ /* @__PURE__ */ f(s, {
60
63
  alignItems: "flex-start",
61
- flexDirection: x ? "row-reverse" : "row",
62
- gap: 3,
63
- p: 4,
64
+ gap: 2,
64
65
  "aria-hidden": !0,
65
- inlineCSS: {
66
- backgroundColor: N.white,
67
- borderRadius: 12,
68
- border: `1px solid ${N[20]}`
69
- },
70
- children: [S && /* @__PURE__ */ f(t, {
71
- src: S,
66
+ children: [x && /* @__PURE__ */ d(t, {
67
+ src: x,
72
68
  width: 32,
73
69
  height: 32,
74
70
  alt: "째깍악어 선생님 심볼",
75
71
  role: "presentation"
76
- }), /* @__PURE__ */ p(c, {
72
+ }), /* @__PURE__ */ f(s, {
77
73
  flexDirection: "column",
78
- children: [
79
- /* @__PURE__ */ f(l, {
80
- tag: "p",
81
- variant: "h4B",
82
- children: C
83
- }),
84
- w && /* @__PURE__ */ f(l, {
85
- tag: "p",
86
- variant: "b3R",
87
- inlineCSS: { marginTop: F.content(1) },
88
- children: w
89
- }),
90
- V && /* @__PURE__ */ p(c, {
91
- mt: 2,
92
- p: 2,
93
- flexDirection: "column",
94
- inlineCSS: {
95
- borderRadius: F.content(2),
96
- backgroundColor: P.primary
97
- },
98
- children: [
99
- /* @__PURE__ */ p(l, {
100
- tag: "dl",
101
- children: [/* @__PURE__ */ f(l, {
74
+ inlineCSS: {
75
+ width: 240,
76
+ backgroundColor: P.white,
77
+ borderRadius: 12,
78
+ border: `1px solid ${P[20]}`,
79
+ overflow: "hidden"
80
+ },
81
+ children: [D && /* @__PURE__ */ d(t, {
82
+ src: D,
83
+ width: 240,
84
+ height: 120,
85
+ withIntrinsicRatio: !0,
86
+ disabledResizing: !0,
87
+ enableFallback: !0,
88
+ alt: "봇 메시지 안내 이미지",
89
+ role: "presentation"
90
+ }), /* @__PURE__ */ f(s, {
91
+ p: 4,
92
+ flexDirection: "column",
93
+ children: [
94
+ S && /* @__PURE__ */ d(c, {
95
+ tag: "p",
96
+ variant: "h4B",
97
+ children: S
98
+ }),
99
+ C && /* @__PURE__ */ d(c, {
100
+ tag: "p",
101
+ variant: "b2R",
102
+ inlineCSS: { marginTop: S ? F.content(1) : void 0 },
103
+ children: C
104
+ }),
105
+ z.length > 0 && /* @__PURE__ */ d(c, {
106
+ tag: "dl",
107
+ inlineCSS: { marginTop: F.content(6) },
108
+ children: z.map((e) => /* @__PURE__ */ f(c, {
109
+ tag: "div",
110
+ variant: "b2R",
111
+ children: [/* @__PURE__ */ d(c, {
102
112
  tag: "dt",
103
- visuallyHidden: !0,
104
- children: "날짜"
105
- }), /* @__PURE__ */ f(l, {
113
+ visuallyHidden: e.hideLabel,
114
+ inlineCSS: { display: "inline" },
115
+ children: e.hideLabel ? e.label : `■ ${e.label} : `
116
+ }), /* @__PURE__ */ d(c, {
106
117
  tag: "dd",
107
- variant: "b4M",
108
- children: V.dateRangeText
118
+ inlineCSS: { display: "inline" },
119
+ children: e.hideLabel ? `■ ${e.value}` : e.value
109
120
  })]
110
- }),
111
- /* @__PURE__ */ p(l, {
112
- tag: "dl",
113
- children: [/* @__PURE__ */ f(l, {
114
- tag: "dt",
115
- visuallyHidden: !0,
116
- children: "시간"
117
- }), /* @__PURE__ */ f(l, {
118
- tag: "dd",
119
- variant: "b4R",
120
- color: "grey.70",
121
- children: V.timeRangeText
122
- })]
123
- }),
124
- /* @__PURE__ */ p(l, {
125
- tag: "dl",
126
- children: [/* @__PURE__ */ f(l, {
127
- tag: "dt",
128
- visuallyHidden: !0,
129
- children: "돌봄 유형"
130
- }), /* @__PURE__ */ f(l, {
131
- tag: "dd",
132
- variant: "b4R",
133
- color: "grey.70",
134
- children: B
135
- })]
136
- })
137
- ]
138
- }),
139
- R && /* @__PURE__ */ f(s, {
140
- color: "secondary",
141
- onClick: H,
142
- inlineCSS: { marginTop: F.content(2) },
143
- children: R
144
- })
145
- ]
121
+ }, e.label))
122
+ }),
123
+ R && /* @__PURE__ */ d(o, {
124
+ onClick: B,
125
+ inlineCSS: {
126
+ marginTop: F.content(4),
127
+ backgroundColor: P[10],
128
+ color: P[100],
129
+ "&:hover:not([aria-disabled=\"true\"])": { backgroundColor: P[10] },
130
+ "&:active:not([aria-disabled=\"true\"])": { backgroundColor: P[10] }
131
+ },
132
+ children: R
133
+ })
134
+ ]
135
+ })]
146
136
  })]
147
137
  })
148
138
  ]
149
139
  });
150
140
  }
151
141
  //#endregion
152
- export { m as default };
142
+ export { p as default };
@@ -1,8 +1,13 @@
1
- import { BotMessageCtaType, BotMessageProps } from '.';
2
- export declare function getCtaButtonText(ctaType?: BotMessageCtaType | null): "" | "내 수업 확인하기" | "공고 확인하기" | "변경내용 확인하기" | "나의 지원 내역 보러가기" | "돌봄노트 확인하기" | "선생님 선택하러 가기" | "놀이콘텐츠 둘러보기";
3
- export declare function getClassInfo(offer: object): {
4
- dateRangeText: string;
5
- timeRangeText: string;
6
- careType: string;
7
- } | null;
8
- export declare function getBotMessageLabel({ title, content, offer, regDatetime }: Pick<BotMessageProps, 'title' | 'content' | 'offer' | 'regDatetime'>): string;
1
+ import { BotMessageCtaType, BotMessageMatching, BotMessageOffer, BotMessageProps, BotMessageType } from '.';
2
+ export declare function getCtaButtonText(ctaType?: BotMessageCtaType | null): "" | "내 수업 확인하기" | "공고 확인하기" | "변경 내용 확인하기" | "나의 지원 내역 보러가기" | "돌봄노트 확인하기" | "선생님 선택하러 가기" | "놀이콘텐츠 둘러보기";
3
+ export interface ClassInfoLine {
4
+ label: string;
5
+ value: string;
6
+ hideLabel?: boolean;
7
+ }
8
+ export declare function getClassInfo({ offer, matchings, botMessageType }: {
9
+ offer?: BotMessageOffer | null;
10
+ matchings?: BotMessageMatching[] | null;
11
+ botMessageType?: BotMessageType;
12
+ }): ClassInfoLine[];
13
+ export declare function getBotMessageLabel({ title, content, offer, matchings, botMessageType, regDatetime }: Pick<BotMessageProps, 'title' | 'content' | 'offer' | 'matchings' | 'botMessageType' | 'regDatetime'>): string;
@@ -1,11 +1,22 @@
1
1
  import e from "../../../utils/getCareTypeLabel/index.mjs";
2
2
  import t from "dayjs";
3
3
  //#region shared/components/ChatKit/BotMessage/BotMessage.utils.ts
4
- function n(e) {
4
+ var n = "아이이름", r = "돌봄종류", i = "방문일시", a = "기존 수업시간", o = "변경 수업시간", s = {
5
+ TEACHER_APPLIED: "NONE",
6
+ PARENT_SENT_OFFER: "NONE",
7
+ PLAY_CONTENT_RECOMMENDED: "NONE",
8
+ PARENT_REJECTED_APPLICATION: "NONE",
9
+ TEACHER_REFUSED_OFFER: "NONE",
10
+ PARENT_REQUESTED_MATCHING_SCHEDULE_CHANGE: "NONE",
11
+ TEACHER_REFUSED_MATCHING_SCHEDULE_CHANGE: "ORIGINAL_ONLY",
12
+ MATCHING_SCHEDULE_CHANGE_EXPIRED: "ORIGINAL_ONLY",
13
+ TEACHER_ACCEPTED_MATCHING_SCHEDULE_CHANGE: "ORIGINAL_AND_CHANGED"
14
+ };
15
+ function c(e) {
5
16
  switch (e) {
6
17
  case "MY_CLASS_CHECK": return "내 수업 확인하기";
7
18
  case "OFFER_CHECK": return "공고 확인하기";
8
- case "CHANGE_INFO_CHECK": return "변경내용 확인하기";
19
+ case "CHANGE_INFO_CHECK": return "변경 내용 확인하기";
9
20
  case "MY_APPLICATION_INFO_VIEW": return "나의 지원 내역 보러가기";
10
21
  case "CARE_NOTE_CHECK": return "돌봄노트 확인하기";
11
22
  case "TEACHER_SELECTION": return "선생님 선택하러 가기";
@@ -13,21 +24,59 @@ function n(e) {
13
24
  default: return "";
14
25
  }
15
26
  }
16
- function r(n) {
17
- let r = n;
18
- if (!r) return null;
19
- let i;
20
- i = r.totalCareCount > 1 ? `${t(r.careStartDate).format("M월 D일(ddd)")}부터 / 총 ${r.totalCareCount}회` : t(r.careStartDate).format("M월 D일(ddd)");
21
- let a = t(`${r.careStartDate} ${r.careStartTime}`).format("A h:mm"), o = t(`${r.careStartDate} ${r.careEndTime}`).format("A h:mm");
22
- return {
23
- dateRangeText: i,
24
- timeRangeText: `${a} ~ ${o}`,
25
- careType: e(r.firstCareType)
26
- };
27
+ function l({ offer: t, matchings: a, botMessageType: o }) {
28
+ let c = a?.[0] ?? t ?? null;
29
+ if (!c) return [];
30
+ let l = o ? s[o] : void 0;
31
+ if (l === "NONE") return [];
32
+ if (l === "ORIGINAL_ONLY") return u(c);
33
+ if (l === "ORIGINAL_AND_CHANGED") return d(c);
34
+ let f = a?.length ? a.length : t?.totalCareCount ?? 1, m = [];
35
+ if (c.careStartDate && c.careStartTime) {
36
+ let e = p(c.careStartDate, c.careStartTime), t = f > 1 ? ` 외 ${f - 1}건` : "";
37
+ m.push({
38
+ label: i,
39
+ value: `${e}${t}`
40
+ });
41
+ }
42
+ if (c.representativeChildName) {
43
+ let e = c.childCount ?? 1, t = e > 1 ? ` 외 ${e - 1}명` : "";
44
+ m.push({
45
+ label: n,
46
+ value: `${c.representativeChildName}${t}`
47
+ });
48
+ }
49
+ let h = [e(c.firstCareType), e(c.secondCareType)].filter(Boolean).join("+");
50
+ return h && m.push({
51
+ label: r,
52
+ value: h,
53
+ hideLabel: !0
54
+ }), m;
27
55
  }
28
- function i({ title: e, content: n, offer: i, regDatetime: a }) {
29
- let o = r(i);
30
- return `안내, ${e}, ${n ? `${n}, ` : ""}${o ? `${o.dateRangeText}, ${o.timeRangeText}, ${o.careType}, ` : ""}${t(a).format("YYYY년 MM월 DD일 A h:mm")}`;
56
+ var u = (e) => {
57
+ let t = [];
58
+ return f(t, a, e.careStartDate, e.careStartTime), t;
59
+ }, d = (e) => {
60
+ let t = [];
61
+ return f(t, a, e.changeReqDate, e.changeReqStartTime), f(t, o, e.careStartDate, e.careStartTime), t;
62
+ }, f = (e, t, n, r) => {
63
+ n && r && e.push({
64
+ label: t,
65
+ value: p(n, r)
66
+ });
67
+ }, p = (e, n) => t(`${e} ${n}`).format("YYYY-MM-DD HH:mm");
68
+ function m({ title: e, content: n, offer: r, matchings: i, botMessageType: a, regDatetime: o }) {
69
+ return [
70
+ "안내",
71
+ e,
72
+ n,
73
+ l({
74
+ offer: r,
75
+ matchings: i,
76
+ botMessageType: a
77
+ }).map((e) => `${e.label} ${e.value}`).join(", "),
78
+ t(o).format("YYYY년 MM월 DD일 A h:mm")
79
+ ].filter(Boolean).join(", ");
31
80
  }
32
81
  //#endregion
33
- export { i as getBotMessageLabel, r as getClassInfo, n as getCtaButtonText };
82
+ export { m as getBotMessageLabel, l as getClassInfo, c as getCtaButtonText };
@@ -1,4 +1,4 @@
1
- import { default as BotMessage, BotMessageCtaTargetTable, BotMessageCtaType, BotMessageOffer, BotMessageProps, BotMessageSubCtaTargetTable, BotMessageType } from './BotMessage';
1
+ import { default as BotMessage, BotMessageCtaTargetTable, BotMessageCtaType, BotMessageMatching, BotMessageOffer, BotMessageProps, BotMessageSubCtaTargetTable, BotMessageType } from './BotMessage';
2
2
  export { getClassInfo, getCtaButtonText, getBotMessageLabel } from './BotMessage.utils';
3
- export type { BotMessageProps, BotMessageCtaType, BotMessageType, BotMessageOffer, BotMessageSubCtaTargetTable, BotMessageCtaTargetTable };
3
+ export type { BotMessageProps, BotMessageCtaType, BotMessageType, BotMessageOffer, BotMessageMatching, BotMessageSubCtaTargetTable, BotMessageCtaTargetTable };
4
4
  export default BotMessage;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dotss/tictoccroc",
3
3
  "type": "module",
4
- "version": "0.6.3",
4
+ "version": "0.7.1",
5
5
  "description": "Tictoccroc shared components, hooks, utils, and APIs for Dotss",
6
6
  "main": "./dist/index.mjs",
7
7
  "module": "./dist/index.mjs",