@strivacity/sdk-core 2.3.0 → 3.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +6 -2
  3. package/dist/flows/BaseFlow.cjs.map +1 -1
  4. package/dist/flows/BaseFlow.d.ts +1 -1
  5. package/dist/flows/BaseFlow.mjs.map +1 -1
  6. package/dist/flows/EmbeddedFlow.cjs +2 -0
  7. package/dist/flows/EmbeddedFlow.cjs.map +1 -0
  8. package/dist/flows/EmbeddedFlow.d.ts +25 -0
  9. package/dist/flows/EmbeddedFlow.mjs +2 -0
  10. package/dist/flows/EmbeddedFlow.mjs.map +1 -0
  11. package/dist/flows/NativeFlow.cjs +1 -1
  12. package/dist/flows/NativeFlow.cjs.map +1 -1
  13. package/dist/flows/NativeFlow.d.ts +1 -1
  14. package/dist/flows/NativeFlow.mjs +1 -1
  15. package/dist/flows/NativeFlow.mjs.map +1 -1
  16. package/dist/flows/PopupFlow.cjs +1 -1
  17. package/dist/flows/PopupFlow.cjs.map +1 -1
  18. package/dist/flows/PopupFlow.mjs +1 -1
  19. package/dist/flows/PopupFlow.mjs.map +1 -1
  20. package/dist/flows/RedirectFlow.cjs +1 -1
  21. package/dist/flows/RedirectFlow.cjs.map +1 -1
  22. package/dist/flows/RedirectFlow.mjs +1 -1
  23. package/dist/flows/RedirectFlow.mjs.map +1 -1
  24. package/dist/index.cjs +1 -1
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.ts +8 -4
  27. package/dist/index.mjs +1 -1
  28. package/dist/index.mjs.map +1 -1
  29. package/dist/types.cjs.map +1 -1
  30. package/dist/types.d.ts +42 -1
  31. package/dist/types.mjs.map +1 -1
  32. package/dist/utils/EmbeddedFlowHandler.cjs +2 -0
  33. package/dist/utils/EmbeddedFlowHandler.cjs.map +1 -0
  34. package/dist/utils/EmbeddedFlowHandler.d.ts +61 -0
  35. package/dist/utils/EmbeddedFlowHandler.mjs +2 -0
  36. package/dist/utils/EmbeddedFlowHandler.mjs.map +1 -0
  37. package/dist/utils/NativeFlowHandler.cjs +1 -1
  38. package/dist/utils/NativeFlowHandler.cjs.map +1 -1
  39. package/dist/utils/NativeFlowHandler.d.ts +1 -1
  40. package/dist/utils/NativeFlowHandler.mjs +1 -1
  41. package/dist/utils/NativeFlowHandler.mjs.map +1 -1
  42. package/dist/utils/errors.cjs +1 -1
  43. package/dist/utils/errors.cjs.map +1 -1
  44. package/dist/utils/errors.d.ts +12 -0
  45. package/dist/utils/errors.mjs +1 -1
  46. package/dist/utils/errors.mjs.map +1 -1
  47. package/dist/utils/handlers.cjs +1 -1
  48. package/dist/utils/handlers.cjs.map +1 -1
  49. package/dist/utils/handlers.d.ts +1 -3
  50. package/dist/utils/handlers.mjs +1 -1
  51. package/dist/utils/handlers.mjs.map +1 -1
  52. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"PopupFlow.cjs","sources":["../../src/flows/PopupFlow.ts"],"sourcesContent":["import type { SDKOptions, PopupParams, SDKStorage, SDKHttpClient, SDKLogging } from '../types';\nimport { popupCallbackHandler, popupUrlHandler } from '../utils/handlers';\nimport { State } from '../utils/State';\nimport { BaseFlow } from './BaseFlow';\n\n/**\n * Implements the Popup flow for authentication using a popup window.\n */\nexport class PopupFlow extends BaseFlow<SDKOptions, PopupParams> {\n\tconstructor(options: SDKOptions, storage: SDKStorage, httpClient: SDKHttpClient, logging?: SDKLogging) {\n\t\tif (!options.urlHandler) {\n\t\t\toptions.urlHandler = popupUrlHandler;\n\t\t}\n\t\tif (!options.callbackHandler) {\n\t\t\toptions.callbackHandler = popupCallbackHandler;\n\t\t}\n\n\t\tsuper(options, storage, httpClient, logging);\n\t}\n\n\t/**\n\t * Initiates the login process via a popup window.\n\t * @param {PopupParams} [params={}] Optional parameters for popup window configuration.\n\t * @returns {Promise<void>} A promise that resolves when the login process completes.\n\t *\n\t * @throws {Error} Throws an error if URL handler is not defined.\n\t */\n\tasync login(params: PopupParams = {}): Promise<void> {\n\t\tif (typeof this.options.urlHandler !== 'function') {\n\t\t\tconst error = new Error('Missing option: urlHandler');\n\t\t\tthis.logging?.error('Required option missing', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tconst state = await State.create();\n\t\tconst url = await this.getAuthorizationUrl(params);\n\n\t\turl.searchParams.append('state', state.id);\n\t\turl.searchParams.append('code_challenge', state.codeChallenge);\n\t\turl.searchParams.append('nonce', state.nonce);\n\t\turl.searchParams.append('display', 'popup');\n\n\t\tawait this.storage.set(`sty.${state.id}`, JSON.stringify(state));\n\n\t\tthis.dispatchEvent('loginInitiated', []);\n\t\tthis.logging?.debug('Attempting to redirect for login');\n\n\t\tconst data = (await this.options.urlHandler(url.toString(), params)) as Record<string, string>;\n\n\t\tawait this.tokenExchange(data);\n\t}\n\n\t/**\n\t * Initiates the registration process via a popup window.\n\t * @param {PopupParams} [params={}] Optional parameters for popup window configuration.\n\t * @returns {Promise<void>} A promise that resolves when the registration process completes.\n\t */\n\tasync register(params: PopupParams = {}): Promise<void> {\n\t\tparams.prompt = 'create';\n\n\t\tawait this.login(params);\n\t}\n\n\t/**\n\t * Initiates the entry process via a popup window.\n\t * @param {string} url Optional URL to use for the entry process. If not provided, the current window location will be used.\n\t * @returns {Promise<void>} A promise that resolves when the entry process completes.\n\t *\n\t * @throws {Error} Throws an error if URL handler is not defined.\n\t */\n\tasync entry(url?: string): Promise<void> {\n\t\tif (typeof this.options.urlHandler !== 'function') {\n\t\t\tconst error = new Error('Missing option: urlHandler');\n\t\t\tthis.logging?.error('Required option missing', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (!url) {\n\t\t\turl = globalThis.window?.location.href;\n\t\t}\n\n\t\tconst entryUrl = new URL(url);\n\n\t\tthis.logging?.debug('Attempting to redirect for entry');\n\n\t\tawait this.options.urlHandler(`${this.options.issuer}/provider/entry?${entryUrl.searchParams.toString()}`);\n\t}\n\n\t/**\n\t * Handles the callback after login or registration via a popup window.\n\t *\n\t * @throws {Error} Throws an error if callback handler is not defined.\n\t */\n\tasync handleCallback(): Promise<void> {\n\t\tif (typeof this.options.callbackHandler !== 'function') {\n\t\t\tconst error = new Error('Missing option: callbackHandler');\n\t\t\tthis.logging?.error('Required option missing', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tawait this.options.callbackHandler(this.options.responseMode || 'fragment');\n\t}\n}\n"],"names":["PopupFlow","BaseFlow","options","storage","httpClient","logging","popupUrlHandler","popupCallbackHandler","params","error","state","State","url","data","entryUrl"],"mappings":"gXAQO,MAAMA,UAAkBC,EAAAA,QAAkC,CAChE,YAAYC,EAAqBC,EAAqBC,EAA2BC,EAAsB,CACjGH,EAAQ,aACZA,EAAQ,WAAaI,EAAAA,iBAEjBJ,EAAQ,kBACZA,EAAQ,gBAAkBK,EAAAA,sBAG3B,MAAML,EAASC,EAASC,EAAYC,CAAO,CAC5C,CASA,MAAM,MAAMG,EAAsB,GAAmB,CACpD,GAAI,OAAO,KAAK,QAAQ,YAAe,WAAY,CAClD,MAAMC,EAAQ,IAAI,MAAM,4BAA4B,EACpD,WAAK,SAAS,MAAM,0BAA2BA,CAAK,EAC9CA,CACP,CAEA,MAAMC,EAAQ,MAAMC,EAAAA,MAAM,OAAA,EACpBC,EAAM,MAAM,KAAK,oBAAoBJ,CAAM,EAEjDI,EAAI,aAAa,OAAO,QAASF,EAAM,EAAE,EACzCE,EAAI,aAAa,OAAO,iBAAkBF,EAAM,aAAa,EAC7DE,EAAI,aAAa,OAAO,QAASF,EAAM,KAAK,EAC5CE,EAAI,aAAa,OAAO,UAAW,OAAO,EAE1C,MAAM,KAAK,QAAQ,IAAI,OAAOF,EAAM,EAAE,GAAI,KAAK,UAAUA,CAAK,CAAC,EAE/D,KAAK,cAAc,iBAAkB,EAAE,EACvC,KAAK,SAAS,MAAM,kCAAkC,EAEtD,MAAMG,EAAQ,MAAM,KAAK,QAAQ,WAAWD,EAAI,SAAA,EAAYJ,CAAM,EAElE,MAAM,KAAK,cAAcK,CAAI,CAC9B,CAOA,MAAM,SAASL,EAAsB,GAAmB,CACvDA,EAAO,OAAS,SAEhB,MAAM,KAAK,MAAMA,CAAM,CACxB,CASA,MAAM,MAAMI,EAA6B,CACxC,GAAI,OAAO,KAAK,QAAQ,YAAe,WAAY,CAClD,MAAMH,EAAQ,IAAI,MAAM,4BAA4B,EACpD,WAAK,SAAS,MAAM,0BAA2BA,CAAK,EAC9CA,CACP,CAEKG,IACJA,EAAM,WAAW,QAAQ,SAAS,MAGnC,MAAME,EAAW,IAAI,IAAIF,CAAG,EAE5B,KAAK,SAAS,MAAM,kCAAkC,EAEtD,MAAM,KAAK,QAAQ,WAAW,GAAG,KAAK,QAAQ,MAAM,mBAAmBE,EAAS,aAAa,SAAA,CAAU,EAAE,CAC1G,CAOA,MAAM,gBAAgC,CACrC,GAAI,OAAO,KAAK,QAAQ,iBAAoB,WAAY,CACvD,MAAML,EAAQ,IAAI,MAAM,iCAAiC,EACzD,WAAK,SAAS,MAAM,0BAA2BA,CAAK,EAC9CA,CACP,CAEA,MAAM,KAAK,QAAQ,gBAAgB,KAAK,QAAQ,cAAgB,UAAU,CAC3E,CACD"}
1
+ {"version":3,"file":"PopupFlow.cjs","sources":["../../src/flows/PopupFlow.ts"],"sourcesContent":["import type { SDKOptions, PopupParams, SDKStorage, SDKHttpClient, SDKLogging } from '../types';\nimport { popupCallbackHandler, popupUrlHandler } from '../utils/handlers';\nimport { State } from '../utils/State';\nimport { BaseFlow } from './BaseFlow';\n\n/**\n * Implements the Popup flow for authentication using a popup window.\n */\nexport class PopupFlow extends BaseFlow<SDKOptions, PopupParams> {\n\tconstructor(options: SDKOptions, storage: SDKStorage, httpClient: SDKHttpClient, logging?: SDKLogging) {\n\t\tif (!options.urlHandler) {\n\t\t\toptions.urlHandler = popupUrlHandler;\n\t\t}\n\t\tif (!options.callbackHandler) {\n\t\t\toptions.callbackHandler = popupCallbackHandler;\n\t\t}\n\n\t\tsuper(options, storage, httpClient, logging);\n\t}\n\n\t/**\n\t * Initiates the login process via a popup window.\n\t * @param {PopupParams} [params={}] Optional parameters for popup window configuration.\n\t * @returns {Promise<void>} A promise that resolves when the login process completes.\n\t *\n\t * @throws {Error} Throws an error if URL handler is not defined.\n\t */\n\tasync login(params: PopupParams = {}): Promise<void> {\n\t\tif (typeof this.options.urlHandler !== 'function') {\n\t\t\tconst error = new Error('Missing option: urlHandler');\n\t\t\tthis.logging?.error('Required option missing', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tconst state = await State.create();\n\t\tconst url = await this.getAuthorizationUrl(params);\n\n\t\turl.searchParams.append('state', state.id);\n\t\turl.searchParams.append('code_challenge', state.codeChallenge);\n\t\turl.searchParams.append('nonce', state.nonce);\n\t\turl.searchParams.append('display', 'popup');\n\n\t\tawait this.storage.set(`sty.${state.id}`, JSON.stringify(state));\n\n\t\tthis.dispatchEvent('loginInitiated', []);\n\t\tthis.logging?.debug('Attempting to redirect for login');\n\n\t\tconst data = (await this.options.urlHandler(url.toString(), params)) as Record<string, string>;\n\n\t\tawait this.tokenExchange(data);\n\t}\n\n\t/**\n\t * Initiates the registration process via a popup window.\n\t * @param {PopupParams} [params={}] Optional parameters for popup window configuration.\n\t * @returns {Promise<void>} A promise that resolves when the registration process completes.\n\t */\n\tasync register(params: PopupParams = {}): Promise<void> {\n\t\tparams.prompt = 'create';\n\n\t\tawait this.login(params);\n\t}\n\n\t/**\n\t * Initiates the entry process via a popup window.\n\t * @param {string} url Optional URL to use for the entry process. If not provided, the current window location will be used.\n\t * @returns {Promise<void>} A promise that resolves when the entry process completes.\n\t *\n\t * @throws {Error} Throws an error if URL handler is not defined.\n\t */\n\tasync entry(url?: string): Promise<void> {\n\t\tif (typeof this.options.urlHandler !== 'function') {\n\t\t\tconst error = new Error('Missing option: urlHandler');\n\t\t\tthis.logging?.error('Required option missing', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (!url) {\n\t\t\turl = globalThis.window?.location.href;\n\t\t}\n\n\t\tconst entryUrl = new URL(url);\n\n\t\tthis.logging?.debug('Attempting to redirect for entry');\n\n\t\tawait this.options.urlHandler(`${this.options.issuer}/provider/entry?${entryUrl.searchParams.toString()}`);\n\t}\n\n\t/**\n\t * Handles the callback after login or registration via a popup window.\n\t *\n\t * @throws {Error} Throws an error if callback handler is not defined.\n\t */\n\tasync handleCallback(): Promise<void> {\n\t\tif (typeof this.options.callbackHandler !== 'function') {\n\t\t\tconst error = new Error('Missing option: callbackHandler');\n\t\t\tthis.logging?.error('Required option missing', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tawait this.options.callbackHandler(this.options.responseMode || 'fragment');\n\t}\n}\n"],"names":["PopupFlow","BaseFlow","options","storage","httpClient","logging","popupUrlHandler","popupCallbackHandler","params","error","state","State","url","data","entryUrl"],"mappings":"+YAQO,MAAMA,UAAkBC,EAAAA,QAAkC,CAChE,YAAYC,EAAqBC,EAAqBC,EAA2BC,EAAsB,CACjGH,EAAQ,aACZA,EAAQ,WAAaI,EAAAA,iBAEjBJ,EAAQ,kBACZA,EAAQ,gBAAkBK,EAAAA,sBAG3B,MAAML,EAASC,EAASC,EAAYC,CAAO,CAC5C,CASA,MAAM,MAAMG,EAAsB,GAAmB,CACpD,GAAI,OAAO,KAAK,QAAQ,YAAe,WAAY,CAClD,MAAMC,EAAQ,IAAI,MAAM,4BAA4B,EACpD,WAAK,SAAS,MAAM,0BAA2BA,CAAK,EAC9CA,CACP,CAEA,MAAMC,EAAQ,MAAMC,EAAAA,MAAM,OAAA,EACpBC,EAAM,MAAM,KAAK,oBAAoBJ,CAAM,EAEjDI,EAAI,aAAa,OAAO,QAASF,EAAM,EAAE,EACzCE,EAAI,aAAa,OAAO,iBAAkBF,EAAM,aAAa,EAC7DE,EAAI,aAAa,OAAO,QAASF,EAAM,KAAK,EAC5CE,EAAI,aAAa,OAAO,UAAW,OAAO,EAE1C,MAAM,KAAK,QAAQ,IAAI,OAAOF,EAAM,EAAE,GAAI,KAAK,UAAUA,CAAK,CAAC,EAE/D,KAAK,cAAc,iBAAkB,EAAE,EACvC,KAAK,SAAS,MAAM,kCAAkC,EAEtD,MAAMG,EAAQ,MAAM,KAAK,QAAQ,WAAWD,EAAI,SAAA,EAAYJ,CAAM,EAElE,MAAM,KAAK,cAAcK,CAAI,CAC9B,CAOA,MAAM,SAASL,EAAsB,GAAmB,CACvDA,EAAO,OAAS,SAEhB,MAAM,KAAK,MAAMA,CAAM,CACxB,CASA,MAAM,MAAMI,EAA6B,CACxC,GAAI,OAAO,KAAK,QAAQ,YAAe,WAAY,CAClD,MAAMH,EAAQ,IAAI,MAAM,4BAA4B,EACpD,WAAK,SAAS,MAAM,0BAA2BA,CAAK,EAC9CA,CACP,CAEKG,IACJA,EAAM,WAAW,QAAQ,SAAS,MAGnC,MAAME,EAAW,IAAI,IAAIF,CAAG,EAE5B,KAAK,SAAS,MAAM,kCAAkC,EAEtD,MAAM,KAAK,QAAQ,WAAW,GAAG,KAAK,QAAQ,MAAM,mBAAmBE,EAAS,aAAa,SAAA,CAAU,EAAE,CAC1G,CAOA,MAAM,gBAAgC,CACrC,GAAI,OAAO,KAAK,QAAQ,iBAAoB,WAAY,CACvD,MAAML,EAAQ,IAAI,MAAM,iCAAiC,EACzD,WAAK,SAAS,MAAM,0BAA2BA,CAAK,EAC9CA,CACP,CAEA,MAAM,KAAK,QAAQ,gBAAgB,KAAK,QAAQ,cAAgB,UAAU,CAC3E,CACD"}
@@ -1,2 +1,2 @@
1
- import{popupUrlHandler as n,popupCallbackHandler as a}from"../utils/handlers.mjs";import{State as s}from"../utils/State.mjs";import{BaseFlow as l}from"./BaseFlow.mjs";import"../utils/crypto.mjs";import"../utils/base64Url.mjs";import"../utils/date.mjs";import"../utils/jwt.mjs";import"../utils/Metadata.mjs";import"../utils/Session.mjs";class y extends l{constructor(r,i,t,o){r.urlHandler||(r.urlHandler=n),r.callbackHandler||(r.callbackHandler=a),super(r,i,t,o)}async login(r={}){if(typeof this.options.urlHandler!="function"){const e=new Error("Missing option: urlHandler");throw this.logging?.error("Required option missing",e),e}const i=await s.create(),t=await this.getAuthorizationUrl(r);t.searchParams.append("state",i.id),t.searchParams.append("code_challenge",i.codeChallenge),t.searchParams.append("nonce",i.nonce),t.searchParams.append("display","popup"),await this.storage.set(`sty.${i.id}`,JSON.stringify(i)),this.dispatchEvent("loginInitiated",[]),this.logging?.debug("Attempting to redirect for login");const o=await this.options.urlHandler(t.toString(),r);await this.tokenExchange(o)}async register(r={}){r.prompt="create",await this.login(r)}async entry(r){if(typeof this.options.urlHandler!="function"){const t=new Error("Missing option: urlHandler");throw this.logging?.error("Required option missing",t),t}r||(r=globalThis.window?.location.href);const i=new URL(r);this.logging?.debug("Attempting to redirect for entry"),await this.options.urlHandler(`${this.options.issuer}/provider/entry?${i.searchParams.toString()}`)}async handleCallback(){if(typeof this.options.callbackHandler!="function"){const r=new Error("Missing option: callbackHandler");throw this.logging?.error("Required option missing",r),r}await this.options.callbackHandler(this.options.responseMode||"fragment")}}export{y as PopupFlow};
1
+ import{popupUrlHandler as n,popupCallbackHandler as a}from"../utils/handlers.mjs";import{State as s}from"../utils/State.mjs";import{BaseFlow as l}from"./BaseFlow.mjs";import"../utils/errors.mjs";import"../utils/crypto.mjs";import"../utils/base64Url.mjs";import"../utils/date.mjs";import"../utils/jwt.mjs";import"../utils/Metadata.mjs";import"../utils/Session.mjs";class b extends l{constructor(r,i,t,o){r.urlHandler||(r.urlHandler=n),r.callbackHandler||(r.callbackHandler=a),super(r,i,t,o)}async login(r={}){if(typeof this.options.urlHandler!="function"){const e=new Error("Missing option: urlHandler");throw this.logging?.error("Required option missing",e),e}const i=await s.create(),t=await this.getAuthorizationUrl(r);t.searchParams.append("state",i.id),t.searchParams.append("code_challenge",i.codeChallenge),t.searchParams.append("nonce",i.nonce),t.searchParams.append("display","popup"),await this.storage.set(`sty.${i.id}`,JSON.stringify(i)),this.dispatchEvent("loginInitiated",[]),this.logging?.debug("Attempting to redirect for login");const o=await this.options.urlHandler(t.toString(),r);await this.tokenExchange(o)}async register(r={}){r.prompt="create",await this.login(r)}async entry(r){if(typeof this.options.urlHandler!="function"){const t=new Error("Missing option: urlHandler");throw this.logging?.error("Required option missing",t),t}r||(r=globalThis.window?.location.href);const i=new URL(r);this.logging?.debug("Attempting to redirect for entry"),await this.options.urlHandler(`${this.options.issuer}/provider/entry?${i.searchParams.toString()}`)}async handleCallback(){if(typeof this.options.callbackHandler!="function"){const r=new Error("Missing option: callbackHandler");throw this.logging?.error("Required option missing",r),r}await this.options.callbackHandler(this.options.responseMode||"fragment")}}export{b as PopupFlow};
2
2
  //# sourceMappingURL=PopupFlow.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"PopupFlow.mjs","sources":["../../src/flows/PopupFlow.ts"],"sourcesContent":["import type { SDKOptions, PopupParams, SDKStorage, SDKHttpClient, SDKLogging } from '../types';\nimport { popupCallbackHandler, popupUrlHandler } from '../utils/handlers';\nimport { State } from '../utils/State';\nimport { BaseFlow } from './BaseFlow';\n\n/**\n * Implements the Popup flow for authentication using a popup window.\n */\nexport class PopupFlow extends BaseFlow<SDKOptions, PopupParams> {\n\tconstructor(options: SDKOptions, storage: SDKStorage, httpClient: SDKHttpClient, logging?: SDKLogging) {\n\t\tif (!options.urlHandler) {\n\t\t\toptions.urlHandler = popupUrlHandler;\n\t\t}\n\t\tif (!options.callbackHandler) {\n\t\t\toptions.callbackHandler = popupCallbackHandler;\n\t\t}\n\n\t\tsuper(options, storage, httpClient, logging);\n\t}\n\n\t/**\n\t * Initiates the login process via a popup window.\n\t * @param {PopupParams} [params={}] Optional parameters for popup window configuration.\n\t * @returns {Promise<void>} A promise that resolves when the login process completes.\n\t *\n\t * @throws {Error} Throws an error if URL handler is not defined.\n\t */\n\tasync login(params: PopupParams = {}): Promise<void> {\n\t\tif (typeof this.options.urlHandler !== 'function') {\n\t\t\tconst error = new Error('Missing option: urlHandler');\n\t\t\tthis.logging?.error('Required option missing', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tconst state = await State.create();\n\t\tconst url = await this.getAuthorizationUrl(params);\n\n\t\turl.searchParams.append('state', state.id);\n\t\turl.searchParams.append('code_challenge', state.codeChallenge);\n\t\turl.searchParams.append('nonce', state.nonce);\n\t\turl.searchParams.append('display', 'popup');\n\n\t\tawait this.storage.set(`sty.${state.id}`, JSON.stringify(state));\n\n\t\tthis.dispatchEvent('loginInitiated', []);\n\t\tthis.logging?.debug('Attempting to redirect for login');\n\n\t\tconst data = (await this.options.urlHandler(url.toString(), params)) as Record<string, string>;\n\n\t\tawait this.tokenExchange(data);\n\t}\n\n\t/**\n\t * Initiates the registration process via a popup window.\n\t * @param {PopupParams} [params={}] Optional parameters for popup window configuration.\n\t * @returns {Promise<void>} A promise that resolves when the registration process completes.\n\t */\n\tasync register(params: PopupParams = {}): Promise<void> {\n\t\tparams.prompt = 'create';\n\n\t\tawait this.login(params);\n\t}\n\n\t/**\n\t * Initiates the entry process via a popup window.\n\t * @param {string} url Optional URL to use for the entry process. If not provided, the current window location will be used.\n\t * @returns {Promise<void>} A promise that resolves when the entry process completes.\n\t *\n\t * @throws {Error} Throws an error if URL handler is not defined.\n\t */\n\tasync entry(url?: string): Promise<void> {\n\t\tif (typeof this.options.urlHandler !== 'function') {\n\t\t\tconst error = new Error('Missing option: urlHandler');\n\t\t\tthis.logging?.error('Required option missing', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (!url) {\n\t\t\turl = globalThis.window?.location.href;\n\t\t}\n\n\t\tconst entryUrl = new URL(url);\n\n\t\tthis.logging?.debug('Attempting to redirect for entry');\n\n\t\tawait this.options.urlHandler(`${this.options.issuer}/provider/entry?${entryUrl.searchParams.toString()}`);\n\t}\n\n\t/**\n\t * Handles the callback after login or registration via a popup window.\n\t *\n\t * @throws {Error} Throws an error if callback handler is not defined.\n\t */\n\tasync handleCallback(): Promise<void> {\n\t\tif (typeof this.options.callbackHandler !== 'function') {\n\t\t\tconst error = new Error('Missing option: callbackHandler');\n\t\t\tthis.logging?.error('Required option missing', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tawait this.options.callbackHandler(this.options.responseMode || 'fragment');\n\t}\n}\n"],"names":["PopupFlow","BaseFlow","options","storage","httpClient","logging","popupUrlHandler","popupCallbackHandler","params","error","state","State","url","data","entryUrl"],"mappings":"gVAQO,MAAMA,UAAkBC,CAAkC,CAChE,YAAYC,EAAqBC,EAAqBC,EAA2BC,EAAsB,CACjGH,EAAQ,aACZA,EAAQ,WAAaI,GAEjBJ,EAAQ,kBACZA,EAAQ,gBAAkBK,GAG3B,MAAML,EAASC,EAASC,EAAYC,CAAO,CAC5C,CASA,MAAM,MAAMG,EAAsB,GAAmB,CACpD,GAAI,OAAO,KAAK,QAAQ,YAAe,WAAY,CAClD,MAAMC,EAAQ,IAAI,MAAM,4BAA4B,EACpD,WAAK,SAAS,MAAM,0BAA2BA,CAAK,EAC9CA,CACP,CAEA,MAAMC,EAAQ,MAAMC,EAAM,OAAA,EACpBC,EAAM,MAAM,KAAK,oBAAoBJ,CAAM,EAEjDI,EAAI,aAAa,OAAO,QAASF,EAAM,EAAE,EACzCE,EAAI,aAAa,OAAO,iBAAkBF,EAAM,aAAa,EAC7DE,EAAI,aAAa,OAAO,QAASF,EAAM,KAAK,EAC5CE,EAAI,aAAa,OAAO,UAAW,OAAO,EAE1C,MAAM,KAAK,QAAQ,IAAI,OAAOF,EAAM,EAAE,GAAI,KAAK,UAAUA,CAAK,CAAC,EAE/D,KAAK,cAAc,iBAAkB,EAAE,EACvC,KAAK,SAAS,MAAM,kCAAkC,EAEtD,MAAMG,EAAQ,MAAM,KAAK,QAAQ,WAAWD,EAAI,SAAA,EAAYJ,CAAM,EAElE,MAAM,KAAK,cAAcK,CAAI,CAC9B,CAOA,MAAM,SAASL,EAAsB,GAAmB,CACvDA,EAAO,OAAS,SAEhB,MAAM,KAAK,MAAMA,CAAM,CACxB,CASA,MAAM,MAAMI,EAA6B,CACxC,GAAI,OAAO,KAAK,QAAQ,YAAe,WAAY,CAClD,MAAMH,EAAQ,IAAI,MAAM,4BAA4B,EACpD,WAAK,SAAS,MAAM,0BAA2BA,CAAK,EAC9CA,CACP,CAEKG,IACJA,EAAM,WAAW,QAAQ,SAAS,MAGnC,MAAME,EAAW,IAAI,IAAIF,CAAG,EAE5B,KAAK,SAAS,MAAM,kCAAkC,EAEtD,MAAM,KAAK,QAAQ,WAAW,GAAG,KAAK,QAAQ,MAAM,mBAAmBE,EAAS,aAAa,SAAA,CAAU,EAAE,CAC1G,CAOA,MAAM,gBAAgC,CACrC,GAAI,OAAO,KAAK,QAAQ,iBAAoB,WAAY,CACvD,MAAML,EAAQ,IAAI,MAAM,iCAAiC,EACzD,WAAK,SAAS,MAAM,0BAA2BA,CAAK,EAC9CA,CACP,CAEA,MAAM,KAAK,QAAQ,gBAAgB,KAAK,QAAQ,cAAgB,UAAU,CAC3E,CACD"}
