@mindbill/react 0.1.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/LICENSE +21 -0
- package/README.md +11 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +50 -0
- package/dist/index.js.map +1 -0
- package/package.json +51 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 IncidentFox, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# @mindbill/react
|
|
2
|
+
|
|
3
|
+
React wrappers for the secure `@mindbill/embed` custom elements. See the [widget guide](https://github.com/incidentfox/mindbill-widgets/blob/main/docs/widgets.md).
|
|
4
|
+
|
|
5
|
+
> **Publication pending:** `@mindbill/react` and its `@mindbill/embed` dependency are not yet available from npm. The import below documents the post-publication interface and currently returns 404 through package registries. Clone the [source repository](https://github.com/incidentfox/mindbill-widgets) to evaluate it locally.
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { MindBillBillTimeline } from "@mindbill/react";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Create the short-lived embed session on your server; never send a Partner API key to React/browser code.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { MindBillAppearance, MindBillEventDetail, MindBillErrorDetail } from '@mindbill/embed';
|
|
2
|
+
export { MindBillAppearance, MindBillErrorDetail, MindBillEventDetail } from '@mindbill/embed';
|
|
3
|
+
import { CSSProperties, ReactElement } from 'react';
|
|
4
|
+
|
|
5
|
+
type MindBillWidgetProps = {
|
|
6
|
+
sessionToken: string;
|
|
7
|
+
embedUrl: string;
|
|
8
|
+
appearance?: MindBillAppearance;
|
|
9
|
+
className?: string;
|
|
10
|
+
style?: CSSProperties;
|
|
11
|
+
onMindBill?: (event: CustomEvent<MindBillEventDetail>) => void;
|
|
12
|
+
onMindBillError?: (event: CustomEvent<MindBillErrorDetail>) => void;
|
|
13
|
+
};
|
|
14
|
+
declare function MindBillBillTimeline(props: MindBillWidgetProps): ReactElement;
|
|
15
|
+
declare function MindBillBillFromReport(props: MindBillWidgetProps): ReactElement;
|
|
16
|
+
declare function MindBillCollections(props: MindBillWidgetProps): ReactElement;
|
|
17
|
+
declare function MindBillOnboarding(props: MindBillWidgetProps): ReactElement;
|
|
18
|
+
|
|
19
|
+
export { MindBillBillFromReport, MindBillBillTimeline, MindBillCollections, MindBillOnboarding, type MindBillWidgetProps };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/index.tsx
|
|
4
|
+
import "@mindbill/embed";
|
|
5
|
+
import { createElement, useEffect, useRef } from "react";
|
|
6
|
+
function widget(tagName, props) {
|
|
7
|
+
const ref = useRef(null);
|
|
8
|
+
const { onMindBill, onMindBillError } = props;
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
const element = ref.current;
|
|
11
|
+
if (!element) return;
|
|
12
|
+
const handleEvent = (event) => onMindBill?.(event);
|
|
13
|
+
const handleError = (event) => onMindBillError?.(event);
|
|
14
|
+
element.addEventListener("mindbill", handleEvent);
|
|
15
|
+
element.addEventListener("mindbill-error", handleError);
|
|
16
|
+
return () => {
|
|
17
|
+
element.removeEventListener("mindbill", handleEvent);
|
|
18
|
+
element.removeEventListener("mindbill-error", handleError);
|
|
19
|
+
};
|
|
20
|
+
}, [onMindBill, onMindBillError]);
|
|
21
|
+
return createElement(tagName, {
|
|
22
|
+
ref,
|
|
23
|
+
"session-token": props.sessionToken,
|
|
24
|
+
"embed-url": props.embedUrl,
|
|
25
|
+
theme: props.appearance?.theme,
|
|
26
|
+
"accent-color": props.appearance?.accentColor,
|
|
27
|
+
locale: props.appearance?.locale,
|
|
28
|
+
class: props.className,
|
|
29
|
+
style: props.style
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function MindBillBillTimeline(props) {
|
|
33
|
+
return widget("mindbill-bill-timeline", props);
|
|
34
|
+
}
|
|
35
|
+
function MindBillBillFromReport(props) {
|
|
36
|
+
return widget("mindbill-bill-from-report", props);
|
|
37
|
+
}
|
|
38
|
+
function MindBillCollections(props) {
|
|
39
|
+
return widget("mindbill-collections", props);
|
|
40
|
+
}
|
|
41
|
+
function MindBillOnboarding(props) {
|
|
42
|
+
return widget("mindbill-onboarding", props);
|
|
43
|
+
}
|
|
44
|
+
export {
|
|
45
|
+
MindBillBillFromReport,
|
|
46
|
+
MindBillBillTimeline,
|
|
47
|
+
MindBillCollections,
|
|
48
|
+
MindBillOnboarding
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.tsx"],"sourcesContent":["\"use client\";\n\nimport \"@mindbill/embed\";\nimport type { CSSProperties, ReactElement } from \"react\";\nimport { createElement, useEffect, useRef } from \"react\";\nimport type { MindBillAppearance, MindBillErrorDetail, MindBillEventDetail } from \"@mindbill/embed\";\n\nexport type MindBillWidgetProps = {\n sessionToken: string;\n embedUrl: string;\n appearance?: MindBillAppearance;\n className?: string;\n style?: CSSProperties;\n onMindBill?: (event: CustomEvent<MindBillEventDetail>) => void;\n onMindBillError?: (event: CustomEvent<MindBillErrorDetail>) => void;\n};\n\nfunction widget(tagName: string, props: MindBillWidgetProps): ReactElement {\n const ref = useRef<HTMLElement | null>(null);\n const { onMindBill, onMindBillError } = props;\n useEffect(() => {\n const element = ref.current;\n if (!element) return;\n const handleEvent = (event: Event) => onMindBill?.(event as CustomEvent<MindBillEventDetail>);\n const handleError = (event: Event) => onMindBillError?.(event as CustomEvent<MindBillErrorDetail>);\n element.addEventListener(\"mindbill\", handleEvent);\n element.addEventListener(\"mindbill-error\", handleError);\n return () => {\n element.removeEventListener(\"mindbill\", handleEvent);\n element.removeEventListener(\"mindbill-error\", handleError);\n };\n }, [onMindBill, onMindBillError]);\n\n return createElement(tagName, {\n ref,\n \"session-token\": props.sessionToken,\n \"embed-url\": props.embedUrl,\n theme: props.appearance?.theme,\n \"accent-color\": props.appearance?.accentColor,\n locale: props.appearance?.locale,\n class: props.className,\n style: props.style,\n });\n}\n\nexport function MindBillBillTimeline(props: MindBillWidgetProps): ReactElement {\n return widget(\"mindbill-bill-timeline\", props);\n}\nexport function MindBillBillFromReport(props: MindBillWidgetProps): ReactElement {\n return widget(\"mindbill-bill-from-report\", props);\n}\nexport function MindBillCollections(props: MindBillWidgetProps): ReactElement {\n return widget(\"mindbill-collections\", props);\n}\nexport function MindBillOnboarding(props: MindBillWidgetProps): ReactElement {\n return widget(\"mindbill-onboarding\", props);\n}\n\nexport type { MindBillAppearance, MindBillErrorDetail, MindBillEventDetail } from \"@mindbill/embed\";\n"],"mappings":";;;AAEA,OAAO;AAEP,SAAS,eAAe,WAAW,cAAc;AAajD,SAAS,OAAO,SAAiB,OAA0C;AACzE,QAAM,MAAM,OAA2B,IAAI;AAC3C,QAAM,EAAE,YAAY,gBAAgB,IAAI;AACxC,YAAU,MAAM;AACd,UAAM,UAAU,IAAI;AACpB,QAAI,CAAC,QAAS;AACd,UAAM,cAAc,CAAC,UAAiB,aAAa,KAAyC;AAC5F,UAAM,cAAc,CAAC,UAAiB,kBAAkB,KAAyC;AACjG,YAAQ,iBAAiB,YAAY,WAAW;AAChD,YAAQ,iBAAiB,kBAAkB,WAAW;AACtD,WAAO,MAAM;AACX,cAAQ,oBAAoB,YAAY,WAAW;AACnD,cAAQ,oBAAoB,kBAAkB,WAAW;AAAA,IAC3D;AAAA,EACF,GAAG,CAAC,YAAY,eAAe,CAAC;AAEhC,SAAO,cAAc,SAAS;AAAA,IAC5B;AAAA,IACA,iBAAiB,MAAM;AAAA,IACvB,aAAa,MAAM;AAAA,IACnB,OAAO,MAAM,YAAY;AAAA,IACzB,gBAAgB,MAAM,YAAY;AAAA,IAClC,QAAQ,MAAM,YAAY;AAAA,IAC1B,OAAO,MAAM;AAAA,IACb,OAAO,MAAM;AAAA,EACf,CAAC;AACH;AAEO,SAAS,qBAAqB,OAA0C;AAC7E,SAAO,OAAO,0BAA0B,KAAK;AAC/C;AACO,SAAS,uBAAuB,OAA0C;AAC/E,SAAO,OAAO,6BAA6B,KAAK;AAClD;AACO,SAAS,oBAAoB,OAA0C;AAC5E,SAAO,OAAO,wBAAwB,KAAK;AAC7C;AACO,SAAS,mBAAmB,OAA0C;AAC3E,SAAO,OAAO,uBAAuB,KAAK;AAC5C;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mindbill/react",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "React components for MindBill hosted billing workflows",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md"
|
|
18
|
+
],
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"react": ">=18"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@mindbill/embed": "^0.2.0"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"mindbill",
|
|
27
|
+
"react",
|
|
28
|
+
"medical-legal",
|
|
29
|
+
"workers-compensation",
|
|
30
|
+
"widget"
|
|
31
|
+
],
|
|
32
|
+
"license": "MIT",
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "git+https://github.com/incidentfox/mindbill-widgets.git",
|
|
36
|
+
"directory": "packages/react"
|
|
37
|
+
},
|
|
38
|
+
"homepage": "https://github.com/incidentfox/mindbill-widgets#readme",
|
|
39
|
+
"bugs": {
|
|
40
|
+
"url": "https://github.com/incidentfox/mindbill-widgets/issues"
|
|
41
|
+
},
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public",
|
|
44
|
+
"provenance": true
|
|
45
|
+
},
|
|
46
|
+
"sideEffects": true,
|
|
47
|
+
"scripts": {
|
|
48
|
+
"build": "tsup src/index.tsx --format esm --dts --clean --sourcemap --external react --external react/jsx-runtime",
|
|
49
|
+
"clean": "rm -rf dist"
|
|
50
|
+
}
|
|
51
|
+
}
|