@sheerid/jslib 1.153.0 → 1.155.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 (73) hide show
  1. package/es5/Tmetrix.bundle.js +4 -4
  2. package/es5/messages_ar.bundle.js +4 -4
  3. package/es5/messages_bg.bundle.js +4 -4
  4. package/es5/messages_cs.bundle.js +4 -4
  5. package/es5/messages_da.bundle.js +4 -4
  6. package/es5/messages_de.bundle.js +4 -4
  7. package/es5/messages_el.bundle.js +4 -4
  8. package/es5/messages_en-GB.bundle.js +4 -4
  9. package/es5/messages_es-ES.bundle.js +4 -4
  10. package/es5/messages_es.bundle.js +5 -5
  11. package/es5/messages_fi.bundle.js +5 -5
  12. package/es5/messages_fr-CA.bundle.js +4 -4
  13. package/es5/messages_fr.bundle.js +5 -5
  14. package/es5/messages_ga.bundle.js +4 -4
  15. package/es5/messages_hr.bundle.js +4 -4
  16. package/es5/messages_hu.bundle.js +4 -4
  17. package/es5/messages_id.bundle.js +4 -4
  18. package/es5/messages_it.bundle.js +5 -5
  19. package/es5/messages_iw.bundle.js +4 -4
  20. package/es5/messages_ja.bundle.js +4 -4
  21. package/es5/messages_ko.bundle.js +4 -4
  22. package/es5/messages_lo.bundle.js +4 -4
  23. package/es5/messages_lt.bundle.js +4 -4
  24. package/es5/messages_ms.bundle.js +4 -4
  25. package/es5/messages_nl.bundle.js +4 -4
  26. package/es5/messages_no.bundle.js +4 -4
  27. package/es5/messages_pl.bundle.js +4 -4
  28. package/es5/messages_pt-BR.bundle.js +4 -4
  29. package/es5/messages_pt.bundle.js +4 -4
  30. package/es5/messages_ru.bundle.js +5 -5
  31. package/es5/messages_sk.bundle.js +4 -4
  32. package/es5/messages_sl.bundle.js +4 -4
  33. package/es5/messages_sr.bundle.js +4 -4
  34. package/es5/messages_sv.bundle.js +4 -4
  35. package/es5/messages_th.bundle.js +5 -5
  36. package/es5/messages_tr.bundle.js +4 -4
  37. package/es5/messages_zh-HK.bundle.js +4 -4
  38. package/es5/messages_zh.bundle.js +4 -4
  39. package/es6/{es-2aeb2f40.es.js → es-faaaeecf.es.js} +12 -12
  40. package/es6/{fr-7418e287.es.js.map → es-faaaeecf.es.js.map} +1 -1
  41. package/es6/{fi-05af5cb1.es.js → fi-19ff2e75.es.js} +8 -8
  42. package/es6/{es-2aeb2f40.es.js.map → fi-19ff2e75.es.js.map} +1 -1
  43. package/es6/{fr-7418e287.es.js → fr-6e4e7995.es.js} +64 -64
  44. package/es6/{it-9911a46d.es.js.map → fr-6e4e7995.es.js.map} +1 -1
  45. package/es6/{it-9911a46d.es.js → it-59289361.es.js} +11 -11
  46. package/es6/{fi-05af5cb1.es.js.map → it-59289361.es.js.map} +1 -1
  47. package/es6/{ru-b515dc76.es.js → ru-cb51d55d.es.js} +92 -92
  48. package/es6/ru-cb51d55d.es.js.map +1 -0
  49. package/es6/{th-4d80bc94.es.js → th-5f26ac7f.es.js} +26 -26
  50. package/es6/th-5f26ac7f.es.js.map +1 -0
  51. package/localized-messages/es.json +11 -11
  52. package/localized-messages/fi.json +7 -7
  53. package/localized-messages/fr.json +63 -63
  54. package/localized-messages/it.json +10 -10
  55. package/localized-messages/ru.json +91 -91
  56. package/localized-messages/th.json +25 -25
  57. package/localized-messages/vi.json +7 -7
  58. package/manifest.json +43 -43
  59. package/package.json +1 -1
  60. package/sheerid-requestOrg.css +4 -4
  61. package/sheerid-requestOrg.js +4 -4
  62. package/sheerid-requestOrg.js.map +1 -1
  63. package/sheerid-utils.js +4 -4
  64. package/sheerid.css +4 -4
  65. package/sheerid.js +10 -10
  66. package/sheerid.js.map +1 -1
  67. package/sheerides6.js +190 -169
  68. package/sheerides6.js.map +1 -1
  69. package/src/lib/installScript/iframe.d.ts +15 -1
  70. package/src/lib/types/types.d.ts +11 -0
  71. package/types-reference.zip +0 -0
  72. package/es6/ru-b515dc76.es.js.map +0 -1
  73. package/es6/th-4d80bc94.es.js.map +0 -1
