@subiz/widget-v4 4.0.85 → 4.0.88

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.
Files changed (53) hide show
  1. package/.prettierrc.js +1 -1
  2. package/compiled_src/chatbox/AgentsAvatar.js +20 -3
  3. package/compiled_src/chatbox/ChatButton.js +11 -8
  4. package/compiled_src/chatbox/Event.js +12 -0
  5. package/compiled_src/chatbox/Events.js +1 -0
  6. package/compiled_src/chatbox/MessageInput.js +6 -0
  7. package/compiled_src/chatbox/Widget.js +41 -37
  8. package/compiled_src/chatbox/main.js +10 -0
  9. package/compiled_src/popup/popup.js +14 -2
  10. package/compiled_src/store/store.js +24 -40
  11. package/compiled_src/util/common.js +10 -10
  12. package/dist/132.js +105 -48
  13. package/dist/182ee177a49.132.js +1 -0
  14. package/dist/{181a9b734bb.178.js → 182ee177a49.178.js} +0 -0
  15. package/dist/{181a9b734bb.213.js → 182ee177a49.213.js} +1 -1
  16. package/dist/{181a9b734bb.335.js → 182ee177a49.335.js} +0 -0
  17. package/dist/{181a9b734bb.362.js → 182ee177a49.362.js} +1 -1
  18. package/dist/182ee177a49.441.js +1 -0
  19. package/dist/{181a9b734bb.605.js → 182ee177a49.605.js} +0 -0
  20. package/dist/{181a9b734bb.678.js → 182ee177a49.678.js} +0 -0
  21. package/dist/{181a9b734bb.782.js → 182ee177a49.782.js} +1 -1
  22. package/dist/182ee177a49.app.js +1 -0
  23. package/dist/{181a9b734bb.index.html → 182ee177a49.index.html} +2 -2
  24. package/dist/{181a9b734bb.library.html → 182ee177a49.library.html} +2 -2
  25. package/dist/182ee177a49.library.js +1 -0
  26. package/dist/{181a9b734bb.preview.html → 182ee177a49.preview.html} +1 -1
  27. package/dist/182ee177a49.preview.js +1 -0
  28. package/dist/182ee177a49.screenshoot.js +1 -0
  29. package/dist/213.js +18 -1
  30. package/dist/362.js +1 -1
  31. package/dist/441.js +14 -1
  32. package/dist/782.js +1 -1
  33. package/dist/HASH +1 -1
  34. package/dist/screenshoot.html +1 -1
  35. package/dist/screenshoot.js +36 -56
  36. package/index.html +1 -1
  37. package/package.json +11 -11
  38. package/src/chatbox/AgentsAvatar.js +32 -10
  39. package/src/chatbox/ChatButton.js +11 -4
  40. package/src/chatbox/Event.js +23 -4
  41. package/src/chatbox/Events.js +3 -1
  42. package/src/chatbox/MessageInput.js +14 -5
  43. package/src/chatbox/Widget.js +10 -9
  44. package/src/chatbox/main.js +8 -1
  45. package/src/popup/popup.js +14 -1
  46. package/src/store/store.js +24 -36
  47. package/src/util/common.js +16 -19
  48. package/dist/181a9b734bb.132.js +0 -1
  49. package/dist/181a9b734bb.441.js +0 -1
  50. package/dist/181a9b734bb.app.js +0 -1
  51. package/dist/181a9b734bb.library.js +0 -1
  52. package/dist/181a9b734bb.preview.js +0 -1
  53. package/dist/181a9b734bb.screenshoot.js +0 -1
