@kieksme/csp-plugin-chat 0.4.0 → 0.6.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/README.md CHANGED
@@ -1,3 +1,5 @@
1
1
  # @kieksme/csp-plugin-chat
2
2
 
3
- Part of the Customer Service Portal. See the product README and Docs/plugin-sdk.md for configuration and usage.
3
+ Part of the Customer Service Portal. See the product README and docs/plugin-sdk.md for configuration and usage.
4
+
5
+ The question field and session history appear once in the service header. Automatic replies are labelled as a digital assistant; the hotline remains the route for personal contact. The assistant stays available between shifts. See [the header contract](../../docs/plugin-sdk.md#persönlicher-header).
package/dist/browser.d.ts CHANGED
@@ -7,6 +7,7 @@ declare const _default: {
7
7
  sdkVersion: string;
8
8
  sections: {
9
9
  id: string;
10
+ placement: "hero";
10
11
  label: string;
11
12
  title: string;
12
13
  order: number;
package/dist/browser.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  cspPlugin
3
- } from "./chunk-3ZQPP6HM.js";
3
+ } from "./chunk-CHWQINBK.js";
4
4
 
5
5
  // src/browser.tsx
6
6
  import { useEffect, useRef, useState } from "react";
@@ -92,60 +92,96 @@ function Chat(ctx) {
92
92
  abort.current = null;
93
93
  }
94
94
  }
