diff --git a/commons/selfservice/example-ui/src/main/js/main.js b/commons/selfservice/example-ui/src/main/js/main.js index 48d2808ae..6e1e9a5bc 100644 --- a/commons/selfservice/example-ui/src/main/js/main.js +++ b/commons/selfservice/example-ui/src/main/js/main.js @@ -20,6 +20,8 @@ * with the fields enclosed by brackets [] replaced by * your own identifying information: * "Portions Copyrighted [year] [name of copyright owner]" + * + * Portions Copyrighted 2025 3A Systems LLC. */ /*global require, window */ @@ -50,7 +52,7 @@ require.config({ js2form: "libs/js2form-2.0", form2js: "libs/form2js-2.0", spin: "libs/spin-2.0.1-min", - jquery: "libs/jquery-2.1.1-min", + jquery: "libs/jquery-3.7.1-min", xdate: "libs/xdate-0.8-min", doTimeout: "libs/jquery.ba-dotimeout-1.0-min", handlebars: "libs/handlebars-4.7.7-min", diff --git a/ui/commons/src/main/js/config/process/CommonConfig.js b/ui/commons/src/main/js/config/process/CommonConfig.js index 32ef3a934..93c241940 100644 --- a/ui/commons/src/main/js/config/process/CommonConfig.js +++ b/ui/commons/src/main/js/config/process/CommonConfig.js @@ -12,14 +12,17 @@ * information: "Portions copyright [year] [name of copyright owner]". * * Copyright 2011-2016 ForgeRock AS. + * Portions copyright 2025 3A Systems LLC. */ define([ "jquery", "lodash", "org/forgerock/commons/ui/common/util/Constants", - "org/forgerock/commons/ui/common/main/EventManager" -], function($, _, Constants, EventManager) { + "org/forgerock/commons/ui/common/main/EventManager", + "org/forgerock/commons/ui/common/main/SpinnerManager", + "org/forgerock/commons/ui/common/main/ErrorsHandler" +], function($, _, Constants, EventManager, spinner, errorsHandler) { var obj = [ { startEvent: Constants.EVENT_APP_INITIALIZED, @@ -158,11 +161,7 @@ define([ { startEvent: Constants.EVENT_REST_CALL_ERROR, description: "", - dependencies: [ - "org/forgerock/commons/ui/common/main/SpinnerManager", - "org/forgerock/commons/ui/common/main/ErrorsHandler" - ], - processDescription: function(event, spinner, errorsHandler) { + processDescription: function(event) { errorsHandler.handleError(event.data, event.errorsHandlers); spinner.hideSpinner(); } @@ -170,10 +169,7 @@ define([ { startEvent: Constants.EVENT_START_REST_CALL, description: "", - dependencies: [ - "org/forgerock/commons/ui/common/main/SpinnerManager" - ], - processDescription: function(event, spinner) { + processDescription: function(event) { if (!event.suppressSpinner) { spinner.showSpinner(); } @@ -182,10 +178,7 @@ define([ { startEvent: Constants.EVENT_END_REST_CALL, description: "", - dependencies: [ - "org/forgerock/commons/ui/common/main/SpinnerManager" - ], - processDescription: function(event, spinner) { + processDescription: function() { spinner.hideSpinner(); } }, diff --git a/ui/commons/src/main/js/org/forgerock/commons/ui/common/main/ProcessConfiguration.js b/ui/commons/src/main/js/org/forgerock/commons/ui/common/main/ProcessConfiguration.js index 3cf078b05..ed768ec54 100644 --- a/ui/commons/src/main/js/org/forgerock/commons/ui/common/main/ProcessConfiguration.js +++ b/ui/commons/src/main/js/org/forgerock/commons/ui/common/main/ProcessConfiguration.js @@ -12,6 +12,7 @@ * information: "Portions copyright [year] [name of copyright owner]". * * Copyright 2011-2016 ForgeRock AS. + * Portions copyright 2025 3A Systems LLC. */ define([ @@ -37,6 +38,9 @@ define([ obj.callRegisterListenerFromConfig = function (config) { eventManager.registerListener(config.startEvent, function (event) { + if (!config.dependencies) { + return config.processDescription(event); + } return $.when.apply($, _.map(config.dependencies, function (dep) { return ModuleLoader.load(dep); })).then(function () { diff --git a/ui/commons/src/test/qunit/AbstractCollection.js b/ui/commons/src/test/qunit/AbstractCollection.js index 0644e2814..79e88221c 100644 --- a/ui/commons/src/test/qunit/AbstractCollection.js +++ b/ui/commons/src/test/qunit/AbstractCollection.js @@ -12,6 +12,7 @@ * information: "Portions copyright [year] [name of copyright owner]". * * Copyright 2016 ForgeRock AS. + * Portions copyright 2025 3A Systems LLC. */ /*globals QUnit */ @@ -29,7 +30,7 @@ define([ testCollection.url = "/crestResource?_queryFilter=true"; - sinon.stub(ServiceInvoker, "restCall", function (options) { + sinon.stub(ServiceInvoker, "restCall").callsFake(function (options) { var response = { "result": [{ "_id": 1, @@ -57,7 +58,7 @@ define([ testCollection.setPagingType("cookie"); testCollection.setTotalPagedResultsPolicy("EXACT"); - testCollection.getFirstPage().then(function () { + return testCollection.getFirstPage().then(function () { assert.equal(ServiceInvoker.restCall.callCount, 1, "Only one REST call produced"); restCallArg = ServiceInvoker.restCall.args[0][0]; // first invocation, first argument assert.equal(testCollection.length, 2, "collection contains two records from the backend"); @@ -92,4 +93,4 @@ define([ }); -}); +}); \ No newline at end of file diff --git a/ui/commons/src/test/qunit/AbstractModel.js b/ui/commons/src/test/qunit/AbstractModel.js index 8c1b77932..58759855d 100644 --- a/ui/commons/src/test/qunit/AbstractModel.js +++ b/ui/commons/src/test/qunit/AbstractModel.js @@ -12,6 +12,7 @@ * information: "Portions copyright [year] [name of copyright owner]". * * Copyright 2016 ForgeRock AS. + * Portions copyright 2025 3A Systems LLC. */ define([ @@ -32,14 +33,14 @@ define([ testModel.url = "/crestResource"; - sinon.stub(ServiceInvoker, "restCall", function (opts) { + sinon.stub(ServiceInvoker, "restCall").callsFake(function (opts) { return $.Deferred().resolve(_.extend(JSON.parse(opts.data), { "_id": 1, "_rev": 1 })); }); - testModel.save(newRecord).then(function () { + return testModel.save(newRecord).then(function () { restCallArg = ServiceInvoker.restCall.args[0][0]; // first invocation, first argument assert.equal(testModel.id, 1, "Newly-created model has id from backend"); assert.equal(restCallArg.url, "/crestResource?_action=create&", "correct url used to create model"); @@ -60,13 +61,13 @@ define([ testModel.url = "/crestResource"; testModel.id = "myCustomId"; - sinon.stub(ServiceInvoker, "restCall", function (opts) { + sinon.stub(ServiceInvoker, "restCall").callsFake(function (opts) { return $.Deferred().resolve(_.extend(JSON.parse(opts.data), { "_rev": 1 })); }); - testModel.save(newRecord).then(function () { + return testModel.save(newRecord).then(function () { restCallArg = ServiceInvoker.restCall.args[0][0]; // first invocation, first argument assert.equal(testModel.get("_rev"), 1, "Model has new rev from backend"); assert.equal(restCallArg.url, "/crestResource/myCustomId?", "correct url used to create model"); @@ -74,7 +75,7 @@ define([ assert.equal(restCallArg.type, "PUT", "correct method used to create model"); ServiceInvoker.restCall.restore(); - }) + }); }); QUnit.test("read operation", function (assert) { @@ -84,7 +85,7 @@ define([ testModel.url = "/crestResource"; testModel.id = 1; - sinon.stub(ServiceInvoker, "restCall", function () { + sinon.stub(ServiceInvoker, "restCall").callsFake(function () { return $.Deferred().resolve({ "_id": 1, "_rev": 1, @@ -92,7 +93,7 @@ define([ }); }); - testModel.fetch().then(function () { + return testModel.fetch().then(function () { restCallArg = ServiceInvoker.restCall.args[0][0]; // first invocation, first argument assert.equal(testModel.get("name"), "foo", "example data populated from fetch call"); assert.equal(testModel.get("_rev"), 1, "revision populated from fetch call"); @@ -128,13 +129,13 @@ define([ testModel.url = "/crestResource"; - sinon.stub(ServiceInvoker, "restCall", function (opts) { + sinon.stub(ServiceInvoker, "restCall").callsFake(function (opts) { return $.Deferred().resolve(_.extend(JSON.parse(opts.data), { "_rev": 2 })); }); - testModel.save().then(function () { + return testModel.save().then(function () { restCallArg = ServiceInvoker.restCall.args[0][0]; // first invocation, first argument assert.equal(testModel.get("_rev"), 2, "Model has new rev from backend"); assert.equal(restCallArg.url, "/crestResource/1?", "correct url used to update model"); @@ -156,11 +157,11 @@ define([ testModel.url = "/crestResource"; - sinon.stub(ServiceInvoker, "restCall", function (opts) { + sinon.stub(ServiceInvoker, "restCall").callsFake(function () { return $.Deferred().resolve(); }); - testModel.destroy().then(function () { + return testModel.destroy().then(function () { restCallArg = ServiceInvoker.restCall.args[0][0]; // first invocation, first argument assert.equal(restCallArg.url, "/crestResource/1?", "correct url used to delete model"); assert.equal(restCallArg.type, "DELETE", "correct method used to DELETE model"); @@ -180,11 +181,11 @@ define([ testModel.url = "/crestResource"; - sinon.stub(ServiceInvoker, "restCall", function (opts) { + sinon.stub(ServiceInvoker, "restCall").callsFake(function () { return $.Deferred().resolve(); }); - testModel.save({"foo": "baz"}, {patch: true}).then(function () { + return testModel.save({"foo": "baz"}, {patch: true}).then(function () { restCallArg = ServiceInvoker.restCall.args[0][0]; // first invocation, first argument assert.equal(restCallArg.url, "/crestResource/1?", "correct url used to patch model"); diff --git a/ui/commons/src/test/qunit/OAuth.js b/ui/commons/src/test/qunit/OAuth.js index 142d0c3c4..828f58e3a 100644 --- a/ui/commons/src/test/qunit/OAuth.js +++ b/ui/commons/src/test/qunit/OAuth.js @@ -12,6 +12,7 @@ * information: "Portions copyright [year] [name of copyright owner]". * * Copyright 2016 ForgeRock AS. + * Portions copyright 2025 3A Systems LLC. */ define([ @@ -22,10 +23,10 @@ define([ QUnit.module('OAuth Functions'); QUnit.moduleStart(function() { - sinon.stub(URIUtils, "getCurrentOrigin", function () { + sinon.stub(URIUtils, "getCurrentOrigin").callsFake(function () { return "http://rp.com"; }); - sinon.stub(URIUtils, "getCurrentPathName", function () { + sinon.stub(URIUtils, "getCurrentPathName").callsFake(function () { return "/app/index.html"; }); }); @@ -44,7 +45,7 @@ define([ ); }); QUnit.test("oAuth request url", function (assert) { - sinon.stub(OAuth, "generateNonce", function () { + sinon.stub(OAuth, "generateNonce").callsFake(function () { return "nonceValue"; }); assert.equal(OAuth.getRequestURL( diff --git a/ui/mock/src/main/js/main.js b/ui/mock/src/main/js/main.js index 76e7ad70e..bf8aca44c 100644 --- a/ui/mock/src/main/js/main.js +++ b/ui/mock/src/main/js/main.js @@ -12,6 +12,7 @@ * information: "Portions copyright [year] [name of copyright owner]". * * Copyright 2011-2016 ForgeRock AS. + * Portions copyright 2025 3A Systems LLC. */ require.config({ @@ -33,7 +34,7 @@ require.config({ }, paths: { // sinon only needed (or available) for Mock project - sinon: "libs/sinon-1.15.4", + sinon: "libs/sinon-15.2.0", i18next: "libs/i18next-1.7.3-min", backbone: "libs/backbone-1.1.2-min", "backbone.paginator": "libs/backbone.paginator.min-2.0.2-min", @@ -46,7 +47,7 @@ require.config({ js2form: "libs/js2form-2.0-769718a", form2js: "libs/form2js-2.0-769718a", spin: "libs/spin-2.0.1-min", - jquery: "libs/jquery-2.1.1-min", + jquery: "libs/jquery-3.7.1-min", xdate: "libs/xdate-0.8-min", doTimeout: "libs/jquery.ba-dotimeout-1.0-min", handlebars: "libs/handlebars-4.7.7", diff --git a/ui/mock/src/test/qunit/testRunner.js b/ui/mock/src/test/qunit/testRunner.js index fa6cef28f..1f53ad006 100644 --- a/ui/mock/src/test/qunit/testRunner.js +++ b/ui/mock/src/test/qunit/testRunner.js @@ -12,6 +12,7 @@ * information: "Portions copyright [year] [name of copyright owner]". * * Copyright 2016 ForgeRock AS. + * Portions copyright 2025 3A Systems LLC. */ (function () { @@ -29,7 +30,7 @@ stashedRequire.original.config({ baseUrl: '../www', paths: { - sinon: "libs/sinon-1.15.4" + sinon: "libs/sinon-15.2.0" } }); @@ -43,7 +44,7 @@ "org/forgerock/commons/ui/common/main/i18nManager", "ThemeManager" ], function ($, sinon, i18nManager, ThemeManager) { - sinon.stub(ThemeManager, "getTheme", function () { + sinon.stub(ThemeManager, "getTheme").callsFake(function () { return $.Deferred().resolve({path:""}); }); i18nManager.init({ diff --git a/ui/pom.xml b/ui/pom.xml index 90b11e81e..d57a6f3e2 100644 --- a/ui/pom.xml +++ b/ui/pom.xml @@ -32,6 +32,8 @@ UTF-8 ${project.parent.basedir} + 3.7.1 + 15.2.0 org.openidentityplatform.commons ui @@ -150,7 +152,7 @@ org.openidentityplatform.commons.ui.libs sinon - 1.15.4 + ${sinon.version} js https://cdnjs.cloudflare.com/ajax/libs/sinon.js/{version}/{artifactId}.{packaging} @@ -304,7 +306,7 @@ org.openidentityplatform.commons.ui.libs jquery - 2.1.1 + ${jquery.version} js min https://cdnjs.cloudflare.com/ajax/libs/jquery/{version}/{artifactId}.{classifier}.{packaging} @@ -584,7 +586,7 @@ org.openidentityplatform.commons.ui.libs jquery - 2.1.1 + ${jquery.version} js min @@ -805,7 +807,7 @@ org.openidentityplatform.commons.ui.libs sinon - 1.15.4 + ${sinon.version} js