1
+ {"version":3,"file":"PopupFlow.mjs","sources":["../../src/flows/PopupFlow.ts"],"sourcesContent":["import type { SDKOptions, PopupParams, SDKStorage, SDKHttpClient, SDKLogging } from '../types';\nimport { popupCallbackHandler, popupUrlHandler } from '../utils/handlers';\nimport { State } from '../utils/State';\nimport { BaseFlow } from './BaseFlow';\n\n/**\n * Implements the Popup flow for authentication using a popup window.\n */\nexport class PopupFlow extends BaseFlow<SDKOptions, PopupParams> {\n\tconstructor(options: SDKOptions, storage: SDKStorage, httpClient: SDKHttpClient, logging?: SDKLogging) {\n\t\tif (!options.urlHandler) {\n\t\t\toptions.urlHandler = popupUrlHandler;\n\t\t}\n\t\tif (!options.callbackHandler) {\n\t\t\toptions.callbackHandler = popupCallbackHandler;\n\t\t}\n\n\t\tsuper(options, storage, httpClient, logging);\n\t}\n\n\t/**\n\t * Initiates the login process via a popup window.\n\t * @param {PopupParams} [params={}] Optional parameters for popup window configuration.\n\t * @returns {Promise<void>} A promise that resolves when the login process completes.\n\t *\n\t * @throws {Error} Throws an error if URL handler is not defined.\n\t */\n\tasync login(params: PopupParams = {}): Promise<void> {\n\t\tif (typeof this.options.urlHandler !== 'function') {\n\t\t\tconst error = new Error('Missing option: urlHandler');\n\t\t\tthis.logging?.error('Required option missing', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tconst state = await State.create();\n\t\tconst url = await this.getAuthorizationUrl(params);\n\n\t\turl.searchParams.append('state', state.id);\n\t\turl.searchParams.append('code_challenge', state.codeChallenge);\n\t\turl.searchParams.append('nonce', state.nonce);\n\t\turl.searchParams.append('display', 'popup');\n\n\t\tawait this.storage.set(`sty.${state.id}`, JSON.stringify(state));\n\n\t\tthis.dispatchEvent('loginInitiated', []);\n\t\tthis.logging?.debug('Attempting to redirect for login');\n\n\t\tconst data = (await this.options.urlHandler(url.toString(), params)) as Record<string, string>;\n\n\t\tawait this.tokenExchange(data);\n\t}\n\n\t/**\n\t * Initiates the registration process via a popup window.\n\t * @param {PopupParams} [params={}] Optional parameters for popup window configuration.\n\t * @returns {Promise<void>} A promise that resolves when the registration process completes.\n\t */\n\tasync register(params: PopupParams = {}): Promise<void> {\n\t\tparams.prompt = 'create';\n\n\t\tawait this.login(params);\n\t}\n\n\t/**\n\t * Initiates the entry process via a popup window.\n\t * @param {string} url Optional URL to use for the entry process. If not provided, the current window location will be used.\n\t * @returns {Promise<void>} A promise that resolves when the entry process completes.\n\t *\n\t * @throws {Error} Throws an error if URL handler is not defined.\n\t */\n\tasync entry(url?: string): Promise<void> {\n\t\tif (typeof this.options.urlHandler !== 'function') {\n\t\t\tconst error = new Error('Missing option: urlHandler');\n\t\t\tthis.logging?.error('Required option missing', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (!url) {\n\t\t\turl = globalThis.window?.location.href;\n\t\t}\n\n\t\tconst entryUrl = new URL(url);\n\n\t\tthis.logging?.debug('Attempting to redirect for entry');\n\n\t\tawait this.options.urlHandler(`${this.options.issuer}/provider/entry?${entryUrl.searchParams.toString()}`);\n\t}\n\n\t/**\n\t * Handles the callback after login or registration via a popup window.\n\t *\n\t * @throws {Error} Throws an error if callback handler is not defined.\n\t */\n\tasync handleCallback(): Promise<void> {\n\t\tif (typeof this.options.callbackHandler !== 'function') {\n\t\t\tconst error = new Error('Missing option: callbackHandler');\n\t\t\tthis.logging?.error('Required option missing', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tawait this.options.callbackHandler(this.options.responseMode || 'fragment');\n\t}\n}\n"],"names":["PopupFlow","BaseFlow","options","storage","httpClient","logging","popupUrlHandler","popupCallbackHandler","params","error","state","State","url","data","entryUrl"],"mappings":"4WAQO,MAAMA,UAAkBC,CAAkC,CAChE,YAAYC,EAAqBC,EAAqBC,EAA2BC,EAAsB,CACjGH,EAAQ,aACZA,EAAQ,WAAaI,GAEjBJ,EAAQ,kBACZA,EAAQ,gBAAkBK,GAG3B,MAAML,EAASC,EAASC,EAAYC,CAAO,CAC5C,CASA,MAAM,MAAMG,EAAsB,GAAmB,CACpD,GAAI,OAAO,KAAK,QAAQ,YAAe,WAAY,CAClD,MAAMC,EAAQ,IAAI,MAAM,4BAA4B,EACpD,WAAK,SAAS,MAAM,0BAA2BA,CAAK,EAC9CA,CACP,CAEA,MAAMC,EAAQ,MAAMC,EAAM,OAAA,EACpBC,EAAM,MAAM,KAAK,oBAAoBJ,CAAM,EAEjDI,EAAI,aAAa,OAAO,QAASF,EAAM,EAAE,EACzCE,EAAI,aAAa,OAAO,iBAAkBF,EAAM,aAAa,EAC7DE,EAAI,aAAa,OAAO,QAASF,EAAM,KAAK,EAC5CE,EAAI,aAAa,OAAO,UAAW,OAAO,EAE1C,MAAM,KAAK,QAAQ,IAAI,OAAOF,EAAM,EAAE,GAAI,KAAK,UAAUA,CAAK,CAAC,EAE/D,KAAK,cAAc,iBAAkB,EAAE,EACvC,KAAK,SAAS,MAAM,kCAAkC,EAEtD,MAAMG,EAAQ,MAAM,KAAK,QAAQ,WAAWD,EAAI,SAAA,EAAYJ,CAAM,EAElE,MAAM,KAAK,cAAcK,CAAI,CAC9B,CAOA,MAAM,SAASL,EAAsB,GAAmB,CACvDA,EAAO,OAAS,SAEhB,MAAM,KAAK,MAAMA,CAAM,CACxB,CASA,MAAM,MAAMI,EAA6B,CACxC,GAAI,OAAO,KAAK,QAAQ,YAAe,WAAY,CAClD,MAAMH,EAAQ,IAAI,MAAM,4BAA4B,EACpD,WAAK,SAAS,MAAM,0BAA2BA,CAAK,EAC9CA,CACP,CAEKG,IACJA,EAAM,WAAW,QAAQ,SAAS,MAGnC,MAAME,EAAW,IAAI,IAAIF,CAAG,EAE5B,KAAK,SAAS,MAAM,kCAAkC,EAEtD,MAAM,KAAK,QAAQ,WAAW,GAAG,KAAK,QAAQ,MAAM,mBAAmBE,EAAS,aAAa,SAAA,CAAU,EAAE,CAC1G,CAOA,MAAM,gBAAgC,CACrC,GAAI,OAAO,KAAK,QAAQ,iBAAoB,WAAY,CACvD,MAAML,EAAQ,IAAI,MAAM,iCAAiC,EACzD,WAAK,SAAS,MAAM,0BAA2BA,CAAK,EAC9CA,CACP,CAEA,MAAM,KAAK,QAAQ,gBAAgB,KAAK,QAAQ,cAAgB,UAAU,CAC3E,CACD"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../utils/handlers.cjs"),o=require("../utils/State.cjs"),a=require("./BaseFlow.cjs");require("../utils/crypto.cjs");require("../utils/base64Url.cjs");require("../utils/date.cjs");require("../utils/jwt.cjs");require("../utils/Metadata.cjs");require("../utils/Session.cjs");class s extends a.BaseFlow{constructor(e,r,t,i){e.urlHandler||(e.urlHandler=n.redirectUrlHandler),e.callbackHandler||(e.callbackHandler=n.redirectCallbackHandler),super(e,r,t,i)}async login(e={}){if(typeof this.options.urlHandler!="function"){const i=new Error("Missing option: urlHandler");throw this.logging?.error("Required option missing",i),i}const r=await o.State.create(),t=await this.getAuthorizationUrl(e);t.searchParams.append("state",r.id),t.searchParams.append("code_challenge",r.codeChallenge),t.searchParams.append("nonce",r.nonce),await this.storage.set(`sty.${r.id}`,JSON.stringify(r)),this.dispatchEvent("loginInitiated",[]),this.logging?.debug("Attempting to redirect for login"),await this.options.urlHandler(t.toString(),e)}async register(e={}){e.prompt="create",await this.login(e)}async entry(e){if(typeof this.options.urlHandler!="function"){const t=new Error("Missing option: urlHandler");throw this.logging?.error("Required option missing",t),t}e||(e=globalThis.window?.location.href);const r=new URL(e);this.logging?.debug("Attempting to redirect for entry"),await this.options.urlHandler(`${this.options.issuer}/provider/entry?${r.searchParams.toString()}`)}async handleCallback(e){if(typeof this.options.callbackHandler!="function"){const r=new Error("Missing option: callbackHandler");throw this.logging?.error("Required option missing",r),r}e||(e=globalThis.window?.location.href),await this.tokenExchange(await this.options.callbackHandler(e,this.options.responseMode||"fragment"))}}exports.RedirectFlow=s;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../utils/handlers.cjs"),o=require("../utils/State.cjs"),a=require("./BaseFlow.cjs");require("../utils/errors.cjs");require("../utils/crypto.cjs");require("../utils/base64Url.cjs");require("../utils/date.cjs");require("../utils/jwt.cjs");require("../utils/Metadata.cjs");require("../utils/Session.cjs");class s extends a.BaseFlow{constructor(e,r,t,i){e.urlHandler||(e.urlHandler=n.redirectUrlHandler),e.callbackHandler||(e.callbackHandler=n.redirectCallbackHandler),super(e,r,t,i)}async login(e={}){if(typeof this.options.urlHandler!="function"){const i=new Error("Missing option: urlHandler");throw this.logging?.error("Required option missing",i),i}const r=await o.State.create(),t=await this.getAuthorizationUrl(e);t.searchParams.append("state",r.id),t.searchParams.append("code_challenge",r.codeChallenge),t.searchParams.append("nonce",r.nonce),await this.storage.set(`sty.${r.id}`,JSON.stringify(r)),this.dispatchEvent("loginInitiated",[]),this.logging?.debug("Attempting to redirect for login"),await this.options.urlHandler(t.toString(),e)}async register(e={}){e.prompt="create",await this.login(e)}async entry(e){if(typeof this.options.urlHandler!="function"){const t=new Error("Missing option: urlHandler");throw this.logging?.error("Required option missing",t),t}e||(e=globalThis.window?.location.href);const r=new URL(e);this.logging?.debug("Attempting to redirect for entry"),await this.options.urlHandler(`${this.options.issuer}/provider/entry?${r.searchParams.toString()}`)}async handleCallback(e){if(typeof this.options.callbackHandler!="function"){const r=new Error("Missing option: callbackHandler");throw this.logging?.error("Required option missing",r),r}e||(e=globalThis.window?.location.href),await this.tokenExchange(await this.options.callbackHandler(e,this.options.responseMode||"fragment"))}}exports.RedirectFlow=s;
2
2
  //# sourceMappingURL=RedirectFlow.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"RedirectFlow.cjs","sources":["../../src/flows/RedirectFlow.ts"],"sourcesContent":["import type { SDKOptions, RedirectParams, SDKStorage, SDKHttpClient, SDKLogging } from '../types';\nimport { redirectUrlHandler, redirectCallbackHandler } from '../utils/handlers';\nimport { State } from '../utils/State';\nimport { BaseFlow } from './BaseFlow';\n\n/**\n * Implements the Redirect flow for authentication using a full-page redirect.\n */\nexport class RedirectFlow extends BaseFlow<SDKOptions, RedirectParams> {\n\tconstructor(options: SDKOptions, storage: SDKStorage, httpClient: SDKHttpClient, logging?: SDKLogging) {\n\t\tif (!options.urlHandler) {\n\t\t\toptions.urlHandler = redirectUrlHandler;\n\t\t}\n\t\tif (!options.callbackHandler) {\n\t\t\toptions.callbackHandler = redirectCallbackHandler;\n\t\t}\n\n\t\tsuper(options, storage, httpClient, logging);\n\t}\n\n\t/**\n\t * Initiates the login process via a redirect.\n\t * @param {RedirectParams} [params={}] Optional parameters for redirect configuration.\n\t * @returns {Promise<void>} A promise that resolves when the login process completes.\n\t *\n\t * @throws {Error} Throws an error if URL handler is not defined.\n\t */\n\tasync login(params: RedirectParams = {}): Promise<void> {\n\t\tif (typeof this.options.urlHandler !== 'function') {\n\t\t\tconst error = new Error('Missing option: urlHandler');\n\t\t\tthis.logging?.error('Required option missing', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tconst state = await State.create();\n\t\tconst url = await this.getAuthorizationUrl(params);\n\n\t\turl.searchParams.append('state', state.id);\n\t\turl.searchParams.append('code_challenge', state.codeChallenge);\n\t\turl.searchParams.append('nonce', state.nonce);\n\n\t\tawait this.storage.set(`sty.${state.id}`, JSON.stringify(state));\n\n\t\tthis.dispatchEvent('loginInitiated', []);\n\t\tthis.logging?.debug('Attempting to redirect for login');\n\n\t\tawait this.options.urlHandler(url.toString(), params);\n\t}\n\n\t/**\n\t * Initiates the registration process via a redirect.\n\t * @param {RedirectParams} [params={}] Optional parameters for redirect configuration.\n\t * @returns {Promise<void>} A promise that resolves when the registration process completes.\n\t */\n\tasync register(params: RedirectParams = {}): Promise<void> {\n\t\tparams.prompt = 'create';\n\n\t\tawait this.login(params);\n\t}\n\n\t/**\n\t * Initiates the entry process via a redirect.\n\t * @param {string} url Optional URL to use for the entry process. If not provided, the current window location will be used.\n\t * @returns {Promise<void>} A promise that resolves when the entry process completes.\n\t *\n\t * @throws {Error} Throws an error if URL handler is not defined.\n\t */\n\tasync entry(url?: string): Promise<void> {\n\t\tif (typeof this.options.urlHandler !== 'function') {\n\t\t\tconst error = new Error('Missing option: urlHandler');\n\t\t\tthis.logging?.error('Required option missing', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (!url) {\n\t\t\turl = globalThis.window?.location.href;\n\t\t}\n\n\t\tconst entryUrl = new URL(url);\n\n\t\tthis.logging?.debug('Attempting to redirect for entry');\n\n\t\tawait this.options.urlHandler(`${this.options.issuer}/provider/entry?${entryUrl.searchParams.toString()}`);\n\t}\n\n\t/**\n\t * Handles the callback after login or registration via a redirect.\n\t * @param {string} [url] The URL to handle the callback from. Defaults to the current window location.\n\t * @returns {Promise<void>} A promise that resolves when the callback is handled.\n\t *\n\t * @throws {Error} Throws an error if callback handler is not defined.\n\t */\n\tasync handleCallback(url?: string): Promise<void> {\n\t\tif (typeof this.options.callbackHandler !== 'function') {\n\t\t\tconst error = new Error('Missing option: callbackHandler');\n\t\t\tthis.logging?.error('Required option missing', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (!url) {\n\t\t\turl = globalThis.window?.location.href;\n\t\t}\n\n\t\tawait this.tokenExchange((await this.options.callbackHandler(url, this.options.responseMode || 'fragment')) as Record<string, string>);\n\t}\n}\n"],"names":["RedirectFlow","BaseFlow","options","storage","httpClient","logging","redirectUrlHandler","redirectCallbackHandler","params","error","state","State","url","entryUrl"],"mappings":"gXAQO,MAAMA,UAAqBC,EAAAA,QAAqC,CACtE,YAAYC,EAAqBC,EAAqBC,EAA2BC,EAAsB,CACjGH,EAAQ,aACZA,EAAQ,WAAaI,EAAAA,oBAEjBJ,EAAQ,kBACZA,EAAQ,gBAAkBK,EAAAA,yBAG3B,MAAML,EAASC,EAASC,EAAYC,CAAO,CAC5C,CASA,MAAM,MAAMG,EAAyB,GAAmB,CACvD,GAAI,OAAO,KAAK,QAAQ,YAAe,WAAY,CAClD,MAAMC,EAAQ,IAAI,MAAM,4BAA4B,EACpD,WAAK,SAAS,MAAM,0BAA2BA,CAAK,EAC9CA,CACP,CAEA,MAAMC,EAAQ,MAAMC,EAAAA,MAAM,OAAA,EACpBC,EAAM,MAAM,KAAK,oBAAoBJ,CAAM,EAEjDI,EAAI,aAAa,OAAO,QAASF,EAAM,EAAE,EACzCE,EAAI,aAAa,OAAO,iBAAkBF,EAAM,aAAa,EAC7DE,EAAI,aAAa,OAAO,QAASF,EAAM,KAAK,EAE5C,MAAM,KAAK,QAAQ,IAAI,OAAOA,EAAM,EAAE,GAAI,KAAK,UAAUA,CAAK,CAAC,EAE/D,KAAK,cAAc,iBAAkB,EAAE,EACvC,KAAK,SAAS,MAAM,kCAAkC,EAEtD,MAAM,KAAK,QAAQ,WAAWE,EAAI,SAAA,EAAYJ,CAAM,CACrD,CAOA,MAAM,SAASA,EAAyB,GAAmB,CAC1DA,EAAO,OAAS,SAEhB,MAAM,KAAK,MAAMA,CAAM,CACxB,CASA,MAAM,MAAMI,EAA6B,CACxC,GAAI,OAAO,KAAK,QAAQ,YAAe,WAAY,CAClD,MAAMH,EAAQ,IAAI,MAAM,4BAA4B,EACpD,WAAK,SAAS,MAAM,0BAA2BA,CAAK,EAC9CA,CACP,CAEKG,IACJA,EAAM,WAAW,QAAQ,SAAS,MAGnC,MAAMC,EAAW,IAAI,IAAID,CAAG,EAE5B,KAAK,SAAS,MAAM,kCAAkC,EAEtD,MAAM,KAAK,QAAQ,WAAW,GAAG,KAAK,QAAQ,MAAM,mBAAmBC,EAAS,aAAa,SAAA,CAAU,EAAE,CAC1G,CASA,MAAM,eAAeD,EAA6B,CACjD,GAAI,OAAO,KAAK,QAAQ,iBAAoB,WAAY,CACvD,MAAMH,EAAQ,IAAI,MAAM,iCAAiC,EACzD,WAAK,SAAS,MAAM,0BAA2BA,CAAK,EAC9CA,CACP,CAEKG,IACJA,EAAM,WAAW,QAAQ,SAAS,MAGnC,MAAM,KAAK,cAAe,MAAM,KAAK,QAAQ,gBAAgBA,EAAK,KAAK,QAAQ,cAAgB,UAAU,CAA4B,CACtI,CACD"}