95
- return /* @__PURE__ */ jsxs("div", { className: "chat-layout", children: [
96
- /* @__PURE__ */ jsxs("div", { className: "chat-intro", children: [
97
- /* @__PURE__ */ jsx("h3", { children: "Eine Frage reicht." }),
98
- /* @__PURE__ */ jsx("p", { children: "Unser Assistent kennt die Hilfe-Inhalte, das Team und die aktuellen Meldungen. F\xFCr dringende St\xF6rungen bleibt die Hotline der direkte Weg." }),
99
- /* @__PURE__ */ jsx("p", { className: "data-state", children: "\xD6ffentlicher Chat \xB7 Verlauf nur in dieser Sitzung" })
100
- ] }),
101
- /* @__PURE__ */ jsxs("div", { className: "chat-panel", children: [
102
- /* @__PURE__ */ jsxs("div", { className: "chat-history", "aria-live": "polite", "aria-busy": busy, children: [
103
- !messages.length && /* @__PURE__ */ jsx("p", { className: "message assistant", children: "Wie kann ich Ihnen helfen?" }),
104
- messages.map((m, i) => /* @__PURE__ */ jsxs("div", { className: "message " + m.role, children: [
105
- /* @__PURE__ */ jsx("span", { className: "sr-only", children: m.role === "user" ? "Sie: " : "Assistent: " }),
106
- m.content || "Antwort wird vorbereitet \u2026"
107
- ] }, i))
108
- ] }),
109
- sources.length > 0 && /* @__PURE__ */ jsxs("div", { className: "sources", children: [
110
- "Referenzquellen:",
111
- " ",
112
- sources.map(
113
- (s) => s.href ? /* @__PURE__ */ jsxs("a", { href: s.href, children: [
114
- s.title,
115
- s.stale ? " (veraltet)" : ""
116
- ] }, s.id) : /* @__PURE__ */ jsxs("span", { children: [
117
- s.title,
118
- " "
119
- ] }, s.id)
120
- )
121
- ] }),
122
- /* @__PURE__ */ jsxs("form", { className: "chat-form", onSubmit: submit, children: [
123
- /* @__PURE__ */ jsx("label", { className: "sr-only", htmlFor: "chat-input", children: "Ihre Frage" }),
124
- /* @__PURE__ */ jsx(
125
- "textarea",
126
- {
127
- id: "chat-input",
128
- className: "search",
129
- value: input,
130
- maxLength: 4e3,
131
- onChange: (e) => setInput(e.target.value),
132
- placeholder: "Ihre Frage an unser Team \u2026",
133
- required: true
134
- }
135
- ),
136
- /* @__PURE__ */ jsx(
137
- "button",
138
- {
139
- type: "submit",
140
- disabled: busy || !input.trim(),
141
- "aria-label": "Frage senden",
142
- children: "\u2191"
143
- }
144
- )
145
- ] }),
146
- error && /* @__PURE__ */ jsx("p", { className: "chat-error", role: "alert", children: error })
147
- ] })
148
- ] });
95
+ return /* @__PURE__ */ jsxs(
96
+ "div",
97
+ {
98
+ className: ctx.surface === "hero" ? "chat-layout block" : "chat-layout grid grid-cols-[1fr_1.7fr] gap-13.75 compact:grid-cols-[1fr] compact:gap-3.75",
99
+ children: [
100
+ ctx.surface !== "hero" && /* @__PURE__ */ jsxs("div", { className: "chat-intro [&_p]:text-[0.875rem] [&_p]:text-muted [&_p]:leading-[1.8] compact:max-w-[500px]", children: [
101
+ /* @__PURE__ */ jsx("h3", { children: "Eine Frage reicht." }),
102
+ /* @__PURE__ */ jsx("p", { children: "Unser Assistent kennt die Hilfe-Inhalte, das Team und die aktuellen Meldungen. F\xFCr dringende St\xF6rungen bleibt die Hotline der direkte Weg." }),
103
+ /* @__PURE__ */ jsx("p", { className: "data-state font-mono text-[0.625rem] text-muted m-[calc(var(--spacing)_*_3)_0_0] [&.warning]:text-warning", children: "\xD6ffentlicher Chat \xB7 Verlauf nur in dieser Sitzung" })
104
+ ] }),
105
+ /* @__PURE__ */ jsxs("div", { className: "chat-panel text-ink compact:p-4 bg-card border border-line p-6 rounded-card", children: [
106
+ /* @__PURE__ */ jsxs(
107
+ "div",
108
+ {
109
+ className: "chat-history empty:hidden grid gap-3.75 max-h-[400px] overflow-auto mb-4",
110
+ "aria-live": "polite",
111
+ "aria-busy": busy,
112
+ children: [
113
+ !messages.length && ctx.surface !== "hero" && /* @__PURE__ */ jsx("p", { className: "message assistant text-[0.8125rem] leading-[1.8] whitespace-pre-wrap [overflow-wrap:anywhere] [&.user]:bg-soft [&.user]:pt-3 [&.user]:pb-3 [&.user]:pl-4 [&.user]:pr-4 [&.user]:rounded-card [&.assistant]:[border-left:2px_solid_var(--accent)] [&.assistant]:pt-[0] [&.assistant]:pb-[0] [&.assistant]:pl-4 [&.assistant]:pr-4", children: "Wie kann ich Ihnen helfen?" }),
114
+ messages.map((m, i) => /* @__PURE__ */ jsxs(
115
+ "div",
116
+ {
117
+ className: "message text-[0.8125rem] leading-[1.8] whitespace-pre-wrap [overflow-wrap:anywhere] [&.user]:bg-soft [&.user]:pt-3 [&.user]:pb-3 [&.user]:pl-4 [&.user]:pr-4 [&.user]:rounded-card [&.assistant]:[border-left:2px_solid_var(--accent)] [&.assistant]:pt-[0] [&.assistant]:pb-[0] [&.assistant]:pl-4 [&.assistant]:pr-4 " + m.role,
118
+ children: [
119
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: m.role === "user" ? "Sie: " : "Assistent: " }),
120
+ m.content || "Antwort wird vorbereitet \u2026"
121
+ ]
122
+ },
123
+ i
124
+ ))
125
+ ]
126
+ }
127
+ ),
128
+ sources.length > 0 && /* @__PURE__ */ jsxs("div", { className: "sources text-[0.6875rem] text-muted mt-3.75 mb-3.75 ml-[0] mr-[0] [&_a]:mr-3", children: [
129
+ "Referenzquellen:",
130
+ " ",
131
+ sources.map(
132
+ (s) => s.href ? /* @__PURE__ */ jsxs("a", { href: s.href, children: [
133
+ s.title,
134
+ s.stale ? " (veraltet)" : ""
135
+ ] }, s.id) : /* @__PURE__ */ jsxs("span", { children: [
136
+ s.title,
137
+ " "
138
+ ] }, s.id)
139
+ )
140
+ ] }),
141
+ /* @__PURE__ */ jsxs(
142
+ "form",
143
+ {
144
+ className: "chat-form flex gap-2.5 items-end [&_textarea]:resize-y [&_textarea]:min-h-[50px] [&_textarea]:[flex:1] [&_textarea]:min-w-0 [&_button]:bg-accent [&_button]:text-accent-ink [&_button]:[border:0] [&_button]:w-[50px] [&_button]:h-[50px] [&_button]:rounded-card [&_button]:text-[1.25rem] [&_button:disabled]:opacity-[0.5]",
145
+ onSubmit: submit,
146
+ children: [
147
+ /* @__PURE__ */ jsx("label", { className: "sr-only", htmlFor: "chat-input", children: "Ihre Frage" }),
148
+ /* @__PURE__ */ jsx(
149
+ "textarea",
150
+ {
151
+ id: "chat-input",
152
+ className: "search bg-card border border-line rounded-card py-3.5 px-4.5 text-ink w-full",
153
+ value: input,
154
+ maxLength: 4e3,
155
+ onChange: (e) => setInput(e.target.value),
156
+ placeholder: "Ihre Frage an unser Team \u2026",
157
+ required: true
158
+ }
159
+ ),
160
+ /* @__PURE__ */ jsx(
161
+ "button",
162
+ {
163
+ type: "submit",
164
+ disabled: busy || !input.trim(),
165
+ "aria-label": "Frage senden",
166
+ children: "\u2191"
167
+ }
168
+ )
169
+ ]
170
+ }
171
+ ),
172
+ ctx.surface === "hero" && /* @__PURE__ */ jsx("p", { className: "data-state font-mono text-[0.625rem] text-muted mt-3 mb-0", children: "Digitaler Assistent \xB7 Ihre Frage wird automatisch beantwortet. F\xFCr pers\xF6nlichen Kontakt nutzen Sie die Hotline." }),
173
+ error && /* @__PURE__ */ jsx(
174
+ "p",
175
+ {
176
+ className: "chat-error text-danger dark:text-warning text-[0.75rem]",
177
+ role: "alert",
178
+ children: error
179
+ }
180
+ )
181
+ ] })
182
+ ]
183
+ }
184
+ );
149
185
  }
