@squadico/chatbot 1.1.1 → 1.1.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../src/element.tsx"],"names":[],"mappings":"AAkBA,eAAO,MAAM,QAAQ,qBAAqB,CAAA;AAyV1C;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,GAAG,GAAE,MAAiB,GAAG,IAAI,CAM1D"}
1
+ {"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../src/element.tsx"],"names":[],"mappings":"AAkBA,eAAO,MAAM,QAAQ,qBAAqB,CAAA;AA6W1C;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,GAAG,GAAE,MAAiB,GAAG,IAAI,CAM1D"}
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./src-BSDQ6Xfm.cjs");exports.API_URL=e.r,exports.ChatHttpError=e.i,exports.DEFAULT_LANGUAGE=e.s,exports.MAX_MESSAGE_LENGTH=e.a,exports.SUPPORTED_LANGUAGES=e.c,exports.TAG_NAME=e.t,exports.defineChatbot=e.n;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./src-DNagSAPN.cjs");exports.API_URL=e.r,exports.ChatHttpError=e.i,exports.DEFAULT_LANGUAGE=e.s,exports.MAX_MESSAGE_LENGTH=e.a,exports.SUPPORTED_LANGUAGES=e.c,exports.TAG_NAME=e.t,exports.defineChatbot=e.n;
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as e, c as t, i as n, n as r, r as i, s as a, t as o } from "./src-BL9j5H3p.js";
1
+ import { a as e, c as t, i as n, n as r, r as i, s as a, t as o } from "./src-2UbcV1gc.js";
2
2
  export { i as API_URL, n as ChatHttpError, a as DEFAULT_LANGUAGE, e as MAX_MESSAGE_LENGTH, t as SUPPORTED_LANGUAGES, o as TAG_NAME, r as defineChatbot };
package/dist/react.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./src-BSDQ6Xfm.cjs");let t=require("react");var n={embedKey:`embed-key`,agent:`agent`,heading:`heading`,subheading:`subheading`,assistantName:`assistant-name`,placeholder:`placeholder`,greeting:`greeting`,width:`width`,accent:`accent`,theme:`theme`,position:`position`,layout:`layout`,locale:`locale`};function r(e,t){typeof e==`function`?e(t):e&&(e.current=t)}var i=(0,t.forwardRef)(function(i,a){let o=(0,t.useRef)(null),s=(0,t.useRef)(!1);(0,t.useEffect)(()=>{let t=o.current;if(t){e.n(),customElements.upgrade(t);for(let[e,r]of Object.entries(n)){let n=i[e];typeof n==`string`&&n?t.setAttribute(r,n):t.removeAttribute(r)}i.suggestions?.length?t.setAttribute(`suggestions`,JSON.stringify(i.suggestions)):t.removeAttribute(`suggestions`),i.persistOpen===!1?t.setAttribute(`persist-open`,`false`):t.removeAttribute(`persist-open`),t.context=i.context,t.user=i.user,t.getSubjectToken=i.getSubjectToken,s.current||(s.current=!0,e.o(i.defaultOpen,i.persistOpen)&&t.openChat())}});let{onOpen:c,onClose:l,onMessage:u,onError:d,onReset:f}=i;return(0,t.useEffect)(()=>{let e=o.current;if(!e)return;let t=Object.entries({"chatbot-open":c,"chatbot-close":l,"chatbot-message":u,"chatbot-error":d,"chatbot-reset":f}).filter(([,e])=>typeof e==`function`).map(([t,n])=>{let r=e=>{n?.(e.detail)};return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});return()=>t.forEach(e=>e())},[c,l,u,d,f]),(0,t.createElement)(e.t,{ref:e=>{o.current=e,r(a,e)},class:i.className,style:i.style,id:i.id},i.launcherIcon==null?null:(0,t.createElement)(`span`,{slot:`launcher-icon`},i.launcherIcon))});exports.SquadicoChatbot=i,exports.TAG_NAME=e.t,exports.defineChatbot=e.n;
1
+ "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./src-DNagSAPN.cjs");let t=require("react");var n={embedKey:`embed-key`,agent:`agent`,heading:`heading`,subheading:`subheading`,assistantName:`assistant-name`,placeholder:`placeholder`,greeting:`greeting`,width:`width`,accent:`accent`,theme:`theme`,position:`position`,layout:`layout`,locale:`locale`};function r(e,t){typeof e==`function`?e(t):e&&(e.current=t)}var i=(0,t.forwardRef)(function(i,a){let o=(0,t.useRef)(null),s=(0,t.useRef)(!1);(0,t.useEffect)(()=>{let t=o.current;if(t){e.n(),customElements.upgrade(t);for(let[e,r]of Object.entries(n)){let n=i[e];typeof n==`string`&&n?t.setAttribute(r,n):t.removeAttribute(r)}i.suggestions?.length?t.setAttribute(`suggestions`,JSON.stringify(i.suggestions)):t.removeAttribute(`suggestions`),i.persistOpen===!1?t.setAttribute(`persist-open`,`false`):t.removeAttribute(`persist-open`),t.context=i.context,t.user=i.user,t.getSubjectToken=i.getSubjectToken,s.current||(s.current=!0,e.o(i.defaultOpen,i.persistOpen)&&t.openChat())}});let{onOpen:c,onClose:l,onMessage:u,onError:d,onReset:f}=i;return(0,t.useEffect)(()=>{let e=o.current;if(!e)return;let t=Object.entries({"chatbot-open":c,"chatbot-close":l,"chatbot-message":u,"chatbot-error":d,"chatbot-reset":f}).filter(([,e])=>typeof e==`function`).map(([t,n])=>{let r=e=>{n?.(e.detail)};return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});return()=>t.forEach(e=>e())},[c,l,u,d,f]),(0,t.createElement)(e.t,{ref:e=>{o.current=e,r(a,e)},class:i.className,style:i.style,id:i.id},i.launcherIcon==null?null:(0,t.createElement)(`span`,{slot:`launcher-icon`},i.launcherIcon))});exports.SquadicoChatbot=i,exports.TAG_NAME=e.t,exports.defineChatbot=e.n;
2
2
  //# sourceMappingURL=react.cjs.map