@@ -2150,10 +2150,9 @@ function osName() {
2150
2150
  function check_frequently(freq, lastrun, store) {
2151
2151
  if (!lastrun) return true;
2152
2152
  if (op.get(freq, 'once_per_user')) return false;
2153
- var session = store.matchSession() || {};
2154
2153
 
2155
2154
  if (op.get(freq, 'once_per_session')) {
2156
- if (lastrun.session_id === session.id) return false;
2155
+ if (sameDay(lastrun.created, Date.now())) return false;
2157
2156
  }
2158
2157
 
2159
2158
  if (op.get(freq, 'interval_sec')) {
@@ -2166,7 +2165,7 @@ function check_frequently(freq, lastrun, store) {
2166
2165
 
2167
2166
  function checkRunConditions(freq, conds, lastrun, store) {
2168
2167
  var acc = store.matchAccount() || {};
2169
- var session = store.matchSession() || {};
2168
+ var location = store.matchLocation() || {};
2170
2169
  if (!check_frequently(freq, lastrun, store)) return false;
2171
2170
 
2172
2171
  for (var i = 0; i < size(conds); i++) {
@@ -2206,15 +2205,15 @@ function checkRunConditions(freq, conds, lastrun, store) {
2206
2205
  if (size(cond.exclude_locations) > 0) {
2207
2206
  let found = find(cond.exclude_locations, loc => {
2208
2207
  if (loc.city_name && loc.country_code) {
2209
- if (loc.city_name === session.city_name && loc.country_code === session.country_code) return true;
2208
+ if (loc.city_name === location.city_name && loc.country_code === location.country_code) return true;
2210
2209
  }
2211
2210
 
2212
2211
  if (loc.city_name && !loc.country_code) {
2213
- if (loc.city_name === session.city_name) return true;
2212
+ if (loc.city_name === location.city_name) return true;
2214
2213
  }
2215
2214
 
2216
2215
  if (!loc.city_name && loc.country_code) {
2217
- if (loc.country_code === session.country_code) return true;
2216
+ if (loc.country_code === location.country_code) return true;
2218
2217
  }
2219
2218
  });
2220
2219
  if (found) return false;
@@ -2223,15 +2222,15 @@ function checkRunConditions(freq, conds, lastrun, store) {
2223
2222
  if (size(cond.locations) > 0) {
2224
2223
  let found = find(cond.locations, loc => {
2225
2224
  if (loc.city_name && loc.country_code) {
2226
- if (loc.city_name === session.city_name && loc.country_code === session.country_code) return true;
2225
+ if (loc.city_name === location.city_name && loc.country_code === location.country_code) return true;
2227
2226
  }
2228
2227
 
2229
2228
  if (loc.city_name && !loc.country_code) {
2230
- if (loc.city_name === session.city_name) return true;
2229
+ if (loc.city_name === location.city_name) return true;
2231
2230
  }
2232
2231
 
2233
2232
  if (!loc.city_name && loc.country_code) {
2234
- if (loc.country_code === session.country_code) return true;
2233
+ if (loc.country_code === location.country_code) return true;
2235
2234
  }
2236
2235
  });
2237
2236
  if (!found) return false;
@@ -2295,7 +2294,8 @@ function checkRunConditions(freq, conds, lastrun, store) {
2295
2294
 
2296
2295
  case 'source':
2297
2296
  if (size(cond.sources) > 0) {
2298
- if (!find(cond.sources, src => norm(src) === norm(session.source))) return false;
2297
+ let source = store.matchTrafficSource();
2298
+ if (!find(cond.sources, src => norm(src) === norm(source))) return false;
2299
2299
  }
2300
2300
 
2301
2301
  break;
@@ -3208,14 +3208,14 @@ class Pubsub {
3208
3208
 
3209
3209
  "use strict";
3210
3210
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3211
- /* harmony export */ "HY": () => (/* binding */ d),
3212
- /* harmony export */ "Vf": () => (/* binding */ p),
3213
- /* harmony export */ "h": () => (/* binding */ v),
3214
- /* harmony export */ "sY": () => (/* binding */ S),
3215
- /* harmony export */ "wA": () => (/* binding */ _)
3211
+ /* harmony export */ "HY": () => (/* binding */ p),
3212
+ /* harmony export */ "Vf": () => (/* binding */ y),
3213
+ /* harmony export */ "h": () => (/* binding */ h),
3214
+ /* harmony export */ "sY": () => (/* binding */ P),
3215
+ /* harmony export */ "wA": () => (/* binding */ d)
3216
3216
  /* harmony export */ });
3217
3217
  /* unused harmony exports hydrate, createElement, isValidElement, cloneElement, createContext, toChildArray, options */
3218
- var n,l,u,i,t,o,r,f,e={},c=[],s=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function a(n,l){for(var u in l)n[u]=l[u];return n}function h(n){var l=n.parentNode;l&&l.removeChild(n)}function v(l,u,i){var t,o,r,f={};for(r in u)"key"==r?t=u[r]:"ref"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):i),"function"==typeof l&&null!=l.defaultProps)for(r in l.defaultProps)void 0===f[r]&&(f[r]=l.defaultProps[r]);return y(l,f,t,o,null)}function y(n,i,t,o,r){var f={type:n,props:i,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==r?++u:r};return null==r&&null!=l.vnode&&l.vnode(f),f}function p(){return{current:null}}function d(n){return n.children}function _(n,l){this.props=n,this.context=l}function k(n,l){if(null==l)return n.__?k(n.__,n.__.__k.indexOf(n)+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return"function"==typeof n.type?k(n):null}function b(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return b(n)}}function m(n){(!n.__d&&(n.__d=!0)&&t.push(n)&&!g.__r++||r!==l.debounceRendering)&&((r=l.debounceRendering)||o)(g)}function g(){for(var n;g.__r=t.length;)n=t.sort(function(n,l){return n.__v.__b-l.__v.__b}),t=[],n.some(function(n){var l,u,i,t,o,r;n.__d&&(o=(t=(l=n).__v).__e,(r=l.__P)&&(u=[],(i=a({},t)).__v=t.__v+1,j(r,t,i,l.__n,void 0!==r.ownerSVGElement,null!=t.__h?[o]:null,u,null==o?k(t):o,t.__h),z(u,t),t.__e!=o&&b(t)))})}function w(n,l,u,i,t,o,r,f,s,a){var h,v,p,_,b,m,g,w=i&&i.__k||c,A=w.length;for(u.__k=[],h=0;h<l.length;h++)if(null!=(_=u.__k[h]=null==(_=l[h])||"boolean"==typeof _?null:"string"==typeof _||"number"==typeof _||"bigint"==typeof _?y(null,_,null,null,_):Array.isArray(_)?y(d,{children:_},null,null,null):_.__b>0?y(_.type,_.props,_.key,null,_.__v):_)){if(_.__=u,_.__b=u.__b+1,null===(p=w[h])||p&&_.key==p.key&&_.type===p.type)w[h]=void 0;else for(v=0;v<A;v++){if((p=w[v])&&_.key==p.key&&_.type===p.type){w[v]=void 0;break}p=null}j(n,_,p=p||e,t,o,r,f,s,a),b=_.__e,(v=_.ref)&&p.ref!=v&&(g||(g=[]),p.ref&&g.push(p.ref,null,_),g.push(v,_.__c||b,_)),null!=b?(null==m&&(m=b),"function"==typeof _.type&&_.__k===p.__k?_.__d=s=x(_,s,n):s=P(n,_,p,w,b,s),"function"==typeof u.type&&(u.__d=s)):s&&p.__e==s&&s.parentNode!=n&&(s=k(p))}for(u.__e=m,h=A;h--;)null!=w[h]&&("function"==typeof u.type&&null!=w[h].__e&&w[h].__e==u.__d&&(u.__d=k(i,h+1)),N(w[h],w[h]));if(g)for(h=0;h<g.length;h++)M(g[h],g[++h],g[++h])}function x(n,l,u){for(var i,t=n.__k,o=0;t&&o<t.length;o++)(i=t[o])&&(i.__=n,l="function"==typeof i.type?x(i,l,u):P(u,i,i,t,i.__e,l));return l}function A(n,l){return l=l||[],null==n||"boolean"==typeof n||(Array.isArray(n)?n.some(function(n){A(n,l)}):l.push(n)),l}function P(n,l,u,i,t,o){var r,f,e;if(void 0!==l.__d)r=l.__d,l.__d=void 0;else if(null==u||t!=o||null==t.parentNode)n:if(null==o||o.parentNode!==n)n.appendChild(t),r=null;else{for(f=o,e=0;(f=f.nextSibling)&&e<i.length;e+=2)if(f==t)break n;n.insertBefore(t,o),r=o}return void 0!==r?r:t.nextSibling}function C(n,l,u,i,t){var o;for(o in u)"children"===o||"key"===o||o in l||H(n,o,null,u[o],i);for(o in l)t&&"function"!=typeof l[o]||"children"===o||"key"===o||"value"===o||"checked"===o||u[o]===l[o]||H(n,o,l[o],u[o],i)}function $(n,l,u){"-"===l[0]?n.setProperty(l,u):n[l]=null==u?"":"number"!=typeof u||s.test(l)?u:u+"px"}function H(n,l,u,i,t){var o;n:if("style"===l)if("string"==typeof u)n.style.cssText=u;else{if("string"==typeof i&&(n.style.cssText=i=""),i)for(l in i)u&&l in u||$(n.style,l,"");if(u)for(l in u)i&&u[l]===i[l]||$(n.style,l,u[l])}else if("o"===l[0]&&"n"===l[1])o=l!==(l=l.replace(/Capture$/,"")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+o]=u,u?i||n.addEventListener(l,o?T:I,o):n.removeEventListener(l,o?T:I,o);else if("dangerouslySetInnerHTML"!==l){if(t)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("href"!==l&&"list"!==l&&"form"!==l&&"tabIndex"!==l&&"download"!==l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null!=u&&(!1!==u||"a"===l[0]&&"r"===l[1])?n.setAttribute(l,u):n.removeAttribute(l))}}function I(n){this.l[n.type+!1](l.event?l.event(n):n)}function T(n){this.l[n.type+!0](l.event?l.event(n):n)}function j(n,u,i,t,o,r,f,e,c){var s,h,v,y,p,k,b,m,g,x,A,P=u.type;if(void 0!==u.constructor)return null;null!=i.__h&&(c=i.__h,e=u.__e=i.__e,u.__h=null,r=[e]),(s=l.__b)&&s(u);try{n:if("function"==typeof P){if(m=u.props,g=(s=P.contextType)&&t[s.__c],x=s?g?g.props.value:s.__:t,i.__c?b=(h=u.__c=i.__c).__=h.__E:("prototype"in P&&P.prototype.render?u.__c=h=new P(m,x):(u.__c=h=new _(m,x),h.constructor=P,h.render=O),g&&g.sub(h),h.props=m,h.state||(h.state={}),h.context=x,h.__n=t,v=h.__d=!0,h.__h=[]),null==h.__s&&(h.__s=h.state),null!=P.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=a({},h.__s)),a(h.__s,P.getDerivedStateFromProps(m,h.__s))),y=h.props,p=h.state,v)null==P.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(null==P.getDerivedStateFromProps&&m!==y&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(m,x),!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(m,h.__s,x)||u.__v===i.__v){h.props=m,h.state=h.__s,u.__v!==i.__v&&(h.__d=!1),h.__v=u,u.__e=i.__e,u.__k=i.__k,u.__k.forEach(function(n){n&&(n.__=u)}),h.__h.length&&f.push(h);break n}null!=h.componentWillUpdate&&h.componentWillUpdate(m,h.__s,x),null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(y,p,k)})}h.context=x,h.props=m,h.state=h.__s,(s=l.__r)&&s(u),h.__d=!1,h.__v=u,h.__P=n,s=h.render(h.props,h.state,h.context),h.state=h.__s,null!=h.getChildContext&&(t=a(a({},t),h.getChildContext())),v||null==h.getSnapshotBeforeUpdate||(k=h.getSnapshotBeforeUpdate(y,p)),A=null!=s&&s.type===d&&null==s.key?s.props.children:s,w(n,Array.isArray(A)?A:[A],u,i,t,o,r,f,e,c),h.base=u.__e,u.__h=null,h.__h.length&&f.push(h),b&&(h.__E=h.__=null),h.__e=!1}else null==r&&u.__v===i.__v?(u.__k=i.__k,u.__e=i.__e):u.__e=L(i.__e,u,i,t,o,r,f,c);(s=l.diffed)&&s(u)}catch(n){u.__v=null,(c||null!=r)&&(u.__e=e,u.__h=!!c,r[r.indexOf(e)]=null),l.__e(n,u,i)}}function z(n,u){l.__c&&l.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u)})}catch(n){l.__e(n,u.__v)}})}function L(l,u,i,t,o,r,f,c){var s,a,v,y=i.props,p=u.props,d=u.type,_=0;if("svg"===d&&(o=!0),null!=r)for(;_<r.length;_++)if((s=r[_])&&"setAttribute"in s==!!d&&(d?s.localName===d:3===s.nodeType)){l=s,r[_]=null;break}if(null==l){if(null===d)return document.createTextNode(p);l=o?document.createElementNS("http://www.w3.org/2000/svg",d):document.createElement(d,p.is&&p),r=null,c=!1}if(null===d)y===p||c&&l.data===p||(l.data=p);else{if(r=r&&n.call(l.childNodes),a=(y=i.props||e).dangerouslySetInnerHTML,v=p.dangerouslySetInnerHTML,!c){if(null!=r)for(y={},_=0;_<l.attributes.length;_++)y[l.attributes[_].name]=l.attributes[_].value;(v||a)&&(v&&(a&&v.__html==a.__html||v.__html===l.innerHTML)||(l.innerHTML=v&&v.__html||""))}if(C(l,p,y,o,c),v)u.__k=[];else if(_=u.props.children,w(l,Array.isArray(_)?_:[_],u,i,t,o&&"foreignObject"!==d,r,f,r?r[0]:i.__k&&k(i,0),c),null!=r)for(_=r.length;_--;)null!=r[_]&&h(r[_]);c||("value"in p&&void 0!==(_=p.value)&&(_!==l.value||"progress"===d&&!_||"option"===d&&_!==y.value)&&H(l,"value",_,y.value,!1),"checked"in p&&void 0!==(_=p.checked)&&_!==l.checked&&H(l,"checked",_,y.checked,!1))}return l}function M(n,u,i){try{"function"==typeof n?n(u):n.current=u}catch(n){l.__e(n,i)}}function N(n,u,i){var t,o;if(l.unmount&&l.unmount(n),(t=n.ref)&&(t.current&&t.current!==n.__e||M(t,null,u)),null!=(t=n.__c)){if(t.componentWillUnmount)try{t.componentWillUnmount()}catch(n){l.__e(n,u)}t.base=t.__P=null}if(t=n.__k)for(o=0;o<t.length;o++)t[o]&&N(t[o],u,"function"!=typeof n.type);i||null==n.__e||h(n.__e),n.__e=n.__d=void 0}function O(n,l,u){return this.constructor(n,u)}function S(u,i,t){var o,r,f;l.__&&l.__(u,i),r=(o="function"==typeof t)?null:t&&t.__k||i.__k,f=[],j(i,u=(!o&&t||i).__k=v(d,null,[u]),r||e,e,void 0!==i.ownerSVGElement,!o&&t?[t]:r?null:i.firstChild?n.call(i.childNodes):null,f,!o&&t?t:r?r.__e:i.firstChild,o),z(f,u)}function q(n,l){S(n,l,q)}function B(l,u,i){var t,o,r,f=a({},l.props);for(r in u)"key"==r?t=u[r]:"ref"==r?o=u[r]:f[r]=u[r];return arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):i),y(l.type,f,t||l.key,o||l.ref,null)}function D(n,l){var u={__c:l="__cC"+f++,__:n,Consumer:function(n,l){return n.children(l)},Provider:function(n){var u,i;return this.getChildContext||(u=[],(i={})[l]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(n){this.props.value!==n.value&&u.some(m)},this.sub=function(n){u.push(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){u.splice(u.indexOf(n),1),l&&l.call(n)}}),n.children}};return u.Provider.__=u.Consumer.contextType=u}n=c.slice,l={__e:function(n,l,u,i){for(var t,o,r;l=l.__;)if((t=l.__c)&&!t.__)try{if((o=t.constructor)&&null!=o.getDerivedStateFromError&&(t.setState(o.getDerivedStateFromError(n)),r=t.__d),null!=t.componentDidCatch&&(t.componentDidCatch(n,i||{}),r=t.__d),r)return t.__E=t}catch(l){n=l}throw n}},u=0,i=function(n){return null!=n&&void 0===n.constructor},_.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=a({},this.state),"function"==typeof n&&(n=n(a({},u),this.props)),n&&a(u,n),null!=n&&this.__v&&(l&&this.__h.push(l),m(this))},_.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),m(this))},_.prototype.render=d,t=[],o="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,g.__r=0,f=0;
3218
+ var n,l,u,i,t,o,r,f={},e=[],c=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function s(n,l){for(var u in l)n[u]=l[u];return n}function a(n){var l=n.parentNode;l&&l.removeChild(n)}function h(l,u,i){var t,o,r,f={};for(r in u)"key"==r?t=u[r]:"ref"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):i),"function"==typeof l&&null!=l.defaultProps)for(r in l.defaultProps)void 0===f[r]&&(f[r]=l.defaultProps[r]);return v(l,f,t,o,null)}function v(n,i,t,o,r){var f={type:n,props:i,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==r?++u:r};return null==r&&null!=l.vnode&&l.vnode(f),f}function y(){return{current:null}}function p(n){return n.children}function d(n,l){this.props=n,this.context=l}function _(n,l){if(null==l)return n.__?_(n.__,n.__.__k.indexOf(n)+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return"function"==typeof n.type?_(n):null}function k(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return k(n)}}function b(n){(!n.__d&&(n.__d=!0)&&t.push(n)&&!g.__r++||o!==l.debounceRendering)&&((o=l.debounceRendering)||setTimeout)(g)}function g(){for(var n;g.__r=t.length;)n=t.sort(function(n,l){return n.__v.__b-l.__v.__b}),t=[],n.some(function(n){var l,u,i,t,o,r;n.__d&&(o=(t=(l=n).__v).__e,(r=l.__P)&&(u=[],(i=s({},t)).__v=t.__v+1,j(r,t,i,l.__n,void 0!==r.ownerSVGElement,null!=t.__h?[o]:null,u,null==o?_(t):o,t.__h),z(u,t),t.__e!=o&&k(t)))})}function w(n,l,u,i,t,o,r,c,s,a){var h,y,d,k,b,g,w,x=i&&i.__k||e,C=x.length;for(u.__k=[],h=0;h<l.length;h++)if(null!=(k=u.__k[h]=null==(k=l[h])||"boolean"==typeof k?null:"string"==typeof k||"number"==typeof k||"bigint"==typeof k?v(null,k,null,null,k):Array.isArray(k)?v(p,{children:k},null,null,null):k.__b>0?v(k.type,k.props,k.key,null,k.__v):k)){if(k.__=u,k.__b=u.__b+1,null===(d=x[h])||d&&k.key==d.key&&k.type===d.type)x[h]=void 0;else for(y=0;y<C;y++){if((d=x[y])&&k.key==d.key&&k.type===d.type){x[y]=void 0;break}d=null}j(n,k,d=d||f,t,o,r,c,s,a),b=k.__e,(y=k.ref)&&d.ref!=y&&(w||(w=[]),d.ref&&w.push(d.ref,null,k),w.push(y,k.__c||b,k)),null!=b?(null==g&&(g=b),"function"==typeof k.type&&k.__k===d.__k?k.__d=s=m(k,s,n):s=A(n,k,d,x,b,s),"function"==typeof u.type&&(u.__d=s)):s&&d.__e==s&&s.parentNode!=n&&(s=_(d))}for(u.__e=g,h=C;h--;)null!=x[h]&&("function"==typeof u.type&&null!=x[h].__e&&x[h].__e==u.__d&&(u.__d=_(i,h+1)),N(x[h],x[h]));if(w)for(h=0;h<w.length;h++)M(w[h],w[++h],w[++h])}function m(n,l,u){for(var i,t=n.__k,o=0;t&&o<t.length;o++)(i=t[o])&&(i.__=n,l="function"==typeof i.type?m(i,l,u):A(u,i,i,t,i.__e,l));return l}function x(n,l){return l=l||[],null==n||"boolean"==typeof n||(Array.isArray(n)?n.some(function(n){x(n,l)}):l.push(n)),l}function A(n,l,u,i,t,o){var r,f,e;if(void 0!==l.__d)r=l.__d,l.__d=void 0;else if(null==u||t!=o||null==t.parentNode)n:if(null==o||o.parentNode!==n)n.appendChild(t),r=null;else{for(f=o,e=0;(f=f.nextSibling)&&e<i.length;e+=2)if(f==t)break n;n.insertBefore(t,o),r=o}return void 0!==r?r:t.nextSibling}function C(n,l,u,i,t){var o;for(o in u)"children"===o||"key"===o||o in l||H(n,o,null,u[o],i);for(o in l)t&&"function"!=typeof l[o]||"children"===o||"key"===o||"value"===o||"checked"===o||u[o]===l[o]||H(n,o,l[o],u[o],i)}function $(n,l,u){"-"===l[0]?n.setProperty(l,u):n[l]=null==u?"":"number"!=typeof u||c.test(l)?u:u+"px"}function H(n,l,u,i,t){var o;n:if("style"===l)if("string"==typeof u)n.style.cssText=u;else{if("string"==typeof i&&(n.style.cssText=i=""),i)for(l in i)u&&l in u||$(n.style,l,"");if(u)for(l in u)i&&u[l]===i[l]||$(n.style,l,u[l])}else if("o"===l[0]&&"n"===l[1])o=l!==(l=l.replace(/Capture$/,"")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+o]=u,u?i||n.addEventListener(l,o?T:I,o):n.removeEventListener(l,o?T:I,o);else if("dangerouslySetInnerHTML"!==l){if(t)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("href"!==l&&"list"!==l&&"form"!==l&&"tabIndex"!==l&&"download"!==l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null!=u&&(!1!==u||"a"===l[0]&&"r"===l[1])?n.setAttribute(l,u):n.removeAttribute(l))}}function I(n){this.l[n.type+!1](l.event?l.event(n):n)}function T(n){this.l[n.type+!0](l.event?l.event(n):n)}function j(n,u,i,t,o,r,f,e,c){var a,h,v,y,_,k,b,g,m,x,A,C,$,H=u.type;if(void 0!==u.constructor)return null;null!=i.__h&&(c=i.__h,e=u.__e=i.__e,u.__h=null,r=[e]),(a=l.__b)&&a(u);try{n:if("function"==typeof H){if(g=u.props,m=(a=H.contextType)&&t[a.__c],x=a?m?m.props.value:a.__:t,i.__c?b=(h=u.__c=i.__c).__=h.__E:("prototype"in H&&H.prototype.render?u.__c=h=new H(g,x):(u.__c=h=new d(g,x),h.constructor=H,h.render=O),m&&m.sub(h),h.props=g,h.state||(h.state={}),h.context=x,h.__n=t,v=h.__d=!0,h.__h=[]),null==h.__s&&(h.__s=h.state),null!=H.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=s({},h.__s)),s(h.__s,H.getDerivedStateFromProps(g,h.__s))),y=h.props,_=h.state,v)null==H.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(null==H.getDerivedStateFromProps&&g!==y&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(g,x),!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(g,h.__s,x)||u.__v===i.__v){h.props=g,h.state=h.__s,u.__v!==i.__v&&(h.__d=!1),h.__v=u,u.__e=i.__e,u.__k=i.__k,u.__k.forEach(function(n){n&&(n.__=u)}),h.__h.length&&f.push(h);break n}null!=h.componentWillUpdate&&h.componentWillUpdate(g,h.__s,x),null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(y,_,k)})}if(h.context=x,h.props=g,h.__v=u,h.__P=n,A=l.__r,C=0,"prototype"in H&&H.prototype.render)h.state=h.__s,h.__d=!1,A&&A(u),a=h.render(h.props,h.state,h.context);else do{h.__d=!1,A&&A(u),a=h.render(h.props,h.state,h.context),h.state=h.__s}while(h.__d&&++C<25);h.state=h.__s,null!=h.getChildContext&&(t=s(s({},t),h.getChildContext())),v||null==h.getSnapshotBeforeUpdate||(k=h.getSnapshotBeforeUpdate(y,_)),$=null!=a&&a.type===p&&null==a.key?a.props.children:a,w(n,Array.isArray($)?$:[$],u,i,t,o,r,f,e,c),h.base=u.__e,u.__h=null,h.__h.length&&f.push(h),b&&(h.__E=h.__=null),h.__e=!1}else null==r&&u.__v===i.__v?(u.__k=i.__k,u.__e=i.__e):u.__e=L(i.__e,u,i,t,o,r,f,c);(a=l.diffed)&&a(u)}catch(n){u.__v=null,(c||null!=r)&&(u.__e=e,u.__h=!!c,r[r.indexOf(e)]=null),l.__e(n,u,i)}}function z(n,u){l.__c&&l.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u)})}catch(n){l.__e(n,u.__v)}})}function L(l,u,i,t,o,r,e,c){var s,h,v,y=i.props,p=u.props,d=u.type,k=0;if("svg"===d&&(o=!0),null!=r)for(;k<r.length;k++)if((s=r[k])&&"setAttribute"in s==!!d&&(d?s.localName===d:3===s.nodeType)){l=s,r[k]=null;break}if(null==l){if(null===d)return document.createTextNode(p);l=o?document.createElementNS("http://www.w3.org/2000/svg",d):document.createElement(d,p.is&&p),r=null,c=!1}if(null===d)y===p||c&&l.data===p||(l.data=p);else{if(r=r&&n.call(l.childNodes),h=(y=i.props||f).dangerouslySetInnerHTML,v=p.dangerouslySetInnerHTML,!c){if(null!=r)for(y={},k=0;k<l.attributes.length;k++)y[l.attributes[k].name]=l.attributes[k].value;(v||h)&&(v&&(h&&v.__html==h.__html||v.__html===l.innerHTML)||(l.innerHTML=v&&v.__html||""))}if(C(l,p,y,o,c),v)u.__k=[];else if(k=u.props.children,w(l,Array.isArray(k)?k:[k],u,i,t,o&&"foreignObject"!==d,r,e,r?r[0]:i.__k&&_(i,0),c),null!=r)for(k=r.length;k--;)null!=r[k]&&a(r[k]);c||("value"in p&&void 0!==(k=p.value)&&(k!==l.value||"progress"===d&&!k||"option"===d&&k!==y.value)&&H(l,"value",k,y.value,!1),"checked"in p&&void 0!==(k=p.checked)&&k!==l.checked&&H(l,"checked",k,y.checked,!1))}return l}function M(n,u,i){try{"function"==typeof n?n(u):n.current=u}catch(n){l.__e(n,i)}}function N(n,u,i){var t,o;if(l.unmount&&l.unmount(n),(t=n.ref)&&(t.current&&t.current!==n.__e||M(t,null,u)),null!=(t=n.__c)){if(t.componentWillUnmount)try{t.componentWillUnmount()}catch(n){l.__e(n,u)}t.base=t.__P=null}if(t=n.__k)for(o=0;o<t.length;o++)t[o]&&N(t[o],u,"function"!=typeof n.type);i||null==n.__e||a(n.__e),n.__e=n.__d=void 0}function O(n,l,u){return this.constructor(n,u)}function P(u,i,t){var o,r,e;l.__&&l.__(u,i),r=(o="function"==typeof t)?null:t&&t.__k||i.__k,e=[],j(i,u=(!o&&t||i).__k=h(p,null,[u]),r||f,f,void 0!==i.ownerSVGElement,!o&&t?[t]:r?null:i.firstChild?n.call(i.childNodes):null,e,!o&&t?t:r?r.__e:i.firstChild,o),z(e,u)}function S(n,l){P(n,l,S)}function q(l,u,i){var t,o,r,f=s({},l.props);for(r in u)"key"==r?t=u[r]:"ref"==r?o=u[r]:f[r]=u[r];return arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):i),v(l.type,f,t||l.key,o||l.ref,null)}function B(n,l){var u={__c:l="__cC"+r++,__:n,Consumer:function(n,l){return n.children(l)},Provider:function(n){var u,i;return this.getChildContext||(u=[],(i={})[l]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(n){this.props.value!==n.value&&u.some(b)},this.sub=function(n){u.push(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){u.splice(u.indexOf(n),1),l&&l.call(n)}}),n.children}};return u.Provider.__=u.Consumer.contextType=u}n=e.slice,l={__e:function(n,l,u,i){for(var t,o,r;l=l.__;)if((t=l.__c)&&!t.__)try{if((o=t.constructor)&&null!=o.getDerivedStateFromError&&(t.setState(o.getDerivedStateFromError(n)),r=t.__d),null!=t.componentDidCatch&&(t.componentDidCatch(n,i||{}),r=t.__d),r)return t.__E=t}catch(l){n=l}throw n}},u=0,i=function(n){return null!=n&&void 0===n.constructor},d.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=s({},this.state),"function"==typeof n&&(n=n(s({},u),this.props)),n&&s(u,n),null!=n&&this.__v&&(l&&this.__h.push(l),b(this))},d.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),b(this))},d.prototype.render=p,t=[],g.__r=0,r=0;
3219
3219
  //# sourceMappingURL=preact.module.js.map