package/sheerides6.js CHANGED
@@ -2988,11 +2988,11 @@ const getMessagesModuleByLocale = async (locale) => {
2988
2988
  break;
2989
2989
  case "es":
2990
2990
  localizedMessages = await import(
2991
- /* webpackChunkName: "messages_es" */ './es6/es-2aeb2f40.es.js').then((m) => m.default);
2991
+ /* webpackChunkName: "messages_es" */ './es6/es-faaaeecf.es.js').then((m) => m.default);
2992
2992
  break;
2993
2993
  case "fi":
2994
2994
  localizedMessages = await import(
2995
- /* webpackChunkName: "messages_fi" */ './es6/fi-05af5cb1.es.js').then((m) => m.default);
2995
+ /* webpackChunkName: "messages_fi" */ './es6/fi-19ff2e75.es.js').then((m) => m.default);
2996
2996
  break;
2997
2997
  case "fr-CA":
2998
2998
  localizedMessages = await import(
@@ -3000,7 +3000,7 @@ const getMessagesModuleByLocale = async (locale) => {
3000
3000
  break;
3001
3001
  case "fr":
3002
3002
  localizedMessages = await import(
3003
- /* webpackChunkName: "messages_fr" */ './es6/fr-7418e287.es.js').then((m) => m.default);
3003
+ /* webpackChunkName: "messages_fr" */ './es6/fr-6e4e7995.es.js').then((m) => m.default);
3004
3004
  break;
3005
3005
  case "ga":
3006
3006
  localizedMessages = await import(
@@ -3020,7 +3020,7 @@ const getMessagesModuleByLocale = async (locale) => {
3020
3020
  break;
3021
3021
  case "it":
3022
3022
  localizedMessages = await import(
3023
- /* webpackChunkName: "messages_it" */ './es6/it-9911a46d.es.js').then((m) => m.default);
3023
+ /* webpackChunkName: "messages_it" */ './es6/it-59289361.es.js').then((m) => m.default);
3024
3024
  break;
3025
3025
  case "iw":
3026
3026
  localizedMessages = await import(
@@ -3068,7 +3068,7 @@ const getMessagesModuleByLocale = async (locale) => {
3068
3068
  break;
3069
3069
  case "ru":
3070
3070
  localizedMessages = await import(
3071
- /* webpackChunkName: "messages_ru" */ './es6/ru-b515dc76.es.js').then((m) => m.default);
3071
+ /* webpackChunkName: "messages_ru" */ './es6/ru-cb51d55d.es.js').then((m) => m.default);
3072
3072
  break;
3073
3073
  case "sk":
3074
3074
  localizedMessages = await import(
@@ -3088,7 +3088,7 @@ const getMessagesModuleByLocale = async (locale) => {
3088
3088
  break;
3089
3089
  case "th":
3090
3090
  localizedMessages = await import(
3091
- /* webpackChunkName: "messages_th" */ './es6/th-4d80bc94.es.js').then((m) => m.default);
3091
+ /* webpackChunkName: "messages_th" */ './es6/th-5f26ac7f.es.js').then((m) => m.default);
3092
3092
  break;
3093
3093
  case "tr":
3094
3094
  localizedMessages = await import(
@@ -22269,38 +22269,205 @@ const NewVerificationInnerComponent = ({ locale, messages, programTheme, verific
22269
22269
  verificationService.verificationResponse.currentStep, verificationService: verificationService }))))));
22270
22270
  };
22271
22271
 
