@opencx/widget 3.0.69 → 3.0.72
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/designs.cjs +43 -32
- package/dist/designs.cjs.map +1 -1
- package/dist/designs.js +7958 -7856
- package/dist/designs.js.map +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +19 -17
- package/dist/src/designs/react/WidgetPopoverAnchor.d.ts +2 -0
- package/dist/src/designs/react/WidgetPopoverContent.d.ts +2 -0
- package/dist/src/designs/react/WidgetPopoverTrigger.d.ts +1 -3
- package/dist/src/designs/react/components/lib/button.d.ts +2 -2
- package/dist/src/designs/react/hooks/useIsSmallScreen.d.ts +3 -0
- package/dist/src/{headless → designs}/react/hooks/useTheme.d.ts +11 -5
- package/dist/src/designs/react/index.d.ts +1 -1
- package/dist/src/headless/core/types/widget-config.d.ts +17 -6
- package/dist/src/headless/react/WidgetProvider.d.ts +1 -0
- package/dist/src/headless/react/hooks/useWidgetTrigger.d.ts +10 -0
- package/dist/src/headless/react/index.d.ts +1 -0
- package/dist/{useUploadFiles-CoBUxfoW.js → useWidgetTrigger-DdX73dQq.js} +300 -292
- package/dist/useWidgetTrigger-DdX73dQq.js.map +1 -0
- package/dist/useWidgetTrigger-LQGdFooa.cjs +18 -0
- package/dist/useWidgetTrigger-LQGdFooa.cjs.map +1 -0
- package/dist-embed/script.js +189 -178
- package/dist-embed/script.js.map +1 -1
- package/package.json +2 -2
- package/dist/useUploadFiles-CoBUxfoW.js.map +0 -1
- package/dist/useUploadFiles-DH1k_nBL.cjs +0 -18
- package/dist/useUploadFiles-DH1k_nBL.cjs.map +0 -1
package/dist/react.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useWidgetTrigger-LQGdFooa.cjs");function g(t,i,s){const{widgetCtx:{api:u}}=e.useWidget();return e._default(async r=>u.vote({action:r==="up"?"upvote":"downvote",messagePublicId:t,sessionId:i}).then(s),[u,t,i,s])}exports.WidgetProvider=e.WidgetProvider;exports.WidgetTriggerProvider=e.WidgetTriggerProvider;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.useWidgetTrigger=e.useWidgetTrigger;exports.useVote=g;
|
|
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 '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":"
|
|
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":"mIAQgB,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,12 +1,12 @@
|
|
|
1
|
-
import { u
|
|
2
|
-
import { W as p,
|
|
3
|
-
function
|
|
1
|
+
import { u, _ as r } from "./useWidgetTrigger-DdX73dQq.js";
|
|
2
|
+
import { W as p, k as f, a as l, b as v, c as W, d as c, e as m, f as P, g as w, i as x, h as C, j as b } from "./useWidgetTrigger-DdX73dQq.js";
|
|
3
|
+
function g(e, s, t) {
|
|
4
4
|
const {
|
|
5
5
|
widgetCtx: { api: a }
|
|
6
|
-
} =
|
|
7
|
-
return
|
|
8
|
-
async (
|
|
9
|
-
action:
|
|
6
|
+
} = u();
|
|
7
|
+
return r(
|
|
8
|
+
async (i) => a.vote({
|
|
9
|
+
action: i === "up" ? "upvote" : "downvote",
|
|
10
10
|
messagePublicId: e,
|
|
11
11
|
sessionId: s
|
|
12
12
|
}).then(t),
|
|
@@ -15,16 +15,18 @@ function n(e, s, t) {
|
|
|
15
15
|
}
|
|
16
16
|
export {
|
|
17
17
|
p as WidgetProvider,
|
|
18
|
-
f as
|
|
19
|
-
l as
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
f as WidgetTriggerProvider,
|
|
19
|
+
l as useConfig,
|
|
20
|
+
v as useContact,
|
|
21
|
+
W as useIsAwaitingBotReply,
|
|
22
|
+
c as useMessages,
|
|
23
|
+
m as usePreludeData,
|
|
23
24
|
P as usePrimitiveState,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
w as useSessions,
|
|
26
|
+
x as useUploadFiles,
|
|
27
|
+
g as useVote,
|
|
28
|
+
u as useWidget,
|
|
29
|
+
C as useWidgetRouter,
|
|
30
|
+
b as useWidgetTrigger
|
|
29
31
|
};
|
|
30
32
|
//# sourceMappingURL=react.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { VariantProps } from 'class-variance-authority';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
declare const buttonVariants: (props?: ({
|
|
4
|
-
variant?: "default" | "link" | "
|
|
5
|
-
size?: "default" | "
|
|
4
|
+
variant?: "default" | "link" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
5
|
+
size?: "default" | "sm" | "lg" | "icon" | "fit" | "free" | "selfless" | null | undefined;
|
|
6
6
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
7
7
|
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
8
8
|
asChild?: boolean;
|
|
@@ -6,17 +6,23 @@ export declare function useTheme(): {
|
|
|
6
6
|
theme: {
|
|
7
7
|
primaryColor: string;
|
|
8
8
|
widgetTrigger: {
|
|
9
|
+
zIndex: number;
|
|
9
10
|
offset: {
|
|
10
|
-
bottom:
|
|
11
|
-
right:
|
|
11
|
+
bottom: number;
|
|
12
|
+
right: number;
|
|
12
13
|
};
|
|
13
14
|
size: {
|
|
14
|
-
button:
|
|
15
|
-
icon:
|
|
15
|
+
button: number;
|
|
16
|
+
icon: number;
|
|
16
17
|
};
|
|
17
18
|
};
|
|
18
19
|
widgetContentContainer: {
|
|
19
|
-
|
|
20
|
+
borderRadius: string;
|
|
21
|
+
zIndex: number;
|
|
22
|
+
offset: {
|
|
23
|
+
side: number;
|
|
24
|
+
align: number;
|
|
25
|
+
};
|
|
20
26
|
};
|
|
21
27
|
screens: {
|
|
22
28
|
welcome: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { WidgetComponentType } from '../../headless/react';
|
|
3
2
|
import { WidgetConfig } from '../../headless/core';
|
|
3
|
+
import { WidgetComponentType } from '../../headless/react';
|
|
4
4
|
declare function WidgetWrapper({ options, components, }: {
|
|
5
5
|
options: WidgetConfig;
|
|
6
6
|
components?: WidgetComponentType[];
|
|
@@ -38,18 +38,29 @@ export interface WidgetConfig {
|
|
|
38
38
|
theme?: {
|
|
39
39
|
primaryColor?: string;
|
|
40
40
|
widgetTrigger?: {
|
|
41
|
+
zIndex?: number;
|
|
41
42
|
offset?: {
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
/** number in pixels */
|
|
44
|
+
right?: number;
|
|
45
|
+
/** number in pixels */
|
|
46
|
+
bottom?: number;
|
|
44
47
|
};
|
|
45
48
|
size?: {
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
/** number in pixels */
|
|
50
|
+
button?: number;
|
|
51
|
+
/** number in pixels */
|
|
52
|
+
icon?: number;
|
|
48
53
|
};
|
|
49
54
|
};
|
|
50
55
|
widgetContentContainer?: {
|
|
51
|
-
|
|
52
|
-
|
|
56
|
+
borderRadius?: string;
|
|
57
|
+
zIndex?: number;
|
|
58
|
+
offset?: {
|
|
59
|
+
/** number in pixels */
|
|
60
|
+
side?: number;
|
|
61
|
+
/** number in pixels */
|
|
62
|
+
align?: number;
|
|
63
|
+
};
|
|
53
64
|
};
|
|
54
65
|
screens?: {
|
|
55
66
|
welcome?: {
|
|
@@ -8,6 +8,7 @@ interface WidgetProviderValue {
|
|
|
8
8
|
componentStore: ComponentRegistry;
|
|
9
9
|
theme: WidgetConfig['theme'];
|
|
10
10
|
version: string;
|
|
11
|
+
contentIframeRef?: React.MutableRefObject<HTMLIFrameElement | null>;
|
|
11
12
|
}
|
|
12
13
|
declare const useWidget: () => WidgetProviderValue;
|
|
13
14
|
declare function WidgetProvider({ options: config, children, components, storage, }: {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as React, Dispatch, ReactNode, SetStateAction } from 'react';
|
|
2
|
+
type WidgetTriggerCtx = {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
setIsOpen: Dispatch<SetStateAction<boolean>>;
|
|
5
|
+
};
|
|
6
|
+
export declare const useWidgetTrigger: () => WidgetTriggerCtx, SafeProvider: React.Provider<WidgetTriggerCtx>;
|
|
7
|
+
export declare function WidgetTriggerProvider({ children }: {
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
}): React.JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -10,3 +10,4 @@ export { useSessions } from './hooks/useSessions';
|
|
|
10
10
|
export { useWidgetRouter } from './hooks/useWidgetRouter';
|
|
11
11
|
export { useVote } from './hooks/useVote';
|
|
12
12
|
export { type FileWithProgress, useUploadFiles } from './hooks/useUploadFiles';
|
|
13
|
+
export { useWidgetTrigger, WidgetTriggerProvider, } from './hooks/useWidgetTrigger';
|