package/dist/react.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { n as e, o as t, t as n } from "./src-BL9j5H3p.js";
2
+ import { n as e, o as t, t as n } from "./src-2UbcV1gc.js";
3
3
  import { createElement as r, forwardRef as i, useEffect as a, useRef as o } from "react";
4
4
  //#region src/react.tsx
5
5
  var s = {
@@ -2390,7 +2390,14 @@ function Pn(e) {
2390
2390
  function Fn(e) {
2391
2391
  return e === "floating" || e === "sidebar" ? e : void 0;
2392
2392
  }
2393
- function In() {
2393
+ var In = [
2394
+ "context",
2395
+ "embedKey",
2396
+ "user",
2397
+ "getSubjectToken",
2398
+ "agent"
2399
+ ];
2400
+ function Ln() {
2394
2401
  var e, t, n, r, i, a, o, s, c, l, u, d, f, p;
2395
2402
  return t = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new WeakMap(), i = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new WeakMap(), o = /* @__PURE__ */ new WeakMap(), s = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap(), l = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new WeakMap(), d = /* @__PURE__ */ new WeakSet(), f = /* @__PURE__ */ new WeakMap(), p = /* @__PURE__ */ new WeakMap(), e = class extends HTMLElement {
2396
2403
  constructor() {
@@ -2411,6 +2418,11 @@ function In() {
2411
2418
  t.textContent = xn, e.append(t);
2412
2419
  }
2413
2420
  Q(t, this, document.createElement("div")), e.append($(t, this));
2421
+ for (let e of In) {
2422
+ if (!Object.hasOwn(this, e)) continue;
2423
+ let t = this[e];
2424
+ delete this[e], this[e] = t;
2425
+ }
2414
2426
  }
2415
2427
  connectedCallback() {
2416
2428
  Q(i, this, !0), Z(d, this, h).call(this);
@@ -2518,14 +2530,14 @@ function In() {
2518
2530
  }), $(t, this));
2519
2531
  }
2520
2532
  }
2521
- var Ln;
2522
- function Rn(e = wn) {
2523
- typeof window > "u" || typeof HTMLElement > "u" || (Ln ?? (Ln = In()), window.customElements.get(e) || window.customElements.define(e, Ln));
2533
+ var Rn;
2534
+ function zn(e = wn) {
2535
+ typeof window > "u" || typeof HTMLElement > "u" || (Rn ?? (Rn = Ln()), window.customElements.get(e) || window.customElements.define(e, Rn));
2524
2536
  }
2525
2537
  //#endregion
2526
2538
  //#region src/index.ts
2527
- Rn();
2539
+ zn();
2528
2540
  //#endregion
2529
- export { qe as a, je as c, J as i, Rn as n, Be as o, Ke as r, Ae as s, wn as t };
2541
+ export { qe as a, je as c, J as i, zn as n, Be as o, Ke as r, Ae as s, wn as t };
2530
2542
 
2531
- //# sourceMappingURL=src-BL9j5H3p.js.map
2543
+ //# sourceMappingURL=src-2UbcV1gc.js.map