22272
+ const fadeInElements = (elements) => {
22273
+ elements.forEach((element) => {
22274
+ element.classList.add("fade-in");
22275
+ });
22276
+ };
22277
+ const removeElement = (element, transitionTimeout) => {
22278
+ element.classList.remove("fade-in");
22279
+ window.setTimeout(() => {
22280
+ document.body.style.overflow = "auto";
22281
+ element.parentNode.removeChild(element);
22282
+ }, transitionTimeout);
22283
+ };
22284
+ const getVerificationUrl = (url) => {
22285
+ const newUrl = new URL(url);
22286
+ const parentUrl = new URL(window.location.href);
22287
+ // Combine query parameters from parent window and provided url.
22288
+ // If duplicates, provided url parameters supercede.
22289
+ parentUrl.searchParams.forEach((value, key) => {
22290
+ if (!newUrl.searchParams.has(key)) {
22291
+ newUrl.searchParams.set(key, value);
22292
+ }
22293
+ });
22294
+ return newUrl.href;
22295
+ };
22296
+
22297
+ class Iframe {
22298
+ constructor(containerElement, url) {
22299
+ this.hasLoaded = false;
22300
+ this.onLoadEvents = [];
22301
+ this.onCleanupEvents = [];
22302
+ this.installType = "cdn_inline_iframe";
22303
+ if (Iframe.isValidHttpUrl(url)) {
22304
+ const options = {
22305
+ className: iframeConstants.CLASS_NAMES.INLINE_IFRAME_CONTENT,
22306
+ title: iframeTitle,
22307
+ };
22308
+ this.containerElement = containerElement;
22309
+ this.verificationUrl = new URL(getVerificationUrl(url));
22310
+ this.verificationIframeUid = Iframe.createUniqueId();
22311
+ this.createIframe(options);
22312
+ this.addVerificationSizeUpdatesListener();
22313
+ }
22314
+ else {
22315
+ logger.error("Invalid URL. Provide a proper URL: https://example.com/", "iframe url");
22316
+ }
22317
+ }
22318
+ cleanup() {
22319
+ this.onCleanupEvents.forEach((callback) => callback());
22320
+ }
22321
+ static createUniqueId() {
22322
+ return Math.random().toString(36).substr(2, 9);
22323
+ }
22324
+ static isValidHttpUrl(urlString) {
22325
+ try {
22326
+ const url = new URL(urlString);
22327
+ return url.protocol === "http:" || url.protocol === "https:";
22328
+ }
22329
+ catch {
22330
+ return false;
22331
+ }
22332
+ }
22333
+ createIframe(options) {
22334
+ this.iframe = document.createElement("iframe");
22335
+ this.iframe.classList.add(options.className);
22336
+ this.iframe.title = options.title;
22337
+ let mark = "?";
22338
+ if (this.verificationUrl.search) {
22339
+ mark = "&";
22340
+ }
22341
+ this.iframe.src = `${this.verificationUrl.href}${mark}verificationIframeUid=${this.verificationIframeUid}&${QUERY_STRING_INSTALL_PAGE_URL}=${encodeURIComponent(getCurrentUrl())}&${QUERY_STRING_INSTALL_TYPE}=${this.installType}`;
22342
+ this.iframe.onload = () => this.onLoad();
22343
+ return this.iframe;
22344
+ }
22345
+ // If iFrame hasn't loaded yet, queue up the callback
22346
+ // otherwise call it immediately
22347
+ addOnLoadEvent(callback) {
22348
+ try {
22349
+ assertValidFunction(callback);
22350
+ }
22351
+ catch (e) {
22352
+ logger.error("Invalid callback provided to iFrame.onLoad()", e);
22353
+ return;
22354
+ }
22355
+ if (this.hasLoaded) {
22356
+ callback();
22357
+ }
22358
+ else {
22359
+ this.onLoadEvents.push(callback);
22360
+ }
22361
+ }
22362
+ onLoad() {
22363
+ this.hasLoaded = true;
22364
+ this.onLoadEvents.forEach((callback) => callback());
22365
+ }
22366
+ /**
22367
+ * Using this to add parent window message listeners gives us
22368
+ * - Event Cleanup for modals
22369
+ * - verification of origin, verificationIframeUid, and message data structure
22370
+ */
22371
+ addWindowMessageListener(actionCb) {
22372
+ const listener = (ev) => {
22373
+ if (this.verificationUrl.origin !== ev.origin) {
22374
+ return;
22375
+ }
22376
+ if (ev.data.verificationIframeUid !== this.verificationIframeUid) {
22377
+ return;
22378
+ }
22379
+ if (ev.data.action && ev.data.action.type) {
22380
+ actionCb(ev.data.action);
22381
+ }
22382
+ };
22383
+ window.addEventListener("message", listener);
22384
+ this.onCleanupEvents.push(() => window.removeEventListener("message", listener));
22385
+ }
22386
+ addVerificationSizeUpdatesListener() {
22387
+ this.addWindowMessageListener((action) => {
22388
+ if (action.type === "updateHeight") {
22389
+ // UX-1129: If we are getting height updates, turn off scrolling for
22390
+ // the iframe. This prevents browsers (Safari in particular) from
22391
+ // re-wrapping because of different widths and constantly changing
22392
+ // it's own height. `scrolling = "no"` is deprecated, but supported in
22393
+ // all browsers and fixes the problem well.
22394
+ this.iframe.scrolling = "no";
22395
+ this.iframe.style.height = `${action.height}px`;
22396
+ }
22397
+ });
22398
+ }
22399
+ setViewModel(viewModel) {
22400
+ const message = {
22401
+ action: "setViewModel",
22402
+ viewModel,
22403
+ };
22404
+ this.addOnLoadEvent(() => {
22405
+ this.iframe.contentWindow.postMessage(message, this.verificationUrl.origin);
22406
+ });
22407
+ }
22408
+ setOptions(options) {
22409
+ const message = {
22410
+ action: "setOptions",
22411
+ options,
22412
+ };
22413
+ this.addOnLoadEvent(() => {
22414
+ this.iframe.contentWindow.postMessage(message, this.verificationUrl.origin);
22415
+ });
22416
+ }
22417
+ setInstallType(installType) {
22418
+ this.installType = installType;
22419
+ }
22420
+ init() {
22421
+ this.containerElement.appendChild(this.iframe);
22422
+ }
22423
+ }
22424
+ /**
22425
+ * All post messages from inside our iframes and modals should use this function
22426
+ * to post messages to the parent window. It strongly types the data and makes
22427
+ * sure we're only listening to events that have the iframeUid
22428
+ */
22429
+ function postMessageFromIframe(action) {
22430
+ const origin = "*";
22431
+ const verificationUrl = new URL(window.location.href);
22432
+ const verificationIframeUid = verificationUrl.searchParams.get("verificationIframeUid");
22433
+ window.parent.postMessage({
22434
+ verificationIframeUid,
22435
+ action,
22436
+ }, origin);
22437
+ }
22438
+
22272
22439
  /*
22273
22440
  Trap focus in the lightbox by sending and receiving postMessages, here and from the modal script, while tabbing through the program.
22274
22441
  */
