@opencx/widget 3.0.81 → 3.0.82
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 +1 -1
- package/dist/designs.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.js +2 -2
- package/dist/src/headless/core/__tests__/test-utils.d.ts +3 -0
- package/dist/src/headless/core/api/api-caller.d.ts +3 -0
- package/dist/src/headless/core/api/schema.d.ts +5 -0
- package/dist/src/headless/core/context/message.ctx.d.ts +1 -0
- package/dist/src/headless/core/types/widget-config.d.ts +7 -0
- package/dist/src/headless/react/hooks/useMessages.d.ts +1 -0
- package/dist/{useWidgetTrigger-ims5I4zH.js → useWidgetTrigger-B6FKEL-h.js} +3 -3
- package/dist/{useWidgetTrigger-ims5I4zH.js.map → useWidgetTrigger-B6FKEL-h.js.map} +1 -1
- package/dist/{useWidgetTrigger-DL9e5ISu.cjs → useWidgetTrigger-BYK9pFBJ.cjs} +2 -2
- package/dist/{useWidgetTrigger-DL9e5ISu.cjs.map → useWidgetTrigger-BYK9pFBJ.cjs.map} +1 -1
- package/dist/{widget.ctx-DRC-z8Ql.js → widget.ctx-Br9aZd2F.js} +44 -40
- package/dist/widget.ctx-Br9aZd2F.js.map +1 -0
- package/dist/{widget.ctx-sL-dW2kY.cjs → widget.ctx-C_ukAHJS.cjs} +2 -2
- package/dist/widget.ctx-C_ukAHJS.cjs.map +1 -0
- package/dist-embed/script.js +2 -2
- package/dist-embed/script.js.map +1 -1
- package/package.json +1 -1
- package/dist/widget.ctx-DRC-z8Ql.js.map +0 -1
- package/dist/widget.ctx-sL-dW2kY.cjs.map +0 -1
package/dist/designs.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react/jsx-runtime"),uu=require("@radix-ui/react-popover"),X=require("react"),q=require("./useWidgetTrigger-DL9e5ISu.cjs"),lu=require("@radix-ui/react-dialog"),le=require("lucide-react"),va=require("clsx"),fr=require("react-dom"),cu=require("@radix-ui/react-slot"),be=require("framer-motion"),du=require("@radix-ui/react-avatar"),hu=require("@radix-ui/react-tooltip"),hi=require("tinycolor2"),fu=require("react-dropzone"),pu=require("@radix-ui/react-dropdown-menu"),Gn=require("zod");function It(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const Dn=It(uu),ye=It(X),ze=It(lu),St=It(du),sn=It(hu),me=It(pu);function fi(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}const Ne=st(/[A-Za-z]/),Ae=st(/[\dA-Za-z]/),mu=st(/[#-'*+\--9=?A-Z^-~]/);function Cn(e){return e!==null&&(e<32||e===127)}const pr=st(/\d/),gu=st(/[\dA-Fa-f]/),bu=st(/[!-/:-@[-`{-~]/);function W(e){return e!==null&&e<-2}function se(e){return e!==null&&(e<0||e===32)}function J(e){return e===-2||e===-1||e===32}const vn=st(new RegExp("\\p{P}|\\p{S}","u")),pt=st(/\s/);function st(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Eu(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}const Pn=function(e){if(e==null)return yu;if(typeof e=="function")return Mn(e);if(typeof e=="object")return Array.isArray(e)?Tu(e):xu(e);if(typeof e=="string")return wu(e);throw new Error("Expected function, string, or object as test")};function Tu(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Pn(e[n]);return Mn(r);function r(...i){let a=-1;for(;++a<t.length;)if(t[a].apply(this,i))return!0;return!1}}function xu(e){const t=e;return Mn(n);function n(r){const i=r;let a;for(a in e)if(i[a]!==t[a])return!1;return!0}}function wu(e){return Mn(t);function t(n){return n&&n.type===e}}function Mn(e){return t;function t(n,r,i){return!!(_u(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function yu(){return!0}function _u(e){return e!==null&&typeof e=="object"&&"type"in e}const Pa=[],Au=!0,mr=!1,Cu="skip";function Ma(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const a=Pn(i),s=r?-1:1;u(e,void 0,[])();function u(l,c,d){const h=l&&typeof l=="object"?l:{};if(typeof h.type=="string"){const f=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(g,"name",{value:"node ("+(l.type+(f?"<"+f+">":""))+")"})}return g;function g(){let f=Pa,E,y,k;if((!t||a(l,c,d[d.length-1]||void 0))&&(f=ku(n(l,d)),f[0]===mr))return f;if("children"in l&&l.children){const _=l;if(_.children&&f[0]!==Cu)for(y=(r?_.children.length:-1)+s,k=d.concat(_);y>-1&&y<_.children.length;){const S=_.children[y];if(E=u(S,y,k)(),E[0]===mr)return E;y=typeof E[1]=="number"?E[1]:y+s}}return f}}}function ku(e){return Array.isArray(e)?e:typeof e=="number"?[Au,e]:e==null?Pa:[e]}function Nu(e,t,n){const i=Pn((n||{}).ignore||[]),a=Iu(t);let s=-1;for(;++s<a.length;)Ma(e,"text",u);function u(c,d){let h=-1,g;for(;++h<d.length;){const f=d[h],E=g?g.children:void 0;if(i(f,E?E.indexOf(f):void 0,g))return;g=f}if(g)return l(c,d)}function l(c,d){const h=d[d.length-1],g=a[s][0],f=a[s][1];let E=0;const k=h.children.indexOf(c);let _=!1,S=[];g.lastIndex=0;let L=g.exec(c.value);for(;L;){const M=L.index,F={index:L.index,input:L.input,stack:[...d,c]};let I=f(...L,F);if(typeof I=="string"&&(I=I.length>0?{type:"text",value:I}:void 0),I===!1?g.lastIndex=M+1:(E!==M&&S.push({type:"text",value:c.value.slice(E,M)}),Array.isArray(I)?S.push(...I):I&&S.push(I),E=M+L[0].length,_=!0),!g.global)break;L=g.exec(c.value)}return _?(E<c.value.length&&S.push({type:"text",value:c.value.slice(E)}),h.children.splice(k,1,...S)):S=[c],k+S.length}}function Iu(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const i=n[r];t.push([Su(i[0]),Ou(i[1])])}return t}function Su(e){return typeof e=="string"?new RegExp(Eu(e),"g"):e}function Ou(e){return typeof e=="function"?e:function(){return e}}const Qn="phrasing",Xn=["autolink","link","image","label"];function Lu(){return{transforms:[Fu],enter:{literalAutolink:Du,literalAutolinkEmail:Kn,literalAutolinkHttp:Kn,literalAutolinkWww:Kn},exit:{literalAutolink:Bu,literalAutolinkEmail:Mu,literalAutolinkHttp:vu,literalAutolinkWww:Pu}}}function Ru(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Qn,notInConstruct:Xn},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Qn,notInConstruct:Xn},{character:":",before:"[ps]",after:"\\/",inConstruct:Qn,notInConstruct:Xn}]}}function Du(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Kn(e){this.config.enter.autolinkProtocol.call(this,e)}function vu(e){this.config.exit.autolinkProtocol.call(this,e)}function Pu(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function Mu(e){this.config.exit.autolinkEmail.call(this,e)}function Bu(e){this.exit(e)}function Fu(e){Nu(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Hu],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Uu]],{ignore:["link","linkReference"]})}function Hu(e,t,n,r,i){let a="";if(!Ba(i)||(/^w/i.test(t)&&(n=t+n,t="",a="http://"),!zu(n)))return!1;const s=ju(n+r);if(!s[0])return!1;const u={type:"link",title:null,url:a+t+s[0],children:[{type:"text",value:t+s[0]}]};return s[1]?[u,{type:"text",value:s[1]}]:u}function Uu(e,t,n,r){return!Ba(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function zu(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function ju(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=fi(e,"(");let a=fi(e,")");for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),a++;return[e,n]}function Ba(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||pt(n)||vn(n))&&(!t||n!==47)}function Ue(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}Fa.peek=Zu;function Yu(){return{enter:{gfmFootnoteDefinition:qu,gfmFootnoteDefinitionLabelString:Vu,gfmFootnoteCall:Xu,gfmFootnoteCallString:Ku},exit:{gfmFootnoteDefinition:Qu,gfmFootnoteDefinitionLabelString:Gu,gfmFootnoteCall:Ju,gfmFootnoteCallString:$u}}}function Wu(){return{unsafe:[{character:"[",inConstruct:["phrasing","label","reference"]}],handlers:{footnoteDefinition:el,footnoteReference:Fa}}}function qu(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Vu(){this.buffer()}function Gu(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.label=t,n.identifier=Ue(this.sliceSerialize(e)).toLowerCase()}function Qu(e){this.exit(e)}function Xu(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Ku(){this.buffer()}function $u(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.label=t,n.identifier=Ue(this.sliceSerialize(e)).toLowerCase()}function Ju(e){this.exit(e)}function Fa(e,t,n,r){const i=n.createTracker(r);let a=i.move("[^");const s=n.enter("footnoteReference"),u=n.enter("reference");return a+=i.move(n.safe(n.associationId(e),{...i.current(),before:a,after:"]"})),u(),s(),a+=i.move("]"),a}function Zu(){return"["}function el(e,t,n,r){const i=n.createTracker(r);let a=i.move("[^");const s=n.enter("footnoteDefinition"),u=n.enter("label");return a+=i.move(n.safe(n.associationId(e),{...i.current(),before:a,after:"]"})),u(),a+=i.move("]:"+(e.children&&e.children.length>0?" ":"")),i.shift(4),a+=i.move(n.indentLines(n.containerFlow(e,i.current()),tl)),s(),a}function tl(e,t,n){return t===0?e:(n?"":" ")+e}const nl=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Ha.peek=ol;function rl(){return{canContainEols:["delete"],enter:{strikethrough:al},exit:{strikethrough:sl}}}function il(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:nl}],handlers:{delete:Ha}}}function al(e){this.enter({type:"delete",children:[]},e)}function sl(e){this.exit(e)}function Ha(e,t,n,r){const i=n.createTracker(r),a=n.enter("strikethrough");let s=i.move("~~");return s+=n.containerPhrasing(e,{...i.current(),before:s,after:"~"}),s+=i.move("~~"),a(),s}function ol(){return"~"}function ul(e,t={}){const n=(t.align||[]).concat(),r=t.stringLength||cl,i=[],a=[],s=[],u=[];let l=0,c=-1;for(;++c<e.length;){const E=[],y=[];let k=-1;for(e[c].length>l&&(l=e[c].length);++k<e[c].length;){const _=ll(e[c][k]);if(t.alignDelimiters!==!1){const S=r(_);y[k]=S,(u[k]===void 0||S>u[k])&&(u[k]=S)}E.push(_)}a[c]=E,s[c]=y}let d=-1;if(typeof n=="object"&&"length"in n)for(;++d<l;)i[d]=pi(n[d]);else{const E=pi(n);for(;++d<l;)i[d]=E}d=-1;const h=[],g=[];for(;++d<l;){const E=i[d];let y="",k="";E===99?(y=":",k=":"):E===108?y=":":E===114&&(k=":");let _=t.alignDelimiters===!1?1:Math.max(1,u[d]-y.length-k.length);const S=y+"-".repeat(_)+k;t.alignDelimiters!==!1&&(_=y.length+_+k.length,_>u[d]&&(u[d]=_),g[d]=_),h[d]=S}a.splice(1,0,h),s.splice(1,0,g),c=-1;const f=[];for(;++c<a.length;){const E=a[c],y=s[c];d=-1;const k=[];for(;++d<l;){const _=E[d]||"";let S="",L="";if(t.alignDelimiters!==!1){const M=u[d]-(y[d]||0),F=i[d];F===114?S=" ".repeat(M):F===99?M%2?(S=" ".repeat(M/2+.5),L=" ".repeat(M/2-.5)):(S=" ".repeat(M/2),L=S):L=" ".repeat(M)}t.delimiterStart!==!1&&!d&&k.push("|"),t.padding!==!1&&!(t.alignDelimiters===!1&&_==="")&&(t.delimiterStart!==!1||d)&&k.push(" "),t.alignDelimiters!==!1&&k.push(S),k.push(_),t.alignDelimiters!==!1&&k.push(L),t.padding!==!1&&k.push(" "),(t.delimiterEnd!==!1||d!==l-1)&&k.push("|")}f.push(t.delimiterEnd===!1?k.join("").replace(/ +$/,""):k.join(""))}return f.join(`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react/jsx-runtime"),uu=require("@radix-ui/react-popover"),X=require("react"),q=require("./useWidgetTrigger-BYK9pFBJ.cjs"),lu=require("@radix-ui/react-dialog"),le=require("lucide-react"),va=require("clsx"),fr=require("react-dom"),cu=require("@radix-ui/react-slot"),be=require("framer-motion"),du=require("@radix-ui/react-avatar"),hu=require("@radix-ui/react-tooltip"),hi=require("tinycolor2"),fu=require("react-dropzone"),pu=require("@radix-ui/react-dropdown-menu"),Gn=require("zod");function It(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const Dn=It(uu),ye=It(X),ze=It(lu),St=It(du),sn=It(hu),me=It(pu);function fi(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}const Ne=st(/[A-Za-z]/),Ae=st(/[\dA-Za-z]/),mu=st(/[#-'*+\--9=?A-Z^-~]/);function Cn(e){return e!==null&&(e<32||e===127)}const pr=st(/\d/),gu=st(/[\dA-Fa-f]/),bu=st(/[!-/:-@[-`{-~]/);function W(e){return e!==null&&e<-2}function se(e){return e!==null&&(e<0||e===32)}function J(e){return e===-2||e===-1||e===32}const vn=st(new RegExp("\\p{P}|\\p{S}","u")),pt=st(/\s/);function st(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Eu(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}const Pn=function(e){if(e==null)return yu;if(typeof e=="function")return Mn(e);if(typeof e=="object")return Array.isArray(e)?Tu(e):xu(e);if(typeof e=="string")return wu(e);throw new Error("Expected function, string, or object as test")};function Tu(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Pn(e[n]);return Mn(r);function r(...i){let a=-1;for(;++a<t.length;)if(t[a].apply(this,i))return!0;return!1}}function xu(e){const t=e;return Mn(n);function n(r){const i=r;let a;for(a in e)if(i[a]!==t[a])return!1;return!0}}function wu(e){return Mn(t);function t(n){return n&&n.type===e}}function Mn(e){return t;function t(n,r,i){return!!(_u(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function yu(){return!0}function _u(e){return e!==null&&typeof e=="object"&&"type"in e}const Pa=[],Au=!0,mr=!1,Cu="skip";function Ma(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const a=Pn(i),s=r?-1:1;u(e,void 0,[])();function u(l,c,d){const h=l&&typeof l=="object"?l:{};if(typeof h.type=="string"){const f=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(g,"name",{value:"node ("+(l.type+(f?"<"+f+">":""))+")"})}return g;function g(){let f=Pa,E,y,k;if((!t||a(l,c,d[d.length-1]||void 0))&&(f=ku(n(l,d)),f[0]===mr))return f;if("children"in l&&l.children){const _=l;if(_.children&&f[0]!==Cu)for(y=(r?_.children.length:-1)+s,k=d.concat(_);y>-1&&y<_.children.length;){const S=_.children[y];if(E=u(S,y,k)(),E[0]===mr)return E;y=typeof E[1]=="number"?E[1]:y+s}}return f}}}function ku(e){return Array.isArray(e)?e:typeof e=="number"?[Au,e]:e==null?Pa:[e]}function Nu(e,t,n){const i=Pn((n||{}).ignore||[]),a=Iu(t);let s=-1;for(;++s<a.length;)Ma(e,"text",u);function u(c,d){let h=-1,g;for(;++h<d.length;){const f=d[h],E=g?g.children:void 0;if(i(f,E?E.indexOf(f):void 0,g))return;g=f}if(g)return l(c,d)}function l(c,d){const h=d[d.length-1],g=a[s][0],f=a[s][1];let E=0;const k=h.children.indexOf(c);let _=!1,S=[];g.lastIndex=0;let L=g.exec(c.value);for(;L;){const M=L.index,F={index:L.index,input:L.input,stack:[...d,c]};let I=f(...L,F);if(typeof I=="string"&&(I=I.length>0?{type:"text",value:I}:void 0),I===!1?g.lastIndex=M+1:(E!==M&&S.push({type:"text",value:c.value.slice(E,M)}),Array.isArray(I)?S.push(...I):I&&S.push(I),E=M+L[0].length,_=!0),!g.global)break;L=g.exec(c.value)}return _?(E<c.value.length&&S.push({type:"text",value:c.value.slice(E)}),h.children.splice(k,1,...S)):S=[c],k+S.length}}function Iu(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const i=n[r];t.push([Su(i[0]),Ou(i[1])])}return t}function Su(e){return typeof e=="string"?new RegExp(Eu(e),"g"):e}function Ou(e){return typeof e=="function"?e:function(){return e}}const Qn="phrasing",Xn=["autolink","link","image","label"];function Lu(){return{transforms:[Fu],enter:{literalAutolink:Du,literalAutolinkEmail:Kn,literalAutolinkHttp:Kn,literalAutolinkWww:Kn},exit:{literalAutolink:Bu,literalAutolinkEmail:Mu,literalAutolinkHttp:vu,literalAutolinkWww:Pu}}}function Ru(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Qn,notInConstruct:Xn},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Qn,notInConstruct:Xn},{character:":",before:"[ps]",after:"\\/",inConstruct:Qn,notInConstruct:Xn}]}}function Du(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Kn(e){this.config.enter.autolinkProtocol.call(this,e)}function vu(e){this.config.exit.autolinkProtocol.call(this,e)}function Pu(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function Mu(e){this.config.exit.autolinkEmail.call(this,e)}function Bu(e){this.exit(e)}function Fu(e){Nu(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Hu],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Uu]],{ignore:["link","linkReference"]})}function Hu(e,t,n,r,i){let a="";if(!Ba(i)||(/^w/i.test(t)&&(n=t+n,t="",a="http://"),!zu(n)))return!1;const s=ju(n+r);if(!s[0])return!1;const u={type:"link",title:null,url:a+t+s[0],children:[{type:"text",value:t+s[0]}]};return s[1]?[u,{type:"text",value:s[1]}]:u}function Uu(e,t,n,r){return!Ba(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function zu(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function ju(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=fi(e,"(");let a=fi(e,")");for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),a++;return[e,n]}function Ba(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||pt(n)||vn(n))&&(!t||n!==47)}function Ue(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}Fa.peek=Zu;function Yu(){return{enter:{gfmFootnoteDefinition:qu,gfmFootnoteDefinitionLabelString:Vu,gfmFootnoteCall:Xu,gfmFootnoteCallString:Ku},exit:{gfmFootnoteDefinition:Qu,gfmFootnoteDefinitionLabelString:Gu,gfmFootnoteCall:Ju,gfmFootnoteCallString:$u}}}function Wu(){return{unsafe:[{character:"[",inConstruct:["phrasing","label","reference"]}],handlers:{footnoteDefinition:el,footnoteReference:Fa}}}function qu(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Vu(){this.buffer()}function Gu(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.label=t,n.identifier=Ue(this.sliceSerialize(e)).toLowerCase()}function Qu(e){this.exit(e)}function Xu(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Ku(){this.buffer()}function $u(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.label=t,n.identifier=Ue(this.sliceSerialize(e)).toLowerCase()}function Ju(e){this.exit(e)}function Fa(e,t,n,r){const i=n.createTracker(r);let a=i.move("[^");const s=n.enter("footnoteReference"),u=n.enter("reference");return a+=i.move(n.safe(n.associationId(e),{...i.current(),before:a,after:"]"})),u(),s(),a+=i.move("]"),a}function Zu(){return"["}function el(e,t,n,r){const i=n.createTracker(r);let a=i.move("[^");const s=n.enter("footnoteDefinition"),u=n.enter("label");return a+=i.move(n.safe(n.associationId(e),{...i.current(),before:a,after:"]"})),u(),a+=i.move("]:"+(e.children&&e.children.length>0?" ":"")),i.shift(4),a+=i.move(n.indentLines(n.containerFlow(e,i.current()),tl)),s(),a}function tl(e,t,n){return t===0?e:(n?"":" ")+e}const nl=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Ha.peek=ol;function rl(){return{canContainEols:["delete"],enter:{strikethrough:al},exit:{strikethrough:sl}}}function il(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:nl}],handlers:{delete:Ha}}}function al(e){this.enter({type:"delete",children:[]},e)}function sl(e){this.exit(e)}function Ha(e,t,n,r){const i=n.createTracker(r),a=n.enter("strikethrough");let s=i.move("~~");return s+=n.containerPhrasing(e,{...i.current(),before:s,after:"~"}),s+=i.move("~~"),a(),s}function ol(){return"~"}function ul(e,t={}){const n=(t.align||[]).concat(),r=t.stringLength||cl,i=[],a=[],s=[],u=[];let l=0,c=-1;for(;++c<e.length;){const E=[],y=[];let k=-1;for(e[c].length>l&&(l=e[c].length);++k<e[c].length;){const _=ll(e[c][k]);if(t.alignDelimiters!==!1){const S=r(_);y[k]=S,(u[k]===void 0||S>u[k])&&(u[k]=S)}E.push(_)}a[c]=E,s[c]=y}let d=-1;if(typeof n=="object"&&"length"in n)for(;++d<l;)i[d]=pi(n[d]);else{const E=pi(n);for(;++d<l;)i[d]=E}d=-1;const h=[],g=[];for(;++d<l;){const E=i[d];let y="",k="";E===99?(y=":",k=":"):E===108?y=":":E===114&&(k=":");let _=t.alignDelimiters===!1?1:Math.max(1,u[d]-y.length-k.length);const S=y+"-".repeat(_)+k;t.alignDelimiters!==!1&&(_=y.length+_+k.length,_>u[d]&&(u[d]=_),g[d]=_),h[d]=S}a.splice(1,0,h),s.splice(1,0,g),c=-1;const f=[];for(;++c<a.length;){const E=a[c],y=s[c];d=-1;const k=[];for(;++d<l;){const _=E[d]||"";let S="",L="";if(t.alignDelimiters!==!1){const M=u[d]-(y[d]||0),F=i[d];F===114?S=" ".repeat(M):F===99?M%2?(S=" ".repeat(M/2+.5),L=" ".repeat(M/2-.5)):(S=" ".repeat(M/2),L=S):L=" ".repeat(M)}t.delimiterStart!==!1&&!d&&k.push("|"),t.padding!==!1&&!(t.alignDelimiters===!1&&_==="")&&(t.delimiterStart!==!1||d)&&k.push(" "),t.alignDelimiters!==!1&&k.push(S),k.push(_),t.alignDelimiters!==!1&&k.push(L),t.padding!==!1&&k.push(" "),(t.delimiterEnd!==!1||d!==l-1)&&k.push("|")}f.push(t.delimiterEnd===!1?k.join("").replace(/ +$/,""):k.join(""))}return f.join(`
|
|
2
2
|
`)}function ll(e){return e==null?"":String(e)}function cl(e){return e.length}function pi(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}const mi={}.hasOwnProperty;function Ua(e,t){const n=t||{};function r(i,...a){let s=r.invalid;const u=r.handlers;if(i&&mi.call(i,e)){const l=String(i[e]);s=mi.call(u,l)?u[l]:r.unknown}if(s)return s.call(this,i,...a)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}function dl(e,t,n,r){const i=n.enter("blockquote"),a=n.createTracker(r);a.move("> "),a.shift(2);const s=n.indentLines(n.containerFlow(e,a.current()),hl);return i(),s}function hl(e,t,n){return">"+(n?"":" ")+e}function fl(e,t){return gi(e,t.inConstruct,!0)&&!gi(e,t.notInConstruct,!1)}function gi(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function bi(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
|
3
3
|
`&&fl(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
|
|
4
4
|
`}function pl(e,t){const n=String(e);let r=n.indexOf(t),i=r,a=0,s=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++a>s&&(s=a):a=1,i=r+t.length,r=n.indexOf(t,i);return s}function ml(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function gl(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function bl(e,t,n,r){const i=gl(n),a=e.value||"",s=i==="`"?"GraveAccent":"Tilde";if(ml(e,n)){const h=n.enter("codeIndented"),g=n.indentLines(a,El);return h(),g}const u=n.createTracker(r),l=i.repeat(Math.max(pl(a,i)+1,3)),c=n.enter("codeFenced");let d=u.move(l);if(e.lang){const h=n.enter(`codeFencedLang${s}`);d+=u.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...u.current()})),h()}if(e.lang&&e.meta){const h=n.enter(`codeFencedMeta${s}`);d+=u.move(" "),d+=u.move(n.safe(e.meta,{before:d,after:`
|
package/dist/designs.js
CHANGED
|
@@ -2,7 +2,7 @@ import { Fragment as Qa, jsx as b, jsxs as U } from "react/jsx-runtime";
|
|
|
2
2
|
import * as Un from "@radix-ui/react-popover";
|
|
3
3
|
import * as Te from "react";
|
|
4
4
|
import an, { forwardRef as zr, useState as Fe, useImperativeHandle as Au, useRef as cn, useCallback as Cu, useMemo as Yr, useEffect as Ot, memo as ku, cloneElement as Nu, createElement as Ai } from "react";
|
|
5
|
-
import { l as Ci, m as Iu, a as We, u as mt, d as dn, g as zn, i as Su, c as Xa, h as Lt, e as Yn, j as hn, b as Ou, _ as Lu, W as Ru, k as Du } from "./useWidgetTrigger-
|
|
5
|
+
import { l as Ci, m as Iu, a as We, u as mt, d as dn, g as zn, i as Su, c as Xa, h as Lt, e as Yn, j as hn, b as Ou, _ as Lu, W as Ru, k as Du } from "./useWidgetTrigger-B6FKEL-h.js";
|
|
6
6
|
import * as Ue from "@radix-ui/react-dialog";
|
|
7
7
|
import { X as vu, PaperclipIcon as Pu, ImageIcon as Mu, CircleDashed as Bu, ArrowUpIcon as Fu, CircleCheckIcon as Hu, XIcon as jr, AlertCircle as Uu, Loader2 as zu, FileAudio2Icon as Yu, FileVideo2Icon as ju, FileIcon as Wu, ChevronRight as qu, Check as Vu, Circle as Gu, ChevronLeftIcon as Qu, EllipsisVerticalIcon as Xu, MessageCirclePlusIcon as Ku, LoaderIcon as $u, SendHorizontal as Ju, UserRoundIcon as Zu, ChevronRightIcon as el, ChevronDownIcon as tl } from "lucide-react";
|
|
8
8
|
import { clsx as Ka } from "clsx";
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./widget.ctx-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./widget.ctx-C_ukAHJS.cjs");exports.PrimitiveState=t.PrimitiveState;exports.WidgetCtx=t.WidgetCtx;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.js
CHANGED
package/dist/react.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useWidgetTrigger-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useWidgetTrigger-BYK9pFBJ.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.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { u, _ as r } from "./useWidgetTrigger-
|
|
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-
|
|
1
|
+
import { u, _ as r } from "./useWidgetTrigger-B6FKEL-h.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-B6FKEL-h.js";
|
|
3
3
|
function g(e, s, t) {
|
|
4
4
|
const {
|
|
5
5
|
widgetCtx: { api: a }
|
|
@@ -180,6 +180,9 @@ export declare const TestUtils: {
|
|
|
180
180
|
clientContext?: {
|
|
181
181
|
[key: string]: unknown;
|
|
182
182
|
} | null;
|
|
183
|
+
custom_data?: {
|
|
184
|
+
[key: string]: unknown;
|
|
185
|
+
} | null;
|
|
183
186
|
};
|
|
184
187
|
signal: AbortSignal | undefined;
|
|
185
188
|
}, `${string}/${string}`>> | undefined): void;
|
|
@@ -283,9 +283,14 @@ export interface components {
|
|
|
283
283
|
type: string;
|
|
284
284
|
url: string;
|
|
285
285
|
}[] | null;
|
|
286
|
+
/** @description Context for the AI to be sent with each contact message */
|
|
286
287
|
clientContext?: {
|
|
287
288
|
[key: string]: unknown;
|
|
288
289
|
} | null;
|
|
290
|
+
/** @description Custom data to be sent with each contact message */
|
|
291
|
+
custom_data?: {
|
|
292
|
+
[key: string]: unknown;
|
|
293
|
+
} | null;
|
|
289
294
|
};
|
|
290
295
|
UploadWidgetFileResponseDto: {
|
|
291
296
|
fileName: string;
|
|
@@ -28,6 +28,7 @@ export declare class MessageCtx {
|
|
|
28
28
|
sendMessage: (input: {
|
|
29
29
|
content: SendMessageDto["content"];
|
|
30
30
|
attachments?: SendMessageDto["attachments"];
|
|
31
|
+
customData?: SendMessageDto["custom_data"];
|
|
31
32
|
}) => Promise<void>;
|
|
32
33
|
private toUserMessage;
|
|
33
34
|
private toBotMessage;
|
|
@@ -243,8 +243,15 @@ export interface WidgetConfig {
|
|
|
243
243
|
/**
|
|
244
244
|
* Dynamic context to be sent with each send-message request from the widget.
|
|
245
245
|
* Useful if you want to send data regarding the current page the user is viewing.
|
|
246
|
+
* @default undefined
|
|
246
247
|
*/
|
|
247
248
|
context?: Record<string, unknown>;
|
|
249
|
+
/**
|
|
250
|
+
* Dynamic custom data to be sent with each contact message.
|
|
251
|
+
* This custom data is intended for human use only; the AI will not see it and it will not affect the AI's response.
|
|
252
|
+
* @default undefined
|
|
253
|
+
*/
|
|
254
|
+
messageCustomData?: Record<string, unknown>;
|
|
248
255
|
/**
|
|
249
256
|
* An apiUrl to override production backend.
|
|
250
257
|
* This is for us to test the widget locally, you don't need to play with this option 😊.
|
|
@@ -8,5 +8,6 @@ export declare function useMessages(): {
|
|
|
8
8
|
sendMessage: (input: {
|
|
9
9
|
content: import('../../core').SendMessageDto["content"];
|
|
10
10
|
attachments?: import('../../core').SendMessageDto["attachments"];
|
|
11
|
+
customData?: import('../../core').SendMessageDto["custom_data"];
|
|
11
12
|
}) => Promise<void>;
|
|
12
13
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import z, { createContext as Ne, useRef as W, useState as Fe, useMemo as Me, useEffect as oe, useContext as Ue, useSyncExternalStore as kt, useLayoutEffect as Jt, useCallback as ve, useDebugValue as Xt } from "react";
|
|
2
2
|
import { v4 as Qt } from "uuid";
|
|
3
3
|
import { jsx as it } from "react/jsx-runtime";
|
|
4
|
-
import { W as Zt } from "./widget.ctx-
|
|
5
|
-
const en = "3.0.
|
|
4
|
+
import { W as Zt } from "./widget.ctx-Br9aZd2F.js";
|
|
5
|
+
const en = "3.0.82";
|
|
6
6
|
class tn {
|
|
7
7
|
constructor(t) {
|
|
8
8
|
this.components = [];
|
|
@@ -1354,4 +1354,4 @@ export {
|
|
|
1354
1354
|
nr as m,
|
|
1355
1355
|
Y as u
|
|
1356
1356
|
};
|
|
1357
|
-
//# sourceMappingURL=useWidgetTrigger-
|
|
1357
|
+
//# sourceMappingURL=useWidgetTrigger-B6FKEL-h.js.map
|