|
| 1 | +"use strict"; |
| 2 | +Object.defineProperty(exports, "__esModule", { value: true }); |
| 3 | +var IMSInterface = /** @class */ (function () { |
| 4 | + function IMSInterface() { |
| 5 | + } |
| 6 | + /** |
| 7 | + * Establishes an IMS session. Must be called before any IMS access methods. |
| 8 | + * This method is not thread safe. |
| 9 | + * |
| 10 | + * @return An IMS reference string, as returned from IMSLib, which you |
| 11 | + * can then use to make further IMS calls to this object's methods. |
| 12 | + * |
| 13 | + * @deprecated Please use imsConnectWithEndpoint instead. |
| 14 | + */ |
| 15 | + IMSInterface.prototype.imsConnect = function () { |
| 16 | + return window.__adobe_cep__.imsConnect(); |
| 17 | + }; |
| 18 | + IMSInterface.prototype.imsDisconnect = function (imsRef) { |
| 19 | + window.__adobe_cep__.imsDisconnect(imsRef); |
| 20 | + }; |
| 21 | + IMSInterface.prototype.imsConnectWithEndpoint = function (imsEndpoint) { |
| 22 | + return JSON.parse(window.__adobe_cep__.invokeSync("imsConnectWithEndpoint", JSON.stringify({ imsEndpoint: imsEndpoint }))).result; |
| 23 | + }; |
| 24 | + IMSInterface.prototype.imsFetchAccounts = function (imsRef, clientId) { |
| 25 | + return window.__adobe_cep__.imsFetchAccounts(imsRef, clientId); |
| 26 | + }; |
| 27 | + IMSInterface.prototype.imsFetchUserProfileData = function (imsRef, userAccountGuid) { |
| 28 | + var data = { |
| 29 | + imsRef: imsRef, |
| 30 | + userAccountGuid: userAccountGuid |
| 31 | + }; |
| 32 | + return window.__adobe_cep__.invokeSync("imsFetchUserProfileData", JSON.stringify(data)); |
| 33 | + }; |
| 34 | + /** |
| 35 | + * Requests an access token from IMS for a given user and service. |
| 36 | + * |
| 37 | + * This function is asynchronous. To handle the result, register a callback for the event |
| 38 | + * "com.adobe.csxs.events.internal.ims.FetchAccessToken" or "com.adobe.csxs.events.internal.ims.FetchAccessTokenWithStatus". |
| 39 | + * For event "com.adobe.csxs.events.internal.ims.FetchAccessToken", the event data is a JSON string |
| 40 | + * with format {"toua":"...",...,"emailVerified":"false"}. |
| 41 | + * For event "com.adobe.csxs.events.internal.ims.FetchAccessTokenWithStatus", the event data is a JSON string |
| 42 | + * with format {"status":"0","details":{"toua":"...",...,"emailVerified":"false"}}. |
| 43 | + * |
| 44 | + * @see addEventListener() |
| 45 | + * |
| 46 | + * @param imsRef An IMS reference returned from the \c IMSConnect() call. |
| 47 | + * @param clientId The IMS client ID for your extension, assigned by the IMS team on registration. |
| 48 | + * This is the service-code value in the Renga Service Account Object for your client. |
| 49 | + * @param clientSecret The client secret associated with the provided client ID |
| 50 | + * @param userAccountGuid The unique person GUID for the Renga account, as returned by the <code>fetchAccounts()</code> method. The token is generated for this user. |
| 51 | + * @param serviceAccountGuid (optional, not currently used) A unique identifier for a Service Account Object (SAO). |
| 52 | + * @param scope (optional) A comma delimited list of services for which the refresh and access tokens are requested. |
| 53 | + * |
| 54 | + * By default, this is 'openid,AdobeID'. Scope strings are case sensitive. |
| 55 | + * If the cached version of the refresh token does not match the requested service scopes, a new refresh token is fetched. |
| 56 | + * To request your service's own SAO, add your service to the list; |
| 57 | + * for example, 'openid,AdobeID,browserlab'. |
| 58 | + * |
| 59 | + * @return A boolean status. Returning true means only the call to imsFetchAccessToken function itself is successful. |
| 60 | + * Returning false means that failed to fetch access token. |
| 61 | + */ |
| 62 | + IMSInterface.prototype.imsFetchAccessToken = function (imsRef, clientId, clientSecret, userAccountGuid, serviceAccountGuid, scope) { |
| 63 | + return window.__adobe_cep__.imsFetchAccessToken(imsRef, clientId, clientSecret, userAccountGuid, serviceAccountGuid, scope); |
| 64 | + }; |
| 65 | + IMSInterface.prototype.imsFetchContinueToken = function (imsRef, bearerToken, targetClientId, redirectUri, scope, responseType, locale) { |
| 66 | + var data = { |
| 67 | + imsRef: imsRef, |
| 68 | + bearerToken: bearerToken, |
| 69 | + targetClientId: targetClientId, |
| 70 | + redirectUri: redirectUri, |
| 71 | + scope: scope, |
| 72 | + responseType: responseType, |
| 73 | + locale: locale |
| 74 | + }; |
| 75 | + return JSON.parse(window.__adobe_cep__.invokeSync("imsFetchContinueToken", JSON.stringify(data))).result; |
| 76 | + }; |
| 77 | + IMSInterface.prototype.imsRevokeDeviceToken = function (imsRef, clientId, clientSecret, userAccountGuid, serviceAccountGuid) { |
| 78 | + return window.__adobe_cep__.imsFetchAccessToken(imsRef, clientId, clientSecret, userAccountGuid, serviceAccountGuid, "REVOKE"); |
| 79 | + }; |
| 80 | + IMSInterface.prototype.imsSetProxyCredentials = function (proxyUsername, proxyPassword) { |
| 81 | + window.__adobe_cep__.imsSetProxyCredentials(proxyUsername, proxyPassword); |
| 82 | + }; |
| 83 | + IMSInterface.prototype.showAAM = function (clientId, clientSecret, redirectUri, userAccountGuid, serviceAccountGuid, scope) { |
| 84 | + return window.__adobe_cep__.showAAM(clientId, clientSecret, redirectUri, userAccountGuid, serviceAccountGuid, scope); |
| 85 | + }; |
| 86 | + IMSInterface.prototype.imsGetCurrentUserId = function () { |
| 87 | + return window.__adobe_cep__.getCurrentImsUserId(); |
| 88 | + }; |
| 89 | + IMSInterface.prototype.imsGetCurrentUserIdHelper = function (callback) { |
| 90 | + var hostEnvironment = JSON.parse(window.__adobe_cep__.getHostEnvironment()); |
| 91 | + var appName = hostEnvironment.appName; |
| 92 | + if ("ILST" === appName) { |
| 93 | + window.__adobe_cep__.evalScript("app.userGUID", function (result) { |
| 94 | + callback(result); |
| 95 | + }); |
| 96 | + } |
| 97 | + else if ("IDSN" === appName) { |
| 98 | + window.__adobe_cep__.evalScript("app.userGuid", function (result) { |
| 99 | + callback(result); |
| 100 | + }); |
| 101 | + } |
| 102 | + else if ("PHSP" === appName || "PHXS" === appName) { |
| 103 | + window.__adobe_cep__.evalScript("var getUserIdPhotoshop = function() {var userId = '';try {var bhnc = app.charIDToTypeID('bhnc');var ref = new ActionReference();ref.putProperty(app.charIDToTypeID('Prpr'), bhnc);ref.putEnumerated(app.charIDToTypeID('capp'), app.charIDToTypeID('Ordn'), app.charIDToTypeID('Trgt'));var appDesc = app.executeActionGet(ref);if (appDesc.hasKey(bhnc)) {userId = appDesc.getString(bhnc);}} catch (e) {}return userId;};", function (result) { |
| 104 | + window.__adobe_cep__.evalScript("getUserIdPhotoshop()", function (result) { |
| 105 | + callback(result); |
| 106 | + }); |
| 107 | + }); |
| 108 | + } |
| 109 | + else { |
| 110 | + var clientId = window.__adobe_cep__.getCurrentImsUserId(); |
| 111 | + callback(clientId); |
| 112 | + } |
| 113 | + }; |
| 114 | + IMSInterface.prototype.imsLogoutUser = function (imsRef, userAccountGuid, clientId) { |
| 115 | + var data = { |
| 116 | + imsRef: imsRef, |
| 117 | + userAccountGuid: userAccountGuid, |
| 118 | + clientId: clientId |
| 119 | + }; |
| 120 | + return JSON.parse(window.__adobe_cep__.invokeSync("imsLogoutUser", JSON.stringify(data))).result; |
| 121 | + }; |
| 122 | + IMSInterface.prototype.imsAttemptSSOJumpWorkflows = function (openBrowser, url, imsRef, clientId, clientSecret, scope, userAccountGuid, targetClientId, targetScope, targetResponseType, targetLocale) { |
| 123 | + var data = { |
| 124 | + openBrowser: openBrowser, |
| 125 | + url: url, |
| 126 | + imsRef: imsRef, |
| 127 | + clientId: clientId, |
| 128 | + clientSecret: clientSecret, |
| 129 | + scope: scope, |
| 130 | + userAccountGuid: userAccountGuid, |
| 131 | + targetClientId: targetClientId, |
| 132 | + targetScope: targetScope, |
| 133 | + targetResponseType: targetResponseType, |
| 134 | + targetLocale: targetLocale |
| 135 | + }; |
| 136 | + return JSON.parse(window.__adobe_cep__.invokeSync("imsAttemptSSOJumpWorkflows", JSON.stringify(data))).result; |
| 137 | + }; |
| 138 | + return IMSInterface; |
| 139 | +}()); |
| 140 | +exports.IMSInterface = IMSInterface; |
| 141 | +(function (IMSInterface) { |
| 142 | + var Events; |
| 143 | + (function (Events) { |
| 144 | + Events["imsFetchAccessTokenWithStatus"] = "com.adobe.csxs.events.internal.ims.FetchAccessTokenWithStatus"; |
| 145 | + Events["imsFetchAccessToken"] = "com.adobe.csxs.events.internal.ims.FetchAccessToken"; |
| 146 | + Events["imsRevokeAccessToken"] = "com.adobe.csxs.events.internal.ims.FetchAccessTokenWithStatus"; |
| 147 | + Events["imsFetchContinueToken"] = "com.adobe.csxs.events.internal.ims.FetchAccessTokenWithStatus"; |
| 148 | + Events["imsAAMIMSStatus"] = "vulcan.SuiteMessage.com.adobe.aam.AAMIMSStatus"; |
| 149 | + Events["imsLogoutUser"] = "com.adobe.csxs.events.internal.ims.LogoutUser"; |
| 150 | + Events["imsSSOStatus"] = "com.adobe.csxs.events.internal.ims.SSOStatus"; |
| 151 | + })(Events = IMSInterface.Events || (IMSInterface.Events = {})); |
| 152 | + var Status; |
| 153 | + (function (Status) { |
| 154 | + Status["IMS_SUCCESS"] = "0"; |
| 155 | + Status["IMS_ERROR_FAILURE"] = "1"; |
| 156 | + Status["IMS_ERROR_INVALID_ARGUMENTS"] = "2"; |
| 157 | + Status["IMS_ERROR_CANCEL"] = "20"; |
| 158 | + Status["IMS_ERROR_TIMEOUT"] = "21"; |
| 159 | + Status["IMS_ERROR_HTTPFAILURE"] = "22"; |
| 160 | + Status["IMS_ERROR_SSLFAILURE"] = "23"; |
| 161 | + Status["IMS_ERROR_AUTH_PROXY_REQUIRED"] = "24"; |
| 162 | + Status["IMS_ERROR_AUTH_PROXY_FAILED"] = "25"; |
| 163 | + Status["IMS_ERROR_IN_ACCESS_IDP"] = "26"; |
| 164 | + Status["IMS_ERROR_ANOTHER_REQUEST_IN_PROCESS"] = "40"; |
| 165 | + Status["IMS_ERROR_IN_READ_USER_DATA"] = "60"; |
| 166 | + Status["IMS_ERROR_IN_SAVE_USER_DATA"] = "61"; |
| 167 | + Status["IMS_ERROR_IN_REMOVE_USER_DATA"] = "62"; |
| 168 | + Status["IMS_ERROR_USER_DATA_NOT_PRESENT"] = "63"; |
| 169 | + Status["IMS_ERROR_IN_READ_DEVICE_TOKEN"] = "64"; |
| 170 | + Status["IMS_ERROR_IN_SAVE_DEVICE_TOKEN"] = "65"; |
| 171 | + Status["IMS_ERROR_IN_REMOVE_DEVICE_TOKEN"] = "66"; |
| 172 | + Status["IMS_ERROR_DEVICE_TOKEN_NOT_PRESENT"] = "67"; |
| 173 | + Status["IMS_ERROR_INVALID_DEVICE_TOKEN"] = "68"; |
| 174 | + Status["IMS_ERROR_CLIENTID_NOT_PRESENT"] = "69"; |
| 175 | + Status["IMS_ERROR_IN_FETCH_USER_ACCOUNTS"] = "70"; |
| 176 | + Status["IMS_ERROR_IN_SAVE_USER_FOR_CLIENTID"] = "71"; |
| 177 | + Status["IMS_ERROR_DEVICE_ID_NOT_PRESENT"] = "72"; |
| 178 | + Status["IMS_ERROR_DEFAULT_USER_FOR_CLIENTID_NOT_PRESENT"] = "73"; |
| 179 | + Status["IMS_ERROR_NO_USER_RECORDS_PRESENT"] = "74"; |
| 180 | + Status["IMS_ERROR_ACCESS_DENIED"] = "80"; |
| 181 | + Status["IMS_ERROR_INVALID_REQUEST"] = "81"; |
| 182 | + Status["IMS_ERROR_INVALID_CLIENT"] = "82"; |
| 183 | + Status["IMS_ERROR_INVALID_GRANT"] = "83"; |
| 184 | + Status["IMS_ERROR_UNAUTHORIZED_CLIENT"] = "84"; |
| 185 | + Status["IMS_ERROR_UNSUPPORTED_RESPONSE_TYPE"] = "85"; |
| 186 | + Status["IMS_ERROR_INVALID_SCOPE"] = "86"; |
| 187 | + Status["IMS_ERROR_UNSUPPORTED_GRANT_TYPE"] = "87"; |
| 188 | + Status["IMS_ERROR_BAD_REQUEST"] = "88"; |
| 189 | + Status["IMS_ERROR_INVALID_CREDENTIALS"] = "89"; |
| 190 | + Status["IMS_ERROR_IN_GET_AUTH_DATA_FROM_IDP"] = "100"; |
| 191 | + Status["IMS_ERROR_IN_GET_DEVICE_TOKEN_FROM_IDP"] = "101"; |
| 192 | + Status["IMS_ERROR_IN_GET_REFRESH_TOKEN_FROM_IDP"] = "102"; |
| 193 | + Status["IMS_ERROR_IN_GET_ACCESS_TOKEN_FROM_IDP"] = "103"; |
| 194 | + Status["IMS_ERROR_IN_GET_PROFILE_DATA_FROM_IDP"] = "104"; |
| 195 | + Status["IMS_ERROR_TOU_CHANGED"] = "120"; |
| 196 | + Status["IMS_ERROR_IN_REVOKE_DEVICE_TOKEN"] = "121"; |
| 197 | + Status["IMS_ERROR_TOU_NOT_CURRENT"] = "122"; |
| 198 | + Status["IMS_ERROR_EVS_INVALID"] = "123"; |
| 199 | + Status["IMS_ERROR_ACCT_ACT_REQ"] = "124"; |
| 200 | + Status["IMS_ERROR_ACCT_DISABLED"] = "125"; |
| 201 | + Status["IMS_ERROR_SUBS_ACT_REQ"] = "126"; |
| 202 | + Status["IMS_ERROR_SUBS_NO_SUB"] = "127"; |
| 203 | + Status["IMS_ERROR_NO_BUDDY_GROUP_FOR_CLIENT"] = "150"; |
| 204 | + Status["IMS_ERROR_CLIENT_REGISTERED_FOR_OTHER_GROUP"] = "151"; |
| 205 | + Status["IMS_ERROR_GROUP_ENTRY_NOT_PRESENT"] = "152"; |
| 206 | + Status["IMS_ERROR_IN_SAVE_GROUP_DATA"] = "153"; |
| 207 | + Status["IMS_ERROR_CNAME_ENTRY_NOT_PRESENT"] = "154"; |
| 208 | + Status["IMS_ERROR_IN_SAVE_BACKOFF_DATA"] = "155"; |
| 209 | + Status["IMSMANAGER_ERROR_EXCEPTION"] = "3000"; |
| 210 | + Status["IMSMANAGER_ERROR_ENCODING"] = "3001"; |
| 211 | + Status["IMSMANAGER_SUCCESS_BROWSER_OPENED"] = "3002"; |
| 212 | + Status["IMSMANAGER_ERROR_BROWSER_FAILED_TO_OPEN"] = "3003"; |
| 213 | + Status["IMS_UNKNOWN_ERROR"] = "0xFFFF"; |
| 214 | + })(Status = IMSInterface.Status || (IMSInterface.Status = {})); |
| 215 | +})(IMSInterface || (IMSInterface = {})); |
| 216 | +exports.IMSInterface = IMSInterface; |
| 217 | +exports.default = IMSInterface; |
0 commit comments