1
+ {"version":3,"file":"RedirectFlow.cjs","sources":["../../src/flows/RedirectFlow.ts"],"sourcesContent":["import type { SDKOptions, RedirectParams, SDKStorage, SDKHttpClient, SDKLogging } from '../types';\nimport { redirectUrlHandler, redirectCallbackHandler } from '../utils/handlers';\nimport { State } from '../utils/State';\nimport { BaseFlow } from './BaseFlow';\n\n/**\n * Implements the Redirect flow for authentication using a full-page redirect.\n */\nexport class RedirectFlow extends BaseFlow<SDKOptions, RedirectParams> {\n\tconstructor(options: SDKOptions, storage: SDKStorage, httpClient: SDKHttpClient, logging?: SDKLogging) {\n\t\tif (!options.urlHandler) {\n\t\t\toptions.urlHandler = redirectUrlHandler;\n\t\t}\n\t\tif (!options.callbackHandler) {\n\t\t\toptions.callbackHandler = redirectCallbackHandler;\n\t\t}\n\n\t\tsuper(options, storage, httpClient, logging);\n\t}\n\n\t/**\n\t * Initiates the login process via a redirect.\n\t * @param {RedirectParams} [params={}] Optional parameters for redirect configuration.\n\t * @returns {Promise<void>} A promise that resolves when the login process completes.\n\t *\n\t * @throws {Error} Throws an error if URL handler is not defined.\n\t */\n\tasync login(params: RedirectParams = {}): Promise<void> {\n\t\tif (typeof this.options.urlHandler !== 'function') {\n\t\t\tconst error = new Error('Missing option: urlHandler');\n\t\t\tthis.logging?.error('Required option missing', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tconst state = await State.create();\n\t\tconst url = await this.getAuthorizationUrl(params);\n\n\t\turl.searchParams.append('state', state.id);\n\t\turl.searchParams.append('code_challenge', state.codeChallenge);\n\t\turl.searchParams.append('nonce', state.nonce);\n\n\t\tawait this.storage.set(`sty.${state.id}`, JSON.stringify(state));\n\n\t\tthis.dispatchEvent('loginInitiated', []);\n\t\tthis.logging?.debug('Attempting to redirect for login');\n\n\t\tawait this.options.urlHandler(url.toString(), params);\n\t}\n\n\t/**\n\t * Initiates the registration process via a redirect.\n\t * @param {RedirectParams} [params={}] Optional parameters for redirect configuration.\n\t * @returns {Promise<void>} A promise that resolves when the registration process completes.\n\t */\n\tasync register(params: RedirectParams = {}): Promise<void> {\n\t\tparams.prompt = 'create';\n\n\t\tawait this.login(params);\n\t}\n\n\t/**\n\t * Initiates the entry process via a redirect.\n\t * @param {string} url Optional URL to use for the entry process. If not provided, the current window location will be used.\n\t * @returns {Promise<void>} A promise that resolves when the entry process completes.\n\t *\n\t * @throws {Error} Throws an error if URL handler is not defined.\n\t */\n\tasync entry(url?: string): Promise<void> {\n\t\tif (typeof this.options.urlHandler !== 'function') {\n\t\t\tconst error = new Error('Missing option: urlHandler');\n\t\t\tthis.logging?.error('Required option missing', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (!url) {\n\t\t\turl = globalThis.window?.location.href;\n\t\t}\n\n\t\tconst entryUrl = new URL(url);\n\n\t\tthis.logging?.debug('Attempting to redirect for entry');\n\n\t\tawait this.options.urlHandler(`${this.options.issuer}/provider/entry?${entryUrl.searchParams.toString()}`);\n\t}\n\n\t/**\n\t * Handles the callback after login or registration via a redirect.\n\t * @param {string} [url] The URL to handle the callback from. Defaults to the current window location.\n\t * @returns {Promise<void>} A promise that resolves when the callback is handled.\n\t *\n\t * @throws {Error} Throws an error if callback handler is not defined.\n\t */\n\tasync handleCallback(url?: string): Promise<void> {\n\t\tif (typeof this.options.callbackHandler !== 'function') {\n\t\t\tconst error = new Error('Missing option: callbackHandler');\n\t\t\tthis.logging?.error('Required option missing', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (!url) {\n\t\t\turl = globalThis.window?.location.href;\n\t\t}\n\n\t\tawait this.tokenExchange((await this.options.callbackHandler(url, this.options.responseMode || 'fragment')) as Record<string, string>);\n\t}\n}\n"],"names":["RedirectFlow","BaseFlow","options","storage","httpClient","logging","redirectUrlHandler","redirectCallbackHandler","params","error","state","State","url","entryUrl"],"mappings":"+YAQO,MAAMA,UAAqBC,EAAAA,QAAqC,CACtE,YAAYC,EAAqBC,EAAqBC,EAA2BC,EAAsB,CACjGH,EAAQ,aACZA,EAAQ,WAAaI,EAAAA,oBAEjBJ,EAAQ,kBACZA,EAAQ,gBAAkBK,EAAAA,yBAG3B,MAAML,EAASC,EAASC,EAAYC,CAAO,CAC5C,CASA,MAAM,MAAMG,EAAyB,GAAmB,CACvD,GAAI,OAAO,KAAK,QAAQ,YAAe,WAAY,CAClD,MAAMC,EAAQ,IAAI,MAAM,4BAA4B,EACpD,WAAK,SAAS,MAAM,0BAA2BA,CAAK,EAC9CA,CACP,CAEA,MAAMC,EAAQ,MAAMC,EAAAA,MAAM,OAAA,EACpBC,EAAM,MAAM,KAAK,oBAAoBJ,CAAM,EAEjDI,EAAI,aAAa,OAAO,QAASF,EAAM,EAAE,EACzCE,EAAI,aAAa,OAAO,iBAAkBF,EAAM,aAAa,EAC7DE,EAAI,aAAa,OAAO,QAASF,EAAM,KAAK,EAE5C,MAAM,KAAK,QAAQ,IAAI,OAAOA,EAAM,EAAE,GAAI,KAAK,UAAUA,CAAK,CAAC,EAE/D,KAAK,cAAc,iBAAkB,EAAE,EACvC,KAAK,SAAS,MAAM,kCAAkC,EAEtD,MAAM,KAAK,QAAQ,WAAWE,EAAI,SAAA,EAAYJ,CAAM,CACrD,CAOA,MAAM,SAASA,EAAyB,GAAmB,CAC1DA,EAAO,OAAS,SAEhB,MAAM,KAAK,MAAMA,CAAM,CACxB,CASA,MAAM,MAAMI,EAA6B,CACxC,GAAI,OAAO,KAAK,QAAQ,YAAe,WAAY,CAClD,MAAMH,EAAQ,IAAI,MAAM,4BAA4B,EACpD,WAAK,SAAS,MAAM,0BAA2BA,CAAK,EAC9CA,CACP,CAEKG,IACJA,EAAM,WAAW,QAAQ,SAAS,MAGnC,MAAMC,EAAW,IAAI,IAAID,CAAG,EAE5B,KAAK,SAAS,MAAM,kCAAkC,EAEtD,MAAM,KAAK,QAAQ,WAAW,GAAG,KAAK,QAAQ,MAAM,mBAAmBC,EAAS,aAAa,SAAA,CAAU,EAAE,CAC1G,CASA,MAAM,eAAeD,EAA6B,CACjD,GAAI,OAAO,KAAK,QAAQ,iBAAoB,WAAY,CACvD,MAAMH,EAAQ,IAAI,MAAM,iCAAiC,EACzD,WAAK,SAAS,MAAM,0BAA2BA,CAAK,EAC9CA,CACP,CAEKG,IACJA,EAAM,WAAW,QAAQ,SAAS,MAGnC,MAAM,KAAK,cAAe,MAAM,KAAK,QAAQ,gBAAgBA,EAAK,KAAK,QAAQ,cAAgB,UAAU,CAA4B,CACtI,CACD"}
@@ -1,2 +1,2 @@
1
- import{redirectUrlHandler as o,redirectCallbackHandler as n}from"../utils/handlers.mjs";import{State as a}from"../utils/State.mjs";import{BaseFlow as s}from"./BaseFlow.mjs";import"../utils/crypto.mjs";import"../utils/base64Url.mjs";import"../utils/date.mjs";import"../utils/jwt.mjs";import"../utils/Metadata.mjs";import"../utils/Session.mjs";class H extends s{constructor(r,t,i,e){r.urlHandler||(r.urlHandler=o),r.callbackHandler||(r.callbackHandler=n),super(r,t,i,e)}async login(r={}){if(typeof this.options.urlHandler!="function"){const e=new Error("Missing option: urlHandler");throw this.logging?.error("Required option missing",e),e}const t=await a.create(),i=await this.getAuthorizationUrl(r);i.searchParams.append("state",t.id),i.searchParams.append("code_challenge",t.codeChallenge),i.searchParams.append("nonce",t.nonce),await this.storage.set(`sty.${t.id}`,JSON.stringify(t)),this.dispatchEvent("loginInitiated",[]),this.logging?.debug("Attempting to redirect for login"),await this.options.urlHandler(i.toString(),r)}async register(r={}){r.prompt="create",await this.login(r)}async entry(r){if(typeof this.options.urlHandler!="function"){const i=new Error("Missing option: urlHandler");throw this.logging?.error("Required option missing",i),i}r||(r=globalThis.window?.location.href);const t=new URL(r);this.logging?.debug("Attempting to redirect for entry"),await this.options.urlHandler(`${this.options.issuer}/provider/entry?${t.searchParams.toString()}`)}async handleCallback(r){if(typeof this.options.callbackHandler!="function"){const t=new Error("Missing option: callbackHandler");throw this.logging?.error("Required option missing",t),t}r||(r=globalThis.window?.location.href),await this.tokenExchange(await this.options.callbackHandler(r,this.options.responseMode||"fragment"))}}export{H as RedirectFlow};
1
+ import{redirectUrlHandler as o,redirectCallbackHandler as n}from"../utils/handlers.mjs";import{State as a}from"../utils/State.mjs";import{BaseFlow as s}from"./BaseFlow.mjs";import"../utils/errors.mjs";import"../utils/crypto.mjs";import"../utils/base64Url.mjs";import"../utils/date.mjs";import"../utils/jwt.mjs";import"../utils/Metadata.mjs";import"../utils/Session.mjs";class y extends s{constructor(r,t,i,e){r.urlHandler||(r.urlHandler=o),r.callbackHandler||(r.callbackHandler=n),super(r,t,i,e)}async login(r={}){if(typeof this.options.urlHandler!="function"){const e=new Error("Missing option: urlHandler");throw this.logging?.error("Required option missing",e),e}const t=await a.create(),i=await this.getAuthorizationUrl(r);i.searchParams.append("state",t.id),i.searchParams.append("code_challenge",t.codeChallenge),i.searchParams.append("nonce",t.nonce),await this.storage.set(`sty.${t.id}`,JSON.stringify(t)),this.dispatchEvent("loginInitiated",[]),this.logging?.debug("Attempting to redirect for login"),await this.options.urlHandler(i.toString(),r)}async register(r={}){r.prompt="create",await this.login(r)}async entry(r){if(typeof this.options.urlHandler!="function"){const i=new Error("Missing option: urlHandler");throw this.logging?.error("Required option missing",i),i}r||(r=globalThis.window?.location.href);const t=new URL(r);this.logging?.debug("Attempting to redirect for entry"),await this.options.urlHandler(`${this.options.issuer}/provider/entry?${t.searchParams.toString()}`)}async handleCallback(r){if(typeof this.options.callbackHandler!="function"){const t=new Error("Missing option: callbackHandler");throw this.logging?.error("Required option missing",t),t}r||(r=globalThis.window?.location.href),await this.tokenExchange(await this.options.callbackHandler(r,this.options.responseMode||"fragment"))}}export{y as RedirectFlow};
2
2
  //# sourceMappingURL=RedirectFlow.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"RedirectFlow.mjs","sources":["../../src/flows/RedirectFlow.ts"],"sourcesContent":["import type { SDKOptions, RedirectParams, SDKStorage, SDKHttpClient, SDKLogging } from '../types';\nimport { redirectUrlHandler, redirectCallbackHandler } from '../utils/handlers';\nimport { State } from '../utils/State';\nimport { BaseFlow } from './BaseFlow';\n\n/**\n * Implements the Redirect flow for authentication using a full-page redirect.\n */\nexport class RedirectFlow extends BaseFlow<SDKOptions, RedirectParams> {\n\tconstructor(options: SDKOptions, storage: SDKStorage, httpClient: SDKHttpClient, logging?: SDKLogging) {\n\t\tif (!options.urlHandler) {\n\t\t\toptions.urlHandler = redirectUrlHandler;\n\t\t}\n\t\tif (!options.callbackHandler) {\n\t\t\toptions.callbackHandler = redirectCallbackHandler;\n\t\t}\n\n\t\tsuper(options, storage, httpClient, logging);\n\t}\n\n\t/**\n\t * Initiates the login process via a redirect.\n\t * @param {RedirectParams} [params={}] Optional parameters for redirect configuration.\n\t * @returns {Promise<void>} A promise that resolves when the login process completes.\n\t *\n\t * @throws {Error} Throws an error if URL handler is not defined.\n\t */\n\tasync login(params: RedirectParams = {}): Promise<void> {\n\t\tif (typeof this.options.urlHandler !== 'function') {\n\t\t\tconst error = new Error('Missing option: urlHandler');\n\t\t\tthis.logging?.error('Required option missing', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tconst state = await State.create();\n\t\tconst url = await this.getAuthorizationUrl(params);\n\n\t\turl.searchParams.append('state', state.id);\n\t\turl.searchParams.append('code_challenge', state.codeChallenge);\n\t\turl.searchParams.append('nonce', state.nonce);\n\n\t\tawait this.storage.set(`sty.${state.id}`, JSON.stringify(state));\n\n\t\tthis.dispatchEvent('loginInitiated', []);\n\t\tthis.logging?.debug('Attempting to redirect for login');\n\n\t\tawait this.options.urlHandler(url.toString(), params);\n\t}\n\n\t/**\n\t * Initiates the registration process via a redirect.\n\t * @param {RedirectParams} [params={}] Optional parameters for redirect configuration.\n\t * @returns {Promise<void>} A promise that resolves when the registration process completes.\n\t */\n\tasync register(params: RedirectParams = {}): Promise<void> {\n\t\tparams.prompt = 'create';\n\n\t\tawait this.login(params);\n\t}\n\n\t/**\n\t * Initiates the entry process via a redirect.\n\t * @param {string} url Optional URL to use for the entry process. If not provided, the current window location will be used.\n\t * @returns {Promise<void>} A promise that resolves when the entry process completes.\n\t *\n\t * @throws {Error} Throws an error if URL handler is not defined.\n\t */\n\tasync entry(url?: string): Promise<void> {\n\t\tif (typeof this.options.urlHandler !== 'function') {\n\t\t\tconst error = new Error('Missing option: urlHandler');\n\t\t\tthis.logging?.error('Required option missing', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (!url) {\n\t\t\turl = globalThis.window?.location.href;\n\t\t}\n\n\t\tconst entryUrl = new URL(url);\n\n\t\tthis.logging?.debug('Attempting to redirect for entry');\n\n\t\tawait this.options.urlHandler(`${this.options.issuer}/provider/entry?${entryUrl.searchParams.toString()}`);\n\t}\n\n\t/**\n\t * Handles the callback after login or registration via a redirect.\n\t * @param {string} [url] The URL to handle the callback from. Defaults to the current window location.\n\t * @returns {Promise<void>} A promise that resolves when the callback is handled.\n\t *\n\t * @throws {Error} Throws an error if callback handler is not defined.\n\t */\n\tasync handleCallback(url?: string): Promise<void> {\n\t\tif (typeof this.options.callbackHandler !== 'function') {\n\t\t\tconst error = new Error('Missing option: callbackHandler');\n\t\t\tthis.logging?.error('Required option missing', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (!url) {\n\t\t\turl = globalThis.window?.location.href;\n\t\t}\n\n\t\tawait this.tokenExchange((await this.options.callbackHandler(url, this.options.responseMode || 'fragment')) as Record<string, string>);\n\t}\n}\n"],"names":["RedirectFlow","BaseFlow","options","storage","httpClient","logging","redirectUrlHandler","redirectCallbackHandler","params","error","state","State","url","entryUrl"],"mappings":"sVAQO,MAAMA,UAAqBC,CAAqC,CACtE,YAAYC,EAAqBC,EAAqBC,EAA2BC,EAAsB,CACjGH,EAAQ,aACZA,EAAQ,WAAaI,GAEjBJ,EAAQ,kBACZA,EAAQ,gBAAkBK,GAG3B,MAAML,EAASC,EAASC,EAAYC,CAAO,CAC5C,CASA,MAAM,MAAMG,EAAyB,GAAmB,CACvD,GAAI,OAAO,KAAK,QAAQ,YAAe,WAAY,CAClD,MAAMC,EAAQ,IAAI,MAAM,4BAA4B,EACpD,WAAK,SAAS,MAAM,0BAA2BA,CAAK,EAC9CA,CACP,CAEA,MAAMC,EAAQ,MAAMC,EAAM,OAAA,EACpBC,EAAM,MAAM,KAAK,oBAAoBJ,CAAM,EAEjDI,EAAI,aAAa,OAAO,QAASF,EAAM,EAAE,EACzCE,EAAI,aAAa,OAAO,iBAAkBF,EAAM,aAAa,EAC7DE,EAAI,aAAa,OAAO,QAASF,EAAM,KAAK,EAE5C,MAAM,KAAK,QAAQ,IAAI,OAAOA,EAAM,EAAE,GAAI,KAAK,UAAUA,CAAK,CAAC,EAE/D,KAAK,cAAc,iBAAkB,EAAE,EACvC,KAAK,SAAS,MAAM,kCAAkC,EAEtD,MAAM,KAAK,QAAQ,WAAWE,EAAI,SAAA,EAAYJ,CAAM,CACrD,CAOA,MAAM,SAASA,EAAyB,GAAmB,CAC1DA,EAAO,OAAS,SAEhB,MAAM,KAAK,MAAMA,CAAM,CACxB,CASA,MAAM,MAAMI,EAA6B,CACxC,GAAI,OAAO,KAAK,QAAQ,YAAe,WAAY,CAClD,MAAMH,EAAQ,IAAI,MAAM,4BAA4B,EACpD,WAAK,SAAS,MAAM,0BAA2BA,CAAK,EAC9CA,CACP,CAEKG,IACJA,EAAM,WAAW,QAAQ,SAAS,MAGnC,MAAMC,EAAW,IAAI,IAAID,CAAG,EAE5B,KAAK,SAAS,MAAM,kCAAkC,EAEtD,MAAM,KAAK,QAAQ,WAAW,GAAG,KAAK,QAAQ,MAAM,mBAAmBC,EAAS,aAAa,SAAA,CAAU,EAAE,CAC1G,CASA,MAAM,eAAeD,EAA6B,CACjD,GAAI,OAAO,KAAK,QAAQ,iBAAoB,WAAY,CACvD,MAAMH,EAAQ,IAAI,MAAM,iCAAiC,EACzD,WAAK,SAAS,MAAM,0BAA2BA,CAAK,EAC9CA,CACP,CAEKG,IACJA,EAAM,WAAW,QAAQ,SAAS,MAGnC,MAAM,KAAK,cAAe,MAAM,KAAK,QAAQ,gBAAgBA,EAAK,KAAK,QAAQ,cAAgB,UAAU,CAA4B,CACtI,CACD"}
