@theymes/sdk 1.2.4 → 1.2.7
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/constants.d.ts +25 -0
- package/dist/eventPoller.d.ts +22 -0
- package/dist/internalEvents.d.ts +9 -0
- package/dist/internals.d.ts +54 -0
- package/dist/notifications.d.ts +6 -0
- package/dist/sdk.cjs.js +1 -1
- package/dist/sdk.d.ts +4 -75
- package/dist/sdk.esm.js +1 -1
- package/dist/sdk.js +1 -1
- package/dist/sdk.unity.js +1 -1
- package/dist/singletons.d.ts +6 -0
- package/dist/types.d.ts +82 -0
- package/dist/utils.d.ts +9 -0
- package/dist/widgetUtils.d.ts +22 -0
- package/package.json +1 -1
package/dist/sdk.unity.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e){"use strict";var n=function(){return n=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var i in n=arguments[t])Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);return e},n.apply(this,arguments)};function t(e,n,t,o){return new(t||(t=Promise))((function(i,r){function a(e){try{l(o.next(e))}catch(e){r(e)}}function s(e){try{l(o.throw(e))}catch(e){r(e)}}function l(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,s)}l((o=o.apply(e,n||[])).next())}))}function o(e,n){var t,o,i,r={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(r=0)),r;)try{if(t=1,o&&(i=2&s[0]?o.return:s[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;switch(o=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,o=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(i=r.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){r=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(6===s[0]&&r.label<i[1]){r.label=i[1],i=s;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(s);break}i[2]&&r.ops.pop(),r.trys.pop();continue}s=n.call(e,r)}catch(e){s=[6,e],o=0}finally{t=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function i(e,n,t){if(t||2===arguments.length)for(var o,i=0,r=n.length;i<r;i++)!o&&i in n||(o||(o=Array.prototype.slice.call(n,0,i)),o[i]=n[i]);return e.concat(o||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var r={unreadMessageCountUpdate:new Set,unansweredMessageCountUpdate:new Set,open:new Set,close:new Set};function a(e,n){r[e].add(n)}function s(e,n){r[e].delete(n)}function l(e,n){r[e].forEach((function(e){return e.apply(void 0,n)}))}var c='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\n * {\n box-sizing: border-box;\n }\n\n html,\n body {\n background: rgb(CSS_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n padding-top: env(safe-area-inset-top);\n padding-right: env(safe-area-inset-right);\n padding-bottom: env(safe-area-inset-bottom);\n padding-left: env(safe-area-inset-left);\n }\n\n .top-bar {\n flex: 0 0 auto;\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: flex-end;\n }\n\n .loader-wrapper {\n flex: 1 0 0%;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: 12px;\n }\n\n .close-button {\n padding: 0.5rem 1rem;\n cursor: pointer;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 1.75rem;\n height: 1.75rem;\n }\n\n @keyframes spin {\n to {\n transform: rotate(360deg);\n }\n }\n\n .loader {\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 2rem;\n height: 2rem;\n animation: spin 1s linear infinite;\n transform-origin: center;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="wrapper">\n <div class="top-bar">\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"\n stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"\n class="lucide lucide-x-icon lucide-x">\n <path d="M18 6 6 18" />\n <path d="m6 6 12 12" />\n </svg>\n </div>\n </div>\n <div class="loader-wrapper">\n <svg class="loader" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg" fill="none" data-test-name="oval"\n role="img">\n <g fill="none" fill-rule="evenodd">\n <g transform="translate(1 1)" stroke-width="2">\n <circle stroke-opacity="0.5" cx="18" cy="18" r="18" />\n <path d="M36 18c0-9.94-8.06-18-18-18" />\n </g>\n </g>\n </svg>\n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeTheymesSdk() {\n parent.postMessage({ action: \'theymes.close\' }, \'*\');\n }\n\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeTheymesSdk);\n <\/script>\n</body>\n\n</html>',d='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <link rel="preload" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback" as="font"\n type="font/woff2" crossorigin>\n <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback">\n <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'Poppins\', sans-serif;\n font-size: CSS_FONT_SIZE_PLACEHOLDER;\n }\n\n html,\n body {\n background: rgb(CSS_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n padding-top: env(safe-area-inset-top);\n padding-right: env(safe-area-inset-right);\n padding-bottom: env(safe-area-inset-bottom);\n padding-left: env(safe-area-inset-left);\n }\n\n .top-bar {\n flex: 0 0 auto;\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: flex-end;\n }\n\n .close-button {\n padding: 0.5rem 1rem;\n cursor: pointer;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 1.75rem;\n height: 1.75rem;\n }\n\n .error-wrapper {\n flex: 1 0 0%;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: 12px;\n padding: 12px;\n }\n\n h1 {\n font-size: 18px;\n font-weight: 400;\n color: rgb(CSS_TEXT_PLACEHOLDER);\n }\n\n svg.error-icon {\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="wrapper">\n <div class="top-bar">\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"\n stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"\n class="lucide lucide-x-icon lucide-x">\n <path d="M18 6 6 18" />\n <path d="m6 6 12 12" />\n </svg>\n </div>\n </div>\n <div class="error-wrapper">\n <svg class="error-icon" width="91" height="91" viewBox="0 0 91 91" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path\n d="M45.1079 89.1321C50.7158 89.1321 55.2618 84.5859 55.2618 78.9783C55.2618 73.3707 50.7158 68.8245 45.1079 68.8245C39.5001 68.8245 34.9541 73.3707 34.9541 78.9783C34.9541 84.5859 39.5001 89.1321 45.1079 89.1321Z"\n stroke="#FFB547" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />\n <path d="M24.7637 58.6355C35.9988 47.4005 54.2144 47.4005 65.4492 58.6355" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M12.7988 46.6689C22.1436 37.3241 34.529 32.8731 46.7703 33.3159" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M1.1084 34.4283C11.6674 23.9971 25.012 18.0833 38.7295 16.6868" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M89.1082 1.13208L62.0312 28.209" stroke="#FFB547" stroke-width="2" stroke-linecap="round"\n stroke-linejoin="round" />\n <path d="M62.0312 1.13208L89.1082 28.209" stroke="#FFB547" stroke-width="2" stroke-linecap="round"\n stroke-linejoin="round" />\n </svg>\n <div>\n <h1>Connection error</h1>\n </div>\n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeTheymesSdk() {\n parent.postMessage({ action: \'theymes.close\' }, \'*\');\n }\n\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeTheymesSdk);\n <\/script>\n</body>\n\n</html>',u='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <link rel="preload" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback" as="font"\n type="font/woff2" crossorigin>\n <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback">\n <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'Poppins\', sans-serif;\n }\n\n html,\n body {\n width: 100%;\n height: auto;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_NOTIFICATION_TEXT_PLACEHOLDER);\n width: 1.25rem;\n height: 1.25rem;\n }\n\n .notification {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n background: rgb(CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: auto;\n margin: 0;\n padding: 12px;\n border-radius: 6px;\n color: rgb(CSS_NOTIFICATION_TEXT_PLACEHOLDER);\n }\n\n .notification-text {\n flex: 1 0 0%;\n font-size: 0.875rem;\n /* 14/16 */\n line-height: 1.2;\n display: -webkit-box;\n line-clamp: 2;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n text-overflow: ellipsis;\n cursor: pointer;\n }\n\n .close-button {\n flex: 0 0 auto;\n padding-left: 10px;\n cursor: pointer;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="notification">\n <div class="notification-text">NOTIFICATION_TEXT_PLACEHOLDER</div>\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round">\n <path d="M18 6 6 18"></path>\n <path d="m6 6 12 12"></path>\n </svg>\n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeNotification() {\n parent.postMessage({ action: \'theymes.closeNotification\' }, \'*\');\n }\n\n function notificationClicked() {\n parent.postMessage({ action: \'theymes.handleNotificationAction\' }, \'*\');\n }\n\n document.querySelector(\'.notification-text\').addEventListener(\'click\', notificationClicked);\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeNotification);\n <\/script>\n</body>\n\n</html>',p="<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n <meta charset=\"utf-8\" />\n <meta name=\"viewport\"\n content=\"viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no\" />\n <meta name=\"theme-color\" content=\"#000000\" />\n <meta name=\"robots\" content=\"noindex\" />\n <link rel=\"preconnect\" href=\"https://fonts.gstatic.com\" crossorigin>\n <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\n @font-face {\n font-family: 'TheymesBody';\n src: CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER;\n font-weight: normal;\n font-style: normal;\n font-display: fallback;\n }\n\n * {\n box-sizing: border-box;\n }\n\n html,\n body {\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .sdk-button {\n display: flex;\n font-family: 'TheymesBody', CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER;\n background: rgb(CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n align-items: center;\n justify-content: center;\n color: rgb(CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER);\n font-size: 14px;\n font-weight: 700;\n cursor: pointer;\n text-align: center;\n padding: 0 12px;\n border: none;\n outline: none;\n border-radius: 999px;\n box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);\n position: relative;\n }\n\n .sdk-button-badge {\n position: absolute;\n top: 0;\n right: 0;\n background: rgb(CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER);\n width: 12px;\n height: 12px;\n border-radius: 999px;\n display: none;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <button class=\"sdk-button\">\n <span class=\"sdk-button-text\">WIDGET_BUTTON_TEXT_PLACEHOLDER</span>\n <span class=\"sdk-button-badge\"></span>\n </button>\n <script NONCE_ATTR_PLACEHOLDER>\n let unreadMessageCount = UNREAD_MESSAGE_COUNT_PLACEHOLDER;\n\n function openWidget() {\n parent.postMessage({ action: 'theymes.sdkButtonClicked' }, '*');\n }\n\n function iframeSubscriber(e) {\n if (e.data.action === 'unreadMessageCountUpdate') {\n unreadMessageCount = e.data.count;\n updateUnreadMessageCount()\n } else if (e.data.action === 'widgetButtonTextUpdate') {\n document.querySelector('.sdk-button-text').textContent = e.data.text;\n }\n }\n\n function updateUnreadMessageCount() {\n if (unreadMessageCount > 0) {\n document.querySelector('.sdk-button-badge').style.display = 'block';\n } else {\n document.querySelector('.sdk-button-badge').style.display = 'none';\n }\n }\n\n document.querySelector('.sdk-button').addEventListener('click', openWidget);\n window.addEventListener('message', iframeSubscriber, false);\n\n updateUnreadMessageCount();\n <\/script>\n</body>\n\n</html>",g=function(e,n){return e===n||Boolean(e&&n&&"object"==typeof e&&"object"==typeof n&&Object.keys(e).length===Object.keys(n).length&&Object.entries(e).every((function(e){var t=e[0],o=e[1];return g(o,n[t])})))},f=/(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|redmi|series[46]0|samsungbrowser.*mobile|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,m=/CrOS/,h=/android|ipad|playbook|silk/i;var y="colors",v="1.2.4",b="web",w={sdkDialog:"#theymes-sdk-dialog",sdkIframeWrapper:"#theymes-sdk-wrapper",sdkIframe:"#theymes-sdk",sdkLoaderIframe:"#theymes-sdk-loader",notificationDialog:"#theymes-sdk-notification-dialog",notificationIframe:"#theymes-sdk-notification",sdkButtonIframe:"#theymes-sdk-button",sdkStylesheet:"#theymes-sdk-stylesheet"},k=340,S=680,T=500,x=120,C=48,E=.2,A=.2,O=.2,_="theymes_path_on_init",L={token:null,domain:null,mode:"game",deviceId:null,position:"bottom-right",widgetButton:!1,widgetButtonAction:"support",x:20,y:20,loggingEnabled:!1,element:null,language:null,tags:new Set,fields:{},youngPlayer:!1,privacyMode:!1,signedMetadataToken:null,player:null,sdkIsOpen:!1,forceUpdateSdkDialog:!1,recordRetentionAfterSecs:null,resetSessionAfterSecs:28800,sessionStatus:"waiting",sessionStartTime:null,sessionResumeOrStartTime:null,retentionRemainingSeconds:null,isRetentionRecordedForSession:!1,recordRetentionTimerId:null,retryRecordRetentionTimerId:null,networkErrorTimerId:null,colors:function(){var e=localStorage.getItem(y);if(e){var t=JSON.parse(e);return n(n({},{text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}}),t)}return{text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}}}(),locs:{widgetButtonText:{}},fonts:{body:void 0},eventsNextPollAt:null,eventsPollerTimerId:null,notificationsPaused:!0,notifications:[],visibleNotification:null,unreadMessageCount:0,unansweredMessageCount:0,previousPath:null,previousConfig:null,nonce:null,keyboardHeight:0},I=function(e){var n="/help-center";U({path:n,config:e}),F({path:n,config:e})},R=function(e){var n="/assistant";U({path:n,config:e}),F({path:n,config:e})},P=function(){!function(){var e=document.querySelector(w.sdkDialog),n=document.querySelector(w.sdkIframeWrapper);if(e){var t=function(){"widget"!==L.mode||L.forceUpdateSdkDialog?e.remove():e.style.display="none",L.forceUpdateSdkDialog=!1};n?(n.style.opacity="0",n.style.transform=$({animation:"start"}),setTimeout((function(){t()}),1e3*E)):t()}L.widgetButton&&X();l("close",[])}(),G()},D=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];a.apply(void 0,e)};function N(e){var t,o,r,a,s,l,c=(null!=e?e:{}).config;if(!L.token||!L.domain||!L.deviceId)return null;var d=null!==(t=null==c?void 0:c.tags)&&void 0!==t?t:[],u=null!==(o=null==c?void 0:c.fields)&&void 0!==o?o:{},p=null!==(a=null!==(r=null==c?void 0:c.language)&&void 0!==r?r:L.language)&&void 0!==a?a:null,g=null!==(s=L.signedMetadataToken)&&void 0!==s?s:null,f=null!==(l=L.player)&&void 0!==l?l:null,m={_platform:b,_sdkVersion:v};L.youngPlayer&&(m._youngPlayer=!0),(L.privacyMode||L.youngPlayer)&&(m._privacyMode=!0);var h=i(i([],Array.from(L.tags),!0),d,!0),y=n(n(n({},L.fields),u),m);return{token:L.token,domain:L.domain,deviceId:L.deviceId,tags:h,fields:y,language:p,signedMetadataToken:g,player:f}}function M(e){return"".concat(e.r," ").concat(e.g," ").concat(e.b)}function B(e){var n,t,o,i;return e.template.replace("PLATFORM_PLACEHOLDER",b).replaceAll("CSS_TEXT_PLACEHOLDER",M(L.colors.text)).replaceAll("CSS_BORDER_PLACEHOLDER",M(L.colors.border)).replaceAll("CSS_BACKGROUND_PLACEHOLDER",M(L.colors.background)).replaceAll("CSS_TILE_PLACEHOLDER",M(L.colors.tile)).replaceAll("CSS_ACCENT_PLACEHOLDER",M(L.colors.accent)).replaceAll("CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER",M(L.colors.notificationBackground)).replaceAll("CSS_NOTIFICATION_TEXT_PLACEHOLDER",M(L.colors.notificationText)).replaceAll("CSS_FONT_SIZE_PLACEHOLDER","game"===L.mode?"16px":"14px").replaceAll("CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER",null!==(t=null===(n=L.fonts.body)||void 0===n?void 0:n.regular)&&void 0!==t?t:"").replaceAll("CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER",null!==(i=null===(o=L.fonts.body)||void 0===o?void 0:o.fallback)&&void 0!==i?i:"ui-sans-serif, system-ui, sans-serif").replaceAll("NONCE_ATTR_PLACEHOLDER",L.nonce?'nonce="'.concat(L.nonce,'"'):"")}function H(e){var n,t=e.iframe,o=e.content,i=null===(n=t.contentWindow)||void 0===n?void 0:n.document;i&&(i.open(),i.write(o),i.close())}function F(e){var n,t,o,i=N({config:e.config});if(i){var r=null!==(n=document.querySelector(w.sdkDialog))&&void 0!==n?n:document.createElement("div");r.id=w.sdkDialog.replace("#",""),r.style.display="block",r.style.position="fixed",r.style.border="none",r.style.width="0",r.style.height="0",r.style.margin="0",r.style.padding="0",r.style.zIndex="9998",r.style.overflow="hidden",r.style.backgroundColor="transparent";var a=null!==(t=r.querySelector(w.sdkIframeWrapper))&&void 0!==t?t:document.createElement("div");a.id=w.sdkIframeWrapper.replace("#",""),a.style.position="relative",a.style.width="100%",a.style.height="100%",a.style.top="0",a.style.right="0",a.style.bottom="0",a.style.left="0",a.style.opacity="0",a.style.colorScheme="auto",a.style.border="none",a.style.backgroundColor="rgb(".concat(M(L.colors.background),")"),a.style.transform=$({animation:"start"}),a.style.transition=(L.mode,"opacity ".concat(E,"s ease-in-out, transform ").concat(E,"s ease-in-out")),"widget"===L.mode&&(a.style.overflow="hidden");var s=null!==(o=a.querySelector(w.sdkLoaderIframe))&&void 0!==o?o:document.createElement("iframe");s.id=w.sdkLoaderIframe.replace("#",""),s.style.position="absolute",s.style.border="none",s.style.width="100%",s.style.height="100%",s.style.top="0",s.style.right="0",s.style.bottom="0",s.style.left="0",s.style.colorScheme="auto";var u=a.querySelector(w.sdkIframe),p=null!=u?u:document.createElement("iframe"),g=setInterval((function(){var e;"complete"===(null===(e=p.contentDocument)||void 0===e?void 0:e.readyState)&&(clearInterval(g),m())}),500);p.id=w.sdkIframe.replace("#",""),p.style.position="absolute",p.style.border="none",p.style.top="0",p.style.right="0",p.style.bottom="0",p.style.left="0",p.style.colorScheme="auto",u&&!L.networkErrorTimerId||(p.src=function(e){var n=e.path,t=e.supportViewConfig,o="https://".concat(L.domain,"/sdk"),i=new URLSearchParams;i.set("platform",b),i.set("token",t.token),i.set("deviceId",t.deviceId),i.set("mode",L.mode),i.set("origin",window.location.origin),t.language&&i.set("language",t.language);var r=j({supportViewConfig:t});return i.set("metadata",JSON.stringify(r)),"".concat(o).concat(n,"?").concat(i.toString())}({path:e.path,supportViewConfig:i}),p.style.width="0",p.style.height="0",r.appendChild(a),a.appendChild(s),a.appendChild(p),document.body.appendChild(r)),H({iframe:s,content:B({template:c})});var f=!1,m=function(){f||(f=!0,L.networkErrorTimerId=setTimeout((function(){H({iframe:s,content:B({template:d})})}),1e4))};p.onload=m,p.onerror=function(){H({iframe:s,content:B({template:d})})},q(),l("open",[]),setTimeout((function(){a.style.opacity="1",a.style.transform=$({animation:"end"})}),100)}}function U(e){var n=e.path,t=e.config,o=null!=t?t:null;L.previousPath===n&&g(L.previousConfig,o)||(L.previousPath=n,L.previousConfig=o,W())}function W(){var e=document.querySelector(w.sdkDialog);L.sdkIsOpen?L.forceUpdateSdkDialog=!0:null==e||e.remove()}function j(e){var n=e.supportViewConfig,t={unsigned:{},signed:void 0};return n.player&&(t.unsigned.player=n.player),n.tags&&(t.unsigned.tags=n.tags),n.fields&&(t.unsigned.fields=n.fields),n.signedMetadataToken&&(t.signed=n.signedMetadataToken),t}function q(){var e=document.querySelector(w.sdkDialog),n=document.querySelector(w.sdkIframeWrapper);if(e&&n)if("widget"===L.mode){var t=Z({type:"widget"}),o=Q();e.style.width=o.width,e.style.height=o.height,e.style.maxWidth=o.maxWidth,e.style.maxHeight=o.maxHeight,e.style.bottom=t.bottom,e.style.right=t.right,e.style.left=t.left,e.style.top=t.top,V()?(n.style.border="none",n.style.borderRadius="0"):(n.style.border="1px solid rgb(".concat(M(L.colors.border),")"),n.style.borderRadius="10px")}else if(n.style.border="none",n.style.borderRadius="0",L.element){var i=L.element.getBoundingClientRect(),r=i.width,a=i.height,s=i.top,l=i.left,c=i.right,d=i.bottom;e.style.width="".concat(r,"px"),e.style.height="".concat(a,"px"),e.style.maxWidth="none",e.style.maxHeight="none",e.style.top="".concat(s,"px"),e.style.left="".concat(l,"px"),e.style.right="".concat(c,"px"),e.style.bottom="".concat(d,"px")}else{a=L.keyboardHeight>0?"calc(100% - ".concat(L.keyboardHeight,"px + env(safe-area-inset-bottom) - 10px)"):"100%";e.style.width="100%",e.style.height=a,e.style.maxWidth="none",e.style.maxHeight="none",e.style.top="0",e.style.left="0",e.style.right="0",e.style.bottom="0"}}function z(e){var n=1e3*e;L.eventsNextPollAt=new Date(Date.now()+n),L.eventsPollerTimerId=setTimeout(G,n)}function G(){return t(this,void 0,void 0,(function(){var e,t,r,a,s,c,d,u;return o(this,(function(o){switch(o.label){case 0:if(ie(),!L.token||!L.domain||!L.deviceId)return z(60),[2];e=L.notificationsPaused||L.sdkIsOpen?"true":"false",t="https://".concat(L.domain,"/api/sdk/events"),r=new URLSearchParams(n(n({token:L.token,language:null!==(d=L.language)&&void 0!==d?d:"en",deviceId:L.deviceId,notificationsPaused:e,mode:L.mode},(null===(u=L.player)||void 0===u?void 0:u.id)?{unsignedPlayerId:L.player.id}:{}),L.signedMetadataToken?{signedMetadataToken:L.signedMetadataToken}:{})).toString(),o.label=1;case 1:return o.trys.push([1,6,,7]),[4,fetch("".concat(t,"?").concat(r),{method:"GET",headers:{"Content-Type":"application/json"}})];case 2:return(a=o.sent()).ok?[3,4]:[4,ee(a)];case 3:throw o.sent();case 4:return[4,a.json()];case 5:return s=o.sent(),L.notifications=i(i([],L.notifications,!0),s.notifications,!0),s.notifications.length>0&&Y(),s.unansweredMessageCount!==L.unansweredMessageCount&&(L.unansweredMessageCount=s.unansweredMessageCount,l("unansweredMessageCountUpdate",[s.unansweredMessageCount])),s.unreadMessageCount!==L.unreadMessageCount&&(L.unreadMessageCount=s.unreadMessageCount,l("unreadMessageCountUpdate",[s.unreadMessageCount]),se({action:"unreadMessageCountUpdate",count:s.unreadMessageCount})),z(s.nextPollSeconds),[3,7];case 6:return c=o.sent(),console.error("Error initializing SDK:",c),z(60),[3,7];case 7:return[2]}}))}))}function Y(){var e,n,t=L.notifications[0];if(t&&!L.visibleNotification){L.visibleNotification=t;var o=null!==(e=document.querySelector(w.notificationDialog))&&void 0!==e?e:document.createElement("div");o.id=w.notificationDialog.replace("#",""),o.style.position="fixed",o.style.border="none",o.style.width="100%",o.style.height="100%",o.style.top="0",o.style.right="0",o.style.bottom="0",o.style.left="0",o.style.margin="0",o.style.padding="0",o.style.zIndex="9999",o.style.colorScheme="auto",o.style.backgroundColor="transparent",o.style.pointerEvents="none",o.style.overflow="hidden",document.body.appendChild(o);var i,r=null!==(n=o.querySelector(w.notificationIframe))&&void 0!==n?n:document.createElement("iframe");r.id=w.notificationIframe.replace("#",""),r.style.position="absolute",r.style.border="none",r.style.width="0",r.style.height="0",r.style.top="-20px",r.style.left="0",r.style.colorScheme="auto",r.style.pointerEvents="auto",r.style.marginTop="-20px",r.style.opacity="0",r.style.transition="opacity ".concat(O,"s ease-in-out, margin-top ").concat(O,"s ease-in-out"),o.appendChild(r),H({iframe:r,content:(i={text:t.text},B({template:u}).replaceAll("NOTIFICATION_TEXT_PLACEHOLDER",i.text))}),K(),setTimeout((function(){r.style.opacity="1",r.style.marginTop="0px"}),500),t.closeAfterSeconds>0&&setTimeout((function(){J({notification:t})}),1e3*t.closeAfterSeconds)}}function K(){var e,n,t,o=document.querySelector(w.notificationDialog),i=document.querySelector(w.notificationIframe);if(o&&i){var r=(null===(t=null===(n=null===(e=i.contentWindow)||void 0===e?void 0:e.document)||void 0===n?void 0:n.body)||void 0===t?void 0:t.scrollHeight)?"".concat(i.contentWindow.document.body.scrollHeight,"px"):"0";if("widget"===L.mode){var a=Z({type:"widget"}),s=Q(),l="calc(".concat(s.width," - 20px)");o.style.width=s.width,o.style.height=s.height,o.style.maxWidth=s.maxWidth,o.style.maxHeight=s.maxHeight,o.style.bottom=a.bottom,o.style.right=a.right,o.style.left=a.left,o.style.top=a.top,i.style.width=l}else if(L.element){var c=L.element.getBoundingClientRect();l="".concat(c.width-20,"px");o.style.width="".concat(c.width,"px"),o.style.height="".concat(c.height,"px"),o.style.maxWidth="none",o.style.maxHeight="none",o.style.top="".concat(c.top,"px"),o.style.left="".concat(c.left,"px"),o.style.right="".concat(c.right,"px"),o.style.bottom="".concat(c.bottom,"px"),i.style.width=l}else{l="calc(100% - 20px)";o.style.width="100%",o.style.height="100%",o.style.maxWidth="none",o.style.maxHeight="none",o.style.top="0",o.style.left="0",o.style.right="0",o.style.bottom="0",i.style.width=l}i.style.height=r,i.style.top="10px",i.style.left="10px"}}function J(e){if(e.notification&&L.visibleNotification===e.notification){var n=document.querySelector(w.notificationIframe),t=document.querySelector(w.notificationDialog);n&&(n.style.opacity="0",n.style.marginTop="-20px",setTimeout((function(){null==t||t.remove(),L.notifications=L.notifications.slice(1),L.visibleNotification=null,Y()}),1e3*O))}}function X(){var e,n=null!==(e=document.querySelector(w.sdkButtonIframe))&&void 0!==e?e:document.createElement("iframe");if(n){var t,o=Z({type:"button"});n.id=w.sdkButtonIframe.replace("#",""),n.style.position="fixed",n.style.border="none",n.style.width="".concat(x,"px"),n.style.height="".concat(C,"px"),n.style.maxWidth="95%",n.style.maxHeight="95%",n.style.bottom=o.bottom,n.style.right=o.right,n.style.left=o.left,n.style.top=o.top,n.style.margin="0",n.style.padding="0",n.style.zIndex="9997",n.style.backgroundColor="transparent",n.style.opacity="0",n.style.transform="scale(0.8)",n.style.transition="opacity ".concat(A,"s ease-in-out, transform ").concat(A,"s ease-in-out"),setTimeout((function(){n.style.opacity="1",n.style.transform="scale(1)"}),100),document.body.appendChild(n),H({iframe:n,content:(t={unreadMessageCount:L.unreadMessageCount},B({template:p}).replaceAll("UNREAD_MESSAGE_COUNT_PLACEHOLDER","".concat(t.unreadMessageCount)).replaceAll("CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER",M(L.colors.widgetButtonBackground)).replaceAll("CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER",M(L.colors.widgetButtonText)).replaceAll("CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER",M(L.colors.widgetButtonActionPending)).replaceAll("WIDGET_BUTTON_TEXT_PLACEHOLDER",le()))})}}function V(){return!!function(e){e||(e={});var n=e.ua;if(n||"undefined"==typeof navigator||(n=navigator.userAgent),n&&n.headers&&"string"==typeof n.headers["user-agent"]&&(n=n.headers["user-agent"]),"string"!=typeof n)return!1;var t=f.test(n)&&!m.test(n)||!!e.tablet&&h.test(n);return!t&&e.tablet&&e.featureDetect&&navigator&&navigator.maxTouchPoints>1&&-1!==n.indexOf("Macintosh")&&-1!==n.indexOf("Safari")&&(t=!0),t}({tablet:!0})&&(window.innerWidth<T||window.innerHeight<T)}function Z(e){var n=e.type,t=L.position,o=L.x,i=L.y;return V()&&"widget"===n?{top:"0",left:"0",right:"0",bottom:"0"}:"top-left"===t?{top:"".concat(o,"px"),left:"".concat(i,"px"),right:"auto",bottom:"auto"}:"top-right"===t?{top:"".concat(o,"px"),right:"".concat(i,"px"),left:"auto",bottom:"auto"}:"bottom-left"===t?{bottom:"".concat(o,"px"),left:"".concat(i,"px"),right:"auto",top:"auto"}:{bottom:"".concat(o,"px"),right:"".concat(i,"px"),left:"auto",top:"auto"}}function Q(){return V()?{width:"100%",height:"100%",maxWidth:"none",maxHeight:"none"}:{width:"".concat(k,"px"),height:"".concat(S,"px"),maxWidth:"none",maxHeight:"calc(100vh - ".concat(2*L.y,"px)")}}function $(e){return"start"===e.animation?"game"===L.mode?"translateY(20%)":"scale(0.8)":"game"===L.mode?"translateY(0)":"scale(1)"}function ee(e){return t(this,void 0,void 0,(function(){return o(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,7]),[4,e.json()];case 1:return[2,n.sent()];case 2:n.sent(),n.label=3;case 3:return n.trys.push([3,5,,6]),[4,e.text()];case 4:return[2,n.sent()];case 5:return n.sent(),[2,void 0];case 6:return[3,7];case 7:return[2]}}))}))}function ne(){return t(this,void 0,void 0,(function(){var e,n,t,i,r,a;return o(this,(function(o){switch(o.label){case 0:if(re(),L.retryRecordRetentionTimerId&&(clearTimeout(L.retryRecordRetentionTimerId),L.retryRecordRetentionTimerId=null),L.retentionRemainingSeconds=null,L.isRetentionRecordedForSession=!0,!(e=N()))return[2];n="https://".concat(L.domain,"/api/sdk/retention"),t=j({supportViewConfig:e}),i={token:L.token,deviceId:L.deviceId,language:L.language,metadata:t},o.label=1;case 1:return o.trys.push([1,5,,6]),[4,fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})];case 2:return(r=o.sent()).ok?[3,4]:[4,ee(r)];case 3:throw o.sent();case 4:return[3,6];case 5:return a=o.sent(),console.error("Error tracking retention:",a),L.retryRecordRetentionTimerId=setTimeout(ne,6e4),[3,6];case 6:return[2]}}))}))}function te(){var e=new Date;if(L.sessionStatus="active",L.sessionResumeOrStartTime=e,L.sessionStartTime){var n=L.sessionStartTime.valueOf()/1e3+L.resetSessionAfterSecs;Date.now()/1e3>n&&oe()}else oe();if(null!==L.retentionRemainingSeconds&&(L.recordRetentionTimerId=setTimeout(ne,1e3*L.retentionRemainingSeconds)),!L.eventsPollerTimerId)if(L.eventsNextPollAt){var t=Math.floor((L.eventsNextPollAt.valueOf()-Date.now())/1e3);t>0?z(t):G()}else G()}function oe(){L.sessionStartTime=new Date,L.retentionRemainingSeconds=L.recordRetentionAfterSecs,L.isRetentionRecordedForSession=!1,re()}function ie(){L.eventsPollerTimerId&&(clearTimeout(L.eventsPollerTimerId),L.eventsPollerTimerId=null)}function re(){L.recordRetentionTimerId&&(clearTimeout(L.recordRetentionTimerId),L.recordRetentionTimerId=null)}function ae(){G(),L.isRetentionRecordedForSession&&ne()}function se(e){var n=document.querySelector(w.sdkButtonIframe);if(n)var t=setInterval((function(){var o,i;"complete"===(null===(o=n.contentDocument)||void 0===o?void 0:o.readyState)&&(clearInterval(t),null===(i=null==n?void 0:n.contentWindow)||void 0===i||i.postMessage(e,"*"))}),100)}function le(){var e,n,t;return null!==(t=null===(e=L.locs.widgetButtonText)||void 0===e?void 0:e[null!==(n=L.language)&&void 0!==n?n:"en"])&&void 0!==t?t:"Support"}function ce(){var e="visible"===document.visibilityState&&document.hasFocus();e&&"paused"===L.sessionStatus?te():e||"active"!==L.sessionStatus||function(){if(L.sessionResumeOrStartTime&&L.retentionRemainingSeconds){var e=Math.floor((Date.now()-L.sessionResumeOrStartTime.valueOf())/1e3);L.retentionRemainingSeconds-=e}L.sessionStatus="paused",ie(),re()}()}document.addEventListener("visibilitychange",ce),window.addEventListener("focus",ce),window.addEventListener("blur",ce),window.addEventListener("resize",q),window.addEventListener("resize",K),window.addEventListener("message",(function(e){if("theymes.ready"===e.data.action){var n=document.querySelector(w.sdkLoaderIframe),t=document.querySelector(w.sdkIframe);L.networkErrorTimerId&&(clearTimeout(L.networkErrorTimerId),L.networkErrorTimerId=null),t&&(t.style.width="100%",t.style.height="100%"),n&&n.remove()}else if("theymes.close"===e.data.action)P();else if("theymes.closeNotification"===e.data.action)J({notification:L.visibleNotification});else if("theymes.handleNotificationAction"===e.data.action)r={notification:L.visibleNotification},(null==(a=r.notification)?void 0:a.action)&&"OPEN_PAGE"===a.action.type&&(F({path:a.action.path}),J({notification:a}));else if("theymes.sdkButtonClicked"===e.data.action)(i=document.querySelector(w.sdkButtonIframe))&&(i.style.opacity="0",i.style.transform="scale(0.8)",setTimeout((function(){i.remove()}),1e3*A)),"support"===L.widgetButtonAction?I():"assistant"===L.widgetButtonAction&&R();else if("theymes.openExternalPage"===e.data.action){var o=e.data.url.startsWith(window.location.origin);o&&function(e){var n=e.key,t=e.value,o=e.ttlMs,i=e.storage,r=void 0===i?sessionStorage:i,a={value:t,expiry:Date.now()+o};r.setItem(n,JSON.stringify(a))}({key:_,value:e.data.path,ttlMs:1e4}),window.open(e.data.url,o?"_self":"_blank")}var i,r,a}),!1),D("open",(function(){L.sdkIsOpen=!0})),D("close",(function(){L.sdkIsOpen=!1})),e.addEventListener=D,e.addField=function(e,n){L.fields[e]=n,W()},e.addFields=function(e){L.fields=n(n({},L.fields),e),W()},e.addTag=function(e){L.tags.add(e),W()},e.addTags=function(e){e.forEach((function(e){return L.tags.add(e)})),W()},e.close=P,e.disableLogging=function(){L.loggingEnabled=!1},e.disableNotifications=function(){L.notificationsPaused=!0},e.enableLogging=function(){L.loggingEnabled=!0},e.enableNotifications=function(){L.notificationsPaused=!1,G()},e.getFields=function(){return L.fields},e.getLanguage=function(){return L.language},e.getPlayer=function(){return L.player},e.getSdkVersion=function(){return v},e.getSignedMetadataToken=function(){return L.signedMetadataToken},e.getTags=function(){return Array.from(L.tags)},e.getUnansweredMessageCount=function(){return L.unansweredMessageCount},e.getUnreadMessageCount=function(){return L.unreadMessageCount},e.initialize=function(e,i,r){return t(void 0,void 0,void 0,(function(){var t,a,s,l,c,d,u,p,g,f,m,h,v,w;return o(this,(function(o){switch(o.label){case 0:if(!e||!i||!r.mode)throw new Error("Token, domain, and mode are required");L.token=e,L.domain=i,L.mode=r.mode,L.element="element"in r&&void 0!==r.element?r.element:L.element,L.language=null!==(u=r.language)&&void 0!==u?u:L.language,L.nonce=null!==(p=r.nonce)&&void 0!==p?p:L.nonce,L.deviceId=function(){var e=localStorage.getItem("deviceId");if(e)return e;var n=crypto.randomUUID();return localStorage.setItem("deviceId",n),n}(),L.widgetButton="button"in r&&void 0!==r.button&&null!==(g=r.button)&&void 0!==g?g:L.widgetButton,L.widgetButtonAction="buttonAction"in r&&void 0!==r.buttonAction&&null!==(f=r.buttonAction)&&void 0!==f?f:L.widgetButtonAction,L.position="position"in r&&void 0!==r.position&&null!==(m=r.position)&&void 0!==m?m:L.position,L.x="x"in r&&void 0!==r.x?r.x:L.x,L.y="y"in r&&void 0!==r.y?r.y:L.y,G(),t="https://".concat(i,"/api/sdk/initialize"),a={token:e,deviceId:L.deviceId,platform:b,mode:L.mode},o.label=1;case 1:return o.trys.push([1,6,,7]),[4,fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})];case 2:return(s=o.sent()).ok?[3,4]:[4,ee(s)];case 3:throw o.sent();case 4:return[4,s.json()];case 5:return l=o.sent(),(null===(h=null==l?void 0:l.branding)||void 0===h?void 0:h.colors)&&(k=l.branding.colors,L.colors=n(n({},L.colors),k),localStorage.setItem(y,JSON.stringify(L.colors))),(null===(v=null==l?void 0:l.branding)||void 0===v?void 0:v.locs)&&(L.locs=l.branding.locs),(null===(w=null==l?void 0:l.branding)||void 0===w?void 0:w.fonts)&&(L.fonts=l.branding.fonts),"number"==typeof(null==l?void 0:l.recordRetentionAfterSecs)&&(L.recordRetentionAfterSecs=l.recordRetentionAfterSecs),"number"==typeof(null==l?void 0:l.resetSessionAfterSecs)&&(L.resetSessionAfterSecs=l.resetSessionAfterSecs),te(),W(),c=function(e){var n=e.key,t=e.storage,o=void 0===t?sessionStorage:t,i=e.removeItem,r=void 0!==i&&i,a=o.getItem(n);if(!a)return null;var s=JSON.parse(a);return Date.now()>s.expiry?(sessionStorage.removeItem(n),null):(r&&o.removeItem(n),s.value)}({key:_,removeItem:!0}),c?F({path:c}):L.widgetButton&&X(),[3,7];case 6:return d=o.sent(),console.error("Error initializing SDK:",d),[3,7];case 7:return[2]}var k}))}))},e.iosSetKeyboardHeight=function(e){L.keyboardHeight=e,q()},e.isPrivacyMode=function(){return L.privacyMode},e.isSupported=function(){return!0},e.isYoungPlayer=function(){return L.youngPlayer},e.openAssistant=R,e.openResource=function(e,n){var t="/resources/".concat(e);U({path:t,config:n}),F({path:t,config:n})},e.openSupport=I,e.recordRetention=function(){L.isRetentionRecordedForSession||ne()},e.removeAllFields=function(){L.fields={},W()},e.removeAllTags=function(){L.tags.clear(),W()},e.removeEventListener=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];s.apply(void 0,e)},e.removeField=function(e){delete L.fields[e],W()},e.removeFields=function(e){e.forEach((function(e){return delete L.fields[e]})),W()},e.removeTag=function(e){L.tags.delete(e),W()},e.removeTags=function(e){e.forEach((function(e){return L.tags.delete(e)})),W()},e.requestNotificationPermission=function(){},e.reset=function(){L.language=null,L.tags=new Set,L.fields={},L.signedMetadataToken=null,L.player=null,W(),se({action:"widgetButtonTextUpdate",text:le()})},e.setFields=function(e){L.fields=e,W()},e.setLanguage=function(e){var n=L.language!==e;L.language=e,n&&(W(),se({action:"widgetButtonTextUpdate",text:le()}))},e.setPlayer=function(e){var n,t=(null===(n=L.player)||void 0===n?void 0:n.id)!==(null==e?void 0:e.id);L.player=e,t&&(W(),ae())},e.setPrivacyMode=function(e){L.privacyMode=e,W()},e.setSignedMetadataToken=function(e){var n=L.signedMetadataToken!==e;L.signedMetadataToken=e,n&&(W(),ae())},e.setTags=function(e){L.tags=new Set(e),W()},e.setYoungPlayer=function(e){L.youngPlayer=e,W()}}(this.theymes=this.theymes||{});
|
|
1
|
+
!function(e){"use strict";var n=function(){return n=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var i in n=arguments[t])Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);return e},n.apply(this,arguments)};function t(e,n,t,o){return new(t||(t=Promise))((function(i,r){function a(e){try{l(o.next(e))}catch(e){r(e)}}function s(e){try{l(o.throw(e))}catch(e){r(e)}}function l(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,s)}l((o=o.apply(e,n||[])).next())}))}function o(e,n){var t,o,i,r={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(r=0)),r;)try{if(t=1,o&&(i=2&s[0]?o.return:s[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;switch(o=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,o=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(i=r.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){r=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(6===s[0]&&r.label<i[1]){r.label=i[1],i=s;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(s);break}i[2]&&r.ops.pop(),r.trys.pop();continue}s=n.call(e,r)}catch(e){s=[6,e],o=0}finally{t=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function i(e,n,t){if(t||2===arguments.length)for(var o,i=0,r=n.length;i<r;i++)!o&&i in n||(o||(o=Array.prototype.slice.call(n,0,i)),o[i]=n[i]);return e.concat(o||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var r={unreadMessageCountUpdate:new Set,unansweredMessageCountUpdate:new Set,open:new Set,close:new Set};function a(e,n){r[e].add(n)}function s(e,n){r[e].delete(n)}function l(e,n){r[e].forEach((function(e){return e.apply(void 0,n)}))}var c='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\n * {\n box-sizing: border-box;\n }\n\n html,\n body {\n background: rgb(CSS_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n padding-top: INSET_TOP_PLACEHOLDER;\n padding-bottom: INSET_BOTTOM_PLACEHOLDER;\n padding-left: INSET_LEFT_PLACEHOLDER;\n padding-right: INSET_RIGHT_PLACEHOLDER;\n }\n\n .top-bar {\n flex: 0 0 auto;\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: flex-end;\n }\n\n .loader-wrapper {\n flex: 1 0 0%;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: 12px;\n }\n\n .close-button {\n padding: 0.5rem 1rem;\n cursor: pointer;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 1.75rem;\n height: 1.75rem;\n }\n\n @keyframes spin {\n to {\n transform: rotate(360deg);\n }\n }\n\n .loader {\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 2rem;\n height: 2rem;\n animation: spin 1s linear infinite;\n transform-origin: center;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="wrapper">\n <div class="top-bar">\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"\n stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"\n class="lucide lucide-x-icon lucide-x">\n <path d="M18 6 6 18" />\n <path d="m6 6 12 12" />\n </svg>\n </div>\n </div>\n <div class="loader-wrapper">\n <svg class="loader" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg" fill="none" data-test-name="oval"\n role="img">\n <g fill="none" fill-rule="evenodd">\n <g transform="translate(1 1)" stroke-width="2">\n <circle stroke-opacity="0.5" cx="18" cy="18" r="18" />\n <path d="M36 18c0-9.94-8.06-18-18-18" />\n </g>\n </g>\n </svg>\n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeTheymesSdk() {\n parent.postMessage({ action: \'theymes.close\' }, \'*\');\n }\n\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeTheymesSdk);\n <\/script>\n</body>\n\n</html>',d='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: sans-serif;\n font-size: CSS_FONT_SIZE_PLACEHOLDER;\n }\n\n html,\n body {\n background: rgb(CSS_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n padding-top: INSET_TOP_PLACEHOLDER;\n padding-bottom: INSET_BOTTOM_PLACEHOLDER;\n padding-left: INSET_LEFT_PLACEHOLDER;\n padding-right: INSET_RIGHT_PLACEHOLDER;\n }\n\n .top-bar {\n flex: 0 0 auto;\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: flex-end;\n }\n\n .close-button {\n padding: 0.5rem 1rem;\n cursor: pointer;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 1.75rem;\n height: 1.75rem;\n }\n\n .error-wrapper {\n flex: 1 0 0%;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: 12px;\n padding: 12px;\n }\n\n h1 {\n font-size: 18px;\n font-weight: 400;\n color: rgb(CSS_TEXT_PLACEHOLDER);\n }\n\n svg.error-icon {\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="wrapper">\n <div class="top-bar">\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"\n stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"\n class="lucide lucide-x-icon lucide-x">\n <path d="M18 6 6 18" />\n <path d="m6 6 12 12" />\n </svg>\n </div>\n </div>\n <div class="error-wrapper">\n <svg class="error-icon" width="91" height="91" viewBox="0 0 91 91" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path\n d="M45.1079 89.1321C50.7158 89.1321 55.2618 84.5859 55.2618 78.9783C55.2618 73.3707 50.7158 68.8245 45.1079 68.8245C39.5001 68.8245 34.9541 73.3707 34.9541 78.9783C34.9541 84.5859 39.5001 89.1321 45.1079 89.1321Z"\n stroke="#FFB547" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />\n <path d="M24.7637 58.6355C35.9988 47.4005 54.2144 47.4005 65.4492 58.6355" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M12.7988 46.6689C22.1436 37.3241 34.529 32.8731 46.7703 33.3159" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M1.1084 34.4283C11.6674 23.9971 25.012 18.0833 38.7295 16.6868" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M89.1082 1.13208L62.0312 28.209" stroke="#FFB547" stroke-width="2" stroke-linecap="round"\n stroke-linejoin="round" />\n <path d="M62.0312 1.13208L89.1082 28.209" stroke="#FFB547" stroke-width="2" stroke-linecap="round"\n stroke-linejoin="round" />\n </svg>\n <div>\n <h1>Connection error</h1>\n </div>\n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeTheymesSdk() {\n parent.postMessage({ action: \'theymes.close\' }, \'*\');\n }\n\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeTheymesSdk);\n <\/script>\n</body>\n\n</html>',u="<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n <meta charset=\"utf-8\" />\n <meta name=\"viewport\"\n content=\"viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no\" />\n <meta name=\"theme-color\" content=\"#000000\" />\n <meta name=\"robots\" content=\"noindex\" />\n <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\n @font-face {\n font-family: 'TheymesBody';\n src: CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER;\n font-weight: normal;\n font-style: normal;\n font-display: fallback;\n }\n\n * {\n box-sizing: border-box;\n }\n\n html,\n body {\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .sdk-button {\n display: flex;\n font-family: 'TheymesBody', CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER;\n background: rgb(CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n align-items: center;\n justify-content: center;\n color: rgb(CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER);\n font-size: 14px;\n font-weight: 700;\n cursor: pointer;\n text-align: center;\n padding: 0 12px;\n border: none;\n outline: none;\n border-radius: 999px;\n box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);\n position: relative;\n }\n\n .sdk-button-badge {\n position: absolute;\n top: 0;\n right: 0;\n background: rgb(CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER);\n width: 12px;\n height: 12px;\n border-radius: 999px;\n display: none;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <button class=\"sdk-button\">\n <span class=\"sdk-button-text\">WIDGET_BUTTON_TEXT_PLACEHOLDER</span>\n <span class=\"sdk-button-badge\"></span>\n </button>\n <script NONCE_ATTR_PLACEHOLDER>\n let unreadMessageCount = UNREAD_MESSAGE_COUNT_PLACEHOLDER;\n\n function openWidget() {\n parent.postMessage({ action: 'theymes.sdkButtonClicked' }, '*');\n }\n\n function iframeSubscriber(e) {\n if (e.data.action === 'unreadMessageCountUpdate') {\n unreadMessageCount = e.data.count;\n updateUnreadMessageCount()\n } else if (e.data.action === 'widgetButtonTextUpdate') {\n document.querySelector('.sdk-button-text').textContent = e.data.text;\n }\n }\n\n function updateUnreadMessageCount() {\n if (unreadMessageCount > 0) {\n document.querySelector('.sdk-button-badge').style.display = 'block';\n } else {\n document.querySelector('.sdk-button-badge').style.display = 'none';\n }\n }\n\n document.querySelector('.sdk-button').addEventListener('click', openWidget);\n window.addEventListener('message', iframeSubscriber, false);\n\n updateUnreadMessageCount();\n <\/script>\n</body>\n\n</html>",p="1.2.7",f="colors",g="web",m={sdkDialog:"#theymes-sdk-dialog",sdkIframeWrapper:"#theymes-sdk-wrapper",sdkIframe:"#theymes-sdk",sdkLoaderIframe:"#theymes-sdk-loader",notificationDialog:"#theymes-sdk-notification-dialog",notificationIframe:"#theymes-sdk-notification",sdkButtonIframe:"#theymes-sdk-button",sdkStylesheet:"#theymes-sdk-stylesheet"},h=340,y=680,v=500,b=120,w=48,E=.2,T=.2,k=.2,S="theymes_path_on_init",C="url('https://fonts.gstatic.com/s/poppins/v22/pxiEyp8kv8JHgFVrJJfecnFHGPc.woff2') format('woff2')",x={token:null,domain:null,mode:"game",deviceId:null,position:"bottom-right",widgetButton:!1,widgetButtonAction:"support",x:20,y:20,loggingEnabled:!1,element:null,language:null,userLanguage:navigator.language,tags:new Set,fields:{},youngPlayer:!1,privacyMode:!1,signedMetadataToken:null,isLoggedIn:!1,isInForeground:!0,hasNetworkConnectivity:!0,player:null,sdkIsOpen:!1,forceUpdateSdkDialog:!1,recordRetentionAfterSecs:null,resetSessionAfterSecs:28800,sessionStatus:"waiting",sessionStartTime:null,sessionResumeOrStartTime:null,retentionRemainingSeconds:null,isRetentionRecordedForSession:!1,recordRetentionTimerId:null,retryRecordRetentionTimerId:null,retryIntervalSecs:300,networkErrorTimerId:null,colors:function(){var e=localStorage.getItem(f);if(e){var t=JSON.parse(e);return n(n({},{text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}}),t)}return{text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}}}(),locs:{widgetButtonText:{}},fonts:{body:void 0},notificationsPaused:!0,notifications:[],visibleNotification:null,unreadMessageCount:0,unansweredMessageCount:0,previousPath:null,previousConfig:null,nonce:null,keyboardHeight:0,disableInsets:!1};var O=function(e,n){return e===n||Boolean(e&&n&&"object"==typeof e&&"object"==typeof n&&Object.keys(e).length===Object.keys(n).length&&Object.entries(e).every((function(e){var t=e[0],o=e[1];return O(o,n[t])})))};function L(e){var n,t=e.iframe,o=e.content,i=null===(n=t.contentWindow)||void 0===n?void 0:n.document;i&&(i.open(),i.write(o),i.close())}function I(e){return"".concat(e.r," ").concat(e.g," ").concat(e.b)}function _(e){var n,t,o,i;return e.template.replace("PLATFORM_PLACEHOLDER",g).replace("INSET_TOP_PLACEHOLDER",x.disableInsets?"0px":"env(safe-area-inset-top, 0px)").replace("INSET_BOTTOM_PLACEHOLDER",x.disableInsets?"0px":"env(safe-area-inset-bottom, 0px)").replace("INSET_LEFT_PLACEHOLDER",x.disableInsets?"0px":"env(safe-area-inset-left, 0px)").replace("INSET_RIGHT_PLACEHOLDER",x.disableInsets?"0px":"env(safe-area-inset-right, 0px)").replaceAll("CSS_TEXT_PLACEHOLDER",I(x.colors.text)).replaceAll("CSS_BORDER_PLACEHOLDER",I(x.colors.border)).replaceAll("CSS_BACKGROUND_PLACEHOLDER",I(x.colors.background)).replaceAll("CSS_TILE_PLACEHOLDER",I(x.colors.tile)).replaceAll("CSS_ACCENT_PLACEHOLDER",I(x.colors.accent)).replaceAll("CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER",I(x.colors.notificationBackground)).replaceAll("CSS_NOTIFICATION_TEXT_PLACEHOLDER",I(x.colors.notificationText)).replaceAll("CSS_FONT_SIZE_PLACEHOLDER","game"===x.mode?"16px":"14px").replaceAll("CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER",null!==(t=null===(n=x.fonts.body)||void 0===n?void 0:n.regular)&&void 0!==t?t:C).replaceAll("CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER",null!==(i=null===(o=x.fonts.body)||void 0===o?void 0:o.fallback)&&void 0!==i?i:"ui-sans-serif, system-ui, sans-serif").replaceAll("NONCE_ATTR_PLACEHOLDER",x.nonce?'nonce="'.concat(x.nonce,'"'):"")}var R='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\n @font-face {\n font-family: \'TheymesBody\';\n src: CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER;\n font-weight: normal;\n font-style: normal;\n font-display: fallback;\n }\n\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'TheymesBody\', CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER;\n }\n\n html,\n body {\n width: 100%;\n height: auto;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_NOTIFICATION_TEXT_PLACEHOLDER);\n width: 1.25rem;\n height: 1.25rem;\n }\n\n .notification {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n background: rgb(CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: auto;\n margin: 0;\n padding: 12px;\n border-radius: 6px;\n color: rgb(CSS_NOTIFICATION_TEXT_PLACEHOLDER);\n }\n\n .notification-text {\n flex: 1 0 0%;\n font-size: 0.875rem;\n /* 14/16 */\n line-height: 1.2;\n display: -webkit-box;\n line-clamp: 2;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n text-overflow: ellipsis;\n cursor: pointer;\n }\n\n .close-button {\n flex: 0 0 auto;\n padding-left: 10px;\n cursor: pointer;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="notification">\n <div class="notification-text">NOTIFICATION_TEXT_PLACEHOLDER</div>\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round">\n <path d="M18 6 6 18"></path>\n <path d="m6 6 12 12"></path>\n </svg>\n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeNotification() {\n parent.postMessage({ action: \'theymes.closeNotification\' }, \'*\');\n }\n\n function notificationClicked() {\n parent.postMessage({ action: \'theymes.handleNotificationAction\' }, \'*\');\n }\n\n document.querySelector(\'.notification-text\').addEventListener(\'click\', notificationClicked);\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeNotification);\n <\/script>\n</body>\n\n</html>',A=/(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|redmi|series[46]0|samsungbrowser.*mobile|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,P=/CrOS/,N=/android|ipad|playbook|silk/i;function D(){return!!function(e){e||(e={});var n=e.ua;if(n||"undefined"==typeof navigator||(n=navigator.userAgent),n&&n.headers&&"string"==typeof n.headers["user-agent"]&&(n=n.headers["user-agent"]),"string"!=typeof n)return!1;var t=A.test(n)&&!P.test(n)||!!e.tablet&&N.test(n);return!t&&e.tablet&&e.featureDetect&&navigator&&navigator.maxTouchPoints>1&&-1!==n.indexOf("Macintosh")&&-1!==n.indexOf("Safari")&&(t=!0),t}({tablet:!0})&&(window.innerWidth<v||window.innerHeight<v)}function B(e){var n=e.type,t=x.position,o=x.x,i=x.y;return D()&&"widget"===n?{top:"0",left:"0",right:"0",bottom:"0"}:"top-left"===t?{top:"".concat(o,"px"),left:"".concat(i,"px"),right:"auto",bottom:"auto"}:"top-right"===t?{top:"".concat(o,"px"),right:"".concat(i,"px"),left:"auto",bottom:"auto"}:"bottom-left"===t?{bottom:"".concat(o,"px"),left:"".concat(i,"px"),right:"auto",top:"auto"}:{bottom:"".concat(o,"px"),right:"".concat(i,"px"),left:"auto",top:"auto"}}function M(){return D()?{width:"100%",height:"100%",maxWidth:"none",maxHeight:"none"}:{width:"".concat(h,"px"),height:"".concat(y,"px"),maxWidth:"none",maxHeight:"calc(100vh - ".concat(2*x.y,"px)")}}function H(e){var n=document.querySelector(m.sdkButtonIframe);if(n)var t=setInterval((function(){var o,i;"complete"===(null===(o=n.contentDocument)||void 0===o?void 0:o.readyState)&&(clearInterval(t),null===(i=null==n?void 0:n.contentWindow)||void 0===i||i.postMessage(e,"*"))}),100)}function F(){var e,n,t=x.notifications[0];if(t&&!x.visibleNotification){x.visibleNotification=t;var o=null!==(e=document.querySelector(m.notificationDialog))&&void 0!==e?e:document.createElement("div");o.id=m.notificationDialog.replace("#",""),o.style.position="fixed",o.style.border="none",o.style.margin="0",o.style.padding="0",o.style.zIndex="9999",o.style.colorScheme="auto",o.style.backgroundColor="transparent",o.style.pointerEvents="none",o.style.overflow="hidden",document.body.appendChild(o);var i,r=null!==(n=o.querySelector(m.notificationIframe))&&void 0!==n?n:document.createElement("iframe");r.id=m.notificationIframe.replace("#",""),r.style.position="absolute",r.style.border="none",r.style.width="0",r.style.height="0",r.style.top="-20px",r.style.left="0",r.style.colorScheme="auto",r.style.pointerEvents="auto",r.style.marginTop="-20px",r.style.opacity="0",r.style.transition="opacity ".concat(k,"s ease-in-out, margin-top ").concat(k,"s ease-in-out"),o.appendChild(r),L({iframe:r,content:(i={text:t.text},_({template:R}).replaceAll("NOTIFICATION_TEXT_PLACEHOLDER",i.text))}),setTimeout((function(){r.style.opacity="1",r.style.marginTop="0px",j()}),500),t.closeAfterSeconds>0&&setTimeout((function(){U({notification:t})}),1e3*t.closeAfterSeconds)}}function j(){var e,n,t,o=document.querySelector(m.notificationDialog),i=document.querySelector(m.notificationIframe);if(o&&i){var r=(null===(t=null===(n=null===(e=i.contentWindow)||void 0===e?void 0:e.document)||void 0===n?void 0:n.body)||void 0===t?void 0:t.scrollHeight)?"".concat(i.contentWindow.document.body.scrollHeight,"px"):"0";if("widget"===x.mode){var a=B({type:"widget"}),s=M(),l="calc(".concat(s.width," - 20px)");o.style.bottom=a.bottom,o.style.right=a.right,o.style.left=a.left,o.style.top=a.top,o.style.overflow="hidden",i.style.width=l}else if(x.element){var c=x.element.getBoundingClientRect();l="".concat(c.width-20,"px");o.style.top="".concat(c.top,"px"),o.style.left="".concat(c.left,"px"),o.style.right="".concat(c.right,"px"),o.style.bottom="".concat(c.bottom,"px"),o.style.overflow="hidden",i.style.width=l}else{l="calc(100% - 20px)";o.style.top=x.disableInsets?"0px":"env(safe-area-inset-top, 0px)",o.style.left=x.disableInsets?"0px":"env(safe-area-inset-left, 0px)",o.style.right=x.disableInsets?"0px":"env(safe-area-inset-right, 0px)",o.style.bottom=x.disableInsets?"0px":"env(safe-area-inset-bottom, 0px)",o.style.overflow="visible",i.style.width=l}i.style.height=r,i.style.top="10px",i.style.left="10px"}}function U(e){if(e.notification&&x.visibleNotification===e.notification){var n=document.querySelector(m.notificationIframe),t=document.querySelector(m.notificationDialog);n&&(n.style.opacity="0",n.style.marginTop="-20px",setTimeout((function(){null==t||t.remove(),x.notifications=x.notifications.slice(1),x.visibleNotification=null,F()}),1e3*k))}}var q=function(){function e(){Object.defineProperty(this,"isRunning",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"pollWhenNotificationsEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"lastPollDate",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"nextPollDate",{enumerable:!0,configurable:!0,writable:!0,value:null}),this.resumeIfNeeded(!1)}return Object.defineProperty(e.prototype,"onIsInForegroundChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(){x.isInForeground?this.resumeIfNeeded(!1):this.pauseIfNeeded()}}),Object.defineProperty(e.prototype,"onHasNetworkConnectivityChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.resumeIfNeeded(!1)}}),Object.defineProperty(e.prototype,"resume",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.isRunning=!0;var n=new Date;if(this.nextPollDate&&!e||(this.nextPollDate=new Date(n.getTime()+1e3)),n>=this.nextPollDate)this.pollEventsRequest();else{var t=(this.nextPollDate.getTime()-n.getTime())/1e3;this.scheduleNextPollEventsRequest(t)}}}),Object.defineProperty(e.prototype,"pause",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning=!1,this.timer&&(clearTimeout(this.timer),this.timer=null)}}),Object.defineProperty(e.prototype,"shouldBeRunning",{enumerable:!1,configurable:!0,writable:!0,value:function(){return x.isLoggedIn&&x.isInForeground&&x.hasNetworkConnectivity&&!x.sdkIsOpen}}),Object.defineProperty(e.prototype,"resumeIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){!this.shouldBeRunning()||this.isRunning&&!e||this.resume(e)}}),Object.defineProperty(e.prototype,"pauseIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning&&!this.shouldBeRunning()&&this.pause()}}),Object.defineProperty(e.prototype,"onEnableNotifications",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning&&this.pollWhenNotificationsEnabled&&this.scheduleNextPollEventsRequest(0)}}),Object.defineProperty(e.prototype,"onOpen",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.pauseIfNeeded()}}),Object.defineProperty(e.prototype,"onClose",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.resumeIfNeeded(!0)}}),Object.defineProperty(e.prototype,"onLogin",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.resumeIfNeeded(!0)}}),Object.defineProperty(e.prototype,"onLogout",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.pauseIfNeeded()}}),Object.defineProperty(e.prototype,"scheduleNextPollEventsRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this;this.nextPollDate=new Date(Date.now()+1e3*e),this.timer&&clearTimeout(this.timer),this.timer=setTimeout((function(){n.timer=null,n.pollEventsRequest()}),1e3*e)}}),Object.defineProperty(e.prototype,"pollEventsRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(){return t(this,void 0,void 0,(function(){var e,t,r,a,s,c,d,u,p;return o(this,(function(o){switch(o.label){case 0:if(!x.token||!x.domain||!x.deviceId)return[2];if(!this.isRunning)return[2];if(this.lastPollDate&&(e=new Date(this.lastPollDate.getTime()+6e4),(t=(e.getTime()-Date.now())/1e3)>0))return this.scheduleNextPollEventsRequest(t),[2];this.lastPollDate=new Date,r=x.notificationsPaused||x.sdkIsOpen?"true":"false",a=new URLSearchParams(n(n({token:x.token,language:null!==(u=x.language)&&void 0!==u?u:"en",deviceId:x.deviceId,notificationsPaused:r,mode:x.mode},(null===(p=x.player)||void 0===p?void 0:p.id)?{unsignedPlayerId:x.player.id}:{}),x.signedMetadataToken?{signedMetadataToken:x.signedMetadataToken}:{})).toString(),o.label=1;case 1:return o.trys.push([1,4,,5]),[4,fetch("https://".concat(x.domain,"/api/sdk/events?").concat(a),{method:"GET"})];case 2:if(!(s=o.sent()).ok)throw new Error("HTTP error! status: ".concat(s.status));return[4,s.json()];case 3:return c=o.sent(),this.scheduleNextPollEventsRequest(c.nextPollSeconds),void 0!==c.pollWhenNotificationsEnabled&&(this.pollWhenNotificationsEnabled=c.pollWhenNotificationsEnabled),x.notifications=i(i([],x.notifications,!0),c.notifications,!0),x.notifications.length>0&&F(),c.unansweredMessageCount!==x.unansweredMessageCount&&(x.unansweredMessageCount=c.unansweredMessageCount,l("unansweredMessageCountUpdate",[c.unansweredMessageCount])),c.unreadMessageCount!==x.unreadMessageCount&&(x.unreadMessageCount=c.unreadMessageCount,l("unreadMessageCountUpdate",[c.unreadMessageCount]),H({action:"unreadMessageCountUpdate",count:c.unreadMessageCount})),[3,5];case 4:return d=o.sent(),console.error("Error fetching events:",d),this.scheduleNextPollEventsRequest(x.retryIntervalSecs),[3,5];case 5:return[2]}}))}))}}),e}(),W={eventPoller:null},G=function(){var e;null===(e=W.eventPoller)||void 0===e||e.onLogin()},Y=function(){var e;null===(e=W.eventPoller)||void 0===e||e.onLogout()},z=function(){var e;null===(e=W.eventPoller)||void 0===e||e.onOpen()},J=function(){var e;null===(e=W.eventPoller)||void 0===e||e.onClose()},K=function(){var e;null===(e=W.eventPoller)||void 0===e||e.onEnableNotifications()},X=function(){var e;null===(e=W.eventPoller)||void 0===e||e.onIsInForegroundChanged()},V=function(e){var n="/help-center";te({path:n,config:e}),ne({path:n,config:e})},Z=function(e){var n="/assistant";te({path:n,config:e}),ne({path:n,config:e})},Q=function(){!function(){var e=document.querySelector(m.sdkDialog),n=document.querySelector(m.sdkIframeWrapper);if(e){var t=function(){"widget"!==x.mode||x.forceUpdateSdkDialog?e.remove():e.style.display="none",x.forceUpdateSdkDialog=!1};n?(n.style.opacity="0",n.style.transform=se({animation:"start"}),setTimeout((function(){t()}),1e3*E)):t()}x.widgetButton&&ae();l("close",[])}()},$=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];a.apply(void 0,e)};function ee(e){var t,o,r,a,s,l,c=(null!=e?e:{}).config;if(!x.token||!x.domain||!x.deviceId)return null;var d=null!==(t=null==c?void 0:c.tags)&&void 0!==t?t:[],u=null!==(o=null==c?void 0:c.fields)&&void 0!==o?o:{},f=null!==(a=null!==(r=null==c?void 0:c.language)&&void 0!==r?r:x.language)&&void 0!==a?a:null,m=null!==(s=x.signedMetadataToken)&&void 0!==s?s:null,h=null!==(l=x.player)&&void 0!==l?l:null,y={_platform:g,_sdkVersion:p};x.youngPlayer&&(y._youngPlayer=!0),(x.privacyMode||x.youngPlayer)&&(y._privacyMode=!0);var v=i(i([],Array.from(x.tags),!0),d,!0),b=n(n(n({},x.fields),u),y);return{token:x.token,domain:x.domain,deviceId:x.deviceId,tags:v,fields:b,language:f,signedMetadataToken:m,player:h}}function ne(e){var n,t,o,i=ee({config:e.config});if(i){var r=null!==(n=document.querySelector(m.sdkDialog))&&void 0!==n?n:document.createElement("div");r.id=m.sdkDialog.replace("#",""),r.style.display="block",r.style.position="fixed",r.style.border="none",r.style.width="0",r.style.height="0",r.style.margin="0",r.style.padding="0",r.style.zIndex="9998",r.style.overflow="hidden",r.style.backgroundColor="transparent";var a=null!==(t=r.querySelector(m.sdkIframeWrapper))&&void 0!==t?t:document.createElement("div");a.id=m.sdkIframeWrapper.replace("#",""),a.style.position="relative",a.style.width="100%",a.style.height="100%",a.style.top="0",a.style.right="0",a.style.bottom="0",a.style.left="0",a.style.opacity="0",a.style.colorScheme="auto",a.style.border="none",a.style.backgroundColor="rgb(".concat(I(x.colors.background),")"),a.style.transform=se({animation:"start"}),a.style.transition=(x.mode,"opacity ".concat(E,"s ease-in-out, transform ").concat(E,"s ease-in-out")),"widget"===x.mode&&(a.style.overflow="hidden");var s=null!==(o=a.querySelector(m.sdkLoaderIframe))&&void 0!==o?o:document.createElement("iframe");s.id=m.sdkLoaderIframe.replace("#",""),s.style.position="absolute",s.style.border="none",s.style.width="100%",s.style.height="100%",s.style.top="0",s.style.right="0",s.style.bottom="0",s.style.left="0",s.style.colorScheme="auto";var u=a.querySelector(m.sdkIframe),p=null!=u?u:document.createElement("iframe"),f=setInterval((function(){var e;"complete"===(null===(e=p.contentDocument)||void 0===e?void 0:e.readyState)&&(clearInterval(f),y())}),500);p.id=m.sdkIframe.replace("#",""),p.style.position="absolute",p.style.border="none",p.style.top="0",p.style.right="0",p.style.bottom="0",p.style.left="0",p.style.colorScheme="auto",u&&!x.networkErrorTimerId||(p.src=function(e){var n=e.path,t=e.supportViewConfig,o="https://".concat(x.domain,"/sdk"),i=new URLSearchParams;i.set("platform",g),i.set("token",t.token),i.set("deviceId",t.deviceId),i.set("mode",x.mode),i.set("origin",window.location.origin),i.set("userLanguage",x.userLanguage),x.disableInsets&&i.set("disableInsets","true");t.language&&i.set("language",t.language);var r=ie({supportViewConfig:t});return i.set("metadata",JSON.stringify(r)),"".concat(o).concat(n,"?").concat(i.toString())}({path:e.path,supportViewConfig:i}),p.style.width="0",p.style.height="0",r.appendChild(a),a.appendChild(s),a.appendChild(p),document.body.appendChild(r)),L({iframe:s,content:_({template:c})});var h=!1,y=function(){h||(h=!0,x.networkErrorTimerId=setTimeout((function(){L({iframe:s,content:_({template:d})})}),1e4))};p.onload=y,p.onerror=function(){L({iframe:s,content:_({template:d})})},re(),l("open",[]),setTimeout((function(){a.style.opacity="1",a.style.transform=se({animation:"end"})}),100)}}function te(e){var n=e.path,t=e.config,o=null!=t?t:null;x.previousPath===n&&O(x.previousConfig,o)||(x.previousPath=n,x.previousConfig=o,oe())}function oe(){var e=document.querySelector(m.sdkDialog);x.sdkIsOpen?x.forceUpdateSdkDialog=!0:null==e||e.remove()}function ie(e){var n=e.supportViewConfig,t={unsigned:{},signed:void 0};return n.player&&(t.unsigned.player=n.player),n.tags&&(t.unsigned.tags=n.tags),n.fields&&(t.unsigned.fields=n.fields),n.signedMetadataToken&&(t.signed=n.signedMetadataToken),t}function re(){var e=document.querySelector(m.sdkDialog),n=document.querySelector(m.sdkIframeWrapper);if(e&&n)if("widget"===x.mode){var t=B({type:"widget"}),o=M();e.style.width=o.width,e.style.height=o.height,e.style.maxWidth=o.maxWidth,e.style.maxHeight=o.maxHeight,e.style.bottom=t.bottom,e.style.right=t.right,e.style.left=t.left,e.style.top=t.top,D()?(n.style.border="none",n.style.borderRadius="0"):(n.style.border="1px solid rgb(".concat(I(x.colors.border),")"),n.style.borderRadius="10px")}else if(n.style.border="none",n.style.borderRadius="0",x.element){var i=x.element.getBoundingClientRect(),r=i.width,a=i.height,s=i.top,l=i.left,c=i.right,d=i.bottom;e.style.width="".concat(r,"px"),e.style.height="".concat(a,"px"),e.style.maxWidth="none",e.style.maxHeight="none",e.style.top="".concat(s,"px"),e.style.left="".concat(l,"px"),e.style.right="".concat(c,"px"),e.style.bottom="".concat(d,"px")}else{a=x.keyboardHeight>0?"calc(100% - ".concat(x.keyboardHeight,"px + env(safe-area-inset-bottom) - 10px)"):"100%";e.style.width="100%",e.style.height=a,e.style.maxWidth="none",e.style.maxHeight="none",e.style.top="0",e.style.left="0",e.style.right="0",e.style.bottom="0"}}function ae(){var e,n=null!==(e=document.querySelector(m.sdkButtonIframe))&&void 0!==e?e:document.createElement("iframe");if(n){var t,o=B({type:"button"});n.id=m.sdkButtonIframe.replace("#",""),n.style.position="fixed",n.style.border="none",n.style.width="".concat(b,"px"),n.style.height="".concat(w,"px"),n.style.maxWidth="95%",n.style.maxHeight="95%",n.style.bottom=o.bottom,n.style.right=o.right,n.style.left=o.left,n.style.top=o.top,n.style.margin="0",n.style.padding="0",n.style.zIndex="9997",n.style.backgroundColor="transparent",n.style.opacity="0",n.style.transform="scale(0.8)",n.style.transition="opacity ".concat(T,"s ease-in-out, transform ").concat(T,"s ease-in-out"),setTimeout((function(){n.style.opacity="1",n.style.transform="scale(1)"}),100),document.body.appendChild(n),L({iframe:n,content:(t={unreadMessageCount:x.unreadMessageCount},_({template:u}).replaceAll("UNREAD_MESSAGE_COUNT_PLACEHOLDER","".concat(t.unreadMessageCount)).replaceAll("CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER",I(x.colors.widgetButtonBackground)).replaceAll("CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER",I(x.colors.widgetButtonText)).replaceAll("CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER",I(x.colors.widgetButtonActionPending)).replaceAll("WIDGET_BUTTON_TEXT_PLACEHOLDER",ge()))})}}function se(e){return"start"===e.animation?"game"===x.mode?"translateY(20%)":"scale(0.8)":"game"===x.mode?"translateY(0)":"scale(1)"}function le(e){return t(this,void 0,void 0,(function(){return o(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,7]),[4,e.json()];case 1:return[2,n.sent()];case 2:n.sent(),n.label=3;case 3:return n.trys.push([3,5,,6]),[4,e.text()];case 4:return[2,n.sent()];case 5:return n.sent(),[2,void 0];case 6:return[3,7];case 7:return[2]}}))}))}function ce(){return t(this,void 0,void 0,(function(){var e,n,t,i,r,a;return o(this,(function(o){switch(o.label){case 0:if(pe(),x.retryRecordRetentionTimerId&&(clearTimeout(x.retryRecordRetentionTimerId),x.retryRecordRetentionTimerId=null),x.retentionRemainingSeconds=null,x.isRetentionRecordedForSession=!0,!(e=ee()))return[2];n="https://".concat(x.domain,"/api/sdk/retention"),t=ie({supportViewConfig:e}),i={token:x.token,deviceId:x.deviceId,language:x.language,metadata:t},o.label=1;case 1:return o.trys.push([1,5,,6]),[4,fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})];case 2:return(r=o.sent()).ok?[3,4]:[4,le(r)];case 3:throw o.sent();case 4:return[3,6];case 5:return a=o.sent(),console.error("Error tracking retention:",a),x.retryRecordRetentionTimerId=setTimeout(ce,6e4),[3,6];case 6:return[2]}}))}))}function de(){var e=new Date;if(x.sessionStatus="active",x.sessionResumeOrStartTime=e,x.sessionStartTime){var n=x.sessionStartTime.valueOf()/1e3+x.resetSessionAfterSecs;Date.now()/1e3>n&&ue()}else ue();null!==x.retentionRemainingSeconds&&(x.recordRetentionTimerId=setTimeout(ce,1e3*x.retentionRemainingSeconds))}function ue(){x.sessionStartTime=new Date,x.retentionRemainingSeconds=x.recordRetentionAfterSecs,x.isRetentionRecordedForSession=!1,pe()}function pe(){x.recordRetentionTimerId&&(clearTimeout(x.recordRetentionTimerId),x.recordRetentionTimerId=null)}function fe(){x.isRetentionRecordedForSession&&ce()}function ge(){var e,n,t;return null!==(t=null===(e=x.locs.widgetButtonText)||void 0===e?void 0:e[null!==(n=x.language)&&void 0!==n?n:"en"])&&void 0!==t?t:"Support"}function me(){var e=x.isInForeground,n="visible"===document.visibilityState&&document.hasFocus();x.isInForeground=n,e!==n&&X(),n&&"paused"===x.sessionStatus?de():n||"active"!==x.sessionStatus||function(){if(x.sessionResumeOrStartTime&&x.retentionRemainingSeconds){var e=Math.floor((Date.now()-x.sessionResumeOrStartTime.valueOf())/1e3);x.retentionRemainingSeconds-=e}x.sessionStatus="paused",pe()}()}function he(){var e,n=x.isLoggedIn,t=Boolean(x.signedMetadataToken||(null===(e=x.player)||void 0===e?void 0:e.id));x.isLoggedIn=t,t&&!n?G():!t&&n&&Y()}document.addEventListener("visibilitychange",me),window.addEventListener("focus",me),window.addEventListener("blur",me),window.addEventListener("resize",re),window.addEventListener("resize",j),window.addEventListener("message",(function(e){if("theymes.ready"===e.data.action){var n=document.querySelector(m.sdkLoaderIframe),t=document.querySelector(m.sdkIframe);x.networkErrorTimerId&&(clearTimeout(x.networkErrorTimerId),x.networkErrorTimerId=null),t&&(t.style.width="100%",t.style.height="100%"),n&&n.remove()}else if("theymes.close"===e.data.action)Q();else if("theymes.closeNotification"===e.data.action)U({notification:x.visibleNotification});else if("theymes.handleNotificationAction"===e.data.action)r={notification:x.visibleNotification},(null==(a=r.notification)?void 0:a.action)&&"OPEN_PAGE"===a.action.type&&(ne({path:a.action.path}),U({notification:a}));else if("theymes.sdkButtonClicked"===e.data.action)(i=document.querySelector(m.sdkButtonIframe))&&(i.style.opacity="0",i.style.transform="scale(0.8)",setTimeout((function(){i.remove()}),1e3*T)),"support"===x.widgetButtonAction?V():"assistant"===x.widgetButtonAction&&Z();else if("theymes.openExternalPage"===e.data.action){var o=e.data.url.startsWith(window.location.origin);o&&function(e){var n=e.key,t=e.value,o=e.ttlMs,i=e.storage,r=void 0===i?sessionStorage:i,a={value:t,expiry:Date.now()+o};r.setItem(n,JSON.stringify(a))}({key:S,value:e.data.path,ttlMs:1e4}),window.open(e.data.url,o?"_self":"_blank")}var i,r,a}),!1),$("open",(function(){x.sdkIsOpen=!0,z()})),$("close",(function(){x.sdkIsOpen=!1,J()})),e.addEventListener=$,e.addField=function(e,n){x.fields[e]=n,oe()},e.addFields=function(e){x.fields=n(n({},x.fields),e),oe()},e.addTag=function(e){x.tags.add(e),oe()},e.addTags=function(e){e.forEach((function(e){return x.tags.add(e)})),oe()},e.close=Q,e.disableLogging=function(){x.loggingEnabled=!1},e.disableNotifications=function(){x.notificationsPaused=!0},e.enableLogging=function(){x.loggingEnabled=!0},e.enableNotifications=function(){x.notificationsPaused=!1,K()},e.getFields=function(){return x.fields},e.getLanguage=function(){return x.language},e.getPlayer=function(){return x.player},e.getSdkVersion=function(){return p},e.getSignedMetadataToken=function(){return x.signedMetadataToken},e.getTags=function(){return Array.from(x.tags)},e.getUnansweredMessageCount=function(){return x.unansweredMessageCount},e.getUnreadMessageCount=function(){return x.unreadMessageCount},e.initialize=function(e,i,r){return t(void 0,void 0,void 0,(function(){var t,a,s,l,c,d,u,p,m,h,y,v,b,w;return o(this,(function(o){switch(o.label){case 0:if(!e||!i||!r.mode)throw new Error("Token, domain, and mode are required");x.token=e,x.domain=i,x.mode=r.mode,x.element="element"in r&&void 0!==r.element?r.element:x.element,x.language=null!==(u=r.language)&&void 0!==u?u:x.language,x.nonce=null!==(p=r.nonce)&&void 0!==p?p:x.nonce,x.deviceId=function(){var e=localStorage.getItem("deviceId");if(e)return e;var n=crypto.randomUUID();return localStorage.setItem("deviceId",n),n}(),x.widgetButton="button"in r&&void 0!==r.button&&null!==(m=r.button)&&void 0!==m?m:x.widgetButton,x.widgetButtonAction="buttonAction"in r&&void 0!==r.buttonAction&&null!==(h=r.buttonAction)&&void 0!==h?h:x.widgetButtonAction,x.position="position"in r&&void 0!==r.position&&null!==(y=r.position)&&void 0!==y?y:x.position,x.x="x"in r&&void 0!==r.x?r.x:x.x,x.y="y"in r&&void 0!==r.y?r.y:x.y,x.disableInsets="game"===x.mode&&null!==x.element,W.eventPoller||(W.eventPoller=new q),t="https://".concat(i,"/api/sdk/settings"),a=new URLSearchParams({token:x.token,platform:g,mode:x.mode}).toString(),o.label=1;case 1:return o.trys.push([1,6,,7]),[4,fetch("".concat(t,"?").concat(a),{method:"GET"})];case 2:return(s=o.sent()).ok?[3,4]:[4,le(s)];case 3:throw o.sent();case 4:return[4,s.json()];case 5:return l=o.sent(),(null===(v=null==l?void 0:l.branding)||void 0===v?void 0:v.colors)&&(E=l.branding.colors,x.colors=n(n({},x.colors),E),localStorage.setItem(f,JSON.stringify(x.colors))),(null===(b=null==l?void 0:l.branding)||void 0===b?void 0:b.locs)&&(x.locs=l.branding.locs),(null===(w=null==l?void 0:l.branding)||void 0===w?void 0:w.fonts)&&(x.fonts=l.branding.fonts),"number"==typeof(null==l?void 0:l.recordRetentionAfterSecs)&&(x.recordRetentionAfterSecs=l.recordRetentionAfterSecs),"number"==typeof(null==l?void 0:l.resetSessionAfterSecs)&&(x.resetSessionAfterSecs=l.resetSessionAfterSecs),de(),oe(),c=function(e){var n=e.key,t=e.storage,o=void 0===t?sessionStorage:t,i=e.removeItem,r=void 0!==i&&i,a=o.getItem(n);if(!a)return null;var s=JSON.parse(a);return Date.now()>s.expiry?(sessionStorage.removeItem(n),null):(r&&o.removeItem(n),s.value)}({key:S,removeItem:!0}),c?ne({path:c}):x.widgetButton&&ae(),[3,7];case 6:return d=o.sent(),console.error("Error initializing SDK:",d),[3,7];case 7:return[2]}var E}))}))},e.iosSetKeyboardHeight=function(e){x.keyboardHeight=e,re()},e.isPrivacyMode=function(){return x.privacyMode},e.isSupported=function(){return!0},e.isYoungPlayer=function(){return x.youngPlayer},e.openAssistant=Z,e.openResource=function(e,n){var t="/resources/".concat(e);te({path:t,config:n}),ne({path:t,config:n})},e.openSupport=V,e.recordRetention=function(){x.isRetentionRecordedForSession||ce()},e.removeAllFields=function(){x.fields={},oe()},e.removeAllTags=function(){x.tags.clear(),oe()},e.removeEventListener=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];s.apply(void 0,e)},e.removeField=function(e){delete x.fields[e],oe()},e.removeFields=function(e){e.forEach((function(e){return delete x.fields[e]})),oe()},e.removeTag=function(e){x.tags.delete(e),oe()},e.removeTags=function(e){e.forEach((function(e){return x.tags.delete(e)})),oe()},e.requestNotificationPermission=function(){},e.reset=function(){x.language=null,x.tags=new Set,x.fields={},x.signedMetadataToken=null,x.player=null,he(),oe(),H({action:"widgetButtonTextUpdate",text:ge()})},e.setFields=function(e){x.fields=e,oe()},e.setLanguage=function(e){var n=x.language!==e;x.language=e,n&&(oe(),H({action:"widgetButtonTextUpdate",text:ge()}))},e.setPlayer=function(e){var n,t=(null===(n=x.player)||void 0===n?void 0:n.id)!==(null==e?void 0:e.id);x.player=e,he(),t&&(oe(),fe())},e.setPrivacyMode=function(e){x.privacyMode=e,oe()},e.setSignedMetadataToken=function(e){var n=x.signedMetadataToken!==e;x.signedMetadataToken=e,he(),n&&(oe(),fe())},e.setTags=function(e){x.tags=new Set(e),oe()},e.setYoungPlayer=function(e){x.youngPlayer=e,oe()}}(this.theymes=this.theymes||{});
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { CloseEventListener, OpenEventListener, UnansweredMessageCountEventListener, UnreadMessageCountEventListener } from './sdkEventEmitter.js';
|
|
2
|
+
export type ThemeColor = {
|
|
3
|
+
r: number;
|
|
4
|
+
g: number;
|
|
5
|
+
b: number;
|
|
6
|
+
};
|
|
7
|
+
export type Colors = {
|
|
8
|
+
text: ThemeColor;
|
|
9
|
+
border: ThemeColor;
|
|
10
|
+
background: ThemeColor;
|
|
11
|
+
tile: ThemeColor;
|
|
12
|
+
accent: ThemeColor;
|
|
13
|
+
notificationBackground: ThemeColor;
|
|
14
|
+
notificationText: ThemeColor;
|
|
15
|
+
widgetButtonBackground: ThemeColor;
|
|
16
|
+
widgetButtonText: ThemeColor;
|
|
17
|
+
widgetButtonActionPending: ThemeColor;
|
|
18
|
+
};
|
|
19
|
+
export type Locs = {
|
|
20
|
+
widgetButtonText: Record<string, string> | null | undefined;
|
|
21
|
+
};
|
|
22
|
+
export type Font = {
|
|
23
|
+
regular: string;
|
|
24
|
+
fallback: string;
|
|
25
|
+
};
|
|
26
|
+
export type Fonts = {
|
|
27
|
+
body?: Font;
|
|
28
|
+
};
|
|
29
|
+
export type Player = {
|
|
30
|
+
id?: string;
|
|
31
|
+
name?: string;
|
|
32
|
+
email?: string;
|
|
33
|
+
tier?: 1 | 2 | 3;
|
|
34
|
+
};
|
|
35
|
+
export type Config = {
|
|
36
|
+
tags?: readonly string[];
|
|
37
|
+
fields?: Record<string, unknown>;
|
|
38
|
+
language?: string;
|
|
39
|
+
};
|
|
40
|
+
export type SupportViewConfiguration = {
|
|
41
|
+
token: string;
|
|
42
|
+
domain: string;
|
|
43
|
+
deviceId: string;
|
|
44
|
+
tags: readonly string[];
|
|
45
|
+
fields: Record<string, unknown>;
|
|
46
|
+
language: string | null;
|
|
47
|
+
signedMetadataToken: string | null;
|
|
48
|
+
player: Player | null;
|
|
49
|
+
};
|
|
50
|
+
export type SupportMetadataContainer = {
|
|
51
|
+
unsigned: {
|
|
52
|
+
player?: Player;
|
|
53
|
+
tags?: readonly string[];
|
|
54
|
+
fields?: Record<string, unknown>;
|
|
55
|
+
};
|
|
56
|
+
signed: string | undefined;
|
|
57
|
+
};
|
|
58
|
+
export type Notification = {
|
|
59
|
+
text: string;
|
|
60
|
+
action?: {
|
|
61
|
+
type: 'OPEN_PAGE';
|
|
62
|
+
path: string;
|
|
63
|
+
};
|
|
64
|
+
closeAfterSeconds: number;
|
|
65
|
+
};
|
|
66
|
+
export type SessionStatus = 'waiting' | 'active' | 'paused';
|
|
67
|
+
export type Mode = 'game' | 'widget';
|
|
68
|
+
export type Position = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
69
|
+
export type WidgetButtonAction = 'support' | 'assistant';
|
|
70
|
+
export type IosSetKeyboardHeight = (keyboardHeight: number) => void;
|
|
71
|
+
export interface AddEventListener {
|
|
72
|
+
(type: 'unreadMessageCountUpdate', listener: UnreadMessageCountEventListener): void;
|
|
73
|
+
(type: 'unansweredMessageCountUpdate', listener: UnansweredMessageCountEventListener): void;
|
|
74
|
+
(type: 'open', listener: OpenEventListener): void;
|
|
75
|
+
(type: 'close', listener: CloseEventListener): void;
|
|
76
|
+
}
|
|
77
|
+
export interface RemoveEventListener {
|
|
78
|
+
(type: 'unreadMessageCountUpdate', listener: UnreadMessageCountEventListener): void;
|
|
79
|
+
(type: 'unansweredMessageCountUpdate', listener: UnansweredMessageCountEventListener): void;
|
|
80
|
+
(type: 'open', listener: OpenEventListener): void;
|
|
81
|
+
(type: 'close', listener: CloseEventListener): void;
|
|
82
|
+
}
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ThemeColor } from './types.js';
|
|
1
2
|
export declare const isDeepEqual: <T>(a: T, b: T) => boolean;
|
|
2
3
|
export declare const setItemWithTtl: (args: {
|
|
3
4
|
key: string;
|
|
@@ -10,3 +11,11 @@ export declare const getItemWithTtl: (args: {
|
|
|
10
11
|
storage?: Storage;
|
|
11
12
|
removeItem?: boolean;
|
|
12
13
|
}) => string | null;
|
|
14
|
+
export declare function writeIframeContent(args: {
|
|
15
|
+
iframe: HTMLIFrameElement;
|
|
16
|
+
content: string;
|
|
17
|
+
}): void;
|
|
18
|
+
export declare function renderColor(color: ThemeColor): string;
|
|
19
|
+
export declare function renderTemplate(args: {
|
|
20
|
+
template: string;
|
|
21
|
+
}): string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare function isWidgetInMobileSize(): boolean;
|
|
2
|
+
export declare function getWidgetPosition(args: {
|
|
3
|
+
type: 'widget' | 'button';
|
|
4
|
+
}): {
|
|
5
|
+
top: string;
|
|
6
|
+
left: string;
|
|
7
|
+
right: string;
|
|
8
|
+
bottom: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function getWidgetSize(): {
|
|
11
|
+
width: string;
|
|
12
|
+
height: string;
|
|
13
|
+
maxWidth: string;
|
|
14
|
+
maxHeight: string;
|
|
15
|
+
};
|
|
16
|
+
export declare function notifyWidgetButtonIframe(payload: {
|
|
17
|
+
action: 'unreadMessageCountUpdate';
|
|
18
|
+
count: number;
|
|
19
|
+
} | {
|
|
20
|
+
action: 'widgetButtonTextUpdate';
|
|
21
|
+
text: string;
|
|
22
|
+
}): void;
|