@mindbill/react 0.3.0 → 0.5.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 +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @mindbill/react
|
|
2
2
|
|
|
3
|
-
React wrappers for the secure `@mindbill/embed` custom elements. See the [
|
|
3
|
+
React wrappers for the secure `@mindbill/embed` custom elements. See the repository's [10-minute quickstart](https://github.com/incidentfox/mindbill-widgets#add-mindbill-billing-in-10-minutes).
|
|
4
4
|
|
|
5
5
|
Published on npm as [`@mindbill/react`](https://www.npmjs.com/package/@mindbill/react). Install it with `npm install @mindbill/react @mindbill/embed` or your preferred package manager.
|
|
6
6
|
|
package/dist/index.js
CHANGED
|
@@ -24,6 +24,13 @@ function widget(tagName, props) {
|
|
|
24
24
|
"embed-url": props.embedUrl,
|
|
25
25
|
theme: props.appearance?.theme,
|
|
26
26
|
"accent-color": props.appearance?.accentColor,
|
|
27
|
+
"background-color": props.appearance?.backgroundColor,
|
|
28
|
+
"surface-color": props.appearance?.surfaceColor,
|
|
29
|
+
"text-color": props.appearance?.textColor,
|
|
30
|
+
"muted-color": props.appearance?.mutedColor,
|
|
31
|
+
"border-color": props.appearance?.borderColor,
|
|
32
|
+
"font-family": props.appearance?.fontFamily,
|
|
33
|
+
"border-radius": props.appearance?.borderRadius,
|
|
27
34
|
locale: props.appearance?.locale,
|
|
28
35
|
class: props.className,
|
|
29
36
|
style: props.style
|
package/dist/index.js.map
CHANGED
|
@@ -1 +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 {\n MindBillAppearance,\n MindBillErrorDetail,\n MindBillEventDetail,\n} 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) =>\n onMindBill?.(event as CustomEvent<MindBillEventDetail>);\n const handleError = (event: Event) =>\n 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 MindBillBillReview(props: MindBillWidgetProps): ReactElement {\n return widget(\"mindbill-bill-review\", props);\n}\nexport function MindBillBillFromReport(\n props: MindBillWidgetProps,\n): 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 const HostedBillTimeline = MindBillBillTimeline;\nexport const HostedBillReview = MindBillBillReview;\nexport const HostedBillFromReport = MindBillBillFromReport;\nexport const HostedCollections = MindBillCollections;\nexport const HostedOnboarding = MindBillOnboarding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AM,uBAAuB;AAC7B,IAAM,oBAAoB;AAC1B,IAAM,mBAAmB;","names":[]}
|
|
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 {\n MindBillAppearance,\n MindBillErrorDetail,\n MindBillEventDetail,\n} 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) =>\n onMindBill?.(event as CustomEvent<MindBillEventDetail>);\n const handleError = (event: Event) =>\n 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 \"background-color\": props.appearance?.backgroundColor,\n \"surface-color\": props.appearance?.surfaceColor,\n \"text-color\": props.appearance?.textColor,\n \"muted-color\": props.appearance?.mutedColor,\n \"border-color\": props.appearance?.borderColor,\n \"font-family\": props.appearance?.fontFamily,\n \"border-radius\": props.appearance?.borderRadius,\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 MindBillBillReview(props: MindBillWidgetProps): ReactElement {\n return widget(\"mindbill-bill-review\", props);\n}\nexport function MindBillBillFromReport(\n props: MindBillWidgetProps,\n): 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 const HostedBillTimeline = MindBillBillTimeline;\nexport const HostedBillReview = MindBillBillReview;\nexport const HostedBillFromReport = MindBillBillFromReport;\nexport const HostedCollections = MindBillCollections;\nexport const HostedOnboarding = MindBillOnboarding;\n\nexport type {\n MindBillAppearance,\n MindBillErrorDetail,\n MindBillEventDetail,\n} from \"@mindbill/embed\";\n"],"mappings":";;;AAEA,OAAO;AAEP,SAAS,eAAe,WAAW,cAAc;AAiBjD,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,UACnB,aAAa,KAAyC;AACxD,UAAM,cAAc,CAAC,UACnB,kBAAkB,KAAyC;AAC7D,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,oBAAoB,MAAM,YAAY;AAAA,IACtC,iBAAiB,MAAM,YAAY;AAAA,IACnC,cAAc,MAAM,YAAY;AAAA,IAChC,eAAe,MAAM,YAAY;AAAA,IACjC,gBAAgB,MAAM,YAAY;AAAA,IAClC,eAAe,MAAM,YAAY;AAAA,IACjC,iBAAiB,MAAM,YAAY;AAAA,IACnC,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,mBAAmB,OAA0C;AAC3E,SAAO,OAAO,wBAAwB,KAAK;AAC7C;AACO,SAAS,uBACd,OACc;AACd,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;AAEO,IAAM,qBAAqB;AAC3B,IAAM,mBAAmB;AACzB,IAAM,uBAAuB;AAC7B,IAAM,oBAAoB;AAC1B,IAAM,mBAAmB;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mindbill/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "React components for MindBill hosted billing workflows",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"react": ">=18"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@mindbill/embed": "^0.
|
|
23
|
+
"@mindbill/embed": "^0.5.0"
|
|
24
24
|
},
|
|
25
25
|
"keywords": [
|
|
26
26
|
"mindbill",
|