@eka-care/medassist-widget 0.1.96-dev.0 → 0.1.97-dev.0

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@eka-care/medassist-widget",
3
3
  "description": "MedAssist Widget react application",
4
- "version": "0.1.96-dev.0",
4
+ "version": "0.1.97-dev.0",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"
@@ -1,142 +0,0 @@
1
- import { d as p, u as e, z as a, P as I, B as M } from "./medassist-widget.js";
2
- const B = a(() => import("./medassist-widget-mood-angry-BQqxy8gg.js").then((t) => ({ default: t.MoodAngry }))), A = a(() => import("./medassist-widget-mood-bad-BBDRkdRc.js").then((t) => ({ default: t.MoodBad }))), O = a(() => import("./medassist-widget-mood-neutral-CbcKAQbC.js").then((t) => ({ default: t.MoodNeutral }))), C = a(() => import("./medassist-widget-mood-poor-t4w5iE4B.js").then((t) => ({ default: t.MoodPoor }))), L = a(() => import("./medassist-widget-mood-happy-oLG7NUhq.js").then((t) => ({ default: t.MoodHappy }))), P = [
3
- { label: "Took longer than expected", value: "took_longer" },
4
- { label: "Asking too many questions", value: "too_many_questions" },
5
- { label: "Irrelevant response", value: "irrelevant_response" },
6
- { label: "Other", value: "other" }
7
- ], _ = [
8
- { Icon: B, label: "Bad", score: 1 },
9
- { Icon: A, label: "Poor", score: 2 },
10
- { Icon: O, label: "Okay", score: 3 },
11
- { Icon: C, label: "Good", score: 4 },
12
- { Icon: L, label: "Great!", score: 5 }
13
- ];
14
- function j(t, o) {
15
- return t <= 2 ? o.form?.detractors ?? [] : t === 3 ? o.form?.passives ?? [] : o.form?.promoters ?? [];
16
- }
17
- function D({
18
- isOpen: t,
19
- config: o,
20
- onSubmit: u,
21
- onSkip: h,
22
- onDontShowAgain: g
23
- }) {
24
- const s = o.type === "nps", [n, y] = p(null), [i, x] = p(/* @__PURE__ */ new Set()), [d, N] = p(!1), b = s && n !== null ? j(n, o) : o.form?.default?.length ? o.form.default : P, v = (r) => {
25
- x((c) => {
26
- const l = new Set(c);
27
- return l.has(r) ? l.delete(r) : l.add(r), l;
28
- });
29
- }, w = (r) => {
30
- y(r), x(/* @__PURE__ */ new Set());
31
- }, k = i?.size > 0 || n !== null || d, S = () => {
32
- s && n !== null && u([...i], n), d && g?.(), s || u([...i]), h();
33
- };
34
- return t ? /* @__PURE__ */ e(
35
- "div",
36
- {
37
- className: "absolute inset-0 z-[60] flex items-center justify-center",
38
- style: { backgroundColor: "rgba(0, 0, 0, 0.7)" },
39
- children: /* @__PURE__ */ e("div", { className: "flex flex-col items-end gap-1 mx-4 w-full max-w-sm", children: [
40
- /* @__PURE__ */ e(
41
- "button",
42
- {
43
- onClick: h,
44
- className: "text-sm text-white/70 hover:text-white transition-colors bg-transparent border-none cursor-pointer p-0 pr-1",
45
- children: "Skip"
46
- }
47
- ),
48
- /* @__PURE__ */ e("div", { className: "bg-elicitationBg rounded-2xl shadow-xl p-5 w-full flex flex-col gap-4 border border-primary/50", children: [
49
- /* @__PURE__ */ e("div", { className: "flex flex-col gap-1", children: [
50
- o.title && /* @__PURE__ */ e("h2", { className: "text-base font-semibold text-foreground text-center", children: o.title }),
51
- o.description && /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground leading-4 text-center", children: o.description })
52
- ] }),
53
- s && /* @__PURE__ */ e("div", { className: "flex items-center justify-between gap-1", children: _.map(({ Icon: r, label: c, score: l }) => {
54
- const m = n === l, f = n !== null && !m;
55
- return /* @__PURE__ */ e(
56
- "button",
57
- {
58
- onClick: () => w(l),
59
- title: c,
60
- className: "flex flex-col items-center gap-1.5 flex-1 cursor-pointer bg-transparent border-none p-0",
61
- children: [
62
- /* @__PURE__ */ e(
63
- "div",
64
- {
65
- className: `rounded-xl p-1 transition-all ${m ? "border-2 border-primary bg-primary/15" : "border-2 border-transparent"} ${f ? "opacity-50" : ""}`,
66
- style: m ? { filter: "brightness(1.25)" } : void 0,
67
- children: /* @__PURE__ */ e(I, { fallback: /* @__PURE__ */ e("div", { className: "w-10 h-10 rounded-xl bg-surface-secondary" }), children: /* @__PURE__ */ e(r, {}) })
68
- }
69
- ),
70
- /* @__PURE__ */ e(
71
- "span",
72
- {
73
- className: `text-[10px] leading-none transition-colors ${m ? "text-primary/50 font-medium" : f ? "text-primary/50" : "text-primary"}`,
74
- children: c
75
- }
76
- )
77
- ]
78
- },
79
- l
80
- );
81
- }) }),
82
- (!s || n !== null) && b.length > 0 && /* @__PURE__ */ e("div", { className: "flex flex-col gap-2", children: b.map((r) => /* @__PURE__ */ e(
83
- "div",
84
- {
85
- onClick: () => v(r.value),
86
- className: `rounded-lg border px-3 py-2.5 text-sm text-center cursor-pointer transition-colors ${i.has(r.value) ? "border-primary text-primary bg-elicitationBg" : "border-primary/25 text-primary/60 bg-elicitationBg"}`,
87
- children: r.label
88
- },
89
- r.value
90
- )) }),
91
- /* @__PURE__ */ e(
92
- M,
93
- {
94
- disabled: !k,
95
- onClick: S,
96
- className: "w-full bg-primary hover:bg-primary/90 text-primary-foreground",
97
- children: "Submit & exit"
98
- }
99
- ),
100
- /* @__PURE__ */ e("label", { className: "flex items-center justify-center gap-1.5 cursor-pointer select-none", onClick: () => N((r) => !r), children: [
101
- /* @__PURE__ */ e(
102
- "div",
103
- {
104
- className: "relative w-3 h-3 shrink-0",
105
- children: /* @__PURE__ */ e(
106
- "div",
107
- {
108
- className: `w-3 h-3 rounded-[3px] border transition-colors flex items-center justify-center ${d ? "border-primary bg-primary" : "border-muted-foreground bg-transparent"}`,
109
- children: d && /* @__PURE__ */ e(
110
- "svg",
111
- {
112
- width: "7",
113
- height: "6",
114
- viewBox: "0 0 10 8",
115
- fill: "none",
116
- xmlns: "http://www.w3.org/2000/svg",
117
- children: /* @__PURE__ */ e(
118
- "path",
119
- {
120
- d: "M1 3.5L3.8 6.5L9 1",
121
- stroke: "black",
122
- strokeWidth: "1.8",
123
- strokeLinecap: "round",
124
- strokeLinejoin: "round"
125
- }
126
- )
127
- }
128
- )
129
- }
130
- )
131
- }
132
- ),
133
- /* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground", children: "Don't show again" })
134
- ] })
135
- ] })
136
- ] })
137
- }
138
- ) : null;
139
- }
140
- export {
141
- D as default
142
- };