@mediansh/widget 0.6.0 → 0.8.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 +52 -3
- package/dist/{chunk-3KEM4W7J.js → chunk-3ZXE5RBN.js} +2 -2
- package/dist/chunk-77KIJLPP.js +43 -0
- package/dist/{chunk-W6NPKKCE.js → chunk-HLALDSPM.js} +1 -39
- package/dist/{chunk-W6NPKKCE.js.map → chunk-HLALDSPM.js.map} +1 -1
- package/dist/{chunk-DVQ7V3LR.js → chunk-R3S6Y434.js} +9 -7
- package/dist/{chunk-DVQ7V3LR.js.map → chunk-R3S6Y434.js.map} +1 -1
- package/dist/dist-VC6ZVTA2.js +1658 -0
- package/dist/dist-VC6ZVTA2.js.map +1 -0
- package/dist/{highlighted-body-OFNGDK62-DW3EMPTG.js → highlighted-body-OFNGDK62-T25BCWKJ.js} +4 -3
- package/dist/highlighted-body-OFNGDK62-T25BCWKJ.js.map +1 -0
- package/dist/index.d.ts +407 -21
- package/dist/index.js +3387 -1510
- package/dist/index.js.map +1 -1
- package/dist/mermaid-GHXKKRXX-U6EYEPWB.js +11 -0
- package/dist/mermaid-GHXKKRXX-U6EYEPWB.js.map +1 -0
- package/dist/{message-markdown-LOE74LBE.js → message-markdown-KQVNAD42.js} +5 -4
- package/dist/{message-markdown-LOE74LBE.js.map → message-markdown-KQVNAD42.js.map} +1 -1
- package/dist/widget.css +1 -1
- package/package.json +20 -5
- package/dist/highlighted-body-OFNGDK62-DW3EMPTG.js.map +0 -1
- package/dist/mermaid-GHXKKRXX-N3BSVIR6.js +0 -10
- /package/dist/{chunk-3KEM4W7J.js.map → chunk-3ZXE5RBN.js.map} +0 -0
- /package/dist/{mermaid-GHXKKRXX-N3BSVIR6.js.map → chunk-77KIJLPP.js.map} +0 -0
package/README.md
CHANGED
|
@@ -5,6 +5,9 @@ support panel. An AI agent answers first, your team picks up in the Median
|
|
|
5
5
|
inbox, and replies stream back to the visitor. There is no connection or
|
|
6
6
|
message list to manage.
|
|
7
7
|
|
|
8
|
+
The same panel as a modal, a contact form, and a feedback panel ship
|
|
9
|
+
alongside it. Same key, same inbox.
|
|
10
|
+
|
|
8
11
|
## Install
|
|
9
12
|
|
|
10
13
|
```sh
|
|
@@ -66,6 +69,51 @@ medianSupport.reset(); // on sign out
|
|
|
66
69
|
React components can use `useMedianSupport()` for the same control with a
|
|
67
70
|
live `isOpen`.
|
|
68
71
|
|
|
72
|
+
## Modal
|
|
73
|
+
|
|
74
|
+
The widget, opened in the middle of the screen over a scrim rather than out
|
|
75
|
+
of the corner. The button stays; every prop and every control is the same.
|
|
76
|
+
|
|
77
|
+
```tsx
|
|
78
|
+
import { MedianSupportModal } from "@mediansh/widget";
|
|
79
|
+
|
|
80
|
+
<MedianSupportModal apiKey="median_pk_..." />;
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
`mountMedianSupportModal` is the version for pages without React. Mount one
|
|
84
|
+
of the two, not both.
|
|
85
|
+
|
|
86
|
+
## Contact form
|
|
87
|
+
|
|
88
|
+
A form where you put it, for the page where a chat panel is the wrong shape.
|
|
89
|
+
An email and a message are always asked; add the rest:
|
|
90
|
+
|
|
91
|
+
```tsx
|
|
92
|
+
import { MedianContactForm } from "@mediansh/widget";
|
|
93
|
+
|
|
94
|
+
<MedianContactForm
|
|
95
|
+
apiKey="median_pk_..."
|
|
96
|
+
fields={[
|
|
97
|
+
{ name: "name", label: "Name", required: true },
|
|
98
|
+
{ name: "topic", type: "select", options: ["Billing", "A bug"] },
|
|
99
|
+
]}
|
|
100
|
+
/>;
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Sending starts a conversation in your inbox, exactly as the widget does, and
|
|
104
|
+
the reply goes to the email given. `mountMedianContactForm({ target, ... })`
|
|
105
|
+
renders it into an element of yours on a page without React.
|
|
106
|
+
|
|
107
|
+
Or keep your own form and only borrow the send:
|
|
108
|
+
|
|
109
|
+
```tsx
|
|
110
|
+
const contact = useMedianContact({ apiKey: "median_pk_..." });
|
|
111
|
+
|
|
112
|
+
await contact.send({ email, message, fields: { Topic: topic } });
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
`sendMedianContact(options, message)` is the same call as a plain function.
|
|
116
|
+
|
|
69
117
|
## Feedback
|
|
70
118
|
|
|
71
119
|
A second panel, for notes rather than questions. It wraps a trigger of your
|
|
@@ -88,11 +136,12 @@ and the page it was written on rides along.
|
|
|
88
136
|
|
|
89
137
|
## Theming
|
|
90
138
|
|
|
91
|
-
|
|
92
|
-
a plain light theme without them. They inherit your font.
|
|
139
|
+
Every piece reads shadcn-style CSS variables from your page and falls back
|
|
140
|
+
to a plain light theme without them. They inherit your font.
|
|
93
141
|
|
|
94
142
|
## Docs
|
|
95
143
|
|
|
96
|
-
Props, identity, diagnostics, feedback, and
|
|
144
|
+
Props, identity, diagnostics, the modal, the contact form, feedback, and
|
|
145
|
+
agent tools:
|
|
97
146
|
[docs.median.sh](https://docs.median.sh), or the source at
|
|
98
147
|
[github.com/mediansh/median](https://github.com/mediansh/median).
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
clsx,
|
|
4
4
|
twMerge
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-HLALDSPM.js";
|
|
6
6
|
|
|
7
7
|
// ../../apps/web/src/lib/utils.ts
|
|
8
8
|
function cn(...inputs) {
|
|
@@ -12,4 +12,4 @@ function cn(...inputs) {
|
|
|
12
12
|
export {
|
|
13
13
|
cn
|
|
14
14
|
};
|
|
15
|
-
//# sourceMappingURL=chunk-
|
|
15
|
+
//# sourceMappingURL=chunk-3ZXE5RBN.js.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __esm = (fn, res) => function __init() {
|
|
9
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
10
|
+
};
|
|
11
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
12
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
13
|
+
};
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
27
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
28
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
29
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
30
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
31
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
32
|
+
mod
|
|
33
|
+
));
|
|
34
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
|
+
|
|
36
|
+
export {
|
|
37
|
+
__esm,
|
|
38
|
+
__commonJS,
|
|
39
|
+
__export,
|
|
40
|
+
__toESM,
|
|
41
|
+
__toCommonJS
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=chunk-77KIJLPP.js.map
|
|
@@ -1,37 +1,4 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __esm = (fn, res) => function __init() {
|
|
9
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
10
|
-
};
|
|
11
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
12
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
13
|
-
};
|
|
14
|
-
var __export = (target, all) => {
|
|
15
|
-
for (var name in all)
|
|
16
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
-
};
|
|
18
|
-
var __copyProps = (to, from, except, desc) => {
|
|
19
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
-
for (let key of __getOwnPropNames(from))
|
|
21
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
-
}
|
|
24
|
-
return to;
|
|
25
|
-
};
|
|
26
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
27
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
28
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
29
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
30
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
31
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
32
|
-
mod
|
|
33
|
-
));
|
|
34
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
2
|
|
|
36
3
|
// ../../node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
|
|
37
4
|
function r(e) {
|
|
@@ -3303,12 +3270,7 @@ var getDefaultConfig = () => {
|
|
|
3303
3270
|
var twMerge = /* @__PURE__ */ createTailwindMerge(getDefaultConfig);
|
|
3304
3271
|
|
|
3305
3272
|
export {
|
|
3306
|
-
__esm,
|
|
3307
|
-
__commonJS,
|
|
3308
|
-
__export,
|
|
3309
|
-
__toESM,
|
|
3310
|
-
__toCommonJS,
|
|
3311
3273
|
clsx,
|
|
3312
3274
|
twMerge
|
|
3313
3275
|
};
|
|
3314
|
-
//# sourceMappingURL=chunk-
|
|
3276
|
+
//# sourceMappingURL=chunk-HLALDSPM.js.map
|