3220
3220
 
3221
3221
 
@@ -4184,8 +4184,6 @@ class Store {
4184
4184
 
4185
4185
  store_defineProperty(this, "suggest_addresses", keyword => this.api.suggest_address(keyword));
4186
4186
 
4187
- store_defineProperty(this, "matchSession", () => this.kv.match('session') || {});
4188
-
4189
4187
  store_defineProperty(this, "matchAccount", () => this.cache.match('account'));
4190
4188
 
4191
4189
  store_defineProperty(this, "matchPaymentMethods", () => this.cache.match('payment_methods'));
@@ -4277,6 +4275,8 @@ class Store {
4277
4275
  };
4278
4276
  });
4279
4277
 
4278
+ store_defineProperty(this, "matchLocation", () => this.cache.match('location') || {});
4279
+
4280
4280
  store_defineProperty(this, "matchBot", () => this.cache.match('bot') || {});
4281
4281
 
4282
4282
  store_defineProperty(this, "readyGate", new util/* default.Gate */.Z.Gate());
@@ -4304,6 +4304,8 @@ class Store {
4304
4304
 
4305
4305
  store_defineProperty(this, "seenQueue", []);
4306
4306
 
4307
+ store_defineProperty(this, "matchTrafficSource", () => this.kv.match('traffic_source'));
4308
+
4307
4309
  store_defineProperty(this, "_typing", util/* default.throttle */.Z.throttle(convoid => this.api.sendTyping(convoid), 3000, {
4308
4310
  trailing: false
4309
4311
  }));
@@ -4411,7 +4413,7 @@ class Store {
4411
4413
  }
4412
4414
 
4413
4415
  isInsync(key) {
4414
- return util/* default.Date.now */.Z.Date.now() - (this.g_sync[key] || 0) < 300000;
4416
+ return util/* default.Date.now */.Z.Date.now() - (this.g_sync[key] || 0) < 600000;
4415
4417
  }
4416
4418
 
4417
4419
  async fetchShippingAddresses() {
@@ -4682,24 +4684,6 @@ class Store {
4682
4684
 
4683
4685
  if (setting.user) {
4684
4686
  setting.user.account_id = setting.account.id;
4685
- let oldsession = this.matchSession();
4686
- let session = setting.user.session;
4687
-
4688
- if (session) {
4689
- if (session.id === oldsession.id) {
4690
- session._urls = oldsession._urls;
4691
- } else {}
4692
- } else {
4693
- session = oldsession;
4694
- }
4695
-
4696
- session._urls = session._urls || [];
4697
-
4698
- session._urls.push(location.href);
4699
-
4700
- while (session._urls.length > 1000) session._urls.shift();
4701
-
4702
- this.kv.put('session', session);
4703
4687
  delete setting.user.session;
4704
4688
 
4705
4689
  this._setUser(setting.user);
@@ -4712,6 +4696,8 @@ class Store {
4712
4696
  delete setting.account;
4713
4697
  }
4714
4698
 
4699
+ let location = util/* default.get */.Z.get(setting, 'location', []);
4700
+ this.cache.put('location', location);
4715
4701
  let bots = util/* default.get */.Z.get(setting, 'bots', []);
4716
4702
  let botM = {};
4717
4703
  util/* default.map */.Z.map(bots, bot => {
@@ -4746,7 +4732,9 @@ class Store {
4746
4732
 
4747
4733
  async track() {
4748
4734
  let user = this.kv.match('user') || {};
4749
- await this.api.sendContentView(this.device, location.href, document.title, this._currentViewingProduct.id, this._currentViewingProduct.source_id, this._currentViewingProduct.sku);
4735
+ let out = await this.api.sendContentView(this.device, location.href, document.title, this._currentViewingProduct.id, this._currentViewingProduct.source_id, this._currentViewingProduct.sku);
4736
+ let traffic_source = util/* default.get */.Z.get(out, 'body.by.device.source', '');
4737
+ if (traffic_source) this.kv.put('traffic_source', traffic_source);
4750
4738
  this.sendPresence();
4751
4739
  }
4752
4740
 
@@ -5059,12 +5047,10 @@ class Store {
5059
5047
  }
5060
5048
 
5061
5049
  logBotRun(botid) {
5062
- let session = this.matchSession();
5063
5050
  let log = this.kv.match('bot_run_logs') || {};
5064
5051
  log[botid] = {
5065
5052
  bot_id: botid,
5066
- created: this.now(),
5067
- session_id: session.id
5053
+ created: this.now()
5068
5054
  };
5069
5055
  this.kv.put('bot_run_logs', log);
5070
5056
  }
@@ -5072,11 +5058,9 @@ class Store {
5072
5058
  sendImpression(id) {
5073
5059
  let user = this.kv.match('user') || {};
5074
5060
  let log = this.kv.match('plugin_run_logs') || {};
5075
- let session = this.matchSession();
5076
5061
  log[id] = {
5077
5062
  web_plugin_id: id,
5078
- created: this.now(),
5079
- session_id: session.id
5063
+ created: this.now()
5080
5064
  };
5081
5065
  this.kv.put('plugin_run_logs', log);
5082
5066
  return this.api.sendImpression({
@@ -5085,8 +5069,7 @@ class Store {
5085
5069
  web_plugin_id: id,
5086
5070
  user_id: user.id,
5087
5071
  url: window.location.href,
5088
- device: this.device,
5089
- session_id: session.id
5072
+ device: this.device
5090
5073
  });
5091
5074
  }
5092
5075
 
@@ -5108,8 +5091,7 @@ class Store {
5108
5091
  url: window.location.href,
5109
5092
  device: this.device,
5110
5093
  submission,
5111
- impression_token: impressionToken,
5112
- session_id: this.matchSession().id
5094
+ impression_token: impressionToken
5113
5095
  });
5114
5096
  }
5115
5097
 
@@ -5152,7 +5134,7 @@ class Store {
5152
5134
 
5153
5135
  async loopTime() {
5154
5136
  let startms = util/* default.Date.now */.Z.Date.now();
5155
- if (!util/* default.get */.Z.get(this.kv.match('user'), 'id')) return setTimeout(() => this.loopTime(), 120000);
5137
+ if (!util/* default.get */.Z.get(this.kv.match('user'), 'id')) return setTimeout(() => this.loopTime(), 240000);
5156
5138
  let {
5157
5139
  body: t,
5158
5140
  error
@@ -5162,7 +5144,7 @@ class Store {
5162
5144
  var serverMs = new util/* default.Date */.Z.Date(t).getTime() + latences;
5163
5145
  var localMs = util/* default.Date.now */.Z.Date.now();
5164
5146
  this.timeDiff = Math.floor(serverMs - localMs);
5165
- setTimeout(() => this.loopTime(), 120000);
5147
+ setTimeout(() => this.loopTime(), 240000);
5166
5148
  }
5167
5149
 
5168
5150
  replaceFileUrl(src) {
@@ -5300,7 +5282,10 @@ function sendToFBPixel(category, action, label) {
5300
5282
  }
5301
5283
 
5302
5284
  function sendToGA(category, action, label) {
5303
- console.log('SENT.', category, action, label);
5285
+ if (window.gtag) window.gtag('event', category, {
5286
+ Action: action,
5287
+ Label: label
5288
+ });
5304
5289
 
5305
5290
  if (window.ga && window.ga.getAll) {
5306
5291
  const allTrackers = window.ga.getAll() || [];
@@ -5308,11 +5293,6 @@ function sendToGA(category, action, label) {
5308
5293
  const name = tracker.get('name');
5309
5294
  window.ga(name + '.send', 'event', category, action, label);
5310
5295
  });
5311
- } else {
5312
- if (window.gtag) window.gtag('event', category, {
5313
- Action: action,
5314
- Label: label
5315
- });
5316
5296
  }
5317
5297
  }
5318
5298
 
package/index.html CHANGED
@@ -33,7 +33,7 @@
33
33
  window.subiz.q = []
34
34
  // set account it in the very first call
35
35
  window.subiz('setAccount', accid)
36
- window.subiz('expandWidget')
36
+ // window.subiz('expandWidget')
37
37
 
38
38
  if (accid == 'acpxkgumifuoofoosble') {
39
39
  window.subiz('setViewingProduct', {id: '220170', sku: 'ipx', source_id: 'IPHONE10'})
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@subiz/widget-v4",
3
- "version": "4.0.85",
3
+ "version": "4.0.88",
4
4
  "main": "./compiled_src/lib.js",
5
5
  "scripts": {
6
6
  "dev": "npx webpack serve --config webpack.dev.js",
@@ -14,28 +14,28 @@
14
14
  "@subiz/storage": "0.0.8",
15
15
  "@subiz/wsclient": "^3.1.7",
16
16
  "cookie_js": "1.4.2",
17
- "core-js": "^3.23.4",
17
+ "core-js": "^3.25.0",
18
18
  "css-loader": "5.2.7",
19
19
  "file-loader": "^6.2.0",
20
20
  "less": "^4.1.3",
21
21
  "less-loader": "^11.0.0",
22
- "marked": "^4.0.18",
23
- "preact": "^10.10.0"
22
+ "marked": "^4.1.0",
23
+ "preact": "^10.10.6"
24
24
  },
25
25
  "devDependencies": {
26
- "@babel/cli": "^7.18.6",
27
- "@babel/core": "^7.18.6",
26
+ "@babel/cli": "^7.18.10",
27
+ "@babel/core": "^7.18.13",
28
28
  "@babel/plugin-proposal-class-properties": "^7.18.6",
29
- "@babel/plugin-transform-react-jsx": "^7.18.6",
30
- "@babel/preset-env": "^7.18.6",
29
+ "@babel/plugin-transform-react-jsx": "^7.18.10",
30
+ "@babel/preset-env": "^7.18.10",
31
31
  "babel-loader": "^8.2.5",
32
32
  "babel-plugin-syntax-jsx": "^6.18.0",
33
33
  "html-webpack-plugin": "^5.5.0",
34
34
  "prettier": "^2.7.1",
35
35
  "puppeteer": "^15.4.0",
36
- "webpack": "^5.73.0",
37
- "webpack-bundle-analyzer": "^4.5.0",
36
+ "webpack": "^5.74.0",
37
+ "webpack-bundle-analyzer": "^4.6.1",
38
38
  "webpack-cli": "^4.10.0",
39
- "webpack-dev-server": "^4.9.3"
39
+ "webpack-dev-server": "^4.10.1"
40
40
  }
41
41
  }
@@ -10,6 +10,26 @@ export default class AgentsAvatar extends Com {
10
10
 
11
11
  render() {
12
12
  let accountSetting = this.props.plugin.chatbox
13
+ let acc = this.props.store.matchAccount()
14
+ var tooltippos = this.props.tooltipPos || 'bottom'
15
+ var mode = this.props.mode || 'primary'
16
+
17
+ if (accountSetting && accountSetting.hide_agent_profile) {
18
+ return (
19
+ <div class={`group-avatar group-avatar--${mode}`}>
20
+ <div class='d-inline-block pos-relative' data-tooltip={acc.name} data-tooltip-position={tooltippos}>
21
+ <img
22
+ width={35}
23
+ height={35}
24
+ alt='agent avatar left'
25
+ class='avatar group-avatar--agent-left'
26
+ src={this.props.store.replaceFileUrl(acc.logo_url) || require('../../assets/img/image_default.png')}
27
+ />
28
+ </div>
29
+ </div>
30
+ )
31
+ }
32
+
13
33
  let agentM = this.props.store.matchAgent('*')
14
34
  var agents = sb.map(this.props.agent_ids, (id) => agentM[id])
15
35
  if (this.props.agent_ids === undefined || sb.size(this.props.agent_ids) === 0) {
@@ -23,10 +43,6 @@ export default class AgentsAvatar extends Com {
23
43
  }
24
44
 
25
45
  agents = sb.filter(agents, (ag) => !!ag)
26
- let acc = this.props.store.matchAccount()
27
-
28
- var tooltippos = this.props.tooltipPos || 'bottom'
29
- var mode = this.props.mode || 'primary'
30
46
  if (agents.length === 0) {
31
47
  // use account avatar
32
48
  return (
@@ -53,7 +69,8 @@ export default class AgentsAvatar extends Com {
53
69
  <div
54
70
  class='d-inline-block pos-relative'
55
71
  data-tooltip={agent.fullname || acc.name}
56
- data-tooltip-position={tooltippos}>
72
+ data-tooltip-position={tooltippos}
73
+ >
57
74
  <img
58
75
  width={35}
59
76
  height={35}
@@ -75,7 +92,8 @@ export default class AgentsAvatar extends Com {
75
92
  <div
76
93
  class='d-inline-block pos-relative'
77
94
  data-tooltip={leftAgent.fullname || acc.name}
78
- data-tooltip-position={tooltippos}>
95
+ data-tooltip-position={tooltippos}
96
+ >
79
97
  <img
80
98
  width={35}
81
99
  height={35}
@@ -89,7 +107,8 @@ export default class AgentsAvatar extends Com {
89
107
  <div
90
108
  class='d-inline-block pos-relative'
91
109
  data-tooltip={rightAgent.fullname || acc.name}
92
- data-tooltip-position={tooltippos}>
110
+ data-tooltip-position={tooltippos}
111
+ >
93
112
  <img
94
113
  alt='agent avatar right'
95
114
  width={35}
@@ -114,7 +133,8 @@ export default class AgentsAvatar extends Com {
114
133
  <div
115
134
  class='d-inline-block pos-relative'
116
135
  data-tooltip={leftAgent.fullname || acc.name}
117
- data-tooltip-position={tooltippos}>
136
+ data-tooltip-position={tooltippos}
137
+ >
118
138
  <img
119
139
  width={35}
120
140
  height={35}
@@ -128,7 +148,8 @@ export default class AgentsAvatar extends Com {
128
148
  <div
129
149
  class='d-inline-block pos-relative'
130
150
  data-tooltip={middleAgent.fullname || acc.name}
131
- data-tooltip-position={tooltippos}>
151
+ data-tooltip-position={tooltippos}
152
+ >
132
153
  <img
133
154
  alt='agent avatar middle'
134
155
  width={35}
@@ -142,7 +163,8 @@ export default class AgentsAvatar extends Com {
142
163
  <div
143
164
  class='d-inline-block pos-relative'
144
165
  data-tooltip={rightAgent.fullname || acc.name}
145
- data-tooltip-position={tooltippos}>
166
+ data-tooltip-position={tooltippos}
167
+ >
146
168
  <img
147
169
  width={35}
148
170
  height={35}
@@ -175,6 +175,13 @@ export default class ChatButton extends Com {
175
175
  position = sb.get(accountSetting, 'mobile_button.position') || position
176
176
  }
177
177
 
178
+ if (accountSetting && accountSetting.hide_agent_profile) {
179
+ agent = Object.assign({}, account, {
180
+ avatar_url: account.logo_url || require('../../assets/img/image_default.png'),
181
+ fullname: account.name || this.props.t('agent'),
182
+ })
183
+ }
184
+
178
185
  let cls = 'widget-preview widget-preview--' + position
179
186
  if (!this.state.displayPreview) cls += ' widget-preview--hidden'
180
187
 
@@ -206,13 +213,13 @@ export default class ChatButton extends Com {
206
213
  }
207
214
 
208
215
  onProfileReady() {
209
- if (this.state.buttonLoaded) this.setState({opacity: 1})
210
- this.setState({profileLoaded: true})
216
+ if (this._buttonLoaded) this.setState({opacity: 1})
217
+ this._profileLoaded = true
211
218
  }
212
219
 
213
220
  onButtonReady() {
214
- if (this.state.profileLoaded) this.setState({opacity: 1})
215
- this.setState({buttonLoaded: true})
221
+ if (this._profileLoaded) this.setState({opacity: 1})
222
+ this._buttonLoaded = true
216
223
  }
217
224
 
218
225
  renderButton() {
@@ -90,6 +90,15 @@ export default class Event extends Com {
90
90
  let acc = this.props.store.matchAccount()
91
91
  var uri = acc.logo_url || require('../../assets/img/image_default.png')
92
92
 
93
+ if (sb.get(this.props, 'chatbox.hide_agent_profile')) {
94
+ return (
95
+ <div class='message-sender'>
96
+ <img alt='sender' class='message-sender-avatar' src={this.props.store.replaceFileUrl(uri)} />
97
+ <p class='message-sender-name'>{acc.name}</p>
98
+ </div>
99
+ )
100
+ }
101
+
93
102
  let agentM = this.props.store.matchAgent('*')
94
103
  // should replace with subiz logo
95
104
  if (byid !== 'system' || bytype !== 'dummy') {
@@ -130,7 +139,7 @@ export default class Event extends Com {
130
139
  <AudioAttachments store={this.props.store} ev={ev} />
131
140
  <VideoAttachments store={this.props.store} ev={ev} />
132
141
  <FileAttachments store={this.props.store} ev={ev} />
133
- <ButtonAttachments store={this.props.store} ev={ev} t={this.props.t}/>
142
+ <ButtonAttachments store={this.props.store} ev={ev} t={this.props.t} />
134
143
  <FormAttachments
135
144
  store={this.props.store}
136
145
  onSubmit={this.props.onFormSubmit}
@@ -139,8 +148,18 @@ export default class Event extends Com {
139
148
  t={this.props.t}
140
149
  />
141
150
  <FormSubmitAttachments store={this.props.store} ev={ev} t={this.props.t} />
142
- <GenericTemplateAttachments store={this.props.store} ev={ev} onSelect={(e) => this.choosePostbackBtn(e)} t={this.props.t}/>
143
- <ProductAttachments t={this.props.t} onPostback={(e) => this.choosePostbackBtn(e)} store={this.props.store} ev={ev} />
151
+ <GenericTemplateAttachments
152
+ store={this.props.store}
153
+ ev={ev}
154
+ onSelect={(e) => this.choosePostbackBtn(e)}
155
+ t={this.props.t}
156
+ />
157
+ <ProductAttachments
158
+ t={this.props.t}
159
+ onPostback={(e) => this.choosePostbackBtn(e)}
160
+ store={this.props.store}
161
+ ev={ev}
162
+ />
144
163
  <OrderAttachments t={this.props.t} store={this.props.store} ev={ev} />
145
164
  <QuickReplies store={this.props.store} ev={ev} onSelect={(e) => this.chooseQuickReply(e)} />
146
165
  </div>
@@ -182,7 +201,7 @@ export default class Event extends Com {
182
201
  <AudioAttachments store={this.props.store} ev={ev} />
183
202
  <VideoAttachments store={this.props.store} ev={ev} />
184
203
  <FileAttachments store={this.props.store} ev={ev} />
185
- <ButtonAttachments store={this.props.store} ev={ev} t={this.props.t}/>
204
+ <ButtonAttachments store={this.props.store} ev={ev} t={this.props.t} />
186
205
  <FormAttachments store={this.props.store} onSubmit={this.props.onFormSubmit} ref={this.refForm} ev={ev} />
187
206
  <ProductAttachments t={this.props.t} store={this.props.store} ev={ev} />
188
207
  <FormSubmitAttachments store={this.props.store} ev={ev} />
@@ -57,6 +57,7 @@ export default class Events extends Com {
57
57
 
58
58
  let $events = sb.map(events, (ev) => (
59
59
  <Event
60
+ chatbox={this.props.chatbox}
60
61
  onLink={this.props.onLink}
61
62
  store={this.props.store}
62
63
  onFormSubmit={this.props.onFormSubmit}
@@ -82,7 +83,8 @@ export default class Events extends Com {
82
83
  style={style}
83
84
  ref={(ref) => (this.refBody = ref)}
84
85
  class='widget-body--events-container'
85
- onMouseOver={this.checkAndSeen}>
86
+ onMouseOver={this.checkAndSeen}
87
+ >
86
88
  <div class='widget-body--events'>{$events}</div>
87
89
  <PoweredBy store={this.props.store} />
88
90
  </div>
@@ -21,7 +21,7 @@ export default class MessageInput extends Com {
21
21
  this.forceUpdate()
22
22
  }, 500)
23
23
 
24
- this.resizeInput = sb.throttle(function() {
24
+ this.resizeInput = sb.throttle(function () {
25
25
  // TODO: ctrl+A then press backspace dont reset size rightaway
26
26
  const input = this.refMessageInput.current
27
27
  input.style.setProperty('height', '1em', 'important')
@@ -30,6 +30,12 @@ export default class MessageInput extends Com {
30
30
  }, 5)
31
31
  }
32
32
 
33
+ blur() {
34
+ const $input = this.refMessageInput.current
35
+ if (!$input) return
36
+ $input.blur()
37
+ }
38
+
33
39
  render() {
34
40
  var buttons = (
35
41
  <div class='d-flex flex-row align-self-end'>
@@ -37,7 +43,8 @@ export default class MessageInput extends Com {
37
43
  <div
38
44
  data-tooltip-poasition='top-left'
39
45
  class='message-input--button message-input--attachment-button'
40
- onClick={(e) => this.selectFile(e)}></div>
46
+ onClick={(e) => this.selectFile(e)}
47
+ ></div>
41
48
  </div>
42
49
  )
43
50
  var msg = sb.trim(this.refMessageInput.current && this.refMessageInput.current.value)
@@ -48,7 +55,8 @@ export default class MessageInput extends Com {
48
55
  <div
49
56
  data-tooltip-position='top-left'
50
57
  class='message-input--button message-input--send-button'
51
- onClick={() => this.submitMessage()}></div>
58
+ onClick={() => this.submitMessage()}
59
+ ></div>
52
60
  </div>
53
61
  )
54
62
  }
@@ -62,7 +70,8 @@ export default class MessageInput extends Com {
62
70
  class={`message-input ${containercls}`}
63
71
  onClick={(e) => {
64
72
  this.refMessageInput.current && this.refMessageInput.current.focus()
65
- }}>
73
+ }}
74
+ >
66
75
  <input class='d-none' ref={this.refFileInput} type='file' onChange={(e) => this.sendFile(e)} multiple />
67
76
  <textarea
68
77
  disabled={disabled}
@@ -258,7 +267,7 @@ export default class MessageInput extends Com {
258
267
  input.focus()
259
268
  }
260
269
 
261
- onEnter = sb.throttle(function() {
270
+ onEnter = sb.throttle(function () {
262
271
  this.submitMessage()
263
272
  }, 50)
264
273