1
+ {"version":3,"file":"RedirectFlow.mjs","sources":["../../src/flows/RedirectFlow.ts"],"sourcesContent":["import type { SDKOptions, RedirectParams, SDKStorage, SDKHttpClient, SDKLogging } from '../types';\nimport { redirectUrlHandler, redirectCallbackHandler } from '../utils/handlers';\nimport { State } from '../utils/State';\nimport { BaseFlow } from './BaseFlow';\n\n/**\n * Implements the Redirect flow for authentication using a full-page redirect.\n */\nexport class RedirectFlow extends BaseFlow<SDKOptions, RedirectParams> {\n\tconstructor(options: SDKOptions, storage: SDKStorage, httpClient: SDKHttpClient, logging?: SDKLogging) {\n\t\tif (!options.urlHandler) {\n\t\t\toptions.urlHandler = redirectUrlHandler;\n\t\t}\n\t\tif (!options.callbackHandler) {\n\t\t\toptions.callbackHandler = redirectCallbackHandler;\n\t\t}\n\n\t\tsuper(options, storage, httpClient, logging);\n\t}\n\n\t/**\n\t * Initiates the login process via a redirect.\n\t * @param {RedirectParams} [params={}] Optional parameters for redirect configuration.\n\t * @returns {Promise<void>} A promise that resolves when the login process completes.\n\t *\n\t * @throws {Error} Throws an error if URL handler is not defined.\n\t */\n\tasync login(params: RedirectParams = {}): Promise<void> {\n\t\tif (typeof this.options.urlHandler !== 'function') {\n\t\t\tconst error = new Error('Missing option: urlHandler');\n\t\t\tthis.logging?.error('Required option missing', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tconst state = await State.create();\n\t\tconst url = await this.getAuthorizationUrl(params);\n\n\t\turl.searchParams.append('state', state.id);\n\t\turl.searchParams.append('code_challenge', state.codeChallenge);\n\t\turl.searchParams.append('nonce', state.nonce);\n\n\t\tawait this.storage.set(`sty.${state.id}`, JSON.stringify(state));\n\n\t\tthis.dispatchEvent('loginInitiated', []);\n\t\tthis.logging?.debug('Attempting to redirect for login');\n\n\t\tawait this.options.urlHandler(url.toString(), params);\n\t}\n\n\t/**\n\t * Initiates the registration process via a redirect.\n\t * @param {RedirectParams} [params={}] Optional parameters for redirect configuration.\n\t * @returns {Promise<void>} A promise that resolves when the registration process completes.\n\t */\n\tasync register(params: RedirectParams = {}): Promise<void> {\n\t\tparams.prompt = 'create';\n\n\t\tawait this.login(params);\n\t}\n\n\t/**\n\t * Initiates the entry process via a redirect.\n\t * @param {string} url Optional URL to use for the entry process. If not provided, the current window location will be used.\n\t * @returns {Promise<void>} A promise that resolves when the entry process completes.\n\t *\n\t * @throws {Error} Throws an error if URL handler is not defined.\n\t */\n\tasync entry(url?: string): Promise<void> {\n\t\tif (typeof this.options.urlHandler !== 'function') {\n\t\t\tconst error = new Error('Missing option: urlHandler');\n\t\t\tthis.logging?.error('Required option missing', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (!url) {\n\t\t\turl = globalThis.window?.location.href;\n\t\t}\n\n\t\tconst entryUrl = new URL(url);\n\n\t\tthis.logging?.debug('Attempting to redirect for entry');\n\n\t\tawait this.options.urlHandler(`${this.options.issuer}/provider/entry?${entryUrl.searchParams.toString()}`);\n\t}\n\n\t/**\n\t * Handles the callback after login or registration via a redirect.\n\t * @param {string} [url] The URL to handle the callback from. Defaults to the current window location.\n\t * @returns {Promise<void>} A promise that resolves when the callback is handled.\n\t *\n\t * @throws {Error} Throws an error if callback handler is not defined.\n\t */\n\tasync handleCallback(url?: string): Promise<void> {\n\t\tif (typeof this.options.callbackHandler !== 'function') {\n\t\t\tconst error = new Error('Missing option: callbackHandler');\n\t\t\tthis.logging?.error('Required option missing', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (!url) {\n\t\t\turl = globalThis.window?.location.href;\n\t\t}\n\n\t\tawait this.tokenExchange((await this.options.callbackHandler(url, this.options.responseMode || 'fragment')) as Record<string, string>);\n\t}\n}\n"],"names":["RedirectFlow","BaseFlow","options","storage","httpClient","logging","redirectUrlHandler","redirectCallbackHandler","params","error","state","State","url","entryUrl"],"mappings":"kXAQO,MAAMA,UAAqBC,CAAqC,CACtE,YAAYC,EAAqBC,EAAqBC,EAA2BC,EAAsB,CACjGH,EAAQ,aACZA,EAAQ,WAAaI,GAEjBJ,EAAQ,kBACZA,EAAQ,gBAAkBK,GAG3B,MAAML,EAASC,EAASC,EAAYC,CAAO,CAC5C,CASA,MAAM,MAAMG,EAAyB,GAAmB,CACvD,GAAI,OAAO,KAAK,QAAQ,YAAe,WAAY,CAClD,MAAMC,EAAQ,IAAI,MAAM,4BAA4B,EACpD,WAAK,SAAS,MAAM,0BAA2BA,CAAK,EAC9CA,CACP,CAEA,MAAMC,EAAQ,MAAMC,EAAM,OAAA,EACpBC,EAAM,MAAM,KAAK,oBAAoBJ,CAAM,EAEjDI,EAAI,aAAa,OAAO,QAASF,EAAM,EAAE,EACzCE,EAAI,aAAa,OAAO,iBAAkBF,EAAM,aAAa,EAC7DE,EAAI,aAAa,OAAO,QAASF,EAAM,KAAK,EAE5C,MAAM,KAAK,QAAQ,IAAI,OAAOA,EAAM,EAAE,GAAI,KAAK,UAAUA,CAAK,CAAC,EAE/D,KAAK,cAAc,iBAAkB,EAAE,EACvC,KAAK,SAAS,MAAM,kCAAkC,EAEtD,MAAM,KAAK,QAAQ,WAAWE,EAAI,SAAA,EAAYJ,CAAM,CACrD,CAOA,MAAM,SAASA,EAAyB,GAAmB,CAC1DA,EAAO,OAAS,SAEhB,MAAM,KAAK,MAAMA,CAAM,CACxB,CASA,MAAM,MAAMI,EAA6B,CACxC,GAAI,OAAO,KAAK,QAAQ,YAAe,WAAY,CAClD,MAAMH,EAAQ,IAAI,MAAM,4BAA4B,EACpD,WAAK,SAAS,MAAM,0BAA2BA,CAAK,EAC9CA,CACP,CAEKG,IACJA,EAAM,WAAW,QAAQ,SAAS,MAGnC,MAAMC,EAAW,IAAI,IAAID,CAAG,EAE5B,KAAK,SAAS,MAAM,kCAAkC,EAEtD,MAAM,KAAK,QAAQ,WAAW,GAAG,KAAK,QAAQ,MAAM,mBAAmBC,EAAS,aAAa,SAAA,CAAU,EAAE,CAC1G,CASA,MAAM,eAAeD,EAA6B,CACjD,GAAI,OAAO,KAAK,QAAQ,iBAAoB,WAAY,CACvD,MAAMH,EAAQ,IAAI,MAAM,iCAAiC,EACzD,WAAK,SAAS,MAAM,0BAA2BA,CAAK,EAC9CA,CACP,CAEKG,IACJA,EAAM,WAAW,QAAQ,SAAS,MAGnC,MAAM,KAAK,cAAe,MAAM,KAAK,QAAQ,gBAAgBA,EAAK,KAAK,QAAQ,cAAgB,UAAU,CAA4B,CACtI,CACD"}
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./flows/RedirectFlow.cjs"),g=require("./flows/PopupFlow.cjs"),s=require("./flows/NativeFlow.cjs"),a=require("./storages/LocalStorage.cjs"),c=require("./utils/HttpClient.cjs"),q=require("./utils/errors.cjs"),l=require("./types.cjs");require("./utils/handlers.cjs");require("./utils/State.cjs");require("./utils/crypto.cjs");require("./utils/base64Url.cjs");require("./utils/date.cjs");require("./flows/BaseFlow.cjs");require("./utils/jwt.cjs");require("./utils/Metadata.cjs");require("./utils/Session.cjs");require("./utils/NativeFlowHandler.cjs");function w(e){const o=e.storage||a.LocalStorage,n=e.httpClient||c.HttpClient,i=new o,t=new n;let r;return e.logging&&(r=new e.logging,t.logging=r),e.mode==="popup"?new g.PopupFlow(e,i,t,r):e.mode==="native"?new s.NativeFlow(e,i,t,r):new u.RedirectFlow(e,i,t,r)}exports.FallbackError=q.FallbackError;exports.SDKHttpClient=l.SDKHttpClient;exports.SDKLogging=l.SDKLogging;exports.SDKStorage=l.SDKStorage;exports.initFlow=w;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./flows/RedirectFlow.cjs"),s=require("./flows/PopupFlow.cjs"),c=require("./flows/NativeFlow.cjs"),a=require("./flows/EmbeddedFlow.cjs"),w=require("./storages/LocalStorage.cjs"),d=require("./utils/HttpClient.cjs"),l=require("./utils/errors.cjs"),i=require("./types.cjs");require("./utils/handlers.cjs");require("./utils/State.cjs");require("./utils/crypto.cjs");require("./utils/base64Url.cjs");require("./utils/date.cjs");require("./flows/BaseFlow.cjs");require("./utils/jwt.cjs");require("./utils/Metadata.cjs");require("./utils/Session.cjs");require("./utils/NativeFlowHandler.cjs");require("./utils/EmbeddedFlowHandler.cjs");function q(e){const u=e.storage||w.LocalStorage,n=e.httpClient||d.HttpClient,o=new u,t=new n;let r;return e.logging&&(r=new e.logging,t.logging=r),e.mode==="popup"?new s.PopupFlow(e,o,t,r):e.mode==="native"?new c.NativeFlow(e,o,t,r):e.mode==="embedded"?new a.EmbeddedFlow(e,o,t,r):new g.RedirectFlow(e,o,t,r)}exports.FallbackError=l.FallbackError;exports.PopupBlockedError=l.PopupBlockedError;exports.PopupClosedError=l.PopupClosedError;exports.SDKHttpClient=i.SDKHttpClient;exports.SDKLogging=i.SDKLogging;exports.SDKStorage=i.SDKStorage;exports.initFlow=q;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../src/index.ts"],"sourcesContent":["import type { SDKOptions } from './types';\nimport { RedirectFlow } from './flows/RedirectFlow';\nimport { PopupFlow } from './flows/PopupFlow';\nimport { NativeFlow } from './flows/NativeFlow';\nimport { LocalStorage } from './storages/LocalStorage';\nimport { HttpClient } from './utils/HttpClient';\n\nexport * from './utils/errors';\nexport type * from './types';\nexport { SDKStorage, SDKLogging, SDKHttpClient } from './types';\n\n/**\n * Initializes an authentication flow based on the specified mode.\n *\n * @param {SDKOptions & { mode?: 'popup' | 'redirect' | 'native' }} options - The SDK options, including an optional mode. The default storage class is `LocalStorage`.\n * @returns {PopupFlow | RedirectFlow | NativeFlow} A new instance of either PopupFlow, RedirectFlow, or NativeFlow based on the mode.\n */\nexport function initFlow(options: SDKOptions & { mode: 'popup' }): PopupFlow;\nexport function initFlow(options: SDKOptions & { mode: 'redirect' }): RedirectFlow;\nexport function initFlow(options: SDKOptions & { mode: 'native' }): NativeFlow;\nexport function initFlow(options: SDKOptions & { mode?: 'popup' | 'redirect' | 'native' }): PopupFlow | RedirectFlow | NativeFlow;\nexport function initFlow(options: SDKOptions & { mode?: 'popup' | 'redirect' | 'native' }): PopupFlow | RedirectFlow | NativeFlow {\n\tconst StorageClass = options.storage || LocalStorage;\n\tconst HttpClientClass = options.httpClient || HttpClient;\n\n\tconst storage = new StorageClass();\n\tconst httpClient = new HttpClientClass();\n\tlet logging;\n\n\tif (options.logging) {\n\t\tlogging = new options.logging();\n\t\thttpClient.logging = logging;\n\t}\n\n\tif (options.mode === 'popup') {\n\t\treturn new PopupFlow(options, storage, httpClient, logging);\n\t} else if (options.mode === 'native') {\n\t\treturn new NativeFlow(options, storage, httpClient, logging);\n\t} else {\n\t\treturn new RedirectFlow(options, storage, httpClient, logging);\n\t}\n}\n"],"names":["initFlow","options","StorageClass","LocalStorage","HttpClientClass","HttpClient","storage","httpClient","logging","PopupFlow","NativeFlow","RedirectFlow"],"mappings":"ooBAqBO,SAASA,EAASC,EAAyG,CACjI,MAAMC,EAAeD,EAAQ,SAAWE,EAAAA,aAClCC,EAAkBH,EAAQ,YAAcI,EAAAA,WAExCC,EAAU,IAAIJ,EACdK,EAAa,IAAIH,EACvB,IAAII,EAOJ,OALIP,EAAQ,UACXO,EAAU,IAAIP,EAAQ,QACtBM,EAAW,QAAUC,GAGlBP,EAAQ,OAAS,QACb,IAAIQ,EAAAA,UAAUR,EAASK,EAASC,EAAYC,CAAO,EAChDP,EAAQ,OAAS,SACpB,IAAIS,EAAAA,WAAWT,EAASK,EAASC,EAAYC,CAAO,EAEpD,IAAIG,EAAAA,aAAaV,EAASK,EAASC,EAAYC,CAAO,CAE/D"}
1
+ {"version":3,"file":"index.cjs","sources":["../src/index.ts"],"sourcesContent":["import type { SDKOptions } from './types';\nimport { RedirectFlow } from './flows/RedirectFlow';\nimport { PopupFlow } from './flows/PopupFlow';\nimport { NativeFlow } from './flows/NativeFlow';\nimport { EmbeddedFlow } from './flows/EmbeddedFlow';\nimport { LocalStorage } from './storages/LocalStorage';\nimport { HttpClient } from './utils/HttpClient';\n\nexport * from './utils/errors';\nexport type * from './types';\nexport { SDKStorage, SDKLogging, SDKHttpClient } from './types';\n\n/**\n * Initializes an authentication flow based on the specified mode.\n *\n * @param {SDKOptions & { mode?: 'popup' | 'redirect' | 'native' | 'embedded' }} options - The SDK options, including an optional mode. The default storage class is `LocalStorage`.\n * @returns {PopupFlow | RedirectFlow | NativeFlow | EmbeddedFlow} A new instance of either PopupFlow, RedirectFlow, NativeFlow or EmbeddedFlow based on the mode.\n */\nexport function initFlow(options: SDKOptions & { mode: 'popup' }): PopupFlow;\nexport function initFlow(options: SDKOptions & { mode: 'redirect' }): RedirectFlow;\nexport function initFlow(options: SDKOptions & { mode: 'native' }): NativeFlow;\nexport function initFlow(options: SDKOptions & { mode: 'embedded' }): EmbeddedFlow;\nexport function initFlow(options: SDKOptions & { mode?: 'popup' | 'redirect' | 'native' | 'embedded' }): PopupFlow | RedirectFlow | NativeFlow | EmbeddedFlow;\nexport function initFlow(options: SDKOptions & { mode?: 'popup' | 'redirect' | 'native' | 'embedded' }): PopupFlow | RedirectFlow | NativeFlow | EmbeddedFlow {\n\tconst StorageClass = options.storage || LocalStorage;\n\tconst HttpClientClass = options.httpClient || HttpClient;\n\n\tconst storage = new StorageClass();\n\tconst httpClient = new HttpClientClass();\n\tlet logging;\n\n\tif (options.logging) {\n\t\tlogging = new options.logging();\n\t\thttpClient.logging = logging;\n\t}\n\n\tif (options.mode === 'popup') {\n\t\treturn new PopupFlow(options, storage, httpClient, logging);\n\t} else if (options.mode === 'native') {\n\t\treturn new NativeFlow(options, storage, httpClient, logging);\n\t} else if (options.mode === 'embedded') {\n\t\treturn new EmbeddedFlow(options, storage, httpClient, logging);\n\t} else {\n\t\treturn new RedirectFlow(options, storage, httpClient, logging);\n\t}\n}\n"],"names":["initFlow","options","StorageClass","LocalStorage","HttpClientClass","HttpClient","storage","httpClient","logging","PopupFlow","NativeFlow","EmbeddedFlow","RedirectFlow"],"mappings":"qtBAuBO,SAASA,EAASC,EAAqI,CAC7J,MAAMC,EAAeD,EAAQ,SAAWE,EAAAA,aAClCC,EAAkBH,EAAQ,YAAcI,EAAAA,WAExCC,EAAU,IAAIJ,EACdK,EAAa,IAAIH,EACvB,IAAII,EAOJ,OALIP,EAAQ,UACXO,EAAU,IAAIP,EAAQ,QACtBM,EAAW,QAAUC,GAGlBP,EAAQ,OAAS,QACb,IAAIQ,EAAAA,UAAUR,EAASK,EAASC,EAAYC,CAAO,EAChDP,EAAQ,OAAS,SACpB,IAAIS,EAAAA,WAAWT,EAASK,EAASC,EAAYC,CAAO,EACjDP,EAAQ,OAAS,WACpB,IAAIU,EAAAA,aAAaV,EAASK,EAASC,EAAYC,CAAO,EAEtD,IAAII,EAAAA,aAAaX,EAASK,EAASC,EAAYC,CAAO,CAE/D"}
package/dist/index.d.ts CHANGED
@@ -2,14 +2,15 @@ import { SDKOptions } from './types';
2
2
  import { RedirectFlow } from './flows/RedirectFlow';
3
3
  import { PopupFlow } from './flows/PopupFlow';
4
4
  import { NativeFlow } from './flows/NativeFlow';
5
+ import { EmbeddedFlow } from './flows/EmbeddedFlow';
5
6
  export * from './utils/errors';
6
7
  export type * from './types';
7
8
  export { SDKStorage, SDKLogging, SDKHttpClient } from './types';
8
9
  /**
9
10
  * Initializes an authentication flow based on the specified mode.
10
11
  *
11
- * @param {SDKOptions & { mode?: 'popup' | 'redirect' | 'native' }} options - The SDK options, including an optional mode. The default storage class is `LocalStorage`.
12
- * @returns {PopupFlow | RedirectFlow | NativeFlow} A new instance of either PopupFlow, RedirectFlow, or NativeFlow based on the mode.
12
+ * @param {SDKOptions & { mode?: 'popup' | 'redirect' | 'native' | 'embedded' }} options - The SDK options, including an optional mode. The default storage class is `LocalStorage`.
13
+ * @returns {PopupFlow | RedirectFlow | NativeFlow | EmbeddedFlow} A new instance of either PopupFlow, RedirectFlow, NativeFlow or EmbeddedFlow based on the mode.
13
14
  */