150
186
  var browser_default = {
151
187
  id: "chat",
@@ -153,6 +189,7 @@ var browser_default = {
153
189
  sections: [
154
190
  {
155
191
  id: "chat",
192
+ placement: "hero",
156
193
  label: "Assistent",
157
194
  title: "Antworten ohne Warteschleife.",
158
195
  order: 60,
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var cspPlugin = {
3
3
  id: "chat",
4
- sdkVersion: "^0.4.0",
4
+ sdkVersion: "^0.6.0",
5
5
  browser: "./browser",
6
6
  server: "./server"
7
7
  };
package/dist/server.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  cspPlugin
3
- } from "./chunk-3ZQPP6HM.js";
3
+ } from "./chunk-CHWQINBK.js";
4
4
 
5
5
  // src/server.ts
6
6
  import { z } from "zod";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kieksme/csp-plugin-chat",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -22,7 +22,7 @@
22
22
  "registry": "https://registry.npmjs.org"
23
23
  },
24
24
  "dependencies": {
25
- "@kieksme/csp-sdk": "^0.4.0",
25
+ "@kieksme/csp-sdk": "^0.6.0",
26
26
  "zod": "^3.25.76",
27
27
  "openai": "^6.3.0"
28
28
  },
@@ -34,7 +34,7 @@
34
34
  },
35
35
  "cspPlugin": {
36
36
  "id": "chat",
37
- "sdkVersion": "^0.4.0",
37
+ "sdkVersion": "^0.6.0",
38
38
  "browser": "./browser",
39
39
  "server": "./server"
40
40
  },