@etsoo/appscript 1.4.26 → 1.4.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -333,6 +333,11 @@ test('Tests for publicApi', async () => {
333
333
  });
334
334
  expect(defaultExchangeRate?.exchangeRate).toBe(100);
335
335
 
336
+ const url = app.publicApi.getOrgAvatar(1);
337
+ expect(url).toBe(
338
+ 'http://localhost/com.etsoo.SmartERPApi/api/Storage/OrgAvatar/1'
339
+ );
340
+
336
341
  /*
337
342
  const amount1 = await app.publicApi.exchangeAmount(1000, 'NZD', 'CNY');
338
343
  const amount2 = await app.publicApi.exchangeAmount(100, 'NZD', 'USD');
@@ -343,5 +348,6 @@ test('Tests for publicApi', async () => {
343
348
 
344
349
  const orgsQuery = await app.orgApi.query({ currentPage: 1, batchSize: 2 });
345
350
  console.log(orgsQuery);
351
+
346
352
  */
347
353
  });
@@ -1299,7 +1299,9 @@ class CoreApp {
1299
1299
  * @param tryLogin Try to login again
1300
1300
  */
1301
1301
  toLoginPage(tryLogin) {
1302
- const url = '/' + (tryLogin ? '' : '?tryLogin=false');
1302
+ const url = '/?url=' +
1303
+ encodeURIComponent(location.href) +
1304
+ (tryLogin ? '' : '&tryLogin=false');
1303
1305
  this.navigate(url);
1304
1306
  }
1305
1307
  /**
@@ -63,6 +63,12 @@ export declare class PublicApi extends BaseApi {
63
63
  * @returns Result
64
64
  */
65
65
  exchangeRateHistory(currencies: (Currency | string)[], months?: number, payload?: IApiPayload<ExchangeRateHistoryDto[]>): Promise<ExchangeRateHistoryDto[] | undefined>;
66
+ /**
67
+ * Get organization's avatar URL
68
+ * @param id Organization id
69
+ * @returns Result
70
+ */
71
+ getOrgAvatar(id: number): string;
66
72
  /**
67
73
  * Get currency label
68
74
  * @param currency Currency
@@ -118,6 +118,14 @@ class PublicApi extends BaseApi_1.BaseApi {
118
118
  payload !== null && payload !== void 0 ? payload : (payload = { defaultValue: [] });
119
119
  return this.api.post('Public/ExchangeRateHistory', { currencies, months }, payload);
120
120
  }
121
+ /**
122
+ * Get organization's avatar URL
123
+ * @param id Organization id
124
+ * @returns Result
125
+ */
126
+ getOrgAvatar(id) {
127
+ return `${this.api.baseUrl}Storage/OrgAvatar/${id}`;
128
+ }
121
129
  /**
122
130
  * Get currency label
123
131
  * @param currency Currency
@@ -1273,7 +1273,9 @@ export class CoreApp {
1273
1273
  * @param tryLogin Try to login again
1274
1274
  */
1275
1275
  toLoginPage(tryLogin) {
1276
- const url = '/' + (tryLogin ? '' : '?tryLogin=false');
1276
+ const url = '/?url=' +
1277
+ encodeURIComponent(location.href) +
1278
+ (tryLogin ? '' : '&tryLogin=false');
1277
1279
  this.navigate(url);
1278
1280
  }
1279
1281
  /**
@@ -63,6 +63,12 @@ export declare class PublicApi extends BaseApi {
63
63
  * @returns Result
64
64
  */
65
65
  exchangeRateHistory(currencies: (Currency | string)[], months?: number, payload?: IApiPayload<ExchangeRateHistoryDto[]>): Promise<ExchangeRateHistoryDto[] | undefined>;
66
+ /**
67
+ * Get organization's avatar URL
68
+ * @param id Organization id
69
+ * @returns Result
70
+ */
71
+ getOrgAvatar(id: number): string;
66
72
  /**
67
73
  * Get currency label
68
74
  * @param currency Currency
@@ -115,6 +115,14 @@ export class PublicApi extends BaseApi {
115
115
  payload !== null && payload !== void 0 ? payload : (payload = { defaultValue: [] });
116
116
  return this.api.post('Public/ExchangeRateHistory', { currencies, months }, payload);
117
117
  }
118
+ /**
119
+ * Get organization's avatar URL
120
+ * @param id Organization id
121
+ * @returns Result
122
+ */
123
+ getOrgAvatar(id) {
124
+ return `${this.api.baseUrl}Storage/OrgAvatar/${id}`;
125
+ }
118
126
  /**
119
127
  * Get currency label
120
128
  * @param currency Currency
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/appscript",
3
- "version": "1.4.26",
3
+ "version": "1.4.28",
4
4
  "description": "Applications shared TypeScript framework",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -1667,7 +1667,10 @@ export abstract class CoreApp<
1667
1667
  * @param tryLogin Try to login again
1668
1668
  */
1669
1669
  toLoginPage(tryLogin?: boolean) {
1670
- const url = '/' + (tryLogin ? '' : '?tryLogin=false');
1670
+ const url =
1671
+ '/?url=' +
1672
+ encodeURIComponent(location.href) +
1673
+ (tryLogin ? '' : '&tryLogin=false');
1671
1674
  this.navigate(url);
1672
1675
  }
1673
1676
 
@@ -158,6 +158,15 @@ export class PublicApi extends BaseApi {
158
158
  );
159
159
  }
160
160
 
161
+ /**
162
+ * Get organization's avatar URL
163
+ * @param id Organization id
164
+ * @returns Result
165
+ */
166
+ getOrgAvatar(id: number) {
167
+ return `${this.api.baseUrl}Storage/OrgAvatar/${id}`;
168
+ }
169
+
161
170
  /**
162
171
  * Get currency label
163
172
  * @param currency Currency