@makebot.it/react 1.0.2 → 1.0.3
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/commands.d.ts +1 -2
- package/dist/commands.js +1 -1
- package/dist/index.d.ts +47 -5
- package/dist/index.js +1 -1
- package/dist/web.d.ts +2 -2
- package/dist/web.js +9 -5
- package/package.json +2 -2
- package/dist/Bubble.d.ts +0 -17
- package/dist/Bubble.d.ts.map +0 -1
- package/dist/Popup.d.ts +0 -15
- package/dist/Popup.d.ts.map +0 -1
- package/dist/Standard.d.ts +0 -18
- package/dist/Standard.d.ts.map +0 -1
- package/dist/commands.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/web.d.ts.map +0 -1
- /package/dist/{chunk-GFIEK2FB.js → chunk-UYDUWQU3.js} +0 -0
package/dist/commands.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
//# sourceMappingURL=commands.d.ts.map
|
|
1
|
+
export * from '@makebot.it/js';
|
package/dist/commands.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o,b as r,c as e,d as f,e as m,f as p,g as t,h as x,i as a,j as b,k as c}from"./chunk-
|
|
1
|
+
import{a as o,b as r,c as e,d as f,e as m,f as p,g as t,h as x,i as a,j as b,k as c}from"./chunk-UYDUWQU3.js";export{o as close,x as hidePreviewMessage,r as open,b as reload,c as resolveButtonSize,a as sendCommand,m as setInputValue,t as setPrefilledVariables,e as showPreviewMessage,f as toggle,p as unmount};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { BotProps, PopupProps, BubbleProps } from '@makebot.it/js';
|
|
3
|
+
export * from '@makebot.it/js';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
type Props$2 = BotProps & {
|
|
7
|
+
style?: React.CSSProperties;
|
|
8
|
+
className?: string;
|
|
9
|
+
};
|
|
10
|
+
declare global {
|
|
11
|
+
namespace JSX {
|
|
12
|
+
interface IntrinsicElements {
|
|
13
|
+
"makebot-standard": React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> & {
|
|
14
|
+
class?: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
declare const Standard: ({ style, className, ...assignableProps }: Props$2) => react_jsx_runtime.JSX.Element;
|
|
20
|
+
|
|
21
|
+
type Props$1 = PopupProps;
|
|
22
|
+
declare global {
|
|
23
|
+
namespace JSX {
|
|
24
|
+
interface IntrinsicElements {
|
|
25
|
+
"makebot-popup": React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> & {
|
|
26
|
+
class?: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
declare const Popup: (props: Props$1) => react_jsx_runtime.JSX.Element;
|
|
32
|
+
|
|
33
|
+
type Props = BubbleProps & {
|
|
34
|
+
inlineStyle?: {
|
|
35
|
+
[key: string]: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
declare global {
|
|
39
|
+
namespace JSX {
|
|
40
|
+
interface IntrinsicElements {
|
|
41
|
+
"makebot-bubble": React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
declare const Bubble: (props: Props) => react_jsx_runtime.JSX.Element | null;
|
|
46
|
+
|
|
47
|
+
export { Bubble, Popup, Standard };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as R,b as k,c as h,d as S,e as g,f as B,g as z,h as v,i as x,j as w,k as i}from"./chunk-
|
|
1
|
+
import{a as R,b as k,c as h,d as S,e as g,f as B,g as z,h as v,i as x,j as w,k as i}from"./chunk-UYDUWQU3.js";import{useEffect as m,useRef as b}from"react";import{jsx as d}from"react/jsx-runtime";var f=({style:e,className:t,...r})=>{let n=b(null);return m(()=>{let o=!1;return(async()=>{if(await import("./web.js"),await customElements.whenDefined("makebot-standard"),!n.current||o)return;let{makebot:l,...p}=r;Object.assign(n.current,p,{makebot:l})})().catch(l=>{console.error("Failed to initialize makebot-standard",l)}),()=>{o=!0}},[r]),d("makebot-standard",{ref:n,style:e,class:t})};import{useCallback as E,useEffect as c,useRef as u}from"react";import{jsx as y}from"react/jsx-runtime";var P=e=>{let t=u(null),r=u(null),n=E(a=>{let l=document.createElement("makebot-popup");if(r.current=l,o(r.current,a),!t.current){console.warn("N\xE3o foi poss\xEDvel anexar o popup ao cont\xEAiner porque containerRef.current \xE9 nulo");return}t.current?.append(r.current)},[]);c(()=>{r.current||n(e),o(r.current,e)},[n,e]),c(()=>(import("./web.js"),()=>{r.current?.remove(),r.current=null}),[]);let o=(a,l)=>{Object.assign(a,l)};return y("div",{ref:t})};import{useEffect as s,useMemo as T,useRef as M}from"react";import{jsx as L}from"react/jsx-runtime";var H=e=>{let t=M(null);s(()=>{import("./web.js")},[]),s(()=>{if(e.theme?.position==="static"&&!t.current)return;t.current||(t.current=document.createElement("makebot-bubble"),document.body.prepend(t.current));let{makebot:n,...o}=e;Object.assign(t.current,o,{makebot:n})},[e]),s(()=>()=>{e.theme?.position!=="static"&&(t.current?.remove(),t.current=null)},[e.theme?.position]);let r=T(()=>i(e.theme?.button?.size),[e.theme?.button?.size]);return e.theme?.position==="static"?L("makebot-bubble",{ref:t,style:{display:"inline-flex",width:r,height:r}}):null};export{H as Bubble,P as Popup,f as Standard,R as close,v as hidePreviewMessage,k as open,w as reload,i as resolveButtonSize,x as sendCommand,g as setInputValue,z as setPrefilledVariables,h as showPreviewMessage,S as toggle,B as unmount};
|
package/dist/web.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
|
|
2
|
+
export { }
|
package/dist/web.js
CHANGED
|
@@ -1893,9 +1893,13 @@ select option {
|
|
|
1893
1893
|
`),mN=(e,{element:t})=>{let[r,n]=N(!1),[a,i]=N(e.prefilledVariables),o=()=>{n(!0)},s=()=>{n(!1),setTimeout(()=>{n(!0)},1)},l=new IntersectionObserver(d=>{d.some(p=>p.isIntersecting)&&o()}),c=()=>{let d=t.getBoundingClientRect();return d.width>0&&d.height>0&&d.bottom>=0&&d.right>=0&&d.top<=window.innerHeight&&d.left<=window.innerWidth};$e(()=>{if(window.addEventListener("message",u),c()){o();return}l.observe(t)}),Ye(()=>{e.prefilledVariables&&i(d=>({...d,...e.prefilledVariables}))});let u=d=>{let{data:p}=d;if(!(!p.isFromMakebot||p.id&&t.id!==p.id))switch(p.command){case"setPrefilledVariables":i(h=>({...h,...p.variables}));break;case"reload":s();break}};return Ie(()=>{l.disconnect()}),g(Mu,{get value(){return document.querySelector("makebot-standard")?.shadowRoot},get children(){return[(()=>{var d=gN(),p=d.firstChild;return T(d,ed,p),T(d,td,p),d})(),g(X,{get when(){return r()},get children(){return g(Qu,De(e,{get prefilledVariables(){return a()}}))}})]}})},fN=()=>{typeof window>"u"||(ml("makebot-standard",xu,mN),ml("makebot-bubble",qy,uN),ml("makebot-popup",Wy,hN))},bN=({id:e}={})=>{let t={isFromMakebot:!0,command:"close",id:e};window.postMessage(t)},yN=({id:e}={})=>{let t={isFromMakebot:!0,command:"hidePreviewMessage",id:e};window.postMessage(t)},vN=({id:e}={})=>{let t={isFromMakebot:!0,command:"open",id:e};window.postMessage(t)},xN=(e,{id:t}={})=>{let r={isFromMakebot:!0,command:"sendCommand",text:e,id:t};window.postMessage(r)},wN=(e,{id:t}={})=>{let r={isFromMakebot:!0,command:"setInputValue",value:e,id:t};window.postMessage(r)},kN=(e,{id:t}={})=>{let r={isFromMakebot:!0,command:"setPrefilledVariables",variables:e,id:t};window.postMessage(r)},_N=(e,{id:t}={})=>{let r={isFromMakebot:!0,command:"showPreviewMessage",message:e,id:t};window.postMessage(r)},TN=({id:e}={})=>{let t={isFromMakebot:!0,command:"toggle",id:e};window.postMessage(t)},SN=({id:e}={})=>{let t={isFromMakebot:!0,command:"unmount",id:e};window.postMessage(t)},EN=({id:e}={})=>{let t={isFromMakebot:!0,command:"reload",id:e};window.postMessage(t)},CN=e=>{let t=e.id?document.getElementById(e.id):document.querySelector("makebot-standard");if(!t)throw new Error("<makebot-standard> element not found.");Object.assign(t,e)},PN=e=>{let t=document.createElement("makebot-popup");Object.assign(t,e),document.body.prepend(t)},ON=e=>{let t=document.createElement("makebot-bubble");Object.assign(t,e),document.body.prepend(t)},IN=()=>({initStandard:CN,initPopup:PN,initBubble:ON,close:bN,hidePreviewMessage:yN,open:vN,setPrefilledVariables:kN,showPreviewMessage:_N,toggle:TN,setInputValue:wN,unmount:SN,sendCommand:xN,reload:EN}),NN=e=>{typeof window>"u"||(window.Makebot={...e})};fN();var AN=IN();NN(AN);
|
|
1894
1894
|
/*! Bundled license information:
|
|
1895
1895
|
|
|
1896
|
-
|
|
1897
|
-
(*!
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1896
|
+
@makebot.it/js/dist/web.js:
|
|
1897
|
+
(*! Bundled license information:
|
|
1898
|
+
|
|
1899
|
+
ky/distribution/index.js:
|
|
1900
|
+
(*! MIT License © Sindre Sorhus *)
|
|
1901
|
+
|
|
1902
|
+
dompurify/dist/purify.es.mjs:
|
|
1903
|
+
(*! @license DOMPurify 3.2.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.4/LICENSE *)
|
|
1904
|
+
*)
|
|
1901
1905
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@makebot.it/react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Biblioteca conveniente para exibir makebots em seu aplicativo React",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"react": "18.3.1",
|
|
23
|
-
"@makebot.it/js": "1.0.
|
|
23
|
+
"@makebot.it/js": "1.0.3"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"react": "^16.0.0 || ^17.0.0 || ^18.0.0"
|
package/dist/Bubble.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { type BubbleProps } from "@makebot.it/js";
|
|
2
|
-
import type React from "react";
|
|
3
|
-
type Props = BubbleProps & {
|
|
4
|
-
inlineStyle?: {
|
|
5
|
-
[key: string]: string;
|
|
6
|
-
};
|
|
7
|
-
};
|
|
8
|
-
declare global {
|
|
9
|
-
namespace JSX {
|
|
10
|
-
interface IntrinsicElements {
|
|
11
|
-
"makebot-bubble": React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
export declare const Bubble: (props: Props) => import("react/jsx-runtime").JSX.Element | null;
|
|
16
|
-
export {};
|
|
17
|
-
//# sourceMappingURL=Bubble.d.ts.map
|
package/dist/Bubble.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Bubble.d.ts","sourceRoot":"","sources":["../src/Bubble.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAqB,MAAM,gBAAgB,CAAC;AACrE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,KAAK,KAAK,GAAG,WAAW,GAAG;IACzB,WAAW,CAAC,EAAE;QACZ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;KACvB,CAAC;CACH,CAAC;AAEF,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,GAAG,CAAC;QACZ,UAAU,iBAAiB;YACzB,gBAAgB,EAAE,KAAK,CAAC,iBAAiB,CACvC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,EACjC,WAAW,CACZ,CAAC;SACH;KACF;CACF;AAID,eAAO,MAAM,MAAM,GAAI,OAAO,KAAK,mDA0ClC,CAAC"}
|
package/dist/Popup.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { PopupProps } from "@makebot.it/js";
|
|
2
|
-
import type React from "react";
|
|
3
|
-
type Props = PopupProps;
|
|
4
|
-
declare global {
|
|
5
|
-
namespace JSX {
|
|
6
|
-
interface IntrinsicElements {
|
|
7
|
-
"makebot-popup": React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> & {
|
|
8
|
-
class?: string;
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
export declare const Popup: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
export {};
|
|
15
|
-
//# sourceMappingURL=Popup.d.ts.map
|
package/dist/Popup.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Popup.d.ts","sourceRoot":"","sources":["../src/Popup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,KAAK,KAAK,GAAG,UAAU,CAAC;AAExB,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,GAAG,CAAC;QACZ,UAAU,iBAAiB;YACzB,eAAe,EAAE,KAAK,CAAC,iBAAiB,CACtC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,EACjC,WAAW,CACZ,GAAG;gBAAE,KAAK,CAAC,EAAE,MAAM,CAAA;aAAE,CAAC;SACxB;KACF;CACF;AAID,eAAO,MAAM,KAAK,GAAI,OAAO,KAAK,4CAqCjC,CAAC"}
|
package/dist/Standard.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { BotProps } from "@makebot.it/js";
|
|
2
|
-
import type React from "react";
|
|
3
|
-
type Props = BotProps & {
|
|
4
|
-
style?: React.CSSProperties;
|
|
5
|
-
className?: string;
|
|
6
|
-
};
|
|
7
|
-
declare global {
|
|
8
|
-
namespace JSX {
|
|
9
|
-
interface IntrinsicElements {
|
|
10
|
-
"makebot-standard": React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> & {
|
|
11
|
-
class?: string;
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
export declare const Standard: ({ style, className, ...assignableProps }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
-
export {};
|
|
18
|
-
//# sourceMappingURL=Standard.d.ts.map
|
package/dist/Standard.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Standard.d.ts","sourceRoot":"","sources":["../src/Standard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,KAAK,KAAK,GAAG,QAAQ,GAAG;IACtB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,GAAG,CAAC;QACZ,UAAU,iBAAiB;YACzB,kBAAkB,EAAE,KAAK,CAAC,iBAAiB,CACzC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,EACjC,WAAW,CACZ,GAAG;gBAAE,KAAK,CAAC,EAAE,MAAM,CAAA;aAAE,CAAC;SACxB;KACF;CACF;AAID,eAAO,MAAM,QAAQ,GAAI,0CAA0C,KAAK,4CAyBvE,CAAC"}
|
package/dist/commands.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,cAAc,gBAAgB,CAAC"}
|
package/dist/web.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../src/web.ts"],"names":[],"mappings":"AACA,OAAO,oBAAoB,CAAC"}
|
|
File without changes
|