@sheerid/jslib 1.152.0 → 1.154.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.
- package/es5/Tmetrix.bundle.js +4 -4
- package/es5/messages_ar.bundle.js +4 -4
- package/es5/messages_bg.bundle.js +4 -4
- package/es5/messages_cs.bundle.js +4 -4
- package/es5/messages_da.bundle.js +4 -4
- package/es5/messages_de.bundle.js +4 -4
- package/es5/messages_el.bundle.js +4 -4
- package/es5/messages_en-GB.bundle.js +4 -4
- package/es5/messages_es-ES.bundle.js +4 -4
- package/es5/messages_es.bundle.js +4 -4
- package/es5/messages_fi.bundle.js +4 -4
- package/es5/messages_fr-CA.bundle.js +4 -4
- package/es5/messages_fr.bundle.js +4 -4
- package/es5/messages_ga.bundle.js +4 -4
- package/es5/messages_hr.bundle.js +4 -4
- package/es5/messages_hu.bundle.js +4 -4
- package/es5/messages_id.bundle.js +4 -4
- package/es5/messages_it.bundle.js +4 -4
- package/es5/messages_iw.bundle.js +4 -4
- package/es5/messages_ja.bundle.js +4 -4
- package/es5/messages_ko.bundle.js +4 -4
- package/es5/messages_lo.bundle.js +4 -4
- package/es5/messages_lt.bundle.js +4 -4
- package/es5/messages_ms.bundle.js +4 -4
- package/es5/messages_nl.bundle.js +4 -4
- package/es5/messages_no.bundle.js +4 -4
- package/es5/messages_pl.bundle.js +4 -4
- package/es5/messages_pt-BR.bundle.js +4 -4
- package/es5/messages_pt.bundle.js +4 -4
- package/es5/messages_ru.bundle.js +4 -4
- package/es5/messages_sk.bundle.js +4 -4
- package/es5/messages_sl.bundle.js +4 -4
- package/es5/messages_sr.bundle.js +4 -4
- package/es5/messages_sv.bundle.js +4 -4
- package/es5/messages_th.bundle.js +4 -4
- package/es5/messages_tr.bundle.js +4 -4
- package/es5/messages_zh-HK.bundle.js +4 -4
- package/es5/messages_zh.bundle.js +4 -4
- package/manifest.json +43 -43
- package/package.json +1 -1
- package/sheerid-requestOrg.css +4 -4
- package/sheerid-requestOrg.js +5 -5
- package/sheerid-requestOrg.js.map +1 -1
- package/sheerid-utils.js +6 -6
- package/sheerid-utils.js.map +1 -1
- package/sheerid.css +4 -4
- package/sheerid.js +10 -10
- package/sheerid.js.map +1 -1
- package/sheerides6.js +193 -163
- package/sheerides6.js.map +1 -1
- package/src/lib/installScript/iframe.d.ts +15 -1
- package/src/lib/types/runtimeTypes.d.ts +4 -1
- package/src/lib/types/types.d.ts +15 -1
- package/types-reference.zip +0 -0
package/sheerides6.js
CHANGED
|
@@ -36,6 +36,9 @@ const LICENSED_PROFESSIONAL_STATUS = [
|
|
|
36
36
|
"VETERINARIAN",
|
|
37
37
|
"CHILD_CARE_WORKER",
|
|
38
38
|
"LIBRARIAN",
|
|
39
|
+
"INTERIOR_DESIGNER",
|
|
40
|
+
"ARCHITECT",
|
|
41
|
+
"GENERAL_CONTRACTOR",
|
|
39
42
|
];
|
|
40
43
|
const RECENT_MOVER_STATUS = ["HOME_BUYER", "OTHER_MOVER"];
|
|
41
44
|
const LOW_INCOME_STATUS = ["SNAP_BENEFITS", "OTHER_GOVERNMENT_ASSISTANCE"];
|
|
@@ -654,6 +657,9 @@ var SubSegmentEnum;
|
|
|
654
657
|
SubSegmentEnum["OTHER_GOVERNMENT_ASSISTANCE"] = "otherGovernmentAssistance";
|
|
655
658
|
SubSegmentEnum["CHILD_CARE_WORKER"] = "childCareWorker";
|
|
656
659
|
SubSegmentEnum["LIBRARIAN"] = "librarian";
|
|
660
|
+
SubSegmentEnum["INTERIOR_DESIGNER"] = "interiorDesigner";
|
|
661
|
+
SubSegmentEnum["ARCHITECT"] = "architect";
|
|
662
|
+
SubSegmentEnum["GENERAL_CONTRACTOR"] = "generalContractor";
|
|
657
663
|
})(SubSegmentEnum || (SubSegmentEnum = {}));
|
|
658
664
|
Object.values(SubSegmentEnum); // For runtime checks
|
|
659
665
|
const MilitaryStatusDefaultMessagesEnum = {
|
|
@@ -19216,6 +19222,9 @@ const defaultStatusMessages$1 = {
|
|
|
19216
19222
|
VETERINARIAN: "Veterinarian",
|
|
19217
19223
|
CHILD_CARE_WORKER: "Child Care Worker",
|
|
19218
19224
|
LIBRARIAN: "Librarian",
|
|
19225
|
+
INTERIOR_DESIGNER: "Interior Designer",
|
|
19226
|
+
ARCHITECT: "Architect",
|
|
19227
|
+
GENERAL_CONTRACTOR: "General Contractor",
|
|
19219
19228
|
};
|
|
19220
19229
|
const StepLicensedProfessionalPersonalInfo = ({ intl, verificationService, }) => {
|
|
19221
19230
|
const viewModel = verificationService.viewModel;
|
|
@@ -22260,38 +22269,205 @@ const NewVerificationInnerComponent = ({ locale, messages, programTheme, verific
|
|
|
22260
22269
|
verificationService.verificationResponse.currentStep, verificationService: verificationService }))))));
|
|
22261
22270
|
};
|
|
22262
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
|
+
|
|
22263
22439
|
/*
|
|
22264
22440
|
Trap focus in the lightbox by sending and receiving postMessages, here and from the modal script, while tabbing through the program.
|
|
22265
22441
|
*/
|
|
22266
22442
|
const trapFocus = () => {
|
|
22443
|
+
let lastFocusableElement = null;
|
|
22267
22444
|
document.addEventListener("keydown", (e) => {
|
|
22268
|
-
const focusableElements = 'button, .sid-link, input, select, textarea, [tabindex]:not([tabindex="-1"]';
|
|
22269
|
-
const focusableContent = document.querySelectorAll(focusableElements);
|
|
22270
|
-
const lastFocusableElement = focusableContent[focusableContent.length - 1];
|
|
22271
22445
|
const isTabPressed = e.key === "Tab";
|
|
22272
22446
|
if (!isTabPressed) {
|
|
22273
22447
|
return;
|
|
22274
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];
|
|
22275
22452
|
if (lastFocusableElement) {
|
|
22276
|
-
window.addEventListener("message", (event) => {
|
|
22277
|
-
const message = typeof event.data === "string" ? JSON.parse(event.data) : event.data;
|
|
22278
|
-
if (message.focusOn === "lastElement") {
|
|
22279
|
-
lastFocusableElement.focus();
|
|
22280
|
-
e.preventDefault();
|
|
22281
|
-
}
|
|
22282
|
-
});
|
|
22283
22453
|
if (!e.shiftKey && document.activeElement === lastFocusableElement) {
|
|
22284
|
-
|
|
22454
|
+
postMessageFromIframe({ type: "focus", focusOn: "firstElement" });
|
|
22285
22455
|
e.preventDefault();
|
|
22286
22456
|
}
|
|
22287
22457
|
}
|
|
22288
22458
|
});
|
|
22459
|
+
window.addEventListener("message", (event) => {
|
|
22460
|
+
const message = event.data;
|
|
22461
|
+
if (message.focusOn === "lastElement" && lastFocusableElement) {
|
|
22462
|
+
lastFocusableElement.focus();
|
|
22463
|
+
}
|
|
22464
|
+
});
|
|
22289
22465
|
// set inital focus to lightbox close button
|
|
22290
|
-
|
|
22466
|
+
postMessageFromIframe({ type: "focus", focusOn: "firstElement" });
|
|
22291
22467
|
};
|
|
22292
22468
|
const maintainFocusInLightbox = () => {
|
|
22293
22469
|
window.addEventListener("message", (event) => {
|
|
22294
|
-
const message =
|
|
22470
|
+
const message = event.data;
|
|
22295
22471
|
if (message.isInLightBox === "true") {
|
|
22296
22472
|
trapFocus();
|
|
22297
22473
|
}
|
|
@@ -22448,146 +22624,6 @@ const postalCodeMatchers = {
|
|
|
22448
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}$",
|
|
22449
22625
|
};
|
|
22450
22626
|
|
|
22451
|
-
const fadeInElements = (elements) => {
|
|
22452
|
-
elements.forEach((element) => {
|
|
22453
|
-
element.classList.add("fade-in");
|
|
22454
|
-
});
|
|
22455
|
-
};
|
|
22456
|
-
const removeElement = (element, transitionTimeout) => {
|
|
22457
|
-
element.classList.remove("fade-in");
|
|
22458
|
-
window.setTimeout(() => {
|
|
22459
|
-
document.body.style.overflow = "auto";
|
|
22460
|
-
element.parentNode.removeChild(element);
|
|
22461
|
-
}, transitionTimeout);
|
|
22462
|
-
};
|
|
22463
|
-
const getVerificationUrl = (url) => {
|
|
22464
|
-
const newUrl = new URL(url);
|
|
22465
|
-
const parentUrl = new URL(window.location.href);
|
|
22466
|
-
// Combine query parameters from parent window and provided url.
|
|
22467
|
-
// If duplicates, provided url parameters supercede.
|
|
22468
|
-
parentUrl.searchParams.forEach((value, key) => {
|
|
22469
|
-
if (!newUrl.searchParams.has(key)) {
|
|
22470
|
-
newUrl.searchParams.set(key, value);
|
|
22471
|
-
}
|
|
22472
|
-
});
|
|
22473
|
-
return newUrl.href;
|
|
22474
|
-
};
|
|
22475
|
-
|
|
22476
|
-
class Iframe {
|
|
22477
|
-
constructor(containerElement, url) {
|
|
22478
|
-
this.hasLoaded = false;
|
|
22479
|
-
this.onLoadEvents = [];
|
|
22480
|
-
this.installType = "cdn_inline_iframe";
|
|
22481
|
-
if (Iframe.isValidHttpUrl(url)) {
|
|
22482
|
-
const options = {
|
|
22483
|
-
className: iframeConstants.CLASS_NAMES.INLINE_IFRAME_CONTENT,
|
|
22484
|
-
title: iframeTitle,
|
|
22485
|
-
};
|
|
22486
|
-
this.containerElement = containerElement;
|
|
22487
|
-
this.verificationUrl = new URL(getVerificationUrl(url));
|
|
22488
|
-
this.verificationIframeUid = Iframe.createUniqueId();
|
|
22489
|
-
this.createIframe(options);
|
|
22490
|
-
this.addVerificationSizeUpdatesListener();
|
|
22491
|
-
}
|
|
22492
|
-
else {
|
|
22493
|
-
logger.error("Invalid URL. Provide a proper URL: https://example.com/", "iframe url");
|
|
22494
|
-
}
|
|
22495
|
-
}
|
|
22496
|
-
static createUniqueId() {
|
|
22497
|
-
return Math.random().toString(36).substr(2, 9);
|
|
22498
|
-
}
|
|
22499
|
-
static isValidHttpUrl(urlString) {
|
|
22500
|
-
try {
|
|
22501
|
-
const url = new URL(urlString);
|
|
22502
|
-
return url.protocol === "http:" || url.protocol === "https:";
|
|
22503
|
-
}
|
|
22504
|
-
catch {
|
|
22505
|
-
return false;
|
|
22506
|
-
}
|
|
22507
|
-
}
|
|
22508
|
-
createIframe(options) {
|
|
22509
|
-
this.iframe = document.createElement("iframe");
|
|
22510
|
-
this.iframe.classList.add(options.className);
|
|
22511
|
-
this.iframe.title = options.title;
|
|
22512
|
-
let mark = "?";
|
|
22513
|
-
if (this.verificationUrl.search) {
|
|
22514
|
-
mark = "&";
|
|
22515
|
-
}
|
|
22516
|
-
this.iframe.src = `${this.verificationUrl.href}${mark}verificationIframeUid=${this.verificationIframeUid}&${QUERY_STRING_INSTALL_PAGE_URL}=${encodeURIComponent(getCurrentUrl())}&${QUERY_STRING_INSTALL_TYPE}=${this.installType}`;
|
|
22517
|
-
this.iframe.onload = () => this.onLoad();
|
|
22518
|
-
return this.iframe;
|
|
22519
|
-
}
|
|
22520
|
-
// If iFrame hasn't loaded yet, queue up the callback
|
|
22521
|
-
// otherwise call it immediately
|
|
22522
|
-
addOnLoadEvent(callback) {
|
|
22523
|
-
try {
|
|
22524
|
-
assertValidFunction(callback);
|
|
22525
|
-
}
|
|
22526
|
-
catch (e) {
|
|
22527
|
-
logger.error("Invalid callback provided to iFrame.onLoad()", e);
|
|
22528
|
-
return;
|
|
22529
|
-
}
|
|
22530
|
-
if (this.hasLoaded) {
|
|
22531
|
-
callback();
|
|
22532
|
-
}
|
|
22533
|
-
else {
|
|
22534
|
-
this.onLoadEvents.push(callback);
|
|
22535
|
-
}
|
|
22536
|
-
}
|
|
22537
|
-
onLoad() {
|
|
22538
|
-
this.hasLoaded = true;
|
|
22539
|
-
this.onLoadEvents.forEach((callback) => callback());
|
|
22540
|
-
}
|
|
22541
|
-
addVerificationSizeUpdatesListener() {
|
|
22542
|
-
window.addEventListener("message", (event) => {
|
|
22543
|
-
if (this.verificationUrl.origin !== event.origin) {
|
|
22544
|
-
return;
|
|
22545
|
-
}
|
|
22546
|
-
const message = typeof event.data === "string" ? JSON.parse(event.data) : event.data;
|
|
22547
|
-
if (message.verificationIframeUid !== this.verificationIframeUid) {
|
|
22548
|
-
return;
|
|
22549
|
-
}
|
|
22550
|
-
switch (message.action) {
|
|
22551
|
-
case "updateHeight":
|
|
22552
|
-
// UX-1129: If we are getting height updates, turn off scrolling for
|
|
22553
|
-
// the iframe. This prevents browsers (Safari in particular) from
|
|
22554
|
-
// re-wrapping because of different widths and constantly changing
|
|
22555
|
-
// it's own height. `scrolling = "no"` is deprecated, but supported in
|
|
22556
|
-
// all browsers and fixes the problem well.
|
|
22557
|
-
this.iframe.scrolling = "no";
|
|
22558
|
-
this.iframe.style.height = `${message.height}px`;
|
|
22559
|
-
break;
|
|
22560
|
-
default:
|
|
22561
|
-
logger.error("Unsupported message.action");
|
|
22562
|
-
}
|
|
22563
|
-
});
|
|
22564
|
-
}
|
|
22565
|
-
setViewModel(viewModel) {
|
|
22566
|
-
const message = {
|
|
22567
|
-
action: "setViewModel",
|
|
22568
|
-
viewModel,
|
|
22569
|
-
};
|
|
22570
|
-
this.addOnLoadEvent(() => {
|
|
22571
|
-
this.iframe.contentWindow.postMessage(message, this.verificationUrl.origin);
|
|
22572
|
-
});
|
|
22573
|
-
}
|
|
22574
|
-
setOptions(options) {
|
|
22575
|
-
const message = {
|
|
22576
|
-
action: "setOptions",
|
|
22577
|
-
options,
|
|
22578
|
-
};
|
|
22579
|
-
this.addOnLoadEvent(() => {
|
|
22580
|
-
this.iframe.contentWindow.postMessage(message, this.verificationUrl.origin);
|
|
22581
|
-
});
|
|
22582
|
-
}
|
|
22583
|
-
setInstallType(installType) {
|
|
22584
|
-
this.installType = installType;
|
|
22585
|
-
}
|
|
22586
|
-
init() {
|
|
22587
|
-
this.containerElement.appendChild(this.iframe);
|
|
22588
|
-
}
|
|
22589
|
-
}
|
|
22590
|
-
|
|
22591
22627
|
class Modal {
|
|
22592
22628
|
constructor(url, userConfig) {
|
|
22593
22629
|
this.popStateEventHandler = () => this.closeModal();
|
|
@@ -22632,6 +22668,7 @@ class Modal {
|
|
|
22632
22668
|
const transitionTimeout = iframeConstants.MODAL_OPACITY_TRANSITION_PERIOD;
|
|
22633
22669
|
removeElement(this.overlay, transitionTimeout);
|
|
22634
22670
|
removeElement(this.wrapper, transitionTimeout);
|
|
22671
|
+
this.iframeInstance.cleanup();
|
|
22635
22672
|
}
|
|
22636
22673
|
static createOverlay() {
|
|
22637
22674
|
const overlay = document.createElement("div");
|
|
@@ -22658,9 +22695,8 @@ class Modal {
|
|
|
22658
22695
|
window.addEventListener("popstate", this.popStateEventHandler);
|
|
22659
22696
|
}
|
|
22660
22697
|
addFocusListener() {
|
|
22661
|
-
|
|
22662
|
-
|
|
22663
|
-
if (message.focusOn === "firstElement") {
|
|
22698
|
+
this.iframeInstance.addWindowMessageListener((action) => {
|
|
22699
|
+
if (action.type === "focus" && action.focusOn === "firstElement") {
|
|
22664
22700
|
this.closeButton.focus();
|
|
22665
22701
|
}
|
|
22666
22702
|
});
|
|
@@ -22726,13 +22762,7 @@ function postVerificationSizeUpdates(options = { origin: "*", interval: 100 }) {
|
|
|
22726
22762
|
const heightWithComputedMargins = bodyHeight +
|
|
22727
22763
|
parseInt(window.getComputedStyle(document.body).marginTop, 10) +
|
|
22728
22764
|
parseInt(window.getComputedStyle(document.body).marginBottom, 10);
|
|
22729
|
-
|
|
22730
|
-
const verificationIframeUid = verificationUrl.searchParams.get("verificationIframeUid");
|
|
22731
|
-
window.parent.postMessage({
|
|
22732
|
-
verificationIframeUid,
|
|
22733
|
-
action: "updateHeight",
|
|
22734
|
-
height: heightWithComputedMargins,
|
|
22735
|
-
}, options.origin);
|
|
22765
|
+
postMessageFromIframe({ type: "updateHeight", height: heightWithComputedMargins });
|
|
22736
22766
|
}
|
|
22737
22767
|
}, options.interval);
|
|
22738
22768
|
return () => clearInterval(interval);
|