From 6ed6505badbf5bc1b3400bc7f53cd59fb045b5f8 Mon Sep 17 00:00:00 2001 From: Dvir Malka Date: Mon, 22 Aug 2022 15:00:35 +0300 Subject: [PATCH] [semver:patch] Fix check academyColors --- dist/development/strigo.sdk.js | 4 +++- dist/production/strigo.sdk.min.js | 2 +- src/strigo/index.ts | 5 ++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/dist/development/strigo.sdk.js b/dist/development/strigo.sdk.js index 7e825ba..c1852ce 100644 --- a/dist/development/strigo.sdk.js +++ b/dist/development/strigo.sdk.js @@ -13291,7 +13291,9 @@ ${JSON.stringify(parsedContext)}` : ""); LoggerInstance.debug("Configuration fetched from Strigo"); LoggerInstance.setup(loggingConfig); setupAssessmentStorage(userAssessments); - customizeHatColors(configuration?.academyColors); + if (configuration.academyColors) { + customizeHatColors(configuration?.academyColors); + } } setupLocalStorageConfig({ user: { diff --git a/dist/production/strigo.sdk.min.js b/dist/production/strigo.sdk.min.js index b971fd1..91f0143 100644 --- a/dist/production/strigo.sdk.min.js +++ b/dist/production/strigo.sdk.min.js @@ -58,7 +58,7 @@ ${JSON.stringify(F)}`:"")}getDefaultContext(){let p=Fe();if(!p)return{};let{user
assessmentId: ${y?._id}
Expected text: ${y?.recordedAssessment?.expectedText}
Selector used: ${p}
- `,console.log("*** Appending assessment debug context element.");let Y=window.document.querySelectorAll(`[data-${og}="${p}"]`)?.[0];Y?Y.appendChild(H):cg(h,p).appendChild(H)},eu=function(){console.log("*** Evaluating Assessments...",{bodyTextDuringAssessment:window.document.body.innerText.slice(0,50)}),ru.forEach(h=>{let{recordedAssessment:p,challengeSuccessEvent:y,_id:b}=h,{actionType:H,expectedText:F}=p,Y=p?.locationElement?.profile;if(!Y){console.log("*** missing location element profile. Aborting...");return}if(Oo?.[b]?.status==="SUCCESS"){console.log('*** Assessment already in "success" status. Aborting...');return}Ja(b,{status:"pending"});let{locationElement:X,locationElementSelector:iA}=ag(b,Y);if(!X){console.log("*** Failed to find location element. Aborting assessment evaluation...");return}switch(Fe()?.isAcademyAssessmentDebug&&lg(X,iA,h),H){case"added-item":{let AA=sg.bind({assessment:h,locationElement:X,window});if(Ut[b]?.observer&&X===Ut[b].element){Ut[b].element=X;try{AA([]),Ut[b].observer.observe(X,Xa),$.info("Same reference - no need to observe again"),console.log(" *** Same reference - no need to observe again",X)}catch(EA){console.log("*** Got an error in item count",EA);break}break}if(Ut[b]?.observer){try{AA([]),Ut[b].observer.observe(X,Xa),$.info("DOM Reference have changed - observing again"),console.log(" *** DOM Reference have changed - observing again",X)}catch(EA){console.log("*** Got an error in item count",EA);break}break}Ut[b]={element:X,observer:new MutationObserver(AA)};try{AA([]),Ut[b].observer.observe(X,Xa)}catch(EA){console.log("*** Got an error in item count",EA);break}break}case"text-change":{if(console.log("*** Assessing text changes in location element...",{locationElement:X,locationElementType:X instanceof HTMLInputElement?"input":"non-input",innerTextValue:X instanceof HTMLInputElement?X?.value:X?.innerText,expectedText:F}),X instanceof HTMLInputElement&&X?.value?.includes(F)){Wa(h,{locationElement:X});break}if(X?.innerText?.includes(F)){Wa(h,{locationElement:X});break}break}default:break}})},ug=function(h){let p=h.some(b=>b.addedNodes?.length>0),y=h.some(b=>b.type=="characterData");if(console.log("#####",{isAddedNodes:p,isCharacterDataChanged:y}),!p&&!y){console.log("*** No added nodes and no character data change were detected after url change.",{previousLocation:To||"",newLocation:document.location.href});return}To===document.location.href?console.log("*** No URL change and no nodes were added."):(console.log("*** Detected URL change!",{previousLocation:To||"",newLocation:document.location.href}),To=document.location.href),Ya(window)},Ya=(0,tu.default)(h=>{if(console.log("*** Initializing document observer"),ru=Ra().assessments.filter(({assessmentType:p})=>p==="recorded-flow"),!window?.strigoObserver?.observer){console.log("*** Adding Strigo observer to document body"),window.strigoObserver={observer:new MutationObserver(ug),observedBodyElement:window.document.body},eu(),console.log("*** Starting to observe document body"),window?.strigoObserver?.observer?.observe(window.document,Au);return}eu(),window.document.contains(window.strigoObserver.observedBodyElement)||(console.log('*** Detected a "body" element change. Re-initializing the document observer...'),window.strigoObserver.observedBodyElement=window.document.body,window.strigoObserver.observer.observe(window.document,Au))},500);var ou=342;function iu(){console.log("Posting dockable state to Strigo...");let h=gr("dockingSide");document.getElementById("strigo-exercises").contentWindow.postMessage({dockable:!0,dockingSide:h},"*")}function Bg(){let[h]=Yi();(0,ja.default)("#strigo-widget").resizable({edges:{left:"#strigo-collapse-div",right:"#strigo-collapse-div.align-left",bottom:!1,top:!1},listeners:{move(p){let y=p.target;y.style.width=`${p.rect.widthh?h:p.rect.width}px`},start(){let p=document.getElementById("strigo-exercises");p.style.pointerEvents="none"},end(){let p=document.getElementById("strigo-exercises");p.style.pointerEvents="auto"}},modifiers:[ja.default.modifiers.restrictEdges({outer:"parent"})]})}var au=class{init(){return $.info("overlay init called"),"OVERLAY"}setup({version:p}){$.info("overlay setup called"),pr({parentElement:dr(),url:Tl(p)}),pr({parentElement:dr(),url:Zi(p)});let y=ml(zi(Fe())),b=Io();this.initEventListeners(b,y),console.log("adding observer"),Ya(b),Ql(b),console.log("observer added"),Bg()}shutdown(){$.info("overlay shutdown called");let p=Io();this.removeEventListeners(p),p?.strigoObserver?.observer?.disconnect(),wl(p)}collapse(){$.info("overlay collapse called"),Ta()}open(){ji(),iu()}move(){hl()}initEventListeners(p,y){es(y,iu),As(p)}removeEventListeners(p){cu()}},Do=new au;function uu(h){if(!(!h||!h.data))switch(h.data){case"move":{$.info("Panel move message received"),bo()==="overlay"&&Do.move();break}case"close":{$.info("Shutdown message received - will collapse panel"),window.Strigo?.collapse();break}case"destroy":{$.info("Destroy message received"),window.Strigo?.destroy();break}case"challenge-success":{$.info("Challenge event success received"),bo()==="overlay"&&Do.open();break}default:break}}function As(h){h.addEventListener("message",uu,!1)}function cu(){window.removeEventListener("message",uu)}function es(h,p){h.addEventListener("load",async()=>{cl("isLoading")&&(p&&await p(),Ji("isLoading",!1))})}function fu(h){let p=gr("initSite")?.host;h.addEventListener("load",function(){try{this.contentWindow.location.host!==p&&window.Strigo.shutdown()}catch(y){$.error(y),window.Strigo.shutdown()}})}function Bu(){return Na(["#strigo-exercises","#original-site"],{sizes:[25,75],maxSize:Yi(),minSize:dl(),gutterSize:2})}async function dg(){await Jl(),document.getElementById("strigo-exercises").contentWindow.postMessage({dockable:!1},"*")}var gu=class{init(){let p;return Sl()?($.info("Child SDK window"),p="CHILD",window.dispatchEvent(new Event("strigo-opened")),Hl()):($.info("Parent SDK window"),p="PARENT"),p}setup({version:p}){$.info("iframe setup started"),ul(),pr({parentElement:dr(),url:Ll(p)}),pr({parentElement:dr(),url:Zi(p)}),Wl();let y=Fe(),b=fl(),H=So({parentElement:b,url:zi(y),classNames:jc,id:"strigo-exercises"}),F=So({parentElement:b,url:Il(y.initSite.href),classNames:zc,id:"original-site"}),Y=document.createElement("div");Y.className="strigo-academy-hat align-left",Y.id="strigo-academy-hat",Y.onclick=()=>{document.getElementById("strigo-academy-hat").classList.toggle("slide-in"),this.splitInstance=Bu()};let X=document.createElement("div");X.className="strigo-academy-hat-icon",X.id="strigo-academy-hat-icon",X.innerHTML=Xi,Y.appendChild(X),b.appendChild(Y),this.splitInstance=Bu();let iA=Io();this.initEventListeners(iA,H,F)}collapse(){this.splitInstance&&(this.splitInstance.destroy(),this.splitInstance=Na(["#strigo-exercises","#original-site"],{sizes:[25,75],minSize:0,gutterSize:0}),this.splitInstance.collapse(0),document.getElementById("strigo-academy-hat").classList.toggle("slide-in"))}open(){}shutdown(){$.info("iframe shutdown called"),Bl()}initEventListeners(p,y,b){es(y,dg),fu(b),As(b.contentWindow)}},du=new gu;function pu(h){return h&&h==="dynamic"?pl()?"iframe":"overlay":h}function Ko(h){let p=null;switch(h){case"iframe":{p=du;break}case"overlay":{p=Do;break}default:throw $.error("Widget flavor is not supported",{widgetFlavor:h}),new Error(`Widget flavor ${h} is not supported`)}return p}var hu=class{constructor(){this.config={}}isDevelopment(){return!1}init(){try{if($.info("Initializing SDK..."),this.config.initialized){$.info("SDK was already initialized");return}Nl();let{webApiKey:p,subDomain:y,selectedWidgetFlavor:b}=xl();if(!p||!y||!b)throw new Error("Init data is missing");let H=pu(b);el({webApiKey:p,subDomain:y,selectedWidgetFlavor:H});let F=Ko(H);this.config.sdkType=F.init(),this.config.initialized=!0,$.info("Initialized SDK."),this.config.sdkType!=="CHILD"&&Rn()&&this.setup()}catch(p){$.error("Could not initialize SDK",{err:p})}}async setup(p){try{$.info("Starting to setup SDK...");let y=document.getElementById("strigo-widget");if(this.config.isOpen&&y||this.config.sdkType==="CHILD"){$.info('panel is already opened. Aborting "setup" action...');return}if(!this.config.initialized)throw new Error("SDK was not initialized");let H=Fe(),{email:F,token:Y,version:X,openWidget:iA=!0,dockingSide:HA="right"}={...H.user,...H,...p};if(!F||!Y)throw new Error("Setup data is missing");let AA=await ol(Y);if(!AA?.allowedAcademyDomains?.includes(window.location.host.replace(/^www\./i,""))){console.log("Running on an unrelated domain. Aborting...",{allowedDomains:AA?.allowedAcademyDomains,currentHost:window.location.host});return}if(AA){let{loggingConfig:EA,userAssessments:_A}=AA;$.debug("Configuration fetched from Strigo"),$.setup(EA),Gl(_A),Cl(AA?.academyColors)}tl({user:{email:F,token:Y},initSite:bl(),version:X,loggingConfig:AA?.loggingConfig,isAcademyAssessmentDebug:AA?.isAcademyAssessmentDebug,dockingSide:HA}),this.config.configured=!0,$.info("Finished SDK setup."),iA&&this.open()}catch(y){$.error("Could not setup SDK",{err:y})}}open(){try{if($.info("Opening academy panel..."),!this.config.configured)throw new Error("SDK was not set up");let p=document.getElementById("strigo-widget");if(this.config.isOpen&&p||this.config.sdkType==="CHILD"){$.info('Panel is already opened. Aborting "open" action...');return}let b=Fe();al({currentUrl:b.initSite.href,shouldPanelBeOpen:Rn(),isLoading:!0,widgetFlavor:b.selectedWidgetFlavor}),Ko(b.selectedWidgetFlavor).setup({version:b.version}),this.config.isOpen=!0,$.info("Opened academy panel.")}catch(p){$.error("Could not open academy panel",{err:p})}}collapse(){$.info("Collapsing academy panel");let{selectedWidgetFlavor:p}=Fe();Ko(p).collapse()}shutdown(){try{if($.info("Closing academy panel..."),this.config.sdkType==="CHILD"){window.parent.postMessage(JSON.stringify({messageType:"close"}),"*"),$.info("Notified parent frame to close academy panel.");return}if(!this.config.isOpen){$.info("Tried to close unopened academy panel");return}let p=Ko(bo());ll(),p.collapse(),p.shutdown(),this.config.isOpen=!1,$.info("Closed academy panel.")}catch(p){$.error("Could not close academy panel",{err:p})}}destroy(){try{if($.info("Destroying SDK..."),this.config.sdkType==="CHILD"){window.parent.postMessage(JSON.stringify({messageType:"destroy"}),"*"),$.info("Notified parent frame to destroy SDK.");return}nl(),kl(),this.shutdown(),this.config={},$.info("Destroyed SDK.")}catch(p){$.error("Could not destroy SDK",{err:p})}}async sendEvent(p){let y=gr("user"),{token:b}=y;await il(b,p),$.debug("sendEvent called",{eventName:p})}startElementSelector(p,y,b){$.debug("startElementSelector called");let H=b?window.document.querySelector(b):window.document.body,{startElementSelector:F,stopElementSelection:Y}=Fl(window.document,{onElementProfileCreated:p,onElementSelectionCancel:y,zIndex:2147483645,rootElement:H});this.stopElementSelector=Y,F()}stopElementSelector(){}assessmentRecorder(){Pl()}},wu=new hu;window.Strigo=wu;_l()?(console.log("Strigo recorder mode"),window.Strigo.assessmentRecorder()):window.Strigo.init();})(); + `,console.log("*** Appending assessment debug context element.");let Y=window.document.querySelectorAll(`[data-${og}="${p}"]`)?.[0];Y?Y.appendChild(H):cg(h,p).appendChild(H)},eu=function(){console.log("*** Evaluating Assessments...",{bodyTextDuringAssessment:window.document.body.innerText.slice(0,50)}),ru.forEach(h=>{let{recordedAssessment:p,challengeSuccessEvent:y,_id:b}=h,{actionType:H,expectedText:F}=p,Y=p?.locationElement?.profile;if(!Y){console.log("*** missing location element profile. Aborting...");return}if(Oo?.[b]?.status==="SUCCESS"){console.log('*** Assessment already in "success" status. Aborting...');return}Ja(b,{status:"pending"});let{locationElement:X,locationElementSelector:iA}=ag(b,Y);if(!X){console.log("*** Failed to find location element. Aborting assessment evaluation...");return}switch(Fe()?.isAcademyAssessmentDebug&&lg(X,iA,h),H){case"added-item":{let AA=sg.bind({assessment:h,locationElement:X,window});if(Ut[b]?.observer&&X===Ut[b].element){Ut[b].element=X;try{AA([]),Ut[b].observer.observe(X,Xa),$.info("Same reference - no need to observe again"),console.log(" *** Same reference - no need to observe again",X)}catch(EA){console.log("*** Got an error in item count",EA);break}break}if(Ut[b]?.observer){try{AA([]),Ut[b].observer.observe(X,Xa),$.info("DOM Reference have changed - observing again"),console.log(" *** DOM Reference have changed - observing again",X)}catch(EA){console.log("*** Got an error in item count",EA);break}break}Ut[b]={element:X,observer:new MutationObserver(AA)};try{AA([]),Ut[b].observer.observe(X,Xa)}catch(EA){console.log("*** Got an error in item count",EA);break}break}case"text-change":{if(console.log("*** Assessing text changes in location element...",{locationElement:X,locationElementType:X instanceof HTMLInputElement?"input":"non-input",innerTextValue:X instanceof HTMLInputElement?X?.value:X?.innerText,expectedText:F}),X instanceof HTMLInputElement&&X?.value?.includes(F)){Wa(h,{locationElement:X});break}if(X?.innerText?.includes(F)){Wa(h,{locationElement:X});break}break}default:break}})},ug=function(h){let p=h.some(b=>b.addedNodes?.length>0),y=h.some(b=>b.type=="characterData");if(console.log("#####",{isAddedNodes:p,isCharacterDataChanged:y}),!p&&!y){console.log("*** No added nodes and no character data change were detected after url change.",{previousLocation:To||"",newLocation:document.location.href});return}To===document.location.href?console.log("*** No URL change and no nodes were added."):(console.log("*** Detected URL change!",{previousLocation:To||"",newLocation:document.location.href}),To=document.location.href),Ya(window)},Ya=(0,tu.default)(h=>{if(console.log("*** Initializing document observer"),ru=Ra().assessments.filter(({assessmentType:p})=>p==="recorded-flow"),!window?.strigoObserver?.observer){console.log("*** Adding Strigo observer to document body"),window.strigoObserver={observer:new MutationObserver(ug),observedBodyElement:window.document.body},eu(),console.log("*** Starting to observe document body"),window?.strigoObserver?.observer?.observe(window.document,Au);return}eu(),window.document.contains(window.strigoObserver.observedBodyElement)||(console.log('*** Detected a "body" element change. Re-initializing the document observer...'),window.strigoObserver.observedBodyElement=window.document.body,window.strigoObserver.observer.observe(window.document,Au))},500);var ou=342;function iu(){console.log("Posting dockable state to Strigo...");let h=gr("dockingSide");document.getElementById("strigo-exercises").contentWindow.postMessage({dockable:!0,dockingSide:h},"*")}function Bg(){let[h]=Yi();(0,ja.default)("#strigo-widget").resizable({edges:{left:"#strigo-collapse-div",right:"#strigo-collapse-div.align-left",bottom:!1,top:!1},listeners:{move(p){let y=p.target;y.style.width=`${p.rect.widthh?h:p.rect.width}px`},start(){let p=document.getElementById("strigo-exercises");p.style.pointerEvents="none"},end(){let p=document.getElementById("strigo-exercises");p.style.pointerEvents="auto"}},modifiers:[ja.default.modifiers.restrictEdges({outer:"parent"})]})}var au=class{init(){return $.info("overlay init called"),"OVERLAY"}setup({version:p}){$.info("overlay setup called"),pr({parentElement:dr(),url:Tl(p)}),pr({parentElement:dr(),url:Zi(p)});let y=ml(zi(Fe())),b=Io();this.initEventListeners(b,y),console.log("adding observer"),Ya(b),Ql(b),console.log("observer added"),Bg()}shutdown(){$.info("overlay shutdown called");let p=Io();this.removeEventListeners(p),p?.strigoObserver?.observer?.disconnect(),wl(p)}collapse(){$.info("overlay collapse called"),Ta()}open(){ji(),iu()}move(){hl()}initEventListeners(p,y){es(y,iu),As(p)}removeEventListeners(p){cu()}},Do=new au;function uu(h){if(!(!h||!h.data))switch(h.data){case"move":{$.info("Panel move message received"),bo()==="overlay"&&Do.move();break}case"close":{$.info("Shutdown message received - will collapse panel"),window.Strigo?.collapse();break}case"destroy":{$.info("Destroy message received"),window.Strigo?.destroy();break}case"challenge-success":{$.info("Challenge event success received"),bo()==="overlay"&&Do.open();break}default:break}}function As(h){h.addEventListener("message",uu,!1)}function cu(){window.removeEventListener("message",uu)}function es(h,p){h.addEventListener("load",async()=>{cl("isLoading")&&(p&&await p(),Ji("isLoading",!1))})}function fu(h){let p=gr("initSite")?.host;h.addEventListener("load",function(){try{this.contentWindow.location.host!==p&&window.Strigo.shutdown()}catch(y){$.error(y),window.Strigo.shutdown()}})}function Bu(){return Na(["#strigo-exercises","#original-site"],{sizes:[25,75],maxSize:Yi(),minSize:dl(),gutterSize:2})}async function dg(){await Jl(),document.getElementById("strigo-exercises").contentWindow.postMessage({dockable:!1},"*")}var gu=class{init(){let p;return Sl()?($.info("Child SDK window"),p="CHILD",window.dispatchEvent(new Event("strigo-opened")),Hl()):($.info("Parent SDK window"),p="PARENT"),p}setup({version:p}){$.info("iframe setup started"),ul(),pr({parentElement:dr(),url:Ll(p)}),pr({parentElement:dr(),url:Zi(p)}),Wl();let y=Fe(),b=fl(),H=So({parentElement:b,url:zi(y),classNames:jc,id:"strigo-exercises"}),F=So({parentElement:b,url:Il(y.initSite.href),classNames:zc,id:"original-site"}),Y=document.createElement("div");Y.className="strigo-academy-hat align-left",Y.id="strigo-academy-hat",Y.onclick=()=>{document.getElementById("strigo-academy-hat").classList.toggle("slide-in"),this.splitInstance=Bu()};let X=document.createElement("div");X.className="strigo-academy-hat-icon",X.id="strigo-academy-hat-icon",X.innerHTML=Xi,Y.appendChild(X),b.appendChild(Y),this.splitInstance=Bu();let iA=Io();this.initEventListeners(iA,H,F)}collapse(){this.splitInstance&&(this.splitInstance.destroy(),this.splitInstance=Na(["#strigo-exercises","#original-site"],{sizes:[25,75],minSize:0,gutterSize:0}),this.splitInstance.collapse(0),document.getElementById("strigo-academy-hat").classList.toggle("slide-in"))}open(){}shutdown(){$.info("iframe shutdown called"),Bl()}initEventListeners(p,y,b){es(y,dg),fu(b),As(b.contentWindow)}},du=new gu;function pu(h){return h&&h==="dynamic"?pl()?"iframe":"overlay":h}function Ko(h){let p=null;switch(h){case"iframe":{p=du;break}case"overlay":{p=Do;break}default:throw $.error("Widget flavor is not supported",{widgetFlavor:h}),new Error(`Widget flavor ${h} is not supported`)}return p}var hu=class{constructor(){this.config={}}isDevelopment(){return!1}init(){try{if($.info("Initializing SDK..."),this.config.initialized){$.info("SDK was already initialized");return}Nl();let{webApiKey:p,subDomain:y,selectedWidgetFlavor:b}=xl();if(!p||!y||!b)throw new Error("Init data is missing");let H=pu(b);el({webApiKey:p,subDomain:y,selectedWidgetFlavor:H});let F=Ko(H);this.config.sdkType=F.init(),this.config.initialized=!0,$.info("Initialized SDK."),this.config.sdkType!=="CHILD"&&Rn()&&this.setup()}catch(p){$.error("Could not initialize SDK",{err:p})}}async setup(p){try{$.info("Starting to setup SDK...");let y=document.getElementById("strigo-widget");if(this.config.isOpen&&y||this.config.sdkType==="CHILD"){$.info('panel is already opened. Aborting "setup" action...');return}if(!this.config.initialized)throw new Error("SDK was not initialized");let H=Fe(),{email:F,token:Y,version:X,openWidget:iA=!0,dockingSide:HA="right"}={...H.user,...H,...p};if(!F||!Y)throw new Error("Setup data is missing");let AA=await ol(Y);if(!AA?.allowedAcademyDomains?.includes(window.location.host.replace(/^www\./i,""))){console.log("Running on an unrelated domain. Aborting...",{allowedDomains:AA?.allowedAcademyDomains,currentHost:window.location.host});return}if(AA){let{loggingConfig:EA,userAssessments:_A}=AA;$.debug("Configuration fetched from Strigo"),$.setup(EA),Gl(_A),AA.academyColors&&Cl(AA?.academyColors)}tl({user:{email:F,token:Y},initSite:bl(),version:X,loggingConfig:AA?.loggingConfig,isAcademyAssessmentDebug:AA?.isAcademyAssessmentDebug,dockingSide:HA}),this.config.configured=!0,$.info("Finished SDK setup."),iA&&this.open()}catch(y){$.error("Could not setup SDK",{err:y})}}open(){try{if($.info("Opening academy panel..."),!this.config.configured)throw new Error("SDK was not set up");let p=document.getElementById("strigo-widget");if(this.config.isOpen&&p||this.config.sdkType==="CHILD"){$.info('Panel is already opened. Aborting "open" action...');return}let b=Fe();al({currentUrl:b.initSite.href,shouldPanelBeOpen:Rn(),isLoading:!0,widgetFlavor:b.selectedWidgetFlavor}),Ko(b.selectedWidgetFlavor).setup({version:b.version}),this.config.isOpen=!0,$.info("Opened academy panel.")}catch(p){$.error("Could not open academy panel",{err:p})}}collapse(){$.info("Collapsing academy panel");let{selectedWidgetFlavor:p}=Fe();Ko(p).collapse()}shutdown(){try{if($.info("Closing academy panel..."),this.config.sdkType==="CHILD"){window.parent.postMessage(JSON.stringify({messageType:"close"}),"*"),$.info("Notified parent frame to close academy panel.");return}if(!this.config.isOpen){$.info("Tried to close unopened academy panel");return}let p=Ko(bo());ll(),p.collapse(),p.shutdown(),this.config.isOpen=!1,$.info("Closed academy panel.")}catch(p){$.error("Could not close academy panel",{err:p})}}destroy(){try{if($.info("Destroying SDK..."),this.config.sdkType==="CHILD"){window.parent.postMessage(JSON.stringify({messageType:"destroy"}),"*"),$.info("Notified parent frame to destroy SDK.");return}nl(),kl(),this.shutdown(),this.config={},$.info("Destroyed SDK.")}catch(p){$.error("Could not destroy SDK",{err:p})}}async sendEvent(p){let y=gr("user"),{token:b}=y;await il(b,p),$.debug("sendEvent called",{eventName:p})}startElementSelector(p,y,b){$.debug("startElementSelector called");let H=b?window.document.querySelector(b):window.document.body,{startElementSelector:F,stopElementSelection:Y}=Fl(window.document,{onElementProfileCreated:p,onElementSelectionCancel:y,zIndex:2147483645,rootElement:H});this.stopElementSelector=Y,F()}stopElementSelector(){}assessmentRecorder(){Pl()}},wu=new hu;window.Strigo=wu;_l()?(console.log("Strigo recorder mode"),window.Strigo.assessmentRecorder()):window.Strigo.init();})(); /*! * html2canvas 1.4.1 * Copyright (c) 2022 Niklas von Hertzen diff --git a/src/strigo/index.ts b/src/strigo/index.ts index 2115fd5..ed33f62 100644 --- a/src/strigo/index.ts +++ b/src/strigo/index.ts @@ -106,7 +106,10 @@ class StrigoSDK implements IStrigoSDK { Logger.setup(loggingConfig); assessmentsStorage.setupAssessmentStorage(userAssessments); - customizeHatColors(configuration?.academyColors); + + if (configuration.academyColors) { + customizeHatColors(configuration?.academyColors); + } } configManager.setupLocalStorageConfig({