@descope/web-component 4.3.0 → 4.3.2
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.
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("tslib"),t=require("@descope/sdk-helpers"),i=require("@descope/sdk-mixins/static-resources-mixin"),s=require("@descope/sdk-mixins/theme-mixin"),r=require("@descope/sdk-mixins/inject-style-mixin"),n=require("@descope/sdk-mixins/telemetry-mixin"),o=require("@descope/web-js-sdk"),a=require("../constants/index.js"),l=require("../helpers/helpers.js"),u=require("../helpers/state.js");require("@descope/escape-markdown"),require("../helpers/webauthn.js");var d,c,h,g,f,p,v,_,m,b,w,k,C,x,F,P,y,A,E,I,j,S,G,M=require("../helpers/storage.js"),O=require("../helpers/flowInputs.js"),U=require("../mixins/formMountMixin.js"),q=require("../mixins/componentConditionsMixin.js"),L=require("../mixins/duplicateFlowWarningMixin.js"),R=require("../mixins/passwordManagerMixin.js"),N=require("../constants/content.js"),T=require("../constants/general.js");function W(e){return Object.freeze({__proto__:null,default:e})}const D=t.compose(s.themeMixin,i.staticResourcesMixin,U.formMountMixin,q.componentConditionsMixin,L.duplicateFlowWarningMixin,R.passwordManagerMixin,r.injectStyleMixin,n.telemetryMixin)(HTMLElement);class K extends D{static get observedAttributes(){return["project-id","flow-id","base-url","tenant","locale","debug","storage-prefix","preview","redirect-url","auto-focus","store-last-authenticated-user","refresh-cookie-name","keep-last-authenticated-user-after-logout","validate-on-blur","send-session-token","style-id"]}constructor(t){super(),d.add(this),this.sdkVersion="4.3.0",h.set(this,!1),g.set(this,void 0),this.flowStatus="initial",this.loggerWrapper={error:(t,i="")=>{this.logger.error(t,i,new Error),e.__classPrivateFieldGet(this,d,"m",G).call(this,t,i)},warn:(e,t="")=>{this.logger.warn(e,t)},info:(e,t="",i={})=>{this.logger.info(e,t,i)},debug:(e,t="")=>{this.logger.debug(e,t)}},f.set(this,new u),p.set(this,new u),v.set(this,{}),this.getComponentsContext=()=>e.__classPrivateFieldGet(this,v,"f"),this.nextRequestStatus=new u({isLoading:!1}),_.set(this,void 0),m.set(this,{popstate:e.__classPrivateFieldGet(this,d,"m",x).bind(this),componentsContext:e.__classPrivateFieldGet(this,d,"m",I).bind(this)}),b.set(this,void 0),this.getConfig=()=>e.__awaiter(this,void 0,void 0,(function*(){return(yield this.config)||{isMissingConfig:!0}})),e.__classPrivateFieldSet(this,b,t,"f"),e.__classPrivateFieldGet(this,d,"m",k).call(this)}get client(){try{return JSON.parse(this.getAttribute("client"))||{}}catch(e){return{}}}get redirectUrl(){return this.getAttribute("redirect-url")||void 0}get debug(){return"true"===this.getAttribute("debug")}get locale(){return this.getAttribute("locale")||void 0}get autoFocus(){var e;const t=null!==(e=this.getAttribute("auto-focus"))&&void 0!==e?e:"true";return"skipFirstScreen"===t?t:"true"===t}get validateOnBlur(){return"true"===this.getAttribute("validate-on-blur")}get storeLastAuthenticatedUser(){var e;return"true"===(null!==(e=this.getAttribute("store-last-authenticated-user"))&&void 0!==e?e:"true")}get refreshCookieName(){return this.getAttribute("refresh-cookie-name")||""}get keepLastAuthenticatedUserAfterLogout(){return"true"===this.getAttribute("keep-last-authenticated-user-after-logout")}get storagePrefix(){return this.getAttribute("storage-prefix")||""}get sendSessionToken(){return"true"===this.getAttribute("send-session-token")}get preview(){return!!this.getAttribute("preview")}get formConfig(){return O.transformFlowInputFormData(this.form)}get form(){return this.getAttribute("form")}get formConfigValues(){return O.extractNestedAttribute(this.formConfig,"value")}get outboundAppId(){return this.getAttribute("outbound-app-id")}get outboundAppScopes(){try{const e=JSON.parse(this.getAttribute("outbound-app-scopes"));return e||null}catch(e){return null}}get popupOrigin(){return this.getAttribute("popup-origin")}get customStorage(){return e.__classPrivateFieldGet(this,g,"f")}set customStorage(t){if(t&&"function"!=typeof t.getItem)throw new Error("Custom storage must have a getItem method");if(t&&"function"!=typeof t.setItem)throw new Error("Custom storage must have a setItem method");if(t&&"function"!=typeof t.removeItem)throw new Error("Custom storage must have a removeItem method");e.__classPrivateFieldSet(this,g,t,"f"),M.setCustomStorage(t)}get isRestartOnError(){return"true"===this.getAttribute("restart-on-error")}getExecutionContext(){return e.__awaiter(this,void 0,void 0,(function*(){const e=yield this.getConfig();return"executionContext"in e?e.executionContext:void 0}))}getProjectConfig(){return e.__awaiter(this,void 0,void 0,(function*(){const e=yield this.getConfig();return"projectConfig"in e?e.projectConfig:void 0}))}getFlowConfig(){return e.__awaiter(this,void 0,void 0,(function*(){var e,t;const i=yield this.getProjectConfig(),s=(null===(e=null==i?void 0:i.flows)||void 0===e?void 0:e[this.flowId])||{};return null!==(t=s.version)&&void 0!==t||(s.version=0),s}))}getTargetLocales(){return e.__awaiter(this,void 0,void 0,(function*(){const e=yield this.getFlowConfig();return((null==e?void 0:e.targetLocales)||[]).map((e=>e.toLowerCase()))}))}handleKeyPress(){this.logger.debug("Enable key press handler"),this.rootElement.onkeydown=e=>{var t,i,s;const r=!!(null===(t=this.shadowRoot.activeElement)||void 0===t?void 0:t.getAttribute("href")),n=a.ELEMENTS_TO_IGNORE_ENTER_KEY_ON.includes(null!==(s=null===(i=this.shadowRoot.activeElement)||void 0===i?void 0:i.localName)&&void 0!==s?s:"");if("Enter"!==e.key||r||n)return;e.preventDefault();const o=this.rootElement.querySelectorAll("descope-button");if(1===o.length&&"false"!==o[0].getAttribute("auto-submit"))return void o[0].click();const l=Array.from(o).filter((e=>"true"===e.getAttribute("auto-submit")));if(1===l.length)return void l[0].click();const u=Array.from(o).filter((e=>"button"===e.getAttribute("data-type")));if(1===u.length)"false"!==u[0].getAttribute("auto-submit")&&u[0].click();else if(0===u.length){const e=Array.from(o).filter((e=>"sso"===e.getAttribute("data-type")));1===e.length&&"false"!==e[0].getAttribute("auto-submit")&&e[0].click()}}}disableKeyPressHandler(){this.logger.debug("Disable key press handler"),this.rootElement.onkeydown=null}getComponentsVersion(){return e.__awaiter(this,void 0,void 0,(function*(){var e;const t=yield this.getConfig(),i="projectConfig"in t?null===(e=t.projectConfig)||void 0===e?void 0:e.componentsVersion:{};return i||(this.logger.error("Did not get components version, using latest version"),"latest")}))}init(){const t=Object.create(null,{init:{get:()=>super.init}});return e.__awaiter(this,void 0,void 0,(function*(){var i;if(this.flowStatus="loading",["ready","error","success"].forEach((e=>this.addEventListener(e,(()=>{this.flowStatus=e})))),yield null===(i=t.init)||void 0===i?void 0:i.call(this),e.__classPrivateFieldGet(this,p,"f").subscribe(e.__classPrivateFieldGet(this,d,"m",S).bind(this)),e.__classPrivateFieldGet(this,p,"f").update({isDebug:this.debug}),e.__classPrivateFieldGet(this,d,"m",C).call(this),yield e.__classPrivateFieldGet(this,d,"m",A).call(this))return void this.loggerWrapper.error("This SDK version does not support your flows version","Make sure to upgrade your flows to the latest version or use an older SDK version");const s=yield this.getConfig();if("isMissingConfig"in s&&s.isMissingConfig)return void this.loggerWrapper.error("Cannot get config file","Make sure that your projectId & flowId are correct");const{executionId:r,stepId:n,token:o,code:a,isPopup:u,exchangeError:c,redirectAuthCallbackUrl:g,redirectAuthBackupCallbackUri:v,redirectAuthCodeChallenge:_,redirectAuthInitiator:b,ssoQueryParams:w}=l.handleUrlParams(this.flowId,this.loggerWrapper);window.addEventListener("popstate",e.__classPrivateFieldGet(this,m,"f").popstate),window.addEventListener("components-context",e.__classPrivateFieldGet(this,m,"f").componentsContext),e.__classPrivateFieldGet(this,f,"f").subscribe(e.__classPrivateFieldGet(this,d,"m",y).bind(this)),e.__classPrivateFieldGet(this,f,"f").update(Object.assign({projectId:this.projectId,flowId:this.flowId,baseUrl:this.baseUrl,tenant:this.tenantId,redirectUrl:this.redirectUrl,locale:this.locale,stepId:n,executionId:r,token:o,code:a,isPopup:u,exchangeError:c,redirectAuthCallbackUrl:g,redirectAuthBackupCallbackUri:v,redirectAuthCodeChallenge:_,redirectAuthInitiator:b},w)),e.__classPrivateFieldSet(this,h,!0,"f")}))}disconnectedCallback(){var t;e.__classPrivateFieldGet(this,f,"f").unsubscribeAll(),e.__classPrivateFieldGet(this,p,"f").unsubscribeAll(),e.__classPrivateFieldGet(this,d,"m",j).call(this),window.removeEventListener("popstate",e.__classPrivateFieldGet(this,m,"f").popstate),window.removeEventListener("components-context",e.__classPrivateFieldGet(this,m,"f").componentsContext),null===(t=super.disconnectedCallback)||void 0===t||t.call(this)}attributeChangedCallback(t,i,s){var r;if(null===(r=super.attributeChangedCallback)||void 0===r||r.call(this,t,i,s),this.shadowRoot.isConnected&&e.__classPrivateFieldGet(this,h,"f")&&i!==s&&c.observedAttributes.includes(t)){e.__classPrivateFieldGet(this,d,"m",C).call(this);const r=null===i;e.__classPrivateFieldGet(this,f,"f").update((({stepId:e,executionId:i})=>{let n=e,o=i;return r||(o=null,n=null,l.clearRunIdsFromUrl()),{[l.camelCase(t)]:s,stepId:n,executionId:o}})),e.__classPrivateFieldGet(this,p,"f").update({isDebug:this.debug})}}}c=K,h=new WeakMap,g=new WeakMap,f=new WeakMap,p=new WeakMap,v=new WeakMap,_=new WeakMap,m=new WeakMap,b=new WeakMap,d=new WeakSet,w=function(){this.injectStyle("\n :host {\n\t\t\twidth: 100%;\n display: block;\n\t\t}\n\n\t\t#root {\n\t\t\theight: 100%;\n display: flex;\n flex-direction: column;\n\t\t}\n\n #content-root {\n all: initial;\n transition: opacity 200ms ease-in-out;\n }\n\n\t\t#root[data-theme] {\n\t\t\tbackground-color: transparent;\n\t\t}\n\n\t\t.fade-out {\n\t\t\topacity: 0.1!important;\n\t\t}\n\n .hidden {\n display: none;\n }\n ")},k=function(){e.__classPrivateFieldGet(this,d,"m",w).call(this),this.slotElement=document.createElement("slot"),this.slotElement.classList.add("hidden"),this.rootElement.appendChild(this.slotElement)},C=function(){const e=["base-url","tenant","locale","debug","redirect-url","auto-focus","store-last-authenticated-user","refresh-cookie-name","keep-last-authenticated-user-after-logout","preview","storage-prefix","form","client","validate-on-blur","send-session-token","style-id","outbound-app-id","outbound-app-scopes","theme-override"];c.observedAttributes.forEach((t=>{if(!e.includes(t)&&!this[l.camelCase(t)])throw Error(`${t} cannot be empty`)}))},x=function(){const{stepId:t,executionId:i}=l.getRunIdsFromUrl(this.flowId);e.__classPrivateFieldGet(this,f,"f").update({stepId:t,executionId:i})},F=function(t,i){o.createSdk&&"function"==typeof o.createSdk||this.logger.error("SDK was not loaded properly",o.createSdk,JSON.stringify(o.createSdk));const s=Object.assign(Object.assign({persistTokens:!0,preview:this.preview,storagePrefix:this.storagePrefix,storeLastAuthenticatedUser:this.storeLastAuthenticatedUser,keepLastAuthenticatedUserAfterLogout:this.keepLastAuthenticatedUserAfterLogout,refreshCookieName:this.refreshCookieName},c.sdkConfigOverrides),{projectId:t,baseUrl:i});e.__classPrivateFieldGet(this,g,"f")&&(s.customStorage=e.__classPrivateFieldGet(this,g,"f")),this.sdk=o.createSdk(s);const r={start:1,next:7};["start","next"].forEach((t=>{const i=this.sdk.flow[t],s=l.withRetry(i,1e3,3);this.sdk.flow[t]=(...i)=>e.__awaiter(this,void 0,void 0,(function*(){const n=[...i],o=r[t],a=e.__classPrivateFieldGet(this,d,"m",P).call(this,n[o]);void 0!==a&&(n[o]=a);try{return yield s(...n)}catch(e){return this.logger.error(`Error in sdk flow ${t} function`,e),{error:{errorCode:T.FETCH_EXCEPTION_ERROR_CODE,errorDescription:e.toString()}}}}))}))},P=function(e){if(!this.sendSessionToken)return e;const t=null===o.getSessionToken||void 0===o.getSessionToken?void 0:o.getSessionToken(this.storagePrefix);return t?Object.assign(Object.assign({},null!=e?e:{}),{sessionJwt:t}):e},y=function(t,i,s){return e.__awaiter(this,void 0,void 0,(function*(){const{projectId:i,baseUrl:r}=t;if(s("projectId")||s("baseUrl")){if(!i)return;e.__classPrivateFieldGet(this,d,"m",F).call(this,i,r)}e.__classPrivateFieldGet(this,b,"f").call(this,t)}))},A=function(){return e.__awaiter(this,void 0,void 0,(function*(){const t=yield this.getConfig();return"isMissingConfig"in t&&t.isMissingConfig&&(yield e.__classPrivateFieldGet(this,d,"m",E).call(this))}))},E=function(){return e.__awaiter(this,void 0,void 0,(function*(){const e=l.getContentUrl({projectId:this.projectId,filename:N.CONFIG_FILENAME,assetsFolder:N.PREV_VER_ASSETS_FOLDER,baseUrl:this.baseStaticUrl});try{return yield l.fetchContent(e,"json"),!0}catch(e){return!1}}))},I=function(t){e.__classPrivateFieldSet(this,v,Object.assign(Object.assign({},e.__classPrivateFieldGet(this,v,"f")),t.detail),"f")},j=function(){var t;null===(t=e.__classPrivateFieldGet(this,_,"f"))||void 0===t||t.remove(),e.__classPrivateFieldSet(this,_,null,"f")},S=function(t){return e.__awaiter(this,arguments,void 0,(function*({isDebug:t}){t?(e.__classPrivateFieldSet(this,_,document.createElement("descope-debugger"),"f"),Object.assign(e.__classPrivateFieldGet(this,_,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),yield Promise.resolve().then((function(){return W(require("../debugger-wc.js"))})),document.body.appendChild(e.__classPrivateFieldGet(this,_,"f"))):e.__classPrivateFieldGet(this,d,"m",j).call(this)}))},G=function(t,i){var s;t&&this.debug&&(null===(s=e.__classPrivateFieldGet(this,_,"f"))||void 0===s||s.updateData({title:t,description:i}))},K.sdkConfigOverrides={baseHeaders:{"x-descope-sdk-name":"web-component","x-descope-sdk-version":"4.3.0"}},module.exports=K;
|
|
1
|
+
"use strict";var e=require("tslib"),t=require("@descope/sdk-helpers"),i=require("@descope/sdk-mixins/static-resources-mixin"),s=require("@descope/sdk-mixins/theme-mixin"),r=require("@descope/sdk-mixins/inject-style-mixin"),n=require("@descope/sdk-mixins/telemetry-mixin"),o=require("@descope/web-js-sdk"),a=require("../constants/index.js"),l=require("../helpers/helpers.js"),u=require("../helpers/state.js");require("@descope/escape-markdown"),require("../helpers/webauthn.js");var d,c,h,g,f,p,v,_,m,b,w,k,C,x,F,P,y,A,E,I,j,S,G,M=require("../helpers/storage.js"),O=require("../helpers/flowInputs.js"),U=require("../mixins/formMountMixin.js"),q=require("../mixins/componentConditionsMixin.js"),L=require("../mixins/duplicateFlowWarningMixin.js"),R=require("../mixins/passwordManagerMixin.js"),N=require("../constants/content.js"),T=require("../constants/general.js");function W(e){return Object.freeze({__proto__:null,default:e})}const D=t.compose(s.themeMixin,i.staticResourcesMixin,U.formMountMixin,q.componentConditionsMixin,L.duplicateFlowWarningMixin,R.passwordManagerMixin,r.injectStyleMixin,n.telemetryMixin)(HTMLElement);class K extends D{static get observedAttributes(){return["project-id","flow-id","base-url","tenant","locale","debug","storage-prefix","preview","redirect-url","auto-focus","store-last-authenticated-user","refresh-cookie-name","keep-last-authenticated-user-after-logout","validate-on-blur","send-session-token","style-id"]}constructor(t){super(),d.add(this),this.sdkVersion="4.3.2",h.set(this,!1),g.set(this,void 0),this.flowStatus="initial",this.loggerWrapper={error:(t,i="")=>{this.logger.error(t,i,new Error),e.__classPrivateFieldGet(this,d,"m",G).call(this,t,i)},warn:(e,t="")=>{this.logger.warn(e,t)},info:(e,t="",i={})=>{this.logger.info(e,t,i)},debug:(e,t="")=>{this.logger.debug(e,t)}},f.set(this,new u),p.set(this,new u),v.set(this,{}),this.getComponentsContext=()=>e.__classPrivateFieldGet(this,v,"f"),this.nextRequestStatus=new u({isLoading:!1}),_.set(this,void 0),m.set(this,{popstate:e.__classPrivateFieldGet(this,d,"m",x).bind(this),componentsContext:e.__classPrivateFieldGet(this,d,"m",I).bind(this)}),b.set(this,void 0),this.getConfig=()=>e.__awaiter(this,void 0,void 0,(function*(){return(yield this.config)||{isMissingConfig:!0}})),e.__classPrivateFieldSet(this,b,t,"f"),e.__classPrivateFieldGet(this,d,"m",k).call(this)}get client(){try{return JSON.parse(this.getAttribute("client"))||{}}catch(e){return{}}}get redirectUrl(){return this.getAttribute("redirect-url")||void 0}get debug(){return"true"===this.getAttribute("debug")}get locale(){return this.getAttribute("locale")||void 0}get autoFocus(){var e;const t=null!==(e=this.getAttribute("auto-focus"))&&void 0!==e?e:"true";return"skipFirstScreen"===t?t:"true"===t}get validateOnBlur(){return"true"===this.getAttribute("validate-on-blur")}get storeLastAuthenticatedUser(){var e;return"true"===(null!==(e=this.getAttribute("store-last-authenticated-user"))&&void 0!==e?e:"true")}get refreshCookieName(){return this.getAttribute("refresh-cookie-name")||""}get keepLastAuthenticatedUserAfterLogout(){return"true"===this.getAttribute("keep-last-authenticated-user-after-logout")}get storagePrefix(){return this.getAttribute("storage-prefix")||""}get sendSessionToken(){return"true"===this.getAttribute("send-session-token")}get preview(){return!!this.getAttribute("preview")}get formConfig(){return O.transformFlowInputFormData(this.form)}get form(){return this.getAttribute("form")}get formConfigValues(){return O.extractNestedAttribute(this.formConfig,"value")}get outboundAppId(){return this.getAttribute("outbound-app-id")}get outboundAppScopes(){try{const e=JSON.parse(this.getAttribute("outbound-app-scopes"));return e||null}catch(e){return null}}get popupOrigin(){return this.getAttribute("popup-origin")}get customStorage(){return e.__classPrivateFieldGet(this,g,"f")}set customStorage(t){if(t&&"function"!=typeof t.getItem)throw new Error("Custom storage must have a getItem method");if(t&&"function"!=typeof t.setItem)throw new Error("Custom storage must have a setItem method");if(t&&"function"!=typeof t.removeItem)throw new Error("Custom storage must have a removeItem method");e.__classPrivateFieldSet(this,g,t,"f"),M.setCustomStorage(t)}get isRestartOnError(){return"true"===this.getAttribute("restart-on-error")}getExecutionContext(){return e.__awaiter(this,void 0,void 0,(function*(){const e=yield this.getConfig();return"executionContext"in e?e.executionContext:void 0}))}getProjectConfig(){return e.__awaiter(this,void 0,void 0,(function*(){const e=yield this.getConfig();return"projectConfig"in e?e.projectConfig:void 0}))}getFlowConfig(){return e.__awaiter(this,void 0,void 0,(function*(){var e,t;const i=yield this.getProjectConfig(),s=(null===(e=null==i?void 0:i.flows)||void 0===e?void 0:e[this.flowId])||{};return null!==(t=s.version)&&void 0!==t||(s.version=0),s}))}getTargetLocales(){return e.__awaiter(this,void 0,void 0,(function*(){const e=yield this.getFlowConfig();return((null==e?void 0:e.targetLocales)||[]).map((e=>e.toLowerCase()))}))}handleKeyPress(){this.logger.debug("Enable key press handler"),this.rootElement.onkeydown=e=>{var t,i,s;const r=!!(null===(t=this.shadowRoot.activeElement)||void 0===t?void 0:t.getAttribute("href")),n=a.ELEMENTS_TO_IGNORE_ENTER_KEY_ON.includes(null!==(s=null===(i=this.shadowRoot.activeElement)||void 0===i?void 0:i.localName)&&void 0!==s?s:"");if("Enter"!==e.key||r||n)return;e.preventDefault();const o=this.rootElement.querySelectorAll("descope-button");if(1===o.length&&"false"!==o[0].getAttribute("auto-submit"))return void o[0].click();const l=Array.from(o).filter((e=>"true"===e.getAttribute("auto-submit")));if(1===l.length)return void l[0].click();const u=Array.from(o).filter((e=>"button"===e.getAttribute("data-type")));if(1===u.length)"false"!==u[0].getAttribute("auto-submit")&&u[0].click();else if(0===u.length){const e=Array.from(o).filter((e=>"sso"===e.getAttribute("data-type")));1===e.length&&"false"!==e[0].getAttribute("auto-submit")&&e[0].click()}}}disableKeyPressHandler(){this.logger.debug("Disable key press handler"),this.rootElement.onkeydown=null}getComponentsVersion(){return e.__awaiter(this,void 0,void 0,(function*(){var e;const t=yield this.getConfig(),i="projectConfig"in t?null===(e=t.projectConfig)||void 0===e?void 0:e.componentsVersion:{};return i||(this.logger.error("Did not get components version, using latest version"),"latest")}))}init(){const t=Object.create(null,{init:{get:()=>super.init}});return e.__awaiter(this,void 0,void 0,(function*(){var i;if(this.flowStatus="loading",["ready","error","success"].forEach((e=>this.addEventListener(e,(()=>{this.flowStatus=e})))),yield null===(i=t.init)||void 0===i?void 0:i.call(this),e.__classPrivateFieldGet(this,p,"f").subscribe(e.__classPrivateFieldGet(this,d,"m",S).bind(this)),e.__classPrivateFieldGet(this,p,"f").update({isDebug:this.debug}),e.__classPrivateFieldGet(this,d,"m",C).call(this),yield e.__classPrivateFieldGet(this,d,"m",A).call(this))return void this.loggerWrapper.error("This SDK version does not support your flows version","Make sure to upgrade your flows to the latest version or use an older SDK version");const s=yield this.getConfig();if("isMissingConfig"in s&&s.isMissingConfig)return void this.loggerWrapper.error("Cannot get config file","Make sure that your projectId & flowId are correct");const{executionId:r,stepId:n,token:o,code:a,isPopup:u,exchangeError:c,redirectAuthCallbackUrl:g,redirectAuthBackupCallbackUri:v,redirectAuthCodeChallenge:_,redirectAuthInitiator:b,ssoQueryParams:w}=l.handleUrlParams(this.flowId,this.loggerWrapper);window.addEventListener("popstate",e.__classPrivateFieldGet(this,m,"f").popstate),window.addEventListener("components-context",e.__classPrivateFieldGet(this,m,"f").componentsContext),e.__classPrivateFieldGet(this,f,"f").subscribe(e.__classPrivateFieldGet(this,d,"m",y).bind(this)),e.__classPrivateFieldGet(this,f,"f").update(Object.assign({projectId:this.projectId,flowId:this.flowId,baseUrl:this.baseUrl,tenant:this.tenantId,redirectUrl:this.redirectUrl,locale:this.locale,stepId:n,executionId:r,token:o,code:a,isPopup:u,exchangeError:c,redirectAuthCallbackUrl:g,redirectAuthBackupCallbackUri:v,redirectAuthCodeChallenge:_,redirectAuthInitiator:b},w)),e.__classPrivateFieldSet(this,h,!0,"f")}))}disconnectedCallback(){var t;e.__classPrivateFieldGet(this,f,"f").unsubscribeAll(),e.__classPrivateFieldGet(this,p,"f").unsubscribeAll(),e.__classPrivateFieldGet(this,d,"m",j).call(this),window.removeEventListener("popstate",e.__classPrivateFieldGet(this,m,"f").popstate),window.removeEventListener("components-context",e.__classPrivateFieldGet(this,m,"f").componentsContext),null===(t=super.disconnectedCallback)||void 0===t||t.call(this)}attributeChangedCallback(t,i,s){var r;if(null===(r=super.attributeChangedCallback)||void 0===r||r.call(this,t,i,s),this.shadowRoot.isConnected&&e.__classPrivateFieldGet(this,h,"f")&&i!==s&&c.observedAttributes.includes(t)){e.__classPrivateFieldGet(this,d,"m",C).call(this);const r=null===i;e.__classPrivateFieldGet(this,f,"f").update((({stepId:e,executionId:i})=>{let n=e,o=i;return r||(o=null,n=null,l.clearRunIdsFromUrl()),{[l.camelCase(t)]:s,stepId:n,executionId:o}})),e.__classPrivateFieldGet(this,p,"f").update({isDebug:this.debug})}}}c=K,h=new WeakMap,g=new WeakMap,f=new WeakMap,p=new WeakMap,v=new WeakMap,_=new WeakMap,m=new WeakMap,b=new WeakMap,d=new WeakSet,w=function(){this.injectStyle("\n :host {\n\t\t\twidth: 100%;\n display: block;\n\t\t}\n\n\t\t#root {\n\t\t\theight: 100%;\n display: flex;\n flex-direction: column;\n\t\t}\n\n #content-root {\n all: initial;\n transition: opacity 200ms ease-in-out;\n }\n\n\t\t#root[data-theme] {\n\t\t\tbackground-color: transparent;\n\t\t}\n\n\t\t.fade-out {\n\t\t\topacity: 0.1!important;\n\t\t}\n\n .hidden {\n display: none;\n }\n ")},k=function(){e.__classPrivateFieldGet(this,d,"m",w).call(this),this.slotElement=document.createElement("slot"),this.slotElement.classList.add("hidden"),this.rootElement.appendChild(this.slotElement)},C=function(){const e=["base-url","tenant","locale","debug","redirect-url","auto-focus","store-last-authenticated-user","refresh-cookie-name","keep-last-authenticated-user-after-logout","preview","storage-prefix","form","client","validate-on-blur","send-session-token","style-id","outbound-app-id","outbound-app-scopes","theme-override"];c.observedAttributes.forEach((t=>{if(!e.includes(t)&&!this[l.camelCase(t)])throw Error(`${t} cannot be empty`)}))},x=function(){const{stepId:t,executionId:i}=l.getRunIdsFromUrl(this.flowId);e.__classPrivateFieldGet(this,f,"f").update({stepId:t,executionId:i})},F=function(t,i){o.createSdk&&"function"==typeof o.createSdk||this.logger.error("SDK was not loaded properly",o.createSdk,JSON.stringify(o.createSdk));const s=Object.assign(Object.assign({persistTokens:!0,preview:this.preview,storagePrefix:this.storagePrefix,storeLastAuthenticatedUser:this.storeLastAuthenticatedUser,keepLastAuthenticatedUserAfterLogout:this.keepLastAuthenticatedUserAfterLogout,refreshCookieName:this.refreshCookieName},c.sdkConfigOverrides),{projectId:t,baseUrl:i});e.__classPrivateFieldGet(this,g,"f")&&(s.customStorage=e.__classPrivateFieldGet(this,g,"f")),this.sdk=o.createSdk(s);const r={start:1,next:7};["start","next"].forEach((t=>{const i=this.sdk.flow[t],s=l.withRetry(i,1e3,3);this.sdk.flow[t]=(...i)=>e.__awaiter(this,void 0,void 0,(function*(){const n=[...i],o=r[t],a=e.__classPrivateFieldGet(this,d,"m",P).call(this,n[o]);void 0!==a&&(n[o]=a);try{return yield s(...n)}catch(e){return this.logger.error(`Error in sdk flow ${t} function`,e),{error:{errorCode:T.FETCH_EXCEPTION_ERROR_CODE,errorDescription:e.toString()}}}}))}))},P=function(e){if(!this.sendSessionToken)return e;const t=null===o.getSessionToken||void 0===o.getSessionToken?void 0:o.getSessionToken(this.storagePrefix);return t?Object.assign(Object.assign({},null!=e?e:{}),{sessionJwt:t}):e},y=function(t,i,s){return e.__awaiter(this,void 0,void 0,(function*(){const{projectId:i,baseUrl:r}=t;if(s("projectId")||s("baseUrl")){if(!i)return;e.__classPrivateFieldGet(this,d,"m",F).call(this,i,r)}e.__classPrivateFieldGet(this,b,"f").call(this,t)}))},A=function(){return e.__awaiter(this,void 0,void 0,(function*(){const t=yield this.getConfig();return"isMissingConfig"in t&&t.isMissingConfig&&(yield e.__classPrivateFieldGet(this,d,"m",E).call(this))}))},E=function(){return e.__awaiter(this,void 0,void 0,(function*(){const e=l.getContentUrl({projectId:this.projectId,filename:N.CONFIG_FILENAME,assetsFolder:N.PREV_VER_ASSETS_FOLDER,baseUrl:this.baseStaticUrl});try{return yield l.fetchContent(e,"json"),!0}catch(e){return!1}}))},I=function(t){e.__classPrivateFieldSet(this,v,Object.assign(Object.assign({},e.__classPrivateFieldGet(this,v,"f")),t.detail),"f")},j=function(){var t;null===(t=e.__classPrivateFieldGet(this,_,"f"))||void 0===t||t.remove(),e.__classPrivateFieldSet(this,_,null,"f")},S=function(t){return e.__awaiter(this,arguments,void 0,(function*({isDebug:t}){t?(e.__classPrivateFieldSet(this,_,document.createElement("descope-debugger"),"f"),Object.assign(e.__classPrivateFieldGet(this,_,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),yield Promise.resolve().then((function(){return W(require("../debugger-wc.js"))})),document.body.appendChild(e.__classPrivateFieldGet(this,_,"f"))):e.__classPrivateFieldGet(this,d,"m",j).call(this)}))},G=function(t,i){var s;t&&this.debug&&(null===(s=e.__classPrivateFieldGet(this,_,"f"))||void 0===s||s.updateData({title:t,description:i}))},K.sdkConfigOverrides={baseHeaders:{"x-descope-sdk-name":"web-component","x-descope-sdk-version":"4.3.2"}},module.exports=K;
|
|
2
2
|
//# sourceMappingURL=BaseDescopeWc.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__classPrivateFieldGet as t,__awaiter as e,__classPrivateFieldSet as i}from"tslib";import{compose as o}from"@descope/sdk-helpers";import{staticResourcesMixin as s}from"@descope/sdk-mixins/static-resources-mixin";import{themeMixin as r}from"@descope/sdk-mixins/theme-mixin";import{injectStyleMixin as n}from"@descope/sdk-mixins/inject-style-mixin";import{telemetryMixin as a}from"@descope/sdk-mixins/telemetry-mixin";import{createSdk as u,getSessionToken as l}from"@descope/web-js-sdk";import{ELEMENTS_TO_IGNORE_ENTER_KEY_ON as d}from"../constants/index.js";import{handleUrlParams as c,clearRunIdsFromUrl as h,camelCase as g,getRunIdsFromUrl as f,getContentUrl as p,fetchContent as m,withRetry as b}from"../helpers/helpers.js";import v from"../helpers/state.js";import"@descope/escape-markdown";import"../helpers/webauthn.js";import{setCustomStorage as w}from"../helpers/storage.js";import{transformFlowInputFormData as k,extractNestedAttribute as C}from"../helpers/flowInputs.js";import{formMountMixin as x}from"../mixins/formMountMixin.js";import{componentConditionsMixin as y}from"../mixins/componentConditionsMixin.js";import{duplicateFlowWarningMixin as A}from"../mixins/duplicateFlowWarningMixin.js";import{passwordManagerMixin as j}from"../mixins/passwordManagerMixin.js";import{CONFIG_FILENAME as I,PREV_VER_ASSETS_FOLDER as E}from"../constants/content.js";import{FETCH_EXCEPTION_ERROR_CODE as M}from"../constants/general.js";var S,L,U,O,W,D,P,N,F,T,K,R,J,V,B,H,q,$,z,Q,G,X,Y;const Z=o(r,s,x,y,A,j,n,a)(HTMLElement);class _ extends Z{static get observedAttributes(){return["project-id","flow-id","base-url","tenant","locale","debug","storage-prefix","preview","redirect-url","auto-focus","store-last-authenticated-user","refresh-cookie-name","keep-last-authenticated-user-after-logout","validate-on-blur","send-session-token","style-id"]}constructor(o){super(),S.add(this),this.sdkVersion="4.3.0",U.set(this,!1),O.set(this,void 0),this.flowStatus="initial",this.loggerWrapper={error:(e,i="")=>{this.logger.error(e,i,new Error),t(this,S,"m",Y).call(this,e,i)},warn:(t,e="")=>{this.logger.warn(t,e)},info:(t,e="",i={})=>{this.logger.info(t,e,i)},debug:(t,e="")=>{this.logger.debug(t,e)}},W.set(this,new v),D.set(this,new v),P.set(this,{}),this.getComponentsContext=()=>t(this,P,"f"),this.nextRequestStatus=new v({isLoading:!1}),N.set(this,void 0),F.set(this,{popstate:t(this,S,"m",V).bind(this),componentsContext:t(this,S,"m",Q).bind(this)}),T.set(this,void 0),this.getConfig=()=>e(this,void 0,void 0,(function*(){return(yield this.config)||{isMissingConfig:!0}})),i(this,T,o,"f"),t(this,S,"m",R).call(this)}get client(){try{return JSON.parse(this.getAttribute("client"))||{}}catch(t){return{}}}get redirectUrl(){return this.getAttribute("redirect-url")||void 0}get debug(){return"true"===this.getAttribute("debug")}get locale(){return this.getAttribute("locale")||void 0}get autoFocus(){var t;const e=null!==(t=this.getAttribute("auto-focus"))&&void 0!==t?t:"true";return"skipFirstScreen"===e?e:"true"===e}get validateOnBlur(){return"true"===this.getAttribute("validate-on-blur")}get storeLastAuthenticatedUser(){var t;return"true"===(null!==(t=this.getAttribute("store-last-authenticated-user"))&&void 0!==t?t:"true")}get refreshCookieName(){return this.getAttribute("refresh-cookie-name")||""}get keepLastAuthenticatedUserAfterLogout(){return"true"===this.getAttribute("keep-last-authenticated-user-after-logout")}get storagePrefix(){return this.getAttribute("storage-prefix")||""}get sendSessionToken(){return"true"===this.getAttribute("send-session-token")}get preview(){return!!this.getAttribute("preview")}get formConfig(){return k(this.form)}get form(){return this.getAttribute("form")}get formConfigValues(){return C(this.formConfig,"value")}get outboundAppId(){return this.getAttribute("outbound-app-id")}get outboundAppScopes(){try{const t=JSON.parse(this.getAttribute("outbound-app-scopes"));return t||null}catch(t){return null}}get popupOrigin(){return this.getAttribute("popup-origin")}get customStorage(){return t(this,O,"f")}set customStorage(t){if(t&&"function"!=typeof t.getItem)throw new Error("Custom storage must have a getItem method");if(t&&"function"!=typeof t.setItem)throw new Error("Custom storage must have a setItem method");if(t&&"function"!=typeof t.removeItem)throw new Error("Custom storage must have a removeItem method");i(this,O,t,"f"),w(t)}get isRestartOnError(){return"true"===this.getAttribute("restart-on-error")}getExecutionContext(){return e(this,void 0,void 0,(function*(){const t=yield this.getConfig();return"executionContext"in t?t.executionContext:void 0}))}getProjectConfig(){return e(this,void 0,void 0,(function*(){const t=yield this.getConfig();return"projectConfig"in t?t.projectConfig:void 0}))}getFlowConfig(){return e(this,void 0,void 0,(function*(){var t,e;const i=yield this.getProjectConfig(),o=(null===(t=null==i?void 0:i.flows)||void 0===t?void 0:t[this.flowId])||{};return null!==(e=o.version)&&void 0!==e||(o.version=0),o}))}getTargetLocales(){return e(this,void 0,void 0,(function*(){const t=yield this.getFlowConfig();return((null==t?void 0:t.targetLocales)||[]).map((t=>t.toLowerCase()))}))}handleKeyPress(){this.logger.debug("Enable key press handler"),this.rootElement.onkeydown=t=>{var e,i,o;const s=!!(null===(e=this.shadowRoot.activeElement)||void 0===e?void 0:e.getAttribute("href")),r=d.includes(null!==(o=null===(i=this.shadowRoot.activeElement)||void 0===i?void 0:i.localName)&&void 0!==o?o:"");if("Enter"!==t.key||s||r)return;t.preventDefault();const n=this.rootElement.querySelectorAll("descope-button");if(1===n.length&&"false"!==n[0].getAttribute("auto-submit"))return void n[0].click();const a=Array.from(n).filter((t=>"true"===t.getAttribute("auto-submit")));if(1===a.length)return void a[0].click();const u=Array.from(n).filter((t=>"button"===t.getAttribute("data-type")));if(1===u.length)"false"!==u[0].getAttribute("auto-submit")&&u[0].click();else if(0===u.length){const t=Array.from(n).filter((t=>"sso"===t.getAttribute("data-type")));1===t.length&&"false"!==t[0].getAttribute("auto-submit")&&t[0].click()}}}disableKeyPressHandler(){this.logger.debug("Disable key press handler"),this.rootElement.onkeydown=null}getComponentsVersion(){return e(this,void 0,void 0,(function*(){var t;const e=yield this.getConfig(),i="projectConfig"in e?null===(t=e.projectConfig)||void 0===t?void 0:t.componentsVersion:{};return i||(this.logger.error("Did not get components version, using latest version"),"latest")}))}init(){const o=Object.create(null,{init:{get:()=>super.init}});return e(this,void 0,void 0,(function*(){var e;if(this.flowStatus="loading",["ready","error","success"].forEach((t=>this.addEventListener(t,(()=>{this.flowStatus=t})))),yield null===(e=o.init)||void 0===e?void 0:e.call(this),t(this,D,"f").subscribe(t(this,S,"m",X).bind(this)),t(this,D,"f").update({isDebug:this.debug}),t(this,S,"m",J).call(this),yield t(this,S,"m",$).call(this))return void this.loggerWrapper.error("This SDK version does not support your flows version","Make sure to upgrade your flows to the latest version or use an older SDK version");const s=yield this.getConfig();if("isMissingConfig"in s&&s.isMissingConfig)return void this.loggerWrapper.error("Cannot get config file","Make sure that your projectId & flowId are correct");const{executionId:r,stepId:n,token:a,code:u,isPopup:l,exchangeError:d,redirectAuthCallbackUrl:h,redirectAuthBackupCallbackUri:g,redirectAuthCodeChallenge:f,redirectAuthInitiator:p,ssoQueryParams:m}=c(this.flowId,this.loggerWrapper);window.addEventListener("popstate",t(this,F,"f").popstate),window.addEventListener("components-context",t(this,F,"f").componentsContext),t(this,W,"f").subscribe(t(this,S,"m",q).bind(this)),t(this,W,"f").update(Object.assign({projectId:this.projectId,flowId:this.flowId,baseUrl:this.baseUrl,tenant:this.tenantId,redirectUrl:this.redirectUrl,locale:this.locale,stepId:n,executionId:r,token:a,code:u,isPopup:l,exchangeError:d,redirectAuthCallbackUrl:h,redirectAuthBackupCallbackUri:g,redirectAuthCodeChallenge:f,redirectAuthInitiator:p},m)),i(this,U,!0,"f")}))}disconnectedCallback(){var e;t(this,W,"f").unsubscribeAll(),t(this,D,"f").unsubscribeAll(),t(this,S,"m",G).call(this),window.removeEventListener("popstate",t(this,F,"f").popstate),window.removeEventListener("components-context",t(this,F,"f").componentsContext),null===(e=super.disconnectedCallback)||void 0===e||e.call(this)}attributeChangedCallback(e,i,o){var s;if(null===(s=super.attributeChangedCallback)||void 0===s||s.call(this,e,i,o),this.shadowRoot.isConnected&&t(this,U,"f")&&i!==o&&L.observedAttributes.includes(e)){t(this,S,"m",J).call(this);const s=null===i;t(this,W,"f").update((({stepId:t,executionId:i})=>{let r=t,n=i;return s||(n=null,r=null,h()),{[g(e)]:o,stepId:r,executionId:n}})),t(this,D,"f").update({isDebug:this.debug})}}}L=_,U=new WeakMap,O=new WeakMap,W=new WeakMap,D=new WeakMap,P=new WeakMap,N=new WeakMap,F=new WeakMap,T=new WeakMap,S=new WeakSet,K=function(){this.injectStyle("\n :host {\n\t\t\twidth: 100%;\n display: block;\n\t\t}\n\n\t\t#root {\n\t\t\theight: 100%;\n display: flex;\n flex-direction: column;\n\t\t}\n\n #content-root {\n all: initial;\n transition: opacity 200ms ease-in-out;\n }\n\n\t\t#root[data-theme] {\n\t\t\tbackground-color: transparent;\n\t\t}\n\n\t\t.fade-out {\n\t\t\topacity: 0.1!important;\n\t\t}\n\n .hidden {\n display: none;\n }\n ")},R=function(){t(this,S,"m",K).call(this),this.slotElement=document.createElement("slot"),this.slotElement.classList.add("hidden"),this.rootElement.appendChild(this.slotElement)},J=function(){const t=["base-url","tenant","locale","debug","redirect-url","auto-focus","store-last-authenticated-user","refresh-cookie-name","keep-last-authenticated-user-after-logout","preview","storage-prefix","form","client","validate-on-blur","send-session-token","style-id","outbound-app-id","outbound-app-scopes","theme-override"];L.observedAttributes.forEach((e=>{if(!t.includes(e)&&!this[g(e)])throw Error(`${e} cannot be empty`)}))},V=function(){const{stepId:e,executionId:i}=f(this.flowId);t(this,W,"f").update({stepId:e,executionId:i})},B=function(i,o){u&&"function"==typeof u||this.logger.error("SDK was not loaded properly",u,JSON.stringify(u));const s=Object.assign(Object.assign({persistTokens:!0,preview:this.preview,storagePrefix:this.storagePrefix,storeLastAuthenticatedUser:this.storeLastAuthenticatedUser,keepLastAuthenticatedUserAfterLogout:this.keepLastAuthenticatedUserAfterLogout,refreshCookieName:this.refreshCookieName},L.sdkConfigOverrides),{projectId:i,baseUrl:o});t(this,O,"f")&&(s.customStorage=t(this,O,"f")),this.sdk=u(s);const r={start:1,next:7};["start","next"].forEach((i=>{const o=this.sdk.flow[i],s=b(o,1e3,3);this.sdk.flow[i]=(...o)=>e(this,void 0,void 0,(function*(){const e=[...o],n=r[i],a=t(this,S,"m",H).call(this,e[n]);void 0!==a&&(e[n]=a);try{return yield s(...e)}catch(t){return this.logger.error(`Error in sdk flow ${i} function`,t),{error:{errorCode:M,errorDescription:t.toString()}}}}))}))},H=function(t){if(!this.sendSessionToken)return t;const e=null==l?void 0:l(this.storagePrefix);return e?Object.assign(Object.assign({},null!=t?t:{}),{sessionJwt:e}):t},q=function(i,o,s){return e(this,void 0,void 0,(function*(){const{projectId:e,baseUrl:o}=i;if(s("projectId")||s("baseUrl")){if(!e)return;t(this,S,"m",B).call(this,e,o)}t(this,T,"f").call(this,i)}))},$=function(){return e(this,void 0,void 0,(function*(){const e=yield this.getConfig();return"isMissingConfig"in e&&e.isMissingConfig&&(yield t(this,S,"m",z).call(this))}))},z=function(){return e(this,void 0,void 0,(function*(){const t=p({projectId:this.projectId,filename:I,assetsFolder:E,baseUrl:this.baseStaticUrl});try{return yield m(t,"json"),!0}catch(t){return!1}}))},Q=function(e){i(this,P,Object.assign(Object.assign({},t(this,P,"f")),e.detail),"f")},G=function(){var e;null===(e=t(this,N,"f"))||void 0===e||e.remove(),i(this,N,null,"f")},X=function(o){return e(this,arguments,void 0,(function*({isDebug:e}){e?(i(this,N,document.createElement("descope-debugger"),"f"),Object.assign(t(this,N,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),yield import("../debugger-wc.js"),document.body.appendChild(t(this,N,"f"))):t(this,S,"m",G).call(this)}))},Y=function(e,i){var o;e&&this.debug&&(null===(o=t(this,N,"f"))||void 0===o||o.updateData({title:e,description:i}))},_.sdkConfigOverrides={baseHeaders:{"x-descope-sdk-name":"web-component","x-descope-sdk-version":"4.3.0"}};export{_ as default};
|
|
1
|
+
import{__classPrivateFieldGet as t,__awaiter as e,__classPrivateFieldSet as i}from"tslib";import{compose as o}from"@descope/sdk-helpers";import{staticResourcesMixin as s}from"@descope/sdk-mixins/static-resources-mixin";import{themeMixin as r}from"@descope/sdk-mixins/theme-mixin";import{injectStyleMixin as n}from"@descope/sdk-mixins/inject-style-mixin";import{telemetryMixin as a}from"@descope/sdk-mixins/telemetry-mixin";import{createSdk as u,getSessionToken as l}from"@descope/web-js-sdk";import{ELEMENTS_TO_IGNORE_ENTER_KEY_ON as d}from"../constants/index.js";import{handleUrlParams as c,clearRunIdsFromUrl as h,camelCase as g,getRunIdsFromUrl as f,getContentUrl as p,fetchContent as m,withRetry as b}from"../helpers/helpers.js";import v from"../helpers/state.js";import"@descope/escape-markdown";import"../helpers/webauthn.js";import{setCustomStorage as w}from"../helpers/storage.js";import{transformFlowInputFormData as k,extractNestedAttribute as C}from"../helpers/flowInputs.js";import{formMountMixin as x}from"../mixins/formMountMixin.js";import{componentConditionsMixin as y}from"../mixins/componentConditionsMixin.js";import{duplicateFlowWarningMixin as A}from"../mixins/duplicateFlowWarningMixin.js";import{passwordManagerMixin as j}from"../mixins/passwordManagerMixin.js";import{CONFIG_FILENAME as I,PREV_VER_ASSETS_FOLDER as E}from"../constants/content.js";import{FETCH_EXCEPTION_ERROR_CODE as M}from"../constants/general.js";var S,L,U,O,W,D,P,N,F,T,K,R,J,V,B,H,q,$,z,Q,G,X,Y;const Z=o(r,s,x,y,A,j,n,a)(HTMLElement);class _ extends Z{static get observedAttributes(){return["project-id","flow-id","base-url","tenant","locale","debug","storage-prefix","preview","redirect-url","auto-focus","store-last-authenticated-user","refresh-cookie-name","keep-last-authenticated-user-after-logout","validate-on-blur","send-session-token","style-id"]}constructor(o){super(),S.add(this),this.sdkVersion="4.3.2",U.set(this,!1),O.set(this,void 0),this.flowStatus="initial",this.loggerWrapper={error:(e,i="")=>{this.logger.error(e,i,new Error),t(this,S,"m",Y).call(this,e,i)},warn:(t,e="")=>{this.logger.warn(t,e)},info:(t,e="",i={})=>{this.logger.info(t,e,i)},debug:(t,e="")=>{this.logger.debug(t,e)}},W.set(this,new v),D.set(this,new v),P.set(this,{}),this.getComponentsContext=()=>t(this,P,"f"),this.nextRequestStatus=new v({isLoading:!1}),N.set(this,void 0),F.set(this,{popstate:t(this,S,"m",V).bind(this),componentsContext:t(this,S,"m",Q).bind(this)}),T.set(this,void 0),this.getConfig=()=>e(this,void 0,void 0,(function*(){return(yield this.config)||{isMissingConfig:!0}})),i(this,T,o,"f"),t(this,S,"m",R).call(this)}get client(){try{return JSON.parse(this.getAttribute("client"))||{}}catch(t){return{}}}get redirectUrl(){return this.getAttribute("redirect-url")||void 0}get debug(){return"true"===this.getAttribute("debug")}get locale(){return this.getAttribute("locale")||void 0}get autoFocus(){var t;const e=null!==(t=this.getAttribute("auto-focus"))&&void 0!==t?t:"true";return"skipFirstScreen"===e?e:"true"===e}get validateOnBlur(){return"true"===this.getAttribute("validate-on-blur")}get storeLastAuthenticatedUser(){var t;return"true"===(null!==(t=this.getAttribute("store-last-authenticated-user"))&&void 0!==t?t:"true")}get refreshCookieName(){return this.getAttribute("refresh-cookie-name")||""}get keepLastAuthenticatedUserAfterLogout(){return"true"===this.getAttribute("keep-last-authenticated-user-after-logout")}get storagePrefix(){return this.getAttribute("storage-prefix")||""}get sendSessionToken(){return"true"===this.getAttribute("send-session-token")}get preview(){return!!this.getAttribute("preview")}get formConfig(){return k(this.form)}get form(){return this.getAttribute("form")}get formConfigValues(){return C(this.formConfig,"value")}get outboundAppId(){return this.getAttribute("outbound-app-id")}get outboundAppScopes(){try{const t=JSON.parse(this.getAttribute("outbound-app-scopes"));return t||null}catch(t){return null}}get popupOrigin(){return this.getAttribute("popup-origin")}get customStorage(){return t(this,O,"f")}set customStorage(t){if(t&&"function"!=typeof t.getItem)throw new Error("Custom storage must have a getItem method");if(t&&"function"!=typeof t.setItem)throw new Error("Custom storage must have a setItem method");if(t&&"function"!=typeof t.removeItem)throw new Error("Custom storage must have a removeItem method");i(this,O,t,"f"),w(t)}get isRestartOnError(){return"true"===this.getAttribute("restart-on-error")}getExecutionContext(){return e(this,void 0,void 0,(function*(){const t=yield this.getConfig();return"executionContext"in t?t.executionContext:void 0}))}getProjectConfig(){return e(this,void 0,void 0,(function*(){const t=yield this.getConfig();return"projectConfig"in t?t.projectConfig:void 0}))}getFlowConfig(){return e(this,void 0,void 0,(function*(){var t,e;const i=yield this.getProjectConfig(),o=(null===(t=null==i?void 0:i.flows)||void 0===t?void 0:t[this.flowId])||{};return null!==(e=o.version)&&void 0!==e||(o.version=0),o}))}getTargetLocales(){return e(this,void 0,void 0,(function*(){const t=yield this.getFlowConfig();return((null==t?void 0:t.targetLocales)||[]).map((t=>t.toLowerCase()))}))}handleKeyPress(){this.logger.debug("Enable key press handler"),this.rootElement.onkeydown=t=>{var e,i,o;const s=!!(null===(e=this.shadowRoot.activeElement)||void 0===e?void 0:e.getAttribute("href")),r=d.includes(null!==(o=null===(i=this.shadowRoot.activeElement)||void 0===i?void 0:i.localName)&&void 0!==o?o:"");if("Enter"!==t.key||s||r)return;t.preventDefault();const n=this.rootElement.querySelectorAll("descope-button");if(1===n.length&&"false"!==n[0].getAttribute("auto-submit"))return void n[0].click();const a=Array.from(n).filter((t=>"true"===t.getAttribute("auto-submit")));if(1===a.length)return void a[0].click();const u=Array.from(n).filter((t=>"button"===t.getAttribute("data-type")));if(1===u.length)"false"!==u[0].getAttribute("auto-submit")&&u[0].click();else if(0===u.length){const t=Array.from(n).filter((t=>"sso"===t.getAttribute("data-type")));1===t.length&&"false"!==t[0].getAttribute("auto-submit")&&t[0].click()}}}disableKeyPressHandler(){this.logger.debug("Disable key press handler"),this.rootElement.onkeydown=null}getComponentsVersion(){return e(this,void 0,void 0,(function*(){var t;const e=yield this.getConfig(),i="projectConfig"in e?null===(t=e.projectConfig)||void 0===t?void 0:t.componentsVersion:{};return i||(this.logger.error("Did not get components version, using latest version"),"latest")}))}init(){const o=Object.create(null,{init:{get:()=>super.init}});return e(this,void 0,void 0,(function*(){var e;if(this.flowStatus="loading",["ready","error","success"].forEach((t=>this.addEventListener(t,(()=>{this.flowStatus=t})))),yield null===(e=o.init)||void 0===e?void 0:e.call(this),t(this,D,"f").subscribe(t(this,S,"m",X).bind(this)),t(this,D,"f").update({isDebug:this.debug}),t(this,S,"m",J).call(this),yield t(this,S,"m",$).call(this))return void this.loggerWrapper.error("This SDK version does not support your flows version","Make sure to upgrade your flows to the latest version or use an older SDK version");const s=yield this.getConfig();if("isMissingConfig"in s&&s.isMissingConfig)return void this.loggerWrapper.error("Cannot get config file","Make sure that your projectId & flowId are correct");const{executionId:r,stepId:n,token:a,code:u,isPopup:l,exchangeError:d,redirectAuthCallbackUrl:h,redirectAuthBackupCallbackUri:g,redirectAuthCodeChallenge:f,redirectAuthInitiator:p,ssoQueryParams:m}=c(this.flowId,this.loggerWrapper);window.addEventListener("popstate",t(this,F,"f").popstate),window.addEventListener("components-context",t(this,F,"f").componentsContext),t(this,W,"f").subscribe(t(this,S,"m",q).bind(this)),t(this,W,"f").update(Object.assign({projectId:this.projectId,flowId:this.flowId,baseUrl:this.baseUrl,tenant:this.tenantId,redirectUrl:this.redirectUrl,locale:this.locale,stepId:n,executionId:r,token:a,code:u,isPopup:l,exchangeError:d,redirectAuthCallbackUrl:h,redirectAuthBackupCallbackUri:g,redirectAuthCodeChallenge:f,redirectAuthInitiator:p},m)),i(this,U,!0,"f")}))}disconnectedCallback(){var e;t(this,W,"f").unsubscribeAll(),t(this,D,"f").unsubscribeAll(),t(this,S,"m",G).call(this),window.removeEventListener("popstate",t(this,F,"f").popstate),window.removeEventListener("components-context",t(this,F,"f").componentsContext),null===(e=super.disconnectedCallback)||void 0===e||e.call(this)}attributeChangedCallback(e,i,o){var s;if(null===(s=super.attributeChangedCallback)||void 0===s||s.call(this,e,i,o),this.shadowRoot.isConnected&&t(this,U,"f")&&i!==o&&L.observedAttributes.includes(e)){t(this,S,"m",J).call(this);const s=null===i;t(this,W,"f").update((({stepId:t,executionId:i})=>{let r=t,n=i;return s||(n=null,r=null,h()),{[g(e)]:o,stepId:r,executionId:n}})),t(this,D,"f").update({isDebug:this.debug})}}}L=_,U=new WeakMap,O=new WeakMap,W=new WeakMap,D=new WeakMap,P=new WeakMap,N=new WeakMap,F=new WeakMap,T=new WeakMap,S=new WeakSet,K=function(){this.injectStyle("\n :host {\n\t\t\twidth: 100%;\n display: block;\n\t\t}\n\n\t\t#root {\n\t\t\theight: 100%;\n display: flex;\n flex-direction: column;\n\t\t}\n\n #content-root {\n all: initial;\n transition: opacity 200ms ease-in-out;\n }\n\n\t\t#root[data-theme] {\n\t\t\tbackground-color: transparent;\n\t\t}\n\n\t\t.fade-out {\n\t\t\topacity: 0.1!important;\n\t\t}\n\n .hidden {\n display: none;\n }\n ")},R=function(){t(this,S,"m",K).call(this),this.slotElement=document.createElement("slot"),this.slotElement.classList.add("hidden"),this.rootElement.appendChild(this.slotElement)},J=function(){const t=["base-url","tenant","locale","debug","redirect-url","auto-focus","store-last-authenticated-user","refresh-cookie-name","keep-last-authenticated-user-after-logout","preview","storage-prefix","form","client","validate-on-blur","send-session-token","style-id","outbound-app-id","outbound-app-scopes","theme-override"];L.observedAttributes.forEach((e=>{if(!t.includes(e)&&!this[g(e)])throw Error(`${e} cannot be empty`)}))},V=function(){const{stepId:e,executionId:i}=f(this.flowId);t(this,W,"f").update({stepId:e,executionId:i})},B=function(i,o){u&&"function"==typeof u||this.logger.error("SDK was not loaded properly",u,JSON.stringify(u));const s=Object.assign(Object.assign({persistTokens:!0,preview:this.preview,storagePrefix:this.storagePrefix,storeLastAuthenticatedUser:this.storeLastAuthenticatedUser,keepLastAuthenticatedUserAfterLogout:this.keepLastAuthenticatedUserAfterLogout,refreshCookieName:this.refreshCookieName},L.sdkConfigOverrides),{projectId:i,baseUrl:o});t(this,O,"f")&&(s.customStorage=t(this,O,"f")),this.sdk=u(s);const r={start:1,next:7};["start","next"].forEach((i=>{const o=this.sdk.flow[i],s=b(o,1e3,3);this.sdk.flow[i]=(...o)=>e(this,void 0,void 0,(function*(){const e=[...o],n=r[i],a=t(this,S,"m",H).call(this,e[n]);void 0!==a&&(e[n]=a);try{return yield s(...e)}catch(t){return this.logger.error(`Error in sdk flow ${i} function`,t),{error:{errorCode:M,errorDescription:t.toString()}}}}))}))},H=function(t){if(!this.sendSessionToken)return t;const e=null==l?void 0:l(this.storagePrefix);return e?Object.assign(Object.assign({},null!=t?t:{}),{sessionJwt:e}):t},q=function(i,o,s){return e(this,void 0,void 0,(function*(){const{projectId:e,baseUrl:o}=i;if(s("projectId")||s("baseUrl")){if(!e)return;t(this,S,"m",B).call(this,e,o)}t(this,T,"f").call(this,i)}))},$=function(){return e(this,void 0,void 0,(function*(){const e=yield this.getConfig();return"isMissingConfig"in e&&e.isMissingConfig&&(yield t(this,S,"m",z).call(this))}))},z=function(){return e(this,void 0,void 0,(function*(){const t=p({projectId:this.projectId,filename:I,assetsFolder:E,baseUrl:this.baseStaticUrl});try{return yield m(t,"json"),!0}catch(t){return!1}}))},Q=function(e){i(this,P,Object.assign(Object.assign({},t(this,P,"f")),e.detail),"f")},G=function(){var e;null===(e=t(this,N,"f"))||void 0===e||e.remove(),i(this,N,null,"f")},X=function(o){return e(this,arguments,void 0,(function*({isDebug:e}){e?(i(this,N,document.createElement("descope-debugger"),"f"),Object.assign(t(this,N,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),yield import("../debugger-wc.js"),document.body.appendChild(t(this,N,"f"))):t(this,S,"m",G).call(this)}))},Y=function(e,i){var o;e&&this.debug&&(null===(o=t(this,N,"f"))||void 0===o||o.updateData({title:e,description:i}))},_.sdkConfigOverrides={baseHeaders:{"x-descope-sdk-name":"web-component","x-descope-sdk-version":"4.3.2"}};export{_ as default};
|
|
2
2
|
//# sourceMappingURL=BaseDescopeWc.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -433,18 +433,18 @@ interface PasswordManagerHost {
|
|
|
433
433
|
}
|
|
434
434
|
|
|
435
435
|
declare const BaseClass: (new (...args: any) => {
|
|
436
|
-
"__#
|
|
437
|
-
"__#
|
|
438
|
-
"__#
|
|
439
|
-
"__#
|
|
436
|
+
"__#42399@#telemetryManager": any;
|
|
437
|
+
"__#42399@#telemetryInitialized": boolean;
|
|
438
|
+
"__#42399@#expirationTimeoutId": NodeJS.Timeout;
|
|
439
|
+
"__#42399@#initializeTelemetry"(config: _descope_sdk_mixins_static_resources_mixin.TelemetryConfig, context: {
|
|
440
440
|
projectId: string;
|
|
441
441
|
flowId?: string;
|
|
442
442
|
sdkVersion?: string;
|
|
443
443
|
}): Promise<void>;
|
|
444
|
-
"__#
|
|
445
|
-
"__#
|
|
444
|
+
"__#42399@#scheduleExpirationShutdown"(expirationMs: number): void;
|
|
445
|
+
"__#42399@#shutdownTelemetry"(): void;
|
|
446
446
|
readonly telemetryManager: any;
|
|
447
|
-
"__#
|
|
447
|
+
"__#42399@#isRumConfigComplete"(rumConfig?: {
|
|
448
448
|
sessionSampleRate: number;
|
|
449
449
|
applicationId: string;
|
|
450
450
|
identityPoolId: string;
|
|
@@ -452,8 +452,8 @@ declare const BaseClass: (new (...args: any) => {
|
|
|
452
452
|
region: string;
|
|
453
453
|
endpoint?: string;
|
|
454
454
|
}): boolean;
|
|
455
|
-
"__#
|
|
456
|
-
"__#
|
|
455
|
+
"__#42399@#getTelemetryConfig"(): Promise<_descope_sdk_mixins_static_resources_mixin.TelemetryConfig>;
|
|
456
|
+
"__#42399@#resolveCapture"(beCapture: {
|
|
457
457
|
console?: boolean | {
|
|
458
458
|
levels?: ("error" | "warn" | "info" | "debug" | "log")[];
|
|
459
459
|
};
|
|
@@ -479,16 +479,16 @@ declare const BaseClass: (new (...args: any) => {
|
|
|
479
479
|
};
|
|
480
480
|
};
|
|
481
481
|
updateTelemetryContext(context: Record<string, any>): void;
|
|
482
|
-
"__#
|
|
482
|
+
"__#42399@#telemetryReady": Promise<void>;
|
|
483
483
|
init(): Promise<void>;
|
|
484
484
|
readonly telemetryReady: Promise<void>;
|
|
485
485
|
disconnectedCallback(): void;
|
|
486
486
|
readonly flowId: string;
|
|
487
|
-
"__#
|
|
488
|
-
"__#
|
|
487
|
+
"__#42383@#handleError": ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void);
|
|
488
|
+
"__#42382@#observeMappings": {};
|
|
489
489
|
observeAttribute: ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any);
|
|
490
490
|
observeAttributes: ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void);
|
|
491
|
-
"__#
|
|
491
|
+
"__#42381@#isInit": boolean;
|
|
492
492
|
connectedCallback: (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void);
|
|
493
493
|
accessKey: string;
|
|
494
494
|
readonly accessKeyLabel: string;
|
|
@@ -815,28 +815,28 @@ declare const BaseClass: (new (...args: any) => {
|
|
|
815
815
|
tabIndex: number;
|
|
816
816
|
blur(): void;
|
|
817
817
|
focus(options?: FocusOptions): void;
|
|
818
|
-
"__#
|
|
819
|
-
"__#
|
|
818
|
+
"__#42380@#logger": _descope_sdk_mixins_static_resources_mixin.Logger;
|
|
819
|
+
"__#42380@#wrapLogger": ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger);
|
|
820
820
|
get logger(): _descope_sdk_mixins_static_resources_mixin.Logger;
|
|
821
821
|
set logger(logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>);
|
|
822
822
|
onLogEvent: ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void);
|
|
823
823
|
readonly projectId: string;
|
|
824
824
|
readonly config: Promise<_descope_sdk_mixins_static_resources_mixin.Config>;
|
|
825
|
-
"__#
|
|
826
|
-
"__#
|
|
827
|
-
"__#
|
|
828
|
-
"__#
|
|
825
|
+
"__#42386@#configCacheClear"(): void;
|
|
826
|
+
"__#42386@#_configResource": Promise<_descope_sdk_mixins_static_resources_mixin.Config>;
|
|
827
|
+
"__#42386@#fetchConfig": () => Promise<_descope_sdk_mixins_static_resources_mixin.Config>;
|
|
828
|
+
"__#42385@#callbacks": Map<string, () => void>;
|
|
829
829
|
onReset(sectionId: string, callback: () => void | Promise<void>): () => void;
|
|
830
830
|
reset(...sectionIds: string[]): Promise<void>;
|
|
831
|
-
"__#
|
|
832
|
-
"__#
|
|
833
|
-
"__#
|
|
834
|
-
"__#
|
|
831
|
+
"__#42384@#lastBaseUrl"?: string;
|
|
832
|
+
"__#42384@#workingBaseUrl"?: string;
|
|
833
|
+
"__#42384@#failedUrls": Set<string>;
|
|
834
|
+
"__#42384@#getResourceUrls"(filename: string): (URL & {
|
|
835
835
|
baseUrl: string;
|
|
836
836
|
}) | (URL & {
|
|
837
837
|
baseUrl: string;
|
|
838
838
|
})[];
|
|
839
|
-
"__#
|
|
839
|
+
"__#42384@#createResourceUrl"(filename: string, baseUrl: string): URL & {
|
|
840
840
|
baseUrl: string;
|
|
841
841
|
};
|
|
842
842
|
fetchStaticResource<F extends "text" | "json">(filename: string, format: F): Promise<{
|
|
@@ -861,12 +861,12 @@ declare const BaseClass: (new (...args: any) => {
|
|
|
861
861
|
readonly cssRules: CSSRuleList;
|
|
862
862
|
} | CSSStyleSheet;
|
|
863
863
|
nonce: string;
|
|
864
|
-
"__#
|
|
864
|
+
"__#42387@#setNonce"(): void;
|
|
865
865
|
init(): Promise<void>;
|
|
866
|
-
"__#
|
|
866
|
+
"__#42382@#observeMappings": {};
|
|
867
867
|
observeAttribute(attrName: string, onAttrChange: (attrName: string, value: string) => void): () => any;
|
|
868
868
|
observeAttributes(attrs: string[], cb: (attrName: string, value: string) => void): () => void;
|
|
869
|
-
"__#
|
|
869
|
+
"__#42381@#isInit": boolean;
|
|
870
870
|
connectedCallback: (() => void) & (() => void) & (() => void);
|
|
871
871
|
accessKey: string;
|
|
872
872
|
readonly accessKeyLabel: string;
|
|
@@ -1193,8 +1193,8 @@ declare const BaseClass: (new (...args: any) => {
|
|
|
1193
1193
|
tabIndex: number;
|
|
1194
1194
|
blur(): void;
|
|
1195
1195
|
focus(options?: FocusOptions): void;
|
|
1196
|
-
"__#
|
|
1197
|
-
"__#
|
|
1196
|
+
"__#42380@#logger": _descope_sdk_mixins_static_resources_mixin.Logger;
|
|
1197
|
+
"__#42380@#wrapLogger"(logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>): _descope_sdk_mixins_static_resources_mixin.Logger;
|
|
1198
1198
|
get logger(): _descope_sdk_mixins_static_resources_mixin.Logger;
|
|
1199
1199
|
set logger(logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>);
|
|
1200
1200
|
onLogEvent(logLevel: "error" | "warn" | "info" | "debug", data: any[]): void;
|
|
@@ -1207,8 +1207,8 @@ declare const BaseClass: (new (...args: any) => {
|
|
|
1207
1207
|
updateUsernameAnchor(): void;
|
|
1208
1208
|
captureLastSubmittedLoginId(formData?: {}, responseExecutionId?: string): void;
|
|
1209
1209
|
storeCredentials(formData?: {}): void;
|
|
1210
|
-
"__#
|
|
1211
|
-
"__#
|
|
1210
|
+
"__#42380@#logger": _descope_sdk_mixins_static_resources_mixin.Logger;
|
|
1211
|
+
"__#42380@#wrapLogger"(logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>): _descope_sdk_mixins_static_resources_mixin.Logger;
|
|
1212
1212
|
get logger(): _descope_sdk_mixins_static_resources_mixin.Logger;
|
|
1213
1213
|
set logger(logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>);
|
|
1214
1214
|
onLogEvent(logLevel: "error" | "warn" | "info" | "debug", data: any[]): void;
|
|
@@ -1609,8 +1609,8 @@ declare const BaseClass: (new (...args: any) => {
|
|
|
1609
1609
|
"__#10@#scheduleDuplicateFlowCheck"(): void;
|
|
1610
1610
|
connectedCallback(): void;
|
|
1611
1611
|
attributeChangedCallback(attrName: string, oldValue: string, newValue: string): void;
|
|
1612
|
-
"__#
|
|
1613
|
-
"__#
|
|
1612
|
+
"__#42380@#logger": _descope_sdk_mixins_static_resources_mixin.Logger;
|
|
1613
|
+
"__#42380@#wrapLogger"(logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>): _descope_sdk_mixins_static_resources_mixin.Logger;
|
|
1614
1614
|
get logger(): _descope_sdk_mixins_static_resources_mixin.Logger;
|
|
1615
1615
|
set logger(logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>);
|
|
1616
1616
|
onLogEvent(logLevel: "error" | "warn" | "info" | "debug", data: any[]): void;
|
|
@@ -2012,8 +2012,8 @@ declare const BaseClass: (new (...args: any) => {
|
|
|
2012
2012
|
"__#9@#reEvaluateRealtime"(): void;
|
|
2013
2013
|
disconnectedCallback(): void;
|
|
2014
2014
|
"__#9@#teardownRealtimeRuntime"(): void;
|
|
2015
|
-
"__#
|
|
2016
|
-
"__#
|
|
2015
|
+
"__#42380@#logger": _descope_sdk_mixins_static_resources_mixin.Logger;
|
|
2016
|
+
"__#42380@#wrapLogger"(logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>): _descope_sdk_mixins_static_resources_mixin.Logger;
|
|
2017
2017
|
get logger(): _descope_sdk_mixins_static_resources_mixin.Logger;
|
|
2018
2018
|
set logger(logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>);
|
|
2019
2019
|
onLogEvent(logLevel: "error" | "warn" | "info" | "debug", data: any[]): void;
|
|
@@ -2740,15 +2740,15 @@ declare const BaseClass: (new (...args: any) => {
|
|
|
2740
2740
|
focus(options?: FocusOptions): void;
|
|
2741
2741
|
};
|
|
2742
2742
|
} & (new (...params: any[]) => {
|
|
2743
|
-
"__#
|
|
2744
|
-
"__#
|
|
2745
|
-
"__#
|
|
2746
|
-
"__#
|
|
2743
|
+
"__#42384@#lastBaseUrl"?: string;
|
|
2744
|
+
"__#42384@#workingBaseUrl"?: string;
|
|
2745
|
+
"__#42384@#failedUrls": Set<string>;
|
|
2746
|
+
"__#42384@#getResourceUrls"(filename: string): (URL & {
|
|
2747
2747
|
baseUrl: string;
|
|
2748
2748
|
}) | (URL & {
|
|
2749
2749
|
baseUrl: string;
|
|
2750
2750
|
})[];
|
|
2751
|
-
"__#
|
|
2751
|
+
"__#42384@#createResourceUrl"(filename: string, baseUrl: string): URL & {
|
|
2752
2752
|
baseUrl: string;
|
|
2753
2753
|
};
|
|
2754
2754
|
fetchStaticResource<F_1 extends "text" | "json">(filename: string, format: F_1): Promise<{
|
|
@@ -3085,43 +3085,43 @@ declare const BaseClass: (new (...args: any) => {
|
|
|
3085
3085
|
blur(): void;
|
|
3086
3086
|
focus(options?: FocusOptions): void;
|
|
3087
3087
|
readonly projectId: string;
|
|
3088
|
-
"__#
|
|
3088
|
+
"__#42383@#handleError"(attrName: string, newValue: string): void;
|
|
3089
3089
|
init(): Promise<void>;
|
|
3090
|
-
"__#
|
|
3090
|
+
"__#42382@#observeMappings": {};
|
|
3091
3091
|
observeAttribute(attrName: string, onAttrChange: (attrName: string, value: string) => void): () => any;
|
|
3092
3092
|
observeAttributes(attrs: string[], cb: (attrName: string, value: string) => void): () => void;
|
|
3093
|
-
"__#
|
|
3094
|
-
"__#
|
|
3095
|
-
"__#
|
|
3093
|
+
"__#42381@#isInit": boolean;
|
|
3094
|
+
"__#42380@#logger": _descope_sdk_mixins_static_resources_mixin.Logger;
|
|
3095
|
+
"__#42380@#wrapLogger": ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger);
|
|
3096
3096
|
get logger(): _descope_sdk_mixins_static_resources_mixin.Logger;
|
|
3097
3097
|
set logger(logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>);
|
|
3098
3098
|
onLogEvent: ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void);
|
|
3099
3099
|
}) & (new (...params: any[]) => {
|
|
3100
|
-
"__#
|
|
3101
|
-
"__#
|
|
3102
|
-
"__#
|
|
3100
|
+
"__#42397@#globalStyle": _descope_sdk_mixins_static_resources_mixin.InjectedStyle;
|
|
3101
|
+
"__#42397@#tenantStyle": _descope_sdk_mixins_static_resources_mixin.InjectedStyle;
|
|
3102
|
+
"__#42397@#customStyle": _descope_sdk_mixins_static_resources_mixin.InjectedStyle;
|
|
3103
3103
|
readonly theme: _descope_sdk_mixins_static_resources_mixin.ThemeOptions;
|
|
3104
3104
|
readonly styleId: string;
|
|
3105
3105
|
readonly themeOverride: Record<string, any>;
|
|
3106
|
-
"__#
|
|
3107
|
-
"__#
|
|
3108
|
-
"__#
|
|
3109
|
-
"__#
|
|
3110
|
-
readonly "__#
|
|
3111
|
-
"__#
|
|
3112
|
-
"__#
|
|
3113
|
-
readonly "__#
|
|
3114
|
-
"__#
|
|
3115
|
-
"__#
|
|
3116
|
-
"__#
|
|
3117
|
-
"__#
|
|
3106
|
+
"__#42397@#getThemeOverrideString"(): string;
|
|
3107
|
+
"__#42397@#_themeResource": Promise<void | Record<string, any>>;
|
|
3108
|
+
"__#42397@#_tenantThemeResource": Promise<Record<string, any>>;
|
|
3109
|
+
"__#42397@#fetchTheme"(): Promise<Record<string, any>>;
|
|
3110
|
+
readonly "__#42397@#themeResource": Promise<void | Record<string, any>>;
|
|
3111
|
+
"__#42397@#loadGlobalStyle"(): Promise<void>;
|
|
3112
|
+
"__#42397@#fetchTenantTheme"(): Promise<Record<string, any>>;
|
|
3113
|
+
readonly "__#42397@#tenantThemeResource": Promise<Record<string, any>>;
|
|
3114
|
+
"__#42397@#loadTenantStyle"(): Promise<void>;
|
|
3115
|
+
"__#42397@#loadCustomStyle"(): Promise<void>;
|
|
3116
|
+
"__#42397@#loadComponentsStyle"(): Promise<void>;
|
|
3117
|
+
"__#42397@#getFontsConfig"(): Promise<Record<string, {
|
|
3118
3118
|
url?: string;
|
|
3119
3119
|
}>>;
|
|
3120
|
-
"__#
|
|
3121
|
-
"__#
|
|
3122
|
-
"__#
|
|
3123
|
-
"__#
|
|
3124
|
-
"__#
|
|
3120
|
+
"__#42397@#loadFonts"(): Promise<void>;
|
|
3121
|
+
"__#42397@#applyTheme"(): Promise<void>;
|
|
3122
|
+
"__#42397@#onThemeChange": () => void;
|
|
3123
|
+
"__#42397@#loadTheme"(): void;
|
|
3124
|
+
"__#42397@#toggleOsThemeChangeListener": (listen: boolean) => void;
|
|
3125
3125
|
init(): Promise<void>;
|
|
3126
3126
|
injectStyle: ((cssString: string, { prepend }?: {
|
|
3127
3127
|
prepend?: boolean;
|
|
@@ -3139,11 +3139,11 @@ declare const BaseClass: (new (...args: any) => {
|
|
|
3139
3139
|
readonly cssRules: CSSRuleList;
|
|
3140
3140
|
});
|
|
3141
3141
|
nonce: string;
|
|
3142
|
-
"__#
|
|
3143
|
-
"__#
|
|
3142
|
+
"__#42387@#setNonce": (() => void) & (() => void);
|
|
3143
|
+
"__#42382@#observeMappings": {};
|
|
3144
3144
|
observeAttribute: ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any);
|
|
3145
3145
|
observeAttributes: ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void);
|
|
3146
|
-
"__#
|
|
3146
|
+
"__#42381@#isInit": boolean;
|
|
3147
3147
|
connectedCallback: (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void);
|
|
3148
3148
|
accessKey: string;
|
|
3149
3149
|
readonly accessKeyLabel: string;
|
|
@@ -3470,25 +3470,25 @@ declare const BaseClass: (new (...args: any) => {
|
|
|
3470
3470
|
tabIndex: number;
|
|
3471
3471
|
blur(): void;
|
|
3472
3472
|
focus(options?: FocusOptions): void;
|
|
3473
|
-
"__#
|
|
3474
|
-
"__#
|
|
3473
|
+
"__#42380@#logger": _descope_sdk_mixins_static_resources_mixin.Logger;
|
|
3474
|
+
"__#42380@#wrapLogger": ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger);
|
|
3475
3475
|
get logger(): _descope_sdk_mixins_static_resources_mixin.Logger;
|
|
3476
3476
|
set logger(logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>);
|
|
3477
3477
|
onLogEvent: ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void);
|
|
3478
3478
|
contentRootElement: HTMLElement;
|
|
3479
3479
|
rootElement: HTMLElement;
|
|
3480
3480
|
readonly config: Promise<_descope_sdk_mixins_static_resources_mixin.Config>;
|
|
3481
|
-
"__#
|
|
3482
|
-
"__#
|
|
3483
|
-
"__#
|
|
3484
|
-
"__#
|
|
3481
|
+
"__#42386@#configCacheClear": (() => void) & (() => void);
|
|
3482
|
+
"__#42386@#_configResource": Promise<_descope_sdk_mixins_static_resources_mixin.Config>;
|
|
3483
|
+
"__#42386@#fetchConfig": (() => Promise<_descope_sdk_mixins_static_resources_mixin.Config>) & (() => Promise<_descope_sdk_mixins_static_resources_mixin.Config>);
|
|
3484
|
+
"__#42385@#callbacks": Map<string, () => void> & Map<string, () => void>;
|
|
3485
3485
|
onReset: ((sectionId: string, callback: () => void | Promise<void>) => () => void) & ((sectionId: string, callback: () => void | Promise<void>) => () => void);
|
|
3486
3486
|
reset: ((...sectionIds: string[]) => Promise<void>) & ((...sectionIds: string[]) => Promise<void>);
|
|
3487
|
-
"__#
|
|
3488
|
-
"__#
|
|
3489
|
-
"__#
|
|
3490
|
-
"__#
|
|
3491
|
-
"__#
|
|
3487
|
+
"__#42383@#handleError": ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void);
|
|
3488
|
+
"__#42384@#lastBaseUrl"?: string;
|
|
3489
|
+
"__#42384@#workingBaseUrl"?: string;
|
|
3490
|
+
"__#42384@#failedUrls": Set<string>;
|
|
3491
|
+
"__#42384@#getResourceUrls": ((filename: string) => (URL & {
|
|
3492
3492
|
baseUrl: string;
|
|
3493
3493
|
}) | (URL & {
|
|
3494
3494
|
baseUrl: string;
|
|
@@ -3501,7 +3501,7 @@ declare const BaseClass: (new (...args: any) => {
|
|
|
3501
3501
|
}) | (URL & {
|
|
3502
3502
|
baseUrl: string;
|
|
3503
3503
|
})[]);
|
|
3504
|
-
"__#
|
|
3504
|
+
"__#42384@#createResourceUrl": ((filename: string, baseUrl: string) => URL & {
|
|
3505
3505
|
baseUrl: string;
|
|
3506
3506
|
}) & ((filename: string, baseUrl: string) => URL & {
|
|
3507
3507
|
baseUrl: string;
|
|
@@ -3521,12 +3521,12 @@ declare const BaseClass: (new (...args: any) => {
|
|
|
3521
3521
|
readonly baseStaticUrl: string;
|
|
3522
3522
|
readonly baseUrl: string;
|
|
3523
3523
|
readonly projectId: string;
|
|
3524
|
-
"__#
|
|
3525
|
-
"__#
|
|
3526
|
-
"__#
|
|
3524
|
+
"__#42390@#getComponentsVersion"(): Promise<string>;
|
|
3525
|
+
"__#42390@#getComponentsVersionSri"(): Promise<string>;
|
|
3526
|
+
"__#42390@#descopeUi": Promise<any>;
|
|
3527
3527
|
readonly descopeUi: Promise<any>;
|
|
3528
|
-
"__#
|
|
3529
|
-
"__#
|
|
3528
|
+
"__#42390@#loadDescopeUiComponent"(componentName: string): Promise<any>;
|
|
3529
|
+
"__#42390@#getDescopeUi"(): Promise<any>;
|
|
3530
3530
|
loadDescopeUiComponents(templateOrComponentNames: string[] | HTMLTemplateElement): Promise<any[]>;
|
|
3531
3531
|
readonly baseCdnUrl: string;
|
|
3532
3532
|
injectNpmLib(libName: string, version: string, filePath?: string, overrides?: string[], integrity?: string): Promise<{
|