22275
22442
  const trapFocus = () => {
22443
+ let lastFocusableElement = null;
22276
22444
  document.addEventListener("keydown", (e) => {
22277
- const focusableElements = 'button, .sid-link, input, select, textarea, [tabindex]:not([tabindex="-1"]';
22278
- const focusableContent = document.querySelectorAll(focusableElements);
22279
- const lastFocusableElement = focusableContent[focusableContent.length - 1];
22280
22445
  const isTabPressed = e.key === "Tab";
22281
22446
  if (!isTabPressed) {
22282
22447
  return;
22283
22448
  }
22449
+ const focusableElements = 'button, .sid-link, input, select, textarea, [tabindex]:not([tabindex="-1"]';
22450
+ const focusableContent = document.querySelectorAll(focusableElements);
22451
+ lastFocusableElement = focusableContent[focusableContent.length - 1];
22284
22452
  if (lastFocusableElement) {
22285
- window.addEventListener("message", (event) => {
22286
- const message = typeof event.data === "string" ? JSON.parse(event.data) : event.data;
22287
- if (message.focusOn === "lastElement") {
22288
- lastFocusableElement.focus();
22289
- e.preventDefault();
22290
- }
22291
- });
22292
22453
  if (!e.shiftKey && document.activeElement === lastFocusableElement) {
22293
- window.parent.postMessage({ focusOn: "firstElement" }, "*");
22454
+ postMessageFromIframe({ type: "focus", focusOn: "firstElement" });
22294
22455
  e.preventDefault();
22295
22456
  }
22296
22457
  }
22297
22458
  });
22459
+ window.addEventListener("message", (event) => {
22460
+ const message = event.data;
22461
+ if (message.focusOn === "lastElement" && lastFocusableElement) {
22462
+ lastFocusableElement.focus();
22463
+ }
22464
+ });
22298
22465
  // set inital focus to lightbox close button
22299
- window.parent.postMessage({ focusOn: "firstElement" }, "*");
22466
+ postMessageFromIframe({ type: "focus", focusOn: "firstElement" });
22300
22467
  };