14
15
  export declare function initFlow(options: SDKOptions & {
15
16
  mode: 'popup';
@@ -21,5 +22,8 @@ export declare function initFlow(options: SDKOptions & {
21
22
  mode: 'native';
22
23
  }): NativeFlow;
23
24
  export declare function initFlow(options: SDKOptions & {
24
- mode?: 'popup' | 'redirect' | 'native';
25
- }): PopupFlow | RedirectFlow | NativeFlow;
25
+ mode: 'embedded';
26
+ }): EmbeddedFlow;
27
+ export declare function initFlow(options: SDKOptions & {
28
+ mode?: 'popup' | 'redirect' | 'native' | 'embedded';
29
+ }): PopupFlow | RedirectFlow | NativeFlow | EmbeddedFlow;
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import{RedirectFlow as l}from"./flows/RedirectFlow.mjs";import{PopupFlow as g}from"./flows/PopupFlow.mjs";import{NativeFlow as p}from"./flows/NativeFlow.mjs";import{LocalStorage as n}from"./storages/LocalStorage.mjs";import{HttpClient as a}from"./utils/HttpClient.mjs";import{FallbackError as E}from"./utils/errors.mjs";import{SDKHttpClient as P,SDKLogging as R,SDKStorage as j}from"./types.mjs";import"./utils/handlers.mjs";import"./utils/State.mjs";import"./utils/crypto.mjs";import"./utils/base64Url.mjs";import"./utils/date.mjs";import"./flows/BaseFlow.mjs";import"./utils/jwt.mjs";import"./utils/Metadata.mjs";import"./utils/Session.mjs";import"./utils/NativeFlowHandler.mjs";function L(t){const i=t.storage||n,m=t.httpClient||a,e=new i,o=new m;let r;return t.logging&&(r=new t.logging,o.logging=r),t.mode==="popup"?new g(t,e,o,r):t.mode==="native"?new p(t,e,o,r):new l(t,e,o,r)}export{E as FallbackError,P as SDKHttpClient,R as SDKLogging,j as SDKStorage,L as initFlow};
1
+ import{RedirectFlow as l}from"./flows/RedirectFlow.mjs";import{PopupFlow as p}from"./flows/PopupFlow.mjs";import{NativeFlow as g}from"./flows/NativeFlow.mjs";import{EmbeddedFlow as n}from"./flows/EmbeddedFlow.mjs";import{LocalStorage as f}from"./storages/LocalStorage.mjs";import{HttpClient as a}from"./utils/HttpClient.mjs";import{FallbackError as N,PopupBlockedError as R,PopupClosedError as j}from"./utils/errors.mjs";import{SDKHttpClient as y,SDKLogging as z,SDKStorage as A}from"./types.mjs";import"./utils/handlers.mjs";import"./utils/State.mjs";import"./utils/crypto.mjs";import"./utils/base64Url.mjs";import"./utils/date.mjs";import"./flows/BaseFlow.mjs";import"./utils/jwt.mjs";import"./utils/Metadata.mjs";import"./utils/Session.mjs";import"./utils/NativeFlowHandler.mjs";import"./utils/EmbeddedFlowHandler.mjs";function v(r){const m=r.storage||f,i=r.httpClient||a,o=new m,t=new i;let e;return r.logging&&(e=new r.logging,t.logging=e),r.mode==="popup"?new p(r,o,t,e):r.mode==="native"?new g(r,o,t,e):r.mode==="embedded"?new n(r,o,t,e):new l(r,o,t,e)}export{N as FallbackError,R as PopupBlockedError,j as PopupClosedError,y as SDKHttpClient,z as SDKLogging,A as SDKStorage,v as initFlow};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":["import type { SDKOptions } from './types';\nimport { RedirectFlow } from './flows/RedirectFlow';\nimport { PopupFlow } from './flows/PopupFlow';\nimport { NativeFlow } from './flows/NativeFlow';\nimport { LocalStorage } from './storages/LocalStorage';\nimport { HttpClient } from './utils/HttpClient';\n\nexport * from './utils/errors';\nexport type * from './types';\nexport { SDKStorage, SDKLogging, SDKHttpClient } from './types';\n\n/**\n * Initializes an authentication flow based on the specified mode.\n *\n * @param {SDKOptions & { mode?: 'popup' | 'redirect' | 'native' }} options - The SDK options, including an optional mode. The default storage class is `LocalStorage`.\n * @returns {PopupFlow | RedirectFlow | NativeFlow} A new instance of either PopupFlow, RedirectFlow, or NativeFlow based on the mode.\n */\nexport function initFlow(options: SDKOptions & { mode: 'popup' }): PopupFlow;\nexport function initFlow(options: SDKOptions & { mode: 'redirect' }): RedirectFlow;\nexport function initFlow(options: SDKOptions & { mode: 'native' }): NativeFlow;\nexport function initFlow(options: SDKOptions & { mode?: 'popup' | 'redirect' | 'native' }): PopupFlow | RedirectFlow | NativeFlow;\nexport function initFlow(options: SDKOptions & { mode?: 'popup' | 'redirect' | 'native' }): PopupFlow | RedirectFlow | NativeFlow {\n\tconst StorageClass = options.storage || LocalStorage;\n\tconst HttpClientClass = options.httpClient || HttpClient;\n\n\tconst storage = new StorageClass();\n\tconst httpClient = new HttpClientClass();\n\tlet logging;\n\n\tif (options.logging) {\n\t\tlogging = new options.logging();\n\t\thttpClient.logging = logging;\n\t}\n\n\tif (options.mode === 'popup') {\n\t\treturn new PopupFlow(options, storage, httpClient, logging);\n\t} else if (options.mode === 'native') {\n\t\treturn new NativeFlow(options, storage, httpClient, logging);\n\t} else {\n\t\treturn new RedirectFlow(options, storage, httpClient, logging);\n\t}\n}\n"],"names":["initFlow","options","StorageClass","LocalStorage","HttpClientClass","HttpClient","storage","httpClient","logging","PopupFlow","NativeFlow","RedirectFlow"],"mappings":"yqBAqBO,SAASA,EAASC,EAAyG,CACjI,MAAMC,EAAeD,EAAQ,SAAWE,EAClCC,EAAkBH,EAAQ,YAAcI,EAExCC,EAAU,IAAIJ,EACdK,EAAa,IAAIH,EACvB,IAAII,EAOJ,OALIP,EAAQ,UACXO,EAAU,IAAIP,EAAQ,QACtBM,EAAW,QAAUC,GAGlBP,EAAQ,OAAS,QACb,IAAIQ,EAAUR,EAASK,EAASC,EAAYC,CAAO,EAChDP,EAAQ,OAAS,SACpB,IAAIS,EAAWT,EAASK,EAASC,EAAYC,CAAO,EAEpD,IAAIG,EAAaV,EAASK,EAASC,EAAYC,CAAO,CAE/D"}
1
+ {"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":["import type { SDKOptions } from './types';\nimport { RedirectFlow } from './flows/RedirectFlow';\nimport { PopupFlow } from './flows/PopupFlow';\nimport { NativeFlow } from './flows/NativeFlow';\nimport { EmbeddedFlow } from './flows/EmbeddedFlow';\nimport { LocalStorage } from './storages/LocalStorage';\nimport { HttpClient } from './utils/HttpClient';\n\nexport * from './utils/errors';\nexport type * from './types';\nexport { SDKStorage, SDKLogging, SDKHttpClient } from './types';\n\n/**\n * Initializes an authentication flow based on the specified mode.\n *\n * @param {SDKOptions & { mode?: 'popup' | 'redirect' | 'native' | 'embedded' }} options - The SDK options, including an optional mode. The default storage class is `LocalStorage`.\n * @returns {PopupFlow | RedirectFlow | NativeFlow | EmbeddedFlow} A new instance of either PopupFlow, RedirectFlow, NativeFlow or EmbeddedFlow based on the mode.\n */\nexport function initFlow(options: SDKOptions & { mode: 'popup' }): PopupFlow;\nexport function initFlow(options: SDKOptions & { mode: 'redirect' }): RedirectFlow;\nexport function initFlow(options: SDKOptions & { mode: 'native' }): NativeFlow;\nexport function initFlow(options: SDKOptions & { mode: 'embedded' }): EmbeddedFlow;\nexport function initFlow(options: SDKOptions & { mode?: 'popup' | 'redirect' | 'native' | 'embedded' }): PopupFlow | RedirectFlow | NativeFlow | EmbeddedFlow;\nexport function initFlow(options: SDKOptions & { mode?: 'popup' | 'redirect' | 'native' | 'embedded' }): PopupFlow | RedirectFlow | NativeFlow | EmbeddedFlow {\n\tconst StorageClass = options.storage || LocalStorage;\n\tconst HttpClientClass = options.httpClient || HttpClient;\n\n\tconst storage = new StorageClass();\n\tconst httpClient = new HttpClientClass();\n\tlet logging;\n\n\tif (options.logging) {\n\t\tlogging = new options.logging();\n\t\thttpClient.logging = logging;\n\t}\n\n\tif (options.mode === 'popup') {\n\t\treturn new PopupFlow(options, storage, httpClient, logging);\n\t} else if (options.mode === 'native') {\n\t\treturn new NativeFlow(options, storage, httpClient, logging);\n\t} else if (options.mode === 'embedded') {\n\t\treturn new EmbeddedFlow(options, storage, httpClient, logging);\n\t} else {\n\t\treturn new RedirectFlow(options, storage, httpClient, logging);\n\t}\n}\n"],"names":["initFlow","options","StorageClass","LocalStorage","HttpClientClass","HttpClient","storage","httpClient","logging","PopupFlow","NativeFlow","EmbeddedFlow","RedirectFlow"],"mappings":"szBAuBO,SAASA,EAASC,EAAqI,CAC7J,MAAMC,EAAeD,EAAQ,SAAWE,EAClCC,EAAkBH,EAAQ,YAAcI,EAExCC,EAAU,IAAIJ,EACdK,EAAa,IAAIH,EACvB,IAAII,EAOJ,OALIP,EAAQ,UACXO,EAAU,IAAIP,EAAQ,QACtBM,EAAW,QAAUC,GAGlBP,EAAQ,OAAS,QACb,IAAIQ,EAAUR,EAASK,EAASC,EAAYC,CAAO,EAChDP,EAAQ,OAAS,SACpB,IAAIS,EAAWT,EAASK,EAASC,EAAYC,CAAO,EACjDP,EAAQ,OAAS,WACpB,IAAIU,EAAaV,EAASK,EAASC,EAAYC,CAAO,EAEtD,IAAII,EAAaX,EAASK,EAASC,EAAYC,CAAO,CAE/D"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.cjs","sources":["../src/types.ts"],"sourcesContent":["/**\n * Makes properties of `T` required based on the keys provided in `K`.\n *\n * @template T - The type from which properties will be made required.\n * @template K - The keys of `T` that should be required.\n * @example\n * type MyType = { a?: string; b?: number; c?: boolean };\n * type RequiredAB = Mandatory<MyType, 'a' | 'b'>; // { a: string; b: number; c?: boolean }\n */\nexport type Mandatory<T, K extends keyof T> = Required<Pick<T, K>> & Omit<T, K>;\n\n/**\n * A type representing a partial record of key-value pairs where keys are of type `K` and values are of type `T`.\n *\n * @template K - The type of the keys in the record.\n * @template T - The type of the values in the record.\n * @example\n * type StringMap = PartialRecord<string, string>; // { [key: string]: string | undefined }\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type PartialRecord<K extends keyof any, T> = {\n\t[P in K]?: T;\n};\n\n// region SDK\n\n/**\n * List of supported response types.\n */\nexport const ResponseTypeList = ['code', 'id_token'] as const;\n/**\n * Type representing valid response types.\n */\nexport type ResponseType = (typeof ResponseTypeList)[number];\n\n/**\n * List of supported response modes.\n */\nexport const ResponseModeList = ['query', 'fragment'] as const;\n/**\n * Type representing valid response modes.\n */\nexport type ResponseMode = (typeof ResponseModeList)[number];\n\n/**\n * List of supported token endpoint authentication methods.\n */\nexport const TokenEndpointAuthMethodList = ['none'] as const;\n/**\n * Type representing valid token endpoint authentication methods.\n */\nexport type TokenEndpointAuthMethod = (typeof TokenEndpointAuthMethodList)[number];\n\n/**\n * List of supported grant types.\n */\nexport const GrantTypeList = ['authorization_code', 'refresh_token'] as const;\n/**\n * Type representing valid grant types.\n */\nexport type GrantType = (typeof GrantTypeList)[number];\n\n/**\n * List of supported algorithm types.\n */\nexport const AlgorithmTypeList = ['RS256'] as const;\n/**\n * Type representing valid algorithm types.\n */\nexport type AlgorithmType = (typeof AlgorithmTypeList)[number];\n\n/**\n * List of supported subject types.\n */\nexport const SubjectTypeList = ['public'] as const;\n/**\n * Type representing valid subject types.\n */\nexport type SubjectType = (typeof SubjectTypeList)[number];\n\n/**\n * List of supported prompt types.\n */\nexport const PromptTypeList = ['none', 'login', 'create'] as const;\n/**\n * Type representing valid prompt types.\n */\nexport type PromptType = (typeof PromptTypeList)[number];\n\n/**\n * List of supported fallback modes.\n */\nexport const FallbackModeTypeList = ['redirect', 'popup'] as const;\n/**\n * Type representing valid fallback modes.\n */\nexport type FallbackMode = (typeof FallbackModeTypeList)[number];\n\n/**\n * Represents a signing key used in cryptographic operations, such as signing JSON Web Tokens (JWTs).\n *\n * This type defines the key's properties, including its usage, type, identifier, algorithm, and key material.\n */\nexport type SigningKey = {\n\t/**\n\t * The intended use of the key. Common values include \"sig\" for signature and \"enc\" for encryption.\n\t *\n\t * @type {string}\n\t * @example 'sig'\n\t */\n\tuse: string;\n\n\t/**\n\t * The key type. For example, \"RSA\" for RSA keys or \"EC\" for Elliptic Curve keys.\n\t *\n\t * @type {string}\n\t * @example 'RSA'\n\t */\n\tkty: string;\n\n\t/**\n\t * A unique identifier for the key. This is used to distinguish the key from others.\n\t *\n\t * @type {string}\n\t * @example 'key-id-1234'\n\t */\n\tkid: string;\n\n\t/**\n\t * The algorithm used with the key. For example, \"RS256\" for RSA SHA-256.\n\t *\n\t * @type {AlgorithmType}\n\t * @example 'RS256'\n\t */\n\talg: AlgorithmType;\n\n\t/**\n\t * The modulus of the RSA key, encoded in base64url format. For RSA keys, this is a required property.\n\t *\n\t * @type {string}\n\t * @example 'base64url-encoded-modulus'\n\t */\n\tn: string;\n\n\t/**\n\t * The exponent of the RSA key, encoded in base64url format. For RSA keys, this is a required property.\n\t *\n\t * @type {string}\n\t * @example 'base64url-encoded-exponent'\n\t */\n\te: string;\n};\n\n/**\n * Represents the metadata options provided by an authorization server.\n *\n * This metadata includes information about the server's endpoints, supported features, and supported claims.\n */\nexport type MetadataOptions = {\n\t/**\n\t * The issuer of the tokens. This is the authorization server or entity that issues the tokens.\n\t *\n\t * @type {string}\n\t * @example 'https://example.com'\n\t */\n\tissuer: string;\n\n\t/**\n\t * The URL of the authorization endpoint where authentication requests are sent.\n\t *\n\t * @type {string}\n\t * @example 'https://example.com/oauth/authorize'\n\t */\n\tauthorization_endpoint: string;\n\n\t/**\n\t * The URL of the token endpoint where tokens are exchanged.\n\t *\n\t * @type {string}\n\t * @example 'https://example.com/oauth/token'\n\t */\n\ttoken_endpoint: string;\n\n\t/**\n\t * The URL of the JSON Web Key Set (JWKS) endpoint where public keys are available.\n\t *\n\t * @type {string}\n\t * @example 'https://example.com/oauth/jwks'\n\t */\n\tjwks_uri: string;\n\n\t/**\n\t * The types of subjects that are supported by the authorization server.\n\t *\n\t * @type {Array<SubjectType>}\n\t * @example ['public']\n\t */\n\tsubject_types_supported: Array<SubjectType>;\n\n\t/**\n\t * The types of responses supported by the authorization server.\n\t *\n\t * @type {Array<string>}\n\t * @example ['code', 'id_token']\n\t */\n\tresponse_types_supported: Array<string>;\n\n\t/**\n\t * The claims supported by the authorization server.\n\t *\n\t * @type {Array<string>}\n\t * @example ['sub', 'name', 'email']\n\t */\n\tclaims_supported: Array<string>;\n\n\t/**\n\t * The grant types supported by the authorization server.\n\t *\n\t * @type {Array<GrantType>}\n\t * @example ['authorization_code', 'refresh_token']\n\t */\n\tgrant_types_supported: Array<GrantType>;\n\n\t/**\n\t * The response modes supported by the authorization server.\n\t *\n\t * @type {Array<ResponseMode>}\n\t * @example ['query', 'fragment']\n\t */\n\tresponse_modes_supported: Array<ResponseMode>;\n\n\t/**\n\t * The URL of the user info endpoint where user information can be retrieved.\n\t *\n\t * @type {string}\n\t * @example 'https://example.com/userinfo'\n\t */\n\tuserinfo_endpoint: string;\n\n\t/**\n\t * The scopes supported by the authorization server.\n\t *\n\t * @type {Array<string>}\n\t * @example ['openid', 'profile', 'email']\n\t */\n\tscopes_supported: Array<string>;\n\n\t/**\n\t * The authentication methods supported for token endpoint authentication.\n\t *\n\t * @type {Array<TokenEndpointAuthMethod>}\n\t * @example ['none']\n\t */\n\ttoken_endpoint_auth_methods_supported: Array<TokenEndpointAuthMethod>;\n\n\t/**\n\t * The algorithms supported for signing tokens used in the user info endpoint.\n\t *\n\t * @type {Array<AlgorithmType>}\n\t * @example ['RS256']\n\t */\n\tuserinfo_signing_alg_values_supported: Array<AlgorithmType>;\n\n\t/**\n\t * The algorithms supported for signing ID tokens.\n\t *\n\t * @type {Array<AlgorithmType>}\n\t * @example ['RS256']\n\t */\n\tid_token_signing_alg_values_supported: Array<AlgorithmType>;\n\n\t/**\n\t * The algorithms used to sign ID tokens in response.\n\t *\n\t * @type {Array<AlgorithmType>}\n\t * @example ['RS256']\n\t */\n\tid_token_signed_response_alg: Array<AlgorithmType>;\n\n\t/**\n\t * The algorithms used to sign responses from the user info endpoint.\n\t *\n\t * @type {Array<AlgorithmType>}\n\t * @example ['RS256']\n\t */\n\tuserinfo_signed_response_alg: Array<AlgorithmType>;\n\n\t/**\n\t * Indicates whether the request parameter is supported in requests.\n\t *\n\t * @type {boolean}\n\t * @example true\n\t */\n\trequest_parameter_supported: boolean;\n\n\t/**\n\t * Indicates whether the request URI parameter is supported in requests.\n\t *\n\t * @type {boolean}\n\t * @example true\n\t */\n\trequest_uri_parameter_supported: boolean;\n\n\t/**\n\t * Indicates whether request URI registration is required.\n\t *\n\t * @type {boolean}\n\t * @example true\n\t */\n\trequire_request_uri_registration: boolean;\n\n\t/**\n\t * Indicates whether the claims parameter is supported.\n\t *\n\t * @type {boolean}\n\t * @example true\n\t */\n\tclaims_parameter_supported: boolean;\n\n\t/**\n\t * The URL of the revocation endpoint for revoking tokens.\n\t *\n\t * @type {string}\n\t * @example 'https://example.com/oauth/revoke'\n\t */\n\trevocation_endpoint: string;\n\n\t/**\n\t * Indicates whether backchannel logout is supported.\n\t *\n\t * @type {boolean}\n\t * @example true\n\t */\n\tbackchannel_logout_supported: boolean;\n\n\t/**\n\t * Indicates whether backchannel logout session support is provided.\n\t *\n\t * @type {boolean}\n\t * @example true\n\t */\n\tbackchannel_logout_session_supported: boolean;\n\n\t/**\n\t * Indicates whether frontchannel logout is supported.\n\t *\n\t * @type {boolean}\n\t * @example true\n\t */\n\tfrontchannel_logout_supported: boolean;\n\n\t/**\n\t * Indicates whether frontchannel logout session support is provided.\n\t *\n\t * @type {boolean}\n\t * @example true\n\t */\n\tfrontchannel_logout_session_supported: boolean;\n\n\t/**\n\t * The URL of the endpoint where end-session requests can be sent.\n\t *\n\t * @type {string}\n\t * @example 'https://example.com/logout'\n\t */\n\tend_session_endpoint: string;\n\n\t/**\n\t * The algorithms supported for signing request objects.\n\t *\n\t * @type {Array<AlgorithmType>}\n\t * @example ['RS256']\n\t */\n\trequest_object_signing_alg_values_supported: Array<AlgorithmType>;\n\n\t/**\n\t * The code challenge methods supported by the authorization server.\n\t *\n\t * @type {Array<'S256'>}\n\t * @example ['S256']\n\t */\n\tcode_challenge_methods_supported: Array<'S256'>;\n};\n\n/**\n * Represents the standard claims in a JSON Web Token (JWT).\n *\n * These claims are part of the payload in a JWT and convey information about the token, such as its issuer, subject, and expiration.\n */\nexport type JwtClaims = {\n\t/**\n\t * The issuer of the token. This typically represents the authorization server or entity that issued the JWT.\n\t *\n\t * @type {string}\n\t * @example 'https://example.com'\n\t */\n\tiss?: string;\n\n\t/**\n\t * The subject of the token. This is the identifier for the entity the token represents, such as a user ID.\n\t *\n\t * @type {string}\n\t * @example 'user123'\n\t */\n\tsub?: string;\n\n\t/**\n\t * The audience for which the token is intended. This can be a single identifier or an array of identifiers.\n\t *\n\t * @type {string | Array<string>}\n\t * @example 'your-client-id' | ['client1', 'client2']\n\t */\n\taud?: string | Array<string>;\n\n\t/**\n\t * The expiration time of the token, expressed as a Unix timestamp (number of seconds since January 1, 1970).\n\t *\n\t * @type {number}\n\t * @example 1633024800\n\t */\n\texp?: number;\n\n\t/**\n\t * The not-before time of the token, expressed as a Unix timestamp. The token must not be accepted before this time.\n\t *\n\t * @type {number}\n\t * @example 1633021200\n\t */\n\tnbf?: number;\n\n\t/**\n\t * The issued-at time of the token, expressed as a Unix timestamp (number of seconds since January 1, 1970).\n\t *\n\t * @type {number}\n\t * @example 1633022400\n\t */\n\tiat?: number;\n\n\t/**\n\t * A unique identifier for the token. This can be used to prevent token replay attacks.\n\t *\n\t * @type {string}\n\t * @example 'unique-jwt-id-1234'\n\t */\n\tjti?: string;\n};\n\n/**\n * Represents the claims included in an ID token, extending standard JWT claims with additional properties specific to identity tokens.\n *\n * ID tokens are used to authenticate and provide identity information about the user.\n */\nexport type IdTokenClaims = Mandatory<JwtClaims, 'iss' | 'sub' | 'aud' | 'exp' | 'iat'> & {\n\t/**\n\t * The authentication time, indicating when the user was authenticated.\n\t *\n\t * @type {number}\n\t * @example 1633022400\n\t */\n\tauth_time?: number;\n\n\t/**\n\t * A nonce value used to associate a client session with an ID token, preventing replay attacks.\n\t *\n\t * @type {string}\n\t * @example 'nonce-value-1234'\n\t */\n\tnonce?: string;\n\n\t/**\n\t * The Authentication Context Class Reference, indicating the authentication methods used.\n\t *\n\t * @type {string}\n\t * @example '2'\n\t */\n\tacr?: string;\n\n\t/**\n\t * The Authentication Methods References, providing information about the authentication methods used.\n\t *\n\t * @type {unknown}\n\t */\n\tamr?: unknown;\n\n\t/**\n\t * Authorized party, the client that the ID token is intended for.\n\t *\n\t * @type {string}\n\t * @example 'client-id'\n\t */\n\tazp?: string;\n\n\t/**\n\t * Session ID for the user, which can be used to manage user sessions.\n\t *\n\t * @type {string}\n\t * @example 'session-id-1234'\n\t */\n\tsid?: string;\n\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t[key: string]: any;\n};\n\n/**\n * Options for configuring the SDK.\n */\nexport type SDKOptions = {\n\t/**\n\t * Specifies the mode of the SDK operation, either 'popup' or 'redirect'.\n\t *\n\t * @type {'popup' | 'redirect'}\n\t * @default 'redirect'\n\t */\n\tmode?: 'popup' | 'redirect' | 'native';\n\n\t/**\n\t * The issuer of the tokens, typically the URL of the authorization server.\n\t *\n\t * @type {string}\n\t * @example 'https://example.com'\n\t */\n\tissuer: string;\n\n\t/**\n\t * The client ID issued by the authorization server, used to identify the application.\n\t *\n\t * @type {string}\n\t * @example 'your-client-id'\n\t */\n\tclientId: string;\n\n\t/**\n\t * The URI to which the user will be redirected after authentication or authorization.\n\t *\n\t * @type {string}\n\t * @example 'https://example.com/callback'\n\t */\n\tredirectUri: string;\n\n\t/**\n\t * A list of scopes requested by the application, defining the access levels for the tokens.\n\t *\n\t * @type {Array<string>}\n\t * @default ['openid']\n\t * @example ['openid', 'profile']\n\t */\n\tscopes?: Array<string>;\n\n\t/**\n\t * The type of response expected from the authorization server.\n\t *\n\t * @type {ResponseType}\n\t * @default 'code'\n\t */\n\tresponseType?: ResponseType;\n\n\t/**\n\t * The mode in which the response is returned from the authorization server.\n\t *\n\t * @type {ResponseMode}\n\t * @default 'query'\n\t */\n\tresponseMode?: ResponseMode;\n\n\t/**\n\t * The name of the token in storage used to persist authentication information.\n\t *\n\t * @type {string}\n\t * @default 'sty.session'\n\t * @example 'accessToken'\n\t */\n\tstorageTokenName?: string;\n\n\t/**\n\t * The storage mechanism used to save and retrieve authentication information.\n\t *\n\t * @type {SDKStorageType}\n\t * @default LocalStorage\n\t */\n\tstorage?: SDKStorageType;\n\n\t/**\n\t * The HTTP client used for making requests to the authorization server.\n\t *\n\t * @type {SDKHttpClientType}\n\t * @default HttpClient\n\t */\n\thttpClient?: SDKHttpClientType;\n\n\t/**\n\t * The logging mechanism used for logging messages and errors.\n\t *\n\t * @type {SDKLoggingType}\n\t */\n\tlogging?: SDKLoggingType;\n\n\t/**\n\t * Handles the URL redirection to the specified target.\n\t * You can use this method to implement custom URL handling logic, such as opening a new window or navigating to a different page.\n\t *\n\t * @param {string} url - The URL to handle.\n\t * @param {Record<string, unknown>} params - Optional parameters for redirection.\n\t * @returns - A promise that resolves when the redirection is handled.\n\t */\n\turlHandler?: (url: string, params?: Record<string, unknown>) => Promise<unknown>;\n\n\t/**\n\t * Handles the callback from the authorization server after a successful authentication or authorization.\n\t * You can use this method to implement custom logic for processing the response from the authorization server.\n\t *\n\t * @param url - The URL containing the response from the authorization server.\n\t * @param responseMode - The mode in which the response is returned (e.g., 'query', 'fragment').\n\t * @returns - A promise that resolves when the callback is handled.\n\t */\n\tcallbackHandler?: (url: string, responseMode?: ResponseMode) => Promise<unknown>;\n};\n\n/**\n * Abstract class for SDK storage mechanisms.\n */\nexport abstract class SDKStorage {\n\t/**\n\t * Retrieves an item from the storage by key.\n\t *\n\t * @param {string} key - The key of the item to retrieve.\n\t * @returns {string | null} The value associated with the key, or `null` if not found.\n\t */\n\tabstract get(key: string): Promise<string | null>;\n\n\t/**\n\t * Deletes an item from the storage by key.\n\t *\n\t * @param {string} key - The key of the item to delete.\n\t */\n\tabstract delete(key: string): Promise<void>;\n\n\t/**\n\t * Sets an item in the storage with the specified key and value.\n\t *\n\t * @param {string} key - The key to associate with the value.\n\t * @param {string} value - The value to store.\n\t */\n\tabstract set(key: string, value: string): Promise<void>;\n}\n\nexport abstract class SDKLogging {\n\t/*\n\t * Identifier for the login session - can be used to provide additional context for log messages\n\t */\n\txEventId: string | undefined;\n\n\tabstract debug(message: string): void;\n\tabstract info(message: string): void;\n\tabstract warn(message: string): void;\n\tabstract error(message: string, error: Error): void;\n}\n\n/**\n * Abstract class for HTTP client used in the SDK.\n */\nexport abstract class SDKHttpClient {\n\tlogging?: SDKLogging;\n\n\t/**\n\t * Makes an HTTP request to the specified URL with optional options.\n\t * @param {string} url - The URL to which the request is sent.\n\t * @param {RequestInit} options - Optional request options, such as method, headers, body, etc.\n\t */\n\tabstract request<T>(url: string, options?: RequestInit): Promise<HttpClientResponse<T>>;\n}\n\n/**\n * Type representing a constructor function for SDKStorage.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type SDKStorageType = new (...args: Array<any>) => SDKStorage;\n\n/**\n * Type representing a constructor function for SDKHttpClient.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type SDKHttpClientType = new (...args: Array<any>) => SDKHttpClient;\n\n/**\n * Type representing a constructor function for SDKHttpClient.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type SDKLoggingType = new (...args: Array<any>) => SDKLogging;\n\n/**\n * Http client response type.\n */\nexport type HttpClientResponse<T> = {\n\treadonly headers: Headers;\n\treadonly ok: boolean;\n\treadonly status: number;\n\treadonly statusText: string;\n\treadonly url: string;\n\tjson(): Promise<T>;\n\ttext(): Promise<string>;\n};\n\n/**\n * A collection of functions used to handle various events that occur within the SDK.\n */\nexport type EventFunctions = {\n\t/**\n\t * Handler called when an access token has expired.\n\t *\n\t * @param {Object} params - The parameters for the event.\n\t * @param {string} params.accessToken - The expired access token.\n\t * @param {string | null} [params.refreshToken] - The refresh token associated with the access token, if available.\n\t * @returns {Promise<void> | void} A promise that resolves when the handler completes, or void if no asynchronous operation is needed.\n\t */\n\taccessTokenExpired: (params: { accessToken: string; refreshToken?: string | null }) => Promise<void> | void;\n\n\t/**\n\t * Handler called when the SDK is initialized.\n\t *\n\t * @returns {Promise<void> | void} A promise that resolves when the initialization is complete, or void if no asynchronous operation is needed.\n\t */\n\tinit: () => Promise<void> | void;\n\n\t/**\n\t * Handler called when a user has successfully logged in.\n\t *\n\t * @param {Object} params - The parameters for the event.\n\t * @param {string} params.accessToken - The access token obtained after login.\n\t * @param {string | null} [params.refreshToken] - The refresh token obtained after login, if available.\n\t * @param {IdTokenClaims} params.claims - The claims extracted from the ID token.\n\t * @returns {Promise<void> | void} A promise that resolves when the handler completes, or void if no asynchronous operation is needed.\n\t */\n\tloggedIn: (params: { accessToken: string; refreshToken?: string | null; claims: IdTokenClaims }) => Promise<void> | void;\n\n\t/**\n\t * Handler called when login has been initiated.\n\t *\n\t * @returns {Promise<void> | void} A promise that resolves when the login initiation process is complete, or void if no asynchronous operation is needed.\n\t */\n\tloginInitiated: () => Promise<void> | void;\n\n\t/**\n\t * Handler called when a logout request has been initiated.\n\t *\n\t * @param {Object} params - The parameters for the event.\n\t * @param {string} params.idToken - The ID token associated with the logout request.\n\t * @param {IdTokenClaims} params.claims - The claims associated with the ID token.\n\t * @returns {Promise<void> | void} A promise that resolves when the logout initiation process is complete, or void if no asynchronous operation is needed.\n\t */\n\tlogoutInitiated: (params: { idToken: string; claims: IdTokenClaims }) => Promise<void> | void;\n\n\t/**\n\t * Handler called when a user session has been successfully loaded.\n\t *\n\t * @param {Object} params - The parameters for the event.\n\t * @param {string} params.accessToken - The access token associated with the loaded session.\n\t * @param {string | null} [params.refreshToken] - The refresh token associated with the session, if available.\n\t * @param {IdTokenClaims} params.claims - The claims associated with the ID token in the session.\n\t * @returns {Promise<void> | void} A promise that resolves when the session loading is complete, or void if no asynchronous operation is needed.\n\t */\n\tsessionLoaded: (params: { accessToken: string; refreshToken?: string | null; claims: IdTokenClaims }) => Promise<void> | void;\n\n\t/**\n\t * Handler called when an access token has been successfully refreshed.\n\t *\n\t * @param {Object} params - The parameters for the event.\n\t * @param {string} params.accessToken - The new access token obtained after the refresh.\n\t * @param {string} params.refreshToken - The refresh token used to obtain the new access token.\n\t * @param {IdTokenClaims} params.claims - The claims extracted from the new ID token.\n\t * @returns {Promise<void> | void} A promise that resolves when the token refresh is complete, or void if no asynchronous operation is needed.\n\t */\n\ttokenRefreshed: (params: { accessToken: string; refreshToken: string; claims: IdTokenClaims }) => Promise<void> | void;\n\n\t/**\n\t * Handler called when a token refresh operation fails.\n\t *\n\t * @param {Object} params - The parameters for the event.\n\t * @param {string} params.refreshToken - The refresh token that was used in the failed refresh operation.\n\t * @returns {Promise<void> | void} A promise that resolves when the handler completes, or void if no asynchronous operation is needed.\n\t */\n\ttokenRefreshFailed: (params: { refreshToken: string }) => Promise<void> | void;\n\n\t/**\n\t * Handler called when a token has been successfully revoked.\n\t *\n\t * @param {Object} params - The parameters for the event.\n\t * @param {string} params.token - The token that was revoked.\n\t * @param {'refresh_token' | 'access_token'} params.tokenTypeHint - The type of token that was revoked.\n\t * @returns {Promise<void> | void} A promise that resolves when the handler completes, or void if no asynchronous operation is needed.\n\t */\n\ttokenRevoked: (params: { token: string; tokenTypeHint: 'refresh_token' | 'access_token' }) => Promise<void> | void;\n\n\t/**\n\t * Handler called when a token revocation operation fails.\n\t *\n\t * @param {Object} params - The parameters for the event.\n\t * @param {string} params.token - The token that was attempted to be revoked.\n\t * @param {'refresh_token' | 'access_token'} params.tokenTypeHint - The type of token that was attempted to be revoked.\n\t * @returns {Promise<void> | void} A promise that resolves when the handler completes, or void if no asynchronous operation is needed.\n\t */\n\ttokenRevokeFailed: (params: { token: string; tokenTypeHint: 'refresh_token' | 'access_token' }) => Promise<void> | void;\n};\n\n// endregion\n\n// region Flows\n\n/**\n * Extra parameters that can be used in requests.\n */\n/**\n * Additional parameters that can be included in authentication or authorization requests.\n */\nexport type ExtraRequestArgs = {\n\t/**\n\t * Specifies the type of prompt to display to the user during authentication or authorization.\n\t *\n\t * @type {PromptType}\n\t * @example 'none' | 'login' | 'create'\n\t */\n\tprompt?: PromptType;\n\n\t/**\n\t * Provides a hint to the authorization server about the user's email or username.\n\t *\n\t * @type {string}\n\t * @example 'user@example.com'\n\t */\n\tloginHint?: string;\n\n\t/**\n\t * A list of values used to request specific authentication contexts or levels of assurance.\n\t *\n\t * This parameter allows requesting specific authentication contexts (e.g., multi-factor authentication)\n\t * or other criteria that the authorization server should consider when authenticating the user.\n\t *\n\t * @type {Array<string>}\n\t * @example ['urn:mace:incommon:iap:bronze', 'urn:mace:incommon:iap:silver']\n\t */\n\tacrValues?: Array<string>;\n\n\t/**\n\t * A list of locale codes to request specific language and regional preferences for the user interface.\n\t *\n\t * This parameter allows requesting the user interface to be presented in specific languages or regional formats.\n\t *\n\t * @type {Array<string>}\n\t * @example ['en-US', 'fr-CA']\n\t */\n\tuiLocales?: Array<string>;\n\n\t/**\n\t * A list of audience values to specify the intended recipients of the token.\n\t *\n\t * This parameter allows requesting that the issued token is intended for specific audiences.\n\t *\n\t * @type {Array<string>}\n\t * @example ['https://api.example.com', 'https://service.example.com']\n\t */\n\taudiences?: Array<string>;\n};\n\n/**\n * Params for configuring logout behavior.\n */\nexport type LogoutParams = {\n\t/**\n\t * The URI to redirect to after a successful logout.\n\t *\n\t * If specified, the user will be redirected to this URI upon completing the logout process.\n\t * This is often used to send users back to the main application or a custom post-logout page.\n\t *\n\t * @type {string}\n\t * @example 'https://example.com/home'\n\t */\n\tpostLogoutRedirectUri?: string;\n};\n\n/**\n * Parameters for redirect authentication flow.\n */\nexport type RedirectParams = ExtraRequestArgs & {\n\t/**\n\t * The method used to update the browser's location after authentication or authorization.\n\t *\n\t * Determines whether the new URL should replace the current URL in the history or be added to it.\n\t *\n\t * @type {'replace' | 'assign'}\n\t * @default 'assign'\n\t */\n\tlocationMethod?: 'replace' | 'assign';\n\n\t/**\n\t * The window in which the redirect should occur.\n\t *\n\t * Specifies whether the redirect should happen in the top-level window or the current window.\n\t *\n\t * @type {'top' | 'self'}\n\t * @default 'self'\n\t */\n\ttargetWindow?: 'top' | 'self';\n};\n\n/**\n * Features for customizing the popup window.\n */\nexport type PopupWindowFeatures = {\n\t/**\n\t * The horizontal position of the popup window relative to the left edge of the screen.\n\t *\n\t * @type {number}\n\t * @example 100\n\t */\n\tleft?: number;\n\n\t/**\n\t * The vertical position of the popup window relative to the top edge of the screen.\n\t *\n\t * @type {number}\n\t * @example 100\n\t */\n\ttop?: number;\n\n\t/**\n\t * The width of the popup window.\n\t *\n\t * @type {number}\n\t * @example 600\n\t */\n\twidth?: number;\n\n\t/**\n\t * The height of the popup window.\n\t *\n\t * @type {number}\n\t * @example 400\n\t */\n\theight?: number;\n\n\t/**\n\t * Whether the popup window should display a menubar.\n\t *\n\t * Can be a boolean value or a string ('yes' or 'no').\n\t *\n\t * @type {boolean | string}\n\t * @example true\n\t */\n\tmenubar?: boolean | string;\n\n\t/**\n\t * Whether the popup window should display a toolbar.\n\t *\n\t * Can be a boolean value or a string ('yes' or 'no').\n\t *\n\t * @type {boolean | string}\n\t * @example true\n\t */\n\ttoolbar?: boolean | string;\n\n\t/**\n\t * Whether the popup window should display the address/location bar.\n\t *\n\t * Can be a boolean value or a string ('yes' or 'no').\n\t *\n\t * @type {boolean | string}\n\t * @example true\n\t */\n\tlocation?: boolean | string;\n\n\t/**\n\t * Whether the popup window should display a status bar.\n\t *\n\t * Can be a boolean value or a string ('yes' or 'no').\n\t *\n\t * @type {boolean | string}\n\t * @example true\n\t */\n\tstatus?: boolean | string;\n\n\t/**\n\t * Whether the popup window should be resizable.\n\t *\n\t * Can be a boolean value or a string ('yes' or 'no').\n\t *\n\t * @type {boolean | string}\n\t * @example false\n\t */\n\tresizable?: boolean | string;\n\n\t/**\n\t * Whether the popup window should display scrollbars.\n\t *\n\t * Can be a boolean value or a string ('yes' or 'no').\n\t *\n\t * @type {boolean | string}\n\t * @example false\n\t */\n\tscrollbars?: boolean | string;\n\n\t[key: string]: boolean | string | number | undefined;\n};\n\n/**\n * Parameters for popup authentication flow.\n */\nexport type PopupParams = ExtraRequestArgs & {\n\t/**\n\t * Configuration options for the popup window, including size, position, and other features.\n\t *\n\t * @type {PopupWindowFeatures}\n\t */\n\tpopupWindowFeatures?: PopupWindowFeatures;\n\n\t/**\n\t * The target of the popup window, which specifies where the popup should be opened.\n\t *\n\t * @type {string}\n\t * @example '_blank' | '_self' | '_parent' | '_top'\n\t */\n\tpopupWindowTarget?: string;\n};\n\n/**\n * Parameters for native authentication flow.\n */\nexport type NativeParams = RedirectParams & { sdk?: string };\n\nexport declare const WidgetTypeList: readonly [\n\t'layout',\n\t'submit',\n\t'close',\n\t'static',\n\t'input',\n\t'checkbox',\n\t'password',\n\t'select',\n\t'multiSelect',\n\t'passcode',\n\t'date',\n\t'phone',\n\t'loading',\n\t'passkeyLogin',\n\t'passkeyEnroll',\n\t'webauthnLogin',\n\t'webauthnEnroll',\n];\nexport type WidgetType = (typeof WidgetTypeList)[number];\nexport declare const SelectOptionTypeList: readonly ['item', 'group'];\nexport type SelectOptionType = (typeof SelectOptionTypeList)[number];\nexport type BrandingData = {\n\tlogoUrl: string | null;\n\tbrandName: string | null;\n\tcopyright: string | null;\n\tprivacyPolicyUrl: string | null;\n\tsiteTermsUrl: string | null;\n};\nexport type CheckboxWidget = {\n\tid: string;\n\ttype: 'checkbox';\n\tlabel?: string;\n\treadonly?: boolean;\n\tvalue?: boolean;\n\trender: {\n\t\ttype: 'checkboxHidden' | 'checkboxShown';\n\t\tlabelType: 'text' | 'html';\n\t};\n\tvalidator?: {\n\t\trequired?: boolean;\n\t};\n};\nexport type DateWidget = {\n\tid: string;\n\ttype: 'date';\n\tlabel?: string;\n\tplaceholder?: string;\n\treadonly?: boolean;\n\tvalue?: string;\n\trender: {\n\t\ttype: 'native' | 'fieldSet';\n\t};\n\tvalidator?: {\n\t\tnotBefore?: string;\n\t\tnotAfter?: string;\n\t\trequired?: boolean;\n\t};\n};\nexport type InputWidget = {\n\tid: string;\n\ttype: 'input';\n\tlabel?: string;\n\tvalue?: string;\n\tplaceholder?: string;\n\treadonly?: boolean;\n\tautocomplete?: string;\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tinputmode: any;\n\trender?: {\n\t\tautocompleteHint?: string;\n\t};\n\tvalidator?: {\n\t\trequired?: boolean;\n\t\tminLength?: number;\n\t\tmaxLength?: number;\n\t\tregex?: string;\n\t};\n};\nexport type PasscodeWidget = {\n\tid: string;\n\ttype: 'passcode';\n\tlabel?: string;\n\tvalidator?: {\n\t\tlength?: number;\n\t};\n};\nexport type PasswordWidget = {\n\tid: string;\n\ttype: 'password';\n\tlabel?: string;\n\tqualityIndicator?: boolean;\n\tvalidator?: {\n\t\tminLength?: number;\n\t\tmaxLength?: number;\n\t\tmaxNumericCharacterSequences?: number;\n\t\tmaxRepeatedCharacters?: number;\n\t\tmustContain?: Array<'UPPERCASE' | 'LOWERCASE' | 'NUMERIC' | 'SPECIAL'>;\n\t\trestrictedCharacters?: string;\n\t};\n};\nexport type PhoneWidget = {\n\tid: string;\n\ttype: 'phone';\n\tlabel?: string;\n\treadonly?: boolean;\n\tvalue?: string;\n\tvalidator?: {\n\t\trequired?: boolean;\n\t};\n};\nexport type SelectWidgetOption = {\n\ttype: 'item';\n\tlabel?: string;\n\tvalue: string;\n};\nexport type SelectWidgetOptionGroup = {\n\ttype: 'group';\n\tlabel?: string;\n\toptions: Array<SelectWidgetOption>;\n};\nexport type SelectWidget = {\n\tid: string;\n\ttype: 'select';\n\tlabel?: string;\n\treadonly?: boolean;\n\tvalues?: Array<string>;\n\tplaceholder?: string;\n\trender: {\n\t\ttype: 'dropdown' | 'radio';\n\t};\n\toptions: Array<SelectWidgetOptionGroup | SelectWidgetOption>;\n\tvalidator?: {\n\t\trequired?: boolean;\n\t};\n};\nexport type MultiSelectWidget = {\n\tid: string;\n\ttype: 'multiSelect';\n\tlabel?: string;\n\treadonly?: boolean;\n\tvalues?: Array<string>;\n\tplaceholder?: string;\n\trender: {\n\t\ttype: 'dropdown' | 'checkbox';\n\t};\n\toptions: Array<SelectWidgetOptionGroup | SelectWidgetOption>;\n\tvalidator?: {\n\t\tminSelectable?: number;\n\t\tmaxSelectable?: number;\n\t};\n};\nexport type StaticWidget = {\n\tid: string;\n\ttype: 'static';\n\tvalue: string;\n\trender: {\n\t\ttype: 'html' | 'text';\n\t};\n};\nexport type SubmitWidget = {\n\tid: string;\n\ttype: 'submit';\n\tlabel?: string;\n\trender: {\n\t\ttype: 'button' | 'link';\n\t\ttextColor?: string;\n\t\tbgColor?: string;\n\t\thint?: {\n\t\t\ticon?: string;\n\t\t\tvariant?: string;\n\t\t};\n\t};\n};\nexport type CloseWidget = {\n\tid: string;\n\ttype: 'close';\n\tlabel?: string;\n\trender: {\n\t\ttype: 'button' | 'link';\n\t\ttextColor?: string;\n\t\tbgColor?: string;\n\t\thint?: {\n\t\t\ticon?: string;\n\t\t\tvariant?: string;\n\t\t};\n\t};\n};\nexport type FormWidget = {\n\tid: string;\n\ttype: 'form';\n\twidgets: Array<\n\t\tCheckboxWidget | DateWidget | InputWidget | PasscodeWidget | PasswordWidget | PhoneWidget | SelectWidget | MultiSelectWidget | StaticWidget | SubmitWidget\n\t>;\n};\nexport type Widget = {\n\ttype: 'widget';\n\tformId: string;\n\twidgetId: string;\n};\nexport type LayoutWidget = {\n\ttype: 'vertical' | 'horizontal';\n\titems: Array<Widget | LayoutWidget>;\n};\nexport type PasskeyLoginWidget = {\n\tid: string;\n\tlabel?: string;\n\trender: {\n\t\ttype: 'button';\n\t\thint?: {\n\t\t\tvariant?: string;\n\t\t};\n\t\tnotification?: {\n\t\t\tcancelled?: string;\n\t\t};\n\t};\n\tassertionOptions: PublicKeyCredentialRequestOptions;\n};\nexport type PasskeyEnrollWidget = {\n\tid: string;\n\tlabel?: string;\n\trender: {\n\t\ttype: 'button';\n\t\thint?: {\n\t\t\tvariant?: string;\n\t\t};\n\t\tnotification?: {\n\t\t\tcancelled?: string;\n\t\t};\n\t};\n\tenrollOptions: PublicKeyCredentialCreationOptions;\n};\nexport type WebauthnLoginWidget = {\n\tid: string;\n\tlabel?: string;\n\tauthenticatorType: 'deviceBiometrics' | 'securityKey';\n\trender: {\n\t\ttype: 'button';\n\t\thint?: {\n\t\t\tvariant?: string;\n\t\t};\n\t\tnotification?: {\n\t\t\tcancelled?: string;\n\t\t};\n\t};\n\tassertionOptions: PublicKeyCredentialRequestOptions;\n};\nexport type WebauthnEnrollWidget = {\n\tid: string;\n\tlabel?: string;\n\tauthenticatorType: 'deviceBiometrics' | 'securityKey';\n\trender: {\n\t\ttype: 'button';\n\t\thint?: {\n\t\t\tvariant?: string;\n\t\t};\n\t\tnotification?: {\n\t\t\tcancelled?: string;\n\t\t};\n\t};\n\tenrollOptions: PublicKeyCredentialCreationOptions;\n};\nexport type LoginFlowMessage = {\n\ttype: string;\n\ttext: string;\n};\nexport type LoginFlowState = {\n\thostedUrl?: string;\n\tfinalizeUrl?: string;\n\tscreen?: string;\n\tbranding?: BrandingData;\n\tforms?: Array<FormWidget>;\n\tlayout?: LayoutWidget;\n\tmessages?: Record<string, Record<string, LoginFlowMessage>> & {\n\t\tglobal?: LoginFlowMessage;\n\t};\n};\nexport type AssertionPublicKeyCredential = PublicKeyCredential & {\n\tresponse: AuthenticatorAssertionResponse;\n};\nexport type AssertionCredentialData = {\n\tid: string;\n\ttype: string;\n\trawId: string;\n\tresponse: {\n\t\tclientDataJSON: string;\n\t\tauthenticatorData: string;\n\t\tsignature: string;\n\t\tuserHandle: string;\n\t};\n};\nexport type AttestationPublicKeyCredential = PublicKeyCredential & {\n\tresponse: AuthenticatorAttestationResponse;\n};\nexport type AttestationCredentialData = {\n\tid: string;\n\ttype: string;\n\trawId: string;\n\tauthenticatorAttachment: string | null;\n\tresponse: {\n\t\tclientDataJSON: string;\n\t\tattestationObject: string;\n\t\ttransports: Array<string>;\n\t};\n};\n\n// endregion\n"],"names":["ResponseTypeList","ResponseModeList","TokenEndpointAuthMethodList","GrantTypeList","AlgorithmTypeList","SubjectTypeList","PromptTypeList","FallbackModeTypeList","SDKStorage","SDKLogging","SDKHttpClient"],"mappings":"gFA6BO,MAAMA,EAAmB,CAAC,OAAQ,UAAU,EAStCC,EAAmB,CAAC,QAAS,UAAU,EASvCC,EAA8B,CAAC,MAAM,EASrCC,EAAgB,CAAC,qBAAsB,eAAe,EAStDC,EAAoB,CAAC,OAAO,EAS5BC,EAAkB,CAAC,QAAQ,EAS3BC,EAAiB,CAAC,OAAQ,QAAS,QAAQ,EAS3CC,EAAuB,CAAC,WAAY,OAAO,EAihBjD,MAAeC,CAAW,CAuBjC,CAEO,MAAeC,CAAW,CAIhC,QAMD,CAKO,MAAeC,CAAc,CACnC,OAQD"}
1
+ {"version":3,"file":"types.cjs","sources":["../src/types.ts"],"sourcesContent":["/**\n * Makes properties of `T` required based on the keys provided in `K`.\n *\n * @template T - The type from which properties will be made required.\n * @template K - The keys of `T` that should be required.\n * @example\n * type MyType = { a?: string; b?: number; c?: boolean };\n * type RequiredAB = Mandatory<MyType, 'a' | 'b'>; // { a: string; b: number; c?: boolean }\n */\nexport type Mandatory<T, K extends keyof T> = Required<Pick<T, K>> & Omit<T, K>;\n\n/**\n * A type representing a partial record of key-value pairs where keys are of type `K` and values are of type `T`.\n *\n * @template K - The type of the keys in the record.\n * @template T - The type of the values in the record.\n * @example\n * type StringMap = PartialRecord<string, string>; // { [key: string]: string | undefined }\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type PartialRecord<K extends keyof any, T> = {\n\t[P in K]?: T;\n};\n\n// region SDK\n\n/**\n * List of supported response types.\n */\nexport const ResponseTypeList = ['code', 'id_token'] as const;\n/**\n * Type representing valid response types.\n */\nexport type ResponseType = (typeof ResponseTypeList)[number];\n\n/**\n * List of supported response modes.\n */\nexport const ResponseModeList = ['query', 'fragment'] as const;\n/**\n * Type representing valid response modes.\n */\nexport type ResponseMode = (typeof ResponseModeList)[number];\n\n/**\n * List of supported token endpoint authentication methods.\n */\nexport const TokenEndpointAuthMethodList = ['none'] as const;\n/**\n * Type representing valid token endpoint authentication methods.\n */\nexport type TokenEndpointAuthMethod = (typeof TokenEndpointAuthMethodList)[number];\n\n/**\n * List of supported grant types.\n */\nexport const GrantTypeList = ['authorization_code', 'refresh_token'] as const;\n/**\n * Type representing valid grant types.\n */\nexport type GrantType = (typeof GrantTypeList)[number];\n\n/**\n * List of supported algorithm types.\n */\nexport const AlgorithmTypeList = ['RS256'] as const;\n/**\n * Type representing valid algorithm types.\n */\nexport type AlgorithmType = (typeof AlgorithmTypeList)[number];\n\n/**\n * List of supported subject types.\n */\nexport const SubjectTypeList = ['public'] as const;\n/**\n * Type representing valid subject types.\n */\nexport type SubjectType = (typeof SubjectTypeList)[number];\n\n/**\n * List of supported prompt types.\n */\nexport const PromptTypeList = ['none', 'login', 'create'] as const;\n/**\n * Type representing valid prompt types.\n */\nexport type PromptType = (typeof PromptTypeList)[number];\n\n/**\n * List of supported fallback modes.\n */\nexport const FallbackModeTypeList = ['redirect', 'popup'] as const;\n/**\n * Type representing valid fallback modes.\n */\nexport type FallbackMode = (typeof FallbackModeTypeList)[number];\n\n/**\n * Represents a signing key used in cryptographic operations, such as signing JSON Web Tokens (JWTs).\n *\n * This type defines the key's properties, including its usage, type, identifier, algorithm, and key material.\n */\nexport type SigningKey = {\n\t/**\n\t * The intended use of the key. Common values include \"sig\" for signature and \"enc\" for encryption.\n\t *\n\t * @type {string}\n\t * @example 'sig'\n\t */\n\tuse: string;\n\n\t/**\n\t * The key type. For example, \"RSA\" for RSA keys or \"EC\" for Elliptic Curve keys.\n\t *\n\t * @type {string}\n\t * @example 'RSA'\n\t */\n\tkty: string;\n\n\t/**\n\t * A unique identifier for the key. This is used to distinguish the key from others.\n\t *\n\t * @type {string}\n\t * @example 'key-id-1234'\n\t */\n\tkid: string;\n\n\t/**\n\t * The algorithm used with the key. For example, \"RS256\" for RSA SHA-256.\n\t *\n\t * @type {AlgorithmType}\n\t * @example 'RS256'\n\t */\n\talg: AlgorithmType;\n\n\t/**\n\t * The modulus of the RSA key, encoded in base64url format. For RSA keys, this is a required property.\n\t *\n\t * @type {string}\n\t * @example 'base64url-encoded-modulus'\n\t */\n\tn: string;\n\n\t/**\n\t * The exponent of the RSA key, encoded in base64url format. For RSA keys, this is a required property.\n\t *\n\t * @type {string}\n\t * @example 'base64url-encoded-exponent'\n\t */\n\te: string;\n};\n\n/**\n * Represents the metadata options provided by an authorization server.\n *\n * This metadata includes information about the server's endpoints, supported features, and supported claims.\n */\nexport type MetadataOptions = {\n\t/**\n\t * The issuer of the tokens. This is the authorization server or entity that issues the tokens.\n\t *\n\t * @type {string}\n\t * @example 'https://example.com'\n\t */\n\tissuer: string;\n\n\t/**\n\t * The URL of the authorization endpoint where authentication requests are sent.\n\t *\n\t * @type {string}\n\t * @example 'https://example.com/oauth/authorize'\n\t */\n\tauthorization_endpoint: string;\n\n\t/**\n\t * The URL of the token endpoint where tokens are exchanged.\n\t *\n\t * @type {string}\n\t * @example 'https://example.com/oauth/token'\n\t */\n\ttoken_endpoint: string;\n\n\t/**\n\t * The URL of the JSON Web Key Set (JWKS) endpoint where public keys are available.\n\t *\n\t * @type {string}\n\t * @example 'https://example.com/oauth/jwks'\n\t */\n\tjwks_uri: string;\n\n\t/**\n\t * The types of subjects that are supported by the authorization server.\n\t *\n\t * @type {Array<SubjectType>}\n\t * @example ['public']\n\t */\n\tsubject_types_supported: Array<SubjectType>;\n\n\t/**\n\t * The types of responses supported by the authorization server.\n\t *\n\t * @type {Array<string>}\n\t * @example ['code', 'id_token']\n\t */\n\tresponse_types_supported: Array<string>;\n\n\t/**\n\t * The claims supported by the authorization server.\n\t *\n\t * @type {Array<string>}\n\t * @example ['sub', 'name', 'email']\n\t */\n\tclaims_supported: Array<string>;\n\n\t/**\n\t * The grant types supported by the authorization server.\n\t *\n\t * @type {Array<GrantType>}\n\t * @example ['authorization_code', 'refresh_token']\n\t */\n\tgrant_types_supported: Array<GrantType>;\n\n\t/**\n\t * The response modes supported by the authorization server.\n\t *\n\t * @type {Array<ResponseMode>}\n\t * @example ['query', 'fragment']\n\t */\n\tresponse_modes_supported: Array<ResponseMode>;\n\n\t/**\n\t * The URL of the user info endpoint where user information can be retrieved.\n\t *\n\t * @type {string}\n\t * @example 'https://example.com/userinfo'\n\t */\n\tuserinfo_endpoint: string;\n\n\t/**\n\t * The scopes supported by the authorization server.\n\t *\n\t * @type {Array<string>}\n\t * @example ['openid', 'profile', 'email']\n\t */\n\tscopes_supported: Array<string>;\n\n\t/**\n\t * The authentication methods supported for token endpoint authentication.\n\t *\n\t * @type {Array<TokenEndpointAuthMethod>}\n\t * @example ['none']\n\t */\n\ttoken_endpoint_auth_methods_supported: Array<TokenEndpointAuthMethod>;\n\n\t/**\n\t * The algorithms supported for signing tokens used in the user info endpoint.\n\t *\n\t * @type {Array<AlgorithmType>}\n\t * @example ['RS256']\n\t */\n\tuserinfo_signing_alg_values_supported: Array<AlgorithmType>;\n\n\t/**\n\t * The algorithms supported for signing ID tokens.\n\t *\n\t * @type {Array<AlgorithmType>}\n\t * @example ['RS256']\n\t */\n\tid_token_signing_alg_values_supported: Array<AlgorithmType>;\n\n\t/**\n\t * The algorithms used to sign ID tokens in response.\n\t *\n\t * @type {Array<AlgorithmType>}\n\t * @example ['RS256']\n\t */\n\tid_token_signed_response_alg: Array<AlgorithmType>;\n\n\t/**\n\t * The algorithms used to sign responses from the user info endpoint.\n\t *\n\t * @type {Array<AlgorithmType>}\n\t * @example ['RS256']\n\t */\n\tuserinfo_signed_response_alg: Array<AlgorithmType>;\n\n\t/**\n\t * Indicates whether the request parameter is supported in requests.\n\t *\n\t * @type {boolean}\n\t * @example true\n\t */\n\trequest_parameter_supported: boolean;\n\n\t/**\n\t * Indicates whether the request URI parameter is supported in requests.\n\t *\n\t * @type {boolean}\n\t * @example true\n\t */\n\trequest_uri_parameter_supported: boolean;\n\n\t/**\n\t * Indicates whether request URI registration is required.\n\t *\n\t * @type {boolean}\n\t * @example true\n\t */\n\trequire_request_uri_registration: boolean;\n\n\t/**\n\t * Indicates whether the claims parameter is supported.\n\t *\n\t * @type {boolean}\n\t * @example true\n\t */\n\tclaims_parameter_supported: boolean;\n\n\t/**\n\t * The URL of the revocation endpoint for revoking tokens.\n\t *\n\t * @type {string}\n\t * @example 'https://example.com/oauth/revoke'\n\t */\n\trevocation_endpoint: string;\n\n\t/**\n\t * Indicates whether backchannel logout is supported.\n\t *\n\t * @type {boolean}\n\t * @example true\n\t */\n\tbackchannel_logout_supported: boolean;\n\n\t/**\n\t * Indicates whether backchannel logout session support is provided.\n\t *\n\t * @type {boolean}\n\t * @example true\n\t */\n\tbackchannel_logout_session_supported: boolean;\n\n\t/**\n\t * Indicates whether frontchannel logout is supported.\n\t *\n\t * @type {boolean}\n\t * @example true\n\t */\n\tfrontchannel_logout_supported: boolean;\n\n\t/**\n\t * Indicates whether frontchannel logout session support is provided.\n\t *\n\t * @type {boolean}\n\t * @example true\n\t */\n\tfrontchannel_logout_session_supported: boolean;\n\n\t/**\n\t * The URL of the endpoint where end-session requests can be sent.\n\t *\n\t * @type {string}\n\t * @example 'https://example.com/logout'\n\t */\n\tend_session_endpoint: string;\n\n\t/**\n\t * The algorithms supported for signing request objects.\n\t *\n\t * @type {Array<AlgorithmType>}\n\t * @example ['RS256']\n\t */\n\trequest_object_signing_alg_values_supported: Array<AlgorithmType>;\n\n\t/**\n\t * The code challenge methods supported by the authorization server.\n\t *\n\t * @type {Array<'S256'>}\n\t * @example ['S256']\n\t */\n\tcode_challenge_methods_supported: Array<'S256'>;\n};\n\n/**\n * Represents the standard claims in a JSON Web Token (JWT).\n *\n * These claims are part of the payload in a JWT and convey information about the token, such as its issuer, subject, and expiration.\n */\nexport type JwtClaims = {\n\t/**\n\t * The issuer of the token. This typically represents the authorization server or entity that issued the JWT.\n\t *\n\t * @type {string}\n\t * @example 'https://example.com'\n\t */\n\tiss?: string;\n\n\t/**\n\t * The subject of the token. This is the identifier for the entity the token represents, such as a user ID.\n\t *\n\t * @type {string}\n\t * @example 'user123'\n\t */\n\tsub?: string;\n\n\t/**\n\t * The audience for which the token is intended. This can be a single identifier or an array of identifiers.\n\t *\n\t * @type {string | Array<string>}\n\t * @example 'your-client-id' | ['client1', 'client2']\n\t */\n\taud?: string | Array<string>;\n\n\t/**\n\t * The expiration time of the token, expressed as a Unix timestamp (number of seconds since January 1, 1970).\n\t *\n\t * @type {number}\n\t * @example 1633024800\n\t */\n\texp?: number;\n\n\t/**\n\t * The not-before time of the token, expressed as a Unix timestamp. The token must not be accepted before this time.\n\t *\n\t * @type {number}\n\t * @example 1633021200\n\t */\n\tnbf?: number;\n\n\t/**\n\t * The issued-at time of the token, expressed as a Unix timestamp (number of seconds since January 1, 1970).\n\t *\n\t * @type {number}\n\t * @example 1633022400\n\t */\n\tiat?: number;\n\n\t/**\n\t * A unique identifier for the token. This can be used to prevent token replay attacks.\n\t *\n\t * @type {string}\n\t * @example 'unique-jwt-id-1234'\n\t */\n\tjti?: string;\n};\n\n/**\n * Represents the claims included in an ID token, extending standard JWT claims with additional properties specific to identity tokens.\n *\n * ID tokens are used to authenticate and provide identity information about the user.\n */\nexport type IdTokenClaims = Mandatory<JwtClaims, 'iss' | 'sub' | 'aud' | 'exp' | 'iat'> & {\n\t/**\n\t * The authentication time, indicating when the user was authenticated.\n\t *\n\t * @type {number}\n\t * @example 1633022400\n\t */\n\tauth_time?: number;\n\n\t/**\n\t * A nonce value used to associate a client session with an ID token, preventing replay attacks.\n\t *\n\t * @type {string}\n\t * @example 'nonce-value-1234'\n\t */\n\tnonce?: string;\n\n\t/**\n\t * The Authentication Context Class Reference, indicating the authentication methods used.\n\t *\n\t * @type {string}\n\t * @example '2'\n\t */\n\tacr?: string;\n\n\t/**\n\t * The Authentication Methods References, providing information about the authentication methods used.\n\t *\n\t * @type {unknown}\n\t */\n\tamr?: unknown;\n\n\t/**\n\t * Authorized party, the client that the ID token is intended for.\n\t *\n\t * @type {string}\n\t * @example 'client-id'\n\t */\n\tazp?: string;\n\n\t/**\n\t * Session ID for the user, which can be used to manage user sessions.\n\t *\n\t * @type {string}\n\t * @example 'session-id-1234'\n\t */\n\tsid?: string;\n\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t[key: string]: any;\n};\n\n/**\n * Options for configuring the SDK.\n */\nexport type SDKOptions = {\n\t/**\n\t * Specifies the mode of the SDK operation, either 'popup' or 'redirect'.\n\t *\n\t * @type {'popup' | 'redirect'}\n\t * @default 'redirect'\n\t */\n\tmode?: 'popup' | 'redirect' | 'native' | 'embedded';\n\n\t/**\n\t * The issuer of the tokens, typically the URL of the authorization server.\n\t *\n\t * @type {string}\n\t * @example 'https://example.com'\n\t */\n\tissuer: string;\n\n\t/**\n\t * The client ID issued by the authorization server, used to identify the application.\n\t *\n\t * @type {string}\n\t * @example 'your-client-id'\n\t */\n\tclientId: string;\n\n\t/**\n\t * The URI to which the user will be redirected after authentication or authorization.\n\t *\n\t * @type {string}\n\t * @example 'https://example.com/callback'\n\t */\n\tredirectUri: string;\n\n\t/**\n\t * A list of scopes requested by the application, defining the access levels for the tokens.\n\t *\n\t * @type {Array<string>}\n\t * @default ['openid']\n\t * @example ['openid', 'profile']\n\t */\n\tscopes?: Array<string>;\n\n\t/**\n\t * The type of response expected from the authorization server.\n\t *\n\t * @type {ResponseType}\n\t * @default 'code'\n\t */\n\tresponseType?: ResponseType;\n\n\t/**\n\t * The mode in which the response is returned from the authorization server.\n\t *\n\t * @type {ResponseMode}\n\t * @default 'query'\n\t */\n\tresponseMode?: ResponseMode;\n\n\t/**\n\t * The name of the token in storage used to persist authentication information.\n\t *\n\t * @type {string}\n\t * @default 'sty.session'\n\t * @example 'accessToken'\n\t */\n\tstorageTokenName?: string;\n\n\t/**\n\t * The storage mechanism used to save and retrieve authentication information.\n\t *\n\t * @type {SDKStorageType}\n\t * @default LocalStorage\n\t */\n\tstorage?: SDKStorageType;\n\n\t/**\n\t * The HTTP client used for making requests to the authorization server.\n\t *\n\t * @type {SDKHttpClientType}\n\t * @default HttpClient\n\t */\n\thttpClient?: SDKHttpClientType;\n\n\t/**\n\t * The logging mechanism used for logging messages and errors.\n\t *\n\t * @type {SDKLoggingType}\n\t */\n\tlogging?: SDKLoggingType;\n\n\t/**\n\t * Handles the URL redirection to the specified target.\n\t * You can use this method to implement custom URL handling logic, such as opening a new window or navigating to a different page.\n\t *\n\t * @param {string} url - The URL to handle.\n\t * @param {Record<string, unknown>} params - Optional parameters for redirection.\n\t * @returns - A promise that resolves when the redirection is handled.\n\t */\n\turlHandler?: (url: string, params?: Record<string, unknown>) => Promise<unknown>;\n\n\t/**\n\t * Handles the callback from the authorization server after a successful authentication or authorization.\n\t * You can use this method to implement custom logic for processing the response from the authorization server.\n\t *\n\t * @param url - The URL containing the response from the authorization server.\n\t * @param responseMode - The mode in which the response is returned (e.g., 'query', 'fragment').\n\t * @returns - A promise that resolves when the callback is handled.\n\t */\n\tcallbackHandler?: (url: string, responseMode?: ResponseMode) => Promise<unknown>;\n};\n\n/**\n * Abstract class for SDK storage mechanisms.\n */\nexport abstract class SDKStorage {\n\t/**\n\t * Retrieves an item from the storage by key.\n\t *\n\t * @param {string} key - The key of the item to retrieve.\n\t * @returns {string | null} The value associated with the key, or `null` if not found.\n\t */\n\tabstract get(key: string): Promise<string | null>;\n\n\t/**\n\t * Deletes an item from the storage by key.\n\t *\n\t * @param {string} key - The key of the item to delete.\n\t */\n\tabstract delete(key: string): Promise<void>;\n\n\t/**\n\t * Sets an item in the storage with the specified key and value.\n\t *\n\t * @param {string} key - The key to associate with the value.\n\t * @param {string} value - The value to store.\n\t */\n\tabstract set(key: string, value: string): Promise<void>;\n}\n\nexport abstract class SDKLogging {\n\t/*\n\t * Identifier for the login session - can be used to provide additional context for log messages\n\t */\n\txEventId: string | undefined;\n\n\tabstract debug(message: string): void;\n\tabstract info(message: string): void;\n\tabstract warn(message: string): void;\n\tabstract error(message: string, error: Error): void;\n}\n\n/**\n * Abstract class for HTTP client used in the SDK.\n */\nexport abstract class SDKHttpClient {\n\tlogging?: SDKLogging;\n\n\t/**\n\t * Makes an HTTP request to the specified URL with optional options.\n\t * @param {string} url - The URL to which the request is sent.\n\t * @param {RequestInit} options - Optional request options, such as method, headers, body, etc.\n\t */\n\tabstract request<T>(url: string, options?: RequestInit): Promise<HttpClientResponse<T>>;\n}\n\n/**\n * Type representing a constructor function for SDKStorage.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type SDKStorageType = new (...args: Array<any>) => SDKStorage;\n\n/**\n * Type representing a constructor function for SDKHttpClient.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type SDKHttpClientType = new (...args: Array<any>) => SDKHttpClient;\n\n/**\n * Type representing a constructor function for SDKHttpClient.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type SDKLoggingType = new (...args: Array<any>) => SDKLogging;\n\n/**\n * Http client response type.\n */\nexport type HttpClientResponse<T> = {\n\treadonly headers: Headers;\n\treadonly ok: boolean;\n\treadonly status: number;\n\treadonly statusText: string;\n\treadonly url: string;\n\tjson(): Promise<T>;\n\ttext(): Promise<string>;\n};\n\n/**\n * A collection of functions used to handle various events that occur within the SDK.\n */\nexport type EventFunctions = {\n\t/**\n\t * Handler called when an access token has expired.\n\t *\n\t * @param {Object} params - The parameters for the event.\n\t * @param {string} params.accessToken - The expired access token.\n\t * @param {string | null} [params.refreshToken] - The refresh token associated with the access token, if available.\n\t * @returns {Promise<void> | void} A promise that resolves when the handler completes, or void if no asynchronous operation is needed.\n\t */\n\taccessTokenExpired: (params: { accessToken: string; refreshToken?: string | null }) => Promise<void> | void;\n\n\t/**\n\t * Handler called when the SDK is initialized.\n\t *\n\t * @returns {Promise<void> | void} A promise that resolves when the initialization is complete, or void if no asynchronous operation is needed.\n\t */\n\tinit: () => Promise<void> | void;\n\n\t/**\n\t * Handler called when a user has successfully logged in.\n\t *\n\t * @param {Object} params - The parameters for the event.\n\t * @param {string} params.accessToken - The access token obtained after login.\n\t * @param {string | null} [params.refreshToken] - The refresh token obtained after login, if available.\n\t * @param {IdTokenClaims} params.claims - The claims extracted from the ID token.\n\t * @returns {Promise<void> | void} A promise that resolves when the handler completes, or void if no asynchronous operation is needed.\n\t */\n\tloggedIn: (params: { accessToken: string; refreshToken?: string | null; claims: IdTokenClaims }) => Promise<void> | void;\n\n\t/**\n\t * Handler called when login has been initiated.\n\t *\n\t * @returns {Promise<void> | void} A promise that resolves when the login initiation process is complete, or void if no asynchronous operation is needed.\n\t */\n\tloginInitiated: () => Promise<void> | void;\n\n\t/**\n\t * Handler called when a logout request has been initiated.\n\t *\n\t * @param {Object} params - The parameters for the event.\n\t * @param {string} params.idToken - The ID token associated with the logout request.\n\t * @param {IdTokenClaims} params.claims - The claims associated with the ID token.\n\t * @returns {Promise<void> | void} A promise that resolves when the logout initiation process is complete, or void if no asynchronous operation is needed.\n\t */\n\tlogoutInitiated: (params: { idToken: string; claims: IdTokenClaims }) => Promise<void> | void;\n\n\t/**\n\t * Handler called when a user session has been successfully loaded.\n\t *\n\t * @param {Object} params - The parameters for the event.\n\t * @param {string} params.accessToken - The access token associated with the loaded session.\n\t * @param {string | null} [params.refreshToken] - The refresh token associated with the session, if available.\n\t * @param {IdTokenClaims} params.claims - The claims associated with the ID token in the session.\n\t * @returns {Promise<void> | void} A promise that resolves when the session loading is complete, or void if no asynchronous operation is needed.\n\t */\n\tsessionLoaded: (params: { accessToken: string; refreshToken?: string | null; claims: IdTokenClaims }) => Promise<void> | void;\n\n\t/**\n\t * Handler called when an access token has been successfully refreshed.\n\t *\n\t * @param {Object} params - The parameters for the event.\n\t * @param {string} params.accessToken - The new access token obtained after the refresh.\n\t * @param {string} params.refreshToken - The refresh token used to obtain the new access token.\n\t * @param {IdTokenClaims} params.claims - The claims extracted from the new ID token.\n\t * @returns {Promise<void> | void} A promise that resolves when the token refresh is complete, or void if no asynchronous operation is needed.\n\t */\n\ttokenRefreshed: (params: { accessToken: string; refreshToken: string; claims: IdTokenClaims }) => Promise<void> | void;\n\n\t/**\n\t * Handler called when a token refresh operation fails.\n\t *\n\t * @param {Object} params - The parameters for the event.\n\t * @param {string} params.refreshToken - The refresh token that was used in the failed refresh operation.\n\t * @returns {Promise<void> | void} A promise that resolves when the handler completes, or void if no asynchronous operation is needed.\n\t */\n\ttokenRefreshFailed: (params: { refreshToken: string }) => Promise<void> | void;\n\n\t/**\n\t * Handler called when a token has been successfully revoked.\n\t *\n\t * @param {Object} params - The parameters for the event.\n\t * @param {string} params.token - The token that was revoked.\n\t * @param {'refresh_token' | 'access_token'} params.tokenTypeHint - The type of token that was revoked.\n\t * @returns {Promise<void> | void} A promise that resolves when the handler completes, or void if no asynchronous operation is needed.\n\t */\n\ttokenRevoked: (params: { token: string; tokenTypeHint: 'refresh_token' | 'access_token' }) => Promise<void> | void;\n\n\t/**\n\t * Handler called when a token revocation operation fails.\n\t *\n\t * @param {Object} params - The parameters for the event.\n\t * @param {string} params.token - The token that was attempted to be revoked.\n\t * @param {'refresh_token' | 'access_token'} params.tokenTypeHint - The type of token that was attempted to be revoked.\n\t * @returns {Promise<void> | void} A promise that resolves when the handler completes, or void if no asynchronous operation is needed.\n\t */\n\ttokenRevokeFailed: (params: { token: string; tokenTypeHint: 'refresh_token' | 'access_token' }) => Promise<void> | void;\n};\n\n// endregion\n\n// region Flows\n\n/**\n * Extra parameters that can be used in requests.\n */\n/**\n * Additional parameters that can be included in authentication or authorization requests.\n */\nexport type ExtraRequestArgs = {\n\t/**\n\t * Specifies the type of prompt to display to the user during authentication or authorization.\n\t *\n\t * @type {PromptType}\n\t * @example 'none' | 'login' | 'create'\n\t */\n\tprompt?: PromptType;\n\n\t/**\n\t * Provides a hint to the authorization server about the user's email or username.\n\t *\n\t * @type {string}\n\t * @example 'user@example.com'\n\t */\n\tloginHint?: string;\n\n\t/**\n\t * A list of values used to request specific authentication contexts or levels of assurance.\n\t *\n\t * This parameter allows requesting specific authentication contexts (e.g., multi-factor authentication)\n\t * or other criteria that the authorization server should consider when authenticating the user.\n\t *\n\t * @type {Array<string>}\n\t * @example ['urn:mace:incommon:iap:bronze', 'urn:mace:incommon:iap:silver']\n\t */\n\tacrValues?: Array<string>;\n\n\t/**\n\t * A list of locale codes to request specific language and regional preferences for the user interface.\n\t *\n\t * This parameter allows requesting the user interface to be presented in specific languages or regional formats.\n\t *\n\t * @type {Array<string>}\n\t * @example ['en-US', 'fr-CA']\n\t */\n\tuiLocales?: Array<string>;\n\n\t/**\n\t * A list of audience values to specify the intended recipients of the token.\n\t *\n\t * This parameter allows requesting that the issued token is intended for specific audiences.\n\t *\n\t * @type {Array<string>}\n\t * @example ['https://api.example.com', 'https://service.example.com']\n\t */\n\taudiences?: Array<string>;\n};\n\n/**\n * Params for configuring logout behavior.\n */\nexport type LogoutParams = {\n\t/**\n\t * The URI to redirect to after a successful logout.\n\t *\n\t * If specified, the user will be redirected to this URI upon completing the logout process.\n\t * This is often used to send users back to the main application or a custom post-logout page.\n\t *\n\t * @type {string}\n\t * @example 'https://example.com/home'\n\t */\n\tpostLogoutRedirectUri?: string;\n};\n\n/**\n * Parameters for redirect authentication flow.\n */\nexport type RedirectParams = ExtraRequestArgs & {\n\t/**\n\t * The method used to update the browser's location after authentication or authorization.\n\t *\n\t * Determines whether the new URL should replace the current URL in the history or be added to it.\n\t *\n\t * @type {'replace' | 'assign'}\n\t * @default 'assign'\n\t */\n\tlocationMethod?: 'replace' | 'assign';\n\n\t/**\n\t * The window in which the redirect should occur.\n\t *\n\t * Specifies whether the redirect should happen in the top-level window or the current window.\n\t *\n\t * @type {'top' | 'self'}\n\t * @default 'self'\n\t */\n\ttargetWindow?: 'top' | 'self';\n};\n\n/**\n * Features for customizing the popup window.\n */\nexport type PopupWindowFeatures = {\n\t/**\n\t * The horizontal position of the popup window relative to the left edge of the screen.\n\t *\n\t * @type {number}\n\t * @example 100\n\t */\n\tleft?: number;\n\n\t/**\n\t * The vertical position of the popup window relative to the top edge of the screen.\n\t *\n\t * @type {number}\n\t * @example 100\n\t */\n\ttop?: number;\n\n\t/**\n\t * The width of the popup window.\n\t *\n\t * @type {number}\n\t * @example 600\n\t */\n\twidth?: number;\n\n\t/**\n\t * The height of the popup window.\n\t *\n\t * @type {number}\n\t * @example 400\n\t */\n\theight?: number;\n\n\t/**\n\t * Whether the popup window should display a menubar.\n\t *\n\t * Can be a boolean value or a string ('yes' or 'no').\n\t *\n\t * @type {boolean | string}\n\t * @example true\n\t */\n\tmenubar?: boolean | string;\n\n\t/**\n\t * Whether the popup window should display a toolbar.\n\t *\n\t * Can be a boolean value or a string ('yes' or 'no').\n\t *\n\t * @type {boolean | string}\n\t * @example true\n\t */\n\ttoolbar?: boolean | string;\n\n\t/**\n\t * Whether the popup window should display the address/location bar.\n\t *\n\t * Can be a boolean value or a string ('yes' or 'no').\n\t *\n\t * @type {boolean | string}\n\t * @example true\n\t */\n\tlocation?: boolean | string;\n\n\t/**\n\t * Whether the popup window should display a status bar.\n\t *\n\t * Can be a boolean value or a string ('yes' or 'no').\n\t *\n\t * @type {boolean | string}\n\t * @example true\n\t */\n\tstatus?: boolean | string;\n\n\t/**\n\t * Whether the popup window should be resizable.\n\t *\n\t * Can be a boolean value or a string ('yes' or 'no').\n\t *\n\t * @type {boolean | string}\n\t * @example false\n\t */\n\tresizable?: boolean | string;\n\n\t/**\n\t * Whether the popup window should display scrollbars.\n\t *\n\t * Can be a boolean value or a string ('yes' or 'no').\n\t *\n\t * @type {boolean | string}\n\t * @example false\n\t */\n\tscrollbars?: boolean | string;\n\n\t[key: string]: boolean | string | number | undefined;\n};\n\n/**\n * Parameters for popup authentication flow.\n */\nexport type PopupParams = ExtraRequestArgs & {\n\t/**\n\t * Configuration options for the popup window, including size, position, and other features.\n\t *\n\t * @type {PopupWindowFeatures}\n\t */\n\tpopupWindowFeatures?: PopupWindowFeatures;\n\n\t/**\n\t * The target of the popup window, which specifies where the popup should be opened.\n\t *\n\t * @type {string}\n\t * @example '_blank' | '_self' | '_parent' | '_top'\n\t */\n\tpopupWindowTarget?: string;\n\n\t/**\n\t * Whether to check the origin of messages received from the popup window.\n\t *\n\t * If set to `true`, the SDK will verify that messages received from the popup window originate from the expected domain.\n\t * This is a security measure to prevent malicious scripts from sending unauthorized messages to the application.\n\t *\n\t * @type {boolean}\n\t * @default true\n\t */\n\tcheckOrigin?: boolean;\n};\n\n/**\n * Parameters for native authentication flow.\n */\nexport type NativeParams = RedirectParams & { sdk?: string };\n\nexport declare const WidgetTypeList: readonly [\n\t'layout',\n\t'submit',\n\t'close',\n\t'static',\n\t'input',\n\t'checkbox',\n\t'password',\n\t'select',\n\t'multiSelect',\n\t'passcode',\n\t'date',\n\t'phone',\n\t'loading',\n\t'passkeyLogin',\n\t'passkeyEnroll',\n\t'webauthnLogin',\n\t'webauthnEnroll',\n];\nexport type WidgetType = (typeof WidgetTypeList)[number];\nexport declare const SelectOptionTypeList: readonly ['item', 'group'];\nexport type SelectOptionType = (typeof SelectOptionTypeList)[number];\nexport type BrandingData = {\n\tlogoUrl: string | null;\n\tbrandName: string | null;\n\tcopyright: string | null;\n\tprivacyPolicyUrl: string | null;\n\tsiteTermsUrl: string | null;\n};\nexport type CheckboxWidget = {\n\tid: string;\n\ttype: 'checkbox';\n\tlabel?: string;\n\treadonly?: boolean;\n\tvalue?: boolean;\n\trender: {\n\t\ttype: 'checkboxHidden' | 'checkboxShown';\n\t\tlabelType: 'text' | 'html';\n\t};\n\tvalidator?: {\n\t\trequired?: boolean;\n\t};\n};\nexport type DateWidget = {\n\tid: string;\n\ttype: 'date';\n\tlabel?: string;\n\tplaceholder?: string;\n\treadonly?: boolean;\n\tvalue?: string;\n\trender: {\n\t\ttype: 'native' | 'fieldSet';\n\t};\n\tvalidator?: {\n\t\tnotBefore?: string;\n\t\tnotAfter?: string;\n\t\trequired?: boolean;\n\t};\n};\nexport type InputWidget = {\n\tid: string;\n\ttype: 'input';\n\tlabel?: string;\n\tvalue?: string;\n\tplaceholder?: string;\n\treadonly?: boolean;\n\tautocomplete?: string;\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tinputmode: any;\n\trender?: {\n\t\tautocompleteHint?: string;\n\t};\n\tvalidator?: {\n\t\trequired?: boolean;\n\t\tminLength?: number;\n\t\tmaxLength?: number;\n\t\tregex?: string;\n\t};\n};\nexport type PasscodeWidget = {\n\tid: string;\n\ttype: 'passcode';\n\tlabel?: string;\n\tvalidator?: {\n\t\tlength?: number;\n\t};\n};\nexport type PasswordWidget = {\n\tid: string;\n\ttype: 'password';\n\tlabel?: string;\n\tqualityIndicator?: boolean;\n\tvalidator?: {\n\t\tminLength?: number;\n\t\tmaxLength?: number;\n\t\tmaxNumericCharacterSequences?: number;\n\t\tmaxRepeatedCharacters?: number;\n\t\tmustContain?: Array<'UPPERCASE' | 'LOWERCASE' | 'NUMERIC' | 'SPECIAL'>;\n\t\trestrictedCharacters?: string;\n\t};\n};\nexport type PhoneWidget = {\n\tid: string;\n\ttype: 'phone';\n\tlabel?: string;\n\treadonly?: boolean;\n\tvalue?: string;\n\tvalidator?: {\n\t\trequired?: boolean;\n\t};\n};\nexport type SelectWidgetOption = {\n\ttype: 'item';\n\tlabel?: string;\n\tvalue: string;\n};\nexport type SelectWidgetOptionGroup = {\n\ttype: 'group';\n\tlabel?: string;\n\toptions: Array<SelectWidgetOption>;\n};\nexport type SelectWidget = {\n\tid: string;\n\ttype: 'select';\n\tlabel?: string;\n\treadonly?: boolean;\n\tvalues?: Array<string>;\n\tplaceholder?: string;\n\trender: {\n\t\ttype: 'dropdown' | 'radio';\n\t};\n\toptions: Array<SelectWidgetOptionGroup | SelectWidgetOption>;\n\tvalidator?: {\n\t\trequired?: boolean;\n\t};\n};\nexport type MultiSelectWidget = {\n\tid: string;\n\ttype: 'multiSelect';\n\tlabel?: string;\n\treadonly?: boolean;\n\tvalues?: Array<string>;\n\tplaceholder?: string;\n\trender: {\n\t\ttype: 'dropdown' | 'checkbox';\n\t};\n\toptions: Array<SelectWidgetOptionGroup | SelectWidgetOption>;\n\tvalidator?: {\n\t\tminSelectable?: number;\n\t\tmaxSelectable?: number;\n\t};\n};\nexport type StaticWidget = {\n\tid: string;\n\ttype: 'static';\n\tvalue: string;\n\trender: {\n\t\ttype: 'html' | 'text';\n\t};\n};\nexport type SubmitWidget = {\n\tid: string;\n\ttype: 'submit';\n\tlabel?: string;\n\trender: {\n\t\ttype: 'button' | 'link';\n\t\ttextColor?: string;\n\t\tbgColor?: string;\n\t\thint?: {\n\t\t\ticon?: string;\n\t\t\tvariant?: string;\n\t\t};\n\t};\n};\nexport type CloseWidget = {\n\tid: string;\n\ttype: 'close';\n\tlabel?: string;\n\trender: {\n\t\ttype: 'button' | 'link';\n\t\ttextColor?: string;\n\t\tbgColor?: string;\n\t\thint?: {\n\t\t\ticon?: string;\n\t\t\tvariant?: string;\n\t\t};\n\t};\n};\nexport type FormWidget = {\n\tid: string;\n\ttype: 'form';\n\twidgets: Array<\n\t\tCheckboxWidget | DateWidget | InputWidget | PasscodeWidget | PasswordWidget | PhoneWidget | SelectWidget | MultiSelectWidget | StaticWidget | SubmitWidget\n\t>;\n};\nexport type Widget = {\n\ttype: 'widget';\n\tformId: string;\n\twidgetId: string;\n};\nexport type LayoutWidget = {\n\ttype: 'vertical' | 'horizontal';\n\titems: Array<Widget | LayoutWidget>;\n};\nexport type PasskeyLoginWidget = {\n\tid: string;\n\tlabel?: string;\n\trender: {\n\t\ttype: 'button';\n\t\thint?: {\n\t\t\tvariant?: string;\n\t\t};\n\t\tnotification?: {\n\t\t\tcancelled?: string;\n\t\t};\n\t};\n\tassertionOptions: PublicKeyCredentialRequestOptions;\n};\nexport type PasskeyEnrollWidget = {\n\tid: string;\n\tlabel?: string;\n\trender: {\n\t\ttype: 'button';\n\t\thint?: {\n\t\t\tvariant?: string;\n\t\t};\n\t\tnotification?: {\n\t\t\tcancelled?: string;\n\t\t};\n\t};\n\tenrollOptions: PublicKeyCredentialCreationOptions;\n};\nexport type WebauthnLoginWidget = {\n\tid: string;\n\tlabel?: string;\n\tauthenticatorType: 'deviceBiometrics' | 'securityKey';\n\trender: {\n\t\ttype: 'button';\n\t\thint?: {\n\t\t\tvariant?: string;\n\t\t};\n\t\tnotification?: {\n\t\t\tcancelled?: string;\n\t\t};\n\t};\n\tassertionOptions: PublicKeyCredentialRequestOptions;\n};\nexport type WebauthnEnrollWidget = {\n\tid: string;\n\tlabel?: string;\n\tauthenticatorType: 'deviceBiometrics' | 'securityKey';\n\trender: {\n\t\ttype: 'button';\n\t\thint?: {\n\t\t\tvariant?: string;\n\t\t};\n\t\tnotification?: {\n\t\t\tcancelled?: string;\n\t\t};\n\t};\n\tenrollOptions: PublicKeyCredentialCreationOptions;\n};\nexport type LoginFlowMessage = {\n\ttype: string;\n\ttext: string;\n};\nexport type LoginFlowState = {\n\thostedUrl?: string;\n\tfinalizeUrl?: string;\n\tscreen?: string;\n\tbranding?: BrandingData;\n\tforms?: Array<FormWidget>;\n\tlayout?: LayoutWidget;\n\tmessages?: Record<string, Record<string, LoginFlowMessage>> & {\n\t\tglobal?: LoginFlowMessage;\n\t};\n};\nexport type AssertionPublicKeyCredential = PublicKeyCredential & {\n\tresponse: AuthenticatorAssertionResponse;\n};\nexport type AssertionCredentialData = {\n\tid: string;\n\ttype: string;\n\trawId: string;\n\tresponse: {\n\t\tclientDataJSON: string;\n\t\tauthenticatorData: string;\n\t\tsignature: string;\n\t\tuserHandle: string;\n\t};\n};\nexport type AttestationPublicKeyCredential = PublicKeyCredential & {\n\tresponse: AuthenticatorAttestationResponse;\n};\nexport type AttestationCredentialData = {\n\tid: string;\n\ttype: string;\n\trawId: string;\n\tauthenticatorAttachment: string | null;\n\tresponse: {\n\t\tclientDataJSON: string;\n\t\tattestationObject: string;\n\t\ttransports: Array<string>;\n\t};\n};\n\nexport declare class LanguageSelectorComponent extends HTMLElement {}\n\nexport declare class NotificationComponent extends HTMLElement {\n\tdevMode: boolean;\n}\n\nexport declare class LandingComponent extends HTMLElement {\n\tactiveBlock: string;\n\tbaseUrl: string;\n\tlazy: boolean;\n\tlang: string;\n\tdebug: boolean;\n\tinitialized?: boolean;\n}\n\nexport declare class LoginComponent extends HTMLElement {\n\tmode?: string;\n\tbaseUrl?: string;\n\tsessionId?: string;\n\tlazy: boolean;\n\tparams: ExtraRequestArgs;\n\tlang: string;\n\tdebug: boolean;\n\tinitialized?: boolean;\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'sty-language-selector': LanguageSelectorComponent;\n\t\t'sty-notifications': NotificationComponent;\n\t\t'sty-landing': LandingComponent;\n\t\t'sty-login': LoginComponent;\n\t}\n}\n\n// endregion\n"],"names":["ResponseTypeList","ResponseModeList","TokenEndpointAuthMethodList","GrantTypeList","AlgorithmTypeList","SubjectTypeList","PromptTypeList","FallbackModeTypeList","SDKStorage","SDKLogging","SDKHttpClient"],"mappings":"gFA6BO,MAAMA,EAAmB,CAAC,OAAQ,UAAU,EAStCC,EAAmB,CAAC,QAAS,UAAU,EASvCC,EAA8B,CAAC,MAAM,EASrCC,EAAgB,CAAC,qBAAsB,eAAe,EAStDC,EAAoB,CAAC,OAAO,EAS5BC,EAAkB,CAAC,QAAQ,EAS3BC,EAAiB,CAAC,OAAQ,QAAS,QAAQ,EAS3CC,EAAuB,CAAC,WAAY,OAAO,EAihBjD,MAAeC,CAAW,CAuBjC,CAEO,MAAeC,CAAW,CAIhC,QAMD,CAKO,MAAeC,CAAc,CACnC,OAQD"}
package/dist/types.d.ts CHANGED
@@ -450,7 +450,7 @@ export type SDKOptions = {
450
450
  * @type {'popup' | 'redirect'}
451
451
  * @default 'redirect'
452
452
  */
453
- mode?: 'popup' | 'redirect' | 'native';
453
+ mode?: 'popup' | 'redirect' | 'native' | 'embedded';
454
454
  /**
455
455
  * The issuer of the tokens, typically the URL of the authorization server.
456
456
  *
@@ -919,6 +919,16 @@ export type PopupParams = ExtraRequestArgs & {
919
919
  * @example '_blank' | '_self' | '_parent' | '_top'
920
920
  */
921
921
  popupWindowTarget?: string;
922
+ /**
923
+ * Whether to check the origin of messages received from the popup window.
924
+ *
925
+ * If set to `true`, the SDK will verify that messages received from the popup window originate from the expected domain.
926
+ * This is a security measure to prevent malicious scripts from sending unauthorized messages to the application.
927
+ *
928
+ * @type {boolean}
929
+ * @default true
930
+ */
931
+ checkOrigin?: boolean;
922
932
  };
923
933
  /**
924
934
  * Parameters for native authentication flow.
@@ -1228,3 +1238,34 @@ export type AttestationCredentialData = {
1228
1238
  transports: Array<string>;
1229
1239
  };
1230
1240
  };
1241
+ export declare class LanguageSelectorComponent extends HTMLElement {
1242
+ }
1243
+ export declare class NotificationComponent extends HTMLElement {
1244
+ devMode: boolean;
1245
+ }
1246
+ export declare class LandingComponent extends HTMLElement {
1247
+ activeBlock: string;
1248
+ baseUrl: string;
1249
+ lazy: boolean;
1250
+ lang: string;
1251
+ debug: boolean;
1252
+ initialized?: boolean;
1253
+ }
1254
+ export declare class LoginComponent extends HTMLElement {
1255
+ mode?: string;
1256
+ baseUrl?: string;
1257
+ sessionId?: string;
1258
+ lazy: boolean;
1259
+ params: ExtraRequestArgs;
1260
+ lang: string;
1261
+ debug: boolean;
1262
+ initialized?: boolean;
1263
+ }
1264
+ declare global {
1265
+ interface HTMLElementTagNameMap {
1266
+ 'sty-language-selector': LanguageSelectorComponent;
1267
+ 'sty-notifications': NotificationComponent;
1268
+ 'sty-landing': LandingComponent;
1269
+ 'sty-login': LoginComponent;
1270
+ }
1271
+ }