@forgerock/javascript-sdk-ui
Advanced tools
Comparing version
@@ -1,1 +0,1 @@ | ||
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){"use strict";r.r(t),t.default=r.p+"fr-ui.css"}]); | ||
!function(){"use strict";var t={};t.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),function(){var r;t.g.importScripts&&(r=t.g.location+"");var e=t.g.document;if(!r&&e&&(e.currentScript&&(r=e.currentScript.src),!r)){var i=e.getElementsByTagName("script");i.length&&(r=i[i.length-1].src)}if(!r)throw new Error("Automatic publicPath is not supported in this browser");r=r.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),t.p=r}(),t.p}(); |
# Changelog | ||
## [Unreleased] | ||
### Added | ||
- Social Login support. | ||
### Fixed | ||
- Fixed build issue with Windows PowerShell | ||
### Breaking Changes | ||
- Removed `nonce` from export as it was removed from Core SDK | ||
- Upgraded to Twitter Bootstrap 5.0 and removed ForgeRock's UI Library | ||
- Markup for password and select components have changed; check your customizations for compatibility | ||
## [2.2.0] - 2020-12-18 | ||
@@ -4,0 +20,0 @@ |
@@ -6,3 +6,3 @@ /* | ||
* | ||
* Copyright (c) 2020 ForgeRock. All rights reserved. | ||
* Copyright (c) 2020-2021 ForgeRock. All rights reserved. | ||
* This software may be modified and distributed under the terms | ||
@@ -23,2 +23,3 @@ * of the MIT license. See the LICENSE file for details. | ||
import ReCaptchaCallbackRenderer from '../renderers/recaptcha'; | ||
import SelectIdPCallbackRenderer from '../renderers/select-idp'; | ||
import TermsAndConditionsCallbackRenderer from '../renderers/terms'; | ||
@@ -48,4 +49,4 @@ import TextOutputCallbackRenderer from '../renderers/text'; | ||
CallbackType.PollingWaitCallback, | ||
// TODO: Update when core SDK supports this callback type | ||
'RedirectCallback', | ||
CallbackType.RedirectCallback, | ||
CallbackType.SelectIdPCallback, | ||
]; | ||
@@ -124,7 +125,11 @@ /** | ||
return new DeviceProfileCallbackRenderer(cb, _this.onChange); | ||
case CallbackType.KbaCreateCallback: | ||
var kbaCreateCallback_1 = cb; | ||
var kbaIndex = _this.step | ||
.getCallbacksOfType(CallbackType.KbaCreateCallback) | ||
.filter(function (x) { return x.getPrompt() === kbaCreateCallback_1.getPrompt(); }) | ||
.indexOf(kbaCreateCallback_1); | ||
return new KbaCreateCallbackRenderer(kbaCreateCallback_1, index, kbaIndex, _this.onChange); | ||
case CallbackType.PasswordCallback: | ||
return new PasswordCallbackRenderer(cb, index, _this.onChange); | ||
case CallbackType.ValidatedCreatePasswordCallback: | ||
var passwordCallback = cb; | ||
return new PasswordCallbackRenderer(passwordCallback, index, _this.onChange); | ||
case CallbackType.PollingWaitCallback: | ||
@@ -134,2 +139,10 @@ return new PollingWaitCallbackRenderer(cb, index, _this.onChange); | ||
return new ReCaptchaCallbackRenderer(cb, index, _this.onChange); | ||
case CallbackType.SelectIdPCallback: | ||
/** | ||
* If either of the username collection callbacks are present, | ||
* we assume a local authentication form is present | ||
*/ | ||
var hasLocalAuthForm = !!_this.step.getCallbacksOfType(CallbackType.NameCallback).length || | ||
!!_this.step.getCallbacksOfType(CallbackType.ValidatedCreateUsernameCallback).length; | ||
return new SelectIdPCallbackRenderer(cb, index, _this.onChange, hasLocalAuthForm); | ||
case CallbackType.TermsAndConditionsCallback: | ||
@@ -140,9 +153,5 @@ var termsCallback = cb; | ||
return new TextOutputCallbackRenderer(cb, index, ((_a = _this.rendererOptions) === null || _a === void 0 ? void 0 : _a.dangerouslySetScriptText) || false); | ||
case CallbackType.KbaCreateCallback: | ||
var kbaCreateCallback_1 = cb; | ||
var kbaIndex = _this.step | ||
.getCallbacksOfType(CallbackType.KbaCreateCallback) | ||
.filter(function (x) { return x.getPrompt() === kbaCreateCallback_1.getPrompt(); }) | ||
.indexOf(kbaCreateCallback_1); | ||
return new KbaCreateCallbackRenderer(kbaCreateCallback_1, index, kbaIndex, _this.onChange); | ||
case CallbackType.ValidatedCreatePasswordCallback: | ||
var passwordCallback = cb; | ||
return new PasswordCallbackRenderer(passwordCallback, index, _this.onChange); | ||
default: | ||
@@ -152,9 +161,5 @@ return new GenericCallbackRenderer(cb, index, _this.onChange); | ||
}; | ||
// TODO: use `renderer` to identify what triggered the change | ||
this.onChange = function () { | ||
this.onChange = function (renderer) { | ||
var callbacks = _this.step.callbacks; | ||
// If any renderer has an invalid value (input value length of 0), this will be false | ||
var isValid = _this.isValid(); | ||
// Enables or disables button according to validity of renderer values | ||
_this.setSubmitButton(isValid); | ||
var rendererClassname = renderer === null || renderer === void 0 ? void 0 : renderer.constructor.name; | ||
var pollingWaitCb = callbacks.find(function (x) { return x.getType() === CallbackType.PollingWaitCallback; }); | ||
@@ -171,2 +176,42 @@ /** | ||
/** | ||
* A SelectIdPCallback with local authentication form is a special combo | ||
*/ | ||
var socialLoginWithLocal = function () { | ||
var hasSelectIdP = false; | ||
var hasLocalForm = false; | ||
callbacks.forEach(function (x) { | ||
switch (x.getType()) { | ||
case CallbackType.SelectIdPCallback: | ||
hasSelectIdP = true; | ||
break; | ||
case CallbackType.NameCallback: | ||
hasLocalForm = true; | ||
break; | ||
case CallbackType.ValidatedCreateUsernameCallback: | ||
hasLocalForm = true; | ||
break; | ||
default: | ||
// Intentionally left empty | ||
} | ||
}); | ||
return hasSelectIdP && hasLocalForm; | ||
}; | ||
if (socialLoginWithLocal() && rendererClassname !== 'SelectIdPCallbackRenderer') { | ||
/** | ||
* If Local Authentication form is combined with Social Login Providers, and | ||
* local inputs are used, this signals the use of the local auth, so set | ||
* localAuthentication as provider on the SelectIdPCallback before resolving | ||
*/ | ||
var selectIdPRenderer = _this.renderers.find(function (x) { | ||
return x.constructor.name === 'SelectIdPCallbackRenderer'; | ||
}); | ||
// eslint-disable-next-line | ||
// @ts-ignore | ||
selectIdPRenderer.onOtherInput('localAuthentication'); | ||
} | ||
// If any renderer has an invalid value (input value length of 0), this will be false | ||
var isValid = _this.isValid(); | ||
// Enables or disables button according to validity of renderer values | ||
_this.setSubmitButton(isValid); | ||
/** | ||
* If Polling Wait is "exitable", it will come with a confirmation callback | ||
@@ -185,2 +230,5 @@ * that has only one value. We don't want to block the autosubmission of | ||
} | ||
else if (rendererClassname === 'SelectIdPCallbackRenderer') { | ||
_this.resolve(); | ||
} | ||
}; | ||
@@ -205,3 +253,3 @@ this.requiresSubmitButton = function () { | ||
* If there's a single callback not needing a submit button, | ||
* return false. If there are no callbacks needing a submit | ||
* return false. If there are no callbacks NOT needing a submit | ||
* button, return true, which results in the rendering of a | ||
@@ -218,3 +266,5 @@ * submit button. | ||
button.innerText = 'Next'; | ||
button.addEventListener('click', _this.resolve); | ||
button.addEventListener('click', function () { | ||
_this.resolve(); | ||
}); | ||
return button; | ||
@@ -240,2 +290,3 @@ }; | ||
this.resolve = function () { | ||
// Continue with cleaning up and resolving step | ||
_this.renderers | ||
@@ -242,0 +293,0 @@ .filter(function (x) { return !!x.destroy; }) |
@@ -6,3 +6,3 @@ /* | ||
* | ||
* Copyright (c) 2020 ForgeRock. All rights reserved. | ||
* Copyright (c) 2020-2021 ForgeRock. All rights reserved. | ||
* This software may be modified and distributed under the terms | ||
@@ -9,0 +9,0 @@ * of the MIT license. See the LICENSE file for details. |
@@ -6,3 +6,3 @@ /* | ||
* | ||
* Copyright (c) 2020 ForgeRock. All rights reserved. | ||
* Copyright (c) 2020-2021 ForgeRock. All rights reserved. | ||
* This software may be modified and distributed under the terms | ||
@@ -43,14 +43,6 @@ * of the MIT license. See the LICENSE file for details. | ||
var defaultIndex = _this.callback.getInputValue(); | ||
var formGroup = el('div', "fr-callback-" + _this.index + " form-group"); | ||
var formGroup = el('div', "fr-callback-" + _this.index + " form-group mb-3"); | ||
var id = "fr-callback-" + _this.index; | ||
// Add the prompt | ||
var prompt = _this.callback.getPrompt(); | ||
if (prompt) { | ||
var label = el('label'); | ||
label.innerHTML = prompt; | ||
label.htmlFor = id; | ||
formGroup.appendChild(label); | ||
} | ||
// Add the dropdown | ||
_this.input = el('select', 'form-control'); | ||
_this.input = el('select', 'form-select'); | ||
_this.input.id = id; | ||
@@ -66,2 +58,11 @@ _this.input.addEventListener('change', _this.onInput); | ||
formGroup.appendChild(_this.input); | ||
// Add the prompt | ||
var prompt = _this.callback.getPrompt(); | ||
if (prompt) { | ||
formGroup.classList.add('form-floating'); | ||
var label = el('label'); | ||
label.innerHTML = prompt; | ||
label.htmlFor = id; | ||
formGroup.appendChild(label); | ||
} | ||
return formGroup; | ||
@@ -68,0 +69,0 @@ }; |
@@ -6,3 +6,3 @@ /* | ||
* | ||
* Copyright (c) 2020 ForgeRock. All rights reserved. | ||
* Copyright (c) 2020-2021 ForgeRock. All rights reserved. | ||
* This software may be modified and distributed under the terms | ||
@@ -44,4 +44,4 @@ * of the MIT license. See the LICENSE file for details. | ||
// Create basic structure | ||
var formGroup = el('div', "fr-callback-" + _this.index + " form-group"); | ||
var formLabelGroup = el('div', 'form-label-group'); | ||
var formGroup = el('div', "fr-callback-" + _this.index + " form-group mb-3"); | ||
var formLabelGroup = el('div', 'form-floating form-label-group'); | ||
formGroup.appendChild(formLabelGroup); | ||
@@ -48,0 +48,0 @@ // Add the input element |
@@ -6,12 +6,10 @@ /* | ||
* | ||
* Copyright (c) 2020 ForgeRock. All rights reserved. | ||
* Copyright (c) 2020-2021 ForgeRock. All rights reserved. | ||
* This software may be modified and distributed under the terms | ||
* of the MIT license. See the LICENSE file for details. | ||
*/ | ||
var __spreadArrays = (this && this.__spreadArrays) || function () { | ||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; | ||
for (var r = Array(s), k = 0, i = 0; i < il; i++) | ||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) | ||
r[k] = a[j]; | ||
return r; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
}; | ||
@@ -23,2 +21,3 @@ import { el } from '../../util/dom'; | ||
customLabel: 'Custom Question', | ||
questionLabel: 'Select Question', | ||
}; | ||
@@ -73,3 +72,3 @@ /** | ||
this.render = function () { | ||
var formGroup = el('div', "fr-callback-" + _this.index + " form-group"); | ||
var formGroup = el('div', "fr-callback-" + _this.index + " form-group mb-3"); | ||
// Only add the prompt to the first KBA question | ||
@@ -85,7 +84,8 @@ if (_this.kbaIndex === 0) { | ||
var isCustomQuestion = !predefinedQuestions.includes(questionText); | ||
var allOptions = __spreadArrays(predefinedQuestions, [TEXT.customLabel]); | ||
var allOptions = __spreadArray(__spreadArray([], predefinedQuestions), [TEXT.customLabel]); | ||
var selectedIndex = allOptions.indexOf(isCustomQuestion ? TEXT.customLabel : questionText); | ||
// Add the dropdown | ||
var selectWrap = el('div', 'mb-1'); | ||
_this.select = el('select', 'form-control custom-select'); | ||
var selectWrap = el('div', 'mb-1 form-floating'); | ||
_this.select = el('select', 'form-select'); | ||
_this.select.id = "fr-callback-" + _this.index + "-question"; | ||
_this.select.required = true; | ||
@@ -98,8 +98,13 @@ allOptions.forEach(function (x, i) { | ||
selectWrap.appendChild(_this.select); | ||
var selectLabel = el('label'); | ||
selectLabel.htmlFor = _this.select.id; | ||
selectLabel.innerHTML = TEXT.questionLabel; | ||
selectWrap.appendChild(selectLabel); | ||
formGroup.appendChild(selectWrap); | ||
// Create the "custom question" input | ||
_this.customWrap = el('div', 'form-label-group fr-kba-custom-wrap mb-1 d-none'); | ||
_this.customWrap = el('div', 'form-label-group form-floating fr-kba-custom-wrap mb-1 d-none'); | ||
_this.custom = el('input', 'form-control fr-kba-custom'); | ||
_this.custom.id = "fr-callback-" + _this.index + "-custom"; | ||
_this.custom.type = 'text'; | ||
_this.custom.placeholder = TEXT.customLabel; | ||
_this.custom.value = isCustomQuestion ? questionText : ''; | ||
@@ -114,3 +119,3 @@ _this.custom.addEventListener('keyup', _this.onInput); | ||
// Create an input for the answer | ||
var answerWrap = el('div', 'form-label-group mb-0'); | ||
var answerWrap = el('div', 'form-label-group form-floating mb-0'); | ||
_this.answer = el('input', 'form-control fr-kba-answer'); | ||
@@ -117,0 +122,0 @@ _this.answer.id = "fr-callback-" + _this.index + "-answer"; |
@@ -13,3 +13,2 @@ import { PasswordCallback, ValidatedCreatePasswordCallback } from '@forgerock/javascript-sdk'; | ||
private toggle; | ||
private toggleIcon; | ||
/** | ||
@@ -16,0 +15,0 @@ * @param callback The callback to render |
@@ -6,3 +6,3 @@ /* | ||
* | ||
* Copyright (c) 2020 ForgeRock. All rights reserved. | ||
* Copyright (c) 2020-2021 ForgeRock. All rights reserved. | ||
* This software may be modified and distributed under the terms | ||
@@ -48,14 +48,10 @@ * of the MIT license. See the LICENSE file for details. | ||
// Create the basic structure | ||
var formGroup = el('div', "fr-callback-" + _this.index + " form-group"); | ||
var formLabelGroup = el('div', 'form-label-group form-label-group-password'); | ||
var formLabelGroupInput = el('div', 'form-label-group-input'); | ||
var formInputGroupAppend = el('div', 'input-group-append'); | ||
formLabelGroup.appendChild(formLabelGroupInput); | ||
formLabelGroup.appendChild(formInputGroupAppend); | ||
var formGroup = el('div', "fr-callback-" + _this.index + " form-group mb-3"); | ||
var formLabelGroup = el('div', 'form-floating form-label-group input-group form-label-group-password'); | ||
formGroup.appendChild(formLabelGroup); | ||
// Add the input | ||
_this.input = el('input', 'form-control'); | ||
_this.input = el('input', 'form-control rounded-end input-password'); | ||
_this.input.id = "fr-callback-" + _this.index; | ||
_this.input.addEventListener('keyup', _this.onInput); | ||
formLabelGroupInput.appendChild(_this.input); | ||
formLabelGroup.appendChild(_this.input); | ||
// Add the prompt | ||
@@ -68,11 +64,10 @@ var prompt = _this.callback.getPrompt(); | ||
label.htmlFor = _this.input.id; | ||
formLabelGroupInput.appendChild(label); | ||
formLabelGroup.appendChild(label); | ||
} | ||
// Add the view/hide toggle | ||
_this.toggle = el('button', 'btn btn-outline-secondary'); | ||
_this.toggle = el('button', 'toggle-password'); | ||
_this.toggle.type = 'button'; | ||
_this.toggle.setAttribute('aria-label', 'Display password in plain text.'); | ||
_this.toggle.addEventListener('click', _this.toggleView); | ||
_this.toggleIcon = el('i', 'material-icons material-icons-outlined'); | ||
_this.toggle.appendChild(_this.toggleIcon); | ||
formInputGroupAppend.appendChild(_this.toggle); | ||
formLabelGroup.appendChild(_this.toggle); | ||
// Add policy errors | ||
@@ -88,3 +83,2 @@ var errorList = renderErrors(_this.callback.getFailedPolicies(), prompt); | ||
_this.input.type = showPassword ? 'text' : 'password'; | ||
_this.toggleIcon.innerHTML = showPassword ? 'visibility_off' : 'visibility'; | ||
}; | ||
@@ -91,0 +85,0 @@ this.toggleView = function () { |
@@ -39,3 +39,3 @@ /* | ||
this.render = function () { | ||
var formGroup = el('div', "fr-callback-" + _this.index + " form-group"); | ||
var formGroup = el('div', "fr-callback-" + _this.index + " form-group mb-3"); | ||
formGroup.appendChild(_this.container); | ||
@@ -42,0 +42,0 @@ return formGroup; |
@@ -6,3 +6,3 @@ /* | ||
* | ||
* Copyright (c) 2020 ForgeRock. All rights reserved. | ||
* Copyright (c) 2020-2021 ForgeRock. All rights reserved. | ||
* This software may be modified and distributed under the terms | ||
@@ -43,3 +43,3 @@ * of the MIT license. See the LICENSE file for details. | ||
this.render = function () { | ||
var formGroup = el('div', "fr-callback-" + _this.index + " form-group"); | ||
var formGroup = el('div', "fr-callback-" + _this.index + " form-group mb-3"); | ||
// Add the terms | ||
@@ -46,0 +46,0 @@ var p = el('p'); |
@@ -5,3 +5,2 @@ declare class PasswordInput { | ||
private toggler; | ||
private togglerIcon; | ||
constructor(input: HTMLInputElement); | ||
@@ -8,0 +7,0 @@ bind: () => void; |
@@ -6,3 +6,3 @@ /* | ||
* | ||
* Copyright (c) 2020 ForgeRock. All rights reserved. | ||
* Copyright (c) 2020-2021 ForgeRock. All rights reserved. | ||
* This software may be modified and distributed under the terms | ||
@@ -23,7 +23,5 @@ * of the MIT license. See the LICENSE file for details. | ||
_this.input.type = _this.input.type === 'text' ? 'password' : 'text'; | ||
_this.togglerIcon.innerText = _this.input.type === 'text' ? 'visibility' : 'visibility_off'; | ||
}; | ||
this.group = input.closest('.form-group'); | ||
this.toggler = this.group.querySelector('button'); | ||
this.togglerIcon = this.toggler.querySelector('i'); | ||
} | ||
@@ -30,0 +28,0 @@ return PasswordInput; |
@@ -18,2 +18,4 @@ /* | ||
return function (d, b) { | ||
if (typeof b !== "function" && b !== null) | ||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | ||
extendStatics(d, b); | ||
@@ -20,0 +22,0 @@ function __() { this.constructor = d; } |
@@ -18,2 +18,4 @@ /* | ||
return function (d, b) { | ||
if (typeof b !== "function" && b !== null) | ||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | ||
extendStatics(d, b); | ||
@@ -20,0 +22,0 @@ function __() { this.constructor = d; } |
@@ -18,2 +18,4 @@ /* | ||
return function (d, b) { | ||
if (typeof b !== "function" && b !== null) | ||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | ||
extendStatics(d, b); | ||
@@ -20,0 +22,0 @@ function __() { this.constructor = d; } |
@@ -18,2 +18,4 @@ /* | ||
return function (d, b) { | ||
if (typeof b !== "function" && b !== null) | ||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | ||
extendStatics(d, b); | ||
@@ -20,0 +22,0 @@ function __() { this.constructor = d; } |
@@ -18,2 +18,4 @@ /* | ||
return function (d, b) { | ||
if (typeof b !== "function" && b !== null) | ||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | ||
extendStatics(d, b); | ||
@@ -20,0 +22,0 @@ function __() { this.constructor = d; } |
@@ -18,2 +18,4 @@ /* | ||
return function (d, b) { | ||
if (typeof b !== "function" && b !== null) | ||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | ||
extendStatics(d, b); | ||
@@ -20,0 +22,0 @@ function __() { this.constructor = d; } |
@@ -18,2 +18,4 @@ /* | ||
return function (d, b) { | ||
if (typeof b !== "function" && b !== null) | ||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | ||
extendStatics(d, b); | ||
@@ -20,0 +22,0 @@ function __() { this.constructor = d; } |
@@ -18,2 +18,4 @@ /* | ||
return function (d, b) { | ||
if (typeof b !== "function" && b !== null) | ||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | ||
extendStatics(d, b); | ||
@@ -20,0 +22,0 @@ function __() { this.constructor = d; } |
import { Dispatcher } from '@forgerock/javascript-sdk'; | ||
import { ConfigOptions } from './index'; | ||
import { FREndStep, FRUIOptions } from './interfaces'; | ||
import { StringDict } from '@forgerock/javascript-sdk/lib/shared/interfaces'; | ||
interface StepOptions extends ConfigOptions { | ||
query: StringDict<string>; | ||
} | ||
/** | ||
@@ -26,3 +30,3 @@ * Orchestrates the flow through an authentication tree using `FRAuth`, generating | ||
*/ | ||
getSession: (options?: ConfigOptions | undefined) => Promise<FREndStep>; | ||
getSession: (options?: StepOptions | undefined) => Promise<FREndStep>; | ||
/** | ||
@@ -29,0 +33,0 @@ * Reserved for future use. Returns the current instance of FRUI for chaining. |
@@ -18,2 +18,4 @@ /* | ||
return function (d, b) { | ||
if (typeof b !== "function" && b !== null) | ||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | ||
extendStatics(d, b); | ||
@@ -60,3 +62,3 @@ function __() { this.constructor = d; } | ||
}; | ||
import { Dispatcher, ErrorCode, FRAuth, FRLoginFailure, StepType, } from '@forgerock/javascript-sdk'; | ||
import { CallbackType, Dispatcher, ErrorCode, FRAuth, FRLoginFailure, StepType, } from '@forgerock/javascript-sdk'; | ||
import basicStepHandlerFactory from './basic'; | ||
@@ -135,40 +137,51 @@ import { TARGET_ID } from './constants'; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var thisStep, _b, _c, rendererOptions, error_1, failure; | ||
var thisStep, _b, _c, redirectCallbacks, rendererOptions, error_1, failure; | ||
return __generator(this, function (_d) { | ||
switch (_d.label) { | ||
case 0: | ||
_d.trys.push([0, 11, , 12]); | ||
return [4 /*yield*/, FRAuth.next(previousStep, options)]; | ||
_d.trys.push([0, 14, , 15]); | ||
if (!(((options === null || options === void 0 ? void 0 : options.query.code) && (options === null || options === void 0 ? void 0 : options.query.state)) || (options === null || options === void 0 ? void 0 : options.query.form_post_entry))) return [3 /*break*/, 2]; | ||
return [4 /*yield*/, FRAuth.resume(window.location.href, options)]; | ||
case 1: | ||
thisStep = _d.sent(); | ||
return [3 /*break*/, 4]; | ||
case 2: return [4 /*yield*/, FRAuth.next(previousStep, options)]; | ||
case 3: | ||
thisStep = _d.sent(); | ||
_d.label = 4; | ||
case 4: | ||
this.dispatchEvent({ step: thisStep, type: FREventType.StepChange }); | ||
_b = thisStep.type; | ||
switch (_b) { | ||
case StepType.LoginSuccess: return [3 /*break*/, 2]; | ||
case StepType.LoginFailure: return [3 /*break*/, 3]; | ||
case StepType.LoginSuccess: return [3 /*break*/, 5]; | ||
case StepType.LoginFailure: return [3 /*break*/, 6]; | ||
} | ||
return [3 /*break*/, 8]; | ||
case 2: | ||
return [3 /*break*/, 11]; | ||
case 5: | ||
// Login successful | ||
return [2 /*return*/, thisStep]; | ||
case 3: | ||
if (!(previousStep && this.firstStepTimedOut(thisStep))) return [3 /*break*/, 5]; | ||
case 6: | ||
if (!(previousStep && this.firstStepTimedOut(thisStep))) return [3 /*break*/, 8]; | ||
_c = previousStep.payload; | ||
return [4 /*yield*/, this.getNewFirstAuthId()]; | ||
case 4: | ||
case 7: | ||
_c.authId = _d.sent(); | ||
return [2 /*return*/, this.nextStep(previousStep)]; | ||
case 5: | ||
if (!(this.handler && this.handler.retry)) return [3 /*break*/, 7]; | ||
case 8: | ||
if (!(this.handler && this.handler.retry)) return [3 /*break*/, 10]; | ||
return [4 /*yield*/, this.handler.retry()]; | ||
case 6: | ||
case 9: | ||
previousStep = _d.sent(); | ||
return [2 /*return*/, this.nextStep(previousStep)]; | ||
case 7: | ||
case 10: | ||
// Login failed | ||
return [2 /*return*/, thisStep]; | ||
case 8: | ||
case 11: | ||
if (previousStep) { | ||
this.successfulStages.push(previousStep); | ||
} | ||
redirectCallbacks = thisStep.getCallbacksOfType(CallbackType.RedirectCallback); | ||
if (redirectCallbacks.length > 0) { | ||
return [2 /*return*/, FRAuth.redirect(thisStep)]; | ||
} | ||
// Get a handler for this step and use it to complete the step | ||
@@ -184,8 +197,8 @@ if (!this.options.handlerFactory) { | ||
return [4 /*yield*/, this.handler.completeStep()]; | ||
case 9: | ||
case 12: | ||
thisStep = _d.sent(); | ||
// Keep going to the next step | ||
return [2 /*return*/, this.nextStep(thisStep)]; | ||
case 10: return [3 /*break*/, 12]; | ||
case 11: | ||
case 13: return [3 /*break*/, 15]; | ||
case 14: | ||
error_1 = _d.sent(); | ||
@@ -200,3 +213,3 @@ this.dispatchEvent({ step: previousStep, type: FREventType.StepError, error: error_1 }); | ||
return [2 /*return*/, failure]; | ||
case 12: return [2 /*return*/]; | ||
case 15: return [2 /*return*/]; | ||
} | ||
@@ -203,0 +216,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
import { AttributeInputCallback, Auth, AuthResponse, Callback, CallbackContainer, CallbackType, ChoiceCallback, Config, ConfigOptions, ConfirmationCallback, defaultMessageCreator, DeviceProfileCallback, Deferred, Dispatcher, ErrorCode, FailureDetail, FRAuth, FRCallback, FRCallbackFactory, FRDevice, FRLoginFailure, FRLoginSuccess, FRPolicy, FRRecoveryCodes, FRStep, FRStepHandler, FRUser, FRWebAuthn, GetAuthorizationUrlOptions, GetOAuth2TokensOptions, GetTokensOptions, HiddenValueCallback, HttpClient, KbaCreateCallback, Listener, LocalStorage, MessageCreator, MetadataCallback, NameCallback, NameValue, nonce, OAuth2Client, OAuth2Tokens, PasswordCallback, PKCE, PolicyKey, PolicyRequirement, PollingWaitCallback, ProcessedPropertyError, ReCaptchaCallback, RelyingParty, ResponseType, SessionManager, Step, StepDetail, StepType, SuspendedTextOutputCallback, TermsAndConditionsCallback, TextOutputCallback, TokenManager, Tokens, TokenStorage, UserManager, ValidatedCreatePasswordCallback, ValidatedCreateUsernameCallback, ValidConfigOptions, WebAuthnAuthenticationMetadata, WebAuthnCallbacks, WebAuthnOutcome, WebAuthnRegistrationMetadata, WebAuthnStepType } from '@forgerock/javascript-sdk'; | ||
import { AttributeInputCallback, Auth, AuthResponse, Callback, CallbackContainer, CallbackType, ChoiceCallback, Config, ConfigOptions, ConfirmationCallback, defaultMessageCreator, DeviceProfileCallback, Deferred, Dispatcher, ErrorCode, FailureDetail, FRAuth, FRCallback, FRCallbackFactory, FRDevice, FRLoginFailure, FRLoginSuccess, FRPolicy, FRRecoveryCodes, FRStep, FRStepHandler, FRUser, FRWebAuthn, GetAuthorizationUrlOptions, GetOAuth2TokensOptions, GetTokensOptions, HiddenValueCallback, HttpClient, KbaCreateCallback, Listener, LocalStorage, MessageCreator, MetadataCallback, NameCallback, NameValue, OAuth2Client, OAuth2Tokens, PasswordCallback, PKCE, PolicyKey, PolicyRequirement, PollingWaitCallback, ProcessedPropertyError, ReCaptchaCallback, RelyingParty, ResponseType, SessionManager, Step, StepDetail, StepType, SuspendedTextOutputCallback, TermsAndConditionsCallback, TextOutputCallback, TokenManager, Tokens, TokenStorage, UserManager, ValidatedCreatePasswordCallback, ValidatedCreateUsernameCallback, ValidConfigOptions, WebAuthnAuthenticationMetadata, WebAuthnCallbacks, WebAuthnOutcome, WebAuthnRegistrationMetadata, WebAuthnStepType } from '@forgerock/javascript-sdk'; | ||
import basicStepHandlerFactory, { BasicStepHandler } from './basic'; | ||
@@ -17,2 +17,2 @@ import { CallbackRenderer } from './basic/interfaces'; | ||
import { FRAnyStep, FREndStep, FREvent, FRUIStepHandler, FRUIStepHandlerFactory, StepChangeEvent } from './interfaces'; | ||
export { basicStepHandlerFactory, defaultMessageCreator, expressStepHandlerFactory, AttributeInputCallback, Auth, AuthResponse, BasicStepHandler, BooleanAttributeCallbackRenderer, Callback, CallbackContainer, CallbackRenderer, CallbackType, ChoiceCallback, ChoiceCallbackRenderer, Config, ConfigOptions, ConfirmationCallback, ConfirmationCallbackRenderer, DeviceProfileCallback, Deferred, Dispatcher, ErrorCode, FailureDetail, FRAnyStep, FRAuth, FRCallback, FRCallbackFactory, FRDevice, FREndStep, FREvent, FRLoginFailure, FRLoginSuccess, FRPolicy, FRRecoveryCodes, FRStep, FRStepHandler, FRStepHandlerBase, FRUI, FRUIOptions, FRUIStepHandler, FRUIStepHandlerFactory, FRUser, FRWebAuthn, GenericCallbackRenderer, GetAuthorizationUrlOptions, GetOAuth2TokensOptions, GetTokensOptions, HiddenValueCallback, HttpClient, KbaCreateCallback, KbaCreateCallbackRenderer, Listener, LocalStorage, MessageCreator, MetadataCallback, NameCallback, NameValue, nonce, OAuth2Client, OAuth2Tokens, PasswordCallback, PasswordCallbackRenderer, PKCE, PolicyKey, PolicyRequirement, PollingWaitCallback, PollingWaitCallbackRenderer, ProcessedPropertyError, ReCaptchaCallback, ReCaptchaCallbackRenderer, RelyingParty, ResponseType, SessionManager, Step, StepChangeEvent, StepDetail, StepType, SuspendedTextOutputCallback, TermsAndConditionsCallback, TermsAndConditionsCallbackRenderer, TextOutputCallback, TokenManager, Tokens, TokenStorage, UserManager, ValidatedCreatePasswordCallback, ValidatedCreateUsernameCallback, ValidConfigOptions, WebAuthnAuthenticationMetadata, WebAuthnCallbacks, WebAuthnOutcome, WebAuthnRegistrationMetadata, WebAuthnStepType, }; | ||
export { basicStepHandlerFactory, defaultMessageCreator, expressStepHandlerFactory, AttributeInputCallback, Auth, AuthResponse, BasicStepHandler, BooleanAttributeCallbackRenderer, Callback, CallbackContainer, CallbackRenderer, CallbackType, ChoiceCallback, ChoiceCallbackRenderer, Config, ConfigOptions, ConfirmationCallback, ConfirmationCallbackRenderer, DeviceProfileCallback, Deferred, Dispatcher, ErrorCode, FailureDetail, FRAnyStep, FRAuth, FRCallback, FRCallbackFactory, FRDevice, FREndStep, FREvent, FRLoginFailure, FRLoginSuccess, FRPolicy, FRRecoveryCodes, FRStep, FRStepHandler, FRStepHandlerBase, FRUI, FRUIOptions, FRUIStepHandler, FRUIStepHandlerFactory, FRUser, FRWebAuthn, GenericCallbackRenderer, GetAuthorizationUrlOptions, GetOAuth2TokensOptions, GetTokensOptions, HiddenValueCallback, HttpClient, KbaCreateCallback, KbaCreateCallbackRenderer, Listener, LocalStorage, MessageCreator, MetadataCallback, NameCallback, NameValue, OAuth2Client, OAuth2Tokens, PasswordCallback, PasswordCallbackRenderer, PKCE, PolicyKey, PolicyRequirement, PollingWaitCallback, PollingWaitCallbackRenderer, ProcessedPropertyError, ReCaptchaCallback, ReCaptchaCallbackRenderer, RelyingParty, ResponseType, SessionManager, Step, StepChangeEvent, StepDetail, StepType, SuspendedTextOutputCallback, TermsAndConditionsCallback, TermsAndConditionsCallbackRenderer, TextOutputCallback, TokenManager, Tokens, TokenStorage, UserManager, ValidatedCreatePasswordCallback, ValidatedCreateUsernameCallback, ValidConfigOptions, WebAuthnAuthenticationMetadata, WebAuthnCallbacks, WebAuthnOutcome, WebAuthnRegistrationMetadata, WebAuthnStepType, }; |
@@ -10,3 +10,3 @@ /* | ||
*/ | ||
import { AttributeInputCallback, Auth, CallbackType, ChoiceCallback, Config, ConfirmationCallback, defaultMessageCreator, DeviceProfileCallback, Deferred, Dispatcher, ErrorCode, FRAuth, FRCallback, FRDevice, FRLoginFailure, FRLoginSuccess, FRPolicy, FRRecoveryCodes, FRStep, FRUser, FRWebAuthn, HiddenValueCallback, HttpClient, KbaCreateCallback, LocalStorage, MetadataCallback, NameCallback, nonce, OAuth2Client, PasswordCallback, PKCE, PolicyKey, PollingWaitCallback, ReCaptchaCallback, ResponseType, SessionManager, StepType, SuspendedTextOutputCallback, TermsAndConditionsCallback, TextOutputCallback, TokenManager, TokenStorage, UserManager, ValidatedCreatePasswordCallback, ValidatedCreateUsernameCallback, WebAuthnOutcome, WebAuthnStepType, } from '@forgerock/javascript-sdk'; | ||
import { AttributeInputCallback, Auth, CallbackType, ChoiceCallback, Config, ConfirmationCallback, defaultMessageCreator, DeviceProfileCallback, Deferred, Dispatcher, ErrorCode, FRAuth, FRCallback, FRDevice, FRLoginFailure, FRLoginSuccess, FRPolicy, FRRecoveryCodes, FRStep, FRUser, FRWebAuthn, HiddenValueCallback, HttpClient, KbaCreateCallback, LocalStorage, MetadataCallback, NameCallback, OAuth2Client, PasswordCallback, PKCE, PolicyKey, PollingWaitCallback, ReCaptchaCallback, ResponseType, SessionManager, StepType, SuspendedTextOutputCallback, TermsAndConditionsCallback, TextOutputCallback, TokenManager, TokenStorage, UserManager, ValidatedCreatePasswordCallback, ValidatedCreateUsernameCallback, WebAuthnOutcome, WebAuthnStepType, } from '@forgerock/javascript-sdk'; | ||
import basicStepHandlerFactory, { BasicStepHandler } from './basic'; | ||
@@ -25,3 +25,3 @@ import BooleanAttributeCallbackRenderer from './basic/renderers/boolean'; | ||
import FRUI from './fr-ui'; | ||
export { basicStepHandlerFactory, defaultMessageCreator, expressStepHandlerFactory, AttributeInputCallback, Auth, BasicStepHandler, BooleanAttributeCallbackRenderer, CallbackType, ChoiceCallback, ChoiceCallbackRenderer, Config, ConfirmationCallback, ConfirmationCallbackRenderer, DeviceProfileCallback, Deferred, Dispatcher, ErrorCode, FRAuth, FRCallback, FRDevice, FRLoginFailure, FRLoginSuccess, FRPolicy, FRRecoveryCodes, FRStep, FRStepHandlerBase, FRUI, FRUser, FRWebAuthn, GenericCallbackRenderer, HiddenValueCallback, HttpClient, KbaCreateCallback, KbaCreateCallbackRenderer, LocalStorage, MetadataCallback, NameCallback, nonce, OAuth2Client, PasswordCallback, PasswordCallbackRenderer, PKCE, PolicyKey, PollingWaitCallback, PollingWaitCallbackRenderer, ReCaptchaCallback, ReCaptchaCallbackRenderer, ResponseType, SessionManager, StepType, SuspendedTextOutputCallback, TermsAndConditionsCallback, TermsAndConditionsCallbackRenderer, TextOutputCallback, TokenManager, TokenStorage, UserManager, ValidatedCreatePasswordCallback, ValidatedCreateUsernameCallback, WebAuthnOutcome, WebAuthnStepType, }; | ||
export { basicStepHandlerFactory, defaultMessageCreator, expressStepHandlerFactory, AttributeInputCallback, Auth, BasicStepHandler, BooleanAttributeCallbackRenderer, CallbackType, ChoiceCallback, ChoiceCallbackRenderer, Config, ConfirmationCallback, ConfirmationCallbackRenderer, DeviceProfileCallback, Deferred, Dispatcher, ErrorCode, FRAuth, FRCallback, FRDevice, FRLoginFailure, FRLoginSuccess, FRPolicy, FRRecoveryCodes, FRStep, FRStepHandlerBase, FRUI, FRUser, FRWebAuthn, GenericCallbackRenderer, HiddenValueCallback, HttpClient, KbaCreateCallback, KbaCreateCallbackRenderer, LocalStorage, MetadataCallback, NameCallback, OAuth2Client, PasswordCallback, PasswordCallbackRenderer, PKCE, PolicyKey, PollingWaitCallback, PollingWaitCallbackRenderer, ReCaptchaCallback, ReCaptchaCallbackRenderer, ResponseType, SessionManager, StepType, SuspendedTextOutputCallback, TermsAndConditionsCallback, TermsAndConditionsCallbackRenderer, TextOutputCallback, TokenManager, TokenStorage, UserManager, ValidatedCreatePasswordCallback, ValidatedCreateUsernameCallback, WebAuthnOutcome, WebAuthnStepType, }; | ||
//# sourceMappingURL=index.js.map |
@@ -7,3 +7,3 @@ import { FRLoginFailure, FRLoginSuccess, FRStep } from '@forgerock/javascript-sdk'; | ||
*/ | ||
declare type FREndStep = FRLoginSuccess | FRLoginFailure; | ||
declare type FREndStep = FRLoginSuccess | FRLoginFailure | void; | ||
/** | ||
@@ -10,0 +10,0 @@ * Represents any step type of authentication, including the final step type. |
@@ -7,3 +7,3 @@ "use strict"; | ||
* | ||
* Copyright (c) 2020 ForgeRock. All rights reserved. | ||
* Copyright (c) 2020-2021 ForgeRock. All rights reserved. | ||
* This software may be modified and distributed under the terms | ||
@@ -28,2 +28,3 @@ * of the MIT license. See the LICENSE file for details. | ||
var recaptcha_1 = __importDefault(require("../renderers/recaptcha")); | ||
var select_idp_1 = __importDefault(require("../renderers/select-idp")); | ||
var terms_1 = __importDefault(require("../renderers/terms")); | ||
@@ -53,4 +54,4 @@ var text_1 = __importDefault(require("../renderers/text")); | ||
javascript_sdk_1.CallbackType.PollingWaitCallback, | ||
// TODO: Update when core SDK supports this callback type | ||
'RedirectCallback', | ||
javascript_sdk_1.CallbackType.RedirectCallback, | ||
javascript_sdk_1.CallbackType.SelectIdPCallback, | ||
]; | ||
@@ -129,7 +130,11 @@ /** | ||
return new device_profile_1.default(cb, _this.onChange); | ||
case javascript_sdk_1.CallbackType.KbaCreateCallback: | ||
var kbaCreateCallback_1 = cb; | ||
var kbaIndex = _this.step | ||
.getCallbacksOfType(javascript_sdk_1.CallbackType.KbaCreateCallback) | ||
.filter(function (x) { return x.getPrompt() === kbaCreateCallback_1.getPrompt(); }) | ||
.indexOf(kbaCreateCallback_1); | ||
return new kba_create_1.default(kbaCreateCallback_1, index, kbaIndex, _this.onChange); | ||
case javascript_sdk_1.CallbackType.PasswordCallback: | ||
return new password_1.default(cb, index, _this.onChange); | ||
case javascript_sdk_1.CallbackType.ValidatedCreatePasswordCallback: | ||
var passwordCallback = cb; | ||
return new password_1.default(passwordCallback, index, _this.onChange); | ||
case javascript_sdk_1.CallbackType.PollingWaitCallback: | ||
@@ -139,2 +144,10 @@ return new polling_wait_1.default(cb, index, _this.onChange); | ||
return new recaptcha_1.default(cb, index, _this.onChange); | ||
case javascript_sdk_1.CallbackType.SelectIdPCallback: | ||
/** | ||
* If either of the username collection callbacks are present, | ||
* we assume a local authentication form is present | ||
*/ | ||
var hasLocalAuthForm = !!_this.step.getCallbacksOfType(javascript_sdk_1.CallbackType.NameCallback).length || | ||
!!_this.step.getCallbacksOfType(javascript_sdk_1.CallbackType.ValidatedCreateUsernameCallback).length; | ||
return new select_idp_1.default(cb, index, _this.onChange, hasLocalAuthForm); | ||
case javascript_sdk_1.CallbackType.TermsAndConditionsCallback: | ||
@@ -145,9 +158,5 @@ var termsCallback = cb; | ||
return new text_1.default(cb, index, ((_a = _this.rendererOptions) === null || _a === void 0 ? void 0 : _a.dangerouslySetScriptText) || false); | ||
case javascript_sdk_1.CallbackType.KbaCreateCallback: | ||
var kbaCreateCallback_1 = cb; | ||
var kbaIndex = _this.step | ||
.getCallbacksOfType(javascript_sdk_1.CallbackType.KbaCreateCallback) | ||
.filter(function (x) { return x.getPrompt() === kbaCreateCallback_1.getPrompt(); }) | ||
.indexOf(kbaCreateCallback_1); | ||
return new kba_create_1.default(kbaCreateCallback_1, index, kbaIndex, _this.onChange); | ||
case javascript_sdk_1.CallbackType.ValidatedCreatePasswordCallback: | ||
var passwordCallback = cb; | ||
return new password_1.default(passwordCallback, index, _this.onChange); | ||
default: | ||
@@ -157,9 +166,5 @@ return new generic_1.default(cb, index, _this.onChange); | ||
}; | ||
// TODO: use `renderer` to identify what triggered the change | ||
this.onChange = function () { | ||
this.onChange = function (renderer) { | ||
var callbacks = _this.step.callbacks; | ||
// If any renderer has an invalid value (input value length of 0), this will be false | ||
var isValid = _this.isValid(); | ||
// Enables or disables button according to validity of renderer values | ||
_this.setSubmitButton(isValid); | ||
var rendererClassname = renderer === null || renderer === void 0 ? void 0 : renderer.constructor.name; | ||
var pollingWaitCb = callbacks.find(function (x) { return x.getType() === javascript_sdk_1.CallbackType.PollingWaitCallback; }); | ||
@@ -176,2 +181,42 @@ /** | ||
/** | ||
* A SelectIdPCallback with local authentication form is a special combo | ||
*/ | ||
var socialLoginWithLocal = function () { | ||
var hasSelectIdP = false; | ||
var hasLocalForm = false; | ||
callbacks.forEach(function (x) { | ||
switch (x.getType()) { | ||
case javascript_sdk_1.CallbackType.SelectIdPCallback: | ||
hasSelectIdP = true; | ||
break; | ||
case javascript_sdk_1.CallbackType.NameCallback: | ||
hasLocalForm = true; | ||
break; | ||
case javascript_sdk_1.CallbackType.ValidatedCreateUsernameCallback: | ||
hasLocalForm = true; | ||
break; | ||
default: | ||
// Intentionally left empty | ||
} | ||
}); | ||
return hasSelectIdP && hasLocalForm; | ||
}; | ||
if (socialLoginWithLocal() && rendererClassname !== 'SelectIdPCallbackRenderer') { | ||
/** | ||
* If Local Authentication form is combined with Social Login Providers, and | ||
* local inputs are used, this signals the use of the local auth, so set | ||
* localAuthentication as provider on the SelectIdPCallback before resolving | ||
*/ | ||
var selectIdPRenderer = _this.renderers.find(function (x) { | ||
return x.constructor.name === 'SelectIdPCallbackRenderer'; | ||
}); | ||
// eslint-disable-next-line | ||
// @ts-ignore | ||
selectIdPRenderer.onOtherInput('localAuthentication'); | ||
} | ||
// If any renderer has an invalid value (input value length of 0), this will be false | ||
var isValid = _this.isValid(); | ||
// Enables or disables button according to validity of renderer values | ||
_this.setSubmitButton(isValid); | ||
/** | ||
* If Polling Wait is "exitable", it will come with a confirmation callback | ||
@@ -190,2 +235,5 @@ * that has only one value. We don't want to block the autosubmission of | ||
} | ||
else if (rendererClassname === 'SelectIdPCallbackRenderer') { | ||
_this.resolve(); | ||
} | ||
}; | ||
@@ -210,3 +258,3 @@ this.requiresSubmitButton = function () { | ||
* If there's a single callback not needing a submit button, | ||
* return false. If there are no callbacks needing a submit | ||
* return false. If there are no callbacks NOT needing a submit | ||
* button, return true, which results in the rendering of a | ||
@@ -223,3 +271,5 @@ * submit button. | ||
button.innerText = 'Next'; | ||
button.addEventListener('click', _this.resolve); | ||
button.addEventListener('click', function () { | ||
_this.resolve(); | ||
}); | ||
return button; | ||
@@ -245,2 +295,3 @@ }; | ||
this.resolve = function () { | ||
// Continue with cleaning up and resolving step | ||
_this.renderers | ||
@@ -247,0 +298,0 @@ .filter(function (x) { return !!x.destroy; }) |
@@ -7,3 +7,3 @@ "use strict"; | ||
* | ||
* Copyright (c) 2020 ForgeRock. All rights reserved. | ||
* Copyright (c) 2020-2021 ForgeRock. All rights reserved. | ||
* This software may be modified and distributed under the terms | ||
@@ -10,0 +10,0 @@ * of the MIT license. See the LICENSE file for details. |
@@ -7,3 +7,3 @@ "use strict"; | ||
* | ||
* Copyright (c) 2020 ForgeRock. All rights reserved. | ||
* Copyright (c) 2020-2021 ForgeRock. All rights reserved. | ||
* This software may be modified and distributed under the terms | ||
@@ -45,14 +45,6 @@ * of the MIT license. See the LICENSE file for details. | ||
var defaultIndex = _this.callback.getInputValue(); | ||
var formGroup = dom_1.el('div', "fr-callback-" + _this.index + " form-group"); | ||
var formGroup = dom_1.el('div', "fr-callback-" + _this.index + " form-group mb-3"); | ||
var id = "fr-callback-" + _this.index; | ||
// Add the prompt | ||
var prompt = _this.callback.getPrompt(); | ||
if (prompt) { | ||
var label = dom_1.el('label'); | ||
label.innerHTML = prompt; | ||
label.htmlFor = id; | ||
formGroup.appendChild(label); | ||
} | ||
// Add the dropdown | ||
_this.input = dom_1.el('select', 'form-control'); | ||
_this.input = dom_1.el('select', 'form-select'); | ||
_this.input.id = id; | ||
@@ -68,2 +60,11 @@ _this.input.addEventListener('change', _this.onInput); | ||
formGroup.appendChild(_this.input); | ||
// Add the prompt | ||
var prompt = _this.callback.getPrompt(); | ||
if (prompt) { | ||
formGroup.classList.add('form-floating'); | ||
var label = dom_1.el('label'); | ||
label.innerHTML = prompt; | ||
label.htmlFor = id; | ||
formGroup.appendChild(label); | ||
} | ||
return formGroup; | ||
@@ -70,0 +71,0 @@ }; |
@@ -7,3 +7,3 @@ "use strict"; | ||
* | ||
* Copyright (c) 2020 ForgeRock. All rights reserved. | ||
* Copyright (c) 2020-2021 ForgeRock. All rights reserved. | ||
* This software may be modified and distributed under the terms | ||
@@ -46,4 +46,4 @@ * of the MIT license. See the LICENSE file for details. | ||
// Create basic structure | ||
var formGroup = dom_1.el('div', "fr-callback-" + _this.index + " form-group"); | ||
var formLabelGroup = dom_1.el('div', 'form-label-group'); | ||
var formGroup = dom_1.el('div', "fr-callback-" + _this.index + " form-group mb-3"); | ||
var formLabelGroup = dom_1.el('div', 'form-floating form-label-group'); | ||
formGroup.appendChild(formLabelGroup); | ||
@@ -50,0 +50,0 @@ // Add the input element |
@@ -7,12 +7,10 @@ "use strict"; | ||
* | ||
* Copyright (c) 2020 ForgeRock. All rights reserved. | ||
* Copyright (c) 2020-2021 ForgeRock. All rights reserved. | ||
* This software may be modified and distributed under the terms | ||
* of the MIT license. See the LICENSE file for details. | ||
*/ | ||
var __spreadArrays = (this && this.__spreadArrays) || function () { | ||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; | ||
for (var r = Array(s), k = 0, i = 0; i < il; i++) | ||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) | ||
r[k] = a[j]; | ||
return r; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
}; | ||
@@ -25,2 +23,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
customLabel: 'Custom Question', | ||
questionLabel: 'Select Question', | ||
}; | ||
@@ -75,3 +74,3 @@ /** | ||
this.render = function () { | ||
var formGroup = dom_1.el('div', "fr-callback-" + _this.index + " form-group"); | ||
var formGroup = dom_1.el('div', "fr-callback-" + _this.index + " form-group mb-3"); | ||
// Only add the prompt to the first KBA question | ||
@@ -87,7 +86,8 @@ if (_this.kbaIndex === 0) { | ||
var isCustomQuestion = !predefinedQuestions.includes(questionText); | ||
var allOptions = __spreadArrays(predefinedQuestions, [TEXT.customLabel]); | ||
var allOptions = __spreadArray(__spreadArray([], predefinedQuestions), [TEXT.customLabel]); | ||
var selectedIndex = allOptions.indexOf(isCustomQuestion ? TEXT.customLabel : questionText); | ||
// Add the dropdown | ||
var selectWrap = dom_1.el('div', 'mb-1'); | ||
_this.select = dom_1.el('select', 'form-control custom-select'); | ||
var selectWrap = dom_1.el('div', 'mb-1 form-floating'); | ||
_this.select = dom_1.el('select', 'form-select'); | ||
_this.select.id = "fr-callback-" + _this.index + "-question"; | ||
_this.select.required = true; | ||
@@ -100,8 +100,13 @@ allOptions.forEach(function (x, i) { | ||
selectWrap.appendChild(_this.select); | ||
var selectLabel = dom_1.el('label'); | ||
selectLabel.htmlFor = _this.select.id; | ||
selectLabel.innerHTML = TEXT.questionLabel; | ||
selectWrap.appendChild(selectLabel); | ||
formGroup.appendChild(selectWrap); | ||
// Create the "custom question" input | ||
_this.customWrap = dom_1.el('div', 'form-label-group fr-kba-custom-wrap mb-1 d-none'); | ||
_this.customWrap = dom_1.el('div', 'form-label-group form-floating fr-kba-custom-wrap mb-1 d-none'); | ||
_this.custom = dom_1.el('input', 'form-control fr-kba-custom'); | ||
_this.custom.id = "fr-callback-" + _this.index + "-custom"; | ||
_this.custom.type = 'text'; | ||
_this.custom.placeholder = TEXT.customLabel; | ||
_this.custom.value = isCustomQuestion ? questionText : ''; | ||
@@ -116,3 +121,3 @@ _this.custom.addEventListener('keyup', _this.onInput); | ||
// Create an input for the answer | ||
var answerWrap = dom_1.el('div', 'form-label-group mb-0'); | ||
var answerWrap = dom_1.el('div', 'form-label-group form-floating mb-0'); | ||
_this.answer = dom_1.el('input', 'form-control fr-kba-answer'); | ||
@@ -119,0 +124,0 @@ _this.answer.id = "fr-callback-" + _this.index + "-answer"; |
@@ -13,3 +13,2 @@ import { PasswordCallback, ValidatedCreatePasswordCallback } from '@forgerock/javascript-sdk'; | ||
private toggle; | ||
private toggleIcon; | ||
/** | ||
@@ -16,0 +15,0 @@ * @param callback The callback to render |
@@ -7,3 +7,3 @@ "use strict"; | ||
* | ||
* Copyright (c) 2020 ForgeRock. All rights reserved. | ||
* Copyright (c) 2020-2021 ForgeRock. All rights reserved. | ||
* This software may be modified and distributed under the terms | ||
@@ -50,14 +50,10 @@ * of the MIT license. See the LICENSE file for details. | ||
// Create the basic structure | ||
var formGroup = dom_1.el('div', "fr-callback-" + _this.index + " form-group"); | ||
var formLabelGroup = dom_1.el('div', 'form-label-group form-label-group-password'); | ||
var formLabelGroupInput = dom_1.el('div', 'form-label-group-input'); | ||
var formInputGroupAppend = dom_1.el('div', 'input-group-append'); | ||
formLabelGroup.appendChild(formLabelGroupInput); | ||
formLabelGroup.appendChild(formInputGroupAppend); | ||
var formGroup = dom_1.el('div', "fr-callback-" + _this.index + " form-group mb-3"); | ||
var formLabelGroup = dom_1.el('div', 'form-floating form-label-group input-group form-label-group-password'); | ||
formGroup.appendChild(formLabelGroup); | ||
// Add the input | ||
_this.input = dom_1.el('input', 'form-control'); | ||
_this.input = dom_1.el('input', 'form-control rounded-end input-password'); | ||
_this.input.id = "fr-callback-" + _this.index; | ||
_this.input.addEventListener('keyup', _this.onInput); | ||
formLabelGroupInput.appendChild(_this.input); | ||
formLabelGroup.appendChild(_this.input); | ||
// Add the prompt | ||
@@ -70,11 +66,10 @@ var prompt = _this.callback.getPrompt(); | ||
label.htmlFor = _this.input.id; | ||
formLabelGroupInput.appendChild(label); | ||
formLabelGroup.appendChild(label); | ||
} | ||
// Add the view/hide toggle | ||
_this.toggle = dom_1.el('button', 'btn btn-outline-secondary'); | ||
_this.toggle = dom_1.el('button', 'toggle-password'); | ||
_this.toggle.type = 'button'; | ||
_this.toggle.setAttribute('aria-label', 'Display password in plain text.'); | ||
_this.toggle.addEventListener('click', _this.toggleView); | ||
_this.toggleIcon = dom_1.el('i', 'material-icons material-icons-outlined'); | ||
_this.toggle.appendChild(_this.toggleIcon); | ||
formInputGroupAppend.appendChild(_this.toggle); | ||
formLabelGroup.appendChild(_this.toggle); | ||
// Add policy errors | ||
@@ -90,3 +85,2 @@ var errorList = errors_1.renderErrors(_this.callback.getFailedPolicies(), prompt); | ||
_this.input.type = showPassword ? 'text' : 'password'; | ||
_this.toggleIcon.innerHTML = showPassword ? 'visibility_off' : 'visibility'; | ||
}; | ||
@@ -93,0 +87,0 @@ this.toggleView = function () { |
@@ -41,3 +41,3 @@ "use strict"; | ||
this.render = function () { | ||
var formGroup = dom_1.el('div', "fr-callback-" + _this.index + " form-group"); | ||
var formGroup = dom_1.el('div', "fr-callback-" + _this.index + " form-group mb-3"); | ||
formGroup.appendChild(_this.container); | ||
@@ -44,0 +44,0 @@ return formGroup; |
@@ -7,3 +7,3 @@ "use strict"; | ||
* | ||
* Copyright (c) 2020 ForgeRock. All rights reserved. | ||
* Copyright (c) 2020-2021 ForgeRock. All rights reserved. | ||
* This software may be modified and distributed under the terms | ||
@@ -45,3 +45,3 @@ * of the MIT license. See the LICENSE file for details. | ||
this.render = function () { | ||
var formGroup = dom_1.el('div', "fr-callback-" + _this.index + " form-group"); | ||
var formGroup = dom_1.el('div', "fr-callback-" + _this.index + " form-group mb-3"); | ||
// Add the terms | ||
@@ -48,0 +48,0 @@ var p = dom_1.el('p'); |
@@ -5,3 +5,2 @@ declare class PasswordInput { | ||
private toggler; | ||
private togglerIcon; | ||
constructor(input: HTMLInputElement); | ||
@@ -8,0 +7,0 @@ bind: () => void; |
@@ -7,3 +7,3 @@ "use strict"; | ||
* | ||
* Copyright (c) 2020 ForgeRock. All rights reserved. | ||
* Copyright (c) 2020-2021 ForgeRock. All rights reserved. | ||
* This software may be modified and distributed under the terms | ||
@@ -25,7 +25,5 @@ * of the MIT license. See the LICENSE file for details. | ||
_this.input.type = _this.input.type === 'text' ? 'password' : 'text'; | ||
_this.togglerIcon.innerText = _this.input.type === 'text' ? 'visibility' : 'visibility_off'; | ||
}; | ||
this.group = input.closest('.form-group'); | ||
this.toggler = this.group.querySelector('button'); | ||
this.togglerIcon = this.toggler.querySelector('i'); | ||
} | ||
@@ -32,0 +30,0 @@ return PasswordInput; |
@@ -19,2 +19,4 @@ "use strict"; | ||
return function (d, b) { | ||
if (typeof b !== "function" && b !== null) | ||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | ||
extendStatics(d, b); | ||
@@ -21,0 +23,0 @@ function __() { this.constructor = d; } |
@@ -19,2 +19,4 @@ "use strict"; | ||
return function (d, b) { | ||
if (typeof b !== "function" && b !== null) | ||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | ||
extendStatics(d, b); | ||
@@ -21,0 +23,0 @@ function __() { this.constructor = d; } |
@@ -19,2 +19,4 @@ "use strict"; | ||
return function (d, b) { | ||
if (typeof b !== "function" && b !== null) | ||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | ||
extendStatics(d, b); | ||
@@ -21,0 +23,0 @@ function __() { this.constructor = d; } |
@@ -19,2 +19,4 @@ "use strict"; | ||
return function (d, b) { | ||
if (typeof b !== "function" && b !== null) | ||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | ||
extendStatics(d, b); | ||
@@ -21,0 +23,0 @@ function __() { this.constructor = d; } |
@@ -19,2 +19,4 @@ "use strict"; | ||
return function (d, b) { | ||
if (typeof b !== "function" && b !== null) | ||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | ||
extendStatics(d, b); | ||
@@ -21,0 +23,0 @@ function __() { this.constructor = d; } |
@@ -19,2 +19,4 @@ "use strict"; | ||
return function (d, b) { | ||
if (typeof b !== "function" && b !== null) | ||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | ||
extendStatics(d, b); | ||
@@ -21,0 +23,0 @@ function __() { this.constructor = d; } |
@@ -19,2 +19,4 @@ "use strict"; | ||
return function (d, b) { | ||
if (typeof b !== "function" && b !== null) | ||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | ||
extendStatics(d, b); | ||
@@ -21,0 +23,0 @@ function __() { this.constructor = d; } |
@@ -19,2 +19,4 @@ "use strict"; | ||
return function (d, b) { | ||
if (typeof b !== "function" && b !== null) | ||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | ||
extendStatics(d, b); | ||
@@ -21,0 +23,0 @@ function __() { this.constructor = d; } |
import { Dispatcher } from '@forgerock/javascript-sdk'; | ||
import { ConfigOptions } from './index'; | ||
import { FREndStep, FRUIOptions } from './interfaces'; | ||
import { StringDict } from '@forgerock/javascript-sdk/lib/shared/interfaces'; | ||
interface StepOptions extends ConfigOptions { | ||
query: StringDict<string>; | ||
} | ||
/** | ||
@@ -26,3 +30,3 @@ * Orchestrates the flow through an authentication tree using `FRAuth`, generating | ||
*/ | ||
getSession: (options?: ConfigOptions | undefined) => Promise<FREndStep>; | ||
getSession: (options?: StepOptions | undefined) => Promise<FREndStep>; | ||
/** | ||
@@ -29,0 +33,0 @@ * Reserved for future use. Returns the current instance of FRUI for chaining. |
@@ -19,2 +19,4 @@ "use strict"; | ||
return function (d, b) { | ||
if (typeof b !== "function" && b !== null) | ||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | ||
extendStatics(d, b); | ||
@@ -139,40 +141,51 @@ function __() { this.constructor = d; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var thisStep, _b, _c, rendererOptions, error_1, failure; | ||
var thisStep, _b, _c, redirectCallbacks, rendererOptions, error_1, failure; | ||
return __generator(this, function (_d) { | ||
switch (_d.label) { | ||
case 0: | ||
_d.trys.push([0, 11, , 12]); | ||
return [4 /*yield*/, javascript_sdk_1.FRAuth.next(previousStep, options)]; | ||
_d.trys.push([0, 14, , 15]); | ||
if (!(((options === null || options === void 0 ? void 0 : options.query.code) && (options === null || options === void 0 ? void 0 : options.query.state)) || (options === null || options === void 0 ? void 0 : options.query.form_post_entry))) return [3 /*break*/, 2]; | ||
return [4 /*yield*/, javascript_sdk_1.FRAuth.resume(window.location.href, options)]; | ||
case 1: | ||
thisStep = _d.sent(); | ||
return [3 /*break*/, 4]; | ||
case 2: return [4 /*yield*/, javascript_sdk_1.FRAuth.next(previousStep, options)]; | ||
case 3: | ||
thisStep = _d.sent(); | ||
_d.label = 4; | ||
case 4: | ||
this.dispatchEvent({ step: thisStep, type: enums_1.FREventType.StepChange }); | ||
_b = thisStep.type; | ||
switch (_b) { | ||
case javascript_sdk_1.StepType.LoginSuccess: return [3 /*break*/, 2]; | ||
case javascript_sdk_1.StepType.LoginFailure: return [3 /*break*/, 3]; | ||
case javascript_sdk_1.StepType.LoginSuccess: return [3 /*break*/, 5]; | ||
case javascript_sdk_1.StepType.LoginFailure: return [3 /*break*/, 6]; | ||
} | ||
return [3 /*break*/, 8]; | ||
case 2: | ||
return [3 /*break*/, 11]; | ||
case 5: | ||
// Login successful | ||
return [2 /*return*/, thisStep]; | ||
case 3: | ||
if (!(previousStep && this.firstStepTimedOut(thisStep))) return [3 /*break*/, 5]; | ||
case 6: | ||
if (!(previousStep && this.firstStepTimedOut(thisStep))) return [3 /*break*/, 8]; | ||
_c = previousStep.payload; | ||
return [4 /*yield*/, this.getNewFirstAuthId()]; | ||
case 4: | ||
case 7: | ||
_c.authId = _d.sent(); | ||
return [2 /*return*/, this.nextStep(previousStep)]; | ||
case 5: | ||
if (!(this.handler && this.handler.retry)) return [3 /*break*/, 7]; | ||
case 8: | ||
if (!(this.handler && this.handler.retry)) return [3 /*break*/, 10]; | ||
return [4 /*yield*/, this.handler.retry()]; | ||
case 6: | ||
case 9: | ||
previousStep = _d.sent(); | ||
return [2 /*return*/, this.nextStep(previousStep)]; | ||
case 7: | ||
case 10: | ||
// Login failed | ||
return [2 /*return*/, thisStep]; | ||
case 8: | ||
case 11: | ||
if (previousStep) { | ||
this.successfulStages.push(previousStep); | ||
} | ||
redirectCallbacks = thisStep.getCallbacksOfType(javascript_sdk_1.CallbackType.RedirectCallback); | ||
if (redirectCallbacks.length > 0) { | ||
return [2 /*return*/, javascript_sdk_1.FRAuth.redirect(thisStep)]; | ||
} | ||
// Get a handler for this step and use it to complete the step | ||
@@ -188,8 +201,8 @@ if (!this.options.handlerFactory) { | ||
return [4 /*yield*/, this.handler.completeStep()]; | ||
case 9: | ||
case 12: | ||
thisStep = _d.sent(); | ||
// Keep going to the next step | ||
return [2 /*return*/, this.nextStep(thisStep)]; | ||
case 10: return [3 /*break*/, 12]; | ||
case 11: | ||
case 13: return [3 /*break*/, 15]; | ||
case 14: | ||
error_1 = _d.sent(); | ||
@@ -204,3 +217,3 @@ this.dispatchEvent({ step: previousStep, type: enums_1.FREventType.StepError, error: error_1 }); | ||
return [2 /*return*/, failure]; | ||
case 12: return [2 /*return*/]; | ||
case 15: return [2 /*return*/]; | ||
} | ||
@@ -207,0 +220,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
import { AttributeInputCallback, Auth, AuthResponse, Callback, CallbackContainer, CallbackType, ChoiceCallback, Config, ConfigOptions, ConfirmationCallback, defaultMessageCreator, DeviceProfileCallback, Deferred, Dispatcher, ErrorCode, FailureDetail, FRAuth, FRCallback, FRCallbackFactory, FRDevice, FRLoginFailure, FRLoginSuccess, FRPolicy, FRRecoveryCodes, FRStep, FRStepHandler, FRUser, FRWebAuthn, GetAuthorizationUrlOptions, GetOAuth2TokensOptions, GetTokensOptions, HiddenValueCallback, HttpClient, KbaCreateCallback, Listener, LocalStorage, MessageCreator, MetadataCallback, NameCallback, NameValue, nonce, OAuth2Client, OAuth2Tokens, PasswordCallback, PKCE, PolicyKey, PolicyRequirement, PollingWaitCallback, ProcessedPropertyError, ReCaptchaCallback, RelyingParty, ResponseType, SessionManager, Step, StepDetail, StepType, SuspendedTextOutputCallback, TermsAndConditionsCallback, TextOutputCallback, TokenManager, Tokens, TokenStorage, UserManager, ValidatedCreatePasswordCallback, ValidatedCreateUsernameCallback, ValidConfigOptions, WebAuthnAuthenticationMetadata, WebAuthnCallbacks, WebAuthnOutcome, WebAuthnRegistrationMetadata, WebAuthnStepType } from '@forgerock/javascript-sdk'; | ||
import { AttributeInputCallback, Auth, AuthResponse, Callback, CallbackContainer, CallbackType, ChoiceCallback, Config, ConfigOptions, ConfirmationCallback, defaultMessageCreator, DeviceProfileCallback, Deferred, Dispatcher, ErrorCode, FailureDetail, FRAuth, FRCallback, FRCallbackFactory, FRDevice, FRLoginFailure, FRLoginSuccess, FRPolicy, FRRecoveryCodes, FRStep, FRStepHandler, FRUser, FRWebAuthn, GetAuthorizationUrlOptions, GetOAuth2TokensOptions, GetTokensOptions, HiddenValueCallback, HttpClient, KbaCreateCallback, Listener, LocalStorage, MessageCreator, MetadataCallback, NameCallback, NameValue, OAuth2Client, OAuth2Tokens, PasswordCallback, PKCE, PolicyKey, PolicyRequirement, PollingWaitCallback, ProcessedPropertyError, ReCaptchaCallback, RelyingParty, ResponseType, SessionManager, Step, StepDetail, StepType, SuspendedTextOutputCallback, TermsAndConditionsCallback, TextOutputCallback, TokenManager, Tokens, TokenStorage, UserManager, ValidatedCreatePasswordCallback, ValidatedCreateUsernameCallback, ValidConfigOptions, WebAuthnAuthenticationMetadata, WebAuthnCallbacks, WebAuthnOutcome, WebAuthnRegistrationMetadata, WebAuthnStepType } from '@forgerock/javascript-sdk'; | ||
import basicStepHandlerFactory, { BasicStepHandler } from './basic'; | ||
@@ -17,2 +17,2 @@ import { CallbackRenderer } from './basic/interfaces'; | ||
import { FRAnyStep, FREndStep, FREvent, FRUIStepHandler, FRUIStepHandlerFactory, StepChangeEvent } from './interfaces'; | ||
export { basicStepHandlerFactory, defaultMessageCreator, expressStepHandlerFactory, AttributeInputCallback, Auth, AuthResponse, BasicStepHandler, BooleanAttributeCallbackRenderer, Callback, CallbackContainer, CallbackRenderer, CallbackType, ChoiceCallback, ChoiceCallbackRenderer, Config, ConfigOptions, ConfirmationCallback, ConfirmationCallbackRenderer, DeviceProfileCallback, Deferred, Dispatcher, ErrorCode, FailureDetail, FRAnyStep, FRAuth, FRCallback, FRCallbackFactory, FRDevice, FREndStep, FREvent, FRLoginFailure, FRLoginSuccess, FRPolicy, FRRecoveryCodes, FRStep, FRStepHandler, FRStepHandlerBase, FRUI, FRUIOptions, FRUIStepHandler, FRUIStepHandlerFactory, FRUser, FRWebAuthn, GenericCallbackRenderer, GetAuthorizationUrlOptions, GetOAuth2TokensOptions, GetTokensOptions, HiddenValueCallback, HttpClient, KbaCreateCallback, KbaCreateCallbackRenderer, Listener, LocalStorage, MessageCreator, MetadataCallback, NameCallback, NameValue, nonce, OAuth2Client, OAuth2Tokens, PasswordCallback, PasswordCallbackRenderer, PKCE, PolicyKey, PolicyRequirement, PollingWaitCallback, PollingWaitCallbackRenderer, ProcessedPropertyError, ReCaptchaCallback, ReCaptchaCallbackRenderer, RelyingParty, ResponseType, SessionManager, Step, StepChangeEvent, StepDetail, StepType, SuspendedTextOutputCallback, TermsAndConditionsCallback, TermsAndConditionsCallbackRenderer, TextOutputCallback, TokenManager, Tokens, TokenStorage, UserManager, ValidatedCreatePasswordCallback, ValidatedCreateUsernameCallback, ValidConfigOptions, WebAuthnAuthenticationMetadata, WebAuthnCallbacks, WebAuthnOutcome, WebAuthnRegistrationMetadata, WebAuthnStepType, }; | ||
export { basicStepHandlerFactory, defaultMessageCreator, expressStepHandlerFactory, AttributeInputCallback, Auth, AuthResponse, BasicStepHandler, BooleanAttributeCallbackRenderer, Callback, CallbackContainer, CallbackRenderer, CallbackType, ChoiceCallback, ChoiceCallbackRenderer, Config, ConfigOptions, ConfirmationCallback, ConfirmationCallbackRenderer, DeviceProfileCallback, Deferred, Dispatcher, ErrorCode, FailureDetail, FRAnyStep, FRAuth, FRCallback, FRCallbackFactory, FRDevice, FREndStep, FREvent, FRLoginFailure, FRLoginSuccess, FRPolicy, FRRecoveryCodes, FRStep, FRStepHandler, FRStepHandlerBase, FRUI, FRUIOptions, FRUIStepHandler, FRUIStepHandlerFactory, FRUser, FRWebAuthn, GenericCallbackRenderer, GetAuthorizationUrlOptions, GetOAuth2TokensOptions, GetTokensOptions, HiddenValueCallback, HttpClient, KbaCreateCallback, KbaCreateCallbackRenderer, Listener, LocalStorage, MessageCreator, MetadataCallback, NameCallback, NameValue, OAuth2Client, OAuth2Tokens, PasswordCallback, PasswordCallbackRenderer, PKCE, PolicyKey, PolicyRequirement, PollingWaitCallback, PollingWaitCallbackRenderer, ProcessedPropertyError, ReCaptchaCallback, ReCaptchaCallbackRenderer, RelyingParty, ResponseType, SessionManager, Step, StepChangeEvent, StepDetail, StepType, SuspendedTextOutputCallback, TermsAndConditionsCallback, TermsAndConditionsCallbackRenderer, TextOutputCallback, TokenManager, Tokens, TokenStorage, UserManager, ValidatedCreatePasswordCallback, ValidatedCreateUsernameCallback, ValidConfigOptions, WebAuthnAuthenticationMetadata, WebAuthnCallbacks, WebAuthnOutcome, WebAuthnRegistrationMetadata, WebAuthnStepType, }; |
@@ -34,4 +34,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.StepType = exports.SessionManager = exports.ResponseType = exports.ReCaptchaCallbackRenderer = exports.ReCaptchaCallback = exports.PollingWaitCallbackRenderer = exports.PollingWaitCallback = exports.PolicyKey = exports.PKCE = exports.PasswordCallbackRenderer = exports.PasswordCallback = exports.OAuth2Client = exports.nonce = exports.NameCallback = exports.MetadataCallback = exports.LocalStorage = exports.KbaCreateCallbackRenderer = exports.KbaCreateCallback = exports.HttpClient = exports.HiddenValueCallback = exports.GenericCallbackRenderer = exports.FRWebAuthn = exports.FRUser = exports.FRUI = exports.FRStepHandlerBase = exports.FRStep = exports.FRRecoveryCodes = exports.FRPolicy = exports.FRLoginSuccess = exports.FRLoginFailure = exports.FRDevice = exports.FRCallback = exports.FRAuth = exports.ErrorCode = exports.Dispatcher = exports.Deferred = exports.DeviceProfileCallback = exports.ConfirmationCallbackRenderer = exports.ConfirmationCallback = exports.Config = exports.ChoiceCallbackRenderer = exports.ChoiceCallback = exports.CallbackType = exports.BooleanAttributeCallbackRenderer = exports.BasicStepHandler = exports.Auth = exports.AttributeInputCallback = exports.expressStepHandlerFactory = exports.defaultMessageCreator = exports.basicStepHandlerFactory = void 0; | ||
exports.WebAuthnStepType = exports.WebAuthnOutcome = exports.ValidatedCreateUsernameCallback = exports.ValidatedCreatePasswordCallback = exports.UserManager = exports.TokenStorage = exports.TokenManager = exports.TextOutputCallback = exports.TermsAndConditionsCallbackRenderer = exports.TermsAndConditionsCallback = exports.SuspendedTextOutputCallback = void 0; | ||
exports.SuspendedTextOutputCallback = exports.StepType = exports.SessionManager = exports.ResponseType = exports.ReCaptchaCallbackRenderer = exports.ReCaptchaCallback = exports.PollingWaitCallbackRenderer = exports.PollingWaitCallback = exports.PolicyKey = exports.PKCE = exports.PasswordCallbackRenderer = exports.PasswordCallback = exports.OAuth2Client = exports.NameCallback = exports.MetadataCallback = exports.LocalStorage = exports.KbaCreateCallbackRenderer = exports.KbaCreateCallback = exports.HttpClient = exports.HiddenValueCallback = exports.GenericCallbackRenderer = exports.FRWebAuthn = exports.FRUser = exports.FRUI = exports.FRStepHandlerBase = exports.FRStep = exports.FRRecoveryCodes = exports.FRPolicy = exports.FRLoginSuccess = exports.FRLoginFailure = exports.FRDevice = exports.FRCallback = exports.FRAuth = exports.ErrorCode = exports.Dispatcher = exports.Deferred = exports.DeviceProfileCallback = exports.ConfirmationCallbackRenderer = exports.ConfirmationCallback = exports.Config = exports.ChoiceCallbackRenderer = exports.ChoiceCallback = exports.CallbackType = exports.BooleanAttributeCallbackRenderer = exports.BasicStepHandler = exports.Auth = exports.AttributeInputCallback = exports.expressStepHandlerFactory = exports.defaultMessageCreator = exports.basicStepHandlerFactory = void 0; | ||
exports.WebAuthnStepType = exports.WebAuthnOutcome = exports.ValidatedCreateUsernameCallback = exports.ValidatedCreatePasswordCallback = exports.UserManager = exports.TokenStorage = exports.TokenManager = exports.TextOutputCallback = exports.TermsAndConditionsCallbackRenderer = exports.TermsAndConditionsCallback = void 0; | ||
var javascript_sdk_1 = require("@forgerock/javascript-sdk"); | ||
@@ -65,3 +65,2 @@ Object.defineProperty(exports, "AttributeInputCallback", { enumerable: true, get: function () { return javascript_sdk_1.AttributeInputCallback; } }); | ||
Object.defineProperty(exports, "NameCallback", { enumerable: true, get: function () { return javascript_sdk_1.NameCallback; } }); | ||
Object.defineProperty(exports, "nonce", { enumerable: true, get: function () { return javascript_sdk_1.nonce; } }); | ||
Object.defineProperty(exports, "OAuth2Client", { enumerable: true, get: function () { return javascript_sdk_1.OAuth2Client; } }); | ||
@@ -68,0 +67,0 @@ Object.defineProperty(exports, "PasswordCallback", { enumerable: true, get: function () { return javascript_sdk_1.PasswordCallback; } }); |
@@ -7,3 +7,3 @@ import { FRLoginFailure, FRLoginSuccess, FRStep } from '@forgerock/javascript-sdk'; | ||
*/ | ||
declare type FREndStep = FRLoginSuccess | FRLoginFailure; | ||
declare type FREndStep = FRLoginSuccess | FRLoginFailure | void; | ||
/** | ||
@@ -10,0 +10,0 @@ * Represents any step type of authentication, including the final step type. |
{ | ||
"name": "@forgerock/javascript-sdk-ui", | ||
"version": "2.2.0", | ||
"version": "3.0.0-beta1", | ||
"description": "ForgeRock JavaScript SDK with UI rendering capability", | ||
@@ -15,7 +15,7 @@ "main": "./lib/", | ||
"scripts": { | ||
"build": "npm run clean && tsc && tsc -m es6 --outDir lib-esm && webpack --env.DEV=no", | ||
"build": "npm run clean && tsc && tsc -m es6 --outDir lib-esm && webpack --env DEV=no", | ||
"build:e2e": "webpack --config ./tests/e2e/server/webpack.config.js", | ||
"clean": "shx rm -rf bundles docs lib lib-esm", | ||
"clean:all": "npm run clean && shx rm -rf node_modules package-lock.json && git clean -fX -e '!*.pem'", | ||
"lint": "eslint --ignore-path .gitignore '**/*.ts' --fix", | ||
"clean": "shx rm -rf ./bundles ./docs ./lib ./lib-esm", | ||
"clean:all": "npm run clean && shx rm -rf ./node_modules ./package-lock.json && git clean -fX -e \"!*.pem\"", | ||
"lint": "eslint --ignore-path .gitignore \"./**/*.ts\" --fix", | ||
"eslint-check": "eslint --print-config src/index.ts | eslint-config-prettier-check", | ||
@@ -25,3 +25,2 @@ "docs": "npm run docs:clean && npm run docs:gen", | ||
"docs:clean": "shx rm -rf docs", | ||
"docs:watch": "watch 'npm run docs' ./src", | ||
"start:e2e": "http-server ./tests/e2e/site -c1 -p 8443 --ssl --cert example.com+5.pem --key example.com+5-key.pem", | ||
@@ -31,6 +30,6 @@ "start:e2e:app": "http-server ./tests/e2e/app -c1 -p 8443 --ssl --cert example.com+5.pem --key example.com+5-key.pem", | ||
"test": "npm run test:unit && npm run test:e2e", | ||
"test:e2e": "JEST_PUPPETEER_CONFIG='./tests/jest.puppeteer.config.js' jest --testMatch='<rootDir>/tests/e2e/**/*.test.ts' --config=./tests/jest.e2e.config.js", | ||
"test:integration": "jest --testMatch='<rootDir>/tests/integration/**/*.test.ts' --config=./tests/jest.basic.config.js", | ||
"test:unit": "jest --testMatch='<rootDir>/src/**/*.test.ts' --config=./tests/jest.basic.config.js", | ||
"watch": "webpack --env.DEV=yes" | ||
"test:e2e": "JEST_PUPPETEER_CONFIG=\"./tests/jest.puppeteer.config.js\" jest --testMatch=\"<rootDir>/tests/e2e/**/*.test.ts\" --config=./tests/jest.e2e.config.js", | ||
"test:integration": "jest --testMatch=\"<rootDir>/tests/integration/**/*.test.ts\" --config=./tests/jest.basic.config.js", | ||
"test:unit": "jest --testMatch=\"<rootDir>/src/**/*.test.ts\" --config=./tests/jest.basic.config.js", | ||
"watch": "webpack --env DEV=yes" | ||
}, | ||
@@ -54,6 +53,5 @@ "husky": { | ||
"dependencies": { | ||
"@forgerock/javascript-sdk": "^2.2.0" | ||
"@forgerock/javascript-sdk": "^3.0.0-beta1" | ||
}, | ||
"devDependencies": { | ||
"@forgerock/ui-design": "^0.1.1", | ||
"@types/expect-puppeteer": "^3.3.3", | ||
@@ -63,9 +61,10 @@ "@types/jest": "^26.0.13", | ||
"@types/puppeteer": "^3.0.2", | ||
"@typescript-eslint/eslint-plugin": "^3.4.0", | ||
"@typescript-eslint/parser": "^3.4.0", | ||
"awesome-typescript-loader": "^5.2.1", | ||
"bootstrap": "^4.4.1", | ||
"@typescript-eslint/eslint-plugin": "^4.17.0", | ||
"@typescript-eslint/parser": "^4.17.0", | ||
"@typescript-eslint/typescript-estree": "^4.17.0", | ||
"autoprefixer": "^10.2.6", | ||
"bootstrap": "^5.0.1", | ||
"copyfiles": "^2.1.1", | ||
"cpy-cli": "^3.1.1", | ||
"eslint": "^7.3.1", | ||
"eslint": "^7.22.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
@@ -77,18 +76,20 @@ "eslint-plugin-prettier": "^3.1.4", | ||
"jest": "^26.1.0", | ||
"jest-junit": "^12.0.0", | ||
"jest-puppeteer": "^4.4.0", | ||
"miragejs": "^0.1.32", | ||
"node-sass": "^4.14.1", | ||
"postcss": "^8.3.0", | ||
"postcss-loader": "^5.3.0", | ||
"prettier": "^2.0.5", | ||
"puppeteer": "^2.0.0", | ||
"raw-loader": "^3.1.0", | ||
"sass-loader": "^8.0.0", | ||
"raw-loader": "^4.0.2", | ||
"sass-loader": "^11.1.1", | ||
"shx": "^0.3.2", | ||
"ts-jest": "^26.1.4", | ||
"tslint": "^5.20.0", | ||
"ts-loader": "^8.0.17", | ||
"typedoc": "^0.17.7", | ||
"typescript": "^4.0.0", | ||
"watch": "^1.0.2", | ||
"webpack": "^4.43.0", | ||
"webpack-cli": "^3.3.12" | ||
"webpack": "^5.24.4", | ||
"webpack-cli": "^4.5.0" | ||
} | ||
} |
[](CHANGELOG.md) | ||
[](https://jenkins.petrov.ca/job/01-JS-UI-SDK-BUILD/) | ||
@@ -28,6 +29,7 @@ <p align="center"> | ||
* Browsers: | ||
* Chrome 87 | ||
* Firefox 84 | ||
* Safari 14 | ||
* Edge 87 (Chromium) | ||
* Edge 44 (Legacy): requires one polyfill for TextEncoder, [`fast-text-encoding` is recommended](https://www.npmjs.com/package/fast-text-encoding) | ||
* Edge 83 (Chromium) | ||
* Chrome 83 | ||
* Firefox 77 | ||
@@ -34,0 +36,0 @@ > **Tip**: Older browsers (like IE11) may require multiple [polyfills, which can be found in our documentation](https://sdks.forgerock.com/javascript/polyfills/). |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
2156689
7.37%265
2.32%14869
4.86%225
0.9%35
6.06%1
Infinity%8
Infinity%+ Added
- Removed