Skip to content

Commit 75e9e49

Browse files
committed
Update abp.js and abp.d.ts to abp-web-resources 5.1.1
1 parent 66a0dcf commit 75e9e49

File tree

4 files changed

+121
-78
lines changed

4 files changed

+121
-78
lines changed

reactjs/src/lib/abp.d.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
declare namespace abp {
1+
declare namespace abp {
22

33
let appPath: string;
44

@@ -111,6 +111,19 @@
111111
function getToken(): string;
112112

113113
function clearToken(): void;
114+
115+
let refreshTokenCookieName: string;
116+
117+
/**
118+
* Saves refreshToken token.
119+
* @param refreshToken The token to be saved.
120+
* @param expireDate Optional expire date. If not specified, token will be deleted at end of the session.
121+
*/
122+
function setRefreshToken(refreshToken: string, expireDate?: Date): void;
123+
124+
function getRefreshToken(): string;
125+
126+
function clearRefreshToken(): void;
114127
}
115128

116129
namespace features {

reactjs/src/lib/abp.js

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var abp = abp || {};
1+
var abp = abp || {};
22
(function () {
33

44
/* Application paths *****************************************/
@@ -55,9 +55,10 @@
5555

5656
/* SESSION */
5757

58-
abp.session = abp.session || {
59-
multiTenancySide: abp.multiTenancy.sides.HOST
60-
};
58+
abp.session = abp.session ||
59+
{
60+
multiTenancySide: abp.multiTenancy.sides.HOST
61+
};
6162

6263
/* LOCALIZATION ***********************************************/
6364
//Implements Localization API that simplifies usage of localization scripts generated by Abp.
@@ -104,9 +105,9 @@
104105

105106
abp.localization.isCurrentCulture = function (name) {
106107
return abp.localization.currentCulture
107-
&& abp.localization.currentCulture.name
108-
&& abp.localization.currentCulture.name.indexOf(name) == 0;
109-
};
108+
&& abp.localization.currentCulture.name
109+
&& abp.localization.currentCulture.name.indexOf(name) == 0;
110+
};
110111

111112
abp.localization.defaultSourceName = undefined;
112113
abp.localization.abpWeb = abp.localization.getSource('AbpWeb');
@@ -137,8 +138,8 @@
137138

138139
abp.auth.isGranted = function (permissionName) {
139140
return abp.auth.allPermissions[permissionName] != undefined &&
140-
abp.auth.grantedPermissions[permissionName] != undefined;
141-
};
141+
abp.auth.grantedPermissions[permissionName] != undefined;
142+
};
142143

143144
abp.auth.isAnyGranted = function () {
144145
if (!arguments || arguments.length <= 0) {
@@ -176,11 +177,25 @@
176177

177178
abp.auth.getToken = function () {
178179
return abp.utils.getCookieValue(abp.auth.tokenCookieName);
179-
}
180+
};
180181

181182
abp.auth.clearToken = function () {
182183
abp.auth.setToken();
183-
}
184+
};
185+
186+
abp.auth.refreshTokenCookieName = 'Abp.AuthRefreshToken';
187+
188+
abp.auth.setRefreshToken = function (refreshToken, expireDate) {
189+
abp.utils.setCookieValue(abp.auth.refreshTokenCookieName, refreshToken, expireDate, abp.appPath, abp.domain);
190+
};
191+
192+
abp.auth.getRefreshToken = function () {
193+
return abp.utils.getCookieValue(abp.auth.refreshTokenCookieName);
194+
};
195+
196+
abp.auth.clearRefreshToken = function () {
197+
abp.auth.setRefreshToken();
198+
};
184199

185200
/* FEATURE SYSTEM *********************************************/
186201
//Implements Features API that simplifies usage of feature scripts generated by Abp.
@@ -280,12 +295,12 @@
280295

281296
abp.notifications.messageFormatters['Abp.Notifications.LocalizableMessageNotificationData'] =
282297
function (userNotification) {
283-
var message = userNotification.notification.data.message ||
284-
userNotification.notification.data.properties.Message;
285-
var localizedMessage = abp.localization.localize(
286-
message.name,
287-
message.sourceName
288-
);
298+
var message = userNotification.notification.data.message ||
299+
userNotification.notification.data.properties.Message;
300+
var localizedMessage = abp.localization.localize(
301+
message.name,
302+
message.sourceName
303+
);
289304

290305
if (userNotification.notification.data.properties) {
291306
var properties = Object.keys(userNotification.notification.data.properties);
@@ -396,7 +411,7 @@
396411

397412
abp.message = abp.message || {};
398413

399-
var showMessage = function (message, title) {
414+
var showMessage = function (message, title, options) {
400415
alert((title || '') + ' ' + message);
401416

402417
};
@@ -510,7 +525,6 @@
510525
};
511526
})();
512527

513-
514528
/* UTILS ***************************************************/
515529

516530
abp.utils = abp.utils || {};
@@ -623,7 +637,6 @@
623637
includeQuestionMark = true;
624638
}
625639

626-
627640
var qs = '';
628641

629642
function addSeperator() {

vue/src/lib/abp.d.ts

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
declare namespace abp {
1+
declare namespace abp {
22

33
let appPath: string;
44

@@ -18,6 +18,8 @@
1818

1919
let isEnabled: boolean;
2020

21+
let ignoreFeatureCheckForHostUsers: boolean;
22+
2123
let tenantIdCookieName: string;
2224

2325
function setTenantIdCookie(tenantId?: number): void;
@@ -109,6 +111,19 @@
109111
function getToken(): string;
110112

111113
function clearToken(): void;
114+
115+
let refreshTokenCookieName: string;
116+
117+
/**
118+
* Saves refreshToken token.
119+
* @param refreshToken The token to be saved.
120+
* @param expireDate Optional expire date. If not specified, token will be deleted at end of the session.
121+
*/
122+
function setRefreshToken(refreshToken: string, expireDate?: Date): void;
123+
124+
function getRefreshToken(): string;
125+
126+
function clearRefreshToken(): void;
112127
}
113128

114129
namespace features {
@@ -293,17 +308,15 @@
293308

294309
//TODO: these methods return jQuery.Promise instead of any. fix it.
295310

296-
function info(message: string, title?: string): any;
297-
298-
function success(message: string, title?: string): any;
311+
function info(message: string, title?: string, options?: any): any;
299312

300-
function warn(message: string, title?: string): any;
313+
function success(message: string, title?: string, options?: any): any;
301314

302-
function error(message: string, title?: string): any;
315+
function warn(message: string, title?: string, options?: any): any;
303316

304-
function confirm(message: string, callback?: (result: boolean) => void): any;
317+
function error(message: string, title?: string, options?: any): any;
305318

306-
function confirm(message: string, title?: string, callback?: (result: boolean) => void): any;
319+
function confirm(message: string, title?: string, callback?: (result: boolean) => void, options?: any): any;
307320

308321
}
309322

0 commit comments

Comments
 (0)