@thunderid/vue 0.11.4 → 0.13.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.
@@ -3327,13 +3327,17 @@ const STYLES = [
3327
3327
  *
3328
3328
  * @param vendor - Vendor/brand namespace used to derive the dedupe `<style>` element id
3329
3329
  * (e.g. `${vendor}-vue-styles`). Defaults to `VendorConstants.VENDOR_PREFIX`.
3330
+ * @param nonce - CSP nonce applied to the injected `<style>` element via a `nonce` attribute,
3331
+ * so consuming apps can enforce a strict `style-src` Content-Security-Policy (i.e. without
3332
+ * `'unsafe-inline'`) for this runtime-injected stylesheet.
3330
3333
  */
3331
- function injectStyles(vendor) {
3334
+ function injectStyles(vendor, nonce) {
3332
3335
  if (typeof document === "undefined") return;
3333
3336
  const styleId = `${(0, __thunderid_browser.getVendorPrefix)(vendor)}-vue-styles`;
3334
3337
  if (document.getElementById(styleId)) return;
3335
3338
  const style = document.createElement("style");
3336
3339
  style.id = styleId;
3340
+ if (nonce) style.setAttribute("nonce", nonce);
3337
3341
  style.textContent = STYLES;
3338
3342
  document.head.appendChild(style);
3339
3343
  }
@@ -3367,7 +3371,7 @@ function injectStyles(vendor) {
3367
3371
  * ```
3368
3372
  */
3369
3373
  const ThunderIDPlugin = { install(app, options) {
3370
- injectStyles(options?.vendor);
3374
+ injectStyles(options?.vendor, options?.cspNonce);
3371
3375
  if (options?.mode === "delegated") return;
3372
3376
  app.component("ThunderIDProvider", ThunderIDProvider_default);
3373
3377
  } };
@@ -5517,17 +5521,21 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
5517
5521
  const consentPrompt = options.additionalData?.["consentPrompt"];
5518
5522
  if (consentPrompt && eventType.toUpperCase() === __thunderid_browser.EmbeddedFlowEventType.Submit) {
5519
5523
  const isDeny = componentVariant.toLowerCase() !== "primary";
5520
- const decisions = { purposes: consentPrompt.purposes.map((p) => ({
5524
+ const decisions = {
5521
5525
  approved: !isDeny,
5522
- elements: [...p.essential.map((e) => ({
5526
+ ...isDeny ? { reason: __thunderid_browser.ConsentConstants.REASON_USER_DENIED } : {},
5527
+ purposes: consentPrompt.purposes.map((p) => ({
5523
5528
  approved: !isDeny,
5524
- name: e.name
5525
- })), ...p.optional.map((e) => ({
5526
- approved: !isDeny && formValues[getConsentOptionalKey(p.purposeId, e.name)] === "true",
5527
- name: e.name
5528
- }))],
5529
- purposeName: p.purposeName ?? ""
5530
- })) };
5529
+ elements: [...(p.essential ?? []).map((e) => ({
5530
+ approved: !isDeny,
5531
+ name: e.name
5532
+ })), ...(p.optional ?? []).map((e) => ({
5533
+ approved: !isDeny && formValues[getConsentOptionalKey(p.purposeId, e.name)] === "true",
5534
+ name: e.name
5535
+ }))],
5536
+ purposeName: p.purposeName ?? ""
5537
+ }))
5538
+ };
5531
5539
  formData["consent_decisions"] = JSON.stringify(decisions);
5532
5540
  }
5533
5541
  if (eventType.toUpperCase() === __thunderid_browser.EmbeddedFlowEventType.Submit) options.onSubmit(component, formData, shouldSkipValidation);
@@ -6438,20 +6446,24 @@ const SignIn = (0, vue.defineComponent)({
6438
6446
  const submitAction = findAction(components.value);
6439
6447
  if (submitAction && submitAction.variant?.toLowerCase() !== "primary") isDeny = true;
6440
6448
  }
6441
- const decisions = { purposes: purposes.map((p) => ({
6449
+ const decisions = {
6442
6450
  approved: !isDeny,
6443
- elements: [...(p.essential ?? []).map((e) => ({
6451
+ ...isDeny ? { reason: __thunderid_browser.ConsentConstants.REASON_USER_DENIED } : {},
6452
+ purposes: purposes.map((p) => ({
6444
6453
  approved: !isDeny,
6445
- name: e.name
6446
- })), ...(p.optional ?? []).map((e) => {
6447
- const key = `__consent_opt__${p.purposeId}__${e.name}`;
6448
- return {
6449
- approved: isDeny ? false : processedInputs[key] !== "false",
6454
+ elements: [...(p.essential ?? []).map((e) => ({
6455
+ approved: !isDeny,
6450
6456
  name: e.name
6451
- };
6452
- })],
6453
- purposeName: p.purposeName
6454
- })) };
6457
+ })), ...(p.optional ?? []).map((e) => {
6458
+ const key = `__consent_opt__${p.purposeId}__${e.name}`;
6459
+ return {
6460
+ approved: !isDeny && processedInputs[key] === "true",
6461
+ name: e.name
6462
+ };
6463
+ })],
6464
+ purposeName: p.purposeName
6465
+ }))
6466
+ };
6455
6467
  processedInputs["consent_decisions"] = JSON.stringify(decisions);
6456
6468
  Object.keys(processedInputs).forEach((key) => {
6457
6469
  if (key.startsWith("__consent_opt__")) delete processedInputs[key];
@@ -1 +1 @@
1
- {"version":3,"file":"AuthOptionFactoryCore.d.ts","sourceRoot":"","sources":["../../../../src/components/auth/sign-in/AuthOptionFactoryCore.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,oBAAoB,EACpB,qBAAqB,EAYtB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAI,KAAK,KAAK,EAAC,MAAM,KAAK,CAAC;AA+ClC,KAAK,aAAa,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,KAAK,MAAM,CAAC;AA0YvF,YAAY,EAAC,aAAa,EAAC,CAAC;AAE5B;;GAEG;AACH,eAAO,MAAM,sBAAsB,GACjC,YAAY,qBAAqB,EAAE,EACnC,YAAY,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAClC,eAAe,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACtC,YAAY,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAClC,WAAW,OAAO,EAClB,aAAa,OAAO,EACpB,WAAW,MAAM,IAAI,EACrB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,EACpD,UAAU;IACR,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACrC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iBAAiB,CAAC,EAAE,OAAO,CAA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B,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,aAAa,EAAE,OAAO,CAAC;IACvB,SAAS,EAAE,OAAO,CAAC;IACnB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,IAAI,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAClC,QAAQ,EAAE,CAAC,OAAO,EAAE,yBAAyB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACjE;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,QAAA,MAAM,MAAM,EAAE,SAmjBZ,CAAC;AAEH,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"SignIn.d.ts","sourceRoot":"","sources":["../../../../src/components/auth/sign-in/SignIn.ts"],"names":[],"mappings":"AAGA,OAAO,EAIL,qBAAqB,EAErB,yBAAyB,EAIzB,oBAAoB,EACrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,KAAK,SAAS,EAWf,MAAM,KAAK,CAAC;AAmBb;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACrC,UAAU,EAAE,qBAAqB,EAAE,CAAC;IACpC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,aAAa,EAAE,OAAO,CAAC;IACvB,SAAS,EAAE,OAAO,CAAC;IACnB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,IAAI,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAClC,QAAQ,EAAE,CAAC,OAAO,EAAE,yBAAyB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACjE;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,QAAA,MAAM,MAAM,EAAE,SAqjBZ,CAAC;AAEH,eAAe,MAAM,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { DEFAULT_THEME, EmbeddedFlowActionVariant, EmbeddedFlowComponentType, EmbeddedFlowComponentType as EmbeddedFlowComponentType$1, EmbeddedFlowEventType, EmbeddedFlowEventType as EmbeddedFlowEventType$1, EmbeddedFlowResponseType, EmbeddedFlowTextVariant, EmbeddedFlowType, EmbeddedSignInFlowStatus, EmbeddedSignInFlowStatus as EmbeddedSignInFlowStatus$1, EmbeddedSignInFlowType, EmbeddedSignInFlowType as EmbeddedSignInFlowType$1, EmbeddedSignUpFlowStatus, EmbeddedSignUpFlowStatus as EmbeddedSignUpFlowStatus$1, EmbeddedSignUpFlowType, FetchHttpClient, FieldType, FieldType as FieldType$1, FlowMetaType, ThunderIDAPIError, ThunderIDBrowserClient, ThunderIDError, ThunderIDRuntimeError, ThunderIDRuntimeError as ThunderIDRuntimeError$1, TranslationBundleConstants, arrayBufferToBase64url, base64urlToArrayBuffer, createClassObserver, createClassObserver as createClassObserver$1, createMediaQueryListener, createMediaQueryListener as createMediaQueryListener$1, createPackageComponentLogger, createPackageLogger, createTheme, deepMerge, detectThemeMode, detectThemeMode as detectThemeMode$1, executeEmbeddedSignInFlow, executeEmbeddedSignUpFlow, extractEmojiFromUri, extractUserClaimsFromIdToken, generateFlattenedUserProfile, get, getActiveTheme, getDefaultI18nBundles, getFlowMeta, getUsersMe, getVendorPrefix, handleWebAuthnAuthentication, hasAuthParamsInUrl, hasAuthParamsInUrl as hasAuthParamsInUrl$1, hasCalledForThisInstanceInUrl, http, isEmojiUri, isEmpty, navigate, navigate as navigate$1, normalizeBorderRadius, normalizeTranslations, resolveFlowTemplateLiterals, resolveLogoUri, resolveResourceEndpoint, updateMeProfile, withVendorCSSClassPrefix } from "@thunderid/browser";
1
+ import { ConsentConstants, DEFAULT_THEME, EmbeddedFlowActionVariant, EmbeddedFlowComponentType, EmbeddedFlowComponentType as EmbeddedFlowComponentType$1, EmbeddedFlowEventType, EmbeddedFlowEventType as EmbeddedFlowEventType$1, EmbeddedFlowResponseType, EmbeddedFlowTextVariant, EmbeddedFlowType, EmbeddedSignInFlowStatus, EmbeddedSignInFlowStatus as EmbeddedSignInFlowStatus$1, EmbeddedSignInFlowType, EmbeddedSignInFlowType as EmbeddedSignInFlowType$1, EmbeddedSignUpFlowStatus, EmbeddedSignUpFlowStatus as EmbeddedSignUpFlowStatus$1, EmbeddedSignUpFlowType, FetchHttpClient, FieldType, FieldType as FieldType$1, FlowMetaType, ThunderIDAPIError, ThunderIDBrowserClient, ThunderIDError, ThunderIDRuntimeError, ThunderIDRuntimeError as ThunderIDRuntimeError$1, TranslationBundleConstants, arrayBufferToBase64url, base64urlToArrayBuffer, createClassObserver, createClassObserver as createClassObserver$1, createMediaQueryListener, createMediaQueryListener as createMediaQueryListener$1, createPackageComponentLogger, createPackageLogger, createTheme, deepMerge, detectThemeMode, detectThemeMode as detectThemeMode$1, executeEmbeddedSignInFlow, executeEmbeddedSignUpFlow, extractEmojiFromUri, extractUserClaimsFromIdToken, generateFlattenedUserProfile, get, getActiveTheme, getDefaultI18nBundles, getFlowMeta, getUsersMe, getVendorPrefix, handleWebAuthnAuthentication, hasAuthParamsInUrl, hasAuthParamsInUrl as hasAuthParamsInUrl$1, hasCalledForThisInstanceInUrl, http, isEmojiUri, isEmpty, navigate, navigate as navigate$1, normalizeBorderRadius, normalizeTranslations, resolveFlowTemplateLiterals, resolveLogoUri, resolveResourceEndpoint, updateMeProfile, withVendorCSSClassPrefix } from "@thunderid/browser";
2
2
  import { Fragment, computed, defineComponent, h, inject, nextTick, onBeforeUnmount, onMounted, onUnmounted, provide, readonly, ref, shallowReadonly, shallowRef, watch } from "vue";
3
3
  import DOMPurify from "dompurify";
4
4
 
@@ -3301,13 +3301,17 @@ const STYLES = [
3301
3301
  *
3302
3302
  * @param vendor - Vendor/brand namespace used to derive the dedupe `<style>` element id
3303
3303
  * (e.g. `${vendor}-vue-styles`). Defaults to `VendorConstants.VENDOR_PREFIX`.
3304
+ * @param nonce - CSP nonce applied to the injected `<style>` element via a `nonce` attribute,
3305
+ * so consuming apps can enforce a strict `style-src` Content-Security-Policy (i.e. without
3306
+ * `'unsafe-inline'`) for this runtime-injected stylesheet.
3304
3307
  */
3305
- function injectStyles(vendor) {
3308
+ function injectStyles(vendor, nonce) {
3306
3309
  if (typeof document === "undefined") return;
3307
3310
  const styleId = `${getVendorPrefix(vendor)}-vue-styles`;
3308
3311
  if (document.getElementById(styleId)) return;
3309
3312
  const style = document.createElement("style");
3310
3313
  style.id = styleId;
3314
+ if (nonce) style.setAttribute("nonce", nonce);
3311
3315
  style.textContent = STYLES;
3312
3316
  document.head.appendChild(style);
3313
3317
  }
@@ -3341,7 +3345,7 @@ function injectStyles(vendor) {
3341
3345
  * ```
3342
3346
  */
3343
3347
  const ThunderIDPlugin = { install(app, options) {
3344
- injectStyles(options?.vendor);
3348
+ injectStyles(options?.vendor, options?.cspNonce);
3345
3349
  if (options?.mode === "delegated") return;
3346
3350
  app.component("ThunderIDProvider", ThunderIDProvider_default);
3347
3351
  } };
@@ -5491,17 +5495,21 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
5491
5495
  const consentPrompt = options.additionalData?.["consentPrompt"];
5492
5496
  if (consentPrompt && eventType.toUpperCase() === EmbeddedFlowEventType$1.Submit) {
5493
5497
  const isDeny = componentVariant.toLowerCase() !== "primary";
5494
- const decisions = { purposes: consentPrompt.purposes.map((p) => ({
5498
+ const decisions = {
5495
5499
  approved: !isDeny,
5496
- elements: [...p.essential.map((e) => ({
5500
+ ...isDeny ? { reason: ConsentConstants.REASON_USER_DENIED } : {},
5501
+ purposes: consentPrompt.purposes.map((p) => ({
5497
5502
  approved: !isDeny,
5498
- name: e.name
5499
- })), ...p.optional.map((e) => ({
5500
- approved: !isDeny && formValues[getConsentOptionalKey(p.purposeId, e.name)] === "true",
5501
- name: e.name
5502
- }))],
5503
- purposeName: p.purposeName ?? ""
5504
- })) };
5503
+ elements: [...(p.essential ?? []).map((e) => ({
5504
+ approved: !isDeny,
5505
+ name: e.name
5506
+ })), ...(p.optional ?? []).map((e) => ({
5507
+ approved: !isDeny && formValues[getConsentOptionalKey(p.purposeId, e.name)] === "true",
5508
+ name: e.name
5509
+ }))],
5510
+ purposeName: p.purposeName ?? ""
5511
+ }))
5512
+ };
5505
5513
  formData["consent_decisions"] = JSON.stringify(decisions);
5506
5514
  }
5507
5515
  if (eventType.toUpperCase() === EmbeddedFlowEventType$1.Submit) options.onSubmit(component, formData, shouldSkipValidation);
@@ -6412,20 +6420,24 @@ const SignIn = defineComponent({
6412
6420
  const submitAction = findAction(components.value);
6413
6421
  if (submitAction && submitAction.variant?.toLowerCase() !== "primary") isDeny = true;
6414
6422
  }
6415
- const decisions = { purposes: purposes.map((p) => ({
6423
+ const decisions = {
6416
6424
  approved: !isDeny,
6417
- elements: [...(p.essential ?? []).map((e) => ({
6425
+ ...isDeny ? { reason: ConsentConstants.REASON_USER_DENIED } : {},
6426
+ purposes: purposes.map((p) => ({
6418
6427
  approved: !isDeny,
6419
- name: e.name
6420
- })), ...(p.optional ?? []).map((e) => {
6421
- const key = `__consent_opt__${p.purposeId}__${e.name}`;
6422
- return {
6423
- approved: isDeny ? false : processedInputs[key] !== "false",
6428
+ elements: [...(p.essential ?? []).map((e) => ({
6429
+ approved: !isDeny,
6424
6430
  name: e.name
6425
- };
6426
- })],
6427
- purposeName: p.purposeName
6428
- })) };
6431
+ })), ...(p.optional ?? []).map((e) => {
6432
+ const key = `__consent_opt__${p.purposeId}__${e.name}`;
6433
+ return {
6434
+ approved: !isDeny && processedInputs[key] === "true",
6435
+ name: e.name
6436
+ };
6437
+ })],
6438
+ purposeName: p.purposeName
6439
+ }))
6440
+ };
6429
6441
  processedInputs["consent_decisions"] = JSON.stringify(decisions);
6430
6442
  Object.keys(processedInputs).forEach((key) => {
6431
6443
  if (key.startsWith("__consent_opt__")) delete processedInputs[key];
@@ -28,6 +28,11 @@ export interface ThunderIDPluginOptions {
28
28
  * Should match the `vendor` passed to `<ThunderIDProvider>`. Defaults to `VendorConstants.VENDOR_PREFIX`.
29
29
  */
30
30
  vendor?: string;
31
+ /**
32
+ * CSP nonce applied to the SDK's runtime-injected `<style>` tag, for apps that enforce
33
+ * a strict `style-src` Content-Security-Policy directive (i.e. without `'unsafe-inline'`).
34
+ */
35
+ cspNonce?: string;
31
36
  }
32
37
  /**
33
38
  * Vue plugin for ThunderID authentication.
@@ -1 +1 @@
1
- {"version":3,"file":"ThunderIDPlugin.d.ts","sourceRoot":"","sources":["../../src/plugins/ThunderIDPlugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAM,MAAM,EAAC,MAAM,KAAK,CAAC;AAIrC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;;;OAKG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC;IAE/B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,QAAA,MAAM,eAAe,EAAE,MAAM,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAYtD,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"ThunderIDPlugin.d.ts","sourceRoot":"","sources":["../../src/plugins/ThunderIDPlugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAM,MAAM,EAAC,MAAM,KAAK,CAAC;AAIrC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;;;OAKG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC;IAE/B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,QAAA,MAAM,eAAe,EAAE,MAAM,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAYtD,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -4,7 +4,10 @@
4
4
  *
5
5
  * @param vendor - Vendor/brand namespace used to derive the dedupe `<style>` element id
6
6
  * (e.g. `${vendor}-vue-styles`). Defaults to `VendorConstants.VENDOR_PREFIX`.
7
+ * @param nonce - CSP nonce applied to the injected `<style>` element via a `nonce` attribute,
8
+ * so consuming apps can enforce a strict `style-src` Content-Security-Policy (i.e. without
9
+ * `'unsafe-inline'`) for this runtime-injected stylesheet.
7
10
  */
8
- export declare function injectStyles(vendor?: string): void;
11
+ export declare function injectStyles(vendor?: string, nonce?: string): void;
9
12
  export default injectStyles;
10
13
  //# sourceMappingURL=injectStyles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"injectStyles.d.ts","sourceRoot":"","sources":["../../src/styles/injectStyles.ts"],"names":[],"mappings":"AA4EA;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAWlD;AAED,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"injectStyles.d.ts","sourceRoot":"","sources":["../../src/styles/injectStyles.ts"],"names":[],"mappings":"AA4EA;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAclE;AAED,eAAe,YAAY,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thunderid/vue",
3
- "version": "0.11.4",
3
+ "version": "0.13.0",
4
4
  "description": "Vue SDK for ThunderID",
5
5
  "keywords": [
6
6
  "thunderid",
@@ -37,6 +37,7 @@
37
37
  "@thunderid/eslint-plugin": "0.0.2",
38
38
  "@thunderid/prettier-config": "0.0.2",
39
39
  "@types/node": "24.7.2",
40
+ "@vitest/browser-playwright": "4.1.8",
40
41
  "@vue/test-utils": "2.4.6",
41
42
  "eslint": "9.39.4",
42
43
  "prettier": "3.6.2",
@@ -58,7 +59,7 @@
58
59
  "dependencies": {
59
60
  "dompurify": "3.4.11",
60
61
  "tslib": "2.8.1",
61
- "@thunderid/browser": "^0.11.4"
62
+ "@thunderid/browser": "^0.13.0"
62
63
  },
63
64
  "publishConfig": {
64
65
  "access": "public"