@maioradv/cms-basic-lib 1.3.9 → 1.4.1

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.
package/dist/client.d.ts CHANGED
@@ -21,6 +21,7 @@ export declare class MaiorCmsApiClient implements ClientApiI {
21
21
  protected config: ApiConfigs;
22
22
  protected client: Axios;
23
23
  protected configApi: ValidatedApiConfigs;
24
+ protected accessToken: string;
24
25
  authentication: Auth;
25
26
  apiTokens: ApiTokens;
26
27
  collections: Collections;
@@ -40,6 +41,7 @@ export declare class MaiorCmsApiClient implements ClientApiI {
40
41
  protected _initClient(): Axios;
41
42
  protected _initModules(): void;
42
43
  _setAccessToken(accessToken: string): void;
44
+ _getAccessToken(): string;
43
45
  auth(): Promise<AccessTokenDto>;
44
46
  jwt(accessToken: string): Promise<AccessTokenDto>;
45
47
  }
package/dist/client.js CHANGED
@@ -54,16 +54,22 @@ class MaiorCmsApiClient {
54
54
  }
55
55
  _setAccessToken(accessToken) {
56
56
  this.client.defaults.headers.common[types_1.ApiHeader.Authorization] = `Bearer ${accessToken}`;
57
+ this.accessToken = accessToken;
58
+ }
59
+ _getAccessToken() {
60
+ return this.accessToken;
57
61
  }
58
62
  async auth() {
59
63
  if (!this.configApi.credentials)
60
64
  throw new error_1.AuthError('Missing credentials');
61
65
  const access = this.configApi.credentials.apiToken ? await this.authentication.token(this.configApi.credentials.apiToken) : await this.authentication.jwt(this.configApi.credentials.accessToken);
66
+ this.accessToken = access.access_token;
62
67
  this.client.defaults.headers.common[types_1.ApiHeader.Authorization] = `${access.token_type} ${access.access_token}`;
63
68
  return access;
64
69
  }
65
70
  async jwt(accessToken) {
66
71
  const access = await this.authentication.jwt(accessToken);
72
+ this.accessToken = access.access_token;
67
73
  this.client.defaults.headers.common[types_1.ApiHeader.Authorization] = `${access.token_type} ${access.access_token}`;
68
74
  return access;
69
75
  }
@@ -45,6 +45,7 @@ exports.ConfigsResolvers = {
45
45
  allowLocalization
46
46
  allowPopup
47
47
  allowProductVideo
48
+ allowCustomTheme
48
49
  dashboardId
49
50
  maxMenuCollectionNumber
50
51
  maxProductImageNumber
@@ -2,5 +2,9 @@ import { ApiModule } from "../model";
2
2
  import { CreateImportDto, CreatePdfDto } from "./types";
3
3
  export default class IO extends ApiModule {
4
4
  importExcel(args: CreateImportDto): Promise<void>;
5
+ RNImportExcel(formData: any): Promise<void>;
6
+ exportExcel(): Promise<Buffer>;
7
+ excelModel(): Promise<Buffer>;
5
8
  createPdf(args: CreatePdfDto): Promise<boolean>;
9
+ downloadPdf(): Promise<Buffer>;
6
10
  }
package/dist/io/index.js CHANGED
@@ -9,8 +9,30 @@ class IO extends model_1.ApiModule {
9
9
  }
10
10
  });
11
11
  }
12
+ RNImportExcel(formData) {
13
+ return this._call('post', `/excel`, formData, {
14
+ headers: {
15
+ 'Content-Type': 'multipart/form-data'
16
+ }
17
+ });
18
+ }
19
+ exportExcel() {
20
+ return this._call('get', '/excel', undefined, {
21
+ responseType: 'arraybuffer'
22
+ });
23
+ }
24
+ excelModel() {
25
+ return this._call('get', '/excel/model', undefined, {
26
+ responseType: 'arraybuffer'
27
+ });
28
+ }
12
29
  createPdf(args) {
13
30
  return this._call('post', '/pdf', args);
14
31
  }
32
+ downloadPdf() {
33
+ return this._call('get', '/pdf', undefined, {
34
+ responseType: 'arraybuffer'
35
+ });
36
+ }
15
37
  }
16
38
  exports.default = IO;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maioradv/cms-basic-lib",
3
- "version": "1.3.9",
3
+ "version": "1.4.1",
4
4
  "description": "JS lib for Maior CMS Basic Api",
5
5
  "repository": "https://github.com/maioradv/cms-basic-lib.git",
6
6
  "author": "Maior ADV Srl",