@etsoo/appscript 1.4.39 → 1.4.41

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.
@@ -349,5 +349,7 @@ test('Tests for publicApi', async () => {
349
349
  const orgsQuery = await app.orgApi.query({ currentPage: 1, batchSize: 2 });
350
350
  console.log(orgsQuery);
351
351
 
352
+ const cultures = await app.publicApi.supportedCultures();
353
+ expect(cultures?.some((culture) => culture.id === 'zh-Hans')).toBeTruthy();
352
354
  */
353
355
  });
@@ -184,7 +184,7 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
184
184
  * @param api Api
185
185
  * @param handlerFor401 Handler for 401 error
186
186
  */
187
- setApiErrorHandler(api: IApi, handlerFor401?: boolean | (() => void)): void;
187
+ setApiErrorHandler(api: IApi, handlerFor401?: boolean | (() => Promise<void>)): void;
188
188
  /**
189
189
  * Setup Api loading
190
190
  * @param api Api
@@ -453,7 +453,7 @@ export interface IApp {
453
453
  * @param api Api
454
454
  * @param handlerFor401 Handler for 401 error
455
455
  */
456
- setApiErrorHandler(api: IApi, handlerFor401?: boolean): void;
456
+ setApiErrorHandler(api: IApi, handlerFor401?: boolean | (() => Promise<void>)): void;
457
457
  /**
458
458
  * Setup Api loading
459
459
  * @param api Api
@@ -114,6 +114,12 @@ export declare class PublicApi extends BaseApi {
114
114
  * @returns Units
115
115
  */
116
116
  repeatOptions(options?: string[], isJoined?: boolean): ListType[];
117
+ /**
118
+ * Get all supported cultures
119
+ * @param payload Payload
120
+ * @returns Result
121
+ */
122
+ supportedCultures(payload?: IApiPayload<ListType1[]>): Promise<ListType1[] | undefined>;
117
123
  /**
118
124
  * Get all product units
119
125
  * @returns Units
@@ -204,6 +204,14 @@ class PublicApi extends BaseApi_1.BaseApi {
204
204
  options !== null && options !== void 0 ? options : (options = shared_1.DataTypes.getEnumKeys(RepeatOption_1.RepeatOption));
205
205
  return this.units(options, isJoined);
206
206
  }
207
+ /**
208
+ * Get all supported cultures
209
+ * @param payload Payload
210
+ * @returns Result
211
+ */
212
+ supportedCultures(payload) {
213
+ return this.api.get('Public/SupportedCultures', undefined, payload);
214
+ }
207
215
  /**
208
216
  *
209
217
  * Get all product units
@@ -184,7 +184,7 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
184
184
  * @param api Api
185
185
  * @param handlerFor401 Handler for 401 error
186
186
  */
187
- setApiErrorHandler(api: IApi, handlerFor401?: boolean | (() => void)): void;
187
+ setApiErrorHandler(api: IApi, handlerFor401?: boolean | (() => Promise<void>)): void;
188
188
  /**
189
189
  * Setup Api loading
190
190
  * @param api Api
@@ -453,7 +453,7 @@ export interface IApp {
453
453
  * @param api Api
454
454
  * @param handlerFor401 Handler for 401 error
455
455
  */
456
- setApiErrorHandler(api: IApi, handlerFor401?: boolean): void;
456
+ setApiErrorHandler(api: IApi, handlerFor401?: boolean | (() => Promise<void>)): void;
457
457
  /**
458
458
  * Setup Api loading
459
459
  * @param api Api
@@ -114,6 +114,12 @@ export declare class PublicApi extends BaseApi {
114
114
  * @returns Units
115
115
  */
116
116
  repeatOptions(options?: string[], isJoined?: boolean): ListType[];
117
+ /**
118
+ * Get all supported cultures
119
+ * @param payload Payload
120
+ * @returns Result
121
+ */
122
+ supportedCultures(payload?: IApiPayload<ListType1[]>): Promise<ListType1[] | undefined>;
117
123
  /**
118
124
  * Get all product units
119
125
  * @returns Units
@@ -201,6 +201,14 @@ export class PublicApi extends BaseApi {
201
201
  options !== null && options !== void 0 ? options : (options = DataTypes.getEnumKeys(RepeatOption));
202
202
  return this.units(options, isJoined);
203
203
  }
204
+ /**
205
+ * Get all supported cultures
206
+ * @param payload Payload
207
+ * @returns Result
208
+ */
209
+ supportedCultures(payload) {
210
+ return this.api.get('Public/SupportedCultures', undefined, payload);
211
+ }
204
212
  /**
205
213
  *
206
214
  * Get all product units
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/appscript",
3
- "version": "1.4.39",
3
+ "version": "1.4.41",
4
4
  "description": "Applications shared TypeScript framework",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -459,7 +459,7 @@ export abstract class CoreApp<
459
459
  */
460
460
  public setApiErrorHandler(
461
461
  api: IApi,
462
- handlerFor401?: boolean | (() => void)
462
+ handlerFor401?: boolean | (() => Promise<void>)
463
463
  ) {
464
464
  api.onError = (error: ApiDataError) => {
465
465
  // Error code
package/src/app/IApp.ts CHANGED
@@ -611,7 +611,10 @@ export interface IApp {
611
611
  * @param api Api
612
612
  * @param handlerFor401 Handler for 401 error
613
613
  */
614
- setApiErrorHandler(api: IApi, handlerFor401?: boolean): void;
614
+ setApiErrorHandler(
615
+ api: IApi,
616
+ handlerFor401?: boolean | (() => Promise<void>)
617
+ ): void;
615
618
 
616
619
  /**
617
620
  * Setup Api loading
@@ -258,6 +258,15 @@ export class PublicApi extends BaseApi {
258
258
  return this.units(options, isJoined);
259
259
  }
260
260
 
261
+ /**
262
+ * Get all supported cultures
263
+ * @param payload Payload
264
+ * @returns Result
265
+ */
266
+ supportedCultures(payload?: IApiPayload<ListType1[]>) {
267
+ return this.api.get('Public/SupportedCultures', undefined, payload);
268
+ }
269
+
261
270
  /**
262
271
  * Get all product units
263
272
  * @returns Units