@ada-support/embed2 1.14.19 → 1.14.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/npm-entry/client/components/ChatFrame/index.d.ts +1 -1
- package/dist/npm-entry/client/components/Container/index.d.ts +1 -1
- package/dist/npm-entry/client/components/IFrame/index.d.ts +1 -1
- package/dist/npm-entry/client/helpers/web-notifications/web-notification-events.d.ts +1 -1
- package/dist/npm-entry/client/lib/connect.d.ts +4 -4
- package/dist/npm-entry/client/lib/store-proxy.d.ts +1 -1
- package/dist/npm-entry/client/store/actions/index.d.ts +1 -1
- package/dist/npm-entry/common/constants/actions.d.ts +11 -11
- package/dist/npm-entry/common/helpers/TriggerConditionEvaluator.d.ts +1 -1
- package/dist/npm-entry/common/helpers/isRTL.d.ts +1 -1
- package/dist/npm-entry/common/helpers/url/index.d.ts +2 -2
- package/dist/npm-entry/common/lib/ConnectContainer/index.d.ts +9 -9
- package/dist/npm-entry/common/lib/channel.d.ts +34 -34
- package/dist/npm-entry/common/types/events.d.ts +1 -1
- package/dist/npm-entry/common/types/helpers.d.ts +1 -1
- package/dist/npm-entry/common/types/http.d.ts +4 -4
- package/dist/npm-entry/common/types/index.d.ts +4 -5
- package/dist/npm-entry/common/types/interface.d.ts +1 -1
- package/dist/npm-entry/common/types/store.d.ts +2 -2
- package/dist/npm-entry/index.js +903 -907
- package/dist/npm-entry/proactiveConversations/proactiveConversation.d.ts +3 -3
- package/package.json +5 -11
package/dist/npm-entry/index.js
CHANGED
|
@@ -6629,9 +6629,6 @@ function _defineProperty(e, r, t) {
|
|
|
6629
6629
|
}) : e[r] = t, e;
|
|
6630
6630
|
}
|
|
6631
6631
|
|
|
6632
|
-
// EXTERNAL MODULE: ./node_modules/lodash.debounce/index.js
|
|
6633
|
-
var lodash_debounce = __webpack_require__(181);
|
|
6634
|
-
var lodash_debounce_default = /*#__PURE__*/__webpack_require__.n(lodash_debounce);
|
|
6635
6632
|
;// ./node_modules/preact/dist/preact.module.js
|
|
6636
6633
|
var n,l,u,i,t,r,o,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 v(n,l,u){var i,t=arguments,r={};for(i in l)"key"!==i&&"ref"!==i&&(r[i]=l[i]);if(arguments.length>3)for(u=[u],i=3;i<arguments.length;i++)u.push(t[i]);if(null!=u&&(r.children=u),"function"==typeof n&&null!=n.defaultProps)for(i in n.defaultProps)void 0===r[i]&&(r[i]=n.defaultProps[i]);return h(n,r,l&&l.key,l&&l.ref,null)}function h(l,u,i,t,r){var o={type:l,props:u,key:i,ref:t,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:r};return null==r&&(o.__v=o),n.vnode&&n.vnode(o),o}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 w(l){(!l.__d&&(l.__d=!0)&&u.push(l)&&!m.__r++||t!==n.debounceRendering)&&((t=n.debounceRendering)||i)(m)}function m(){for(var n;m.__r=u.length;)n=u.sort(function(n,l){return n.__v.__b-l.__v.__b}),u=[],n.some(function(n){var l,u,i,t,r,o,f;n.__d&&(o=(r=(l=n).__v).__e,(f=l.__P)&&(u=[],(i=s({},r)).__v=i,t=T(f,r,i,l.__n,void 0!==f.ownerSVGElement,null,u,null==o?_(r):o),$(u,r),t!=o&&k(r)))})}function g(n,l,u,i,t,r,o,c,s,v){var y,d,k,w,m,g,b,A=i&&i.__k||e,P=A.length;for(s==f&&(s=null!=o?o[0]:P?_(i,0):null),u.__k=[],y=0;y<l.length;y++)if(null!=(w=u.__k[y]=null==(w=l[y])||"boolean"==typeof w?null:"string"==typeof w||"number"==typeof w?h(null,w,null,null,w):Array.isArray(w)?h(p,{children:w},null,null,null):null!=w.__e||null!=w.__c?h(w.type,w.props,w.key,null,w.__v):w)){if(w.__=u,w.__b=u.__b+1,null===(k=A[y])||k&&w.key==k.key&&w.type===k.type)A[y]=void 0;else for(d=0;d<P;d++){if((k=A[d])&&w.key==k.key&&w.type===k.type){A[d]=void 0;break}k=null}m=T(n,w,k=k||f,t,r,o,c,s,v),(d=w.ref)&&k.ref!=d&&(b||(b=[]),k.ref&&b.push(k.ref,null,w),b.push(d,w.__c||m,w)),null!=m?(null==g&&(g=m),s=x(n,w,k,A,o,m,s),"option"==u.type?n.value="":"function"==typeof u.type&&(u.__d=s)):s&&k.__e==s&&s.parentNode!=n&&(s=_(k))}if(u.__e=g,null!=o&&"function"!=typeof u.type)for(y=o.length;y--;)null!=o[y]&&a(o[y]);for(y=P;y--;)null!=A[y]&&I(A[y],A[y]);if(b)for(y=0;y<b.length;y++)H(b[y],b[++y],b[++y])}function b(n){return null==n||"boolean"==typeof n?[]:Array.isArray(n)?e.concat.apply([],n.map(b)):[n]}function x(n,l,u,i,t,r,o){var f,e,c;if(void 0!==l.__d)f=l.__d,l.__d=void 0;else if(t==u||r!=o||null==r.parentNode)n:if(null==o||o.parentNode!==n)n.appendChild(r),f=null;else{for(e=o,c=0;(e=e.nextSibling)&&c<i.length;c+=2)if(e==r)break n;n.insertBefore(r,o),f=o}return void 0!==f?f:r.nextSibling}function A(n,l,u,i,t){var r;for(r in u)"children"===r||"key"===r||r in l||C(n,r,null,u[r],i);for(r in l)t&&"function"!=typeof l[r]||"children"===r||"key"===r||"value"===r||"checked"===r||u[r]===l[r]||C(n,r,l[r],u[r],i)}function P(n,l,u){"-"===l[0]?n.setProperty(l,u):n[l]="number"==typeof u&&!1===c.test(l)?u+"px":null==u?"":u}function C(n,l,u,i,t){var r,o,f,e,c;if(t?"className"===l&&(l="class"):"class"===l&&(l="className"),"style"===l)if(r=n.style,"string"==typeof u)r.cssText=u;else{if("string"==typeof i&&(r.cssText="",i=null),i)for(e in i)u&&e in u||P(r,e,"");if(u)for(c in u)i&&u[c]===i[c]||P(r,c,u[c])}else"o"===l[0]&&"n"===l[1]?(o=l!==(l=l.replace(/Capture$/,"")),f=l.toLowerCase(),l=(f in n?f:l).slice(2),u?(i||n.addEventListener(l,N,o),(n.l||(n.l={}))[l]=u):n.removeEventListener(l,N,o)):"list"!==l&&"tagName"!==l&&"form"!==l&&"type"!==l&&"size"!==l&&!t&&l in n?n[l]=null==u?"":u:"function"!=typeof u&&"dangerouslySetInnerHTML"!==l&&(l!==(l=l.replace(/^xlink:?/,""))?null==u||!1===u?n.removeAttributeNS("http://www.w3.org/1999/xlink",l.toLowerCase()):n.setAttributeNS("http://www.w3.org/1999/xlink",l.toLowerCase(),u):null==u||!1===u&&!/^ar/.test(l)?n.removeAttribute(l):n.setAttribute(l,u))}function N(l){this.l[l.type](n.event?n.event(l):l)}function z(n,l,u){var i,t;for(i=0;i<n.__k.length;i++)(t=n.__k[i])&&(t.__=n,t.__e&&("function"==typeof t.type&&t.__k.length>1&&z(t,l,u),l=x(u,t,t,n.__k,null,t.__e,l),"function"==typeof n.type&&(n.__d=l)))}function T(l,u,i,t,r,o,f,e,c){var a,v,h,y,_,k,w,m,b,x,A,P=u.type;if(void 0!==u.constructor)return null;(a=n.__b)&&a(u);try{n:if("function"==typeof P){if(m=u.props,b=(a=P.contextType)&&t[a.__c],x=a?b?b.props.value:a.__:t,i.__c?w=(v=u.__c=i.__c).__=v.__E:("prototype"in P&&P.prototype.render?u.__c=v=new P(m,x):(u.__c=v=new d(m,x),v.constructor=P,v.render=L),b&&b.sub(v),v.props=m,v.state||(v.state={}),v.context=x,v.__n=t,h=v.__d=!0,v.__h=[]),null==v.__s&&(v.__s=v.state),null!=P.getDerivedStateFromProps&&(v.__s==v.state&&(v.__s=s({},v.__s)),s(v.__s,P.getDerivedStateFromProps(m,v.__s))),y=v.props,_=v.state,h)null==P.getDerivedStateFromProps&&null!=v.componentWillMount&&v.componentWillMount(),null!=v.componentDidMount&&v.__h.push(v.componentDidMount);else{if(null==P.getDerivedStateFromProps&&m!==y&&null!=v.componentWillReceiveProps&&v.componentWillReceiveProps(m,x),!v.__e&&null!=v.shouldComponentUpdate&&!1===v.shouldComponentUpdate(m,v.__s,x)||u.__v===i.__v){v.props=m,v.state=v.__s,u.__v!==i.__v&&(v.__d=!1),v.__v=u,u.__e=i.__e,u.__k=i.__k,v.__h.length&&f.push(v),z(u,e,l);break n}null!=v.componentWillUpdate&&v.componentWillUpdate(m,v.__s,x),null!=v.componentDidUpdate&&v.__h.push(function(){v.componentDidUpdate(y,_,k)})}v.context=x,v.props=m,v.state=v.__s,(a=n.__r)&&a(u),v.__d=!1,v.__v=u,v.__P=l,a=v.render(v.props,v.state,v.context),v.state=v.__s,null!=v.getChildContext&&(t=s(s({},t),v.getChildContext())),h||null==v.getSnapshotBeforeUpdate||(k=v.getSnapshotBeforeUpdate(y,_)),A=null!=a&&a.type==p&&null==a.key?a.props.children:a,g(l,Array.isArray(A)?A:[A],u,i,t,r,o,f,e,c),v.base=u.__e,v.__h.length&&f.push(v),w&&(v.__E=v.__=null),v.__e=!1}else null==o&&u.__v===i.__v?(u.__k=i.__k,u.__e=i.__e):u.__e=j(i.__e,u,i,t,r,o,f,c);(a=n.diffed)&&a(u)}catch(l){u.__v=null,n.__e(l,u,i)}return u.__e}function $(l,u){n.__c&&n.__c(u,l),l.some(function(u){try{l=u.__h,u.__h=[],l.some(function(n){n.call(u)})}catch(l){n.__e(l,u.__v)}})}function j(n,l,u,i,t,r,o,c){var s,a,v,h,y,p=u.props,d=l.props;if(t="svg"===l.type||t,null!=r)for(s=0;s<r.length;s++)if(null!=(a=r[s])&&((null===l.type?3===a.nodeType:a.localName===l.type)||n==a)){n=a,r[s]=null;break}if(null==n){if(null===l.type)return document.createTextNode(d);n=t?document.createElementNS("http://www.w3.org/2000/svg",l.type):document.createElement(l.type,d.is&&{is:d.is}),r=null,c=!1}if(null===l.type)p!==d&&n.data!=d&&(n.data=d);else{if(null!=r&&(r=e.slice.call(n.childNodes)),v=(p=u.props||f).dangerouslySetInnerHTML,h=d.dangerouslySetInnerHTML,!c){if(null!=r)for(p={},y=0;y<n.attributes.length;y++)p[n.attributes[y].name]=n.attributes[y].value;(h||v)&&(h&&v&&h.__html==v.__html||(n.innerHTML=h&&h.__html||""))}A(n,d,p,t,c),h?l.__k=[]:(s=l.props.children,g(n,Array.isArray(s)?s:[s],l,u,i,"foreignObject"!==l.type&&t,r,o,f,c)),c||("value"in d&&void 0!==(s=d.value)&&s!==n.value&&C(n,"value",s,p.value,!1),"checked"in d&&void 0!==(s=d.checked)&&s!==n.checked&&C(n,"checked",s,p.checked,!1))}return n}function H(l,u,i){try{"function"==typeof l?l(u):l.current=u}catch(l){n.__e(l,i)}}function I(l,u,i){var t,r,o;if(n.unmount&&n.unmount(l),(t=l.ref)&&(t.current&&t.current!==l.__e||H(t,null,u)),i||"function"==typeof l.type||(i=null!=(r=l.__e)),l.__e=l.__d=void 0,null!=(t=l.__c)){if(t.componentWillUnmount)try{t.componentWillUnmount()}catch(l){n.__e(l,u)}t.base=t.__P=null}if(t=l.__k)for(o=0;o<t.length;o++)t[o]&&I(t[o],u,i);null!=r&&a(r)}function L(n,l,u){return this.constructor(n,u)}function M(l,u,i){var t,o,c;n.__&&n.__(l,u),o=(t=i===r)?null:i&&i.__k||u.__k,l=v(p,null,[l]),c=[],T(u,(t?u:i||u).__k=l,o||f,f,void 0!==u.ownerSVGElement,i&&!t?[i]:o?null:u.childNodes.length?e.slice.call(u.childNodes):null,c,i||f,t),$(c,l)}function O(n,l){M(n,l,r)}function S(n,l){var u,i;for(i in l=s(s({},n.props),l),arguments.length>2&&(l.children=e.slice.call(arguments,2)),u={},l)"key"!==i&&"ref"!==i&&(u[i]=l[i]);return h(n.type,u,l.key||n.key,l.ref||n.ref,null)}function q(n){var l={},u={__c:"__cC"+o++,__:n,Consumer:function(n,l){return n.children(l)},Provider:function(n){var i,t=this;return this.getChildContext||(i=[],this.getChildContext=function(){return l[u.__c]=t,l},this.shouldComponentUpdate=function(n){t.props.value!==n.value&&i.some(function(l){l.context=n.value,w(l)})},this.sub=function(n){i.push(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){i.splice(i.indexOf(n),1),l&&l.call(n)}}),n.children}};return u.Consumer.contextType=u,u.Provider.__=u,u}n={__e:function(n,l){for(var u,i;l=l.__;)if((u=l.__c)&&!u.__)try{if(u.constructor&&null!=u.constructor.getDerivedStateFromError&&(i=!0,u.setState(u.constructor.getDerivedStateFromError(n))),null!=u.componentDidCatch&&(i=!0,u.componentDidCatch(n)),i)return w(u.__E=u)}catch(l){n=l}throw n}},l=function(n){return null!=n&&void 0===n.constructor},d.prototype.setState=function(n,l){var u;u=this.__s!==this.state?this.__s:this.__s=s({},this.state),"function"==typeof n&&(n=n(u,this.props)),n&&s(u,n),null!=n&&this.__v&&(l&&this.__h.push(l),w(this))},d.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),w(this))},d.prototype.render=p,u=[],i="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,m.__r=0,r=f,o=0;
|
|
6637
6634
|
//# sourceMappingURL=preact.module.js.map
|
|
@@ -6671,9 +6668,6 @@ function warn(warningText) {
|
|
|
6671
6668
|
}
|
|
6672
6669
|
console.warn(`Ada Embed - ${text}`);
|
|
6673
6670
|
}
|
|
6674
|
-
// EXTERNAL MODULE: ./node_modules/uniqid/index.js
|
|
6675
|
-
var uniqid = __webpack_require__(9797);
|
|
6676
|
-
var uniqid_default = /*#__PURE__*/__webpack_require__.n(uniqid);
|
|
6677
6671
|
;// ./node_modules/@sentry/utils/build/esm/debug-build.js
|
|
6678
6672
|
/**
|
|
6679
6673
|
* This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code.
|
|
@@ -16125,7 +16119,7 @@ const client = new BrowserClient({
|
|
|
16125
16119
|
return event;
|
|
16126
16120
|
},
|
|
16127
16121
|
environment: "production",
|
|
16128
|
-
release: "1.14.
|
|
16122
|
+
release: "1.14.21-7e99166",
|
|
16129
16123
|
sampleRate: 0.25,
|
|
16130
16124
|
autoSessionTracking: false,
|
|
16131
16125
|
// Integrations don't seem to work with Sentry: https://github.com/getsentry/sentry-javascript/issues/2541
|
|
@@ -16260,12 +16254,16 @@ let FetchEventStatus = /*#__PURE__*/function (FetchEventStatus) {
|
|
|
16260
16254
|
FetchEventStatus["Failure"] = "FAILURE";
|
|
16261
16255
|
return FetchEventStatus;
|
|
16262
16256
|
}({});
|
|
16257
|
+
// EXTERNAL MODULE: ./node_modules/uniqid/index.js
|
|
16258
|
+
var uniqid = __webpack_require__(9797);
|
|
16259
|
+
var uniqid_default = /*#__PURE__*/__webpack_require__.n(uniqid);
|
|
16263
16260
|
;// ./src/common/lib/channel.ts
|
|
16264
16261
|
|
|
16265
16262
|
|
|
16266
16263
|
|
|
16267
16264
|
|
|
16268
16265
|
|
|
16266
|
+
|
|
16269
16267
|
// MES-981 P1 #6 follow-up: request events whose responses are surfaced
|
|
16270
16268
|
// directly to host-page callers. For these, channel.fetch() differentiates
|
|
16271
16269
|
// timeouts (resolves to undefined) from other failures (re-throws with a
|
|
@@ -16418,6 +16416,9 @@ class FrameChannel extends Channel {
|
|
|
16418
16416
|
} catch {
|
|
16419
16417
|
return;
|
|
16420
16418
|
}
|
|
16419
|
+
if (!parsedData) {
|
|
16420
|
+
return;
|
|
16421
|
+
}
|
|
16421
16422
|
const {
|
|
16422
16423
|
name,
|
|
16423
16424
|
type,
|
|
@@ -16425,7 +16426,7 @@ class FrameChannel extends Channel {
|
|
|
16425
16426
|
id,
|
|
16426
16427
|
status
|
|
16427
16428
|
} = parsedData;
|
|
16428
|
-
if (name !== this.name) {
|
|
16429
|
+
if (name !== this.name || type === undefined) {
|
|
16429
16430
|
return;
|
|
16430
16431
|
}
|
|
16431
16432
|
handler(type, payload, id, status);
|
|
@@ -16538,8 +16539,6 @@ class CustomEventChannel extends Channel {
|
|
|
16538
16539
|
this.addTrackedListener(handleRef);
|
|
16539
16540
|
return handleRef;
|
|
16540
16541
|
}
|
|
16541
|
-
|
|
16542
|
-
// eslint-disable-next-line class-methods-use-this
|
|
16543
16542
|
constructObjectToSend(type, payload, id, status) {
|
|
16544
16543
|
return {
|
|
16545
16544
|
type,
|
|
@@ -16580,27 +16579,27 @@ class MessageService {
|
|
|
16580
16579
|
return Object.values(this.channels);
|
|
16581
16580
|
}
|
|
16582
16581
|
}
|
|
16583
|
-
// EXTERNAL MODULE: ./node_modules/json-stable-stringify/index.js
|
|
16584
|
-
var json_stable_stringify = __webpack_require__(5473);
|
|
16585
|
-
var json_stable_stringify_default = /*#__PURE__*/__webpack_require__.n(json_stable_stringify);
|
|
16586
16582
|
;// ./src/common/constants/actions.ts
|
|
16587
16583
|
let ActionCreators = /*#__PURE__*/function (ActionCreators) {
|
|
16588
|
-
ActionCreators["
|
|
16589
|
-
ActionCreators["
|
|
16590
|
-
ActionCreators["
|
|
16591
|
-
ActionCreators["
|
|
16592
|
-
ActionCreators["
|
|
16584
|
+
ActionCreators["SetStateAction"] = "setState";
|
|
16585
|
+
ActionCreators["ToggleChatAction"] = "toggleChat";
|
|
16586
|
+
ActionCreators["SetConnectionState"] = "setConnectionState";
|
|
16587
|
+
ActionCreators["SendUnreadMessagesAction"] = "sendUnreadMessages";
|
|
16588
|
+
ActionCreators["FocusOffAdaAction"] = "focusOffAda";
|
|
16593
16589
|
return ActionCreators;
|
|
16594
16590
|
}({});
|
|
16595
16591
|
let ActionTypes = /*#__PURE__*/function (ActionTypes) {
|
|
16596
|
-
ActionTypes["
|
|
16597
|
-
ActionTypes["
|
|
16598
|
-
ActionTypes["
|
|
16599
|
-
ActionTypes["
|
|
16600
|
-
ActionTypes["
|
|
16601
|
-
ActionTypes["
|
|
16592
|
+
ActionTypes["SetStateType"] = "SET_STATE";
|
|
16593
|
+
ActionTypes["ToggleChatType"] = "TOGGLE_CHAT";
|
|
16594
|
+
ActionTypes["SetMetaFieldsType"] = "SET_META_FIELDS";
|
|
16595
|
+
ActionTypes["SetConnectionStateType"] = "SET_CONNECTION_STATE";
|
|
16596
|
+
ActionTypes["IncrementMessageCountType"] = "INCREMENT_MESSAGE_COUNT";
|
|
16597
|
+
ActionTypes["FocusOffAdaType"] = "FOCUS_OFF_ADA";
|
|
16602
16598
|
return ActionTypes;
|
|
16603
16599
|
}({});
|
|
16600
|
+
// EXTERNAL MODULE: ./node_modules/json-stable-stringify/index.js
|
|
16601
|
+
var json_stable_stringify = __webpack_require__(5473);
|
|
16602
|
+
var json_stable_stringify_default = /*#__PURE__*/__webpack_require__.n(json_stable_stringify);
|
|
16604
16603
|
;// ./src/client/helpers/event-subscriptions/index.ts
|
|
16605
16604
|
let subscriptions = [];
|
|
16606
16605
|
function hasEventSubscription(eventKey) {
|
|
@@ -16751,7 +16750,7 @@ function getEmbedURL(_ref) {
|
|
|
16751
16750
|
} else {
|
|
16752
16751
|
host = `http://${handle}.localhost:${ports.localhost.default}`;
|
|
16753
16752
|
}
|
|
16754
|
-
return `${host}/embed/${frameName}/${"
|
|
16753
|
+
return `${host}/embed/${frameName}/${"7e99166"}/index.html`;
|
|
16755
16754
|
}
|
|
16756
16755
|
function constructQueryString(query) {
|
|
16757
16756
|
return Object.keys(query).map(key => {
|
|
@@ -16851,7 +16850,7 @@ const actions = {
|
|
|
16851
16850
|
payload = {}
|
|
16852
16851
|
} = _ref;
|
|
16853
16852
|
return {
|
|
16854
|
-
type: ActionTypes.
|
|
16853
|
+
type: ActionTypes.SetStateType,
|
|
16855
16854
|
payload
|
|
16856
16855
|
};
|
|
16857
16856
|
},
|
|
@@ -16918,7 +16917,7 @@ const actions = {
|
|
|
16918
16917
|
});
|
|
16919
16918
|
}
|
|
16920
16919
|
return {
|
|
16921
|
-
type: ActionTypes.
|
|
16920
|
+
type: ActionTypes.ToggleChatType
|
|
16922
16921
|
};
|
|
16923
16922
|
},
|
|
16924
16923
|
sendUnreadMessages: _ref3 => {
|
|
@@ -16926,7 +16925,7 @@ const actions = {
|
|
|
16926
16925
|
payload
|
|
16927
16926
|
} = _ref3;
|
|
16928
16927
|
return {
|
|
16929
|
-
type: ActionTypes.
|
|
16928
|
+
type: ActionTypes.IncrementMessageCountType,
|
|
16930
16929
|
payload: payload
|
|
16931
16930
|
};
|
|
16932
16931
|
},
|
|
@@ -16935,7 +16934,7 @@ const actions = {
|
|
|
16935
16934
|
payload
|
|
16936
16935
|
} = _ref4;
|
|
16937
16936
|
return {
|
|
16938
|
-
type: ActionTypes.
|
|
16937
|
+
type: ActionTypes.SetConnectionStateType,
|
|
16939
16938
|
payload: payload
|
|
16940
16939
|
};
|
|
16941
16940
|
},
|
|
@@ -16944,7 +16943,7 @@ const actions = {
|
|
|
16944
16943
|
payload
|
|
16945
16944
|
} = _ref5;
|
|
16946
16945
|
return {
|
|
16947
|
-
type: ActionTypes.
|
|
16946
|
+
type: ActionTypes.FocusOffAdaType,
|
|
16948
16947
|
payload: payload
|
|
16949
16948
|
};
|
|
16950
16949
|
}
|
|
@@ -16960,7 +16959,7 @@ function mutations_objectSpread(e) { for (var r = 1; r < arguments.length; r++)
|
|
|
16960
16959
|
|
|
16961
16960
|
const mutations = (state, action) => {
|
|
16962
16961
|
switch (action.type) {
|
|
16963
|
-
case ActionTypes.
|
|
16962
|
+
case ActionTypes.ToggleChatType:
|
|
16964
16963
|
{
|
|
16965
16964
|
// MES-981 P1 #9 follow-up: defensive guard against future accidental
|
|
16966
16965
|
// TOGGLE_CHAT_ACTION dispatches in headless mode. The host page has
|
|
@@ -16990,22 +16989,21 @@ const mutations = (state, action) => {
|
|
|
16990
16989
|
hasChatOpenedAfterProactiveMessagesShown
|
|
16991
16990
|
});
|
|
16992
16991
|
}
|
|
16993
|
-
case ActionTypes.
|
|
16994
|
-
return mutations_objectSpread(mutations_objectSpread({}, state), action.payload);
|
|
16995
|
-
case ActionTypes.
|
|
16992
|
+
case ActionTypes.SetStateType:
|
|
16993
|
+
return mutations_objectSpread(mutations_objectSpread({}, state), action.payload ?? {});
|
|
16994
|
+
case ActionTypes.IncrementMessageCountType:
|
|
16996
16995
|
{
|
|
16997
|
-
|
|
16998
|
-
|
|
16999
|
-
} = action.payload;
|
|
16996
|
+
var _action$payload;
|
|
16997
|
+
const messages = ((_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : _action$payload.messages) ?? [];
|
|
17000
16998
|
// Filter out Proactive Messages
|
|
17001
16999
|
const nonProactive = messages.filter(message => !message.campaign_key);
|
|
17002
17000
|
return mutations_objectSpread(mutations_objectSpread({}, state), {}, {
|
|
17003
17001
|
unreadMessageCount: nonProactive.length
|
|
17004
17002
|
});
|
|
17005
17003
|
}
|
|
17006
|
-
case ActionTypes.
|
|
17004
|
+
case ActionTypes.SetConnectionStateType:
|
|
17007
17005
|
{
|
|
17008
|
-
const newConnections = mutations_objectSpread(mutations_objectSpread({}, state.connections), action.payload);
|
|
17006
|
+
const newConnections = mutations_objectSpread(mutations_objectSpread({}, state.connections), action.payload ?? {});
|
|
17009
17007
|
const connectionValues = Object.values(newConnections);
|
|
17010
17008
|
let appConnectionState;
|
|
17011
17009
|
const done = connectionValues.every(connectionState => connectionState === ConnectionState.Done);
|
|
@@ -17025,7 +17023,7 @@ const mutations = (state, action) => {
|
|
|
17025
17023
|
appConnectionState
|
|
17026
17024
|
});
|
|
17027
17025
|
}
|
|
17028
|
-
case ActionTypes.
|
|
17026
|
+
case ActionTypes.FocusOffAdaType:
|
|
17029
17027
|
{
|
|
17030
17028
|
return mutations_objectSpread(mutations_objectSpread({}, state), {}, {
|
|
17031
17029
|
focusIsOnAda: false
|
|
@@ -17067,9 +17065,7 @@ class Store {
|
|
|
17067
17065
|
}
|
|
17068
17066
|
handleEvents(channel, type, payload, id) {
|
|
17069
17067
|
if (type === GET_EVENT) {
|
|
17070
|
-
const
|
|
17071
|
-
key
|
|
17072
|
-
} = payload;
|
|
17068
|
+
const key = payload.key;
|
|
17073
17069
|
this.getEventHandler(channel, key, id);
|
|
17074
17070
|
}
|
|
17075
17071
|
if (type === GET_STATE_EVENT) {
|
|
@@ -17091,8 +17087,6 @@ class Store {
|
|
|
17091
17087
|
actionKey,
|
|
17092
17088
|
payload
|
|
17093
17089
|
} = data;
|
|
17094
|
-
|
|
17095
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17096
17090
|
const actionKeyExists = ak => Object.values(ActionCreators).includes(ak);
|
|
17097
17091
|
if (!actionKeyExists(actionKey)) {
|
|
17098
17092
|
console.error(`Action "${actionKey} doesn't exist.`);
|
|
@@ -17100,8 +17094,7 @@ class Store {
|
|
|
17100
17094
|
}
|
|
17101
17095
|
const actionVal = actions[actionKey]({
|
|
17102
17096
|
currentState: this.state,
|
|
17103
|
-
payload,
|
|
17104
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
17097
|
+
payload: payload,
|
|
17105
17098
|
dispatch: (ak, p) => {
|
|
17106
17099
|
this.dispatchEventHandler(channel, {
|
|
17107
17100
|
actionKey: ak,
|
|
@@ -17225,7 +17218,6 @@ function notificationPermissionsListener(notificationPermissionsChangeHandler) {
|
|
|
17225
17218
|
navigator.permissions.query({
|
|
17226
17219
|
name: "notifications"
|
|
17227
17220
|
}).then(notificationPerm => {
|
|
17228
|
-
// eslint-disable-next-line no-param-reassign
|
|
17229
17221
|
notificationPerm.onchange = () => {
|
|
17230
17222
|
notificationPermissionsChangeHandler(notificationPermissionGuard(notificationPerm.state));
|
|
17231
17223
|
};
|
|
@@ -17269,7 +17261,7 @@ function readMessagingTokenSubject(token) {
|
|
|
17269
17261
|
const padded = normalized.padEnd(normalized.length + (4 - normalized.length % 4) % 4, "=");
|
|
17270
17262
|
const claims = JSON.parse(globalThis.atob(padded));
|
|
17271
17263
|
return typeof claims.sub === "string" && claims.sub ? claims.sub : null;
|
|
17272
|
-
} catch
|
|
17264
|
+
} catch {
|
|
17273
17265
|
return null;
|
|
17274
17266
|
}
|
|
17275
17267
|
}
|
|
@@ -17297,7 +17289,7 @@ function getApiOrigin(_ref) {
|
|
|
17297
17289
|
cluster,
|
|
17298
17290
|
domain
|
|
17299
17291
|
}), window.location.origin).origin;
|
|
17300
|
-
} catch
|
|
17292
|
+
} catch {
|
|
17301
17293
|
return null;
|
|
17302
17294
|
}
|
|
17303
17295
|
}
|
|
@@ -17324,7 +17316,7 @@ function parseMessagingAuthState(value) {
|
|
|
17324
17316
|
if (typeof value === "string") {
|
|
17325
17317
|
try {
|
|
17326
17318
|
parsedValue = JSON.parse(value);
|
|
17327
|
-
} catch
|
|
17319
|
+
} catch {
|
|
17328
17320
|
return null;
|
|
17329
17321
|
}
|
|
17330
17322
|
}
|
|
@@ -17362,7 +17354,7 @@ function safeReadMessagingAuthState(persistence) {
|
|
|
17362
17354
|
try {
|
|
17363
17355
|
var _getMessagingAuthStor;
|
|
17364
17356
|
return parseMessagingAuthState(((_getMessagingAuthStor = getMessagingAuthStorage(persistence)) === null || _getMessagingAuthStor === void 0 ? void 0 : _getMessagingAuthStor.getItem(MESSAGING_AUTH_STATE_STORAGE_KEY)) ?? null);
|
|
17365
|
-
} catch
|
|
17357
|
+
} catch {
|
|
17366
17358
|
return null;
|
|
17367
17359
|
}
|
|
17368
17360
|
}
|
|
@@ -17427,7 +17419,7 @@ function writeMessagingAuthStateToStorage(_ref4) {
|
|
|
17427
17419
|
}
|
|
17428
17420
|
storage.setItem(storageKey, boundState);
|
|
17429
17421
|
return true;
|
|
17430
|
-
} catch
|
|
17422
|
+
} catch {
|
|
17431
17423
|
return false;
|
|
17432
17424
|
}
|
|
17433
17425
|
}
|
|
@@ -17436,7 +17428,7 @@ function clearAllMessagingAuthStatesFromStorage() {
|
|
|
17436
17428
|
try {
|
|
17437
17429
|
var _getMessagingAuthStor2;
|
|
17438
17430
|
(_getMessagingAuthStor2 = getMessagingAuthStorage(persistence)) === null || _getMessagingAuthStor2 === void 0 ? void 0 : _getMessagingAuthStor2.removeItem(MESSAGING_AUTH_STATE_STORAGE_KEY);
|
|
17439
|
-
} catch
|
|
17431
|
+
} catch {
|
|
17440
17432
|
// Storage blocked; nothing to clear.
|
|
17441
17433
|
}
|
|
17442
17434
|
});
|
|
@@ -17469,7 +17461,7 @@ function clearMessagingAuthStateFromStorage(_ref5) {
|
|
|
17469
17461
|
return;
|
|
17470
17462
|
}
|
|
17471
17463
|
(_getMessagingAuthStor3 = getMessagingAuthStorage(persistence)) === null || _getMessagingAuthStor3 === void 0 ? void 0 : _getMessagingAuthStor3.removeItem(MESSAGING_AUTH_STATE_STORAGE_KEY);
|
|
17472
|
-
} catch
|
|
17464
|
+
} catch {
|
|
17473
17465
|
// Storage blocked; nothing to clear.
|
|
17474
17466
|
}
|
|
17475
17467
|
});
|
|
@@ -17545,6 +17537,9 @@ const getInitialState = adaSettings => {
|
|
|
17545
17537
|
showFallbackOnTimeout: true
|
|
17546
17538
|
};
|
|
17547
17539
|
};
|
|
17540
|
+
// EXTERNAL MODULE: ./node_modules/lodash.debounce/index.js
|
|
17541
|
+
var lodash_debounce = __webpack_require__(181);
|
|
17542
|
+
var lodash_debounce_default = /*#__PURE__*/__webpack_require__.n(lodash_debounce);
|
|
17548
17543
|
// EXTERNAL MODULE: ./node_modules/lodash.memoize/index.js
|
|
17549
17544
|
var lodash_memoize = __webpack_require__(7654);
|
|
17550
17545
|
var lodash_memoize_default = /*#__PURE__*/__webpack_require__.n(lodash_memoize);
|
|
@@ -17591,9 +17586,9 @@ async function log(message, extra, options) {
|
|
|
17591
17586
|
service: "embed",
|
|
17592
17587
|
env: "production",
|
|
17593
17588
|
embedVersion: 2,
|
|
17594
|
-
version: "1.14.
|
|
17589
|
+
version: "1.14.21",
|
|
17595
17590
|
isNpm: true,
|
|
17596
|
-
commitHash: "
|
|
17591
|
+
commitHash: "7e99166"
|
|
17597
17592
|
}))
|
|
17598
17593
|
});
|
|
17599
17594
|
}
|
|
@@ -17608,7 +17603,16 @@ function getPathSearchRegex(path) {
|
|
|
17608
17603
|
const escapedParams = encodeURI(params[1]);
|
|
17609
17604
|
return new RegExp(`^${params[0]}\\?${escapedParams}$`);
|
|
17610
17605
|
}
|
|
17611
|
-
|
|
17606
|
+
|
|
17607
|
+
// Only "*" is a wildcard ("match anything"); every other character — including
|
|
17608
|
+
// regex metacharacters in a customer URL like "." or "(" — is matched literally,
|
|
17609
|
+
// so they are escaped rather than interpreted (or throwing on an unbalanced "("
|
|
17610
|
+
// or a trailing "\"). A trailing "/*" is optional: "/help/*" also matches "/help"
|
|
17611
|
+
// with nothing after it.
|
|
17612
|
+
const hasTrailingWildcard = path.endsWith("/*");
|
|
17613
|
+
const base = hasTrailingWildcard ? path.slice(0, -2) : path;
|
|
17614
|
+
const escaped = base.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*");
|
|
17615
|
+
const newPath = hasTrailingWildcard ? `${escaped}(/.*)?` : escaped;
|
|
17612
17616
|
return new RegExp(`^${newPath}$`);
|
|
17613
17617
|
}
|
|
17614
17618
|
function doesUrlMatchPath(url, path) {
|
|
@@ -17705,8 +17709,6 @@ function trackEventImpl(adaSettings, chatterToken, sessionToken, params) {
|
|
|
17705
17709
|
value,
|
|
17706
17710
|
meta
|
|
17707
17711
|
} = params;
|
|
17708
|
-
|
|
17709
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
17710
17712
|
httpRequest({
|
|
17711
17713
|
url: `${baseApiUrl}business_events/track`,
|
|
17712
17714
|
method: "POST",
|
|
@@ -17732,323 +17734,626 @@ const getEventsToTrigger = businessEvents =>
|
|
|
17732
17734
|
* we may change this in the future
|
|
17733
17735
|
*/
|
|
17734
17736
|
businessEvents.filter(businessEvent => businessEvent.trigger_conditions.some(triggerCondition => evalTriggerCondition(triggerCondition)));
|
|
17735
|
-
;// ./src/
|
|
17736
|
-
const Languages = {
|
|
17737
|
-
en: "en",
|
|
17738
|
-
// English
|
|
17739
|
-
be: "be",
|
|
17740
|
-
// Belarusian
|
|
17741
|
-
da: "da",
|
|
17742
|
-
// Danish
|
|
17743
|
-
de: "de",
|
|
17744
|
-
// German
|
|
17745
|
-
es: "es",
|
|
17746
|
-
// Spanish
|
|
17747
|
-
fi: "fi",
|
|
17748
|
-
// Finnish
|
|
17749
|
-
fr: "fr",
|
|
17750
|
-
// French
|
|
17751
|
-
hi: "hi",
|
|
17752
|
-
// Hindi
|
|
17753
|
-
ht: "ht",
|
|
17754
|
-
// Haitian Creole
|
|
17755
|
-
id: "id",
|
|
17756
|
-
// Indonesian
|
|
17757
|
-
it: "it",
|
|
17758
|
-
// Italian
|
|
17759
|
-
ja: "ja",
|
|
17760
|
-
// Japanese
|
|
17761
|
-
km: "km",
|
|
17762
|
-
// Khmer
|
|
17763
|
-
ko: "ko",
|
|
17764
|
-
// Korean
|
|
17765
|
-
ms: "ms",
|
|
17766
|
-
// Malay
|
|
17767
|
-
my: "my",
|
|
17768
|
-
// Burmese
|
|
17769
|
-
no: "no",
|
|
17770
|
-
// Norwegian
|
|
17771
|
-
nl: "nl",
|
|
17772
|
-
// Dutch
|
|
17773
|
-
pa: "pa",
|
|
17774
|
-
// Punjabi
|
|
17775
|
-
pt: "pt",
|
|
17776
|
-
// Portuguese
|
|
17777
|
-
ru: "ru",
|
|
17778
|
-
// Russian
|
|
17779
|
-
sv: "sv",
|
|
17780
|
-
// Swedish
|
|
17781
|
-
ta: "ta",
|
|
17782
|
-
// Tamil
|
|
17783
|
-
th: "th",
|
|
17784
|
-
// Thai
|
|
17785
|
-
tl: "tl",
|
|
17786
|
-
// Tagalog
|
|
17787
|
-
tr: "tr",
|
|
17788
|
-
// Turkish
|
|
17789
|
-
uk: "uk",
|
|
17790
|
-
// Ukrainian
|
|
17791
|
-
vi: "vi",
|
|
17792
|
-
// Vietnamese
|
|
17793
|
-
zh: "zh",
|
|
17794
|
-
// Chinese simplified
|
|
17795
|
-
"zh-tw": "zh-tw",
|
|
17796
|
-
// Chinese traditional
|
|
17797
|
-
bg: "bg",
|
|
17798
|
-
// Bulgarian
|
|
17799
|
-
ro: "ro",
|
|
17800
|
-
// Romanian
|
|
17801
|
-
el: "el",
|
|
17802
|
-
// Greek
|
|
17803
|
-
hu: "hu",
|
|
17804
|
-
// Hungarian
|
|
17805
|
-
pl: "pl",
|
|
17806
|
-
// Polish
|
|
17807
|
-
cs: "cs",
|
|
17808
|
-
// Czech
|
|
17809
|
-
et: "et",
|
|
17810
|
-
// Estonian
|
|
17811
|
-
hr: "hr",
|
|
17812
|
-
// Croatian
|
|
17813
|
-
lt: "lt",
|
|
17814
|
-
// Lithuanian
|
|
17815
|
-
lv: "lv",
|
|
17816
|
-
// Latvian
|
|
17817
|
-
sl: "sl",
|
|
17818
|
-
// Slovenian
|
|
17819
|
-
sk: "sk",
|
|
17820
|
-
// Slovak
|
|
17821
|
-
is: "is",
|
|
17822
|
-
// Icelandic
|
|
17823
|
-
ar: "ar",
|
|
17824
|
-
// Arabic
|
|
17825
|
-
he: "he" // Hebrew
|
|
17826
|
-
};
|
|
17827
|
-
;// ./src/common/helpers/get-browser-language.ts
|
|
17828
|
-
|
|
17829
|
-
const DEFAULT_LANGUAGE_CODE = "en";
|
|
17830
|
-
const SUPPORTED_LANGUAGES = [...Object.values(Languages)];
|
|
17831
|
-
/**
|
|
17832
|
-
* Gets a language code from the browser. Stolen from `chat` repo
|
|
17833
|
-
*
|
|
17834
|
-
* NOTE: THIS SHOULD NOT EXIST. IF YOU FIND YOURSELF IN A POSITION WHERE YOU NEED TO SUPPORT THIS
|
|
17835
|
-
* CODE, PLEASE DO EVERYTHING IN YOUR POWER TO AVOID IT. THIS CODE SHOULD DIE. EMBED SHOULD NOT BE
|
|
17836
|
-
* IN CHARGE OF PICKING LANGUAGES AND ANY CODE MAKING USE OF THIS FUNCTION SHOULD BE KEPT TO AN
|
|
17837
|
-
* ABSOLUTE MINIMUM.
|
|
17838
|
-
*
|
|
17839
|
-
* THIS WAS A NECESSARY HACK BECAUSE INTROS WERE IMPLEMENTED IN EMBED, BEFORE TRANSLATIONS
|
|
17840
|
-
* WERE A THING, AND GOT LEFT BEHIND DURING THE IMPLEMENTATION THEREOF.
|
|
17841
|
-
*
|
|
17842
|
-
* I'M SO SORRY.
|
|
17843
|
-
*/
|
|
17844
|
-
|
|
17845
|
-
function isSupportedLanguageCode(languageCode) {
|
|
17846
|
-
return SUPPORTED_LANGUAGES.includes(languageCode);
|
|
17847
|
-
}
|
|
17848
|
-
const getBrowserLanguage = () => {
|
|
17849
|
-
const browserLanguageString = (navigator.languages && navigator.languages[0] || navigator.language || navigator.userLanguage || navigator.browserLanguage || navigator.systemLanguage || DEFAULT_LANGUAGE_CODE).toLowerCase();
|
|
17850
|
-
if (isSupportedLanguageCode(browserLanguageString)) {
|
|
17851
|
-
return browserLanguageString;
|
|
17852
|
-
}
|
|
17853
|
-
if (browserLanguageString.includes("-")) {
|
|
17854
|
-
// an unsupported, hyphenated language code was received so return the main locale
|
|
17855
|
-
// if it is supported
|
|
17856
|
-
const mainLocale = browserLanguageString.split("-")[0];
|
|
17857
|
-
if (isSupportedLanguageCode(mainLocale)) {
|
|
17858
|
-
return mainLocale;
|
|
17859
|
-
}
|
|
17860
|
-
}
|
|
17861
|
-
return browserLanguageString;
|
|
17862
|
-
};
|
|
17863
|
-
/* harmony default export */ var get_browser_language = (getBrowserLanguage);
|
|
17864
|
-
;// ./src/services/helpers.ts
|
|
17865
|
-
const NO_OP_FUNCTION = () => {
|
|
17866
|
-
// Do nothing
|
|
17867
|
-
};
|
|
17868
|
-
function isStartOptions(input) {
|
|
17869
|
-
if (!(typeof input === "object")) {
|
|
17870
|
-
return false;
|
|
17871
|
-
}
|
|
17872
|
-
if (input === null) {
|
|
17873
|
-
return false;
|
|
17874
|
-
}
|
|
17875
|
-
return typeof input.handle === "string";
|
|
17876
|
-
}
|
|
17877
|
-
;// ./src/campaigns/campaign.ts
|
|
17878
|
-
|
|
17879
|
-
function campaign_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
17880
|
-
function campaign_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? campaign_ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : campaign_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
17881
|
-
|
|
17882
|
-
|
|
17737
|
+
;// ./src/proactiveConversations/proactiveConversation.ts
|
|
17883
17738
|
|
|
17739
|
+
function proactiveConversation_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
17740
|
+
function proactiveConversation_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? proactiveConversation_ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : proactiveConversation_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
17884
17741
|
|
|
17885
17742
|
|
|
17886
17743
|
|
|
17887
17744
|
|
|
17888
17745
|
|
|
17889
|
-
|
|
17890
|
-
|
|
17891
|
-
|
|
17892
|
-
|
|
17893
|
-
|
|
17894
|
-
|
|
17895
|
-
|
|
17896
|
-
|
|
17897
|
-
* example, if a campaign is shown to a user with frequency once-per-user and then has its
|
|
17898
|
-
* frequency changed to every-time, it will still be shown properly.
|
|
17899
|
-
*/
|
|
17900
|
-
function campaignShownWithinFrequency(campaign, handle) {
|
|
17901
|
-
switch (campaign.message_frequency) {
|
|
17902
|
-
case "every-time":
|
|
17746
|
+
// Once-per-user suppression persists in localStorage across sessions. It uses a
|
|
17747
|
+
// key distinct from `proactive_conversations_shown` because that key is owned by
|
|
17748
|
+
// the ranking "shown" set (see getRankedShownKeys); sharing it would conflate
|
|
17749
|
+
// user-frequency suppression with ranking's advance-across-visits state.
|
|
17750
|
+
const USER_FREQUENCY_STORAGE_KEY = "proactive_conversations_shown_user";
|
|
17751
|
+
function proactiveShownWithinFrequency(proactiveConversationKey, frequency, handle) {
|
|
17752
|
+
switch (frequency) {
|
|
17753
|
+
case "always":
|
|
17903
17754
|
return false;
|
|
17904
|
-
case "
|
|
17755
|
+
case "session":
|
|
17905
17756
|
{
|
|
17906
|
-
const storageValue = dist/* adaSessionStorage */.ad.getFnItem("
|
|
17907
|
-
const
|
|
17908
|
-
return
|
|
17757
|
+
const storageValue = dist/* adaSessionStorage */.ad.getFnItem("proactive_conversations_shown");
|
|
17758
|
+
const perSessionProactives = storageValue ? (storageValue[handle] || "").split(",") : [];
|
|
17759
|
+
return perSessionProactives.includes(proactiveConversationKey);
|
|
17909
17760
|
}
|
|
17910
|
-
case "
|
|
17761
|
+
case "user":
|
|
17911
17762
|
{
|
|
17912
|
-
const storageValue = dist/* adaLocalStorage */.BB.getFnItem(
|
|
17913
|
-
const
|
|
17914
|
-
return
|
|
17763
|
+
const storageValue = dist/* adaLocalStorage */.BB.getFnItem(USER_FREQUENCY_STORAGE_KEY);
|
|
17764
|
+
const perUserProactives = storageValue ? (storageValue[handle] || "").split(",") : [];
|
|
17765
|
+
return perUserProactives.includes(proactiveConversationKey);
|
|
17915
17766
|
}
|
|
17916
17767
|
default:
|
|
17917
17768
|
return false;
|
|
17918
17769
|
}
|
|
17919
17770
|
}
|
|
17920
|
-
|
|
17921
|
-
|
|
17771
|
+
|
|
17772
|
+
// Ranking advances across visits: once a proactive fires it's remembered so a
|
|
17773
|
+
// later visit surfaces the next-highest priority instead of repeating it. This
|
|
17774
|
+
// "shown" set persists in localStorage (across visits, unlike the per-session
|
|
17775
|
+
// frequency record above) under the same disclosed `proactive_conversations_shown`
|
|
17776
|
+
// key, scoped by handle.
|
|
17777
|
+
function getRankedShownKeys(handle) {
|
|
17778
|
+
const storageValue = dist/* adaLocalStorage */.BB.getFnItem("proactive_conversations_shown");
|
|
17779
|
+
const stored = storageValue ? storageValue[handle] : undefined;
|
|
17780
|
+
return stored ? stored.split(",") : [];
|
|
17781
|
+
}
|
|
17782
|
+
function setRankedShownKeys(handle, keys) {
|
|
17783
|
+
const storageValue = dist/* adaLocalStorage */.BB.getFnItem("proactive_conversations_shown") || {};
|
|
17784
|
+
dist/* adaLocalStorage */.BB.setFnItem("proactive_conversations_shown", proactiveConversation_objectSpread(proactiveConversation_objectSpread({}, storageValue), {}, {
|
|
17785
|
+
[handle]: keys.join(",")
|
|
17786
|
+
}));
|
|
17787
|
+
}
|
|
17788
|
+
function recordRankedShown(handle, proactiveConversationKey) {
|
|
17789
|
+
const keys = getRankedShownKeys(handle);
|
|
17790
|
+
if (!keys.includes(proactiveConversationKey)) {
|
|
17791
|
+
setRankedShownKeys(handle, [...keys, proactiveConversationKey]);
|
|
17792
|
+
}
|
|
17922
17793
|
}
|
|
17923
17794
|
|
|
17924
|
-
//
|
|
17925
|
-
|
|
17926
|
-
|
|
17927
|
-
|
|
17795
|
+
// A proactive only fires when `now` is within its optional scheduling window.
|
|
17796
|
+
// Bounds are absolute ISO 8601 UTC instants authored in the dashboard; either
|
|
17797
|
+
// may be unset for an open-ended window. This mirrors the declarative campaign
|
|
17798
|
+
// datetime gating: the start is after-inclusive and the end is before-exclusive,
|
|
17799
|
+
// evaluated through the shared trigger-condition evaluator so the semantics stay
|
|
17800
|
+
// identical across both surfaces.
|
|
17801
|
+
function isWithinSchedule(scheduleStart, scheduleEnd) {
|
|
17802
|
+
const now = new Date();
|
|
17803
|
+
const buildCondition = (operator, datetime) => ({
|
|
17804
|
+
type: "datetime",
|
|
17805
|
+
// Bounds are absolute UTC instants (the stored datetime carries a `Z`
|
|
17806
|
+
// offset). `timezone` is metadata the evaluator doesn't consult, but label
|
|
17807
|
+
// it UTC to match the data and stay correct if the evaluator ever honors it.
|
|
17808
|
+
timezone: "UTC",
|
|
17809
|
+
condition: {
|
|
17810
|
+
operator,
|
|
17811
|
+
datetime
|
|
17812
|
+
}
|
|
17813
|
+
});
|
|
17814
|
+
if (scheduleStart && !evalDatetimeTriggerCondition(buildCondition("after-inclusive", scheduleStart), now)) {
|
|
17815
|
+
return false;
|
|
17816
|
+
}
|
|
17817
|
+
if (scheduleEnd && !evalDatetimeTriggerCondition(buildCondition("before-exclusive", scheduleEnd), now)) {
|
|
17818
|
+
return false;
|
|
17819
|
+
}
|
|
17820
|
+
return true;
|
|
17821
|
+
}
|
|
17822
|
+
|
|
17823
|
+
// When several active proactives match the same URL, only the highest priority
|
|
17824
|
+
// fires: the lowest `order` wins, and any explicit rank beats an unranked one.
|
|
17825
|
+
function pickHighestPriorityMatch(matches) {
|
|
17826
|
+
return [...matches].sort((_ref, _ref2) => {
|
|
17827
|
+
let [, a] = _ref;
|
|
17828
|
+
let [, b] = _ref2;
|
|
17829
|
+
return (a.order ?? Infinity) - (b.order ?? Infinity);
|
|
17830
|
+
})[0];
|
|
17831
|
+
}
|
|
17832
|
+
function addProactiveToStorageString(oldStorageValue, proactiveConversationId) {
|
|
17833
|
+
return oldStorageValue ? `${oldStorageValue},${proactiveConversationId}` : proactiveConversationId;
|
|
17834
|
+
}
|
|
17835
|
+
function recordProactiveTrigger(proactiveConversationKey, frequency, handle) {
|
|
17836
|
+
switch (frequency) {
|
|
17837
|
+
case "always":
|
|
17928
17838
|
break;
|
|
17929
|
-
case "
|
|
17839
|
+
case "session":
|
|
17930
17840
|
{
|
|
17931
|
-
const currentStorageValue = dist/* adaSessionStorage */.ad.getFnItem("
|
|
17932
|
-
const newStorageValue =
|
|
17933
|
-
dist/* adaSessionStorage */.ad.setFnItem("
|
|
17841
|
+
const currentStorageValue = dist/* adaSessionStorage */.ad.getFnItem("proactive_conversations_shown");
|
|
17842
|
+
const newStorageValue = addProactiveToStorageString(currentStorageValue ? currentStorageValue[handle] || "" : "", proactiveConversationKey);
|
|
17843
|
+
dist/* adaSessionStorage */.ad.setFnItem("proactive_conversations_shown", proactiveConversation_objectSpread(proactiveConversation_objectSpread({}, currentStorageValue), {}, {
|
|
17934
17844
|
[handle]: newStorageValue
|
|
17935
17845
|
}));
|
|
17936
17846
|
break;
|
|
17937
17847
|
}
|
|
17938
|
-
case "
|
|
17848
|
+
case "user":
|
|
17939
17849
|
{
|
|
17940
|
-
const currentStorageValue = dist/* adaLocalStorage */.BB.getFnItem(
|
|
17941
|
-
const newStorageValue =
|
|
17942
|
-
dist/* adaLocalStorage */.BB.setFnItem(
|
|
17850
|
+
const currentStorageValue = dist/* adaLocalStorage */.BB.getFnItem(USER_FREQUENCY_STORAGE_KEY);
|
|
17851
|
+
const newStorageValue = addProactiveToStorageString(currentStorageValue ? currentStorageValue[handle] || "" : "", proactiveConversationKey);
|
|
17852
|
+
dist/* adaLocalStorage */.BB.setFnItem(USER_FREQUENCY_STORAGE_KEY, proactiveConversation_objectSpread(proactiveConversation_objectSpread({}, currentStorageValue), {}, {
|
|
17943
17853
|
[handle]: newStorageValue
|
|
17944
17854
|
}));
|
|
17945
17855
|
break;
|
|
17946
17856
|
}
|
|
17947
|
-
|
|
17948
|
-
// If an unknown frequency type is found, do nothing
|
|
17949
17857
|
default:
|
|
17950
17858
|
break;
|
|
17951
17859
|
}
|
|
17952
17860
|
}
|
|
17953
|
-
|
|
17861
|
+
|
|
17862
|
+
// Rich content (image + single CTA) is optional. The image is keyed by
|
|
17863
|
+
// language; fall back to the first language by sorted key (the URL is shared
|
|
17864
|
+
// across languages — only the alt text is translated — so the fallback is
|
|
17865
|
+
// deterministic rather than relying on object key order).
|
|
17866
|
+
function extractRichContent(proactiveConversation, language) {
|
|
17867
|
+
var _images$language, _images$fallbackLangu;
|
|
17868
|
+
const {
|
|
17869
|
+
images,
|
|
17870
|
+
ctas
|
|
17871
|
+
} = proactiveConversation;
|
|
17872
|
+
const fallbackLanguage = images ? Object.keys(images).sort()[0] : undefined;
|
|
17873
|
+
const imageConfig = (images === null || images === void 0 ? void 0 : (_images$language = images[language]) === null || _images$language === void 0 ? void 0 : _images$language[0]) ?? (fallbackLanguage ? images === null || images === void 0 ? void 0 : (_images$fallbackLangu = images[fallbackLanguage]) === null || _images$fallbackLangu === void 0 ? void 0 : _images$fallbackLangu[0] : undefined);
|
|
17874
|
+
const ctaConfig = ctas === null || ctas === void 0 ? void 0 : ctas[0];
|
|
17875
|
+
return {
|
|
17876
|
+
image: imageConfig ? {
|
|
17877
|
+
url: imageConfig.url,
|
|
17878
|
+
alt: imageConfig.alt
|
|
17879
|
+
} : undefined,
|
|
17880
|
+
cta: ctaConfig ? {
|
|
17881
|
+
label: ctaConfig.cta_label,
|
|
17882
|
+
url: ctaConfig.cta_url,
|
|
17883
|
+
openInNewTab: ctaConfig.cta_open_in_new_tab
|
|
17884
|
+
} : undefined
|
|
17885
|
+
};
|
|
17886
|
+
}
|
|
17887
|
+
function proactiveTriggerImpl(_ref3) {
|
|
17954
17888
|
let {
|
|
17889
|
+
proactiveConversation,
|
|
17890
|
+
triggerMethod,
|
|
17955
17891
|
adaSettings,
|
|
17956
|
-
|
|
17957
|
-
|
|
17958
|
-
|
|
17959
|
-
|
|
17960
|
-
clearCampaignToTrigger,
|
|
17961
|
-
messageService
|
|
17962
|
-
} = _ref;
|
|
17892
|
+
messageService,
|
|
17893
|
+
language,
|
|
17894
|
+
clearProactiveConversation
|
|
17895
|
+
} = _ref3;
|
|
17963
17896
|
const {
|
|
17964
|
-
handle
|
|
17965
|
-
cluster,
|
|
17966
|
-
domain
|
|
17897
|
+
handle
|
|
17967
17898
|
} = adaSettings;
|
|
17968
|
-
|
|
17969
|
-
|
|
17970
|
-
|
|
17971
|
-
|
|
17972
|
-
|
|
17973
|
-
|
|
17974
|
-
|
|
17975
|
-
|
|
17976
|
-
|
|
17899
|
+
const {
|
|
17900
|
+
key,
|
|
17901
|
+
params = {},
|
|
17902
|
+
is_template: isTemplate
|
|
17903
|
+
} = proactiveConversation;
|
|
17904
|
+
const messageKey = String(key);
|
|
17905
|
+
const {
|
|
17906
|
+
duration,
|
|
17907
|
+
delay,
|
|
17908
|
+
frequency,
|
|
17909
|
+
active,
|
|
17910
|
+
schedule_start: scheduleStart,
|
|
17911
|
+
schedule_end: scheduleEnd
|
|
17912
|
+
} = proactiveConversation.modality_config.chat;
|
|
17913
|
+
let proactiveMessage = proactiveConversation.messages[language][0];
|
|
17914
|
+
if (!active) {
|
|
17915
|
+
warn("Proactive message is not active");
|
|
17977
17916
|
return;
|
|
17978
17917
|
}
|
|
17979
|
-
if (!(
|
|
17980
|
-
warn(
|
|
17918
|
+
if (!isWithinSchedule(scheduleStart, scheduleEnd)) {
|
|
17919
|
+
warn("Proactive message is outside its scheduled window");
|
|
17981
17920
|
return;
|
|
17982
17921
|
}
|
|
17983
|
-
|
|
17984
|
-
|
|
17985
|
-
|
|
17986
|
-
|
|
17987
|
-
const body = campaign.message_text[language];
|
|
17988
|
-
const duration = campaign.message_duration;
|
|
17989
|
-
const responseId = campaign.follow_up_response_id;
|
|
17990
|
-
if (body) {
|
|
17991
|
-
localChannel.postMessage(CREATE_PROACTIVE, {
|
|
17992
|
-
body,
|
|
17993
|
-
duration,
|
|
17994
|
-
responseId
|
|
17995
|
-
});
|
|
17996
|
-
} else {
|
|
17997
|
-
warn(`No translation for this campaign (campaign_key: ${campaign.campaign_key}) is defined for the language: ${language}`);
|
|
17922
|
+
if (isTemplate) {
|
|
17923
|
+
if (Object.keys(params).length === 0) {
|
|
17924
|
+
warn("Proactive message is a template but no parameters were provided");
|
|
17925
|
+
return;
|
|
17998
17926
|
}
|
|
17999
|
-
|
|
18000
|
-
|
|
18001
|
-
|
|
18002
|
-
|
|
18003
|
-
|
|
18004
|
-
|
|
18005
|
-
|
|
17927
|
+
|
|
17928
|
+
// Replace the template variables with the param values
|
|
17929
|
+
const missingParams = [];
|
|
17930
|
+
proactiveMessage = proactiveMessage.replace(/{{(.*?)}}/g, (_match, variableKey) => {
|
|
17931
|
+
if (!(variableKey in params)) {
|
|
17932
|
+
missingParams.push(variableKey);
|
|
17933
|
+
}
|
|
17934
|
+
return params[variableKey];
|
|
18006
17935
|
});
|
|
18007
|
-
|
|
18008
|
-
|
|
18009
|
-
|
|
18010
|
-
body: JSON.stringify({
|
|
18011
|
-
customer_query: {
|
|
18012
|
-
token: chatterToken
|
|
18013
|
-
},
|
|
18014
|
-
ignore_status: ignoreStatus
|
|
18015
|
-
})
|
|
18016
|
-
}).catch(NO_OP_FUNCTION); // we don't want to log errors here, it may fail because of rate limiting
|
|
18017
|
-
}
|
|
18018
|
-
}
|
|
18019
|
-
const getCampaignToTrigger = (adaSettings, marketingCampaigns, options, onlyBasic) => {
|
|
18020
|
-
const {
|
|
18021
|
-
ignoreStatus = false,
|
|
18022
|
-
ignoreFrequency = false
|
|
18023
|
-
} = options;
|
|
18024
|
-
const {
|
|
18025
|
-
handle
|
|
18026
|
-
} = adaSettings;
|
|
18027
|
-
return marketingCampaigns === null || marketingCampaigns === void 0 ? void 0 : marketingCampaigns.find(campaign => {
|
|
18028
|
-
if (campaign.status !== "active" && !ignoreStatus) {
|
|
18029
|
-
return false;
|
|
17936
|
+
if (missingParams.length > 0) {
|
|
17937
|
+
warn(`Missing parameters for template message: ${missingParams.join(", ")}`);
|
|
17938
|
+
return;
|
|
18030
17939
|
}
|
|
18031
|
-
|
|
18032
|
-
|
|
17940
|
+
}
|
|
17941
|
+
if (triggerMethod === "url") {
|
|
17942
|
+
// Check if the proactive message has been shown within the specified frequency
|
|
17943
|
+
const doesPassFrequencyCheck = !proactiveShownWithinFrequency(messageKey, frequency, handle);
|
|
17944
|
+
if (!doesPassFrequencyCheck) {
|
|
17945
|
+
return;
|
|
18033
17946
|
}
|
|
17947
|
+
}
|
|
18034
17948
|
|
|
18035
|
-
|
|
18036
|
-
|
|
18037
|
-
|
|
17949
|
+
// Record the proactive message as being shown
|
|
17950
|
+
recordProactiveTrigger(messageKey, frequency, handle);
|
|
17951
|
+
|
|
17952
|
+
// Remember URL-triggered shows so ranking advances to the next proactive on
|
|
17953
|
+
// the next visit. Recording every URL trigger (not just ranked ones) is safe:
|
|
17954
|
+
// the unranked fire-all path never reads this set, and the loop-reset in
|
|
17955
|
+
// `selectProactivesToTriggerForUrl` clears any stale keys.
|
|
17956
|
+
if (triggerMethod === "url") {
|
|
17957
|
+
recordRankedShown(handle, messageKey);
|
|
17958
|
+
}
|
|
17959
|
+
const {
|
|
17960
|
+
image,
|
|
17961
|
+
cta
|
|
17962
|
+
} = extractRichContent(proactiveConversation, language);
|
|
17963
|
+
clearProactiveConversation();
|
|
17964
|
+
const localChannel = messageService.getChannel("local");
|
|
17965
|
+
localChannel.postMessage(CREATE_PROACTIVE, {
|
|
17966
|
+
body: proactiveMessage,
|
|
17967
|
+
duration,
|
|
17968
|
+
delay,
|
|
17969
|
+
image,
|
|
17970
|
+
cta,
|
|
17971
|
+
proactiveConfig: {
|
|
17972
|
+
key: messageKey,
|
|
17973
|
+
params,
|
|
17974
|
+
playbook_id: proactiveConversation.playbook_id
|
|
18038
17975
|
}
|
|
18039
|
-
const conditionsMet = campaign.trigger_conditions.every(tc => evalTriggerCondition(tc));
|
|
18040
|
-
const doesPassFrequencyCheck = ignoreFrequency || !campaignShownWithinFrequency(campaign, handle);
|
|
18041
|
-
return conditionsMet && doesPassFrequencyCheck;
|
|
18042
17976
|
});
|
|
18043
|
-
|
|
18044
|
-
|
|
18045
|
-
|
|
18046
|
-
|
|
18047
|
-
|
|
18048
|
-
|
|
18049
|
-
|
|
18050
|
-
|
|
18051
|
-
|
|
17977
|
+
log("Proactive message displayed", {
|
|
17978
|
+
handle,
|
|
17979
|
+
language,
|
|
17980
|
+
duration,
|
|
17981
|
+
delay
|
|
17982
|
+
});
|
|
17983
|
+
}
|
|
17984
|
+
function evaluateUrlTriggerConditions(conditions, url) {
|
|
17985
|
+
if (!(conditions !== null && conditions !== void 0 && conditions.length)) {
|
|
17986
|
+
return false;
|
|
17987
|
+
}
|
|
17988
|
+
return evalUrlMatchTriggerCondition(conditions, url);
|
|
17989
|
+
}
|
|
17990
|
+
|
|
17991
|
+
// The proactives to fire for the current URL, among the active, non-template
|
|
17992
|
+
// ones whose schedule + URL conditions match and that haven't been suppressed
|
|
17993
|
+
// by their frequency this session (filtering frequency here, not just in
|
|
17994
|
+
// `proactiveTriggerImpl`, lets a lower-priority proactive still fire when the
|
|
17995
|
+
// top one has already been shown).
|
|
17996
|
+
//
|
|
17997
|
+
// Prioritization is configured only by clients on the
|
|
17998
|
+
// `proactive-messaging-image-support` flag — the only ones who can rank in the
|
|
17999
|
+
// dashboard. Embed has no flag access, so the presence of an `order` is the
|
|
18000
|
+
// signal: when any match is ranked, exactly one fires and successive visits
|
|
18001
|
+
// advance down the ranking (the highest priority that hasn't been shown yet,
|
|
18002
|
+
// looping back to the top once all have), rather than firing every match — the
|
|
18003
|
+
// pre-ranking behavior kept for unranked clients.
|
|
18004
|
+
function selectProactivesToTriggerForUrl(proactiveConversations, url, handle) {
|
|
18005
|
+
const matches = Object.entries(proactiveConversations).filter(_ref4 => {
|
|
18006
|
+
let [key, conversation] = _ref4;
|
|
18007
|
+
const chatConfig = conversation.modality_config.chat;
|
|
18008
|
+
return chatConfig.active && !conversation.is_template && isWithinSchedule(chatConfig.schedule_start, chatConfig.schedule_end) && evaluateUrlTriggerConditions(chatConfig.url_trigger_conditions, url) && !proactiveShownWithinFrequency(key, chatConfig.frequency, handle);
|
|
18009
|
+
});
|
|
18010
|
+
const isRankingConfigured = matches.some(_ref5 => {
|
|
18011
|
+
let [, conversation] = _ref5;
|
|
18012
|
+
return typeof conversation.order === "number";
|
|
18013
|
+
});
|
|
18014
|
+
if (!isRankingConfigured) {
|
|
18015
|
+
return matches;
|
|
18016
|
+
}
|
|
18017
|
+
|
|
18018
|
+
// Ranking fires one proactive per visit and advances down the list: matches
|
|
18019
|
+
// already shown on previous visits are skipped so the next-highest priority
|
|
18020
|
+
// fires. Once every current match has been shown, clear their records so the
|
|
18021
|
+
// cycle loops back to the top.
|
|
18022
|
+
const shownKeys = getRankedShownKeys(handle);
|
|
18023
|
+
const unshown = matches.filter(_ref6 => {
|
|
18024
|
+
let [key] = _ref6;
|
|
18025
|
+
return !shownKeys.includes(key);
|
|
18026
|
+
});
|
|
18027
|
+
if (unshown.length === 0) {
|
|
18028
|
+
const matchKeys = matches.map(_ref7 => {
|
|
18029
|
+
let [key] = _ref7;
|
|
18030
|
+
return key;
|
|
18031
|
+
});
|
|
18032
|
+
setRankedShownKeys(handle, shownKeys.filter(key => !matchKeys.includes(key)));
|
|
18033
|
+
const top = pickHighestPriorityMatch(matches);
|
|
18034
|
+
return top ? [top] : [];
|
|
18035
|
+
}
|
|
18036
|
+
const top = pickHighestPriorityMatch(unshown);
|
|
18037
|
+
return top ? [top] : [];
|
|
18038
|
+
}
|
|
18039
|
+
;// ./src/common/types/languages.ts
|
|
18040
|
+
const Languages = {
|
|
18041
|
+
en: "en",
|
|
18042
|
+
// English
|
|
18043
|
+
be: "be",
|
|
18044
|
+
// Belarusian
|
|
18045
|
+
da: "da",
|
|
18046
|
+
// Danish
|
|
18047
|
+
de: "de",
|
|
18048
|
+
// German
|
|
18049
|
+
es: "es",
|
|
18050
|
+
// Spanish
|
|
18051
|
+
fi: "fi",
|
|
18052
|
+
// Finnish
|
|
18053
|
+
fr: "fr",
|
|
18054
|
+
// French
|
|
18055
|
+
hi: "hi",
|
|
18056
|
+
// Hindi
|
|
18057
|
+
ht: "ht",
|
|
18058
|
+
// Haitian Creole
|
|
18059
|
+
id: "id",
|
|
18060
|
+
// Indonesian
|
|
18061
|
+
it: "it",
|
|
18062
|
+
// Italian
|
|
18063
|
+
ja: "ja",
|
|
18064
|
+
// Japanese
|
|
18065
|
+
km: "km",
|
|
18066
|
+
// Khmer
|
|
18067
|
+
ko: "ko",
|
|
18068
|
+
// Korean
|
|
18069
|
+
ms: "ms",
|
|
18070
|
+
// Malay
|
|
18071
|
+
my: "my",
|
|
18072
|
+
// Burmese
|
|
18073
|
+
no: "no",
|
|
18074
|
+
// Norwegian
|
|
18075
|
+
nl: "nl",
|
|
18076
|
+
// Dutch
|
|
18077
|
+
pa: "pa",
|
|
18078
|
+
// Punjabi
|
|
18079
|
+
pt: "pt",
|
|
18080
|
+
// Portuguese
|
|
18081
|
+
ru: "ru",
|
|
18082
|
+
// Russian
|
|
18083
|
+
sv: "sv",
|
|
18084
|
+
// Swedish
|
|
18085
|
+
ta: "ta",
|
|
18086
|
+
// Tamil
|
|
18087
|
+
th: "th",
|
|
18088
|
+
// Thai
|
|
18089
|
+
tl: "tl",
|
|
18090
|
+
// Tagalog
|
|
18091
|
+
tr: "tr",
|
|
18092
|
+
// Turkish
|
|
18093
|
+
uk: "uk",
|
|
18094
|
+
// Ukrainian
|
|
18095
|
+
vi: "vi",
|
|
18096
|
+
// Vietnamese
|
|
18097
|
+
zh: "zh",
|
|
18098
|
+
// Chinese simplified
|
|
18099
|
+
"zh-tw": "zh-tw",
|
|
18100
|
+
// Chinese traditional
|
|
18101
|
+
bg: "bg",
|
|
18102
|
+
// Bulgarian
|
|
18103
|
+
ro: "ro",
|
|
18104
|
+
// Romanian
|
|
18105
|
+
el: "el",
|
|
18106
|
+
// Greek
|
|
18107
|
+
hu: "hu",
|
|
18108
|
+
// Hungarian
|
|
18109
|
+
pl: "pl",
|
|
18110
|
+
// Polish
|
|
18111
|
+
cs: "cs",
|
|
18112
|
+
// Czech
|
|
18113
|
+
et: "et",
|
|
18114
|
+
// Estonian
|
|
18115
|
+
hr: "hr",
|
|
18116
|
+
// Croatian
|
|
18117
|
+
lt: "lt",
|
|
18118
|
+
// Lithuanian
|
|
18119
|
+
lv: "lv",
|
|
18120
|
+
// Latvian
|
|
18121
|
+
sl: "sl",
|
|
18122
|
+
// Slovenian
|
|
18123
|
+
sk: "sk",
|
|
18124
|
+
// Slovak
|
|
18125
|
+
is: "is",
|
|
18126
|
+
// Icelandic
|
|
18127
|
+
ar: "ar",
|
|
18128
|
+
// Arabic
|
|
18129
|
+
he: "he" // Hebrew
|
|
18130
|
+
};
|
|
18131
|
+
;// ./src/common/helpers/get-browser-language.ts
|
|
18132
|
+
|
|
18133
|
+
const DEFAULT_LANGUAGE_CODE = "en";
|
|
18134
|
+
const SUPPORTED_LANGUAGES = [...Object.values(Languages)];
|
|
18135
|
+
/**
|
|
18136
|
+
* Gets a language code from the browser. Stolen from `chat` repo
|
|
18137
|
+
*
|
|
18138
|
+
* NOTE: THIS SHOULD NOT EXIST. IF YOU FIND YOURSELF IN A POSITION WHERE YOU NEED TO SUPPORT THIS
|
|
18139
|
+
* CODE, PLEASE DO EVERYTHING IN YOUR POWER TO AVOID IT. THIS CODE SHOULD DIE. EMBED SHOULD NOT BE
|
|
18140
|
+
* IN CHARGE OF PICKING LANGUAGES AND ANY CODE MAKING USE OF THIS FUNCTION SHOULD BE KEPT TO AN
|
|
18141
|
+
* ABSOLUTE MINIMUM.
|
|
18142
|
+
*
|
|
18143
|
+
* THIS WAS A NECESSARY HACK BECAUSE INTROS WERE IMPLEMENTED IN EMBED, BEFORE TRANSLATIONS
|
|
18144
|
+
* WERE A THING, AND GOT LEFT BEHIND DURING THE IMPLEMENTATION THEREOF.
|
|
18145
|
+
*
|
|
18146
|
+
* I'M SO SORRY.
|
|
18147
|
+
*/
|
|
18148
|
+
|
|
18149
|
+
function isSupportedLanguageCode(languageCode) {
|
|
18150
|
+
return SUPPORTED_LANGUAGES.includes(languageCode);
|
|
18151
|
+
}
|
|
18152
|
+
const getBrowserLanguage = () => {
|
|
18153
|
+
var _navigator$languages;
|
|
18154
|
+
const browserLanguageString = (((_navigator$languages = navigator.languages) === null || _navigator$languages === void 0 ? void 0 : _navigator$languages[0]) || navigator.language || navigator.userLanguage || navigator.browserLanguage || navigator.systemLanguage || DEFAULT_LANGUAGE_CODE).toLowerCase();
|
|
18155
|
+
if (isSupportedLanguageCode(browserLanguageString)) {
|
|
18156
|
+
return browserLanguageString;
|
|
18157
|
+
}
|
|
18158
|
+
if (browserLanguageString.includes("-")) {
|
|
18159
|
+
// an unsupported, hyphenated language code was received so return the main locale
|
|
18160
|
+
// if it is supported
|
|
18161
|
+
const mainLocale = browserLanguageString.split("-")[0];
|
|
18162
|
+
if (isSupportedLanguageCode(mainLocale)) {
|
|
18163
|
+
return mainLocale;
|
|
18164
|
+
}
|
|
18165
|
+
}
|
|
18166
|
+
return browserLanguageString;
|
|
18167
|
+
};
|
|
18168
|
+
/* harmony default export */ var get_browser_language = (getBrowserLanguage);
|
|
18169
|
+
;// ./src/services/helpers.ts
|
|
18170
|
+
const NO_OP_FUNCTION = () => {
|
|
18171
|
+
// Do nothing
|
|
18172
|
+
};
|
|
18173
|
+
function isStartOptions(input) {
|
|
18174
|
+
if (!(typeof input === "object")) {
|
|
18175
|
+
return false;
|
|
18176
|
+
}
|
|
18177
|
+
if (input === null) {
|
|
18178
|
+
return false;
|
|
18179
|
+
}
|
|
18180
|
+
return typeof input.handle === "string";
|
|
18181
|
+
}
|
|
18182
|
+
;// ./src/campaigns/campaign.ts
|
|
18183
|
+
|
|
18184
|
+
function campaign_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
18185
|
+
function campaign_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? campaign_ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : campaign_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
18186
|
+
|
|
18187
|
+
|
|
18188
|
+
|
|
18189
|
+
|
|
18190
|
+
|
|
18191
|
+
|
|
18192
|
+
|
|
18193
|
+
|
|
18194
|
+
/**
|
|
18195
|
+
* To enforce frequency restrictions, when a campaign is shown we add its id to a list of shown
|
|
18196
|
+
* campaigns, and any campaigns in this list will not be shown again until removed from the list.
|
|
18197
|
+
*
|
|
18198
|
+
* For once-per-session we use sessionStorage which clears every (page) session.
|
|
18199
|
+
* For once-per-user we use localStorage which does not clear.
|
|
18200
|
+
*
|
|
18201
|
+
* We only check the list matching the current frequency of the campaign - this ensures that, for
|
|
18202
|
+
* example, if a campaign is shown to a user with frequency once-per-user and then has its
|
|
18203
|
+
* frequency changed to every-time, it will still be shown properly.
|
|
18204
|
+
*/
|
|
18205
|
+
function campaignShownWithinFrequency(campaign, handle) {
|
|
18206
|
+
switch (campaign.message_frequency) {
|
|
18207
|
+
case "every-time":
|
|
18208
|
+
return false;
|
|
18209
|
+
case "once-per-session":
|
|
18210
|
+
{
|
|
18211
|
+
const storageValue = dist/* adaSessionStorage */.ad.getFnItem("marketing_campaigns_shown");
|
|
18212
|
+
const perSessionCampaigns = storageValue ? (storageValue[handle] || "").split(",") : [];
|
|
18213
|
+
return perSessionCampaigns.includes(campaign.campaign_key);
|
|
18214
|
+
}
|
|
18215
|
+
case "once-per-user":
|
|
18216
|
+
{
|
|
18217
|
+
const storageValue = dist/* adaLocalStorage */.BB.getFnItem("marketing_campaigns_shown");
|
|
18218
|
+
const perSessionCampaigns = storageValue ? (storageValue[handle] || "").split(",") : [];
|
|
18219
|
+
return perSessionCampaigns.includes(campaign.campaign_key);
|
|
18220
|
+
}
|
|
18221
|
+
default:
|
|
18222
|
+
return false;
|
|
18223
|
+
}
|
|
18224
|
+
}
|
|
18225
|
+
function addCampaignToStorageString(oldStorageValue, campaignId) {
|
|
18226
|
+
return oldStorageValue ? `${oldStorageValue},${campaignId}` : campaignId;
|
|
18227
|
+
}
|
|
18228
|
+
|
|
18229
|
+
// Record the campaign as being shown to prevent showing again based on frequency if applicable
|
|
18230
|
+
function recordCampaignTrigger(campaignKey, frequency, handle) {
|
|
18231
|
+
switch (frequency) {
|
|
18232
|
+
case "every-time":
|
|
18233
|
+
break;
|
|
18234
|
+
case "once-per-session":
|
|
18235
|
+
{
|
|
18236
|
+
const currentStorageValue = dist/* adaSessionStorage */.ad.getFnItem("marketing_campaigns_shown");
|
|
18237
|
+
const newStorageValue = addCampaignToStorageString(currentStorageValue ? currentStorageValue[handle] || "" : "", campaignKey);
|
|
18238
|
+
dist/* adaSessionStorage */.ad.setFnItem("marketing_campaigns_shown", campaign_objectSpread(campaign_objectSpread({}, currentStorageValue), {}, {
|
|
18239
|
+
[handle]: newStorageValue
|
|
18240
|
+
}));
|
|
18241
|
+
break;
|
|
18242
|
+
}
|
|
18243
|
+
case "once-per-user":
|
|
18244
|
+
{
|
|
18245
|
+
const currentStorageValue = dist/* adaLocalStorage */.BB.getFnItem("marketing_campaigns_shown");
|
|
18246
|
+
const newStorageValue = addCampaignToStorageString(currentStorageValue ? currentStorageValue[handle] || "" : "", campaignKey);
|
|
18247
|
+
dist/* adaLocalStorage */.BB.setFnItem("marketing_campaigns_shown", campaign_objectSpread(campaign_objectSpread({}, currentStorageValue), {}, {
|
|
18248
|
+
[handle]: newStorageValue
|
|
18249
|
+
}));
|
|
18250
|
+
break;
|
|
18251
|
+
}
|
|
18252
|
+
|
|
18253
|
+
// If an unknown frequency type is found, do nothing
|
|
18254
|
+
default:
|
|
18255
|
+
break;
|
|
18256
|
+
}
|
|
18257
|
+
}
|
|
18258
|
+
function triggerCampaignImpl(_ref) {
|
|
18259
|
+
let {
|
|
18260
|
+
adaSettings,
|
|
18261
|
+
chatterToken,
|
|
18262
|
+
campaign,
|
|
18263
|
+
ignoreStatus,
|
|
18264
|
+
ignoreFrequency,
|
|
18265
|
+
clearCampaignToTrigger,
|
|
18266
|
+
messageService
|
|
18267
|
+
} = _ref;
|
|
18268
|
+
const {
|
|
18269
|
+
handle,
|
|
18270
|
+
cluster,
|
|
18271
|
+
domain
|
|
18272
|
+
} = adaSettings;
|
|
18273
|
+
clearCampaignToTrigger();
|
|
18274
|
+
|
|
18275
|
+
/**
|
|
18276
|
+
* getCampaignToTrigger already checks this - it needs to because if the frequency check fails,
|
|
18277
|
+
* we don't want it to block other campaigns. However, we still need to check here for the manual
|
|
18278
|
+
* triggering case.
|
|
18279
|
+
*/
|
|
18280
|
+
const doesPassFrequencyCheck = ignoreFrequency || !campaignShownWithinFrequency(campaign, handle);
|
|
18281
|
+
if (!doesPassFrequencyCheck) {
|
|
18282
|
+
return;
|
|
18283
|
+
}
|
|
18284
|
+
if (!(campaign.status === "active") && !ignoreStatus) {
|
|
18285
|
+
warn(`Campaign with key ${campaign.campaign_key} is not active. If you still want to trigger it, use the ignoreStatus option.`);
|
|
18286
|
+
return;
|
|
18287
|
+
}
|
|
18288
|
+
recordCampaignTrigger(campaign.campaign_key, campaign.message_frequency, handle);
|
|
18289
|
+
if (campaign.message_text) {
|
|
18290
|
+
const localChannel = messageService.getChannel("local");
|
|
18291
|
+
const language = adaSettings.language || get_browser_language();
|
|
18292
|
+
const body = campaign.message_text[language];
|
|
18293
|
+
const duration = campaign.message_duration;
|
|
18294
|
+
const responseId = campaign.follow_up_response_id;
|
|
18295
|
+
if (body) {
|
|
18296
|
+
localChannel.postMessage(CREATE_PROACTIVE, {
|
|
18297
|
+
body,
|
|
18298
|
+
duration,
|
|
18299
|
+
responseId
|
|
18300
|
+
});
|
|
18301
|
+
} else {
|
|
18302
|
+
warn(`No translation for this campaign (campaign_key: ${campaign.campaign_key}) is defined for the language: ${language}`);
|
|
18303
|
+
}
|
|
18304
|
+
} else {
|
|
18305
|
+
const url = getURL({
|
|
18306
|
+
name: "api",
|
|
18307
|
+
route: `campaigns/trigger/${campaign.campaign_key}`,
|
|
18308
|
+
handle,
|
|
18309
|
+
cluster: cluster,
|
|
18310
|
+
domain
|
|
18311
|
+
});
|
|
18312
|
+
httpRequest({
|
|
18313
|
+
url,
|
|
18314
|
+
method: "POST",
|
|
18315
|
+
body: JSON.stringify({
|
|
18316
|
+
customer_query: {
|
|
18317
|
+
token: chatterToken
|
|
18318
|
+
},
|
|
18319
|
+
ignore_status: ignoreStatus
|
|
18320
|
+
})
|
|
18321
|
+
}).catch(NO_OP_FUNCTION); // we don't want to log errors here, it may fail because of rate limiting
|
|
18322
|
+
}
|
|
18323
|
+
}
|
|
18324
|
+
const getCampaignToTrigger = (adaSettings, marketingCampaigns, options, onlyBasic) => {
|
|
18325
|
+
const {
|
|
18326
|
+
ignoreStatus = false,
|
|
18327
|
+
ignoreFrequency = false
|
|
18328
|
+
} = options;
|
|
18329
|
+
const {
|
|
18330
|
+
handle
|
|
18331
|
+
} = adaSettings;
|
|
18332
|
+
return marketingCampaigns === null || marketingCampaigns === void 0 ? void 0 : marketingCampaigns.find(campaign => {
|
|
18333
|
+
if (campaign.status !== "active" && !ignoreStatus) {
|
|
18334
|
+
return false;
|
|
18335
|
+
}
|
|
18336
|
+
if (onlyBasic && !campaign.message_text) {
|
|
18337
|
+
return false;
|
|
18338
|
+
}
|
|
18339
|
+
|
|
18340
|
+
// Campaigns with no trigger conditions can only be triggered manually
|
|
18341
|
+
if (!campaign.trigger_conditions || campaign.trigger_conditions.length === 0) {
|
|
18342
|
+
return false;
|
|
18343
|
+
}
|
|
18344
|
+
const conditionsMet = campaign.trigger_conditions.every(tc => evalTriggerCondition(tc));
|
|
18345
|
+
const doesPassFrequencyCheck = ignoreFrequency || !campaignShownWithinFrequency(campaign, handle);
|
|
18346
|
+
return conditionsMet && doesPassFrequencyCheck;
|
|
18347
|
+
});
|
|
18348
|
+
};
|
|
18349
|
+
;// ./src/common/helpers/fetch-client.ts
|
|
18350
|
+
|
|
18351
|
+
|
|
18352
|
+
|
|
18353
|
+
|
|
18354
|
+
function isClientObject(client) {
|
|
18355
|
+
// We require the following properties defined
|
|
18356
|
+
return ["handle", "rollout", "chat", "features"].every(key => client[key] !== undefined);
|
|
18052
18357
|
}
|
|
18053
18358
|
|
|
18054
18359
|
/**
|
|
@@ -18089,7 +18394,7 @@ async function fetchClient(handle, cluster, domain, language) {
|
|
|
18089
18394
|
}
|
|
18090
18395
|
})
|
|
18091
18396
|
});
|
|
18092
|
-
} catch
|
|
18397
|
+
} catch {
|
|
18093
18398
|
// Do not trackException here because this can fail a lot due to poor network connections
|
|
18094
18399
|
warn("Failed to fetch client from API.");
|
|
18095
18400
|
}
|
|
@@ -18160,10 +18465,8 @@ class Client {
|
|
|
18160
18465
|
persistence,
|
|
18161
18466
|
privacy,
|
|
18162
18467
|
rollout,
|
|
18163
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
18164
18468
|
alternative_bot,
|
|
18165
18469
|
tint,
|
|
18166
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
18167
18470
|
translated_languages
|
|
18168
18471
|
} = clientResponse,
|
|
18169
18472
|
rest = _objectWithoutProperties(clientResponse, _excluded);
|
|
@@ -18191,7 +18494,7 @@ function getButtonText(client) {
|
|
|
18191
18494
|
var _client$ui_settings, _client$ui_settings$e;
|
|
18192
18495
|
const buttonTextMap = client === null || client === void 0 ? void 0 : (_client$ui_settings = client.ui_settings) === null || _client$ui_settings === void 0 ? void 0 : (_client$ui_settings$e = _client$ui_settings.embed) === null || _client$ui_settings$e === void 0 ? void 0 : _client$ui_settings$e.button_text;
|
|
18193
18496
|
const languageKey = get_browser_language();
|
|
18194
|
-
if (!buttonTextMap
|
|
18497
|
+
if (!(buttonTextMap !== null && buttonTextMap !== void 0 && buttonTextMap[languageKey])) {
|
|
18195
18498
|
return "Chat";
|
|
18196
18499
|
}
|
|
18197
18500
|
return buttonTextMap[languageKey];
|
|
@@ -18450,15 +18753,13 @@ function storeRollout(handle, group, lastProb) {
|
|
|
18450
18753
|
* Reads the stored rollout group and probability
|
|
18451
18754
|
*/
|
|
18452
18755
|
function readRollout(handle) {
|
|
18756
|
+
var _adaLocalStorage$getF, _adaLocalStorage$getF2;
|
|
18453
18757
|
const rollout = {
|
|
18454
18758
|
group: null,
|
|
18455
18759
|
lastProb: null
|
|
18456
18760
|
};
|
|
18457
|
-
rollout.group =
|
|
18458
|
-
|
|
18459
|
-
|
|
18460
|
-
(dist/* adaLocalStorage */.BB.getFnItem("rolloutGroup") || {})[handle] || null;
|
|
18461
|
-
rollout.lastProb = (dist/* adaLocalStorage */.BB.getFnItem("rolloutLastValue") || {})[handle] || null;
|
|
18761
|
+
rollout.group = ((_adaLocalStorage$getF = dist/* adaLocalStorage */.BB.getFnItem("rolloutGroup")) === null || _adaLocalStorage$getF === void 0 ? void 0 : _adaLocalStorage$getF[handle]) || null;
|
|
18762
|
+
rollout.lastProb = ((_adaLocalStorage$getF2 = dist/* adaLocalStorage */.BB.getFnItem("rolloutLastValue")) === null || _adaLocalStorage$getF2 === void 0 ? void 0 : _adaLocalStorage$getF2[handle]) || null;
|
|
18462
18763
|
return rollout;
|
|
18463
18764
|
}
|
|
18464
18765
|
|
|
@@ -18493,529 +18794,227 @@ function checkRollout(rollout, handle) {
|
|
|
18493
18794
|
storeRollout(handle, group, rollout);
|
|
18494
18795
|
return group === "B";
|
|
18495
18796
|
}
|
|
18496
|
-
|
|
18497
|
-
// If the user has already been put in a group and it hasn't changed - don't move them
|
|
18498
|
-
if (rollout === userRolloutGroup.lastProb) {
|
|
18499
|
-
return userRolloutGroup.group === "B";
|
|
18500
|
-
}
|
|
18501
|
-
|
|
18502
|
-
// Generate a random number to test against the probability score
|
|
18503
|
-
const rand = Math.random();
|
|
18504
|
-
|
|
18505
|
-
// If the user has not been put in a group yet - test against the probability score to determine their group and assign it to them
|
|
18506
|
-
if (userRolloutGroup.group === null || userRolloutGroup.lastProb === 0) {
|
|
18507
|
-
const roll = rand <= rollout;
|
|
18508
|
-
const group = roll ? "B" : "A";
|
|
18509
|
-
storeRollout(handle, group, rollout);
|
|
18510
|
-
return roll;
|
|
18511
|
-
}
|
|
18512
|
-
|
|
18513
|
-
// If we got here the rollout value has changed and is either higher or lower than the previous value
|
|
18514
|
-
if (userRolloutGroup.lastProb !== null && rollout > 0) {
|
|
18515
|
-
// If the rollout is higher than previous we want to test against the probability score to see if they get upgraded to group B
|
|
18516
|
-
// If the rollout is lower than previous we want to test against the probability score to see if they get downgraded to group A
|
|
18517
|
-
const adjustedProb = rollout > userRolloutGroup.lastProb ? 1 - userRolloutGroup.lastProb / rollout // This is the math to see if the user gets upgraded to group B
|
|
18518
|
-
: 1 - rollout / userRolloutGroup.lastProb; // This is the math to see if the user gets downgraded to group A
|
|
18519
|
-
|
|
18520
|
-
// If the random number is less than or equal to the adjusted probability score - we will upgrade the user to group B, otherwise they will go to group A
|
|
18521
|
-
const shouldBeVisible = rand <= adjustedProb;
|
|
18522
|
-
const group = shouldBeVisible ? "B" : "A";
|
|
18523
|
-
storeRollout(handle, group, rollout);
|
|
18524
|
-
return shouldBeVisible;
|
|
18525
|
-
}
|
|
18526
|
-
|
|
18527
|
-
// If all else fails show the button
|
|
18528
|
-
warn("Unable to detemrine rollout group - defaulting to showing chat button");
|
|
18529
|
-
return true;
|
|
18530
|
-
}
|
|
18531
|
-
;// ./src/client/helpers/web-notifications/web-notification-events.ts
|
|
18532
|
-
let WebNotificationEvents = /*#__PURE__*/function (WebNotificationEvents) {
|
|
18533
|
-
WebNotificationEvents["NOTIFICATION_CLICK"] = "ada:web_notification:click";
|
|
18534
|
-
return WebNotificationEvents;
|
|
18535
|
-
}({});
|
|
18536
|
-
;// ./src/client/helpers/web-notifications/index.ts
|
|
18537
|
-
|
|
18538
|
-
function handleWebNotificationClick(data) {
|
|
18539
|
-
if (data.type === WebNotificationEvents.NOTIFICATION_CLICK) {
|
|
18540
|
-
setTimeout(() => {
|
|
18541
|
-
var _window$adaEmbed;
|
|
18542
|
-
return (_window$adaEmbed = window.adaEmbed) === null || _window$adaEmbed === void 0 ? void 0 : _window$adaEmbed.handleNotification();
|
|
18543
|
-
}, 0);
|
|
18544
|
-
}
|
|
18545
|
-
}
|
|
18546
|
-
|
|
18547
|
-
// the Firebase client will post messages to the host page running the bot.
|
|
18548
|
-
// the messages will contain event data that embed would need to take action on
|
|
18549
|
-
// such as handling what happens when the notification is clicked
|
|
18550
|
-
function addServiceWorkerListeners() {
|
|
18551
|
-
if ("serviceWorker" in navigator) {
|
|
18552
|
-
navigator.serviceWorker.addEventListener("message", event => {
|
|
18553
|
-
const {
|
|
18554
|
-
data
|
|
18555
|
-
} = event;
|
|
18556
|
-
handleWebNotificationClick(data);
|
|
18557
|
-
});
|
|
18558
|
-
}
|
|
18559
|
-
}
|
|
18560
|
-
// EXTERNAL MODULE: ./node_modules/core-js-pure/full/object/assign.js
|
|
18561
|
-
var object_assign = __webpack_require__(5401);
|
|
18562
|
-
// EXTERNAL MODULE: ./node_modules/core-js-pure/full/instance/bind.js
|
|
18563
|
-
var bind = __webpack_require__(3375);
|
|
18564
|
-
;// ./node_modules/@babel/runtime-corejs3/helpers/esm/extends.js
|
|
18565
|
-
|
|
18566
|
-
|
|
18567
|
-
function _extends() {
|
|
18568
|
-
var _context;
|
|
18569
|
-
return _extends = object_assign ? bind(_context = object_assign).call(_context) : function (n) {
|
|
18570
|
-
for (var e = 1; e < arguments.length; e++) {
|
|
18571
|
-
var t = arguments[e];
|
|
18572
|
-
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
18573
|
-
}
|
|
18574
|
-
return n;
|
|
18575
|
-
}, _extends.apply(null, arguments);
|
|
18576
|
-
}
|
|
18577
|
-
|
|
18578
|
-
;// ./src/common/lib/ConnectContainer/index.tsx
|
|
18579
|
-
|
|
18580
|
-
|
|
18581
|
-
function ConnectContainer_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
18582
|
-
function ConnectContainer_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ConnectContainer_ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ConnectContainer_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
18583
|
-
|
|
18584
|
-
class ConnectContainer extends d {
|
|
18585
|
-
constructor() {
|
|
18586
|
-
super(...arguments);
|
|
18587
|
-
_defineProperty(this, "state", {
|
|
18588
|
-
initialized: false,
|
|
18589
|
-
propsFromState: {},
|
|
18590
|
-
propsFromDispatch: {}
|
|
18591
|
-
});
|
|
18592
|
-
}
|
|
18593
|
-
componentDidMount() {
|
|
18594
|
-
const {
|
|
18595
|
-
store
|
|
18596
|
-
} = this.props;
|
|
18597
|
-
store.subscribe(state => {
|
|
18598
|
-
this.setState(this.mapStateAndDispatch(state));
|
|
18599
|
-
});
|
|
18600
|
-
store.getState().then(state => {
|
|
18601
|
-
this.setState(ConnectContainer_objectSpread({
|
|
18602
|
-
initialized: true
|
|
18603
|
-
}, this.mapStateAndDispatch(state)));
|
|
18604
|
-
});
|
|
18605
|
-
}
|
|
18606
|
-
mapStateAndDispatch(state) {
|
|
18607
|
-
const {
|
|
18608
|
-
mapStateToProps,
|
|
18609
|
-
mapDispatchToProps,
|
|
18610
|
-
store
|
|
18611
|
-
} = this.props;
|
|
18612
|
-
return {
|
|
18613
|
-
propsFromState: mapStateToProps ? mapStateToProps(state) : {},
|
|
18614
|
-
propsFromDispatch: mapDispatchToProps ? mapDispatchToProps(store.dispatch) : {}
|
|
18615
|
-
};
|
|
18616
|
-
}
|
|
18617
|
-
render() {
|
|
18618
|
-
const {
|
|
18619
|
-
WrappedComponent
|
|
18620
|
-
} = this.props;
|
|
18621
|
-
const {
|
|
18622
|
-
propsFromState,
|
|
18623
|
-
propsFromDispatch,
|
|
18624
|
-
initialized
|
|
18625
|
-
} = this.state;
|
|
18626
|
-
if (!initialized) {
|
|
18627
|
-
return null;
|
|
18628
|
-
}
|
|
18629
|
-
return v(WrappedComponent, _extends({}, this.props, propsFromState, propsFromDispatch));
|
|
18630
|
-
}
|
|
18631
|
-
}
|
|
18632
|
-
;// ./src/client/lib/connect.tsx
|
|
18633
|
-
|
|
18634
|
-
|
|
18635
|
-
|
|
18636
|
-
|
|
18637
|
-
function connect(mapStateToProps, mapDispatchToProps) {
|
|
18638
|
-
return function connector(WrappedComponent) {
|
|
18639
|
-
return ownProps => v(StoreContext.Consumer, null, store => v(ConnectContainer, _extends({
|
|
18640
|
-
store: store
|
|
18641
|
-
}, ownProps, {
|
|
18642
|
-
WrappedComponent: WrappedComponent,
|
|
18643
|
-
mapStateToProps: mapStateToProps,
|
|
18644
|
-
mapDispatchToProps: mapDispatchToProps
|
|
18645
|
-
})));
|
|
18646
|
-
};
|
|
18647
|
-
}
|
|
18648
|
-
function bindActionCreators(action, dispatch) {
|
|
18649
|
-
return payload => dispatch(action, payload);
|
|
18650
|
-
}
|
|
18651
|
-
;// ./src/common/helpers/isRTL.ts
|
|
18652
|
-
/* unused harmony import specifier */ var isRTL_getBrowserLanguage;
|
|
18653
|
-
|
|
18654
|
-
const RTLLanguages = ["ar", "he"];
|
|
18655
|
-
const isRTLLanguage = language => Boolean(language && RTLLanguages.includes(language)) || false;
|
|
18656
|
-
const isRTL = (client, language) => {
|
|
18657
|
-
const rtlLanguageBool = isRTLLanguage(language) || isRTLLanguage(isRTL_getBrowserLanguage());
|
|
18658
|
-
return rtlLanguageBool || false;
|
|
18659
|
-
};
|
|
18660
|
-
;// ./src/common/helpers/getAlignment.ts
|
|
18661
|
-
|
|
18662
|
-
function getAlignment(adaSettings) {
|
|
18663
|
-
const {
|
|
18664
|
-
language,
|
|
18665
|
-
align
|
|
18666
|
-
} = adaSettings;
|
|
18667
|
-
if (align === "auto") {
|
|
18668
|
-
return isRTLLanguage(language) ? "left" : "right";
|
|
18669
|
-
}
|
|
18670
|
-
return align || "right";
|
|
18671
|
-
}
|
|
18672
|
-
;// ./src/common/helpers/wait.ts
|
|
18673
|
-
function wait(ms) {
|
|
18674
|
-
return new Promise(resolve => {
|
|
18675
|
-
setTimeout(resolve, ms);
|
|
18676
|
-
});
|
|
18677
|
-
}
|
|
18678
|
-
;// ./src/common/types/modules.ts
|
|
18679
|
-
const CHAT_IFRAME = "chat";
|
|
18680
|
-
const ENTRY_SCRIPT = "entry";
|
|
18681
|
-
const EMBED_SCRIPT = "client";
|
|
18682
|
-
const INTRO_IFRAME = "intro";
|
|
18683
|
-
const BUTTON_IFRAME = "button";
|
|
18684
|
-
const MASK_IFRAME = "drawer-mask";
|
|
18685
|
-
const XSTORAGE_IFRAME = "x-storage";
|
|
18686
|
-
;// ./src/frames/helpers/storage/index.ts
|
|
18687
|
-
|
|
18688
|
-
const PERSISTENCE_NORMAL = "normal";
|
|
18689
|
-
const PERSISTENCE_SESSION = "session";
|
|
18690
|
-
|
|
18691
|
-
/**
|
|
18692
|
-
* Retrieves items from local or session storage, depending on the client's
|
|
18693
|
-
* persistence setting. If privateMode is set, it returns null.
|
|
18694
|
-
*/
|
|
18695
|
-
function retrieveStorage(key, client, privateMode) {
|
|
18696
|
-
const {
|
|
18697
|
-
persistence
|
|
18698
|
-
} = client;
|
|
18699
|
-
if (privateMode) {
|
|
18700
|
-
return null;
|
|
18701
|
-
}
|
|
18702
|
-
if (persistence === PERSISTENCE_NORMAL) {
|
|
18703
|
-
return dist/* adaLocalStorage */.BB.getItem(key);
|
|
18704
|
-
}
|
|
18705
|
-
if (persistence === PERSISTENCE_SESSION) {
|
|
18706
|
-
return dist/* adaSessionStorage */.ad.getItem(key);
|
|
18707
|
-
}
|
|
18708
|
-
return null;
|
|
18709
|
-
}
|
|
18710
|
-
function setBrowserStorageItem(key, value, persistenceSetting) {
|
|
18711
|
-
if (persistenceSetting === PERSISTENCE_NORMAL) {
|
|
18712
|
-
dist/* adaLocalStorage */.BB.setItem(key, value);
|
|
18713
|
-
}
|
|
18714
|
-
if (persistenceSetting === PERSISTENCE_SESSION) {
|
|
18715
|
-
dist/* adaSessionStorage */.ad.setItem(key, value);
|
|
18797
|
+
|
|
18798
|
+
// If the user has already been put in a group and it hasn't changed - don't move them
|
|
18799
|
+
if (rollout === userRolloutGroup.lastProb) {
|
|
18800
|
+
return userRolloutGroup.group === "B";
|
|
18716
18801
|
}
|
|
18717
|
-
}
|
|
18718
|
-
;// ./src/proactiveConversations/proactiveConversation.ts
|
|
18719
18802
|
|
|
18720
|
-
|
|
18721
|
-
|
|
18803
|
+
// Generate a random number to test against the probability score
|
|
18804
|
+
const rand = Math.random();
|
|
18722
18805
|
|
|
18806
|
+
// If the user has not been put in a group yet - test against the probability score to determine their group and assign it to them
|
|
18807
|
+
if (userRolloutGroup.group === null || userRolloutGroup.lastProb === 0) {
|
|
18808
|
+
const roll = rand <= rollout;
|
|
18809
|
+
const group = roll ? "B" : "A";
|
|
18810
|
+
storeRollout(handle, group, rollout);
|
|
18811
|
+
return roll;
|
|
18812
|
+
}
|
|
18723
18813
|
|
|
18814
|
+
// If we got here the rollout value has changed and is either higher or lower than the previous value
|
|
18815
|
+
if (userRolloutGroup.lastProb !== null && rollout > 0) {
|
|
18816
|
+
// If the rollout is higher than previous we want to test against the probability score to see if they get upgraded to group B
|
|
18817
|
+
// If the rollout is lower than previous we want to test against the probability score to see if they get downgraded to group A
|
|
18818
|
+
const adjustedProb = rollout > userRolloutGroup.lastProb ? 1 - userRolloutGroup.lastProb / rollout // This is the math to see if the user gets upgraded to group B
|
|
18819
|
+
: 1 - rollout / userRolloutGroup.lastProb; // This is the math to see if the user gets downgraded to group A
|
|
18724
18820
|
|
|
18821
|
+
// If the random number is less than or equal to the adjusted probability score - we will upgrade the user to group B, otherwise they will go to group A
|
|
18822
|
+
const shouldBeVisible = rand <= adjustedProb;
|
|
18823
|
+
const group = shouldBeVisible ? "B" : "A";
|
|
18824
|
+
storeRollout(handle, group, rollout);
|
|
18825
|
+
return shouldBeVisible;
|
|
18826
|
+
}
|
|
18725
18827
|
|
|
18828
|
+
// If all else fails show the button
|
|
18829
|
+
warn("Unable to detemrine rollout group - defaulting to showing chat button");
|
|
18830
|
+
return true;
|
|
18831
|
+
}
|
|
18832
|
+
;// ./src/client/helpers/web-notifications/web-notification-events.ts
|
|
18833
|
+
let WebNotificationEvents = /*#__PURE__*/function (WebNotificationEvents) {
|
|
18834
|
+
WebNotificationEvents["NotificationClick"] = "ada:web_notification:click";
|
|
18835
|
+
return WebNotificationEvents;
|
|
18836
|
+
}({});
|
|
18837
|
+
;// ./src/client/helpers/web-notifications/index.ts
|
|
18726
18838
|
|
|
18727
|
-
|
|
18728
|
-
|
|
18729
|
-
|
|
18730
|
-
|
|
18731
|
-
|
|
18732
|
-
|
|
18733
|
-
switch (frequency) {
|
|
18734
|
-
case "always":
|
|
18735
|
-
return false;
|
|
18736
|
-
case "session":
|
|
18737
|
-
{
|
|
18738
|
-
const storageValue = dist/* adaSessionStorage */.ad.getFnItem("proactive_conversations_shown");
|
|
18739
|
-
const perSessionProactives = storageValue ? (storageValue[handle] || "").split(",") : [];
|
|
18740
|
-
return perSessionProactives.includes(proactiveConversationKey);
|
|
18741
|
-
}
|
|
18742
|
-
case "user":
|
|
18743
|
-
{
|
|
18744
|
-
const storageValue = dist/* adaLocalStorage */.BB.getFnItem(USER_FREQUENCY_STORAGE_KEY);
|
|
18745
|
-
const perUserProactives = storageValue ? (storageValue[handle] || "").split(",") : [];
|
|
18746
|
-
return perUserProactives.includes(proactiveConversationKey);
|
|
18747
|
-
}
|
|
18748
|
-
default:
|
|
18749
|
-
return false;
|
|
18839
|
+
function handleWebNotificationClick(data) {
|
|
18840
|
+
if (data.type === WebNotificationEvents.NotificationClick) {
|
|
18841
|
+
setTimeout(() => {
|
|
18842
|
+
var _window$adaEmbed;
|
|
18843
|
+
return (_window$adaEmbed = window.adaEmbed) === null || _window$adaEmbed === void 0 ? void 0 : _window$adaEmbed.handleNotification();
|
|
18844
|
+
}, 0);
|
|
18750
18845
|
}
|
|
18751
18846
|
}
|
|
18752
18847
|
|
|
18753
|
-
//
|
|
18754
|
-
//
|
|
18755
|
-
//
|
|
18756
|
-
|
|
18757
|
-
|
|
18758
|
-
|
|
18759
|
-
|
|
18760
|
-
|
|
18761
|
-
|
|
18762
|
-
|
|
18763
|
-
|
|
18764
|
-
const storageValue = dist/* adaLocalStorage */.BB.getFnItem("proactive_conversations_shown") || {};
|
|
18765
|
-
dist/* adaLocalStorage */.BB.setFnItem("proactive_conversations_shown", proactiveConversation_objectSpread(proactiveConversation_objectSpread({}, storageValue), {}, {
|
|
18766
|
-
[handle]: keys.join(",")
|
|
18767
|
-
}));
|
|
18768
|
-
}
|
|
18769
|
-
function recordRankedShown(handle, proactiveConversationKey) {
|
|
18770
|
-
const keys = getRankedShownKeys(handle);
|
|
18771
|
-
if (!keys.includes(proactiveConversationKey)) {
|
|
18772
|
-
setRankedShownKeys(handle, [...keys, proactiveConversationKey]);
|
|
18848
|
+
// the Firebase client will post messages to the host page running the bot.
|
|
18849
|
+
// the messages will contain event data that embed would need to take action on
|
|
18850
|
+
// such as handling what happens when the notification is clicked
|
|
18851
|
+
function addServiceWorkerListeners() {
|
|
18852
|
+
if ("serviceWorker" in navigator) {
|
|
18853
|
+
navigator.serviceWorker.addEventListener("message", event => {
|
|
18854
|
+
const {
|
|
18855
|
+
data
|
|
18856
|
+
} = event;
|
|
18857
|
+
handleWebNotificationClick(data);
|
|
18858
|
+
});
|
|
18773
18859
|
}
|
|
18774
18860
|
}
|
|
18861
|
+
// EXTERNAL MODULE: ./node_modules/core-js-pure/full/object/assign.js
|
|
18862
|
+
var object_assign = __webpack_require__(5401);
|
|
18863
|
+
// EXTERNAL MODULE: ./node_modules/core-js-pure/full/instance/bind.js
|
|
18864
|
+
var bind = __webpack_require__(3375);
|
|
18865
|
+
;// ./node_modules/@babel/runtime-corejs3/helpers/esm/extends.js
|
|
18775
18866
|
|
|
18776
|
-
|
|
18777
|
-
|
|
18778
|
-
|
|
18779
|
-
|
|
18780
|
-
|
|
18781
|
-
|
|
18782
|
-
|
|
18783
|
-
const now = new Date();
|
|
18784
|
-
const buildCondition = (operator, datetime) => ({
|
|
18785
|
-
type: "datetime",
|
|
18786
|
-
// Bounds are absolute UTC instants (the stored datetime carries a `Z`
|
|
18787
|
-
// offset). `timezone` is metadata the evaluator doesn't consult, but label
|
|
18788
|
-
// it UTC to match the data and stay correct if the evaluator ever honors it.
|
|
18789
|
-
timezone: "UTC",
|
|
18790
|
-
condition: {
|
|
18791
|
-
operator,
|
|
18792
|
-
datetime
|
|
18867
|
+
|
|
18868
|
+
function _extends() {
|
|
18869
|
+
var _context;
|
|
18870
|
+
return _extends = object_assign ? bind(_context = object_assign).call(_context) : function (n) {
|
|
18871
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
18872
|
+
var t = arguments[e];
|
|
18873
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
18793
18874
|
}
|
|
18794
|
-
|
|
18795
|
-
|
|
18796
|
-
return false;
|
|
18797
|
-
}
|
|
18798
|
-
if (scheduleEnd && !evalDatetimeTriggerCondition(buildCondition("before-exclusive", scheduleEnd), now)) {
|
|
18799
|
-
return false;
|
|
18800
|
-
}
|
|
18801
|
-
return true;
|
|
18875
|
+
return n;
|
|
18876
|
+
}, _extends.apply(null, arguments);
|
|
18802
18877
|
}
|
|
18803
18878
|
|
|
18804
|
-
|
|
18805
|
-
// fires: the lowest `order` wins, and any explicit rank beats an unranked one.
|
|
18806
|
-
function pickHighestPriorityMatch(matches) {
|
|
18807
|
-
return [...matches].sort((_ref, _ref2) => {
|
|
18808
|
-
let [, a] = _ref;
|
|
18809
|
-
let [, b] = _ref2;
|
|
18810
|
-
return (a.order ?? Infinity) - (b.order ?? Infinity);
|
|
18811
|
-
})[0];
|
|
18812
|
-
}
|
|
18813
|
-
function addProactiveToStorageString(oldStorageValue, proactiveConversationId) {
|
|
18814
|
-
return oldStorageValue ? `${oldStorageValue},${proactiveConversationId}` : proactiveConversationId;
|
|
18815
|
-
}
|
|
18816
|
-
function recordProactiveTrigger(proactiveConversationKey, frequency, handle) {
|
|
18817
|
-
switch (frequency) {
|
|
18818
|
-
case "always":
|
|
18819
|
-
break;
|
|
18820
|
-
case "session":
|
|
18821
|
-
{
|
|
18822
|
-
const currentStorageValue = dist/* adaSessionStorage */.ad.getFnItem("proactive_conversations_shown");
|
|
18823
|
-
const newStorageValue = addProactiveToStorageString(currentStorageValue ? currentStorageValue[handle] || "" : "", proactiveConversationKey);
|
|
18824
|
-
dist/* adaSessionStorage */.ad.setFnItem("proactive_conversations_shown", proactiveConversation_objectSpread(proactiveConversation_objectSpread({}, currentStorageValue), {}, {
|
|
18825
|
-
[handle]: newStorageValue
|
|
18826
|
-
}));
|
|
18827
|
-
break;
|
|
18828
|
-
}
|
|
18829
|
-
case "user":
|
|
18830
|
-
{
|
|
18831
|
-
const currentStorageValue = dist/* adaLocalStorage */.BB.getFnItem(USER_FREQUENCY_STORAGE_KEY);
|
|
18832
|
-
const newStorageValue = addProactiveToStorageString(currentStorageValue ? currentStorageValue[handle] || "" : "", proactiveConversationKey);
|
|
18833
|
-
dist/* adaLocalStorage */.BB.setFnItem(USER_FREQUENCY_STORAGE_KEY, proactiveConversation_objectSpread(proactiveConversation_objectSpread({}, currentStorageValue), {}, {
|
|
18834
|
-
[handle]: newStorageValue
|
|
18835
|
-
}));
|
|
18836
|
-
break;
|
|
18837
|
-
}
|
|
18838
|
-
default:
|
|
18839
|
-
break;
|
|
18840
|
-
}
|
|
18841
|
-
}
|
|
18879
|
+
;// ./src/common/lib/ConnectContainer/index.tsx
|
|
18842
18880
|
|
|
18843
|
-
// Rich content (image + single CTA) is optional. The image is keyed by
|
|
18844
|
-
// language; fall back to the first language by sorted key (the URL is shared
|
|
18845
|
-
// across languages — only the alt text is translated — so the fallback is
|
|
18846
|
-
// deterministic rather than relying on object key order).
|
|
18847
|
-
function extractRichContent(proactiveConversation, language) {
|
|
18848
|
-
var _images$language, _images$fallbackLangu;
|
|
18849
|
-
const {
|
|
18850
|
-
images,
|
|
18851
|
-
ctas
|
|
18852
|
-
} = proactiveConversation;
|
|
18853
|
-
const fallbackLanguage = images ? Object.keys(images).sort()[0] : undefined;
|
|
18854
|
-
const imageConfig = (images === null || images === void 0 ? void 0 : (_images$language = images[language]) === null || _images$language === void 0 ? void 0 : _images$language[0]) ?? (fallbackLanguage ? images === null || images === void 0 ? void 0 : (_images$fallbackLangu = images[fallbackLanguage]) === null || _images$fallbackLangu === void 0 ? void 0 : _images$fallbackLangu[0] : undefined);
|
|
18855
|
-
const ctaConfig = ctas === null || ctas === void 0 ? void 0 : ctas[0];
|
|
18856
|
-
return {
|
|
18857
|
-
image: imageConfig ? {
|
|
18858
|
-
url: imageConfig.url,
|
|
18859
|
-
alt: imageConfig.alt
|
|
18860
|
-
} : undefined,
|
|
18861
|
-
cta: ctaConfig ? {
|
|
18862
|
-
label: ctaConfig.cta_label,
|
|
18863
|
-
url: ctaConfig.cta_url,
|
|
18864
|
-
openInNewTab: ctaConfig.cta_open_in_new_tab
|
|
18865
|
-
} : undefined
|
|
18866
|
-
};
|
|
18867
|
-
}
|
|
18868
|
-
function proactiveTriggerImpl(_ref3) {
|
|
18869
|
-
let {
|
|
18870
|
-
proactiveConversation,
|
|
18871
|
-
triggerMethod,
|
|
18872
|
-
adaSettings,
|
|
18873
|
-
messageService,
|
|
18874
|
-
language,
|
|
18875
|
-
clearProactiveConversation
|
|
18876
|
-
} = _ref3;
|
|
18877
|
-
const {
|
|
18878
|
-
handle
|
|
18879
|
-
} = adaSettings;
|
|
18880
|
-
const {
|
|
18881
|
-
key,
|
|
18882
|
-
params = {},
|
|
18883
|
-
is_template: isTemplate
|
|
18884
|
-
} = proactiveConversation;
|
|
18885
|
-
const messageKey = String(key);
|
|
18886
|
-
const {
|
|
18887
|
-
duration,
|
|
18888
|
-
delay,
|
|
18889
|
-
frequency,
|
|
18890
|
-
active,
|
|
18891
|
-
schedule_start: scheduleStart,
|
|
18892
|
-
schedule_end: scheduleEnd
|
|
18893
|
-
} = proactiveConversation.modality_config.chat;
|
|
18894
|
-
let proactiveMessage = proactiveConversation.messages[language][0];
|
|
18895
|
-
if (!active) {
|
|
18896
|
-
warn("Proactive message is not active");
|
|
18897
|
-
return;
|
|
18898
|
-
}
|
|
18899
|
-
if (!isWithinSchedule(scheduleStart, scheduleEnd)) {
|
|
18900
|
-
warn("Proactive message is outside its scheduled window");
|
|
18901
|
-
return;
|
|
18902
|
-
}
|
|
18903
|
-
if (isTemplate) {
|
|
18904
|
-
if (Object.keys(params).length === 0) {
|
|
18905
|
-
warn("Proactive message is a template but no parameters were provided");
|
|
18906
|
-
return;
|
|
18907
|
-
}
|
|
18908
18881
|
|
|
18909
|
-
|
|
18910
|
-
|
|
18911
|
-
|
|
18912
|
-
|
|
18913
|
-
|
|
18914
|
-
|
|
18915
|
-
|
|
18882
|
+
function ConnectContainer_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
18883
|
+
function ConnectContainer_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ConnectContainer_ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ConnectContainer_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
18884
|
+
|
|
18885
|
+
class ConnectContainer extends d {
|
|
18886
|
+
constructor() {
|
|
18887
|
+
super(...arguments);
|
|
18888
|
+
_defineProperty(this, "state", {
|
|
18889
|
+
initialized: false,
|
|
18890
|
+
propsFromState: {},
|
|
18891
|
+
propsFromDispatch: {}
|
|
18916
18892
|
});
|
|
18917
|
-
if (missingParams.length > 0) {
|
|
18918
|
-
warn(`Missing parameters for template message: ${missingParams.join(", ")}`);
|
|
18919
|
-
return;
|
|
18920
|
-
}
|
|
18921
18893
|
}
|
|
18922
|
-
|
|
18923
|
-
|
|
18924
|
-
|
|
18925
|
-
|
|
18926
|
-
|
|
18894
|
+
componentDidMount() {
|
|
18895
|
+
const {
|
|
18896
|
+
store
|
|
18897
|
+
} = this.props;
|
|
18898
|
+
store.subscribe(state => {
|
|
18899
|
+
this.setState(this.mapStateAndDispatch(state));
|
|
18900
|
+
});
|
|
18901
|
+
store.getState().then(state => {
|
|
18902
|
+
this.setState(ConnectContainer_objectSpread({
|
|
18903
|
+
initialized: true
|
|
18904
|
+
}, this.mapStateAndDispatch(state)));
|
|
18905
|
+
});
|
|
18906
|
+
}
|
|
18907
|
+
mapStateAndDispatch(state) {
|
|
18908
|
+
const {
|
|
18909
|
+
mapStateToProps,
|
|
18910
|
+
mapDispatchToProps,
|
|
18911
|
+
store
|
|
18912
|
+
} = this.props;
|
|
18913
|
+
return {
|
|
18914
|
+
propsFromState: mapStateToProps ? mapStateToProps(state) : {},
|
|
18915
|
+
propsFromDispatch: mapDispatchToProps ? mapDispatchToProps(store.dispatch) : {}
|
|
18916
|
+
};
|
|
18917
|
+
}
|
|
18918
|
+
render() {
|
|
18919
|
+
const {
|
|
18920
|
+
WrappedComponent
|
|
18921
|
+
} = this.props;
|
|
18922
|
+
const {
|
|
18923
|
+
propsFromState,
|
|
18924
|
+
propsFromDispatch,
|
|
18925
|
+
initialized
|
|
18926
|
+
} = this.state;
|
|
18927
|
+
if (!initialized) {
|
|
18928
|
+
return null;
|
|
18927
18929
|
}
|
|
18930
|
+
return v(WrappedComponent, _extends({}, this.props, propsFromState, propsFromDispatch));
|
|
18928
18931
|
}
|
|
18932
|
+
}
|
|
18933
|
+
;// ./src/client/lib/connect.tsx
|
|
18929
18934
|
|
|
18930
|
-
// Record the proactive message as being shown
|
|
18931
|
-
recordProactiveTrigger(messageKey, frequency, handle);
|
|
18932
18935
|
|
|
18933
|
-
|
|
18934
|
-
|
|
18935
|
-
|
|
18936
|
-
|
|
18937
|
-
|
|
18938
|
-
|
|
18939
|
-
|
|
18936
|
+
|
|
18937
|
+
|
|
18938
|
+
function connect(mapStateToProps, mapDispatchToProps) {
|
|
18939
|
+
return function connector(WrappedComponent) {
|
|
18940
|
+
return ownProps => v(StoreContext.Consumer, null, store => v(ConnectContainer, _extends({
|
|
18941
|
+
store: store
|
|
18942
|
+
}, ownProps, {
|
|
18943
|
+
WrappedComponent: WrappedComponent,
|
|
18944
|
+
mapStateToProps: mapStateToProps,
|
|
18945
|
+
mapDispatchToProps: mapDispatchToProps
|
|
18946
|
+
})));
|
|
18947
|
+
};
|
|
18948
|
+
}
|
|
18949
|
+
function bindActionCreators(action, dispatch) {
|
|
18950
|
+
return payload => dispatch(action, payload);
|
|
18951
|
+
}
|
|
18952
|
+
;// ./src/common/helpers/isRTL.ts
|
|
18953
|
+
/* unused harmony import specifier */ var isRTL_getBrowserLanguage;
|
|
18954
|
+
|
|
18955
|
+
const RTLLanguages = ["ar", "he"];
|
|
18956
|
+
const isRTLLanguage = language => Boolean(language && RTLLanguages.includes(language)) || false;
|
|
18957
|
+
const isRTL = (_client, language) => {
|
|
18958
|
+
const rtlLanguageBool = isRTLLanguage(language) || isRTLLanguage(isRTL_getBrowserLanguage());
|
|
18959
|
+
return rtlLanguageBool || false;
|
|
18960
|
+
};
|
|
18961
|
+
;// ./src/common/helpers/getAlignment.ts
|
|
18962
|
+
|
|
18963
|
+
function getAlignment(adaSettings) {
|
|
18940
18964
|
const {
|
|
18941
|
-
image,
|
|
18942
|
-
cta
|
|
18943
|
-
} = extractRichContent(proactiveConversation, language);
|
|
18944
|
-
clearProactiveConversation();
|
|
18945
|
-
const localChannel = messageService.getChannel("local");
|
|
18946
|
-
localChannel.postMessage(CREATE_PROACTIVE, {
|
|
18947
|
-
body: proactiveMessage,
|
|
18948
|
-
duration,
|
|
18949
|
-
delay,
|
|
18950
|
-
image,
|
|
18951
|
-
cta,
|
|
18952
|
-
proactiveConfig: {
|
|
18953
|
-
key: messageKey,
|
|
18954
|
-
params,
|
|
18955
|
-
playbook_id: proactiveConversation.playbook_id
|
|
18956
|
-
}
|
|
18957
|
-
});
|
|
18958
|
-
log("Proactive message displayed", {
|
|
18959
|
-
handle,
|
|
18960
18965
|
language,
|
|
18961
|
-
|
|
18962
|
-
|
|
18966
|
+
align
|
|
18967
|
+
} = adaSettings;
|
|
18968
|
+
if (align === "auto") {
|
|
18969
|
+
return isRTLLanguage(language) ? "left" : "right";
|
|
18970
|
+
}
|
|
18971
|
+
return align || "right";
|
|
18972
|
+
}
|
|
18973
|
+
;// ./src/common/helpers/wait.ts
|
|
18974
|
+
function wait(ms) {
|
|
18975
|
+
return new Promise(resolve => {
|
|
18976
|
+
setTimeout(resolve, ms);
|
|
18963
18977
|
});
|
|
18964
18978
|
}
|
|
18965
|
-
|
|
18966
|
-
|
|
18967
|
-
|
|
18979
|
+
;// ./src/common/types/modules.ts
|
|
18980
|
+
const CHAT_IFRAME = "chat";
|
|
18981
|
+
const ENTRY_SCRIPT = "entry";
|
|
18982
|
+
const EMBED_SCRIPT = "client";
|
|
18983
|
+
const INTRO_IFRAME = "intro";
|
|
18984
|
+
const BUTTON_IFRAME = "button";
|
|
18985
|
+
const MASK_IFRAME = "drawer-mask";
|
|
18986
|
+
const XSTORAGE_IFRAME = "x-storage";
|
|
18987
|
+
;// ./src/frames/helpers/storage/index.ts
|
|
18988
|
+
|
|
18989
|
+
const PERSISTENCE_NORMAL = "normal";
|
|
18990
|
+
const PERSISTENCE_SESSION = "session";
|
|
18991
|
+
|
|
18992
|
+
/**
|
|
18993
|
+
* Retrieves items from local or session storage, depending on the client's
|
|
18994
|
+
* persistence setting. If privateMode is set, it returns null.
|
|
18995
|
+
*/
|
|
18996
|
+
function retrieveStorage(key, client, privateMode) {
|
|
18997
|
+
const {
|
|
18998
|
+
persistence
|
|
18999
|
+
} = client;
|
|
19000
|
+
if (privateMode) {
|
|
19001
|
+
return null;
|
|
18968
19002
|
}
|
|
18969
|
-
|
|
19003
|
+
if (persistence === PERSISTENCE_NORMAL) {
|
|
19004
|
+
return dist/* adaLocalStorage */.BB.getItem(key);
|
|
19005
|
+
}
|
|
19006
|
+
if (persistence === PERSISTENCE_SESSION) {
|
|
19007
|
+
return dist/* adaSessionStorage */.ad.getItem(key);
|
|
19008
|
+
}
|
|
19009
|
+
return null;
|
|
18970
19010
|
}
|
|
18971
|
-
|
|
18972
|
-
|
|
18973
|
-
|
|
18974
|
-
// by their frequency this session (filtering frequency here, not just in
|
|
18975
|
-
// `proactiveTriggerImpl`, lets a lower-priority proactive still fire when the
|
|
18976
|
-
// top one has already been shown).
|
|
18977
|
-
//
|
|
18978
|
-
// Prioritization is configured only by clients on the
|
|
18979
|
-
// `proactive-messaging-image-support` flag — the only ones who can rank in the
|
|
18980
|
-
// dashboard. Embed has no flag access, so the presence of an `order` is the
|
|
18981
|
-
// signal: when any match is ranked, exactly one fires and successive visits
|
|
18982
|
-
// advance down the ranking (the highest priority that hasn't been shown yet,
|
|
18983
|
-
// looping back to the top once all have), rather than firing every match — the
|
|
18984
|
-
// pre-ranking behavior kept for unranked clients.
|
|
18985
|
-
function selectProactivesToTriggerForUrl(proactiveConversations, url, handle) {
|
|
18986
|
-
const matches = Object.entries(proactiveConversations).filter(_ref4 => {
|
|
18987
|
-
let [key, conversation] = _ref4;
|
|
18988
|
-
const chatConfig = conversation.modality_config.chat;
|
|
18989
|
-
return chatConfig.active && !conversation.is_template && isWithinSchedule(chatConfig.schedule_start, chatConfig.schedule_end) && evaluateUrlTriggerConditions(chatConfig.url_trigger_conditions, url) && !proactiveShownWithinFrequency(key, chatConfig.frequency, handle);
|
|
18990
|
-
});
|
|
18991
|
-
const isRankingConfigured = matches.some(_ref5 => {
|
|
18992
|
-
let [, conversation] = _ref5;
|
|
18993
|
-
return typeof conversation.order === "number";
|
|
18994
|
-
});
|
|
18995
|
-
if (!isRankingConfigured) {
|
|
18996
|
-
return matches;
|
|
19011
|
+
function setBrowserStorageItem(key, value, persistenceSetting) {
|
|
19012
|
+
if (persistenceSetting === PERSISTENCE_NORMAL) {
|
|
19013
|
+
dist/* adaLocalStorage */.BB.setItem(key, value);
|
|
18997
19014
|
}
|
|
18998
|
-
|
|
18999
|
-
|
|
19000
|
-
// already shown on previous visits are skipped so the next-highest priority
|
|
19001
|
-
// fires. Once every current match has been shown, clear their records so the
|
|
19002
|
-
// cycle loops back to the top.
|
|
19003
|
-
const shownKeys = getRankedShownKeys(handle);
|
|
19004
|
-
const unshown = matches.filter(_ref6 => {
|
|
19005
|
-
let [key] = _ref6;
|
|
19006
|
-
return !shownKeys.includes(key);
|
|
19007
|
-
});
|
|
19008
|
-
if (unshown.length === 0) {
|
|
19009
|
-
const matchKeys = matches.map(_ref7 => {
|
|
19010
|
-
let [key] = _ref7;
|
|
19011
|
-
return key;
|
|
19012
|
-
});
|
|
19013
|
-
setRankedShownKeys(handle, shownKeys.filter(key => !matchKeys.includes(key)));
|
|
19014
|
-
const top = pickHighestPriorityMatch(matches);
|
|
19015
|
-
return top ? [top] : [];
|
|
19015
|
+
if (persistenceSetting === PERSISTENCE_SESSION) {
|
|
19016
|
+
dist/* adaSessionStorage */.ad.setItem(key, value);
|
|
19016
19017
|
}
|
|
19017
|
-
const top = pickHighestPriorityMatch(unshown);
|
|
19018
|
-
return top ? [top] : [];
|
|
19019
19018
|
}
|
|
19020
19019
|
;// ./src/services/chat-versioning/manifest.ts
|
|
19021
19020
|
|
|
@@ -19035,7 +19034,7 @@ const loadChatManifest = async () => {
|
|
|
19035
19034
|
return undefined;
|
|
19036
19035
|
}
|
|
19037
19036
|
return r.json();
|
|
19038
|
-
} catch
|
|
19037
|
+
} catch {
|
|
19039
19038
|
// handling cases where r is undefined / other fetch errors
|
|
19040
19039
|
// by returning undefined, we tell the server to load the unversioned index.html file for chat
|
|
19041
19040
|
log("Failed to load chat manifest", {
|
|
@@ -19122,9 +19121,7 @@ const getChatVersionFromManifest = manifest => {
|
|
|
19122
19121
|
} = shuffledVersions[shuffledVersions.length - 1];
|
|
19123
19122
|
|
|
19124
19123
|
// Loop through shuffledVersions
|
|
19125
|
-
for (
|
|
19126
|
-
const v = shuffledVersions[i];
|
|
19127
|
-
|
|
19124
|
+
for (const v of shuffledVersions) {
|
|
19128
19125
|
// If random falls into version weight
|
|
19129
19126
|
if (random <= v.weight) {
|
|
19130
19127
|
hash = v.hash;
|
|
@@ -19166,12 +19163,11 @@ const getChatVersion = async adaSettings => {
|
|
|
19166
19163
|
return window.__AdaChatVersion;
|
|
19167
19164
|
}
|
|
19168
19165
|
const {
|
|
19169
|
-
cluster,
|
|
19170
19166
|
domain
|
|
19171
19167
|
} = adaSettings;
|
|
19172
19168
|
|
|
19173
|
-
// Skip automatic versioning for
|
|
19174
|
-
if (
|
|
19169
|
+
// Skip automatic versioning for dev/stage clusters but allow override through __AdaChatVersion or __ada-chat-version
|
|
19170
|
+
if (domain !== null && domain !== void 0 && domain.match(/ada-(dev|dev2|stage)/)) {
|
|
19175
19171
|
return undefined;
|
|
19176
19172
|
}
|
|
19177
19173
|
const manifest = await loadChatManifest();
|
|
@@ -19186,6 +19182,7 @@ const getChatVersion = async adaSettings => {
|
|
|
19186
19182
|
|
|
19187
19183
|
|
|
19188
19184
|
|
|
19185
|
+
// biome-ignore lint/style/useImportType: h is the preact classic-JSX factory; import type would break babel's runtime JSX transform
|
|
19189
19186
|
|
|
19190
19187
|
class IFrame extends d {
|
|
19191
19188
|
constructor() {
|
|
@@ -19322,8 +19319,8 @@ function mapStateToProps(storeState) {
|
|
|
19322
19319
|
}
|
|
19323
19320
|
function mapDispatchToProps(dispatch) {
|
|
19324
19321
|
return {
|
|
19325
|
-
setGlobalState: bindActionCreators(ActionCreators.
|
|
19326
|
-
setConnectionState: bindActionCreators(ActionCreators.
|
|
19322
|
+
setGlobalState: bindActionCreators(ActionCreators.SetStateAction, dispatch),
|
|
19323
|
+
setConnectionState: bindActionCreators(ActionCreators.SetConnectionState, dispatch)
|
|
19327
19324
|
};
|
|
19328
19325
|
}
|
|
19329
19326
|
/* harmony default export */ var components_IFrame = (connect(mapStateToProps, mapDispatchToProps)(IFrame));
|
|
@@ -19333,6 +19330,7 @@ function mapDispatchToProps(dispatch) {
|
|
|
19333
19330
|
|
|
19334
19331
|
|
|
19335
19332
|
|
|
19333
|
+
// biome-ignore lint/style/useImportType: h is the preact classic-JSX factory; import type would break babel's runtime JSX transform
|
|
19336
19334
|
|
|
19337
19335
|
|
|
19338
19336
|
class ButtonFrame extends d {
|
|
@@ -19448,6 +19446,15 @@ function ButtonFrame_mapStateToProps(storeState) {
|
|
|
19448
19446
|
};
|
|
19449
19447
|
}
|
|
19450
19448
|
/* harmony default export */ var components_ButtonFrame = (connect(ButtonFrame_mapStateToProps)(ButtonFrame));
|
|
19449
|
+
;// ./src/common/helpers/fetch-as-object-url.ts
|
|
19450
|
+
async function fetchAsObjectURL(url) {
|
|
19451
|
+
const response = await fetch(url);
|
|
19452
|
+
if (!response.ok) {
|
|
19453
|
+
throw new Error(`Fetch failed: ${response.status}`);
|
|
19454
|
+
}
|
|
19455
|
+
const blob = await response.blob();
|
|
19456
|
+
return URL.createObjectURL(blob);
|
|
19457
|
+
}
|
|
19451
19458
|
;// ./node_modules/preact/hooks/dist/hooks.module.js
|
|
19452
19459
|
/* unused harmony import specifier */ var hooks_module_n;
|
|
19453
19460
|
var hooks_module_t,hooks_module_u,hooks_module_r,hooks_module_o=0,hooks_module_i=[],hooks_module_c=n.__r,hooks_module_f=n.diffed,hooks_module_e=n.__c,hooks_module_a=n.unmount;function hooks_module_v(t,r){hooks_module_n.__h&&hooks_module_n.__h(hooks_module_u,t,hooks_module_o||r),hooks_module_o=0;var i=hooks_module_u.__H||(hooks_module_u.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({}),i.__[t]}function hooks_module_m(n){return hooks_module_o=1,hooks_module_p(hooks_module_k,n)}function hooks_module_p(n,r,o){var i=hooks_module_v(hooks_module_t++,2);return i.t=n,i.__c||(i.__c=hooks_module_u,i.__=[o?o(r):hooks_module_k(void 0,r),function(n){var t=i.t(i.__[0],n);i.__[0]!==t&&(i.__=[t,i.__[1]],i.__c.setState({}))}]),i.__}function hooks_module_y(r,o){var i=hooks_module_v(hooks_module_t++,3);!hooks_module_n.__s&&hooks_module_j(i.__H,o)&&(i.__=r,i.__H=o,hooks_module_u.__H.__h.push(i))}function hooks_module_l(r,o){var i=hooks_module_v(hooks_module_t++,4);!hooks_module_n.__s&&hooks_module_j(i.__H,o)&&(i.__=r,i.__H=o,hooks_module_u.__h.push(i))}function hooks_module_h(n){return hooks_module_o=5,hooks_module_(function(){return{current:n}},[])}function hooks_module_s(n,t,u){hooks_module_o=6,hooks_module_l(function(){"function"==typeof n?n(t()):n&&(n.current=t())},null==u?u:u.concat(n))}function hooks_module_(n,u){var r=hooks_module_v(hooks_module_t++,7);return hooks_module_j(r.__H,u)?(r.__H=u,r.__h=n,r.__=n()):r.__}function hooks_module_A(n,t){return hooks_module_o=8,hooks_module_(function(){return n},t)}function F(n){var r=hooks_module_u.context[n.__c],o=hooks_module_v(hooks_module_t++,9);return o.__c=n,r?(null==o.__&&(o.__=!0,r.sub(hooks_module_u)),r.props.value):n.__}function hooks_module_T(t,u){hooks_module_n.useDebugValue&&hooks_module_n.useDebugValue(u?u(t):t)}function hooks_module_d(n){var r=hooks_module_v(hooks_module_t++,10),o=hooks_module_m();return r.__=n,hooks_module_u.componentDidCatch||(hooks_module_u.componentDidCatch=function(n){r.__&&r.__(n),o[1](n)}),[o[0],function(){o[1](void 0)}]}function hooks_module_q(){hooks_module_i.some(function(t){if(t.__P)try{t.__H.__h.forEach(hooks_module_b),t.__H.__h.forEach(hooks_module_g),t.__H.__h=[]}catch(u){return t.__H.__h=[],n.__e(u,t.__v),!0}}),hooks_module_i=[]}n.__r=function(n){hooks_module_c&&hooks_module_c(n),hooks_module_t=0;var r=(hooks_module_u=n.__c).__H;r&&(r.__h.forEach(hooks_module_b),r.__h.forEach(hooks_module_g),r.__h=[])},n.diffed=function(t){hooks_module_f&&hooks_module_f(t);var u=t.__c;u&&u.__H&&u.__H.__h.length&&(1!==hooks_module_i.push(u)&&hooks_module_r===n.requestAnimationFrame||((hooks_module_r=n.requestAnimationFrame)||function(n){var t,u=function(){clearTimeout(r),hooks_module_x&&cancelAnimationFrame(t),setTimeout(n)},r=setTimeout(u,100);hooks_module_x&&(t=requestAnimationFrame(u))})(hooks_module_q))},n.__c=function(t,u){u.some(function(t){try{t.__h.forEach(hooks_module_b),t.__h=t.__h.filter(function(n){return!n.__||hooks_module_g(n)})}catch(r){u.some(function(n){n.__h&&(n.__h=[])}),u=[],n.__e(r,t.__v)}}),hooks_module_e&&hooks_module_e(t,u)},n.unmount=function(t){hooks_module_a&&hooks_module_a(t);var u=t.__c;if(u&&u.__H)try{u.__H.__.forEach(hooks_module_b)}catch(t){n.__e(t,u.__v)}};var hooks_module_x="function"==typeof requestAnimationFrame;function hooks_module_b(n){"function"==typeof n.u&&n.u()}function hooks_module_g(n){n.u=n.__()}function hooks_module_j(n,t){return!n||t.some(function(t,u){return t!==n[u]})}function hooks_module_k(n,t){return"function"==typeof t?t(n):t}
|
|
@@ -19476,15 +19483,6 @@ var hooks_module_t,hooks_module_u,hooks_module_r,hooks_module_o=0,hooks_module_i
|
|
|
19476
19483
|
function compat_module_g(n,t){for(var e in t)n[e]=t[e];return n}function compat_module_w(n,t){for(var e in n)if("__source"!==e&&!(e in t))return!0;for(var r in t)if("__source"!==r&&n[r]!==t[r])return!0;return!1}var E=function(n){var t,e;function r(t){var e;return(e=n.call(this,t)||this).isPureReactComponent=!0,e}return e=n,(t=r).prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e,r.prototype.shouldComponentUpdate=function(n,t){return compat_module_w(this.props,n)||compat_module_w(this.state,t)},r}(d);function compat_module_C(n,t){function e(n){var e=this.props.ref,r=e==n.ref;return!r&&e&&(e.call?e(null):e.current=null),t?!t(this.props,n)||!r:compat_module_w(this.props,n)}function r(t){return this.shouldComponentUpdate=e,compat_module_s(n,t)}return r.prototype.isReactComponent=!0,r.displayName="Memo("+(n.displayName||n.name)+")",r.t=!0,r}var compat_module_=n.__b;n.__b=function(n){n.type&&n.type.t&&n.ref&&(n.props.ref=n.ref,n.ref=null),compat_module_&&compat_module_(n)};var compat_module_A="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function compat_module_k(n){function t(t,e){var r=compat_module_g({},t);return delete r.ref,n(r,"object"!=typeof(e=t.ref||e)||"current"in e?e:null)}return t.$$typeof=compat_module_A,t.render=t,t.prototype.isReactComponent=t.t=!0,t.displayName="ForwardRef("+(n.displayName||n.name)+")",t}var R=function(n,t){return n?compat_module_h(n).reduce(function(n,e,r){return n.concat(t(e,r))},[]):null},compat_module_F=(/* unused pure expression or super */ null && ({map:R,forEach:R,count:function(n){return n?compat_module_h(n).length:0},only:function(n){if(1!==(n=compat_module_h(n)).length)throw new Error("Children.only() expects only one child.");return n[0]},toArray:compat_module_h})),compat_module_N=n.__e;function U(n){return n&&((n=compat_module_g({},n)).__c=null,n.__k=n.__k&&n.__k.map(U)),n}function compat_module_M(){this.__u=0,this.o=null,this.__b=null}function compat_module_j(n){var t=n.__.__c;return t&&t.u&&t.u(n)}function compat_module_L(n){var t,e,r;function o(o){if(t||(t=n()).then(function(n){e=n.default||n},function(n){r=n}),r)throw r;if(!e)throw t;return compat_module_s(e,o)}return o.displayName="Lazy",o.t=!0,o}function compat_module_O(){this.i=null,this.l=null}n.__e=function(n,t,e){if(n.then)for(var r,o=t;o=o.__;)if((r=o.__c)&&r.__c)return r.__c(n,t.__c);compat_module_N(n,t,e)},(compat_module_M.prototype=new d).__c=function(n,t){var e=this;null==e.o&&(e.o=[]),e.o.push(t);var r=compat_module_j(e.__v),o=!1,u=function(){o||(o=!0,r?r(i):i())};t.__c=t.componentWillUnmount,t.componentWillUnmount=function(){u(),t.__c&&t.__c()};var i=function(){var n;if(!--e.__u)for(e.__v.__k[0]=e.state.u,e.setState({u:e.__b=null});n=e.o.pop();)n.forceUpdate()};e.__u++||e.setState({u:e.__b=e.__v.__k[0]}),n.then(u,u)},compat_module_M.prototype.render=function(n,t){return this.__b&&(this.__v.__k[0]=U(this.__b),this.__b=null),[v(p,null,t.u?null:n.children),t.u&&n.fallback]};var compat_module_P=function(n,t,e){if(++e[1]===e[0]&&n.l.delete(t),n.props.revealOrder&&("t"!==n.props.revealOrder[0]||!n.l.size))for(e=n.i;e;){for(;e.length>3;)e.pop()();if(e[1]<e[0])break;n.i=e=e[2]}};(compat_module_O.prototype=new d).u=function(n){var t=this,e=compat_module_j(t.__v),r=t.l.get(n);return r[0]++,function(o){var u=function(){t.props.revealOrder?(r.push(o),compat_module_P(t,n,r)):o()};e?e(u):u()}},compat_module_O.prototype.render=function(n){this.i=null,this.l=new Map;var t=b(n.children);n.revealOrder&&"b"===n.revealOrder[0]&&t.reverse();for(var e=t.length;e--;)this.l.set(t[e],this.i=[1,0,this.i]);return n.children},compat_module_O.prototype.componentDidUpdate=compat_module_O.prototype.componentDidMount=function(){var n=this;n.l.forEach(function(t,e){compat_module_P(n,e,t)})};var W=function(){function n(){}var t=n.prototype;return t.getChildContext=function(){return this.props.context},t.render=function(n){return n.children},n}();function compat_module_z(n){var t=this,e=n.container,r=v(W,{context:t.context},n.vnode);return t.s&&t.s!==e&&(t.v.parentNode&&t.s.removeChild(t.v),I(t.h),t.p=!1),n.vnode?t.p?(e.__k=t.__k,M(r,e),t.__k=e.__k):(t.v=document.createTextNode(""),O("",e),e.appendChild(t.v),t.p=!0,t.s=e,M(r,e,t.v),t.__k=t.v.__k):t.p&&(t.v.parentNode&&t.s.removeChild(t.v),I(t.h)),t.h=r,t.componentWillUnmount=function(){t.v.parentNode&&t.s.removeChild(t.v),I(t.h)},null}function D(n,t){return v(compat_module_z,{vnode:n,container:t})}var compat_module_H=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|fill|flood|font|glyph(?!R)|horiz|marker(?!H|W|U)|overline|paint|stop|strikethrough|stroke|text(?!L)|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/;d.prototype.isReactComponent={};var compat_module_T="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103;function V(n,t,e){if(null==t.__k)for(;t.firstChild;)t.removeChild(t.firstChild);return compat_module_m(n,t),"function"==typeof e&&e(),n?n.__c:null}function Z(n,t,e){return compat_module_p(n,t),"function"==typeof e&&e(),n?n.__c:null}var compat_module_I=n.event;function compat_module_$(n,t){n["UNSAFE_"+t]&&!n[t]&&Object.defineProperty(n,t,{configurable:!1,get:function(){return this["UNSAFE_"+t]},set:function(n){this["UNSAFE_"+t]=n}})}n.event=function(n){compat_module_I&&(n=compat_module_I(n)),n.persist=function(){};var t=!1,e=!1,r=n.stopPropagation;n.stopPropagation=function(){r.call(n),t=!0};var o=n.preventDefault;return n.preventDefault=function(){o.call(n),e=!0},n.isPropagationStopped=function(){return t},n.isDefaultPrevented=function(){return e},n.nativeEvent=n};var compat_module_q={configurable:!0,get:function(){return this.class}},B=n.vnode;n.vnode=function(n){n.$$typeof=compat_module_T;var t=n.type,e=n.props;if(t){if(e.class!=e.className&&(compat_module_q.enumerable="className"in e,null!=e.className&&(e.class=e.className),Object.defineProperty(e,"className",compat_module_q)),"function"!=typeof t){var r,o,u;for(u in e.defaultValue&&void 0!==e.value&&(e.value||0===e.value||(e.value=e.defaultValue),delete e.defaultValue),Array.isArray(e.value)&&e.multiple&&"select"===t&&(b(e.children).forEach(function(n){-1!=e.value.indexOf(n.props.value)&&(n.props.selected=!0)}),delete e.value),null!=e.value&&"textarea"===t&&(e.children=e.value,delete e.value),e)if(r=compat_module_H.test(u))break;if(r)for(u in o=n.props={},e)o[compat_module_H.test(u)?u.replace(/[A-Z0-9]/,"-$&").toLowerCase():u]=e[u]}!function(t){var e=n.type,r=n.props;if(r&&"string"==typeof e){var o={};for(var u in r)/^on(Ani|Tra|Tou)/.test(u)&&(r[u.toLowerCase()]=r[u],delete r[u]),o[u.toLowerCase()]=u;if(o.ondoubleclick&&(r.ondblclick=r[o.ondoubleclick],delete r[o.ondoubleclick]),o.onbeforeinput&&(r.onbeforeinput=r[o.onbeforeinput],delete r[o.onbeforeinput]),o.onchange&&("textarea"===e||"input"===e.toLowerCase()&&!/^fil|che|ra/i.test(r.type))){var i=o.oninput||"oninput";r[i]||(r[i]=r[o.onchange],delete r[o.onchange])}}}(),"function"==typeof t&&!t.m&&t.prototype&&(compat_module_$(t.prototype,"componentWillMount"),compat_module_$(t.prototype,"componentWillReceiveProps"),compat_module_$(t.prototype,"componentWillUpdate"),t.m=!0)}B&&B(n)};var G="16.8.0";function J(n){return compat_module_s.bind(null,n)}function K(n){return!!n&&n.$$typeof===compat_module_T}function Q(n){return K(n)?compat_module_b.apply(null,arguments):n}function X(n){return!!n.__k&&(compat_module_m(null,n),!0)}function Y(n){return n&&(n.base||1===n.nodeType&&n)||null}var nn=function(n,t){return n(t)},tn=(/* unused pure expression or super */ null && (compat_module_d));/* harmony default export */ var compat_module = ((/* unused pure expression or super */ null && ({useState:compat_module_n,useReducer:compat_module_t,useEffect:compat_module_e,useLayoutEffect:compat_module_r,useRef:compat_module_o,useImperativeHandle:compat_module_u,useMemo:compat_module_i,useCallback:compat_module_f,useContext:compat_module_c,useDebugValue:compat_module_a,version:"16.8.0",Children:compat_module_F,render:V,hydrate:Z,unmountComponentAtNode:X,createPortal:D,createElement:compat_module_s,createContext:compat_module_S,createFactory:J,cloneElement:Q,createRef:compat_module_x,Fragment:compat_module_d,isValidElement:K,findDOMNode:Y,Component:compat_module_l,PureComponent:E,memo:compat_module_C,forwardRef:compat_module_k,unstable_batchedUpdates:nn,StrictMode:compat_module_d,Suspense:compat_module_M,SuspenseList:compat_module_O,lazy:compat_module_L})));
|
|
19477
19484
|
//# sourceMappingURL=compat.module.js.map
|
|
19478
19485
|
|
|
19479
|
-
;// ./src/common/helpers/fetch-as-object-url.ts
|
|
19480
|
-
async function fetchAsObjectURL(url) {
|
|
19481
|
-
const response = await fetch(url);
|
|
19482
|
-
if (!response.ok) {
|
|
19483
|
-
throw new Error(`Fetch failed: ${response.status}`);
|
|
19484
|
-
}
|
|
19485
|
-
const blob = await response.blob();
|
|
19486
|
-
return URL.createObjectURL(blob);
|
|
19487
|
-
}
|
|
19488
19486
|
;// ./src/client/components/LightboxOverlay/index.tsx
|
|
19489
19487
|
|
|
19490
19488
|
function LightboxOverlay_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -19530,7 +19528,8 @@ const CloseIcon = () => v("svg", {
|
|
|
19530
19528
|
viewBox: "0 0 64 64",
|
|
19531
19529
|
width: "16",
|
|
19532
19530
|
height: "16",
|
|
19533
|
-
fill: "currentColor"
|
|
19531
|
+
fill: "currentColor",
|
|
19532
|
+
"aria-hidden": "true"
|
|
19534
19533
|
}, v("path", {
|
|
19535
19534
|
d: "M47.4142,47.4355a2.0012,2.0012,0,0,1-2.8307,0l-12.6-12.6L19.3951,47.4246a2.0016,2.0016,0,0,1-2.8306-2.8307L29.1533,32.0052,16.5668,19.4187a2.0015,2.0015,0,0,1,2.83-2.8305L31.9838,29.1746,44.5813,16.5772a2.0015,2.0015,0,1,1,2.83,2.8306L34.8145,32.0052l12.6,12.6A2.001,2.001,0,0,1,47.4142,47.4355Z",
|
|
19536
19535
|
fillRule: "evenodd"
|
|
@@ -19543,7 +19542,8 @@ const ChevronLeftIcon = () => v("svg", {
|
|
|
19543
19542
|
fill: "currentColor",
|
|
19544
19543
|
style: {
|
|
19545
19544
|
display: "block"
|
|
19546
|
-
}
|
|
19545
|
+
},
|
|
19546
|
+
"aria-hidden": "true"
|
|
19547
19547
|
}, v("path", {
|
|
19548
19548
|
d: "M39.7,48.3c-0.5,0-1-0.2-1.4-0.6L22.6,32L38.3,16.3c0.8-0.8,2-0.8,2.8,0s0.8,2,0,2.8L28.2,32l12.9,12.9c0.8,0.8,0.8,2,0,2.8C40.7,48.1,40.2,48.3,39.7,48.3z"
|
|
19549
19549
|
}));
|
|
@@ -19552,7 +19552,8 @@ const DownloadIcon = () => v("svg", {
|
|
|
19552
19552
|
viewBox: "0 0 24 24",
|
|
19553
19553
|
width: "18",
|
|
19554
19554
|
height: "18",
|
|
19555
|
-
fill: "currentColor"
|
|
19555
|
+
fill: "currentColor",
|
|
19556
|
+
"aria-hidden": "true"
|
|
19556
19557
|
}, v("path", {
|
|
19557
19558
|
d: "M12 16l-5-5 1.4-1.4 2.6 2.6V4h2v8.2l2.6-2.6L17 11l-5 5zm-7 2h14v2H5v-2z"
|
|
19558
19559
|
}));
|
|
@@ -19561,7 +19562,8 @@ const PrintIcon = () => v("svg", {
|
|
|
19561
19562
|
viewBox: "0 0 24 24",
|
|
19562
19563
|
width: "18",
|
|
19563
19564
|
height: "18",
|
|
19564
|
-
fill: "currentColor"
|
|
19565
|
+
fill: "currentColor",
|
|
19566
|
+
"aria-hidden": "true"
|
|
19565
19567
|
}, v("path", {
|
|
19566
19568
|
d: "M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z"
|
|
19567
19569
|
}));
|
|
@@ -20028,7 +20030,7 @@ function resolveHostTelemetryFromStartOptions(adaSettings) {
|
|
|
20028
20030
|
// Treat the presence of the hostTelemetry property as authoritative, even if
|
|
20029
20031
|
// normalization fails, so broken new-wrapper payloads are not downgraded
|
|
20030
20032
|
// into the legacy mobile-shell bucket.
|
|
20031
|
-
const hasExplicitHostTelemetry = trustedMobileSdkHostPage && Object.
|
|
20033
|
+
const hasExplicitHostTelemetry = trustedMobileSdkHostPage && Object.hasOwn(adaSettings, "hostTelemetry");
|
|
20032
20034
|
const explicit = hasExplicitHostTelemetry ? normalizeHostTelemetry(adaSettings.hostTelemetry) : undefined;
|
|
20033
20035
|
// Legacy wrappers (iOS SDK, AndroidSDK, react-native-sdk) all set
|
|
20034
20036
|
// `metaFields.sdkType` before calling `adaEmbed.start(...)`. They do not
|
|
@@ -20104,7 +20106,9 @@ function requireProgrammaticControl(adaSettings) {
|
|
|
20104
20106
|
// only carry id/state/timing data and are not subject to this gate.
|
|
20105
20107
|
const TRANSCRIPT_EVENT_KEYS = new Set(["ada:message:sent", "ada:message:received"]);
|
|
20106
20108
|
function shouldDeliverTranscriptEvent(eventKey, adaSettings) {
|
|
20107
|
-
if (!TRANSCRIPT_EVENT_KEYS.has(eventKey))
|
|
20109
|
+
if (!TRANSCRIPT_EVENT_KEYS.has(eventKey)) {
|
|
20110
|
+
return true;
|
|
20111
|
+
}
|
|
20108
20112
|
return isProgrammaticControlEnabled(adaSettings);
|
|
20109
20113
|
}
|
|
20110
20114
|
;// ./src/client/components/ChatFrame/chatFrameEvents/chatterEvent/index.ts
|
|
@@ -20117,20 +20121,22 @@ function storeChatterEventDataInBrowser(client, payload) {
|
|
|
20117
20121
|
domain,
|
|
20118
20122
|
privateMode
|
|
20119
20123
|
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
20120
|
-
const
|
|
20121
|
-
|
|
20122
|
-
|
|
20123
|
-
|
|
20124
|
-
messagingAuthState
|
|
20125
|
-
} = payload;
|
|
20124
|
+
const chatter = payload.chatter;
|
|
20125
|
+
const created = payload.created;
|
|
20126
|
+
const sessionToken = payload.sessionToken;
|
|
20127
|
+
const messagingAuthState = payload.messagingAuthState;
|
|
20126
20128
|
if (privateMode) {
|
|
20127
20129
|
return;
|
|
20128
20130
|
}
|
|
20129
20131
|
const {
|
|
20130
20132
|
persistence
|
|
20131
20133
|
} = client;
|
|
20132
|
-
|
|
20133
|
-
|
|
20134
|
+
if (chatter !== undefined) {
|
|
20135
|
+
setBrowserStorageItem(CHATTER_TOKEN_STORAGE_KEY, chatter, persistence);
|
|
20136
|
+
}
|
|
20137
|
+
if (created !== undefined) {
|
|
20138
|
+
setBrowserStorageItem(CHATTER_CREATED_STORAGE_KEY, created, persistence);
|
|
20139
|
+
}
|
|
20134
20140
|
if (sessionToken) {
|
|
20135
20141
|
setBrowserStorageItem(SESSION_AUTH_TOKEN_STORAGE_KEY, sessionToken, persistence);
|
|
20136
20142
|
}
|
|
@@ -20327,7 +20333,9 @@ function forwardPublishEvent(publishPayload, adaSettings) {
|
|
|
20327
20333
|
eventKey,
|
|
20328
20334
|
data
|
|
20329
20335
|
} = publishPayload;
|
|
20330
|
-
if (!shouldDeliverTranscriptEvent(eventKey, adaSettings))
|
|
20336
|
+
if (!shouldDeliverTranscriptEvent(eventKey, adaSettings)) {
|
|
20337
|
+
return;
|
|
20338
|
+
}
|
|
20331
20339
|
if (eventKey === "ada:ready") {
|
|
20332
20340
|
const mode = adaSettings.headless ? "headless" : "visible";
|
|
20333
20341
|
publishEvent(eventKey, {
|
|
@@ -20386,7 +20394,7 @@ class ChatFrame extends d {
|
|
|
20386
20394
|
log("Chat frame mount", {
|
|
20387
20395
|
handle,
|
|
20388
20396
|
chatUrl: this.url,
|
|
20389
|
-
embedVersion: "
|
|
20397
|
+
embedVersion: "7e99166".slice(0, 7),
|
|
20390
20398
|
embedSettings: adaSettings
|
|
20391
20399
|
});
|
|
20392
20400
|
|
|
@@ -20474,7 +20482,7 @@ class ChatFrame extends d {
|
|
|
20474
20482
|
const hostPageUrlParams = new URL(window.location.href).searchParams;
|
|
20475
20483
|
const smsToken = hostPageUrlParams.get("adaSMSToken");
|
|
20476
20484
|
const queryParams = {
|
|
20477
|
-
embedVersion: "
|
|
20485
|
+
embedVersion: "7e99166".slice(0, 7),
|
|
20478
20486
|
greeting,
|
|
20479
20487
|
language,
|
|
20480
20488
|
skipGreeting,
|
|
@@ -20798,9 +20806,7 @@ class ChatFrame extends d {
|
|
|
20798
20806
|
}
|
|
20799
20807
|
case ANALYTICS_EVENT:
|
|
20800
20808
|
{
|
|
20801
|
-
const
|
|
20802
|
-
analytics
|
|
20803
|
-
} = payload;
|
|
20809
|
+
const analytics = payload.analytics;
|
|
20804
20810
|
const {
|
|
20805
20811
|
analyticsCallback
|
|
20806
20812
|
} = adaSettings;
|
|
@@ -20817,19 +20823,18 @@ class ChatFrame extends d {
|
|
|
20817
20823
|
domain,
|
|
20818
20824
|
privateMode
|
|
20819
20825
|
} = this.props;
|
|
20820
|
-
const
|
|
20821
|
-
|
|
20822
|
-
|
|
20823
|
-
|
|
20824
|
-
|
|
20825
|
-
} = payload;
|
|
20826
|
+
const chatterPayload = payload;
|
|
20827
|
+
const chatter = chatterPayload.chatter;
|
|
20828
|
+
const created = chatterPayload.created;
|
|
20829
|
+
const sessionToken = chatterPayload.sessionToken;
|
|
20830
|
+
const messagingAuthState = chatterPayload.messagingAuthState;
|
|
20826
20831
|
const {
|
|
20827
20832
|
chatterTokenCallback
|
|
20828
20833
|
} = adaSettings;
|
|
20829
20834
|
if (!client) {
|
|
20830
20835
|
throw new AdaEmbedError("`client` is undefined");
|
|
20831
20836
|
}
|
|
20832
|
-
storeChatterEventDataInBrowser(client,
|
|
20837
|
+
storeChatterEventDataInBrowser(client, chatterPayload, {
|
|
20833
20838
|
cluster,
|
|
20834
20839
|
domain,
|
|
20835
20840
|
privateMode
|
|
@@ -20916,9 +20921,7 @@ class ChatFrame extends d {
|
|
|
20916
20921
|
const {
|
|
20917
20922
|
client
|
|
20918
20923
|
} = this.props;
|
|
20919
|
-
const
|
|
20920
|
-
inLiveChat
|
|
20921
|
-
} = payload;
|
|
20924
|
+
const inLiveChat = payload.inLiveChat;
|
|
20922
20925
|
await setGlobalState({
|
|
20923
20926
|
chatterInLiveChat: inLiveChat
|
|
20924
20927
|
});
|
|
@@ -20979,7 +20982,7 @@ class ChatFrame extends d {
|
|
|
20979
20982
|
token
|
|
20980
20983
|
}, id);
|
|
20981
20984
|
});
|
|
20982
|
-
} catch
|
|
20985
|
+
} catch {
|
|
20983
20986
|
console.warn("Function for zdChatterAuthCallback produced an error - please ensure the callback is functioning normally");
|
|
20984
20987
|
if (!this.channel) {
|
|
20985
20988
|
throw new AdaEmbedError("`this.channel` is not defined");
|
|
@@ -21263,19 +21266,18 @@ function ChatFrame_mapStateToProps(storeState) {
|
|
|
21263
21266
|
}
|
|
21264
21267
|
function ChatFrame_mapDispatchToProps(dispatch) {
|
|
21265
21268
|
return {
|
|
21266
|
-
setConnectionState: bindActionCreators(ActionCreators.
|
|
21267
|
-
setGlobalState: bindActionCreators(ActionCreators.
|
|
21268
|
-
toggleChat: bindActionCreators(ActionCreators.
|
|
21269
|
+
setConnectionState: bindActionCreators(ActionCreators.SetConnectionState, dispatch),
|
|
21270
|
+
setGlobalState: bindActionCreators(ActionCreators.SetStateAction, dispatch),
|
|
21271
|
+
toggleChat: bindActionCreators(ActionCreators.ToggleChatAction, dispatch)
|
|
21269
21272
|
};
|
|
21270
21273
|
}
|
|
21271
|
-
|
|
21272
|
-
// eslint-disable-next-line import/no-default-export
|
|
21273
21274
|
/* harmony default export */ var components_ChatFrame = (connect(ChatFrame_mapStateToProps, ChatFrame_mapDispatchToProps)(ChatFrame));
|
|
21274
21275
|
;// ./src/client/components/IntroFrame/index.tsx
|
|
21275
21276
|
|
|
21276
21277
|
|
|
21277
21278
|
|
|
21278
21279
|
|
|
21280
|
+
// biome-ignore lint/style/useImportType: h is the preact classic-JSX factory; import type would break babel's runtime JSX transform
|
|
21279
21281
|
|
|
21280
21282
|
|
|
21281
21283
|
class IntroFrame extends d {
|
|
@@ -21343,13 +21345,14 @@ function IntroFrame_mapStateToProps(storeState) {
|
|
|
21343
21345
|
};
|
|
21344
21346
|
}
|
|
21345
21347
|
|
|
21346
|
-
//
|
|
21348
|
+
// biome-ignore lint/complexity/noBannedTypes: empty type param here means "no own props" for the connect HOC; Record<string, never> breaks the type intersection
|
|
21347
21349
|
/* harmony default export */ var components_IntroFrame = (connect(IntroFrame_mapStateToProps)(IntroFrame));
|
|
21348
21350
|
;// ./src/client/components/MaskFrame/index.tsx
|
|
21349
21351
|
|
|
21350
21352
|
|
|
21351
21353
|
|
|
21352
21354
|
|
|
21355
|
+
// biome-ignore lint/style/useImportType: h is the preact classic-JSX factory; import type would break babel's runtime JSX transform
|
|
21353
21356
|
|
|
21354
21357
|
|
|
21355
21358
|
class MaskFrame extends d {
|
|
@@ -21414,12 +21417,13 @@ function MaskFrame_mapStateToProps(storeState) {
|
|
|
21414
21417
|
};
|
|
21415
21418
|
}
|
|
21416
21419
|
|
|
21417
|
-
//
|
|
21420
|
+
// biome-ignore lint/complexity/noBannedTypes: empty type param here means "no own props" for the connect HOC; Record<string, never> breaks the type intersection
|
|
21418
21421
|
/* harmony default export */ var components_MaskFrame = (connect(MaskFrame_mapStateToProps)(MaskFrame));
|
|
21419
21422
|
;// ./src/client/components/XStorageFrame/index.tsx
|
|
21420
21423
|
|
|
21421
21424
|
|
|
21422
21425
|
|
|
21426
|
+
// biome-ignore lint/style/useImportType: h is the preact classic-JSX factory; import type would break babel's runtime JSX transform
|
|
21423
21427
|
|
|
21424
21428
|
|
|
21425
21429
|
class XStorageFrame extends d {
|
|
@@ -21469,11 +21473,6 @@ function withProactiveKey(metaFields, key) {
|
|
|
21469
21473
|
|
|
21470
21474
|
function Container_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
21471
21475
|
function Container_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? Container_ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : Container_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
21472
|
-
/* eslint-disable max-lines -- MES-981: file was already at the 1000-line
|
|
21473
|
-
max-lines cap on main; the additive programmatic-control work pushes it
|
|
21474
|
-
just over. A targeted refactor of this Container is being tracked
|
|
21475
|
-
separately and is out of scope for this PR. */
|
|
21476
|
-
|
|
21477
21476
|
|
|
21478
21477
|
|
|
21479
21478
|
|
|
@@ -21500,6 +21499,7 @@ function Container_objectSpread(e) { for (var r = 1; r < arguments.length; r++)
|
|
|
21500
21499
|
|
|
21501
21500
|
|
|
21502
21501
|
|
|
21502
|
+
// biome-ignore lint/style/useImportType: h is the jsxFactory value (tsconfig jsxFactory:"h"); moving it to import type breaks JSX transpilation
|
|
21503
21503
|
|
|
21504
21504
|
|
|
21505
21505
|
|
|
@@ -21940,8 +21940,8 @@ class Container extends d {
|
|
|
21940
21940
|
} = campaignToTrigger;
|
|
21941
21941
|
|
|
21942
21942
|
// Make sure trigger conditions are still met after delay
|
|
21943
|
-
for (
|
|
21944
|
-
if (!evalTriggerCondition(
|
|
21943
|
+
for (const condition of triggerConditions) {
|
|
21944
|
+
if (!evalTriggerCondition(condition)) {
|
|
21945
21945
|
return;
|
|
21946
21946
|
}
|
|
21947
21947
|
}
|
|
@@ -22005,7 +22005,9 @@ class Container extends d {
|
|
|
22005
22005
|
const {
|
|
22006
22006
|
isDrawerOpen
|
|
22007
22007
|
} = this.props;
|
|
22008
|
-
if (isDrawerOpen)
|
|
22008
|
+
if (isDrawerOpen) {
|
|
22009
|
+
return;
|
|
22010
|
+
}
|
|
22009
22011
|
this.setState({
|
|
22010
22012
|
proactiveConversation,
|
|
22011
22013
|
proactiveConversationTriggerMethod: triggerMethod
|
|
@@ -22382,7 +22384,7 @@ class Container extends d {
|
|
|
22382
22384
|
// We do not want to store functions in our store. The rest of the values are useful however.
|
|
22383
22385
|
const adaSettingsWithoutFunctions = Object.keys(adaSettings).reduce((newSettings, currentVal) => {
|
|
22384
22386
|
if (typeof adaSettings[currentVal] !== "function") {
|
|
22385
|
-
|
|
22387
|
+
Object.assign(newSettings, {
|
|
22386
22388
|
[currentVal]: adaSettings[currentVal]
|
|
22387
22389
|
});
|
|
22388
22390
|
}
|
|
@@ -22432,7 +22434,7 @@ class Container extends d {
|
|
|
22432
22434
|
url: `${baseApiUrl}business_events/`
|
|
22433
22435
|
});
|
|
22434
22436
|
assignedClient.business_events = businessEvents.business_events;
|
|
22435
|
-
} catch (
|
|
22437
|
+
} catch (_e) {
|
|
22436
22438
|
assignedClient.business_events = [];
|
|
22437
22439
|
warn("Failed to fetch events from API.");
|
|
22438
22440
|
}
|
|
@@ -22445,7 +22447,7 @@ class Container extends d {
|
|
|
22445
22447
|
url: `${baseApiUrl}campaigns/`
|
|
22446
22448
|
});
|
|
22447
22449
|
assignedClient.marketing_campaigns = marketingCampaigns.campaigns;
|
|
22448
|
-
} catch (
|
|
22450
|
+
} catch (_e) {
|
|
22449
22451
|
assignedClient.marketing_campaigns = [];
|
|
22450
22452
|
assignedClient.marketing_campaigns_order = [];
|
|
22451
22453
|
warn("Failed to fetch campaigns from API.");
|
|
@@ -22640,8 +22642,6 @@ class Container extends d {
|
|
|
22640
22642
|
})
|
|
22641
22643
|
});
|
|
22642
22644
|
}
|
|
22643
|
-
|
|
22644
|
-
// eslint-disable-next-line class-methods-use-this
|
|
22645
22645
|
renderXStorageFrame() {
|
|
22646
22646
|
return v(components_XStorageFrame, null);
|
|
22647
22647
|
}
|
|
@@ -22719,7 +22719,7 @@ function Container_mapStateToProps(storeState) {
|
|
|
22719
22719
|
}
|
|
22720
22720
|
function Container_mapDispatchToProps(dispatch) {
|
|
22721
22721
|
return {
|
|
22722
|
-
setGlobalState: bindActionCreators(ActionCreators.
|
|
22722
|
+
setGlobalState: bindActionCreators(ActionCreators.SetStateAction, dispatch)
|
|
22723
22723
|
};
|
|
22724
22724
|
}
|
|
22725
22725
|
const ConnectedContainer = connect(Container_mapStateToProps, Container_mapDispatchToProps)(Container);
|
|
@@ -22751,7 +22751,6 @@ function renderApp(_ref) {
|
|
|
22751
22751
|
entryContainer.id = "ada-entry";
|
|
22752
22752
|
if (adaSettings.parentElement) {
|
|
22753
22753
|
// Just to reduce the diff size in PR (can be removed)
|
|
22754
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
22755
22754
|
parentContainer = getParentContainer({
|
|
22756
22755
|
adaSettings
|
|
22757
22756
|
});
|
|
@@ -23040,7 +23039,7 @@ function createEmbedInterface() {
|
|
|
23040
23039
|
throw new AdaEmbedError("Cannot toggle when using parentElement.");
|
|
23041
23040
|
}
|
|
23042
23041
|
await embed.initialized;
|
|
23043
|
-
await embed.store.dispatch(ActionCreators.
|
|
23042
|
+
await embed.store.dispatch(ActionCreators.ToggleChatAction);
|
|
23044
23043
|
};
|
|
23045
23044
|
return Object.freeze({
|
|
23046
23045
|
start: async adaSettings => {
|
|
@@ -23172,10 +23171,8 @@ function createEmbedInterface() {
|
|
|
23172
23171
|
},
|
|
23173
23172
|
// MES-981: the public surface accepts both the upstream AdaEventKey set
|
|
23174
23173
|
// and the new ada:* keys (ExtendedAdaEventKey). The underlying event
|
|
23175
|
-
// subscription registry is a string-keyed map at runtime
|
|
23176
|
-
//
|
|
23177
|
-
// subscribeEvent helper.
|
|
23178
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23174
|
+
// subscription registry is a string-keyed map at runtime — casting to
|
|
23175
|
+
// AdaEventKey is safe because subscribeEvent stores keys as strings.
|
|
23179
23176
|
subscribeEvent: async (eventKey, callback) => subscribeEvent(eventKey, callback),
|
|
23180
23177
|
unsubscribeEvent: async id => unsubscribeEvent(id),
|
|
23181
23178
|
closeCampaign: async () => {
|
|
@@ -23355,7 +23352,6 @@ function createEmbedInterface() {
|
|
|
23355
23352
|
|
|
23356
23353
|
|
|
23357
23354
|
// We need "export default" for NPM module to be used as `import adaEmbed from "@ada-support/embed2";`
|
|
23358
|
-
// eslint-disable-next-line import/no-default-export
|
|
23359
23355
|
/* harmony default export */ var index_npm = (createEmbedInterface());
|
|
23360
23356
|
}();
|
|
23361
23357
|
module.exports = __webpack_exports__;
|