@authsignal/browser 0.0.16 → 0.0.17
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/dist/cjs/index.js +128 -99
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/rollup.config.d.ts +3 -0
- package/dist/cjs/src/authsignal.d.ts +15 -0
- package/dist/cjs/src/helpers.d.ts +11 -0
- package/dist/cjs/src/index.d.ts +2 -0
- package/dist/cjs/src/popup-handler.d.ts +19 -0
- package/dist/cjs/src/types.d.ts +52 -0
- package/dist/esm/index.js +128 -99
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/rollup.config.d.ts +3 -0
- package/dist/esm/src/authsignal.d.ts +15 -0
- package/dist/esm/src/helpers.d.ts +11 -0
- package/dist/esm/src/index.d.ts +2 -0
- package/dist/esm/src/popup-handler.d.ts +19 -0
- package/dist/esm/src/types.d.ts +52 -0
- package/package.json +15 -15
- package/dist/index.d.ts +0 -46
package/dist/cjs/index.js
CHANGED
|
@@ -5,14 +5,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
// Unique ID creation requires a high quality random # generator. In the browser we therefore
|
|
6
6
|
// require the crypto API and do not support built-in fallback to lower quality random number
|
|
7
7
|
// generators (like Math.random()).
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
let getRandomValues;
|
|
9
|
+
const rnds8 = new Uint8Array(16);
|
|
10
10
|
function rng() {
|
|
11
11
|
// lazy load so that environments that need to polyfill have a chance to do so
|
|
12
12
|
if (!getRandomValues) {
|
|
13
|
-
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
|
|
14
|
-
|
|
15
|
-
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);
|
|
13
|
+
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
|
|
14
|
+
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
16
15
|
|
|
17
16
|
if (!getRandomValues) {
|
|
18
17
|
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
|
@@ -33,27 +32,16 @@ function validate(uuid) {
|
|
|
33
32
|
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
34
33
|
*/
|
|
35
34
|
|
|
36
|
-
|
|
35
|
+
const byteToHex = [];
|
|
37
36
|
|
|
38
|
-
for (
|
|
39
|
-
byteToHex.push((i + 0x100).toString(16).
|
|
37
|
+
for (let i = 0; i < 256; ++i) {
|
|
38
|
+
byteToHex.push((i + 0x100).toString(16).slice(1));
|
|
40
39
|
}
|
|
41
40
|
|
|
42
|
-
function
|
|
43
|
-
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
41
|
+
function unsafeStringify(arr, offset = 0) {
|
|
44
42
|
// Note: Be careful editing this code! It's been tuned for performance
|
|
45
43
|
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
|
|
46
|
-
|
|
47
|
-
// of the following:
|
|
48
|
-
// - One or more input array values don't map to a hex octet (leading to
|
|
49
|
-
// "undefined" in the uuid)
|
|
50
|
-
// - Invalid input values for the RFC `version` or `variant` fields
|
|
51
|
-
|
|
52
|
-
if (!validate(uuid)) {
|
|
53
|
-
throw TypeError('Stringified UUID is invalid');
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return uuid;
|
|
44
|
+
return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
|
|
57
45
|
}
|
|
58
46
|
|
|
59
47
|
function parse(uuid) {
|
|
@@ -61,8 +49,8 @@ function parse(uuid) {
|
|
|
61
49
|
throw TypeError('Invalid UUID');
|
|
62
50
|
}
|
|
63
51
|
|
|
64
|
-
|
|
65
|
-
|
|
52
|
+
let v;
|
|
53
|
+
const arr = new Uint8Array(16); // Parse ########-....-....-....-............
|
|
66
54
|
|
|
67
55
|
arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;
|
|
68
56
|
arr[1] = v >>> 16 & 0xff;
|
|
@@ -91,19 +79,21 @@ function parse(uuid) {
|
|
|
91
79
|
function stringToBytes(str) {
|
|
92
80
|
str = unescape(encodeURIComponent(str)); // UTF8 escape
|
|
93
81
|
|
|
94
|
-
|
|
82
|
+
const bytes = [];
|
|
95
83
|
|
|
96
|
-
for (
|
|
84
|
+
for (let i = 0; i < str.length; ++i) {
|
|
97
85
|
bytes.push(str.charCodeAt(i));
|
|
98
86
|
}
|
|
99
87
|
|
|
100
88
|
return bytes;
|
|
101
89
|
}
|
|
102
90
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
function v35
|
|
91
|
+
const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
|
|
92
|
+
const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
|
|
93
|
+
function v35(name, version, hashfunc) {
|
|
106
94
|
function generateUUID(value, namespace, buf, offset) {
|
|
95
|
+
var _namespace;
|
|
96
|
+
|
|
107
97
|
if (typeof value === 'string') {
|
|
108
98
|
value = stringToBytes(value);
|
|
109
99
|
}
|
|
@@ -112,14 +102,14 @@ function v35 (name, version, hashfunc) {
|
|
|
112
102
|
namespace = parse(namespace);
|
|
113
103
|
}
|
|
114
104
|
|
|
115
|
-
if (namespace.length !== 16) {
|
|
105
|
+
if (((_namespace = namespace) === null || _namespace === void 0 ? void 0 : _namespace.length) !== 16) {
|
|
116
106
|
throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');
|
|
117
107
|
} // Compute hash of namespace and value, Per 4.3
|
|
118
108
|
// Future: Use spread syntax when supported on all platforms, e.g. `bytes =
|
|
119
109
|
// hashfunc([...namespace, ... value])`
|
|
120
110
|
|
|
121
111
|
|
|
122
|
-
|
|
112
|
+
let bytes = new Uint8Array(16 + value.length);
|
|
123
113
|
bytes.set(namespace);
|
|
124
114
|
bytes.set(value, namespace.length);
|
|
125
115
|
bytes = hashfunc(bytes);
|
|
@@ -129,14 +119,14 @@ function v35 (name, version, hashfunc) {
|
|
|
129
119
|
if (buf) {
|
|
130
120
|
offset = offset || 0;
|
|
131
121
|
|
|
132
|
-
for (
|
|
122
|
+
for (let i = 0; i < 16; ++i) {
|
|
133
123
|
buf[offset + i] = bytes[i];
|
|
134
124
|
}
|
|
135
125
|
|
|
136
126
|
return buf;
|
|
137
127
|
}
|
|
138
128
|
|
|
139
|
-
return
|
|
129
|
+
return unsafeStringify(bytes);
|
|
140
130
|
} // Function#name is not settable on some platforms (#270)
|
|
141
131
|
|
|
142
132
|
|
|
@@ -172,11 +162,11 @@ function v35 (name, version, hashfunc) {
|
|
|
172
162
|
*/
|
|
173
163
|
function md5(bytes) {
|
|
174
164
|
if (typeof bytes === 'string') {
|
|
175
|
-
|
|
165
|
+
const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape
|
|
176
166
|
|
|
177
167
|
bytes = new Uint8Array(msg.length);
|
|
178
168
|
|
|
179
|
-
for (
|
|
169
|
+
for (let i = 0; i < msg.length; ++i) {
|
|
180
170
|
bytes[i] = msg.charCodeAt(i);
|
|
181
171
|
}
|
|
182
172
|
}
|
|
@@ -189,13 +179,13 @@ function md5(bytes) {
|
|
|
189
179
|
|
|
190
180
|
|
|
191
181
|
function md5ToHexEncodedArray(input) {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
182
|
+
const output = [];
|
|
183
|
+
const length32 = input.length * 32;
|
|
184
|
+
const hexTab = '0123456789abcdef';
|
|
195
185
|
|
|
196
|
-
for (
|
|
197
|
-
|
|
198
|
-
|
|
186
|
+
for (let i = 0; i < length32; i += 8) {
|
|
187
|
+
const x = input[i >> 5] >>> i % 32 & 0xff;
|
|
188
|
+
const hex = parseInt(hexTab.charAt(x >>> 4 & 0x0f) + hexTab.charAt(x & 0x0f), 16);
|
|
199
189
|
output.push(hex);
|
|
200
190
|
}
|
|
201
191
|
|
|
@@ -218,16 +208,16 @@ function wordsToMd5(x, len) {
|
|
|
218
208
|
/* append padding */
|
|
219
209
|
x[len >> 5] |= 0x80 << len % 32;
|
|
220
210
|
x[getOutputLength(len) - 1] = len;
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
for (
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
211
|
+
let a = 1732584193;
|
|
212
|
+
let b = -271733879;
|
|
213
|
+
let c = -1732584194;
|
|
214
|
+
let d = 271733878;
|
|
215
|
+
|
|
216
|
+
for (let i = 0; i < x.length; i += 16) {
|
|
217
|
+
const olda = a;
|
|
218
|
+
const oldb = b;
|
|
219
|
+
const oldc = c;
|
|
220
|
+
const oldd = d;
|
|
231
221
|
a = md5ff(a, b, c, d, x[i], 7, -680876936);
|
|
232
222
|
d = md5ff(d, a, b, c, x[i + 1], 12, -389564586);
|
|
233
223
|
c = md5ff(c, d, a, b, x[i + 2], 17, 606105819);
|
|
@@ -311,10 +301,10 @@ function bytesToWords(input) {
|
|
|
311
301
|
return [];
|
|
312
302
|
}
|
|
313
303
|
|
|
314
|
-
|
|
315
|
-
|
|
304
|
+
const length8 = input.length * 8;
|
|
305
|
+
const output = new Uint32Array(getOutputLength(length8));
|
|
316
306
|
|
|
317
|
-
for (
|
|
307
|
+
for (let i = 0; i < length8; i += 8) {
|
|
318
308
|
output[i >> 5] |= (input[i / 8] & 0xff) << i % 32;
|
|
319
309
|
}
|
|
320
310
|
|
|
@@ -327,8 +317,8 @@ function bytesToWords(input) {
|
|
|
327
317
|
|
|
328
318
|
|
|
329
319
|
function safeAdd(x, y) {
|
|
330
|
-
|
|
331
|
-
|
|
320
|
+
const lsw = (x & 0xffff) + (y & 0xffff);
|
|
321
|
+
const msw = (x >> 16) + (y >> 16) + (lsw >> 16);
|
|
332
322
|
return msw << 16 | lsw & 0xffff;
|
|
333
323
|
}
|
|
334
324
|
/*
|
|
@@ -366,9 +356,18 @@ function md5ii(a, b, c, d, x, s, t) {
|
|
|
366
356
|
|
|
367
357
|
v35('v3', 0x30, md5);
|
|
368
358
|
|
|
359
|
+
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
360
|
+
var native = {
|
|
361
|
+
randomUUID
|
|
362
|
+
};
|
|
363
|
+
|
|
369
364
|
function v4(options, buf, offset) {
|
|
365
|
+
if (native.randomUUID && !buf && !options) {
|
|
366
|
+
return native.randomUUID();
|
|
367
|
+
}
|
|
368
|
+
|
|
370
369
|
options = options || {};
|
|
371
|
-
|
|
370
|
+
const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
372
371
|
|
|
373
372
|
rnds[6] = rnds[6] & 0x0f | 0x40;
|
|
374
373
|
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
|
|
@@ -376,14 +375,14 @@ function v4(options, buf, offset) {
|
|
|
376
375
|
if (buf) {
|
|
377
376
|
offset = offset || 0;
|
|
378
377
|
|
|
379
|
-
for (
|
|
378
|
+
for (let i = 0; i < 16; ++i) {
|
|
380
379
|
buf[offset + i] = rnds[i];
|
|
381
380
|
}
|
|
382
381
|
|
|
383
382
|
return buf;
|
|
384
383
|
}
|
|
385
384
|
|
|
386
|
-
return
|
|
385
|
+
return unsafeStringify(rnds);
|
|
387
386
|
}
|
|
388
387
|
|
|
389
388
|
// Adapted from Chris Veness' SHA1 code at
|
|
@@ -409,15 +408,15 @@ function ROTL(x, n) {
|
|
|
409
408
|
}
|
|
410
409
|
|
|
411
410
|
function sha1(bytes) {
|
|
412
|
-
|
|
413
|
-
|
|
411
|
+
const K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];
|
|
412
|
+
const H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];
|
|
414
413
|
|
|
415
414
|
if (typeof bytes === 'string') {
|
|
416
|
-
|
|
415
|
+
const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape
|
|
417
416
|
|
|
418
417
|
bytes = [];
|
|
419
418
|
|
|
420
|
-
for (
|
|
419
|
+
for (let i = 0; i < msg.length; ++i) {
|
|
421
420
|
bytes.push(msg.charCodeAt(i));
|
|
422
421
|
}
|
|
423
422
|
} else if (!Array.isArray(bytes)) {
|
|
@@ -426,44 +425,44 @@ function sha1(bytes) {
|
|
|
426
425
|
}
|
|
427
426
|
|
|
428
427
|
bytes.push(0x80);
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
428
|
+
const l = bytes.length / 4 + 2;
|
|
429
|
+
const N = Math.ceil(l / 16);
|
|
430
|
+
const M = new Array(N);
|
|
432
431
|
|
|
433
|
-
for (
|
|
434
|
-
|
|
432
|
+
for (let i = 0; i < N; ++i) {
|
|
433
|
+
const arr = new Uint32Array(16);
|
|
435
434
|
|
|
436
|
-
for (
|
|
437
|
-
arr[j] = bytes[
|
|
435
|
+
for (let j = 0; j < 16; ++j) {
|
|
436
|
+
arr[j] = bytes[i * 64 + j * 4] << 24 | bytes[i * 64 + j * 4 + 1] << 16 | bytes[i * 64 + j * 4 + 2] << 8 | bytes[i * 64 + j * 4 + 3];
|
|
438
437
|
}
|
|
439
438
|
|
|
440
|
-
M[
|
|
439
|
+
M[i] = arr;
|
|
441
440
|
}
|
|
442
441
|
|
|
443
442
|
M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32);
|
|
444
443
|
M[N - 1][14] = Math.floor(M[N - 1][14]);
|
|
445
444
|
M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff;
|
|
446
445
|
|
|
447
|
-
for (
|
|
448
|
-
|
|
446
|
+
for (let i = 0; i < N; ++i) {
|
|
447
|
+
const W = new Uint32Array(80);
|
|
449
448
|
|
|
450
|
-
for (
|
|
451
|
-
W[t] = M[
|
|
449
|
+
for (let t = 0; t < 16; ++t) {
|
|
450
|
+
W[t] = M[i][t];
|
|
452
451
|
}
|
|
453
452
|
|
|
454
|
-
for (
|
|
455
|
-
W[
|
|
453
|
+
for (let t = 16; t < 80; ++t) {
|
|
454
|
+
W[t] = ROTL(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1);
|
|
456
455
|
}
|
|
457
456
|
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
457
|
+
let a = H[0];
|
|
458
|
+
let b = H[1];
|
|
459
|
+
let c = H[2];
|
|
460
|
+
let d = H[3];
|
|
461
|
+
let e = H[4];
|
|
463
462
|
|
|
464
|
-
for (
|
|
465
|
-
|
|
466
|
-
|
|
463
|
+
for (let t = 0; t < 80; ++t) {
|
|
464
|
+
const s = Math.floor(t / 20);
|
|
465
|
+
const T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[t] >>> 0;
|
|
467
466
|
e = d;
|
|
468
467
|
d = c;
|
|
469
468
|
c = ROTL(b, 30) >>> 0;
|
|
@@ -525,8 +524,8 @@ var focusableSelectors = [
|
|
|
525
524
|
'[tabindex]:not([tabindex^="-"])',
|
|
526
525
|
];
|
|
527
526
|
|
|
528
|
-
var TAB_KEY =
|
|
529
|
-
var ESCAPE_KEY =
|
|
527
|
+
var TAB_KEY = 'Tab';
|
|
528
|
+
var ESCAPE_KEY = 'Escape';
|
|
530
529
|
|
|
531
530
|
/**
|
|
532
531
|
* Define the constructor to instantiate a dialog
|
|
@@ -578,9 +577,22 @@ A11yDialog.prototype.create = function () {
|
|
|
578
577
|
|
|
579
578
|
// Keep a collection of dialog closers, each of which will be bound a click
|
|
580
579
|
// event listener to close the dialog
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
)
|
|
580
|
+
const $el = this.$el;
|
|
581
|
+
|
|
582
|
+
this._closers = $$('[data-a11y-dialog-hide]', this.$el)
|
|
583
|
+
// This filter is necessary in case there are nested dialogs, so that
|
|
584
|
+
// only closers from the current dialog are retrieved and effective
|
|
585
|
+
.filter(function (closer) {
|
|
586
|
+
// Testing for `[aria-modal="true"]` is not enough since this attribute
|
|
587
|
+
// and the collect of closers is done at instantation time, when nested
|
|
588
|
+
// dialogs might not have yet been instantiated. Note that if the dialogs
|
|
589
|
+
// are manually instantiated, this could still fail because none of these
|
|
590
|
+
// selectors would match; this would cause closers to close all parent
|
|
591
|
+
// dialogs instead of just the current one
|
|
592
|
+
return closer.closest('[aria-modal="true"], [data-a11y-dialog]') === $el
|
|
593
|
+
})
|
|
594
|
+
.concat($$('[data-a11y-dialog-hide="' + this._id + '"]'));
|
|
595
|
+
|
|
584
596
|
this._closers.forEach(
|
|
585
597
|
function (closer) {
|
|
586
598
|
closer.addEventListener('click', this._hide);
|
|
@@ -761,14 +773,15 @@ A11yDialog.prototype._fire = function (type, event) {
|
|
|
761
773
|
A11yDialog.prototype._bindKeypress = function (event) {
|
|
762
774
|
// This is an escape hatch in case there are nested dialogs, so the keypresses
|
|
763
775
|
// are only reacted to for the most recent one
|
|
764
|
-
|
|
776
|
+
const focused = document.activeElement;
|
|
777
|
+
if (focused && focused.closest('[aria-modal="true"]') !== this.$el) return
|
|
765
778
|
|
|
766
779
|
// If the dialog is shown and the ESCAPE key is being pressed, prevent any
|
|
767
780
|
// further effects from the ESCAPE key and hide the dialog, unless its role
|
|
768
781
|
// is 'alertdialog', which should be modal
|
|
769
782
|
if (
|
|
770
783
|
this.shown &&
|
|
771
|
-
event.
|
|
784
|
+
event.key === ESCAPE_KEY &&
|
|
772
785
|
this.$el.getAttribute('role') !== 'alertdialog'
|
|
773
786
|
) {
|
|
774
787
|
event.preventDefault();
|
|
@@ -777,7 +790,7 @@ A11yDialog.prototype._bindKeypress = function (event) {
|
|
|
777
790
|
|
|
778
791
|
// If the dialog is shown and the TAB key is being pressed, make sure the
|
|
779
792
|
// focus stays trapped within the dialog element
|
|
780
|
-
if (this.shown && event.
|
|
793
|
+
if (this.shown && event.key === TAB_KEY) {
|
|
781
794
|
trapTabKey(this.$el, event);
|
|
782
795
|
}
|
|
783
796
|
};
|
|
@@ -904,16 +917,32 @@ var CONTAINER_ID = "__authsignal-popup-container";
|
|
|
904
917
|
var CONTENT_ID = "__authsignal-popup-content";
|
|
905
918
|
var OVERLAY_ID = "__authsignal-popup-overlay";
|
|
906
919
|
var STYLE_ID = "__authsignal-popup-style";
|
|
920
|
+
var DEFAULT_WIDTH = "576px";
|
|
921
|
+
var DEFAULT_HEIGHT = "600px";
|
|
907
922
|
var PopupHandler = /** @class */ (function () {
|
|
908
|
-
function PopupHandler() {
|
|
923
|
+
function PopupHandler(_a) {
|
|
924
|
+
var width = _a.width, height = _a.height;
|
|
909
925
|
this.popup = null;
|
|
910
926
|
if (document.querySelector("#".concat(CONTAINER_ID))) {
|
|
911
927
|
throw new Error("Multiple instances of Authsignal popup is not supported.");
|
|
912
928
|
}
|
|
913
|
-
this.create();
|
|
929
|
+
this.create({ width: width, height: height });
|
|
914
930
|
}
|
|
915
|
-
PopupHandler.prototype.create = function () {
|
|
931
|
+
PopupHandler.prototype.create = function (_a) {
|
|
916
932
|
var _this = this;
|
|
933
|
+
var _b = _a.width, width = _b === void 0 ? DEFAULT_WIDTH : _b, _c = _a.height, height = _c === void 0 ? DEFAULT_HEIGHT : _c;
|
|
934
|
+
var isWidthValidCSSValue = CSS.supports("width", width);
|
|
935
|
+
var isHeightValidCSSValue = CSS.supports("height", height);
|
|
936
|
+
var popupWidth = width;
|
|
937
|
+
var popupHeight = height;
|
|
938
|
+
if (!isWidthValidCSSValue) {
|
|
939
|
+
console.warn("Invalid CSS value for `popupOptions.width`. Using default value instead.");
|
|
940
|
+
popupWidth = DEFAULT_WIDTH;
|
|
941
|
+
}
|
|
942
|
+
if (!isHeightValidCSSValue) {
|
|
943
|
+
console.warn("Invalid CSS value for `popupOptions.height`. Using default value instead.");
|
|
944
|
+
popupHeight = DEFAULT_HEIGHT;
|
|
945
|
+
}
|
|
917
946
|
// Create dialog container
|
|
918
947
|
var container = document.createElement("div");
|
|
919
948
|
container.setAttribute("id", CONTAINER_ID);
|
|
@@ -929,7 +958,7 @@ var PopupHandler = /** @class */ (function () {
|
|
|
929
958
|
// Create CSS for dialog
|
|
930
959
|
var style = document.createElement("style");
|
|
931
960
|
style.setAttribute("id", STYLE_ID);
|
|
932
|
-
style.textContent = "\n #".concat(CONTAINER_ID, ",\n #").concat(OVERLAY_ID, " {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n }\n\n #").concat(CONTAINER_ID, " {\n z-index: 2147483647;\n display: flex;\n }\n\n #").concat(CONTAINER_ID, "[aria-hidden='true'] {\n display: none;\n }\n\n #").concat(OVERLAY_ID, " {\n background-color: rgba(43, 46, 56, 0.9);\n }\n\n #").concat(CONTENT_ID, " {\n margin: auto;\n z-index: 2147483647;\n position: relative;\n background-color: white;\n height:
|
|
961
|
+
style.textContent = "\n #".concat(CONTAINER_ID, ",\n #").concat(OVERLAY_ID, " {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n }\n\n #").concat(CONTAINER_ID, " {\n z-index: 2147483647;\n display: flex;\n }\n\n #").concat(CONTAINER_ID, "[aria-hidden='true'] {\n display: none;\n }\n\n #").concat(OVERLAY_ID, " {\n background-color: rgba(43, 46, 56, 0.9);\n }\n\n #").concat(CONTENT_ID, " {\n margin: auto;\n z-index: 2147483647;\n position: relative;\n background-color: white;\n height: ").concat(popupHeight, ";\n width: ").concat(popupWidth, ";\n border-radius: 8px;\n }\n\n #").concat(CONTENT_ID, " iframe {\n width: 100%;\n height: 100%;\n border-radius: inherit;\n }\n ");
|
|
933
962
|
// Attach the created elements
|
|
934
963
|
document.head.insertAdjacentElement("beforeend", style);
|
|
935
964
|
container.appendChild(overlay);
|
|
@@ -1009,13 +1038,13 @@ var Authsignal = /** @class */ (function () {
|
|
|
1009
1038
|
}
|
|
1010
1039
|
Authsignal.prototype.launch = function (url, options) {
|
|
1011
1040
|
var _this = this;
|
|
1012
|
-
|
|
1013
|
-
if (mode === "redirect") {
|
|
1041
|
+
if (!(options === null || options === void 0 ? void 0 : options.mode) || options.mode === "redirect") {
|
|
1014
1042
|
window.location.href = url;
|
|
1015
1043
|
}
|
|
1016
1044
|
else {
|
|
1045
|
+
var popupOptions = options.popupOptions;
|
|
1046
|
+
var Popup_1 = new PopupHandler({ width: popupOptions === null || popupOptions === void 0 ? void 0 : popupOptions.width, height: popupOptions === null || popupOptions === void 0 ? void 0 : popupOptions.height });
|
|
1017
1047
|
var popupUrl = "".concat(url, "&mode=popup");
|
|
1018
|
-
var Popup_1 = new PopupHandler();
|
|
1019
1048
|
Popup_1.show({ url: popupUrl });
|
|
1020
1049
|
return new Promise(function (resolve) {
|
|
1021
1050
|
var onMessage = function (event) {
|