@opencx/widget 3.0.64 → 3.0.66
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 +12 -12
- package/dist/designs.cjs +30 -24
- package/dist/designs.cjs.map +1 -1
- package/dist/designs.js +3282 -3138
- package/dist/designs.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +2 -2
- package/dist/react.js.map +1 -1
- package/dist/src/designs/react/components/PoweredByOpen.d.ts +1 -1
- package/dist/src/designs/react/components/lib/MotionDiv.d.ts +1 -1
- package/dist/src/designs/react/components/lib/avatar.d.ts +2 -2
- package/dist/src/designs/react/components/lib/button.d.ts +2 -2
- package/dist/src/designs/react/components/lib/dialog.d.ts +2 -2
- package/dist/src/designs/react/components/lib/dropdown-menu.d.ts +2 -2
- package/dist/src/designs/react/components/lib/input.d.ts +2 -3
- package/dist/src/designs/react/components/lib/popover.d.ts +2 -2
- package/dist/src/designs/react/components/lib/switch.d.ts +2 -2
- package/dist/src/designs/react/components/lib/tooltip.d.ts +4 -4
- package/dist/src/designs/react/components/lib/wobble.d.ts +4 -4
- package/dist/src/designs/react/components/svg/ChatBubbleSvg.d.ts +2 -1
- package/dist/src/designs/react/components/svg/OpenLogoPatternSvg.d.ts +2 -1
- package/dist/src/designs/react/hooks/useWidgetContentHeight.d.ts +1 -7
- package/dist/src/designs/react/hooks/useWidgetSize.d.ts +4 -0
- package/dist/src/designs/translation/translation.types.d.ts +1 -1
- package/dist/src/headless/core/__tests__/test-utils.d.ts +3 -3
- package/dist/src/headless/core/api/api-caller.d.ts +4 -4
- package/dist/src/headless/core/api/client.d.ts +4 -4
- package/dist/src/headless/core/api/schema.d.ts +60 -60
- package/dist/src/headless/core/context/router.ctx.d.ts +4 -4
- package/dist/src/headless/core/index.d.ts +1 -1
- package/dist/src/headless/core/types/messages.d.ts +8 -8
- package/dist/src/headless/core/types/schemas.d.ts +9 -9
- package/dist/src/headless/core/types/widget-config.d.ts +32 -6
- package/dist/src/headless/react/WidgetProvider.d.ts +1 -0
- package/dist/src/headless/react/hooks/usePreludeData.d.ts +1 -1
- package/dist/src/headless/react/hooks/useTheme.d.ts +43 -0
- package/dist/src/headless/react/hooks/useUploadFiles.d.ts +1 -1
- package/dist/{useUploadFiles-C-_5Cqif.js → useUploadFiles-CFJPwXZu.js} +5 -4
- package/dist/useUploadFiles-CFJPwXZu.js.map +1 -0
- package/dist/{useUploadFiles-D0XBYDzl.cjs → useUploadFiles-CkUYYysV.cjs} +2 -2
- package/dist/useUploadFiles-CkUYYysV.cjs.map +1 -0
- package/dist/{widget.ctx-_0XFPUpq.js → widget.ctx-COUAUyWX.js} +2 -4
- package/dist/widget.ctx-COUAUyWX.js.map +1 -0
- package/dist/widget.ctx-DUaeXkNb.cjs.map +1 -1
- package/dist-embed/script.js +92 -86
- package/dist-embed/script.js.map +1 -1
- package/package.json +18 -10
- package/dist/src/designs/react/constants.d.ts +0 -14
- package/dist/useUploadFiles-C-_5Cqif.js.map +0 -1
- package/dist/useUploadFiles-D0XBYDzl.cjs.map +0 -1
- package/dist/widget.ctx-_0XFPUpq.js.map +0 -1
package/dist/index.js
CHANGED
package/dist/react.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useUploadFiles-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useUploadFiles-CkUYYysV.cjs");function a(t,s,u){const{widgetCtx:{api:i}}=e.useWidget();return e._default(async o=>i.vote({action:o==="up"?"upvote":"downvote",messagePublicId:t,sessionId:s}).then(u),[i,t,s,u])}exports.WidgetProvider=e.WidgetProvider;exports.useConfig=e.useConfig;exports.useContact=e.useContact;exports.useIsAwaitingBotReply=e.useIsAwaitingBotReply;exports.useMessages=e.useMessages;exports.usePreludeData=e.usePreludeData;exports.usePrimitiveState=e.usePrimitiveState;exports.useSessions=e.useSessions;exports.useUploadFiles=e.useUploadFiles;exports.useWidget=e.useWidget;exports.useWidgetRouter=e.useWidgetRouter;exports.useVote=a;
|
|
2
2
|
//# sourceMappingURL=react.cjs.map
|
package/dist/react.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.cjs","sources":["../src/headless/react/hooks/useVote.ts"],"sourcesContent":["import useAsyncFn from
|
|
1
|
+
{"version":3,"file":"react.cjs","sources":["../src/headless/react/hooks/useVote.ts"],"sourcesContent":["import useAsyncFn from 'react-use/lib/useAsyncFn';\nimport { useWidget } from '../WidgetProvider';\n\n/**\n * @param id\n * @param onSuccess\n * @returns\n */\nexport function useVote(id: string, sessionId: string, onSuccess?: () => void) {\n const {\n widgetCtx: { api },\n } = useWidget();\n return useAsyncFn(\n async (action: 'up' | 'down') => {\n return api\n .vote({\n action: action === 'up' ? 'upvote' : 'downvote',\n messagePublicId: id,\n sessionId,\n })\n .then(onSuccess);\n },\n [api, id, sessionId, onSuccess],\n );\n}\n\n/**\n * @param id\n * @param onSuccess\n * @deprecated use useVote instead\n */\nexport function useUpvote(\n id: string,\n sessionId: string,\n onSuccess?: () => void,\n) {\n const {\n widgetCtx: { api },\n } = useWidget();\n return useAsyncFn(\n async () =>\n api\n .vote({ action: 'upvote', messagePublicId: id, sessionId })\n .then(onSuccess),\n [api, id, sessionId, onSuccess],\n );\n}\n\n/**\n * @param id\n * @param onSuccess\n * @deprecated use useVote instead\n */\nexport function useDownvote(\n id: string,\n sessionId: string,\n onSuccess?: () => void,\n) {\n const {\n widgetCtx: { api },\n } = useWidget();\n return useAsyncFn(\n async () =>\n api\n .vote({ action: 'downvote', messagePublicId: id, sessionId })\n .then(onSuccess),\n [api, id, sessionId, onSuccess],\n );\n}\n"],"names":["useVote","id","sessionId","onSuccess","api","useWidget","useAsyncFn","action"],"mappings":"iIAQgB,SAAAA,EAAQC,EAAYC,EAAmBC,EAAwB,CACvE,KAAA,CACJ,UAAW,CAAE,IAAAC,CAAI,GACfC,EAAU,UAAA,EACP,OAAAC,EAAA,SACL,MAAOC,GACEH,EACJ,KAAK,CACJ,OAAQG,IAAW,KAAO,SAAW,WACrC,gBAAiBN,EACjB,UAAAC,CAAA,CACD,EACA,KAAKC,CAAS,EAEnB,CAACC,EAAKH,EAAIC,EAAWC,CAAS,CAAA,CAElC"}
|
package/dist/react.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { u as o, _ as i } from "./useUploadFiles-
|
|
2
|
-
import { W as p, a as f, b as l, c, d as m, e as v, f as P, g as W, i as w, h as x } from "./useUploadFiles-
|
|
1
|
+
import { u as o, _ as i } from "./useUploadFiles-CFJPwXZu.js";
|
|
2
|
+
import { W as p, a as f, b as l, c, d as m, e as v, f as P, g as W, i as w, h as x } from "./useUploadFiles-CFJPwXZu.js";
|
|
3
3
|
function n(e, s, t) {
|
|
4
4
|
const {
|
|
5
5
|
widgetCtx: { api: a }
|
package/dist/react.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.js","sources":["../src/headless/react/hooks/useVote.ts"],"sourcesContent":["import useAsyncFn from
|
|
1
|
+
{"version":3,"file":"react.js","sources":["../src/headless/react/hooks/useVote.ts"],"sourcesContent":["import useAsyncFn from 'react-use/lib/useAsyncFn';\nimport { useWidget } from '../WidgetProvider';\n\n/**\n * @param id\n * @param onSuccess\n * @returns\n */\nexport function useVote(id: string, sessionId: string, onSuccess?: () => void) {\n const {\n widgetCtx: { api },\n } = useWidget();\n return useAsyncFn(\n async (action: 'up' | 'down') => {\n return api\n .vote({\n action: action === 'up' ? 'upvote' : 'downvote',\n messagePublicId: id,\n sessionId,\n })\n .then(onSuccess);\n },\n [api, id, sessionId, onSuccess],\n );\n}\n\n/**\n * @param id\n * @param onSuccess\n * @deprecated use useVote instead\n */\nexport function useUpvote(\n id: string,\n sessionId: string,\n onSuccess?: () => void,\n) {\n const {\n widgetCtx: { api },\n } = useWidget();\n return useAsyncFn(\n async () =>\n api\n .vote({ action: 'upvote', messagePublicId: id, sessionId })\n .then(onSuccess),\n [api, id, sessionId, onSuccess],\n );\n}\n\n/**\n * @param id\n * @param onSuccess\n * @deprecated use useVote instead\n */\nexport function useDownvote(\n id: string,\n sessionId: string,\n onSuccess?: () => void,\n) {\n const {\n widgetCtx: { api },\n } = useWidget();\n return useAsyncFn(\n async () =>\n api\n .vote({ action: 'downvote', messagePublicId: id, sessionId })\n .then(onSuccess),\n [api, id, sessionId, onSuccess],\n );\n}\n"],"names":["useVote","id","sessionId","onSuccess","api","useWidget","useAsyncFn","action"],"mappings":";;AAQgB,SAAAA,EAAQC,GAAYC,GAAmBC,GAAwB;AACvE,QAAA;AAAA,IACJ,WAAW,EAAE,KAAAC,EAAI;AAAA,MACfC,EAAU;AACP,SAAAC;AAAAA,IACL,OAAOC,MACEH,EACJ,KAAK;AAAA,MACJ,QAAQG,MAAW,OAAO,WAAW;AAAA,MACrC,iBAAiBN;AAAA,MACjB,WAAAC;AAAA,IAAA,CACD,EACA,KAAKC,CAAS;AAAA,IAEnB,CAACC,GAAKH,GAAIC,GAAWC,CAAS;AAAA,EAAA;AAElC;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { default as React, ComponentProps } from 'react';
|
|
2
2
|
import { motion, Target } from 'framer-motion';
|
|
3
3
|
type MotionProps = ComponentProps<typeof motion.div>;
|
|
4
|
-
type AnimationDirection =
|
|
4
|
+
type AnimationDirection = 'right' | 'left' | 'up' | 'down';
|
|
5
5
|
type MotionDivProps = MotionProps & {
|
|
6
6
|
fadeIn?: AnimationDirection;
|
|
7
7
|
distance?: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import * as AvatarPrimitive from
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
3
3
|
declare const Avatar: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
4
4
|
declare const AvatarImage: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarImageProps & React.RefAttributes<HTMLImageElement>, "ref"> & React.RefAttributes<HTMLImageElement>>;
|
|
5
5
|
declare const AvatarFallback: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarFallbackProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { VariantProps } from 'class-variance-authority';
|
|
2
|
-
import * as React from
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
declare const buttonVariants: (props?: ({
|
|
4
|
-
variant?: "
|
|
4
|
+
variant?: "default" | "link" | "outline" | "destructive" | "secondary" | "ghost" | null | undefined;
|
|
5
5
|
size?: "default" | "icon" | "sm" | "lg" | "fit" | "free" | null | undefined;
|
|
6
6
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
7
7
|
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import * as DialogPrimitive from
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
3
3
|
declare const Dialog: React.FC<DialogPrimitive.DialogProps>;
|
|
4
4
|
declare const DialogTrigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
5
5
|
declare const DialogClose: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as DropdownMenuPrimitive from
|
|
2
|
-
import * as React from
|
|
1
|
+
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
declare const DropdownMenu: React.FC<DropdownMenuPrimitive.DropdownMenuProps>;
|
|
4
4
|
declare const DropdownMenuTrigger: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
5
5
|
declare const DropdownMenuGroup: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
export
|
|
3
|
-
}
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export type InputProps = React.InputHTMLAttributes<HTMLInputElement>;
|
|
4
3
|
declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
5
4
|
export { Input };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as PopoverPrimitive from
|
|
2
|
-
import * as React from
|
|
1
|
+
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
declare const Popover: React.FC<PopoverPrimitive.PopoverProps>;
|
|
4
4
|
declare const PopoverTrigger: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
5
5
|
declare const PopoverContent: React.ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import * as SwitchPrimitives from
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as SwitchPrimitives from '@radix-ui/react-switch';
|
|
3
3
|
declare const Switch: React.ForwardRefExoticComponent<Omit<SwitchPrimitives.SwitchProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
4
4
|
export { Switch };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as TooltipPrimitive from
|
|
2
|
-
import * as React from
|
|
1
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
declare const TooltipProvider: React.FC<TooltipPrimitive.TooltipProviderProps>;
|
|
4
4
|
declare function Tooltippy({ children, content, side, align, }: {
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
content: React.ReactNode;
|
|
7
|
-
side?: TooltipPrimitive.TooltipContentProps[
|
|
8
|
-
align?: TooltipPrimitive.TooltipContentProps[
|
|
7
|
+
side?: TooltipPrimitive.TooltipContentProps['side'];
|
|
8
|
+
align?: TooltipPrimitive.TooltipContentProps['align'];
|
|
9
9
|
}): string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined;
|
|
10
10
|
export { TooltipProvider, Tooltippy };
|
|
@@ -9,10 +9,10 @@ export declare const WOBBLE_MAX_MOVEMENT_PIXELS: {
|
|
|
9
9
|
y: number;
|
|
10
10
|
};
|
|
11
11
|
declare const scaleVariants: {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
'1': string;
|
|
13
|
+
'1.01': string;
|
|
14
|
+
'1.02': string;
|
|
15
|
+
'1.1': string;
|
|
16
16
|
};
|
|
17
17
|
export interface WobbleProps {
|
|
18
18
|
children: ReactElement;
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
export declare function useWidgetContentHeight(
|
|
2
|
-
/**
|
|
3
|
-
* unrendered elements have an offset height of 0, this is causes a weird animation when opening the widget.
|
|
4
|
-
* So, a fallback value equal to the fixed height or min height of the screen's root div solves the issue.
|
|
5
|
-
*/
|
|
6
|
-
fallbackHeight: number;
|
|
7
|
-
}): {
|
|
1
|
+
export declare function useWidgetContentHeight(): {
|
|
8
2
|
observedElementRef: import('react').RefObject<HTMLDivElement>;
|
|
9
3
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type TranslationKeysU =
|
|
1
|
+
export type TranslationKeysU = 'ok' | 'yes' | 'no' | 'agree' | 'cancel' | 'yes-exit' | 'yes-reset' | 'no-cancel' | 'are-you-sure' | 'recording' | 'thank-you' | 'sorry-try-again' | 'error-occurred' | 'please-try-again' | 'write-a-message' | 'send-message' | 'connected' | 'connecting' | 'reconnecting' | 'reconnected' | 'disconnecting' | 'disconnected' | 'error' | 'persist-session' | 'settings' | 'close' | 'help' | 'chat' | 'send' | 'copy' | 'copied' | 'sound-effects' | 'language' | 'select' | 'agent' | 'user' | 'bot' | 'close-widget' | 'got-any-questions' | 'typical-response-time' | 'session-closed-lead' | 'create-new-ticket' | 'exit' | 'reset-conversation' | 'new-conversation' | 'welcome-title' | 'welcome-description' | 'your-name' | 'your-email' | 'start-chat' | 'starting-chat' | 'hello-greeting' | 'i-need-more-help' | 'this-was-helpful' | 'optional' | 'no-conversations-yet';
|
|
2
2
|
export type TranslationInterface = {
|
|
3
3
|
[K in TranslationKeysU]: string;
|
|
4
4
|
};
|
|
@@ -75,7 +75,7 @@ export declare const TestUtils: {
|
|
|
75
75
|
}, {
|
|
76
76
|
params: {
|
|
77
77
|
header: {
|
|
78
|
-
|
|
78
|
+
'x-bot-token': string;
|
|
79
79
|
};
|
|
80
80
|
};
|
|
81
81
|
body: {
|
|
@@ -253,7 +253,7 @@ export declare const TestUtils: {
|
|
|
253
253
|
}, {
|
|
254
254
|
params: {
|
|
255
255
|
header: {
|
|
256
|
-
|
|
256
|
+
'X-Bot-Token': string;
|
|
257
257
|
};
|
|
258
258
|
};
|
|
259
259
|
}, `${string}/${string}`>> | undefined): void;
|
|
@@ -288,7 +288,7 @@ export declare const TestUtils: {
|
|
|
288
288
|
}, {
|
|
289
289
|
params: {
|
|
290
290
|
header: {
|
|
291
|
-
|
|
291
|
+
'X-Bot-Token': string;
|
|
292
292
|
};
|
|
293
293
|
};
|
|
294
294
|
}, `${string}/${string}`>> | undefined): void;
|
|
@@ -5,7 +5,7 @@ export declare class ApiCaller {
|
|
|
5
5
|
private client;
|
|
6
6
|
private config;
|
|
7
7
|
private userToken;
|
|
8
|
-
constructor({ config
|
|
8
|
+
constructor({ config }: {
|
|
9
9
|
config: WidgetConfig;
|
|
10
10
|
});
|
|
11
11
|
private constructClientOptions;
|
|
@@ -42,7 +42,7 @@ export declare class ApiCaller {
|
|
|
42
42
|
}, {
|
|
43
43
|
params: {
|
|
44
44
|
header: {
|
|
45
|
-
|
|
45
|
+
'X-Bot-Token': string;
|
|
46
46
|
};
|
|
47
47
|
};
|
|
48
48
|
}, `${string}/${string}`>>;
|
|
@@ -77,7 +77,7 @@ export declare class ApiCaller {
|
|
|
77
77
|
}, {
|
|
78
78
|
params: {
|
|
79
79
|
header: {
|
|
80
|
-
|
|
80
|
+
'X-Bot-Token': string;
|
|
81
81
|
};
|
|
82
82
|
};
|
|
83
83
|
}, `${string}/${string}`>>;
|
|
@@ -172,7 +172,7 @@ export declare class ApiCaller {
|
|
|
172
172
|
}, {
|
|
173
173
|
params: {
|
|
174
174
|
header: {
|
|
175
|
-
|
|
175
|
+
'x-bot-token': string;
|
|
176
176
|
};
|
|
177
177
|
};
|
|
178
178
|
body: {
|
|
@@ -2,11 +2,11 @@ import { Middleware } from 'openapi-fetch';
|
|
|
2
2
|
import { paths, components } from './schema';
|
|
3
3
|
type Options = {
|
|
4
4
|
baseUrl: string;
|
|
5
|
-
onRequest?: Middleware[
|
|
6
|
-
onResponse?: Middleware[
|
|
7
|
-
onError?: Middleware[
|
|
5
|
+
onRequest?: Middleware['onRequest'];
|
|
6
|
+
onResponse?: Middleware['onResponse'];
|
|
7
|
+
onError?: Middleware['onError'];
|
|
8
8
|
};
|
|
9
9
|
export declare const basicClient: (options: Options) => import('openapi-fetch').Client<paths, `${string}/${string}`>;
|
|
10
10
|
export type Endpoint = keyof paths;
|
|
11
|
-
export type Dto = components[
|
|
11
|
+
export type Dto = components['schemas'];
|
|
12
12
|
export {};
|