@release0/react 1.0.3 → 1.1.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.
- package/README.md +2 -2
- package/dist/index.d.ts +19 -19
- package/dist/index.js +1 -1
- package/dist/web-53BLTPE3.js +150 -0
- package/dist/web-YVWAMJPG.js +150 -0
- package/package.json +5 -6
package/README.md
CHANGED
|
@@ -120,7 +120,7 @@ toggle();
|
|
|
120
120
|
|
|
121
121
|
## Additional configuration
|
|
122
122
|
|
|
123
|
-
You can prefill the agent variable values in your embed code by adding the `
|
|
123
|
+
You can prefill the agent variable values in your embed code by adding the `initialContext` option. Here is an example:
|
|
124
124
|
|
|
125
125
|
```tsx
|
|
126
126
|
import { Standard } from "@release0/react";
|
|
@@ -130,7 +130,7 @@ const App = () => {
|
|
|
130
130
|
<Standard
|
|
131
131
|
agent="ag_herexisxyourxagentxid"
|
|
132
132
|
style={{ width: "100%", height: "600px" }}
|
|
133
|
-
|
|
133
|
+
initialContext={{
|
|
134
134
|
"Account URL": "https://my-site.com/account",
|
|
135
135
|
"User name": "My Username",
|
|
136
136
|
}}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { AgentProps, BubbleProps, PopupProps } from '@release0/js';
|
|
1
|
+
import { BubbleProps, PopupProps, AgentProps } from '@release0/js';
|
|
3
2
|
export * from '@release0/js';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
|
|
6
|
-
type Props$2 =
|
|
7
|
-
style?: React.CSSProperties;
|
|
8
|
-
className?: string;
|
|
9
|
-
};
|
|
6
|
+
type Props$2 = BubbleProps;
|
|
10
7
|
declare global {
|
|
11
|
-
namespace JSX {
|
|
8
|
+
namespace React.JSX {
|
|
12
9
|
interface IntrinsicElements {
|
|
13
|
-
"agent-
|
|
14
|
-
class?: string;
|
|
15
|
-
};
|
|
10
|
+
"agent-bubble": React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
16
11
|
}
|
|
17
12
|
}
|
|
18
13
|
}
|
|
19
|
-
declare const
|
|
14
|
+
declare const Bubble: (props: Props$2) => react_jsx_runtime.JSX.Element | null;
|
|
20
15
|
|
|
21
|
-
type Props$1 =
|
|
16
|
+
type Props$1 = PopupProps;
|
|
22
17
|
declare global {
|
|
23
|
-
namespace JSX {
|
|
18
|
+
namespace React.JSX {
|
|
24
19
|
interface IntrinsicElements {
|
|
25
|
-
"agent-
|
|
20
|
+
"agent-popup": React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> & {
|
|
21
|
+
class?: string;
|
|
22
|
+
};
|
|
26
23
|
}
|
|
27
24
|
}
|
|
28
25
|
}
|
|
29
|
-
declare const
|
|
26
|
+
declare const Popup: (props: Props$1) => react_jsx_runtime.JSX.Element;
|
|
30
27
|
|
|
31
|
-
type Props =
|
|
28
|
+
type Props = AgentProps & {
|
|
29
|
+
style?: React.CSSProperties;
|
|
30
|
+
className?: string;
|
|
31
|
+
};
|
|
32
32
|
declare global {
|
|
33
|
-
namespace JSX {
|
|
33
|
+
namespace React.JSX {
|
|
34
34
|
interface IntrinsicElements {
|
|
35
|
-
"agent-
|
|
35
|
+
"agent-standard": React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> & {
|
|
36
36
|
class?: string;
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
declare const
|
|
41
|
+
declare const Standard: ({ style, className, ...assignableProps }: Props) => react_jsx_runtime.JSX.Element;
|
|
42
42
|
|
|
43
43
|
export { Bubble, Popup, Standard };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var w=({id:t}={})=>{let e={isFromAgent:!0,command:"close",id:t};window.postMessage(e)},v=({id:t}={})=>{let e={isFromAgent:!0,command:"open",id:t};window.postMessage(e)},R=(t,{id:e}={})=>{let n={isFromAgent:!0,command:"showPreviewMessage",message:t,id:e};window.postMessage(n)},T=({id:t}={})=>{let e={isFromAgent:!0,command:"toggle",id:t};window.postMessage(e)},H=({id:t}={})=>{let e={isFromAgent:!0,command:"reload",id:t};window.postMessage(e)},L=(t,{id:e}={})=>{let n={isFromAgent:!0,command:"setInputValue",value:t,id:e};window.postMessage(n)},y=({id:t}={})=>{let e={isFromAgent:!0,command:"unmount",id:t};window.postMessage(e)},A=(t,{id:e}={})=>{let n={isFromAgent:!0,command:"setPrefilledVariables",variables:t,id:e};window.postMessage(n)},h=({id:t}={})=>{let e={isFromAgent:!0,command:"hidePreviewMessage",id:t};window.postMessage(e)};import{useEffect as l,useRef as c}from"react";import{jsx as u}from"react/jsx-runtime";var m=t=>{let e=c(null);return l(()=>{t.theme?.position!=="static"&&(e.current||(e.current=document.createElement("agent-bubble"),document.body.prepend(e.current)),import("./web-53BLTPE3.js").then(()=>{let{agent:n,...r}=t;Object.assign(e.current??document.createElement("agent-bubble"),r,{agent:n})}))},[t]),l(()=>()=>{t.theme?.position!=="static"&&(e.current?.remove(),e.current=null)},[t.theme?.position]),t.theme?.position==="static"?u("agent-bubble",{ref:e,style:{display:"inline-flex"}}):null};import{useCallback as d,useEffect as i,useRef as p}from"react";import{jsx as f}from"react/jsx-runtime";var g=t=>{let e=p(null),n=p(null),r=d(s=>{let a=document.createElement("agent-popup");if(n.current=a,o(n.current,s),!e.current){console.warn("Could not attach popup to container because containerRef.current is null");return}e.current?.append(n.current)},[]);i(()=>{n.current||r(t),o(n.current,t)},[r,t]),i(()=>()=>{n.current?.remove(),n.current=null},[]);let o=(s,a)=>{import("./web-53BLTPE3.js").then(()=>{Object.assign(s,a)})};return f("div",{ref:e})};import{useEffect as b,useRef as P}from"react";import{jsx as M}from"react/jsx-runtime";var E=({style:t,className:e,...n})=>{let r=P(null);return b(()=>{import("./web-53BLTPE3.js").then(()=>{let{agent:o,...s}=n;Object.assign(r.current,s,{agent:o})})},[n]),M("agent-standard",{ref:r,style:t,class:e})};export{m as Bubble,g as Popup,E as Standard,w as close,h as hidePreviewMessage,v as open,H as reload,L as setInputValue,A as setPrefilledVariables,R as showPreviewMessage,T as toggle,y as unmount};
|