@sippet-ai/operator-widget 0.0.12

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.
Files changed (59) hide show
  1. package/LICENSE +2 -0
  2. package/README.md +136 -0
  3. package/cdn/loader.js +146 -0
  4. package/custom-elements.json +2241 -0
  5. package/dist/components/index.d.ts +1 -0
  6. package/dist/components/index.js +1 -0
  7. package/dist/components/voip-widget/index.d.ts +18 -0
  8. package/dist/components/voip-widget/index.js +4 -0
  9. package/dist/components/voip-widget/voip-widget-contacts-tab.d.ts +14 -0
  10. package/dist/components/voip-widget/voip-widget-contacts-tab.js +45 -0
  11. package/dist/components/voip-widget/voip-widget-history-tab.d.ts +13 -0
  12. package/dist/components/voip-widget/voip-widget-history-tab.js +43 -0
  13. package/dist/components/voip-widget/voip-widget-launcher.d.ts +18 -0
  14. package/dist/components/voip-widget/voip-widget-launcher.js +100 -0
  15. package/dist/components/voip-widget/voip-widget-panel.d.ts +21 -0
  16. package/dist/components/voip-widget/voip-widget-panel.js +193 -0
  17. package/dist/components/voip-widget/voip-widget-phone-tab.d.ts +21 -0
  18. package/dist/components/voip-widget/voip-widget-phone-tab.js +187 -0
  19. package/dist/components/voip-widget/voip-widget-queue-tab.d.ts +14 -0
  20. package/dist/components/voip-widget/voip-widget-queue-tab.js +49 -0
  21. package/dist/components/voip-widget/voip-widget-settings-tab.d.ts +21 -0
  22. package/dist/components/voip-widget/voip-widget-settings-tab.js +135 -0
  23. package/dist/components/voip-widget/voip-widget.d.ts +142 -0
  24. package/dist/components/voip-widget/voip-widget.js +1329 -0
  25. package/dist/components/voip-widget/voip-widget.types.d.ts +22 -0
  26. package/dist/components/voip-widget/voip-widget.types.js +1 -0
  27. package/dist/index.d.ts +3 -0
  28. package/dist/index.js +3 -0
  29. package/dist/lib/realtime.d.ts +1 -0
  30. package/dist/lib/realtime.js +1 -0
  31. package/dist/lib/sippet.d.ts +40 -0
  32. package/dist/lib/sippet.js +197 -0
  33. package/dist/lib/tailwindMixin.d.ts +6 -0
  34. package/dist/lib/tailwindMixin.js +24 -0
  35. package/dist/styles/tailwind.global.css +2 -0
  36. package/dist/styles/tailwind.global.css.js +1 -0
  37. package/package.json +126 -0
  38. package/react/SippetAIVoipWidget.d.ts +158 -0
  39. package/react/SippetAIVoipWidget.js +72 -0
  40. package/react/SippetAIVoipWidgetContactsTab.d.ts +67 -0
  41. package/react/SippetAIVoipWidgetContactsTab.js +29 -0
  42. package/react/SippetAIVoipWidgetHistoryTab.d.ts +55 -0
  43. package/react/SippetAIVoipWidgetHistoryTab.js +26 -0
  44. package/react/SippetAIVoipWidgetLauncher.d.ts +83 -0
  45. package/react/SippetAIVoipWidgetLauncher.js +41 -0
  46. package/react/SippetAIVoipWidgetPanel.d.ts +87 -0
  47. package/react/SippetAIVoipWidgetPanel.js +43 -0
  48. package/react/SippetAIVoipWidgetPhoneTab.d.ts +87 -0
  49. package/react/SippetAIVoipWidgetPhoneTab.js +43 -0
  50. package/react/SippetAIVoipWidgetQueueTab.d.ts +67 -0
  51. package/react/SippetAIVoipWidgetQueueTab.js +27 -0
  52. package/react/SippetAIVoipWidgetSettingsTab.d.ts +91 -0
  53. package/react/SippetAIVoipWidgetSettingsTab.js +47 -0
  54. package/react/index.d.ts +8 -0
  55. package/react/index.js +8 -0
  56. package/react/react-utils.js +67 -0
  57. package/types/custom-element-jsx.d.ts +956 -0
  58. package/types/custom-element-svelte.d.ts +264 -0
  59. package/types/custom-element-vuejs.d.ts +234 -0
