@techhalo/chat 1.0.2 → 1.0.3

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.
@@ -1,39 +1,38 @@
1
1
  import { DetailedHTMLProps, HTMLAttributes } from "react";
2
2
 
3
- declare module "HaloChat" {}
3
+ // Export the types for consumers to import
4
+ export type HaloChatPosition = "top-left" | "top-right" | "bottom-left" | "bottom-right";
4
5
 
6
+ export interface HaloChatProps {
7
+ projectId: string;
8
+ position: HaloChatPosition | string;
9
+ onCustomEvent?: (event: CustomEvent) => void;
10
+ }
11
+
12
+ export interface HaloChatElement extends HTMLElement {
13
+ projectId: string;
14
+ position: string;
15
+ onCustomEvent?: (event: CustomEvent) => void;
16
+ }
17
+
18
+ // Type for the JSX element
19
+ export type HaloChatJSXElement = DetailedHTMLProps<
20
+ HTMLAttributes<HTMLElement> & HaloChatProps,
21
+ HTMLElement
22
+ >;
23
+
24
+ // Extend JSX IntrinsicElements to include your custom element
5
25
  declare global {
6
26
  namespace JSX {
7
27
  interface IntrinsicElements {
8
- "halo-chat": DetailedHTMLProps<
9
- HTMLAttributes<HTMLElement> & {
10
- projectId: string;
11
- position: string;
12
- onCustomEvent?: (event: CustomEvent) => void;
13
- },
14
- HTMLElement
15
- >;
28
+ "halo-chat": HaloChatJSXElement;
16
29
  }
17
30
  }
18
31
  }
19
32
 
33
+ // Extend the HTML element map for proper DOM typing
20
34
  declare global {
21
35
  interface HTMLElementTagNameMap {
22
36
  "halo-chat": HaloChatElement;
23
37
  }
24
- }
25
-
26
- export interface HaloChatElement extends HTMLElement {
27
- projectId: string;
28
- position: string;
29
- onCustomEvent?: (event: CustomEvent) => void;
30
- addEventListener(
31
- type: string,
32
- listener: EventListenerOrEventListenerObject,
33
- options?: boolean | AddEventListenerOptions
34
- ): void;
35
- }
36
-
37
- declare module "@HaloChat/HaloChat" {
38
- export = HaloChatElement;
39
- }
38
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@techhalo/chat",
3
3
  "description": "Techhalo Chat Widget",
4
- "version": "1.0.2",
4
+ "version": "1.0.3",
5
5
  "author": "Techhalo",
6
6
  "type": "module",
7
7
  "main": "dist/halo-chat.umd.js",
@@ -1,39 +1,38 @@
1
1
  import { DetailedHTMLProps, HTMLAttributes } from "react";
2
2
 
3
- declare module "HaloChat" {}
3
+ // Export the types for consumers to import
4
+ export type HaloChatPosition = "top-left" | "top-right" | "bottom-left" | "bottom-right";
4
5
 
6
+ export interface HaloChatProps {
7
+ projectId: string;
8
+ position: HaloChatPosition | string;
9
+ onCustomEvent?: (event: CustomEvent) => void;
10
+ }
11
+
12
+ export interface HaloChatElement extends HTMLElement {
13
+ projectId: string;
14
+ position: string;
15
+ onCustomEvent?: (event: CustomEvent) => void;
16
+ }
17
+
18
+ // Type for the JSX element
19
+ export type HaloChatJSXElement = DetailedHTMLProps<
20
+ HTMLAttributes<HTMLElement> & HaloChatProps,
21
+ HTMLElement
22
+ >;
23
+
24
+ // Extend JSX IntrinsicElements to include your custom element
5
25
  declare global {
6
26
  namespace JSX {
7
27
  interface IntrinsicElements {
8
- "halo-chat": DetailedHTMLProps<
9
- HTMLAttributes<HTMLElement> & {
10
- projectId: string;
11
- position: string;
12
- onCustomEvent?: (event: CustomEvent) => void;
13
- },
14
- HTMLElement
15
- >;
28
+ "halo-chat": HaloChatJSXElement;
16
29
  }
17
30
  }
18
31
  }
19
32
 
33
+ // Extend the HTML element map for proper DOM typing
20
34
  declare global {
21
35
  interface HTMLElementTagNameMap {
22
36
  "halo-chat": HaloChatElement;
23
37
  }
24
- }
25
-
26
- export interface HaloChatElement extends HTMLElement {
27
- projectId: string;
28
- position: string;
29
- onCustomEvent?: (event: CustomEvent) => void;
30
- addEventListener(
31
- type: string,
32
- listener: EventListenerOrEventListenerObject,
33
- options?: boolean | AddEventListenerOptions
34
- ): void;
35
- }
36
-
37
- declare module "@HaloChat/HaloChat" {
38
- export = HaloChatElement;
39
- }
38
+ }