/*
 * ! ${copyright}
 */

sap.ui.define([
	"sap/ui/rta/RuntimeAuthoring",
	"sap/ui/core/Element",
	"sap/ui/fl/write/api/FeaturesAPI",
	"sap/ui/fl/Utils",
	"sap/ui/core/UIComponent",
	"sap/base/Log"
], function(
	RuntimeAuthoring,
	Element,
	FeaturesAPI,
	FlexUtils,
	UIComponent,
	Log
) {
	"use strict";
	/**
	 * Starts key user adaptation, initiated for an application at the passed root control instance.
	 * It subsequently extends to all valid child controls.
	 *
	 * Example: If the whole application needs to be adapted,
	 * then this application component's container {@see sap.ui.core.ComponentContainer} should be passed as the root control to this function.
	 *
	 * @function
	 * @experimental
	 * @since 1.71
	 * @public
	 * @alias module:sap/ui/rta/startKeyUserAdaptation
	 *
	 * @param {object} mPropertyBag - Object with properties
	 * @param {sap.ui.core.Element | sap.ui.core.UIComponent} mPropertyBag.rootControl - Control instance from where key user adaptation should be started
	 * @param {boolean} [mPropertyBag.adaptWholeApp] - Indicates if adaptation should start from the passed control's application component
	 *
	 * @returns {Promise} Resolves when adaptation was successfully started
	 */
	return function (mPropertyBag) {
		if (!(mPropertyBag.rootControl instanceof Element) && !(mPropertyBag.rootControl instanceof UIComponent)) {
			return Promise.reject(new Error("An invalid root control was passed"));
		}
		return FeaturesAPI.isKeyUser()
			.then(function (bIsKeyUser) {
				if (!bIsKeyUser) {
					throw new Error("Key user rights have not been granted to the current user");
				}

				var oRootControl = mPropertyBag.rootControl;
				if (mPropertyBag.adaptWholeApp) {
					oRootControl = FlexUtils.getAppComponentForControl(mPropertyBag.rootControl);
				}

				var oRta = new RuntimeAuthoring({
					rootControl: oRootControl,
					flexSettings: {
						developerMode: false,
						layer: "CUSTOMER"
					},
					validateAppVersion: true
				});

				oRta.attachEvent('stop', function () {
					oRta.destroy();
				});

				return oRta.start();
			})
			.catch(function(oError) {
				Log.error("UI Adaptation could not be started", oError.message);
				throw oError;
			});
	};
});
@@ -537,32 +537,34 @@
 this application
+'s
  component's con
@@ -557,17 +557,16 @@
 omponent
-'
 s contai
@@ -697,22 +697,17 @@
 rimental
-%0A%09 * @
+ 
 since 1.
@@ -718,14 +718,18 @@
  * @
-public
+since 1.71
 %0A%09 *
@@ -754,16 +754,20 @@
 /ui/rta/
+api/
 startKey
@@ -878,11 +878,9 @@
 ment
- %7C 
+%7C
 sap.
@@ -1214,27 +1214,54 @@
 %0A%09 *
-/%0A%09return function 
+ @public%0A%09 */%0A%09function startKeyUserAdaptation
 (mPr
@@ -2033,14 +2033,14 @@
 ent(
-'
+%22
 stop
-'
+%22
 , fu
@@ -2237,13 +2237,44 @@
 %09%09%7D);%0A%09%7D
+%0A%09return startKeyUserAdaptation
 ;%0A%7D);

enable startKeyUserAdaptation() JS-Docs