@@ -0,0 +1,87 @@
1
+ import React from "react";
2
+ import {
3
+ SippetAIVoipWidgetPhoneTab as SippetAIVoipWidgetPhoneTabElement,
4
+ CustomEvent,
5
+ } from "../dist/components/voip-widget/voip-widget-phone-tab.js";
6
+
7
+ export type { SippetAIVoipWidgetPhoneTabElement, CustomEvent };
8
+
9
+ export interface SippetAIVoipWidgetPhoneTabProps extends Pick<
10
+ React.AllHTMLAttributes<HTMLElement>,
11
+ | "children"
12
+ | "dir"
13
+ | "hidden"
14
+ | "id"
15
+ | "lang"
16
+ | "slot"
17
+ | "style"
18
+ | "title"
19
+ | "translate"
20
+ | "onClick"
21
+ | "onFocus"
22
+ | "onBlur"
23
+ > {
24
+ /** undefined */
25
+ isMuted?: boolean;
26
+
27
+ /** undefined */
28
+ isHeld?: boolean;
29
+
30
+ /** undefined */
31
+ dialNumber?: SippetAIVoipWidgetPhoneTabElement["dialNumber"];
32
+
33
+ /** undefined */
34
+ sipStatus?: SippetAIVoipWidgetPhoneTabElement["sipStatus"];
35
+
36
+ /** undefined */
37
+ callState?: SippetAIVoipWidgetPhoneTabElement["callState"];
38
+
39
+ /** undefined */
40
+ callSeconds?: SippetAIVoipWidgetPhoneTabElement["callSeconds"];
41
+
42
+ /** A space-separated list of the classes of the element. Classes allows CSS and JavaScript to select and access specific elements via the class selectors or functions like the method `Document.getElementsByClassName()`. */
43
+ className?: string;
44
+
45
+ /** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
46
+ exportparts?: string;
47
+
48
+ /** Used for labels to link them with their inputs (using input id). */
49
+ htmlFor?: string;
50
+
51
+ /** Used to help React identify which items have changed, are added, or are removed within a list. */
52
+ key?: number | string;
53
+
54
+ /** Contains a space-separated list of the part names of the element. Part names allows CSS to select and style specific elements in a shadow tree via the ::part pseudo-element. */
55
+ part?: string;
56
+
57
+ /** A mutable ref object whose `.current` property is initialized to the passed argument (`initialValue`). The returned object will persist for the full lifetime of the component. */
58
+ ref?: React.Ref<SippetAIVoipWidgetPhoneTabElement>;
59
+
60
+ /** Allows developers to make HTML elements focusable, allow or prevent them from being sequentially focusable (usually with the `Tab` key, hence the name) and determine their relative ordering for sequential focus navigation. */
61
+ tabIndex?: number;
62
+
63
+ /** undefined */
64
+ onName?: (event: CustomEvent) => void;
65
+ }
66
+
67
+ /**
68
+ *
69
+ *
70
+ * ## Attributes & Properties
71
+ *
72
+ * Component attributes and properties that can be applied to the element or by using JavaScript.
73
+ *
74
+ * - `dialNumber`: undefined
75
+ * - `sipStatus`: undefined
76
+ * - `callState`: undefined
77
+ * - `callSeconds`: undefined
78
+ * - `isMuted`: undefined
79
+ * - `isHeld`: undefined
80
+ *
81
+ * ## Events
82
+ *
83
+ * Events that will be emitted by the component.
84
+ *
85
+ * - `name`: undefined
86
+ */
87
+ export const SippetAIVoipWidgetPhoneTab: React.ForwardRefExoticComponent<SippetAIVoipWidgetPhoneTabProps>;
@@ -0,0 +1,43 @@
1
+ import React, { forwardRef, useRef } from "react";
2
+ import "../dist/components/voip-widget/voip-widget-phone-tab.js";
3
+ import { useEventListener, createForwardedRefHandler } from "./react-utils.js";
4
+
5
+ export const SippetAIVoipWidgetPhoneTab = forwardRef((props, forwardedRef) => {
6
+ const ref = useRef(null);
7
+ const {
8
+ isMuted,
9
+ isHeld,
10
+ dialNumber,
11
+ sipStatus,
12
+ callState,
13
+ callSeconds,
14
+ exportparts,
15
+ htmlFor,
16
+ part,
17
+ tabIndex,
18
+ ...restProps
19
+ } = props;
20
+
21
+ /** Event listeners - run once */
22
+ useEventListener(ref, "name", props.onName);
23
+
24
+ return React.createElement(
25
+ "sippetai-voip-widget-phone-tab",
26
+ {
27
+ ref: createForwardedRefHandler(ref, forwardedRef),
28
+ ...restProps,
29
+ dialNumber: dialNumber,
30
+ sipStatus: sipStatus,
31
+ callState: callState,
32
+ callSeconds: callSeconds,
33
+ exportparts: exportparts,
34
+ for: htmlFor,
35
+ part: part,
36
+ tabindex: tabIndex,
37
+ isMuted: isMuted ? true : undefined,
38
+ isHeld: isHeld ? true : undefined,
39
+ style: { ...props.style },
40
+ },
41
+ props.children,
42
+ );
43
+ });
@@ -0,0 +1,67 @@
1
+ import React from "react";
2
+ import {
3
+ SippetAIVoipWidgetQueueTab as SippetAIVoipWidgetQueueTabElement,
4
+ CustomEvent,
5
+ } from "../dist/components/voip-widget/voip-widget-queue-tab.js";
6
+
7
+ export type { SippetAIVoipWidgetQueueTabElement, CustomEvent };
8
+
9
+ export interface SippetAIVoipWidgetQueueTabProps extends Pick<
10
+ React.AllHTMLAttributes<HTMLElement>,
11
+ | "children"
12
+ | "dir"
13
+ | "hidden"
14
+ | "id"
15
+ | "lang"
16
+ | "slot"
17
+ | "style"
18
+ | "title"
19
+ | "translate"
20
+ | "onClick"
21
+ | "onFocus"
22
+ | "onBlur"
23
+ > {
24
+ /** undefined */
25
+ queuedCalls?: SippetAIVoipWidgetQueueTabElement["queuedCalls"];
26
+
27
+ /** A space-separated list of the classes of the element. Classes allows CSS and JavaScript to select and access specific elements via the class selectors or functions like the method `Document.getElementsByClassName()`. */
28
+ className?: string;
29
+
30
+ /** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
31
+ exportparts?: string;
32
+
33
+ /** Used for labels to link them with their inputs (using input id). */
34
+ htmlFor?: string;
35
+
36
+ /** Used to help React identify which items have changed, are added, or are removed within a list. */
37
+ key?: number | string;
38
+
39
+ /** Contains a space-separated list of the part names of the element. Part names allows CSS to select and style specific elements in a shadow tree via the ::part pseudo-element. */
40
+ part?: string;
41
+
42
+ /** A mutable ref object whose `.current` property is initialized to the passed argument (`initialValue`). The returned object will persist for the full lifetime of the component. */
43
+ ref?: React.Ref<SippetAIVoipWidgetQueueTabElement>;
44
+
45
+ /** Allows developers to make HTML elements focusable, allow or prevent them from being sequentially focusable (usually with the `Tab` key, hence the name) and determine their relative ordering for sequential focus navigation. */
46
+ tabIndex?: number;
47
+
48
+ /** undefined */
49
+ onName?: (event: CustomEvent) => void;
50
+ }
51
+
52
+ /**
53
+ *
54
+ *
55
+ * ## Attributes & Properties
56
+ *
57
+ * Component attributes and properties that can be applied to the element or by using JavaScript.
58
+ *
59
+ * - `queuedCalls`: undefined
60
+ *
61
+ * ## Events
62
+ *
63
+ * Events that will be emitted by the component.
64
+ *
65
+ * - `name`: undefined
66
+ */
67
+ export const SippetAIVoipWidgetQueueTab: React.ForwardRefExoticComponent<SippetAIVoipWidgetQueueTabProps>;
@@ -0,0 +1,27 @@
1
+ import React, { forwardRef, useRef } from "react";
2
+ import "../dist/components/voip-widget/voip-widget-queue-tab.js";
3
+ import { useEventListener, createForwardedRefHandler } from "./react-utils.js";
4
+
5
+ export const SippetAIVoipWidgetQueueTab = forwardRef((props, forwardedRef) => {
6
+ const ref = useRef(null);
7
+ const { queuedCalls, exportparts, htmlFor, part, tabIndex, ...restProps } =
8
+ props;
9
+
10
+ /** Event listeners - run once */
11
+ useEventListener(ref, "name", props.onName);
12
+
13
+ return React.createElement(
14
+ "sippetai-voip-widget-queue-tab",
15
+ {
16
+ ref: createForwardedRefHandler(ref, forwardedRef),
17
+ ...restProps,
18
+ queuedCalls: queuedCalls,
19
+ exportparts: exportparts,
20
+ for: htmlFor,
21
+ part: part,
22
+ tabindex: tabIndex,
23
+ style: { ...props.style },
24
+ },
25
+ props.children,
26
+ );
27
+ });
@@ -0,0 +1,91 @@
1
+ import React from "react";
2
+ import {
3
+ SippetAIVoipWidgetSettingsTab as SippetAIVoipWidgetSettingsTabElement,
4
+ CustomEvent,
5
+ } from "../dist/components/voip-widget/voip-widget-settings-tab.js";
6
+
7
+ export type { SippetAIVoipWidgetSettingsTabElement, CustomEvent };
8
+
9
+ export interface SippetAIVoipWidgetSettingsTabProps extends Pick<
10
+ React.AllHTMLAttributes<HTMLElement>,
11
+ | "children"
12
+ | "dir"
13
+ | "hidden"
14
+ | "id"
15
+ | "lang"
16
+ | "slot"
17
+ | "style"
18
+ | "title"
19
+ | "translate"
20
+ | "onClick"
21
+ | "onFocus"
22
+ | "onBlur"
23
+ > {
24
+ /** undefined */
25
+ hasMediaPermission?: boolean;
26
+
27
+ /** undefined */
28
+ userEmail?: SippetAIVoipWidgetSettingsTabElement["userEmail"];
29
+
30
+ /** undefined */
31
+ audioInputs?: SippetAIVoipWidgetSettingsTabElement["audioInputs"];
32
+
33
+ /** undefined */
34
+ audioOutputs?: SippetAIVoipWidgetSettingsTabElement["audioOutputs"];
35
+
36
+ /** undefined */
37
+ selectedMicId?: SippetAIVoipWidgetSettingsTabElement["selectedMicId"];
38
+
39
+ /** undefined */
40
+ selectedSpeakerId?: SippetAIVoipWidgetSettingsTabElement["selectedSpeakerId"];
41
+
42
+ /** undefined */
43
+ sipStatus?: SippetAIVoipWidgetSettingsTabElement["sipStatus"];
44
+
45
+ /** A space-separated list of the classes of the element. Classes allows CSS and JavaScript to select and access specific elements via the class selectors or functions like the method `Document.getElementsByClassName()`. */
46
+ className?: string;
47
+
48
+ /** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
49
+ exportparts?: string;
50
+
51
+ /** Used for labels to link them with their inputs (using input id). */
52
+ htmlFor?: string;
53
+
54
+ /** Used to help React identify which items have changed, are added, or are removed within a list. */
55
+ key?: number | string;
56
+
57
+ /** Contains a space-separated list of the part names of the element. Part names allows CSS to select and style specific elements in a shadow tree via the ::part pseudo-element. */
58
+ part?: string;
59
+
60
+ /** A mutable ref object whose `.current` property is initialized to the passed argument (`initialValue`). The returned object will persist for the full lifetime of the component. */
61
+ ref?: React.Ref<SippetAIVoipWidgetSettingsTabElement>;
62
+
63
+ /** Allows developers to make HTML elements focusable, allow or prevent them from being sequentially focusable (usually with the `Tab` key, hence the name) and determine their relative ordering for sequential focus navigation. */
64
+ tabIndex?: number;
65
+
66
+ /** undefined */
67
+ onName?: (event: CustomEvent) => void;
68
+ }
69
+
70
+ /**
71
+ *
72
+ *
73
+ * ## Attributes & Properties
74
+ *
75
+ * Component attributes and properties that can be applied to the element or by using JavaScript.
76
+ *
77
+ * - `userEmail`: undefined
78
+ * - `audioInputs`: undefined
79
+ * - `audioOutputs`: undefined
80
+ * - `selectedMicId`: undefined
81
+ * - `selectedSpeakerId`: undefined
82
+ * - `hasMediaPermission`: undefined
83
+ * - `sipStatus`: undefined
84
+ *
85
+ * ## Events
86
+ *
87
+ * Events that will be emitted by the component.
88
+ *
89
+ * - `name`: undefined
90
+ */
91
+ export const SippetAIVoipWidgetSettingsTab: React.ForwardRefExoticComponent<SippetAIVoipWidgetSettingsTabProps>;
@@ -0,0 +1,47 @@
1
+ import React, { forwardRef, useRef } from "react";
2
+ import "../dist/components/voip-widget/voip-widget-settings-tab.js";
3
+ import { useEventListener, createForwardedRefHandler } from "./react-utils.js";
4
+
5
+ export const SippetAIVoipWidgetSettingsTab = forwardRef(
6
+ (props, forwardedRef) => {
7
+ const ref = useRef(null);
8
+ const {
9
+ hasMediaPermission,
10
+ userEmail,
11
+ audioInputs,
12
+ audioOutputs,
13
+ selectedMicId,
14
+ selectedSpeakerId,
15
+ sipStatus,
16
+ exportparts,
17
+ htmlFor,
18
+ part,
19
+ tabIndex,
20
+ ...restProps
21
+ } = props;
22
+
23
+ /** Event listeners - run once */
24
+ useEventListener(ref, "name", props.onName);
25
+
26
+ return React.createElement(
27
+ "sippetai-voip-widget-settings-tab",
28
+ {
29
+ ref: createForwardedRefHandler(ref, forwardedRef),
30
+ ...restProps,
31
+ userEmail: userEmail,
32
+ audioInputs: audioInputs,
33
+ audioOutputs: audioOutputs,
34
+ selectedMicId: selectedMicId,
35
+ selectedSpeakerId: selectedSpeakerId,
36
+ sipStatus: sipStatus,
37
+ exportparts: exportparts,
38
+ for: htmlFor,
39
+ part: part,
40
+ tabindex: tabIndex,
41
+ hasMediaPermission: hasMediaPermission ? true : undefined,
42
+ style: { ...props.style },
43
+ },
44
+ props.children,
45
+ );
46
+ },
47
+ );
@@ -0,0 +1,8 @@
1
+ export * from "./SippetAIVoipWidgetLauncher.js";
2
+ export * from "./SippetAIVoipWidgetPanel.js";
3
+ export * from "./SippetAIVoipWidgetPhoneTab.js";
4
+ export * from "./SippetAIVoipWidgetQueueTab.js";
5
+ export * from "./SippetAIVoipWidgetContactsTab.js";
6
+ export * from "./SippetAIVoipWidgetHistoryTab.js";
7
+ export * from "./SippetAIVoipWidgetSettingsTab.js";
8
+ export * from "./SippetAIVoipWidget.js";
package/react/index.js ADDED
@@ -0,0 +1,8 @@
1
+ export * from "./SippetAIVoipWidgetLauncher.js";
2
+ export * from "./SippetAIVoipWidgetPanel.js";
3
+ export * from "./SippetAIVoipWidgetPhoneTab.js";
4
+ export * from "./SippetAIVoipWidgetQueueTab.js";
5
+ export * from "./SippetAIVoipWidgetContactsTab.js";
6
+ export * from "./SippetAIVoipWidgetHistoryTab.js";
7
+ export * from "./SippetAIVoipWidgetSettingsTab.js";
8
+ export * from "./SippetAIVoipWidget.js";
@@ -0,0 +1,67 @@
1
+ import { useEffect, useLayoutEffect, useRef } from "react";
2
+
3
+ export function mergeRefs(target, forwardedRef) {
4
+ if (!forwardedRef) {
5
+ return;
6
+ }
7
+
8
+ if (typeof forwardedRef === "function") {
9
+ forwardedRef(target);
10
+ } else {
11
+ forwardedRef.current = target;
12
+ }
13
+ }
14
+
15
+ export function createForwardedRefHandler(localRef, forwardedRef) {
16
+ return (node) => {
17
+ localRef.current = node;
18
+ mergeRefs(node, forwardedRef);
19
+ };
20
+ }
21
+
22
+ export function useProperties(targetElement, propName, value) {
23
+ useEffect(() => {
24
+ const el = targetElement?.current;
25
+ if (!el || value === undefined || el[propName] === value) {
26
+ return;
27
+ }
28
+
29
+ try {
30
+ el[propName] = value;
31
+ } catch (e) {
32
+ console.warn(e);
33
+ }
34
+ }, [targetElement, propName, value]);
35
+ }
36
+
37
+ export function useEventListener(targetElement, eventName, eventHandler) {
38
+ // keep a ref to the latest handler so we don't need to re-register the event listener
39
+ // whenever the handler changes (avoids duplicate listeners on re-renders)
40
+ const handlerRef = useRef(eventHandler);
41
+ handlerRef.current = eventHandler;
42
+
43
+ useLayoutEffect(() => {
44
+ const el = targetElement?.current;
45
+ if (!el || eventName === undefined) {
46
+ return;
47
+ }
48
+
49
+ // capture the handler at the time the listener is attached so we can call cancel on it
50
+ const eventListener = (event) => {
51
+ const handler = handlerRef.current;
52
+ if (handler) {
53
+ handler(event);
54
+ }
55
+ };
56
+
57
+ el.addEventListener(eventName, eventListener);
58
+
59
+ return () => {
60
+ const handler = handlerRef.current;
61
+ if (handler?.cancel) {
62
+ handler.cancel();
63
+ }
64
+ el.removeEventListener(eventName, eventListener);
65
+ };
66
+ }, [eventName, targetElement?.current]);
67
+ }