@release0/react 1.0.4 → 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 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 `prefilledVariables` option. Here is an example:
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
- prefilledVariables={{
133
+ initialContext={{
134
134
  "Account URL": "https://my-site.com/account",
135
135
  "User name": "My Username",
136
136
  }}
package/dist/index.js CHANGED
@@ -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-DTA6A66J.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-DTA6A66J.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-DTA6A66J.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};
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};