22301
22468
  const maintainFocusInLightbox = () => {
22302
22469
  window.addEventListener("message", (event) => {
22303
- const message = typeof event.data === "string" ? JSON.parse(event.data) : event.data;
22470
+ const message = event.data;
22304
22471
  if (message.isInLightBox === "true") {
22305
22472
  trapFocus();
22306
22473
  }
@@ -22457,146 +22624,6 @@ const postalCodeMatchers = {
22457
22624
  GB: "^GIR ?0AA|(?:(?:AB|AL|B|BA|BB|BD|BH|BL|BN|BR|BS|BT|BX|CA|CB|CF|CH|CM|CO|CR|CT|CV|CW|DA|DD|DE|DG|DH|DL|DN|DT|DY|E|EC|EH|EN|EX|FK|FY|G|GL|GY|GU|HA|HD|HG|HP|HR|HS|HU|HX|IG|IM|IP|IV|JE|KA|KT|KW|KY|L|LA|LD|LE|LL|LN|LS|LU|M|ME|MK|ML|N|NE|NG|NN|NP|NR|NW|OL|OX|PA|PE|PH|PL|PO|PR|RG|RH|RM|S|SA|SE|SG|SK|SL|SM|SN|SO|SP|SR|SS|ST|SW|SY|TA|TD|TF|TN|TQ|TR|TS|TW|UB|W|WA|WC|WD|WF|WN|WR|WS|WV|YO|ZE)(?:\\d[\\dA-Z]? ?\\d[ABD-HJLN-UW-Z]{2}))|BFPO ?\\d{1,4}$",
22458
22625
  };
22459
22626
 
22460
- const fadeInElements = (elements) => {
22461
- elements.forEach((element) => {
22462
- element.classList.add("fade-in");
22463
- });
22464
- };
22465
- const removeElement = (element, transitionTimeout) => {
22466
- element.classList.remove("fade-in");
22467
- window.setTimeout(() => {
22468
- document.body.style.overflow = "auto";
22469
- element.parentNode.removeChild(element);
22470
- }, transitionTimeout);
22471
- };
22472
- const getVerificationUrl = (url) => {
22473
- const newUrl = new URL(url);
22474
- const parentUrl = new URL(window.location.href);
22475
- // Combine query parameters from parent window and provided url.
22476
- // If duplicates, provided url parameters supercede.
22477
- parentUrl.searchParams.forEach((value, key) => {
22478
- if (!newUrl.searchParams.has(key)) {
22479
- newUrl.searchParams.set(key, value);
22480
- }
22481
- });
22482
- return newUrl.href;
22483
- };
22484
-
22485
- class Iframe {
22486
- constructor(containerElement, url) {
22487
- this.hasLoaded = false;
22488
- this.onLoadEvents = [];
22489
- this.installType = "cdn_inline_iframe";
22490
- if (Iframe.isValidHttpUrl(url)) {
22491
- const options = {
22492
- className: iframeConstants.CLASS_NAMES.INLINE_IFRAME_CONTENT,
22493
- title: iframeTitle,
22494
- };
22495
- this.containerElement = containerElement;
22496
- this.verificationUrl = new URL(getVerificationUrl(url));
22497
- this.verificationIframeUid = Iframe.createUniqueId();
22498
- this.createIframe(options);
22499
- this.addVerificationSizeUpdatesListener();
22500
- }
22501
- else {
22502
- logger.error("Invalid URL. Provide a proper URL: https://example.com/", "iframe url");
22503
- }
22504
- }
22505
- static createUniqueId() {
22506
- return Math.random().toString(36).substr(2, 9);
22507
- }
22508
- static isValidHttpUrl(urlString) {
22509
- try {
22510
- const url = new URL(urlString);
22511
- return url.protocol === "http:" || url.protocol === "https:";
22512
- }
22513
- catch {
22514
- return false;
22515
- }
22516
- }
22517
- createIframe(options) {
22518
- this.iframe = document.createElement("iframe");
22519
- this.iframe.classList.add(options.className);
22520
- this.iframe.title = options.title;
22521
- let mark = "?";
22522
- if (this.verificationUrl.search) {
22523
- mark = "&";
22524
- }
22525
- this.iframe.src = `${this.verificationUrl.href}${mark}verificationIframeUid=${this.verificationIframeUid}&${QUERY_STRING_INSTALL_PAGE_URL}=${encodeURIComponent(getCurrentUrl())}&${QUERY_STRING_INSTALL_TYPE}=${this.installType}`;
22526
- this.iframe.onload = () => this.onLoad();
22527
- return this.iframe;
22528
- }
22529
- // If iFrame hasn't loaded yet, queue up the callback
22530
- // otherwise call it immediately
22531
- addOnLoadEvent(callback) {
22532
- try {
22533
- assertValidFunction(callback);
22534
- }
22535
- catch (e) {
22536
- logger.error("Invalid callback provided to iFrame.onLoad()", e);
22537
- return;
22538
- }
22539
- if (this.hasLoaded) {
22540
- callback();
22541
- }
22542
- else {
22543
- this.onLoadEvents.push(callback);
22544
- }
22545
- }
22546
- onLoad() {
22547
- this.hasLoaded = true;
22548
- this.onLoadEvents.forEach((callback) => callback());
22549
- }
22550
- addVerificationSizeUpdatesListener() {
22551
- window.addEventListener("message", (event) => {
22552
- if (this.verificationUrl.origin !== event.origin) {
22553
- return;
22554
- }
22555
- const message = typeof event.data === "string" ? JSON.parse(event.data) : event.data;
22556
- if (message.verificationIframeUid !== this.verificationIframeUid) {
22557
- return;
22558
- }
22559
- switch (message.action) {
22560
- case "updateHeight":
22561
- // UX-1129: If we are getting height updates, turn off scrolling for
22562
- // the iframe. This prevents browsers (Safari in particular) from
22563
- // re-wrapping because of different widths and constantly changing
22564
- // it's own height. `scrolling = "no"` is deprecated, but supported in
22565
- // all browsers and fixes the problem well.
22566
- this.iframe.scrolling = "no";
22567
- this.iframe.style.height = `${message.height}px`;
22568
- break;
22569
- default:
22570
- logger.error("Unsupported message.action");
22571
- }
22572
- });
22573
- }
22574
- setViewModel(viewModel) {
22575
- const message = {
22576
- action: "setViewModel",
22577
- viewModel,
22578
- };
22579
- this.addOnLoadEvent(() => {
22580
- this.iframe.contentWindow.postMessage(message, this.verificationUrl.origin);
22581
- });
22582
- }
22583
- setOptions(options) {
22584
- const message = {
22585
- action: "setOptions",
22586
- options,
22587
- };
22588
- this.addOnLoadEvent(() => {
22589
- this.iframe.contentWindow.postMessage(message, this.verificationUrl.origin);
22590
- });
22591
- }
22592
- setInstallType(installType) {
22593
- this.installType = installType;
22594
- }
22595
- init() {
22596
- this.containerElement.appendChild(this.iframe);
22597
- }
22598
- }
22599
-
22600
22627
  class Modal {
22601
22628
  constructor(url, userConfig) {
22602
22629
  this.popStateEventHandler = () => this.closeModal();
@@ -22641,6 +22668,7 @@ class Modal {
22641
22668
  const transitionTimeout = iframeConstants.MODAL_OPACITY_TRANSITION_PERIOD;
22642
22669
  removeElement(this.overlay, transitionTimeout);
22643
22670
  removeElement(this.wrapper, transitionTimeout);
22671
+ this.iframeInstance.cleanup();
22644
22672
  }
22645
22673
  static createOverlay() {
22646
22674
  const overlay = document.createElement("div");
@@ -22667,9 +22695,8 @@ class Modal {
22667
22695
  window.addEventListener("popstate", this.popStateEventHandler);
22668
22696
  }
22669
22697
  addFocusListener() {
22670
- window.addEventListener("message", (event) => {
22671
- const message = typeof event.data === "string" ? JSON.parse(event.data) : event.data;
22672
- if (message.focusOn === "firstElement") {
22698
+ this.iframeInstance.addWindowMessageListener((action) => {
22699
+ if (action.type === "focus" && action.focusOn === "firstElement") {
22673
22700
  this.closeButton.focus();
22674
22701
  }
22675
22702
  });
@@ -22735,13 +22762,7 @@ function postVerificationSizeUpdates(options = { origin: "*", interval: 100 }) {
22735
22762
  const heightWithComputedMargins = bodyHeight +
22736
22763
  parseInt(window.getComputedStyle(document.body).marginTop, 10) +
22737
22764
  parseInt(window.getComputedStyle(document.body).marginBottom, 10);
22738
- const verificationUrl = new URL(window.location.href);
22739
- const verificationIframeUid = verificationUrl.searchParams.get("verificationIframeUid");
22740
- window.parent.postMessage({
22741
- verificationIframeUid,
22742
- action: "updateHeight",
22743
- height: heightWithComputedMargins,
22744
- }, options.origin);
22765
+ postMessageFromIframe({ type: "updateHeight", height: heightWithComputedMargins });
22745
22766
  }
22746
22767
  }, options.interval);
22747
22768
  return () => clearInterval(interval);