@supergrowthai/engage 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
package/README.md ADDED
@@ -0,0 +1,13 @@
1
+ # SuperGrowthAI/superengage
2
+
3
+ Contributors: adexp
4
+ Tags: recommendation, engagement
5
+
6
+ ### SGAI/superengage make engaging your website content readers with a click of a button.
7
+
8
+ This package is to be used with https://supergrowthai.com/superengage
9
+
10
+ ### Changelog
11
+
12
+ * 0.0.1
13
+ * Beta release of the plugin.
@@ -0,0 +1 @@
1
+ (()=>{"use strict";var e={139:(e,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.baseEmbed=function(e,n,t){var o,r,a,i,d,c=e.createElement("iframe");c.src="javascript:void(0)",c.title=n,c.role="presentation",c.id="".concat(n,"boy"),c.marginWidth="0",c.marginHeight="0",c.vspace="0",c.hspace="0",c.allowtransparency="true",c.scrolling="no",c.allowfullscreen="true",(c.frameElement||c).style.cssText="z-index: 98763 !important;width: 0; height: 0; border: 0;",null===(d=e.getElementById("".concat(n,"-holder")))||void 0===d||d.appendChild(c);try{i=null===(o=c.contentWindow)||void 0===o?void 0:o.document}catch(n){a=e.domain,c.src="javascript:var d=document.open();d.domain='"+a+"';void(0);",i=null===(r=c.contentWindow)||void 0===r?void 0:r.document}if(!i)return void console.log("killed silently - no doc");i.open(),i._l=function(){var o=e.body,r=e.createElement("script");a&&(e.domain=a),r.id="".concat(n,"-iframe-async"),r.src=t,o.appendChild(r)};var l=i.createElement("body");l.onload=function(){null==i||i._l()},i.appendChild(l),i.close()}}},n={};function t(o){var r=n[o];if(void 0!==r)return r.exports;var a=n[o]={exports:{}};return e[o](a,a.exports,t),a.exports}t(139).baseEmbed(document,"engage","".concat("https://unpkg.com/@supergrowthai/engage@0.0.2/dist","/engage.js"))})();
Binary file
package/dist/engage.js ADDED
@@ -0,0 +1 @@
1
+ (()=>{"use strict";var e={402:(e,t,n)=>{n.r(t),n.d(t,{Children:()=>p,Component:()=>r.Component,Fragment:()=>r.Fragment,PureComponent:()=>c,StrictMode:()=>X,Suspense:()=>m,SuspenseList:()=>w,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:()=>W,cloneElement:()=>Y,createContext:()=>r.createContext,createElement:()=>r.createElement,createFactory:()=>G,createPortal:()=>C,createRef:()=>r.createRef,default:()=>ce,findDOMNode:()=>K,flushSync:()=>Z,forwardRef:()=>s,hydrate:()=>T,isElement:()=>oe,isFragment:()=>z,isValidElement:()=>$,lazy:()=>b,memo:()=>a,render:()=>L,startTransition:()=>ee,unmountComponentAtNode:()=>Q,unstable_batchedUpdates:()=>J,useCallback:()=>o.useCallback,useContext:()=>o.useContext,useDebugValue:()=>o.useDebugValue,useDeferredValue:()=>te,useEffect:()=>o.useEffect,useErrorBoundary:()=>o.useErrorBoundary,useId:()=>o.useId,useImperativeHandle:()=>o.useImperativeHandle,useInsertionEffect:()=>re,useLayoutEffect:()=>o.useLayoutEffect,useMemo:()=>o.useMemo,useReducer:()=>o.useReducer,useRef:()=>o.useRef,useState:()=>o.useState,useSyncExternalStore:()=>ie,useTransition:()=>ne,version:()=>q});var r=n(172),o=n(994);function i(e,t){for(var n in t)e[n]=t[n];return e}function u(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var r in t)if("__source"!==r&&e[r]!==t[r])return!0;return!1}function c(e,t){this.props=e,this.context=t}function a(e,t){function n(e){var n=this.props.ref,r=n==e.ref;return!r&&n&&(n.call?n(null):n.current=null),t?!t(this.props,e)||!r:u(this.props,e)}function o(t){return this.shouldComponentUpdate=n,(0,r.createElement)(e,t)}return o.displayName="Memo("+(e.displayName||e.name)+")",o.prototype.isReactComponent=!0,o.__f=!0,o}(c.prototype=new r.Component).isPureReactComponent=!0,c.prototype.shouldComponentUpdate=function(e,t){return u(this.props,e)||u(this.state,t)};var l=r.options.__b;r.options.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),l&&l(e)};var _="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function s(e){function t(t){var n=i({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=_,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var f=function(e,t){return null==e?null:(0,r.toChildArray)((0,r.toChildArray)(e).map(t))},p={map:f,forEach:f,count:function(e){return e?(0,r.toChildArray)(e).length:0},only:function(e){var t=(0,r.toChildArray)(e);if(1!==t.length)throw"Children.only";return t[0]},toArray:r.toChildArray},d=r.options.__e;r.options.__e=function(e,t,n,r){if(e.then)for(var o,i=t;i=i.__;)if((o=i.__c)&&o.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),o.__c(e,t);d(e,t,n,r)};var h=r.options.unmount;function v(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach((function(e){"function"==typeof e.__c&&e.__c()})),e.__c.__H=null),null!=(e=i({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map((function(e){return v(e,t,n)}))),e}function y(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map((function(e){return y(e,t,n)})),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function m(){this.__u=0,this.t=null,this.__b=null}function g(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function b(e){var t,n,o;function i(i){if(t||(t=e()).then((function(e){n=e.default||e}),(function(e){o=e})),o)throw o;if(!n)throw t;return(0,r.createElement)(n,i)}return i.displayName="Lazy",i.__f=!0,i}function w(){this.u=null,this.o=null}r.options.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),h&&h(e)},(m.prototype=new r.Component).__c=function(e,t){var n=t.__c,r=this;null==r.t&&(r.t=[]),r.t.push(n);var o=g(r.__v),i=!1,u=function(){i||(i=!0,n.__R=null,o?o(c):c())};n.__R=u;var c=function(){if(! --r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=y(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.t.pop();)t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(u,u)},m.prototype.componentWillUnmount=function(){this.t=[]},m.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=v(this.__b,n,o.__O=o.__P)}this.__b=null}var i=t.__a&&(0,r.createElement)(r.Fragment,null,e.fallback);return i&&(i.__u&=-33),[(0,r.createElement)(r.Fragment,null,t.__a?null:e.children),i]};var E=function(e,t,n){if(++n[1]===n[0]&&e.o.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.o.size))for(n=e.u;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.u=n=n[2]}};function k(e){return this.getChildContext=function(){return e.context},e.children}function S(e){var t=this,n=e.i;t.componentWillUnmount=function(){(0,r.render)(null,t.l),t.l=null,t.i=null},t.i&&t.i!==n&&t.componentWillUnmount(),t.l||(t.i=n,t.l={nodeType:1,parentNode:n,childNodes:[],appendChild:function(e){this.childNodes.push(e),t.i.appendChild(e)},insertBefore:function(e,n){this.childNodes.push(e),t.i.appendChild(e)},removeChild:function(e){this.childNodes.splice(this.childNodes.indexOf(e)>>>1,1),t.i.removeChild(e)}}),(0,r.render)((0,r.createElement)(k,{context:t.context},e.__v),t.l)}function C(e,t){var n=(0,r.createElement)(S,{__v:e,i:t});return n.containerInfo=t,n}(w.prototype=new r.Component).__a=function(e){var t=this,n=g(t.__v),r=t.o.get(e);return r[0]++,function(o){var i=function(){t.props.revealOrder?(r.push(o),E(t,e,r)):o()};n?n(i):i()}},w.prototype.render=function(e){this.u=null,this.o=new Map;var t=(0,r.toChildArray)(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.o.set(t[n],this.u=[1,0,this.u]);return e.children},w.prototype.componentDidUpdate=w.prototype.componentDidMount=function(){var e=this;this.o.forEach((function(t,n){E(e,n,t)}))};var O="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,P=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,x=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,I=/[A-Z0-9]/g,R="undefined"!=typeof document,N=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};function L(e,t,n){return null==t.__k&&(t.textContent=""),(0,r.render)(e,t),"function"==typeof n&&n(),e?e.__c:null}function T(e,t,n){return(0,r.hydrate)(e,t),"function"==typeof n&&n(),e?e.__c:null}r.Component.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach((function(e){Object.defineProperty(r.Component.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})}));var j=r.options.event;function A(){}function U(){return this.cancelBubble}function D(){return this.defaultPrevented}r.options.event=function(e){return j&&(e=j(e)),e.persist=A,e.isPropagationStopped=U,e.isDefaultPrevented=D,e.nativeEvent=e};var H,M={enumerable:!1,configurable:!0,get:function(){return this.class}},F=r.options.vnode;r.options.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,o={};for(var i in t){var u=t[i];if(!("value"===i&&"defaultValue"in t&&null==u||R&&"children"===i&&"noscript"===n||"class"===i||"className"===i)){var c=i.toLowerCase();"defaultValue"===i&&"value"in t&&null==t.value?i="value":"download"===i&&!0===u?u="":"translate"===c&&"no"===u?u=!1:"ondoubleclick"===c?i="ondblclick":"onchange"!==c||"input"!==n&&"textarea"!==n||N(t.type)?"onfocus"===c?i="onfocusin":"onblur"===c?i="onfocusout":x.test(i)?i=c:-1===n.indexOf("-")&&P.test(i)?i=i.replace(I,"-$&").toLowerCase():null===u&&(u=void 0):c=i="oninput","oninput"===c&&o[i=c]&&(i="oninputCapture"),o[i]=u}}"select"==n&&o.multiple&&Array.isArray(o.value)&&(o.value=(0,r.toChildArray)(t.children).forEach((function(e){e.props.selected=-1!=o.value.indexOf(e.props.value)}))),"select"==n&&null!=o.defaultValue&&(o.value=(0,r.toChildArray)(t.children).forEach((function(e){e.props.selected=o.multiple?-1!=o.defaultValue.indexOf(e.props.value):o.defaultValue==e.props.value}))),t.class&&!t.className?(o.class=t.class,Object.defineProperty(o,"className",M)):(t.className&&!t.class||t.class&&t.className)&&(o.class=o.className=t.className),e.props=o}(e),e.$$typeof=O,F&&F(e)};var B=r.options.__r;r.options.__r=function(e){B&&B(e),H=e.__c};var V=r.options.diffed;r.options.diffed=function(e){V&&V(e);var t=e.props,n=e.__e;null!=n&&"textarea"===e.type&&"value"in t&&t.value!==n.value&&(n.value=null==t.value?"":t.value),H=null};var W={ReactCurrentDispatcher:{current:{readContext:function(e){return H.__n[e.__c].props.value}}}},q="17.0.2";function G(e){return r.createElement.bind(null,e)}function $(e){return!!e&&e.$$typeof===O}function z(e){return $(e)&&e.type===r.Fragment}function Y(e){return $(e)?r.cloneElement.apply(null,arguments):e}function Q(e){return!!e.__k&&((0,r.render)(null,e),!0)}function K(e){return e&&(e.base||1===e.nodeType&&e)||null}var J=function(e,t){return e(t)},Z=function(e,t){return e(t)},X=r.Fragment;function ee(e){e()}function te(e){return e}function ne(){return[!1,ee]}var re=o.useLayoutEffect,oe=$;function ie(e,t){var n=t(),r=(0,o.useState)({h:{__:n,v:t}}),i=r[0].h,u=r[1];return(0,o.useLayoutEffect)((function(){i.__=n,i.v=t,ue(i)&&u({h:i})}),[e,n,t]),(0,o.useEffect)((function(){return ue(i)&&u({h:i}),e((function(){ue(i)&&u({h:i})}))}),[e]),n}function ue(e){var t,n,r=e.v,o=e.__;try{var i=r();return!((t=o)===(n=i)&&(0!==t||1/t==1/n)||t!=t&&n!=n)}catch(e){return!0}}var ce={useState:o.useState,useId:o.useId,useReducer:o.useReducer,useEffect:o.useEffect,useLayoutEffect:o.useLayoutEffect,useInsertionEffect:re,useTransition:ne,useDeferredValue:te,useSyncExternalStore:ie,startTransition:ee,useRef:o.useRef,useImperativeHandle:o.useImperativeHandle,useMemo:o.useMemo,useCallback:o.useCallback,useContext:o.useContext,useDebugValue:o.useDebugValue,version:"17.0.2",Children:p,render:L,hydrate:T,unmountComponentAtNode:Q,createPortal:C,createElement:r.createElement,createContext:r.createContext,createFactory:G,cloneElement:Y,createRef:r.createRef,Fragment:r.Fragment,isValidElement:$,isElement:oe,isFragment:z,findDOMNode:K,Component:r.Component,PureComponent:c,memo:a,forwardRef:s,flushSync:Z,unstable_batchedUpdates:J,StrictMode:X,Suspense:m,SuspenseList:w,lazy:b,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:W}},172:(e,t,n)=>{n.r(t),n.d(t,{Component:()=>E,Fragment:()=>w,cloneElement:()=>G,createContext:()=>$,createElement:()=>m,createRef:()=>b,h:()=>m,hydrate:()=>q,isValidElement:()=>u,options:()=>o,render:()=>W,toChildArray:()=>N});var r,o,i,u,c,a,l,_,s,f={},p=[],d=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,h=Array.isArray;function v(e,t){for(var n in t)e[n]=t[n];return e}function y(e){var t=e.parentNode;t&&t.removeChild(e)}function m(e,t,n){var o,i,u,c={};for(u in t)"key"==u?o=t[u]:"ref"==u?i=t[u]:c[u]=t[u];if(arguments.length>2&&(c.children=arguments.length>3?r.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(u in e.defaultProps)void 0===c[u]&&(c[u]=e.defaultProps[u]);return g(e,c,o,i,null)}function g(e,t,n,r,u){var c={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==u?++i:u,__i:-1,__u:0};return null==u&&null!=o.vnode&&o.vnode(c),c}function b(){return{current:null}}function w(e){return e.children}function E(e,t){this.props=e,this.context=t}function k(e,t){if(null==t)return e.__?k(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?k(e):null}function S(e,t,n){var r,i=e.__v,u=i.__e,c=e.__P;if(c)return(r=v({},i)).__v=i.__v+1,o.vnode&&o.vnode(r),D(c,r,i,e.__n,void 0!==c.ownerSVGElement,32&i.__u?[u]:null,t,null==u?k(i):u,!!(32&i.__u),n),r.__v=i.__v,r.__.__k[r.__i]=r,r.__d=void 0,r.__e!=u&&C(r),r}function C(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return C(e)}}function O(e){(!e.__d&&(e.__d=!0)&&c.push(e)&&!P.__r++||a!==o.debounceRendering)&&((a=o.debounceRendering)||l)(P)}function P(){var e,t,n,r=[],i=[];for(c.sort(_);e=c.shift();)e.__d&&(n=c.length,t=S(e,r,i)||t,0===n||c.length>n?(H(r,t,i),i.length=r.length=0,t=void 0,c.sort(_)):t&&o.__c&&o.__c(t,p));t&&H(r,t,i),P.__r=0}function x(e,t,n,r,o,i,u,c,a,l,_){var s,d,h,v,y,m=r&&r.__k||p,g=t.length;for(n.__d=a,I(n,t,m),a=n.__d,s=0;s<g;s++)null!=(h=n.__k[s])&&"boolean"!=typeof h&&"function"!=typeof h&&(d=-1===h.__i?f:m[h.__i]||f,h.__i=s,D(e,h,d,o,i,u,c,a,l,_),v=h.__e,h.ref&&d.ref!=h.ref&&(d.ref&&F(d.ref,null,h),_.push(h.ref,h.__c||v,h)),null==y&&null!=v&&(y=v),65536&h.__u||d.__k===h.__k?a=R(h,a,e):"function"==typeof h.type&&void 0!==h.__d?a=h.__d:v&&(a=v.nextSibling),h.__d=void 0,h.__u&=-196609);n.__d=a,n.__e=y}function I(e,t,n){var r,o,i,u,c,a=t.length,l=n.length,_=l,s=0;for(e.__k=[],r=0;r<a;r++)u=r+s,null!=(o=e.__k[r]=null==(o=t[r])||"boolean"==typeof o||"function"==typeof o?null:"string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?g(null,o,null,null,null):h(o)?g(w,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?g(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o)?(o.__=e,o.__b=e.__b+1,c=L(o,n,u,_),o.__i=c,i=null,-1!==c&&(_--,(i=n[c])&&(i.__u|=131072)),null==i||null===i.__v?(-1==c&&s--,"function"!=typeof o.type&&(o.__u|=65536)):c!==u&&(c===u+1?s++:c>u?_>a-u?s+=c-u:s--:c<u?c==u-1&&(s=c-u):s=0,c!==r+s&&(o.__u|=65536))):(i=n[u])&&null==i.key&&i.__e&&!(131072&i.__u)&&(i.__e==e.__d&&(e.__d=k(i)),B(i,i,!1),n[u]=null,_--);if(_)for(r=0;r<l;r++)null!=(i=n[r])&&!(131072&i.__u)&&(i.__e==e.__d&&(e.__d=k(i)),B(i,i))}function R(e,t,n){var r,o;if("function"==typeof e.type){for(r=e.__k,o=0;r&&o<r.length;o++)r[o]&&(r[o].__=e,t=R(r[o],t,n));return t}e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8===t.nodeType);return t}function N(e,t){return t=t||[],null==e||"boolean"==typeof e||(h(e)?e.some((function(e){N(e,t)})):t.push(e)),t}function L(e,t,n,r){var o=e.key,i=e.type,u=n-1,c=n+1,a=t[n];if(null===a||a&&o==a.key&&i===a.type&&!(131072&a.__u))return n;if(r>(null==a||131072&a.__u?0:1))for(;u>=0||c<t.length;){if(u>=0){if((a=t[u])&&!(131072&a.__u)&&o==a.key&&i===a.type)return u;u--}if(c<t.length){if((a=t[c])&&!(131072&a.__u)&&o==a.key&&i===a.type)return c;c++}}return-1}function T(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||d.test(t)?n:n+"px"}function j(e,t,n,r,o){var i;e:if("style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||T(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||T(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])i=t!==(t=t.replace(/(PointerCapture)$|Capture$/i,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r?n.u=r.u:(n.u=Date.now(),e.addEventListener(t,i?U:A,i)):e.removeEventListener(t,i?U:A,i);else{if(o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==t&&"height"!==t&&"href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&"rowSpan"!==t&&"colSpan"!==t&&"role"!==t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,n))}}function A(e){if(this.l){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(o.event?o.event(e):e)}}function U(e){if(this.l)return this.l[e.type+!0](o.event?o.event(e):e)}function D(e,t,n,r,i,u,c,a,l,_){var s,f,p,d,y,m,g,b,k,S,C,O,P,I,R,N=t.type;if(void 0!==t.constructor)return null;128&n.__u&&(l=!!(32&n.__u),u=[a=t.__e=n.__e]),(s=o.__b)&&s(t);e:if("function"==typeof N)try{if(b=t.props,k=(s=N.contextType)&&r[s.__c],S=s?k?k.props.value:s.__:r,n.__c?g=(f=t.__c=n.__c).__=f.__E:("prototype"in N&&N.prototype.render?t.__c=f=new N(b,S):(t.__c=f=new E(b,S),f.constructor=N,f.render=V),k&&k.sub(f),f.props=b,f.state||(f.state={}),f.context=S,f.__n=r,p=f.__d=!0,f.__h=[],f._sb=[]),null==f.__s&&(f.__s=f.state),null!=N.getDerivedStateFromProps&&(f.__s==f.state&&(f.__s=v({},f.__s)),v(f.__s,N.getDerivedStateFromProps(b,f.__s))),d=f.props,y=f.state,f.__v=t,p)null==N.getDerivedStateFromProps&&null!=f.componentWillMount&&f.componentWillMount(),null!=f.componentDidMount&&f.__h.push(f.componentDidMount);else{if(null==N.getDerivedStateFromProps&&b!==d&&null!=f.componentWillReceiveProps&&f.componentWillReceiveProps(b,S),!f.__e&&(null!=f.shouldComponentUpdate&&!1===f.shouldComponentUpdate(b,f.__s,S)||t.__v===n.__v)){for(t.__v!==n.__v&&(f.props=b,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach((function(e){e&&(e.__=t)})),C=0;C<f._sb.length;C++)f.__h.push(f._sb[C]);f._sb=[],f.__h.length&&c.push(f);break e}null!=f.componentWillUpdate&&f.componentWillUpdate(b,f.__s,S),null!=f.componentDidUpdate&&f.__h.push((function(){f.componentDidUpdate(d,y,m)}))}if(f.context=S,f.props=b,f.__P=e,f.__e=!1,O=o.__r,P=0,"prototype"in N&&N.prototype.render){for(f.state=f.__s,f.__d=!1,O&&O(t),s=f.render(f.props,f.state,f.context),I=0;I<f._sb.length;I++)f.__h.push(f._sb[I]);f._sb=[]}else do{f.__d=!1,O&&O(t),s=f.render(f.props,f.state,f.context),f.state=f.__s}while(f.__d&&++P<25);f.state=f.__s,null!=f.getChildContext&&(r=v(v({},r),f.getChildContext())),p||null==f.getSnapshotBeforeUpdate||(m=f.getSnapshotBeforeUpdate(d,y)),x(e,h(R=null!=s&&s.type===w&&null==s.key?s.props.children:s)?R:[R],t,n,r,i,u,c,a,l,_),f.base=t.__e,t.__u&=-161,f.__h.length&&c.push(f),g&&(f.__E=f.__=null)}catch(e){t.__v=null,l||null!=u?(t.__e=a,t.__u|=l?160:32,u[u.indexOf(a)]=null):(t.__e=n.__e,t.__k=n.__k),o.__e(e,t,n)}else null==u&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=M(n.__e,t,n,r,i,u,c,l,_);(s=o.diffed)&&s(t)}function H(e,t,n){for(var r=0;r<n.length;r++)F(n[r],n[++r],n[++r]);o.__c&&o.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){o.__e(e,t.__v)}}))}function M(e,t,n,o,i,u,c,a,l){var _,s,p,d,v,m,g,b=n.props,w=t.props,E=t.type;if("svg"===E&&(i=!0),null!=u)for(_=0;_<u.length;_++)if((v=u[_])&&"setAttribute"in v==!!E&&(E?v.localName===E:3===v.nodeType)){e=v,u[_]=null;break}if(null==e){if(null===E)return document.createTextNode(w);e=i?document.createElementNS("http://www.w3.org/2000/svg",E):document.createElement(E,w.is&&w),u=null,a=!1}if(null===E)b===w||a&&e.data===w||(e.data=w);else{if(u=u&&r.call(e.childNodes),b=n.props||f,!a&&null!=u)for(b={},_=0;_<e.attributes.length;_++)b[(v=e.attributes[_]).name]=v.value;for(_ in b)v=b[_],"children"==_||("dangerouslySetInnerHTML"==_?p=v:"key"===_||_ in w||j(e,_,null,v,i));for(_ in w)v=w[_],"children"==_?d=v:"dangerouslySetInnerHTML"==_?s=v:"value"==_?m=v:"checked"==_?g=v:"key"===_||a&&"function"!=typeof v||b[_]===v||j(e,_,v,b[_],i);if(s)a||p&&(s.__html===p.__html||s.__html===e.innerHTML)||(e.innerHTML=s.__html),t.__k=[];else if(p&&(e.innerHTML=""),x(e,h(d)?d:[d],t,n,o,i&&"foreignObject"!==E,u,c,u?u[0]:n.__k&&k(n,0),a,l),null!=u)for(_=u.length;_--;)null!=u[_]&&y(u[_]);a||(_="value",void 0!==m&&(m!==e[_]||"progress"===E&&!m||"option"===E&&m!==b[_])&&j(e,_,m,b[_],!1),_="checked",void 0!==g&&g!==e[_]&&j(e,_,g,b[_],!1))}return e}function F(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){o.__e(e,n)}}function B(e,t,n){var r,i;if(o.unmount&&o.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||F(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){o.__e(e,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&B(r[i],t,n||"function"!=typeof e.type);n||null==e.__e||y(e.__e),e.__=e.__e=e.__d=void 0}function V(e,t,n){return this.constructor(e,n)}function W(e,t,n){var i,u,c,a;o.__&&o.__(e,t),u=(i="function"==typeof n)?null:n&&n.__k||t.__k,c=[],a=[],D(t,e=(!i&&n||t).__k=m(w,null,[e]),u||f,f,void 0!==t.ownerSVGElement,!i&&n?[n]:u?null:t.firstChild?r.call(t.childNodes):null,c,!i&&n?n:u?u.__e:t.firstChild,i,a),e.__d=void 0,H(c,e,a)}function q(e,t){W(e,t,q)}function G(e,t,n){var o,i,u,c,a=v({},e.props);for(u in e.type&&e.type.defaultProps&&(c=e.type.defaultProps),t)"key"==u?o=t[u]:"ref"==u?i=t[u]:a[u]=void 0===t[u]&&void 0!==c?c[u]:t[u];return arguments.length>2&&(a.children=arguments.length>3?r.call(arguments,2):n),g(e.type,a,o||e.key,i||e.ref,null)}function $(e,t){var n={__c:t="__cC"+s++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var n,r;return this.getChildContext||(n=[],(r={})[t]=this,this.getChildContext=function(){return r},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&n.some((function(e){e.__e=!0,O(e)}))},this.sub=function(e){n.push(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n.splice(n.indexOf(e),1),t&&t.call(e)}}),e.children}};return n.Provider.__=n.Consumer.contextType=n}r=p.slice,o={__e:function(e,t,n,r){for(var o,i,u;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&null!=i.getDerivedStateFromError&&(o.setState(i.getDerivedStateFromError(e)),u=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(e,r||{}),u=o.__d),u)return o.__E=o}catch(t){e=t}throw e}},i=0,u=function(e){return null!=e&&null==e.constructor},E.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=v({},this.state),"function"==typeof e&&(e=e(v({},n),this.props)),e&&v(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),O(this))},E.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),O(this))},E.prototype.render=w,c=[],l="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,_=function(e,t){return e.__v.__b-t.__v.__b},P.__r=0,s=0},994:(e,t,n)=>{n.r(t),n.d(t,{useCallback:()=>O,useContext:()=>P,useDebugValue:()=>x,useEffect:()=>w,useErrorBoundary:()=>I,useId:()=>R,useImperativeHandle:()=>S,useLayoutEffect:()=>E,useMemo:()=>C,useReducer:()=>b,useRef:()=>k,useState:()=>g});var r,o,i,u,c=n(172),a=0,l=[],_=[],s=c.options,f=s.__b,p=s.__r,d=s.diffed,h=s.__c,v=s.unmount,y=s.__;function m(e,t){s.__h&&s.__h(o,e,a||t),a=0;var n=o.__H||(o.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:_}),n.__[e]}function g(e){return a=1,b(D,e)}function b(e,t,n){var i=m(r++,2);if(i.t=e,!i.__c&&(i.__=[n?n(t):D(void 0,t),function(e){var t=i.__N?i.__N[0]:i.__[0],n=i.t(t,e);t!==n&&(i.__N=[n,i.__[1]],i.__c.setState({}))}],i.__c=o,!o.u)){var u=function(e,t,n){if(!i.__c.__H)return!0;var r=i.__c.__H.__.filter((function(e){return!!e.__c}));if(r.every((function(e){return!e.__N})))return!c||c.call(this,e,t,n);var o=!1;return r.forEach((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}})),!(!o&&i.__c.props===e)&&(!c||c.call(this,e,t,n))};o.u=!0;var c=o.shouldComponentUpdate,a=o.componentWillUpdate;o.componentWillUpdate=function(e,t,n){if(this.__e){var r=c;c=void 0,u(e,t,n),c=r}a&&a.call(this,e,t,n)},o.shouldComponentUpdate=u}return i.__N||i.__}function w(e,t){var n=m(r++,3);!s.__s&&U(n.__H,t)&&(n.__=e,n.i=t,o.__H.__h.push(n))}function E(e,t){var n=m(r++,4);!s.__s&&U(n.__H,t)&&(n.__=e,n.i=t,o.__h.push(n))}function k(e){return a=5,C((function(){return{current:e}}),[])}function S(e,t,n){a=6,E((function(){return"function"==typeof e?(e(t()),function(){return e(null)}):e?(e.current=t(),function(){return e.current=null}):void 0}),null==n?n:n.concat(e))}function C(e,t){var n=m(r++,7);return U(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function O(e,t){return a=8,C((function(){return e}),t)}function P(e){var t=o.context[e.__c],n=m(r++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(o)),t.props.value):e.__}function x(e,t){s.useDebugValue&&s.useDebugValue(t?t(e):e)}function I(e){var t=m(r++,10),n=g();return t.__=e,o.componentDidCatch||(o.componentDidCatch=function(e,r){t.__&&t.__(e,r),n[1](e)}),[n[0],function(){n[1](void 0)}]}function R(){var e=m(r++,11);if(!e.__){for(var t=o.__v;null!==t&&!t.__m&&null!==t.__;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__}function N(){for(var e;e=l.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(j),e.__H.__h.forEach(A),e.__H.__h=[]}catch(t){e.__H.__h=[],s.__e(t,e.__v)}}s.__b=function(e){o=null,f&&f(e)},s.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),y&&y(e,t)},s.__r=function(e){p&&p(e),r=0;var t=(o=e.__c).__H;t&&(i===o?(t.__h=[],o.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.__V=_,e.__N=e.i=void 0}))):(t.__h.forEach(j),t.__h.forEach(A),t.__h=[],r=0)),i=o},s.diffed=function(e){d&&d(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==l.push(t)&&u===s.requestAnimationFrame||((u=s.requestAnimationFrame)||T)(N)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.__V!==_&&(e.__=e.__V),e.i=void 0,e.__V=_}))),i=o=null},s.__c=function(e,t){t.some((function(e){try{e.__h.forEach(j),e.__h=e.__h.filter((function(e){return!e.__||A(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],s.__e(n,e.__v)}})),h&&h(e,t)},s.unmount=function(e){v&&v(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach((function(e){try{j(e)}catch(e){t=e}})),n.__H=void 0,t&&s.__e(t,n.__v))};var L="function"==typeof requestAnimationFrame;function T(e){var t,n=function(){clearTimeout(r),L&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);L&&(t=requestAnimationFrame(n))}function j(e){var t=o,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),o=t}function A(e){var t=o;e.__c=e.__(),o=t}function U(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function D(e,t){return"function"==typeof t?t(e):t}},386:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});var r=n(214),o=function(){function e(e){void 0===e&&(e=function(e){return e}),this.config=e}return e.prototype.customFetcher=function(e,t){return void 0===t&&(t={}),(0,r.fetcher)(e,this.config(t))},e.prototype.completeUrl=function(e){return 0===e.indexOf("https://dashboard.supergrowthai.com")?e:"".concat("https://dashboard.supergrowthai.com").concat(e)},e.prototype.post=function(e,t){return this.customFetcher(this.completeUrl(e),{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json"}})},e.prototype.build=function(){var e=this;return{common:{validateKey:function(t){return e.post("/api/client/common/validate-key",{user:t})}},chet:{validateKey:function(t,n){return e.post("/api/client/validate-key",{key:t,user:n})},chat:function(e,t){return this.post("/api/client/chet",{key:e,prompts:t,client_time:(new Date).toString()})}},engage:{validateKey:function(t,n){return e.post("/api/client/service/engage/v1/validate-key",{key:t,user:n})},ping:function(t){return e.post("/api/client/service/engage/v1/ping",t)},track:function(t){return e.post("/api/client/service/engage/v1/track",t)}}}},e}();t.default=o},214:function(e,t,n){var r,o=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},i.apply(this,arguments)},u=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function u(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,c)}a((r=r.apply(e,t||[])).next())}))},c=this&&this.__generator||function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return u.next=c(0),u.throw=c(1),u.return=c(2),"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function c(c){return function(a){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;u&&(u=0,c[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}};function a(e,r){return u(this,void 0,void 0,(function(){var o,u,a,l,s,f,p,d,h,v,y,m,g,b,w,E,k,S,C,O,P,x,I,R,N,L,T,j,A;return c(this,(function(c){switch(c.label){case 0:return o=null==r?void 0:r.request,u=null==r?void 0:r.response,a=null==r?void 0:r.headers,l=null==r?void 0:r.body,s=(null==r?void 0:r.method)||"GET",f=null==r?void 0:r.token,p=null!=(null==r?void 0:r.dontBreak)&&(null==r?void 0:r.dontBreak),d=!!(null==r?void 0:r.debug),h=(null==r?void 0:r.credentials)||"include",v=(null==o?void 0:o.headers["x-forwarded-for"])||(null===(N=null==o?void 0:o.connection)||void 0===N?void 0:N.remoteAddress),y=(0,t.cookiesUnscramble)(o),m=y.country,g=new URL("https://abc.com".concat((null==o?void 0:o.url)||"/")),b=f||(null===(L=null==o?void 0:o.session)||void 0===L?void 0:L.token)||g.searchParams.get("access_token")||g.searchParams.get("auth_token")||y.token||null,w=null==o?void 0:o.headers["user-agent"],E=null==o?void 0:o.headers.referer,k=Object.assign({"Content-Type":"application/json"},v?{"X-forwarded-for":v}:{},a||{},b?{Authorization:"Bearer ".concat(b)}:{},w?{"User-Agent":w}:{},E?{Referer:E}:{},y?{Cookie:(null===(T=null==o?void 0:o.headers)||void 0===T?void 0:T.cookie)||(null===(A=null===(j=null===n.g||void 0===n.g?void 0:n.g.window)||void 0===j?void 0:j.document)||void 0===A?void 0:A.cookie)}:{}),S=new URLSearchParams(Object.assign({},(null==r?void 0:r.queryParams)||{},m?{country:m}:{})).toString(),C=e.split("?"),O=S?(C[1]||"")+"&"+S:C[1],[4,fetch(O?"".concat(C[0],"?").concat(O):C[0],i(i({mode:"cors",credentials:h,headers:k},l?{body:l}:{}),s?{method:s}:{}))];case 1:if(P=c.sent(),[401,403].includes(P.status)&&!p)throw new _;return[4,P.json()];case 2:return x=c.sent(),I=P.headers.raw?P.headers.raw():P.headers,d&&console.log("\n REQUEST:\n ".concat(s," ").concat(e,"\n RESPONSE:\n ").concat(JSON.stringify(x),"\n ")),I["set-cookie"]&&(R=[],I["set-cookie"].forEach((function(e){var t=e.split(";");t[0]&&(t[0].split("=")[1]&&R.push(e))})),null==u||u.setHeader("set-cookie",R)),[2,x]}}))}))}Object.defineProperty(t,"__esModule",{value:!0}),t.fetcher=t.cookiesScramble=t.cookiesUnscramble=t.UnAuthorized=t.BaseError=void 0;var l=function(e){function t(t,n,r){var o=e.call(this,n)||this;return o.code=t,o.payload=r,o}return o(t,e),t}(Error);t.BaseError=l;var _=function(e){function t(){return e.call(this,403,"Unauthorized")||this}return o(t,e),t}(l);t.UnAuthorized=_;t.cookiesUnscramble=function(e){var t,r,o,i;if(!e)return{};var u={};return((null===(i=(null===(t=e.headers)||void 0===t?void 0:t.cookie)||(null===(o=null===(r=null===n.g||void 0===n.g?void 0:n.g.window)||void 0===r?void 0:r.document)||void 0===o?void 0:o.cookie))||void 0===i?void 0:i.split(";"))||[]).forEach((function(e){var t=e.split("=");t[1]&&(u[t[0].trim().toLowerCase()]=t[1].trim())})),u};t.cookiesScramble=function(e,t){return void 0===t&&(t=[]),Object.keys(e).filter((function(e){return!t.includes(e)})).map((function(t){return t+"="+e[t]})).join("; ")+";"},t.fetcher=a,t.default=a},810:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function u(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,c)}a((r=r.apply(e,t||[])).next())}))},r=this&&this.__generator||function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return u.next=c(0),u.throw=c(1),u.return=c(2),"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function c(c){return function(a){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;u&&(u=0,c[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.baseInit=function(e,t,n){e[t]=n},t.baseApplyCommands=function(e,t){return n(this,void 0,void 0,(function(){var n,o,i,u,c;return r(this,(function(r){switch(r.label){case 0:n=e,e.parent!==e&&document.getElementById("".concat(t,"-iframe-async"))&&(n=e.parent),n[n["".concat(t,"Object")]]=n[n["".concat(t,"Object")]]||[],o=n[n["".concat(t,"Object")]].q,i=e[t],o=o||[],r.label=1;case 1:return o.length?(u=o.shift(),c=u.shift(),[4,i[c].apply(i,u)]):[3,3];case 2:return r.sent(),[3,1];case 3:return o.push=function(e){var t=e.shift();i[t].apply(i,e)},[2]}}))}))}},223:function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=n(172),i=r(n(962)),u=n(128),c=function(){function e(){this.domIsReady=!1,this.queue=[],this.onDomReadyBound=this.onDomReady.bind(this)}return e.prototype.onDomReady=function(){this.domIsReady=!0;for(var e=0;e<this.queue.length;e++)document.dispatchEvent(this.queue[e]);this.queue=[]},e.prototype.init=function(){var e,t,n=document.createElement("div"),r=n;(null===(e=this.config)||void 0===e?void 0:e.container)?(r=document.getElementById(null===(t=this.config)||void 0===t?void 0:t.container))||(console.error("No element found with id passed in chetConfig.container"),r=n,document.body.appendChild(n)):(console.error("No container passed in chetConfig.container"),document.body.appendChild(n)),(0,o.render)((0,o.h)(i.default,null,(0,o.h)(u.BaseProvider,{onReady:this.onDomReadyBound},(0,o.h)(this.Service,null))),r)},e.prototype.Service=function(e){return(0,o.h)(o.Fragment,null)},e.prototype.dispatchOrQueueEvent=function(e){this.domIsReady?document.dispatchEvent(e):this.queue.push(e)},e.prototype.setConfig=function(e){console.debug("Service Configured"),this.config=e,this.setServiceConfig(this.config),this.domIsReady=!1,this.queue.push(new CustomEvent("setConfig",{detail:{config:this.config}})),this.init()},e.prototype.setServiceConfig=function(e){},e.prototype.setEventListener=function(e){this.dispatchOrQueueEvent(new CustomEvent("setEventListener",{detail:{eventListener:e}}))},e.prototype.setAccountHandler=function(e){this.dispatchOrQueueEvent(new CustomEvent("setAccountHandler",{detail:{accountHandler:e}}))},e.prototype.action=function(e){this.dispatchOrQueueEvent(new CustomEvent("action",{detail:e}))},e}();t.default=c},128:function(e,t,n){var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},r.apply(this,arguments)},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.useBase=t.State=void 0,t.BaseProvider=function(e){var t=e.onReady,n=e.LoaderScreen,o=e.children,f=(0,a.useState)(null),p=f[0],d=f[1],h=(0,a.useState)({user:{me:void 0,cMe:void 0}}),v=h[0],y=h[1],m=(0,a.useState)(null),g=m[0],b=m[1],w=(0,c.useMemo)((function(){return new _.default((function(e){return r(r({},e),{credentials:"omit",token:g})})).build()}),[g]),E=(0,a.useState)({eventListener:null,accountHandler:null}),k=E[0],S=E[1],C=(0,a.useState)(i.NONE),O=C[0],P=C[1];(0,a.useEffect)((function(){var e=function(e){!function(e){d(e)}(e.detail.config)},n=function(e){!function(e){S((function(t){return r(r({},t),{eventListener:e})}))}(e.detail.eventListener)},o=function(e){!function(e){S((function(t){return r(r({},t),{accountHandler:e})}));var t=e.getId();y((function(e){return r(r({},e),{user:r(r({},e.user),{cMe:t})})}))}(e.detail.accountHandler)};return document.addEventListener("setConfig",e),document.addEventListener("setEventListener",n),document.addEventListener("setAccountHandler",o),t(),function(){document.removeEventListener("setConfig",e),document.removeEventListener("setEventListener",n),document.removeEventListener("setAccountHandler",o)}}),[]),(0,a.useEffect)((function(){var e=localStorage.getItem("sgai#common#me");e||(e=(0,l.default)(),localStorage.setItem("sgai#common#me",e)),y((function(t){return r(r({},t),{user:r(r({},t.user),{me:e})})}))}),[]),(0,a.useEffect)((function(){var e=localStorage.getItem("sgai#common#token");e&&b(e)}),[]),(0,a.useEffect)((function(){!v.user.me||!p||O>i.INITIALISING||(P(i.INITIALISING),w.common.validateKey(v.user.me).then((function(e){return 0===e.code?Promise.resolve(e):Promise.reject(e)})).then((function(e){var t;return(null===(t=null==e?void 0:e.payload)||void 0===t?void 0:t.token)&&(localStorage.setItem("sgai#common#token",e.payload.token),b(e.payload.token)),e})).then((function(){return P(i.READY)})).catch((function(e){return console.error(e),P(i.ERROR)})))}),[w,v,p]);var x={config:p,listeners:k,metadata:v,setState:P,state:O,network:w};return(0,u.h)(s.Provider,{value:x},O<=i.INITIALISING&&n&&(0,u.h)(n,null),O>=i.READY&&o)};var i,u=n(172),c=n(402),a=n(994),l=o(n(919)),_=o(n(386)),s=(0,u.createContext)(null);!function(e){e[e.NONE=0]="NONE",e[e.INITIALISING=1]="INITIALISING",e[e.ERROR=2]="ERROR",e[e.READY=3]="READY"}(i||(t.State=i={}));t.useBase=function(){return(0,a.useContext)(s)}},962:function(e,t,n){var r,o=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.componentDidCatch=function(e,t){console.error("Error caught by ErrorBoundary:",e,t)},t.prototype.render=function(){return this.props.children},t}(n(172).Component);t.default=i},919:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){return Math.random().toString(20).substring(4,10)+Math.random().toString(20).substring(9,15)}},224:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function u(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,c)}a((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return u.next=c(0),u.throw=c(1),u.return=c(2),"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function c(c){return function(a){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;u&&(u=0,c[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){var e=(0,i.useBase)(),t=(0,u.useRef)(null),n=(0,u.useRef)(null),l=(0,c.useMemo)((function(){var n=new a.EngagementTracker(e.network,e.config.project_id,e.metadata.user.me);return t.current=n,n}),[e.metadata.user.me,e.network,e.config.project_id]);function _(){return r(this,void 0,void 0,(function(){var e,t;return o(this,(function(r){switch(r.label){case 0:return(null===window||void 0===window?void 0:window.location)?(e=function(e){try{var t=new URL(e),n=t.pathname.replace(/\/$/,""),r=new URLSearchParams(t.search),o=Array.from(r.entries()).sort((function(e,t){var n=e[0],r=t[0];return n.localeCompare(r)})),i=o.filter((function(e){var t=e[0];return!t.startsWith("utm_")&&!t.startsWith("fbclid")&&!t.startsWith("gclid")})),u=i.length?"?".concat(new URLSearchParams(i).toString()):"";return"".concat(t.origin).concat(n).concat(u)}catch(t){return e}}(window.location.href),e===n.current?[2]:(n.current=e,t={referrer:document.referrer,user_agent:navigator.userAgent,language:navigator.language,screen_size:"".concat(window.innerWidth,"x").concat(window.innerHeight),utm_source:new URLSearchParams(window.location.search).get("utm_source")||void 0,utm_medium:new URLSearchParams(window.location.search).get("utm_medium")||void 0,utm_campaign:new URLSearchParams(window.location.search).get("utm_campaign")||void 0},[4,l.trackPageView(e,t).catch((function(e){return console.error("Failed to track page view:",e)}))])):[2];case 1:return r.sent(),[2]}}))}))}(0,u.useEffect)((function(){if(e.state===i.State.READY){_();var t=function(){return _()};return window.addEventListener("popstate",t),window.addEventListener("pushState",t),window.addEventListener("replaceState",t),function(){window.removeEventListener("popstate",t),window.removeEventListener("pushState",t),window.removeEventListener("replaceState",t)}}}),[e.state,l]),(0,u.useEffect)((function(){return function(){var e;null===(e=t.current)||void 0===e||e.destroy()}}),[]),!1;return null};n(172);var i=n(128),u=n(994),c=n(402),a=n(197)},197:function(e,t){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)},r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function u(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,c)}a((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return u.next=c(0),u.throw=c(1),u.return=c(2),"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function c(c){return function(a){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;u&&(u=0,c[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}},i=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.EngagementTracker=void 0;var u=function(){function e(e,t,n,r){void 0===r&&(r="".concat(n,"-").concat(Date.now()));var o=this;this.apis=e,this.projectId=t,this.userId=n,this.sessionId=r,this.eventBuffer=[],this.flushTimer=null,this.flushInterval=5e3,this.startFlushTimer(),"undefined"!=typeof window&&window.addEventListener("beforeunload",(function(){return o.flush()}))}return e.prototype.trackPageView=function(e,t){return r(this,void 0,void 0,(function(){var n,r,i;return o(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.apis.engage.ping({project_id:this.projectId,url:e,user_id:this.userId,session_id:this.sessionId,metadata:t})];case 1:return 0===(n=o.sent()).code?[2,null===(i=n.payload)||void 0===i?void 0:i.interaction_id]:[3,3];case 2:return r=o.sent(),console.error("Failed to track page view:",r),[3,3];case 3:return[2]}}))}))},e.prototype.addEvent=function(e){this.eventBuffer.push(n(n({},e),{timestamp:Date.now()})),this.eventBuffer.length>=10&&this.flush()},e.prototype.startFlushTimer=function(){var e=this;this.flushTimer&&clearInterval(this.flushTimer),this.flushTimer=setInterval((function(){return e.flush()}),this.flushInterval)},e.prototype.flush=function(){return r(this,void 0,void 0,(function(){var e,t;return o(this,(function(n){switch(n.label){case 0:if(0===this.eventBuffer.length)return[2];e=i([],this.eventBuffer,!0),this.eventBuffer=[],n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.apis.engage.track({events:e})];case 2:return n.sent(),[3,4];case 3:return t=n.sent(),console.error("Failed to flush events:",t),this.eventBuffer=i(i([],e,!0),this.eventBuffer,!0),[3,4];case 4:return[2]}}))}))},e.prototype.destroy=function(){this.flushTimer&&clearInterval(this.flushTimer),this.flush()},e}();t.EngagementTracker=u},190:function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(632)),i=n(810);i.baseInit(window,"engage",new o.default),(0,i.baseApplyCommands)(window,"engage").then((function(e){return console.log("Hola from SGAI.Engage!")}))},632:function(e,t,n){var r,o=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var u=n(172),c=i(n(223)),a=i(n(224)),l=function(e){function t(){return e.call(this)||this}return o(t,e),t.prototype.Service=function(e){return(0,u.h)(a.default,null)},t}(c.default);t.default=l}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,n),i.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};n(190)})();
Binary file
package/engage.d.ts ADDED
@@ -0,0 +1,21 @@
1
+ declare module '@supergrowthai/engage' {
2
+
3
+ export interface EngageEventListener {
4
+ onEvent(event: string, payload?: any): void
5
+ }
6
+
7
+ export interface AccountHandler {
8
+ getId(): string
9
+ }
10
+ }
11
+
12
+ //@ts-ignore
13
+ declare global {
14
+ import {EngageEventListener} from "@supergrowthai/engage";
15
+ import {AccountHandler} from "@supergrowthai/engage";
16
+
17
+ function cb(props: [a: "setEventListener", b: EngageEventListener]): number;
18
+ function cb(props: [a: "setAccountHandler", b: AccountHandler]): number;
19
+ function cb(props: [a: "action", b: any]): number;
20
+
21
+ }
package/package.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "@supergrowthai/engage",
3
+ "version": "0.0.2",
4
+ "description": "Enable engaging experiences on your site at the click of a button.",
5
+ "main": "dist/engage.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "private": false,
10
+ "author": "adexp",
11
+ "license": "ISC",
12
+ "types": "./engage.d.ts"
13
+ }