@opencx/widget 2.0.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.
Files changed (125) hide show
  1. package/README.md +105 -0
  2. package/dist/basic.cjs +259 -0
  3. package/dist/basic.cjs.map +1 -0
  4. package/dist/basic.d.ts +2 -0
  5. package/dist/basic.js +40507 -0
  6. package/dist/basic.js.map +1 -0
  7. package/dist/core/client/api.d.ts +15 -0
  8. package/dist/core/client/client.d.ts +39 -0
  9. package/dist/core/client/index.d.ts +1 -0
  10. package/dist/core/errors/index.d.ts +21 -0
  11. package/dist/core/index.d.ts +3 -0
  12. package/dist/core/managers/chathistory-manager.d.ts +61 -0
  13. package/dist/core/managers/session-manager.d.ts +35 -0
  14. package/dist/core/platform/index.d.ts +20 -0
  15. package/dist/core/transport/http.transport.d.ts +17 -0
  16. package/dist/core/transport/transport.d.ts +25 -0
  17. package/dist/core/types/helpers.d.ts +5 -0
  18. package/dist/core/types/index.d.ts +32 -0
  19. package/dist/core/types/messages.d.ts +43 -0
  20. package/dist/core/types/prelude.d.ts +14 -0
  21. package/dist/core/types/pub-sub.d.ts +94 -0
  22. package/dist/core/types/schemas.d.ts +489 -0
  23. package/dist/core/types/transport.d.ts +31 -0
  24. package/dist/core/utils/genId.d.ts +2 -0
  25. package/dist/core/utils/genId.test.d.ts +1 -0
  26. package/dist/core/utils/history-to-widget-messages.d.ts +4 -0
  27. package/dist/history-to-widget-messages-CP0hKjhv.js +195 -0
  28. package/dist/history-to-widget-messages-CP0hKjhv.js.map +1 -0
  29. package/dist/history-to-widget-messages-CdbZolRN.cjs +2 -0
  30. package/dist/history-to-widget-messages-CdbZolRN.cjs.map +1 -0
  31. package/dist/index-C11ivBh5.js +2604 -0
  32. package/dist/index-C11ivBh5.js.map +1 -0
  33. package/dist/index-DQmRZV3b.cjs +18 -0
  34. package/dist/index-DQmRZV3b.cjs.map +1 -0
  35. package/dist/index.cjs +2 -0
  36. package/dist/index.cjs.map +1 -0
  37. package/dist/index.d.ts +2 -0
  38. package/dist/index.js +445 -0
  39. package/dist/index.js.map +1 -0
  40. package/dist/react-lib/Root.d.ts +6 -0
  41. package/dist/react-lib/hooks/handle-socket-messages.d.ts +27 -0
  42. package/dist/react-lib/hooks/index.d.ts +6 -0
  43. package/dist/react-lib/hooks/socket.d.ts +11 -0
  44. package/dist/react-lib/hooks/socketState.d.ts +2 -0
  45. package/dist/react-lib/hooks/use-sound.d.ts +13 -0
  46. package/dist/react-lib/hooks/use-sound.test.d.ts +1 -0
  47. package/dist/react-lib/hooks/use-sync-state.test.d.ts +1 -0
  48. package/dist/react-lib/hooks/useAbstractChat.d.ts +159 -0
  49. package/dist/react-lib/hooks/useAxiosInstance.d.ts +121 -0
  50. package/dist/react-lib/hooks/useBaseClient.d.ts +2 -0
  51. package/dist/react-lib/hooks/useScrollTo.d.ts +2 -0
  52. package/dist/react-lib/hooks/useSyncState.d.ts +4 -0
  53. package/dist/react-lib/hooks/useTimeoutState.d.ts +3 -0
  54. package/dist/react-lib/hooks/useUploadFiles.d.ts +21 -0
  55. package/dist/react-lib/hooks/useVote.d.ts +2 -0
  56. package/dist/react-lib/hooks/useWidgetContentHeight.d.ts +9 -0
  57. package/dist/react-lib/index.d.ts +10 -0
  58. package/dist/react-lib/locales/ar.locale.d.ts +2 -0
  59. package/dist/react-lib/locales/de.locale.d.ts +2 -0
  60. package/dist/react-lib/locales/en.locale.d.ts +55 -0
  61. package/dist/react-lib/locales/fr.locale.d.ts +2 -0
  62. package/dist/react-lib/locales/helper.d.ts +65 -0
  63. package/dist/react-lib/locales/index.d.ts +3 -0
  64. package/dist/react-lib/locales/nl.locale.d.ts +2 -0
  65. package/dist/react-lib/locales/pt.locale.d.ts +2 -0
  66. package/dist/react-lib/providers/ChatProvider.d.ts +135 -0
  67. package/dist/react-lib/providers/ClientProvider.d.ts +7 -0
  68. package/dist/react-lib/providers/ConfigDataProvider.d.ts +62 -0
  69. package/dist/react-lib/providers/ContactProvider.d.ts +58 -0
  70. package/dist/react-lib/providers/LocalesProvider.d.ts +11 -0
  71. package/dist/react-lib/providers/componentRegistry.d.ts +13 -0
  72. package/dist/react-lib/providers/use-widget-sfx.d.ts +7 -0
  73. package/dist/react-lib/providers/usePreludeData.d.ts +2 -0
  74. package/dist/react-lib/types/components.d.ts +10 -0
  75. package/dist/react-lib/types/index.d.ts +6 -0
  76. package/dist/react-lib/types/options.d.ts +43 -0
  77. package/dist/react-lib/utils/create-safe-context.d.ts +1 -0
  78. package/dist/react-lib/utils/debug.d.ts +2 -0
  79. package/dist/react-lib/utils/getters.d.ts +24 -0
  80. package/dist/react-lib/utils/index.d.ts +1 -0
  81. package/dist/react.cjs +2 -0
  82. package/dist/react.cjs.map +1 -0
  83. package/dist/react.d.ts +2 -0
  84. package/dist/react.js +41 -0
  85. package/dist/react.js.map +1 -0
  86. package/dist/src/@components/BotMessage.d.ts +9 -0
  87. package/dist/src/@components/BotMessageWrapper.d.ts +7 -0
  88. package/dist/src/@components/ChatEvent.component.d.ts +9 -0
  89. package/dist/src/@components/Fallback.component.d.ts +8 -0
  90. package/dist/src/@components/Loading.component.d.ts +2 -0
  91. package/dist/src/@components/OpenLogoSvg.d.ts +4 -0
  92. package/dist/src/@components/Text.component.d.ts +3 -0
  93. package/dist/src/@components/index.d.ts +6 -0
  94. package/dist/src/@components/markdown.d.ts +3 -0
  95. package/dist/src/components/MotionDiv.d.ts +18 -0
  96. package/dist/src/components/RenderFile.d.ts +7 -0
  97. package/dist/src/components/avatar.d.ts +6 -0
  98. package/dist/src/components/button.d.ts +11 -0
  99. package/dist/src/components/dialog.d.ts +276 -0
  100. package/dist/src/components/dropdown-menu.d.ts +27 -0
  101. package/dist/src/components/input.d.ts +5 -0
  102. package/dist/src/components/keyboard.d.ts +7 -0
  103. package/dist/src/components/popover.d.ts +8 -0
  104. package/dist/src/components/skeleton.d.ts +3 -0
  105. package/dist/src/components/switch.d.ts +4 -0
  106. package/dist/src/components/tooltip.d.ts +10 -0
  107. package/dist/src/components/userMessage.d.ts +8 -0
  108. package/dist/src/components/wobble.d.ts +15 -0
  109. package/dist/src/designs/basic/WidgetPopoverTrigger.d.ts +5 -0
  110. package/dist/src/designs/basic/index.d.ts +5 -0
  111. package/dist/src/designs/basic/screens/chat-screen/ChatFooter.d.ts +2 -0
  112. package/dist/src/designs/basic/screens/chat-screen/ChatHeader.d.ts +2 -0
  113. package/dist/src/designs/basic/screens/chat-screen/ChatScreen.d.ts +2 -0
  114. package/dist/src/designs/basic/screens/chat-screen/SessionClosedDialog.d.ts +2 -0
  115. package/dist/src/designs/basic/screens/root-screen.d.ts +2 -0
  116. package/dist/src/designs/basic/screens/welcome-screen/WelcomeScreen.d.ts +2 -0
  117. package/dist/src/designs/constants.d.ts +15 -0
  118. package/dist/src/hooks/useShouldCollectData.d.ts +3 -0
  119. package/dist/src/index.d.ts +9 -0
  120. package/dist/src/render.d.ts +2 -0
  121. package/dist/src/utils.d.ts +2 -0
  122. package/dist/style.css +1 -0
  123. package/dist-embed/script.js +476 -0
  124. package/dist-embed/script.js.map +1 -0
  125. package/package.json +153 -0
