@opencx/widget 2.6.0 → 2.6.2
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/dist/api-BEtFfKMB.cjs +2 -0
- package/dist/api-BEtFfKMB.cjs.map +1 -0
- package/dist/api-Cez5T-se.js +1393 -0
- package/dist/api-Cez5T-se.js.map +1 -0
- package/dist/basic.cjs +85 -85
- package/dist/basic.cjs.map +1 -1
- package/dist/basic.js +13159 -12639
- package/dist/basic.js.map +1 -1
- package/dist/core/client/api.d.ts +414 -40
- package/dist/core/client/chat.d.ts +33 -19
- package/dist/core/client/config.d.ts +13 -3
- package/dist/core/client/contact.d.ts +9 -13
- package/dist/core/client/index.d.ts +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/sdk/index.d.ts +11 -0
- package/dist/core/types/contact.d.ts +2 -0
- package/dist/core/types/helpers.d.ts +5 -2
- package/dist/core/types/index.d.ts +6 -6
- package/dist/core/types/messages.d.ts +20 -9
- package/dist/core/types/schemas-v2.d.ts +10 -713
- package/dist/index-BzidnDPX.cjs +18 -0
- package/dist/index-BzidnDPX.cjs.map +1 -0
- package/dist/index-DUlnC30_.js +1219 -0
- package/dist/index-DUlnC30_.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +22 -1071
- package/dist/index.js.map +1 -1
- package/dist/react-web/core-integration/ChatProvider.d.ts +107 -0
- package/dist/react-web/core-integration/components.d.ts +11 -0
- package/dist/react-web/core-integration/hooks/useChatMessages.d.ts +70 -0
- package/dist/react-web/core-integration/hooks/useChatSession.d.ts +83 -0
- package/dist/react-web/core-integration/hooks/useConfig.d.ts +1 -0
- package/dist/react-web/core-integration/hooks/useContact.d.ts +17 -0
- package/dist/react-web/core-integration/hooks/useLocale.d.ts +4 -0
- package/dist/react-web/core-integration/hooks/usePreludeData.d.ts +36 -0
- package/dist/react-web/core-integration/hooks/usePubsub.d.ts +2 -0
- package/dist/react-web/{hooks → core-integration/hooks}/useUploadFiles.d.ts +2 -2
- package/dist/react-web/{hooks → core-integration/hooks}/useVote.d.ts +2 -2
- package/dist/react-web/core-integration/hooks.d.ts +9 -0
- package/dist/react-web/core-integration/index.d.ts +2 -0
- package/dist/react-web/index.d.ts +4 -10
- package/dist/react-web/types/components.d.ts +6 -3
- package/dist/react-web/types/index.d.ts +3 -2
- package/dist/react-web/types/options.d.ts +4 -30
- package/dist/react.cjs +1 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +10 -46
- package/dist/react.js.map +1 -1
- package/dist/src/@components/BotOrAgentMessageGroup.d.ts +1 -2
- package/dist/src/@components/BotOrAgentMessageWrapper.d.ts +2 -2
- package/dist/src/@components/ChatEvent.component.d.ts +3 -3
- package/dist/src/@components/Text.component.d.ts +1 -1
- package/dist/src/components/button.d.ts +1 -1
- package/dist/src/components/dialog.d.ts +9 -9
- package/dist/src/designs/basic/index.d.ts +1 -1
- package/dist/style.css +1 -1
- package/dist-embed/script.js +119 -124
- package/dist-embed/script.js.map +1 -1
- package/package.json +7 -4
- package/dist/core/tests/utils/create-fetch.test.d.ts +0 -1
- package/dist/core/types/schemas.d.ts +0 -543
- package/dist/core/utils/create-fetch.d.ts +0 -25
- package/dist/core/utils/genId.d.ts +0 -2
- package/dist/core/utils/history-to-widget-messages.d.ts +0 -4
- package/dist/genUuid-C12yFv3j.js +0 -137
- package/dist/genUuid-C12yFv3j.js.map +0 -1
- package/dist/genUuid-DdeSE04H.cjs +0 -2
- package/dist/genUuid-DdeSE04H.cjs.map +0 -1
- package/dist/index-C87obATS.js +0 -2616
- package/dist/index-C87obATS.js.map +0 -1
- package/dist/index-ChwS_h0D.cjs +0 -18
- package/dist/index-ChwS_h0D.cjs.map +0 -1
- package/dist/package.json.d.ts +0 -158
- package/dist/react-web/Root.d.ts +0 -6
- package/dist/react-web/hooks/index.d.ts +0 -6
- package/dist/react-web/hooks/use-sound.d.ts +0 -13
- package/dist/react-web/hooks/use-sound.test.d.ts +0 -1
- package/dist/react-web/hooks/use-sync-state.test.d.ts +0 -1
- package/dist/react-web/hooks/useAbstractChat.d.ts +0 -157
- package/dist/react-web/hooks/useAxiosInstance.d.ts +0 -190
- package/dist/react-web/hooks/useSyncState.d.ts +0 -4
- package/dist/react-web/hooks/useTimeoutState.d.ts +0 -3
- package/dist/react-web/providers/ChatProvider.d.ts +0 -143
- package/dist/react-web/providers/ConfigDataProvider.d.ts +0 -62
- package/dist/react-web/providers/ContactProvider.d.ts +0 -58
- package/dist/react-web/providers/LocalesProvider.d.ts +0 -11
- package/dist/react-web/providers/componentRegistry.d.ts +0 -13
- package/dist/react-web/providers/use-widget-sfx.d.ts +0 -7
- package/dist/react-web/providers/usePreludeData.d.ts +0 -2
- package/dist/react-web/utils/debug.d.ts +0 -2
- package/dist/react-web/utils/getters.d.ts +0 -24
- package/dist/react-web/utils/index.d.ts +0 -1
- package/dist/src/hooks/useShouldCollectData.d.ts +0 -3
- /package/dist/react-web/{locales → core-integration/locales}/ar.locale.d.ts +0 -0
- /package/dist/react-web/{locales → core-integration/locales}/de.locale.d.ts +0 -0
- /package/dist/react-web/{locales → core-integration/locales}/en.locale.d.ts +0 -0
- /package/dist/react-web/{locales → core-integration/locales}/fr.locale.d.ts +0 -0
- /package/dist/react-web/{locales → core-integration/locales}/helper.d.ts +0 -0
- /package/dist/react-web/{locales → core-integration/locales}/index.d.ts +0 -0
- /package/dist/react-web/{locales → core-integration/locales}/nl.locale.d.ts +0 -0
- /package/dist/react-web/{locales → core-integration/locales}/pt.locale.d.ts +0 -0
package/dist/package.json.d.ts
DELETED
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
"name": "@opencx/widget",
|
|
3
|
-
"private": false,
|
|
4
|
-
"version": "2.6.0",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"publishConfig": {
|
|
7
|
-
"access": "public"
|
|
8
|
-
},
|
|
9
|
-
"scripts": {
|
|
10
|
-
"clean": "rm -rf ./dist ./dist-embed",
|
|
11
|
-
"clean:dist": "rm -rf ./dist ./dist-embed",
|
|
12
|
-
"prepublishOnly": "pnpm clean && pnpm test && pnpm batman",
|
|
13
|
-
"build:lib": "vite build",
|
|
14
|
-
"dev": "vite -c vite.config.ts",
|
|
15
|
-
"build:embed": "vite build -c vite.embed.config.ts",
|
|
16
|
-
"test": "vitest run",
|
|
17
|
-
"batman": "pnpm build:lib && pnpm build:embed",
|
|
18
|
-
"test:watch": "vitest --watch",
|
|
19
|
-
"cs": "changeset",
|
|
20
|
-
"csv": "changeset version",
|
|
21
|
-
"csp": "changeset publish",
|
|
22
|
-
"type-check": "tsc --noEmit",
|
|
23
|
-
"lint": "biome lint --fix",
|
|
24
|
-
"format": "biome format --fix"
|
|
25
|
-
},
|
|
26
|
-
"peerDependencies": {
|
|
27
|
-
"lucide-react": "^0.412.0",
|
|
28
|
-
"react": "^18.3.1",
|
|
29
|
-
"rehype-raw": "^7.0.0"
|
|
30
|
-
},
|
|
31
|
-
"peerDependenciesMeta": {
|
|
32
|
-
"react": {
|
|
33
|
-
"optional": true
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
"optionalDependencies": {
|
|
37
|
-
"axios": "^1.7.5",
|
|
38
|
-
"zod": "^3.23.8"
|
|
39
|
-
},
|
|
40
|
-
"dependencies": {
|
|
41
|
-
"@radix-ui/react-avatar": "^1.1.0",
|
|
42
|
-
"@radix-ui/react-dropdown-menu": "^2.1.4",
|
|
43
|
-
"@radix-ui/react-slot": "^1.1.0",
|
|
44
|
-
"@radix-ui/react-switch": "^1.1.0",
|
|
45
|
-
"@radix-ui/react-tooltip": "^1.1.2",
|
|
46
|
-
"clsx": "^2.1.1",
|
|
47
|
-
"date-fns": "^4.1.0",
|
|
48
|
-
"framer-motion": "^11.3.30",
|
|
49
|
-
"lodash.isequal": "^4.5.0",
|
|
50
|
-
"lodash.set": "^4.3.2",
|
|
51
|
-
"lucide-react": "^0.436.0",
|
|
52
|
-
"mutative": "^1.0.11",
|
|
53
|
-
"react-dropzone": "^14.3.5",
|
|
54
|
-
"react-hot-toast": "^2.4.1",
|
|
55
|
-
"tinycolor2": "^1.6.0",
|
|
56
|
-
"uuid": "^11.0.4",
|
|
57
|
-
"whatwg-fetch": "^3.6.20",
|
|
58
|
-
"zod": "^3.23.8"
|
|
59
|
-
},
|
|
60
|
-
"overrides": {
|
|
61
|
-
"@opencx/widget": {
|
|
62
|
-
"react": {
|
|
63
|
-
"optional": true,
|
|
64
|
-
"dependencies": {
|
|
65
|
-
"react-hot-toast": "^2.4.1",
|
|
66
|
-
"react-markdown": "^9.0.1",
|
|
67
|
-
"framer-motion": "^11.3.30",
|
|
68
|
-
"date-fns": "^4.1.0"
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
"conditionalDependencies": {
|
|
74
|
-
"react": {
|
|
75
|
-
"react-hot-toast": "^2.4.1",
|
|
76
|
-
"react-markdown": "^9.0.1",
|
|
77
|
-
"framer-motion": "^11.3.30",
|
|
78
|
-
"date-fns": "^4.1.0"
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
"files": [
|
|
82
|
-
"dist",
|
|
83
|
-
"dist-embed"
|
|
84
|
-
],
|
|
85
|
-
"bugs": {
|
|
86
|
-
"url": "https://github.com/openchatai/widget/issues"
|
|
87
|
-
},
|
|
88
|
-
"author": {
|
|
89
|
-
"name": "openchatai",
|
|
90
|
-
"url": "https://github.com/openchatai"
|
|
91
|
-
},
|
|
92
|
-
"main": "./dist/index.js",
|
|
93
|
-
"module": "./dist/index.js",
|
|
94
|
-
"types": "./dist/index.d.ts",
|
|
95
|
-
"sideEffects": false,
|
|
96
|
-
"exports": {
|
|
97
|
-
".": {
|
|
98
|
-
"types": "./dist/index.d.ts",
|
|
99
|
-
"import": "./dist/index.js",
|
|
100
|
-
"require": "./dist/index.cjs"
|
|
101
|
-
},
|
|
102
|
-
"./basic": {
|
|
103
|
-
"types": "./dist/basic.d.ts",
|
|
104
|
-
"import": "./dist/basic.js",
|
|
105
|
-
"require": "./dist/basic.cjs"
|
|
106
|
-
},
|
|
107
|
-
"./react": {
|
|
108
|
-
"types": "./dist/react.d.ts",
|
|
109
|
-
"import": "./dist/react.js",
|
|
110
|
-
"require": "./dist/react.cjs"
|
|
111
|
-
},
|
|
112
|
-
"./package.json": "./package.json",
|
|
113
|
-
"./dist/*.css": "./dist/*.css"
|
|
114
|
-
},
|
|
115
|
-
"devDependencies": {
|
|
116
|
-
"@biomejs/biome": "1.9.4",
|
|
117
|
-
"@changesets/cli": "^2.27.9",
|
|
118
|
-
"@radix-ui/react-popover": "^1.1.2",
|
|
119
|
-
"@tailwindcss/typography": "^0.5.15",
|
|
120
|
-
"@testing-library/dom": "^10.4.0",
|
|
121
|
-
"@testing-library/jest-dom": "^6.5.0",
|
|
122
|
-
"@testing-library/react": "^16.0.1",
|
|
123
|
-
"@types/lodash.debounce": "^4.0.9",
|
|
124
|
-
"@types/lodash.isequal": "^4.5.8",
|
|
125
|
-
"@types/lodash.set": "^4.3.9",
|
|
126
|
-
"@types/node": "^20.14.8",
|
|
127
|
-
"@types/react": "^18.3.4",
|
|
128
|
-
"@types/react-dom": "^18.3.0",
|
|
129
|
-
"@types/tinycolor2": "^1.4.6",
|
|
130
|
-
"@uiw/react-iframe": "^1.0.3",
|
|
131
|
-
"@vitejs/plugin-react": "^4.3.4",
|
|
132
|
-
"autoprefixer": "^10.4.20",
|
|
133
|
-
"axios": "^1.7.5",
|
|
134
|
-
"class-variance-authority": "^0.7.0",
|
|
135
|
-
"jsdom": "^25.0.1",
|
|
136
|
-
"mutative": "^1.0.11",
|
|
137
|
-
"postcss": "^8.4.41",
|
|
138
|
-
"postcss-prefix-selector": "^1.16.1",
|
|
139
|
-
"react": "^18.3.1",
|
|
140
|
-
"react-dom": "^18.3.1",
|
|
141
|
-
"react-markdown": "^9.0.1",
|
|
142
|
-
"react-use": "^17.5.1",
|
|
143
|
-
"rehype-raw": "^7.0.0",
|
|
144
|
-
"remark-gfm": "^4.0.0",
|
|
145
|
-
"swr": "^2.2.5",
|
|
146
|
-
"tailwind-merge": "^2.4.0",
|
|
147
|
-
"tailwindcss": "^3.4.6",
|
|
148
|
-
"tailwindcss-animate": "^1.0.7",
|
|
149
|
-
"typescript": "^5.5.4",
|
|
150
|
-
"vite": "^5.4.2",
|
|
151
|
-
"vite-plugin-dts": "4.0.3",
|
|
152
|
-
"vite-plugin-externalize-deps": "^0.8.0",
|
|
153
|
-
"vite-tsconfig-paths": "^5.0.1",
|
|
154
|
-
"vitest": "^2.0.5"
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
export default _default;
|
package/dist/react-web/Root.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
interface UseAudioOptions {
|
|
2
|
-
src: string;
|
|
3
|
-
soundEnabled?: boolean;
|
|
4
|
-
volume?: number;
|
|
5
|
-
}
|
|
6
|
-
declare function useSound(opts: UseAudioOptions): {
|
|
7
|
-
play: () => void;
|
|
8
|
-
stop: () => void;
|
|
9
|
-
pause: () => void;
|
|
10
|
-
isPlaying: () => boolean;
|
|
11
|
-
instance: HTMLAudioElement | null;
|
|
12
|
-
};
|
|
13
|
-
export { useSound };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import { AIClosureType, SessionStatus } from '@core/types/schemas';
|
|
2
|
-
import { MessageType, SendMessageInput } from '../../core/types';
|
|
3
|
-
type HookState = {
|
|
4
|
-
state: "loading" | "error" | "idle";
|
|
5
|
-
error?: any;
|
|
6
|
-
};
|
|
7
|
-
type useChatOptions = {
|
|
8
|
-
onSessionDestroy?: () => void;
|
|
9
|
-
defaultHookSettings?: HookSettings;
|
|
10
|
-
};
|
|
11
|
-
type ChatState = {
|
|
12
|
-
lastUpdated: number | null;
|
|
13
|
-
messages: MessageType[];
|
|
14
|
-
/**
|
|
15
|
-
* Options that the AI provides to the user after a reply, such as "I need more help" or "This is helpful"
|
|
16
|
-
*/
|
|
17
|
-
keyboard: {
|
|
18
|
-
options: string[];
|
|
19
|
-
} | null;
|
|
20
|
-
};
|
|
21
|
-
interface HookSettings {
|
|
22
|
-
persistSession?: boolean;
|
|
23
|
-
useSoundEffects?: boolean;
|
|
24
|
-
}
|
|
25
|
-
declare function useAbstractChat({ onSessionDestroy }: useChatOptions): {
|
|
26
|
-
version: string;
|
|
27
|
-
state: ChatState;
|
|
28
|
-
session: {
|
|
29
|
-
isSessionClosed: boolean;
|
|
30
|
-
isAssignedToAi: boolean;
|
|
31
|
-
isAssignedToHuman: boolean;
|
|
32
|
-
isPendingHuman: boolean;
|
|
33
|
-
status: SessionStatus;
|
|
34
|
-
id: string;
|
|
35
|
-
channel: import('@core/types/schemas').SessionChannel;
|
|
36
|
-
language: string | null;
|
|
37
|
-
ai_closure_type: AIClosureType | null;
|
|
38
|
-
assignee_id: number | null;
|
|
39
|
-
summary: string | null;
|
|
40
|
-
last_message: string | null;
|
|
41
|
-
last_message_at: Date | null;
|
|
42
|
-
sentiment: import('@core/types/schemas').SentimentEnum | null;
|
|
43
|
-
assignee?: {
|
|
44
|
-
name: string;
|
|
45
|
-
email: string;
|
|
46
|
-
avatar_url?: string | undefined;
|
|
47
|
-
} | null | undefined;
|
|
48
|
-
} | null;
|
|
49
|
-
noMessages: boolean;
|
|
50
|
-
initState: {
|
|
51
|
-
loading: boolean;
|
|
52
|
-
error?: undefined;
|
|
53
|
-
value?: undefined;
|
|
54
|
-
} | {
|
|
55
|
-
loading: false;
|
|
56
|
-
error: Error;
|
|
57
|
-
value?: undefined;
|
|
58
|
-
} | {
|
|
59
|
-
loading: true;
|
|
60
|
-
error?: Error | undefined;
|
|
61
|
-
value?: void | undefined;
|
|
62
|
-
} | {
|
|
63
|
-
loading: false;
|
|
64
|
-
error?: undefined;
|
|
65
|
-
value: void;
|
|
66
|
-
};
|
|
67
|
-
clearSessionState: {
|
|
68
|
-
loading: boolean;
|
|
69
|
-
error?: undefined;
|
|
70
|
-
value?: undefined;
|
|
71
|
-
} | {
|
|
72
|
-
loading: false;
|
|
73
|
-
error: Error;
|
|
74
|
-
value?: undefined;
|
|
75
|
-
} | {
|
|
76
|
-
loading: true;
|
|
77
|
-
error?: Error | undefined;
|
|
78
|
-
value?: void | undefined;
|
|
79
|
-
} | {
|
|
80
|
-
loading: false;
|
|
81
|
-
error?: undefined;
|
|
82
|
-
value: void;
|
|
83
|
-
};
|
|
84
|
-
recreateSessionState: {
|
|
85
|
-
loading: boolean;
|
|
86
|
-
error?: undefined;
|
|
87
|
-
value?: undefined;
|
|
88
|
-
} | {
|
|
89
|
-
loading: false;
|
|
90
|
-
error: Error;
|
|
91
|
-
value?: undefined;
|
|
92
|
-
} | {
|
|
93
|
-
loading: true;
|
|
94
|
-
error?: Error | undefined;
|
|
95
|
-
value?: {
|
|
96
|
-
status: SessionStatus;
|
|
97
|
-
id: string;
|
|
98
|
-
channel: import('@core/types/schemas').SessionChannel;
|
|
99
|
-
language: string | null;
|
|
100
|
-
ai_closure_type: AIClosureType | null;
|
|
101
|
-
assignee_id: number | null;
|
|
102
|
-
summary: string | null;
|
|
103
|
-
last_message: string | null;
|
|
104
|
-
last_message_at: Date | null;
|
|
105
|
-
sentiment: import('@core/types/schemas').SentimentEnum | null;
|
|
106
|
-
assignee?: {
|
|
107
|
-
name: string;
|
|
108
|
-
email: string;
|
|
109
|
-
avatar_url?: string | undefined;
|
|
110
|
-
} | null | undefined;
|
|
111
|
-
} | undefined;
|
|
112
|
-
} | {
|
|
113
|
-
loading: false;
|
|
114
|
-
error?: undefined;
|
|
115
|
-
value: {
|
|
116
|
-
status: SessionStatus;
|
|
117
|
-
id: string;
|
|
118
|
-
channel: import('@core/types/schemas').SessionChannel;
|
|
119
|
-
language: string | null;
|
|
120
|
-
ai_closure_type: AIClosureType | null;
|
|
121
|
-
assignee_id: number | null;
|
|
122
|
-
summary: string | null;
|
|
123
|
-
last_message: string | null;
|
|
124
|
-
last_message_at: Date | null;
|
|
125
|
-
sentiment: import('@core/types/schemas').SentimentEnum | null;
|
|
126
|
-
assignee?: {
|
|
127
|
-
name: string;
|
|
128
|
-
email: string;
|
|
129
|
-
avatar_url?: string | undefined;
|
|
130
|
-
} | null | undefined;
|
|
131
|
-
};
|
|
132
|
-
};
|
|
133
|
-
hookState: HookState;
|
|
134
|
-
recreateSession: () => Promise<{
|
|
135
|
-
status: SessionStatus;
|
|
136
|
-
id: string;
|
|
137
|
-
channel: import('@core/types/schemas').SessionChannel;
|
|
138
|
-
language: string | null;
|
|
139
|
-
ai_closure_type: AIClosureType | null;
|
|
140
|
-
assignee_id: number | null;
|
|
141
|
-
summary: string | null;
|
|
142
|
-
last_message: string | null;
|
|
143
|
-
last_message_at: Date | null;
|
|
144
|
-
sentiment: import('@core/types/schemas').SentimentEnum | null;
|
|
145
|
-
assignee?: {
|
|
146
|
-
name: string;
|
|
147
|
-
email: string;
|
|
148
|
-
avatar_url?: string | undefined;
|
|
149
|
-
} | null | undefined;
|
|
150
|
-
}>;
|
|
151
|
-
clearSession: () => Promise<void>;
|
|
152
|
-
sendMessage: ({ content, user, attachments, ...data }: SendMessageInput) => Promise<{
|
|
153
|
-
id: string;
|
|
154
|
-
}>;
|
|
155
|
-
handleKeyboard: (option: string) => void;
|
|
156
|
-
};
|
|
157
|
-
export { useAbstractChat, type SendMessageInput, type HookState };
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import { AxiosRequestConfig } from 'axios';
|
|
2
|
-
import { PreludeData, WorkingHours } from '@core/types/prelude';
|
|
3
|
-
import { UserObject } from '../types';
|
|
4
|
-
import { HttpChatInputSchema, WidgetVoteSchema } from '@core/types/schemas-v2';
|
|
5
|
-
type Options = {
|
|
6
|
-
apiUrl: string;
|
|
7
|
-
botToken: string;
|
|
8
|
-
};
|
|
9
|
-
export declare function useAxiosInstance(options: Options): {
|
|
10
|
-
apis: {
|
|
11
|
-
createSession: (botToken: string) => Promise<import('axios').AxiosResponse<{
|
|
12
|
-
status: import('@core/types/schemas').SessionStatus;
|
|
13
|
-
id: string;
|
|
14
|
-
channel: import('@core/types/schemas').SessionChannel;
|
|
15
|
-
language: string | null;
|
|
16
|
-
ai_closure_type: import('@core/types/schemas').AIClosureType | null;
|
|
17
|
-
assignee_id: number | null;
|
|
18
|
-
summary: string | null;
|
|
19
|
-
last_message: string | null;
|
|
20
|
-
last_message_at: Date | null;
|
|
21
|
-
sentiment: import('@core/types/schemas').SentimentEnum | null;
|
|
22
|
-
assignee?: {
|
|
23
|
-
name: string;
|
|
24
|
-
email: string;
|
|
25
|
-
avatar_url?: string | undefined;
|
|
26
|
-
} | null | undefined;
|
|
27
|
-
}, any>>;
|
|
28
|
-
/**
|
|
29
|
-
* get session data by id
|
|
30
|
-
* @param sessionId
|
|
31
|
-
*/
|
|
32
|
-
fetchSession: (sessionId: string) => Promise<import('axios').AxiosResponse<{
|
|
33
|
-
status: import('@core/types/schemas').SessionStatus;
|
|
34
|
-
id: string;
|
|
35
|
-
channel: import('@core/types/schemas').SessionChannel;
|
|
36
|
-
language: string | null;
|
|
37
|
-
ai_closure_type: import('@core/types/schemas').AIClosureType | null;
|
|
38
|
-
assignee_id: number | null;
|
|
39
|
-
summary: string | null;
|
|
40
|
-
last_message: string | null;
|
|
41
|
-
last_message_at: Date | null;
|
|
42
|
-
sentiment: import('@core/types/schemas').SentimentEnum | null;
|
|
43
|
-
assignee?: {
|
|
44
|
-
name: string;
|
|
45
|
-
email: string;
|
|
46
|
-
avatar_url?: string | undefined;
|
|
47
|
-
} | null | undefined;
|
|
48
|
-
}, any>>;
|
|
49
|
-
fetchPreludeData: () => Promise<PreludeData | undefined>;
|
|
50
|
-
/**
|
|
51
|
-
* get the organization office working hours.
|
|
52
|
-
*/
|
|
53
|
-
getOfficeHours: () => Promise<import('axios').AxiosResponse<WorkingHours, any>>;
|
|
54
|
-
fetchHistory: (sessionId: string) => Promise<import('axios').AxiosResponse<{
|
|
55
|
-
message: string | null;
|
|
56
|
-
type: string | null;
|
|
57
|
-
publicId: string;
|
|
58
|
-
session_id: string;
|
|
59
|
-
agent_avatar: string | null;
|
|
60
|
-
agent_id: number | null;
|
|
61
|
-
agent_name: string | null;
|
|
62
|
-
created_at: string;
|
|
63
|
-
from_user: boolean | null;
|
|
64
|
-
handoff_happened_during_office_hours: boolean | null;
|
|
65
|
-
updated_at: string | null;
|
|
66
|
-
attachments?: {
|
|
67
|
-
type: string;
|
|
68
|
-
id: string;
|
|
69
|
-
name: string;
|
|
70
|
-
size: number;
|
|
71
|
-
url: string;
|
|
72
|
-
}[] | undefined;
|
|
73
|
-
}[] | undefined, any>>;
|
|
74
|
-
/**
|
|
75
|
-
* downvote a message
|
|
76
|
-
* @param id
|
|
77
|
-
* @returns
|
|
78
|
-
* @deprecated use vote instead
|
|
79
|
-
*/
|
|
80
|
-
downvote: (id: string) => Promise<import('axios').AxiosResponse<{
|
|
81
|
-
message: string;
|
|
82
|
-
}, any>>;
|
|
83
|
-
/**
|
|
84
|
-
* upvote a message
|
|
85
|
-
* @param id
|
|
86
|
-
* @returns
|
|
87
|
-
* @deprecated use vote instead
|
|
88
|
-
*/
|
|
89
|
-
upvote: (id: string) => Promise<import('axios').AxiosResponse<{
|
|
90
|
-
message: string;
|
|
91
|
-
}, any>>;
|
|
92
|
-
/**
|
|
93
|
-
* given the userData object we will create or update the contact + get the related conversations/tickets/sessions
|
|
94
|
-
*/
|
|
95
|
-
dumpContact: (userData: UserObject) => Promise<import('axios').AxiosResponse<{
|
|
96
|
-
id: string;
|
|
97
|
-
name: string | null;
|
|
98
|
-
email: string | null;
|
|
99
|
-
avatar_url: string | null;
|
|
100
|
-
created_at: string;
|
|
101
|
-
}, any>>;
|
|
102
|
-
/**
|
|
103
|
-
* get the completions for the given input
|
|
104
|
-
*/
|
|
105
|
-
getCompletions: (input: string) => Promise<import('axios').AxiosResponse<{
|
|
106
|
-
completions: string[];
|
|
107
|
-
}, any>>;
|
|
108
|
-
/**
|
|
109
|
-
* @param file
|
|
110
|
-
* @param options
|
|
111
|
-
*/
|
|
112
|
-
uploadFile: (file: {
|
|
113
|
-
id: string;
|
|
114
|
-
file: File;
|
|
115
|
-
}, _options?: AxiosRequestConfig) => Promise<import('axios').AxiosResponse<{
|
|
116
|
-
fileName: string;
|
|
117
|
-
fileUrl: string;
|
|
118
|
-
clientFileId: string;
|
|
119
|
-
}, any>>;
|
|
120
|
-
getHistoryPooling: ({ lastMessageTimestamp, sessionId, }: {
|
|
121
|
-
lastMessageTimestamp: string;
|
|
122
|
-
sessionId: string;
|
|
123
|
-
}) => Promise<import('axios').AxiosResponse<{
|
|
124
|
-
message: string | null;
|
|
125
|
-
type: string | null;
|
|
126
|
-
publicId: string;
|
|
127
|
-
session_id: string;
|
|
128
|
-
agent_avatar: string | null;
|
|
129
|
-
agent_id: number | null;
|
|
130
|
-
agent_name: string | null;
|
|
131
|
-
created_at: string;
|
|
132
|
-
from_user: boolean | null;
|
|
133
|
-
handoff_happened_during_office_hours: boolean | null;
|
|
134
|
-
updated_at: string | null;
|
|
135
|
-
attachments?: {
|
|
136
|
-
type: string;
|
|
137
|
-
id: string;
|
|
138
|
-
name: string;
|
|
139
|
-
size: number;
|
|
140
|
-
url: string;
|
|
141
|
-
}[] | undefined;
|
|
142
|
-
}[] | undefined, any>>;
|
|
143
|
-
/**
|
|
144
|
-
* send a message to the chat
|
|
145
|
-
* @param message
|
|
146
|
-
*/
|
|
147
|
-
sendMessage: (message: HttpChatInputSchema) => Promise<import('axios').AxiosResponse<{
|
|
148
|
-
success: true;
|
|
149
|
-
code?: string | undefined;
|
|
150
|
-
options?: {
|
|
151
|
-
type: "options";
|
|
152
|
-
value: string[];
|
|
153
|
-
} | undefined;
|
|
154
|
-
autopilotResponse?: {
|
|
155
|
-
type: "text";
|
|
156
|
-
value: {
|
|
157
|
-
content: string;
|
|
158
|
-
error: boolean;
|
|
159
|
-
};
|
|
160
|
-
id?: string | undefined;
|
|
161
|
-
} | undefined;
|
|
162
|
-
uiResponse?: {
|
|
163
|
-
type: "ui";
|
|
164
|
-
value: {
|
|
165
|
-
type: "ui_component";
|
|
166
|
-
name: string;
|
|
167
|
-
content?: string | undefined;
|
|
168
|
-
request_response?: unknown;
|
|
169
|
-
};
|
|
170
|
-
} | undefined;
|
|
171
|
-
sessionIsHandedOff?: boolean | undefined;
|
|
172
|
-
} | {
|
|
173
|
-
success: false;
|
|
174
|
-
error: {
|
|
175
|
-
code?: string | undefined;
|
|
176
|
-
message?: string | undefined;
|
|
177
|
-
};
|
|
178
|
-
}, any>>;
|
|
179
|
-
/**
|
|
180
|
-
* vote on a message
|
|
181
|
-
* @param data
|
|
182
|
-
*/
|
|
183
|
-
vote: (data: WidgetVoteSchema) => Promise<import('axios').AxiosResponse<{
|
|
184
|
-
success: boolean;
|
|
185
|
-
messagePublicId: string | null;
|
|
186
|
-
}, any>>;
|
|
187
|
-
};
|
|
188
|
-
options: Options;
|
|
189
|
-
};
|
|
190
|
-
export {};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
type StorageType = "memory" | "local" | "session";
|
|
2
|
-
type DefaultValue<T> = T | (() => T);
|
|
3
|
-
export declare function useSyncedState<TData>(key: string, defaultValue?: DefaultValue<TData>, storage?: StorageType): [TData | null, (newState: TData | null) => void, () => void];
|
|
4
|
-
export {};
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
|
-
declare const useChat: () => {
|
|
3
|
-
version: string;
|
|
4
|
-
state: {
|
|
5
|
-
lastUpdated: number | null;
|
|
6
|
-
messages: import('../../core').MessageType[];
|
|
7
|
-
keyboard: {
|
|
8
|
-
options: string[];
|
|
9
|
-
} | null;
|
|
10
|
-
};
|
|
11
|
-
session: {
|
|
12
|
-
isSessionClosed: boolean;
|
|
13
|
-
isAssignedToAi: boolean;
|
|
14
|
-
isAssignedToHuman: boolean;
|
|
15
|
-
isPendingHuman: boolean;
|
|
16
|
-
status: import('../../core/types/schemas').SessionStatus;
|
|
17
|
-
id: string;
|
|
18
|
-
channel: import('../../core/types/schemas').SessionChannel;
|
|
19
|
-
language: string | null;
|
|
20
|
-
ai_closure_type: import('../../core/types/schemas').AIClosureType | null;
|
|
21
|
-
assignee_id: number | null;
|
|
22
|
-
summary: string | null;
|
|
23
|
-
last_message: string | null;
|
|
24
|
-
last_message_at: Date | null;
|
|
25
|
-
sentiment: import('../../core/types/schemas').SentimentEnum | null;
|
|
26
|
-
assignee?: {
|
|
27
|
-
name: string;
|
|
28
|
-
email: string;
|
|
29
|
-
avatar_url?: string | undefined;
|
|
30
|
-
} | null | undefined;
|
|
31
|
-
} | null;
|
|
32
|
-
noMessages: boolean;
|
|
33
|
-
initState: {
|
|
34
|
-
loading: boolean;
|
|
35
|
-
error?: undefined;
|
|
36
|
-
value?: undefined;
|
|
37
|
-
} | {
|
|
38
|
-
loading: false;
|
|
39
|
-
error: Error;
|
|
40
|
-
value?: undefined;
|
|
41
|
-
} | {
|
|
42
|
-
loading: true;
|
|
43
|
-
error?: Error | undefined;
|
|
44
|
-
value?: void | undefined;
|
|
45
|
-
} | {
|
|
46
|
-
loading: false;
|
|
47
|
-
error?: undefined;
|
|
48
|
-
value: void;
|
|
49
|
-
};
|
|
50
|
-
clearSessionState: {
|
|
51
|
-
loading: boolean;
|
|
52
|
-
error?: undefined;
|
|
53
|
-
value?: undefined;
|
|
54
|
-
} | {
|
|
55
|
-
loading: false;
|
|
56
|
-
error: Error;
|
|
57
|
-
value?: undefined;
|
|
58
|
-
} | {
|
|
59
|
-
loading: true;
|
|
60
|
-
error?: Error | undefined;
|
|
61
|
-
value?: void | undefined;
|
|
62
|
-
} | {
|
|
63
|
-
loading: false;
|
|
64
|
-
error?: undefined;
|
|
65
|
-
value: void;
|
|
66
|
-
};
|
|
67
|
-
recreateSessionState: {
|
|
68
|
-
loading: boolean;
|
|
69
|
-
error?: undefined;
|
|
70
|
-
value?: undefined;
|
|
71
|
-
} | {
|
|
72
|
-
loading: false;
|
|
73
|
-
error: Error;
|
|
74
|
-
value?: undefined;
|
|
75
|
-
} | {
|
|
76
|
-
loading: true;
|
|
77
|
-
error?: Error | undefined;
|
|
78
|
-
value?: {
|
|
79
|
-
status: import('../../core/types/schemas').SessionStatus;
|
|
80
|
-
id: string;
|
|
81
|
-
channel: import('../../core/types/schemas').SessionChannel;
|
|
82
|
-
language: string | null;
|
|
83
|
-
ai_closure_type: import('../../core/types/schemas').AIClosureType | null;
|
|
84
|
-
assignee_id: number | null;
|
|
85
|
-
summary: string | null;
|
|
86
|
-
last_message: string | null;
|
|
87
|
-
last_message_at: Date | null;
|
|
88
|
-
sentiment: import('../../core/types/schemas').SentimentEnum | null;
|
|
89
|
-
assignee?: {
|
|
90
|
-
name: string;
|
|
91
|
-
email: string;
|
|
92
|
-
avatar_url?: string | undefined;
|
|
93
|
-
} | null | undefined;
|
|
94
|
-
} | undefined;
|
|
95
|
-
} | {
|
|
96
|
-
loading: false;
|
|
97
|
-
error?: undefined;
|
|
98
|
-
value: {
|
|
99
|
-
status: import('../../core/types/schemas').SessionStatus;
|
|
100
|
-
id: string;
|
|
101
|
-
channel: import('../../core/types/schemas').SessionChannel;
|
|
102
|
-
language: string | null;
|
|
103
|
-
ai_closure_type: import('../../core/types/schemas').AIClosureType | null;
|
|
104
|
-
assignee_id: number | null;
|
|
105
|
-
summary: string | null;
|
|
106
|
-
last_message: string | null;
|
|
107
|
-
last_message_at: Date | null;
|
|
108
|
-
sentiment: import('../../core/types/schemas').SentimentEnum | null;
|
|
109
|
-
assignee?: {
|
|
110
|
-
name: string;
|
|
111
|
-
email: string;
|
|
112
|
-
avatar_url?: string | undefined;
|
|
113
|
-
} | null | undefined;
|
|
114
|
-
};
|
|
115
|
-
};
|
|
116
|
-
hookState: import('../hooks/useAbstractChat').HookState;
|
|
117
|
-
recreateSession: () => Promise<{
|
|
118
|
-
status: import('../../core/types/schemas').SessionStatus;
|
|
119
|
-
id: string;
|
|
120
|
-
channel: import('../../core/types/schemas').SessionChannel;
|
|
121
|
-
language: string | null;
|
|
122
|
-
ai_closure_type: import('../../core/types/schemas').AIClosureType | null;
|
|
123
|
-
assignee_id: number | null;
|
|
124
|
-
summary: string | null;
|
|
125
|
-
last_message: string | null;
|
|
126
|
-
last_message_at: Date | null;
|
|
127
|
-
sentiment: import('../../core/types/schemas').SentimentEnum | null;
|
|
128
|
-
assignee?: {
|
|
129
|
-
name: string;
|
|
130
|
-
email: string;
|
|
131
|
-
avatar_url?: string | undefined;
|
|
132
|
-
} | null | undefined;
|
|
133
|
-
}>;
|
|
134
|
-
clearSession: () => Promise<void>;
|
|
135
|
-
sendMessage: ({ content, user, attachments, ...data }: import('../hooks/useAbstractChat').SendMessageInput) => Promise<{
|
|
136
|
-
id: string;
|
|
137
|
-
}>;
|
|
138
|
-
handleKeyboard: (option: string) => void;
|
|
139
|
-
};
|
|
140
|
-
declare function ChatProvider({ children, }: {
|
|
141
|
-
children: React.ReactNode;
|
|
142
|
-
}): React.JSX.Element;
|
|
143
|
-
export { useChat, ChatProvider };
|