@@ -0,0 +1,7 @@
1
+ import { ApiClient } from '../../core/client';
2
+ import { default as React } from 'react';
3
+ declare const useClient: () => ApiClient;
4
+ declare function ClientProvider({ children }: {
5
+ children: React.ReactNode;
6
+ }): React.JSX.Element | null;
7
+ export { useClient, ClientProvider };
@@ -0,0 +1,62 @@
1
+ import { default as React, ReactNode } from 'react';
2
+ import { WidgetOptions, WidgetThemeOptions } from '../types';
3
+ import { useAxiosInstance } from '../hooks';
4
+ import { ComponentRegistry } from './componentRegistry';
5
+ declare function useNormalizeOptions(data: WidgetOptions): {
6
+ bot: {
7
+ id: string | null;
8
+ name: string;
9
+ is_ai: boolean;
10
+ profile_picture?: string | null | undefined;
11
+ };
12
+ apiUrl: string;
13
+ socketUrl: string;
14
+ language: "en" | "ar" | "nl" | "fr" | "de" | "pt";
15
+ botToken: string;
16
+ headers: Record<string, string>;
17
+ pathParams: Record<string, string>;
18
+ queryParams: Record<string, string>;
19
+ user: import('../types').UserObject;
20
+ theme: WidgetThemeOptions & Partial<WidgetThemeOptions>;
21
+ soundEffectFiles: {
22
+ messageArrived: string;
23
+ };
24
+ collectUserData: boolean;
25
+ defaultSettings: {
26
+ persistSession: boolean;
27
+ useSoundEffects: boolean;
28
+ };
29
+ token: string;
30
+ initialMessages: string[];
31
+ settings?: {
32
+ persistSession?: boolean;
33
+ useSoundEffects?: boolean;
34
+ };
35
+ debug?: boolean;
36
+ assets?: {
37
+ organizationLogo?: string;
38
+ };
39
+ components?: import('../types').ComponentType[];
40
+ };
41
+ export type NormalizedWidgetOptions = ReturnType<typeof useNormalizeOptions>;
42
+ type WidgetSettings = {
43
+ persistSession: boolean;
44
+ useSoundEffects: boolean;
45
+ };
46
+ interface ConfigData extends ReturnType<typeof useNormalizeOptions> {
47
+ http: ReturnType<typeof useAxiosInstance>;
48
+ botToken: string;
49
+ componentStore: ComponentRegistry;
50
+ widgetSettings: WidgetSettings | null;
51
+ setSettings: (settings: Partial<WidgetSettings>) => void;
52
+ defaultSettings: WidgetSettings;
53
+ soundEffectFiles: {
54
+ messageArrived: string;
55
+ };
56
+ }
57
+ declare const useConfigData: () => ConfigData;
58
+ export declare function ConfigDataProvider({ children, data, }: {
59
+ data: WidgetOptions;
60
+ children: ReactNode;
61
+ }): React.JSX.Element;
62
+ export { useConfigData };
@@ -0,0 +1,58 @@
1
+ import { default as React, ReactNode } from 'react';
2
+ import { UserObject } from '../types';
3
+ declare const useContact: () => {
4
+ creatingContactState: {
5
+ loading: boolean;
6
+ error?: undefined;
7
+ value?: undefined;
8
+ } | {
9
+ loading: false;
10
+ error: Error;
11
+ value?: undefined;
12
+ } | {
13
+ loading: true;
14
+ error?: Error | undefined;
15
+ value?: {
16
+ email: string | null;
17
+ id: string;
18
+ name: string | null;
19
+ avatar_url: string | null;
20
+ created_at: string;
21
+ } | null | undefined;
22
+ } | {
23
+ loading: false;
24
+ error?: undefined;
25
+ value: {
26
+ email: string | null;
27
+ id: string;
28
+ name: string | null;
29
+ avatar_url: string | null;
30
+ created_at: string;
31
+ } | null;
32
+ };
33
+ createContactAsync: (user: UserObject) => Promise<{
34
+ email: string | null;
35
+ id: string;
36
+ name: string | null;
37
+ avatar_url: string | null;
38
+ created_at: string;
39
+ } | null>;
40
+ contact: {
41
+ email: string | null;
42
+ id: string;
43
+ name: string | null;
44
+ avatar_url: string | null;
45
+ created_at: string;
46
+ } | null;
47
+ shouldCollectData: {
48
+ should: boolean;
49
+ reason: string;
50
+ } | {
51
+ should: boolean;
52
+ reason?: undefined;
53
+ };
54
+ };
55
+ declare function ContactProvider({ children }: {
56
+ children: ReactNode;
57
+ }): React.JSX.Element;
58
+ export { ContactProvider, useContact };
@@ -0,0 +1,11 @@
1
+ import { LangType } from '../locales';
2
+ import { TranslationKeysType } from '@react/locales/en.locale';
3
+ import { default as React } from 'react';
4
+ declare const useLocale: () => {
5
+ get: (key: TranslationKeysType, pfx?: string) => string;
6
+ lang: LangType;
7
+ };
8
+ declare function LocaleProvider({ children }: {
9
+ children: React.ReactNode;
10
+ }): React.JSX.Element;
11
+ export { LocaleProvider, useLocale };
@@ -0,0 +1,13 @@
1
+ import { ComponentType, OptionsType } from '../types';
2
+ /**
3
+ * this a singleton class helps me to easily control the components present/available in the widget.
4
+ * it also manages the various types of components to be added along the way.
5
+ */
6
+ export declare class ComponentRegistry {
7
+ components: ComponentType[];
8
+ constructor(opts: OptionsType);
9
+ register(com: ComponentType): this;
10
+ private get;
11
+ private getOrFallback;
12
+ getComponent(key: string, getFallback?: boolean): import('react').ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
13
+ }
@@ -0,0 +1,7 @@
1
+ declare function useWidgetSoundEffects(): {
2
+ messageArrivedSound: {
3
+ play: () => void;
4
+ stop: () => void;
5
+ };
6
+ };
7
+ export { useWidgetSoundEffects };
@@ -0,0 +1,2 @@
1
+ declare function usePreludeData(): import('swr').SWRResponse<import('../../core/types/prelude').PreludeData | undefined, any, any>;
2
+ export { usePreludeData };
@@ -0,0 +1,10 @@
1
+ import { default as React } from 'react';
2
+ import { BotMessageType } from '@core/types/messages';
3
+ export type ComponentProps<TData> = BotMessageType<TData>;
4
+ export type ComponentType = {
5
+ key: string;
6
+ component: React.ElementType;
7
+ };
8
+ export type OptionsType = {
9
+ components?: ComponentType[];
10
+ };
@@ -0,0 +1,6 @@
1
+ import { ComponentProps } from './components';
2
+ export * from './options';
3
+ export * from './components';
4
+ export type DefaultTextComponentProps = ComponentProps<{
5
+ message: string;
6
+ }>;
@@ -0,0 +1,43 @@
1
+ import { LangType } from '../locales';
2
+ import { ComponentType } from './components';
3
+ export type UserObject = {
4
+ external_id?: string;
5
+ name?: string;
6
+ email?: string;
7
+ phone?: string;
8
+ customData?: Record<string, string>;
9
+ avatarUrl?: string;
10
+ };
11
+ export interface WidgetThemeOptions {
12
+ primaryColor: string;
13
+ triggerOffset: string;
14
+ }
15
+ export type WidgetOptions = {
16
+ token: string;
17
+ headers?: Record<string, string>;
18
+ queryParams?: Record<string, string>;
19
+ pathParams?: Record<string, string>;
20
+ initialMessages: string[];
21
+ apiUrl?: string;
22
+ theme?: Partial<WidgetThemeOptions>;
23
+ settings?: {
24
+ persistSession?: boolean;
25
+ useSoundEffects?: boolean;
26
+ };
27
+ collectUserData?: boolean;
28
+ soundEffectFiles?: {
29
+ messageArrived?: string;
30
+ };
31
+ socketUrl?: string;
32
+ debug?: boolean;
33
+ language?: LangType;
34
+ user?: UserObject;
35
+ assets?: {
36
+ organizationLogo?: string;
37
+ };
38
+ bot?: {
39
+ name?: string;
40
+ avatarUrl?: string;
41
+ };
42
+ components?: ComponentType[];
43
+ };
@@ -0,0 +1 @@
1
+ export declare function createSafeContext<TDdata>(init?: TDdata): readonly [() => TDdata & ({} | null), import('react').Provider<TDdata>];
@@ -0,0 +1,2 @@
1
+ declare function debug(...args: unknown[]): void;
2
+ export { debug };
@@ -0,0 +1,24 @@
1
+ import { ChatHistoryMessageType } from '../../core/types';
2
+ interface DayOfficeHours {
3
+ from: string;
4
+ to: string;
5
+ }
6
+ export declare const workingDays: readonly ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday", "WeekDays", "Everyday"];
7
+ export type PreludeData = {
8
+ initial_questions: string[];
9
+ ai_enabled: boolean;
10
+ office_hours: WorkingHours;
11
+ office_hours_timezone: string;
12
+ organization_name: string;
13
+ };
14
+ type Day = (typeof workingDays)[number];
15
+ export type WorkingHours = {
16
+ [K in Day]: DayOfficeHours;
17
+ };
18
+ export type InitialData = {
19
+ logo: string;
20
+ faq: [];
21
+ initial_questions: string[];
22
+ history: ChatHistoryMessageType[];
23
+ };
24
+ export {};
@@ -0,0 +1 @@
1
+ export * from './getters';
package/dist/react.cjs ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DQmRZV3b.cjs"),a=["monday","tuesday","wednesday","thursday","friday","saturday","sunday","WeekDays","Everyday"];function u(t,o){const{http:s}=e.useConfigData();return e._default(async()=>s.apis.upvote(t).then(o),[s.options,t,o])}function n(t,o){const{http:s}=e.useConfigData();return e._default(async()=>s.apis.downvote(t).then(o),[s.options,t])}exports.WidgetRoot=e.WidgetRoot;exports.useChat=e.useChat;exports.useConfigData=e.useConfigData;exports.useContact=e.useContact;exports.useLocale=e.useLocale;exports.usePreludeData=e.usePreludeData;exports.useUploadFiles=e.useUploadFiles;exports.useWidgetSoundEffects=e.useWidgetSoundEffects;exports.useDownvote=n;exports.useUpvote=u;exports.workingDays=a;
2
+ //# sourceMappingURL=react.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.cjs","sources":["../react-lib/utils/getters.ts","../react-lib/hooks/useVote.ts"],"sourcesContent":["import { ChatHistoryMessageType } from \"@core/types\";\n\ninterface DayOfficeHours {\n from: string;\n to: string;\n}\n\nexport const workingDays = [\n \"monday\",\n \"tuesday\",\n \"wednesday\",\n \"thursday\",\n \"friday\",\n \"saturday\",\n \"sunday\",\n \"WeekDays\",\n \"Everyday\",\n] as const;\n\nexport type PreludeData = {\n initial_questions: string[];\n ai_enabled: boolean;\n office_hours: WorkingHours;\n office_hours_timezone: string;\n organization_name: string;\n};\n\ntype Day = (typeof workingDays)[number];\n\nexport type WorkingHours = {\n [K in Day]: DayOfficeHours;\n};\n\nexport type InitialData = {\n logo: string;\n faq: [];\n initial_questions: string[];\n history: ChatHistoryMessageType[];\n};\n","import { useConfigData } from \"@react/providers/ConfigDataProvider\";\nimport useAsyncFn from \"react-use/lib/useAsyncFn\";\n\nexport function useUpvote(id: string, onSuccess?: () => void) {\n const { http } = useConfigData();\n return useAsyncFn(\n async () => http.apis.upvote(id).then(onSuccess),\n [http.options, id, onSuccess],\n );\n}\n\nexport function useDownvote(id: string, onSuccess?: () => void) {\n const { http } = useConfigData();\n return useAsyncFn(\n async () => http.apis.downvote(id).then(onSuccess),\n [http.options, id],\n );\n}\n"],"names":["workingDays","useUpvote","id","onSuccess","http","useConfigData","useAsyncFn","useDownvote"],"mappings":"wHAOaA,EAAc,CACzB,SACA,UACA,YACA,WACA,SACA,WACA,SACA,WACA,UACF,ECdgB,SAAAC,EAAUC,EAAYC,EAAwB,CACtD,KAAA,CAAE,KAAAC,GAASC,EAAAA,gBACV,OAAAC,EAAA,SACL,SAAYF,EAAK,KAAK,OAAOF,CAAE,EAAE,KAAKC,CAAS,EAC/C,CAACC,EAAK,QAASF,EAAIC,CAAS,CAAA,CAEhC,CAEgB,SAAAI,EAAYL,EAAYC,EAAwB,CACxD,KAAA,CAAE,KAAAC,GAASC,EAAAA,gBACV,OAAAC,EAAA,SACL,SAAYF,EAAK,KAAK,SAASF,CAAE,EAAE,KAAKC,CAAS,EACjD,CAACC,EAAK,QAASF,CAAE,CAAA,CAErB"}
@@ -0,0 +1,2 @@
1
+ export * from './react-lib/index'
2
+ export {}
package/dist/react.js ADDED
@@ -0,0 +1,41 @@
1
+ import { u as e, _ as o } from "./index-C11ivBh5.js";
2
+ import { W as i, e as f, a as c, d as h, b as l, h as v, l as D } from "./index-C11ivBh5.js";
3
+ const u = [
4
+ "monday",
5
+ "tuesday",
6
+ "wednesday",
7
+ "thursday",
8
+ "friday",
9
+ "saturday",
10
+ "sunday",
11
+ "WeekDays",
12
+ "Everyday"
13
+ ];
14
+ function d(t, s) {
15
+ const { http: a } = e();
16
+ return o(
17
+ async () => a.apis.upvote(t).then(s),
18
+ [a.options, t, s]
19
+ );
20
+ }
21
+ function r(t, s) {
22
+ const { http: a } = e();
23
+ return o(
24
+ async () => a.apis.downvote(t).then(s),
25
+ [a.options, t]
26
+ );
27
+ }
28
+ export {
29
+ i as WidgetRoot,
30
+ f as useChat,
31
+ e as useConfigData,
32
+ c as useContact,
33
+ r as useDownvote,
34
+ h as useLocale,
35
+ l as usePreludeData,
36
+ v as useUploadFiles,
37
+ d as useUpvote,
38
+ D as useWidgetSoundEffects,
39
+ u as workingDays
40
+ };
41
+ //# sourceMappingURL=react.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.js","sources":["../react-lib/utils/getters.ts","../react-lib/hooks/useVote.ts"],"sourcesContent":["import { ChatHistoryMessageType } from \"@core/types\";\n\ninterface DayOfficeHours {\n from: string;\n to: string;\n}\n\nexport const workingDays = [\n \"monday\",\n \"tuesday\",\n \"wednesday\",\n \"thursday\",\n \"friday\",\n \"saturday\",\n \"sunday\",\n \"WeekDays\",\n \"Everyday\",\n] as const;\n\nexport type PreludeData = {\n initial_questions: string[];\n ai_enabled: boolean;\n office_hours: WorkingHours;\n office_hours_timezone: string;\n organization_name: string;\n};\n\ntype Day = (typeof workingDays)[number];\n\nexport type WorkingHours = {\n [K in Day]: DayOfficeHours;\n};\n\nexport type InitialData = {\n logo: string;\n faq: [];\n initial_questions: string[];\n history: ChatHistoryMessageType[];\n};\n","import { useConfigData } from \"@react/providers/ConfigDataProvider\";\nimport useAsyncFn from \"react-use/lib/useAsyncFn\";\n\nexport function useUpvote(id: string, onSuccess?: () => void) {\n const { http } = useConfigData();\n return useAsyncFn(\n async () => http.apis.upvote(id).then(onSuccess),\n [http.options, id, onSuccess],\n );\n}\n\nexport function useDownvote(id: string, onSuccess?: () => void) {\n const { http } = useConfigData();\n return useAsyncFn(\n async () => http.apis.downvote(id).then(onSuccess),\n [http.options, id],\n );\n}\n"],"names":["workingDays","useUpvote","id","onSuccess","http","useConfigData","useAsyncFn","useDownvote"],"mappings":";;AAOO,MAAMA,IAAc;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;ACdgB,SAAAC,EAAUC,GAAYC,GAAwB;AACtD,QAAA,EAAE,MAAAC,MAASC;AACV,SAAAC;AAAAA,IACL,YAAYF,EAAK,KAAK,OAAOF,CAAE,EAAE,KAAKC,CAAS;AAAA,IAC/C,CAACC,EAAK,SAASF,GAAIC,CAAS;AAAA,EAAA;AAEhC;AAEgB,SAAAI,EAAYL,GAAYC,GAAwB;AACxD,QAAA,EAAE,MAAAC,MAASC;AACV,SAAAC;AAAAA,IACL,YAAYF,EAAK,KAAK,SAASF,CAAE,EAAE,KAAKC,CAAS;AAAA,IACjD,CAACC,EAAK,SAASF,CAAE;AAAA,EAAA;AAErB;"}
@@ -0,0 +1,9 @@
1
+ import { BotMessageType } from '../../core/types';
2
+ import { default as React } from 'react';
3
+ interface BotMessageProps<W extends React.ElementType> {
4
+ message: BotMessageType;
5
+ Wrapper?: W;
6
+ wrapperProps?: Omit<React.ComponentProps<W>, "children">;
7
+ }
8
+ export declare function BotMessage<W extends React.ElementType>({ message, Wrapper, wrapperProps, }: BotMessageProps<W>): React.JSX.Element | null;
9
+ export {};
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+ import { BotMessageType } from '@core/types/messages';
3
+ export declare function BotResponseWrapper({ children, agent, className, }: {
4
+ children: React.ReactNode;
5
+ agent: BotMessageType["agent"];
6
+ className?: string;
7
+ }): React.JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { MessageTypeEnum } from '../../core/types';
2
+ import { ComponentProps } from '../../react-lib/types';
3
+ import { default as React } from 'react';
4
+ type ChatEventComponentProps = ComponentProps<{
5
+ event: MessageTypeEnum;
6
+ message: string;
7
+ }>;
8
+ declare function ChatEventComponent(props: ChatEventComponentProps): React.JSX.Element;
9
+ export { ChatEventComponent, MessageTypeEnum, type ChatEventComponentProps };
@@ -0,0 +1,8 @@
1
+ import { ComponentProps } from '../../react-lib/types';
2
+ import { default as React } from 'react';
3
+ type Props = ComponentProps<unknown>;
4
+ /**
5
+ * The Basic Fallback component (Rendered when Debug is True and the component key is not found)
6
+ */
7
+ export declare function FallbackComponent(props: Props): React.JSX.Element;
8
+ export {};
@@ -0,0 +1,2 @@
1
+ import { default as React } from 'react';
2
+ export declare function BotLoadingComponent(): React.JSX.Element;
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+ export declare function OpenLogoSvg({ className }: {
3
+ className?: string;
4
+ }): React.JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ import { DefaultTextComponentProps } from '../../react-lib/types';
3
+ export declare function BotTextResponse({ data, id, type, attachments, }: DefaultTextComponentProps): React.JSX.Element;
@@ -0,0 +1,6 @@
1
+ export * from './Text.component';
2
+ export * from './Loading.component';
3
+ export * from './Fallback.component';
4
+ export * from './BotMessageWrapper';
5
+ export * from './BotMessage';
6
+ export * from './ChatEvent.component';
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ import { default as ReactMarkdown } from 'react-markdown';
3
+ export declare const MemoizedReactMarkdown: React.MemoExoticComponent<typeof ReactMarkdown>;
@@ -0,0 +1,18 @@
1
+ import { default as React, ComponentProps } from 'react';
2
+ import { motion, Target } from 'framer-motion';
3
+ type MotionProps = ComponentProps<typeof motion.div>;
4
+ type AnimationDirection = "right" | "left" | "up" | "down";
5
+ type MotionDivProps = MotionProps & {
6
+ fadeIn?: AnimationDirection;
7
+ distance?: number;
8
+ snapExit?: boolean;
9
+ overrides?: Overrides;
10
+ };
11
+ type Overrides = {
12
+ initial?: Target;
13
+ animate?: Target;
14
+ exit?: Target;
15
+ };
16
+ export declare const ANIMATION_DISTANCE_PX = 10;
17
+ declare const MotionDiv: React.ForwardRefExoticComponent<Omit<MotionDivProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
18
+ export { MotionDiv };
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+ import { ChatAttachmentType } from '../../core/types';
3
+ type Props = {
4
+ attachment: ChatAttachmentType;
5
+ };
6
+ export declare function RenderAttachment({ attachment }: Props): React.JSX.Element;
7
+ export {};
@@ -0,0 +1,6 @@
1
+ import * as React from "react";
2
+ import * as AvatarPrimitive from "@radix-ui/react-avatar";
3
+ declare const Avatar: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
4
+ declare const AvatarImage: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarImageProps & React.RefAttributes<HTMLImageElement>, "ref"> & React.RefAttributes<HTMLImageElement>>;
5
+ declare const AvatarFallback: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarFallbackProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
6
+ export { Avatar, AvatarImage, AvatarFallback };
@@ -0,0 +1,11 @@
1
+ import { VariantProps } from 'class-variance-authority';
2
+ import * as React from "react";
3
+ declare const buttonVariants: (props?: ({
4
+ variant?: "link" | "default" | "outline" | "destructive" | "secondary" | "ghost" | null | undefined;
5
+ size?: "default" | "icon" | "sm" | "lg" | "fit" | null | undefined;
6
+ } & import('class-variance-authority/dist/types').ClassProp) | undefined) => string;
7
+ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
8
+ asChild?: boolean;
9
+ }
10
+ declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
11
+ export { Button, buttonVariants };