@crowdin/app-project-module 0.28.3 → 0.28.5

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.
@@ -1,5 +1,5 @@
1
1
  import { Request, Response } from 'express';
2
- import { Config, ExtendedResult, Logger } from '../models';
2
+ import { Config, ExtendedResult, Logger, ImagePath } from '../models';
3
3
  export declare class CodeError extends Error {
4
4
  code: number | undefined;
5
5
  constructor(message: string, code?: number);
@@ -12,3 +12,4 @@ export declare function encryptData(config: Config, data: string): string;
12
12
  export declare function decryptData(config: Config, data: string): string;
13
13
  export declare function executeWithRetry<T>(func: () => Promise<T>, numOfRetries?: number): Promise<T>;
14
14
  export declare function isExtendedResultType<T>(data?: T | ExtendedResult<T>): data is ExtendedResult<T>;
15
+ export declare function getLogoUrl(config: Config, moduleConfig?: ImagePath, modulePath?: string): string;
package/out/util/index.js CHANGED
@@ -32,7 +32,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
32
32
  });
33
33
  };
34
34
  Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.isExtendedResultType = exports.executeWithRetry = exports.decryptData = exports.encryptData = exports.logError = exports.runAsyncWrapper = exports.getMessage = exports.log = exports.CodeError = void 0;
35
+ exports.getLogoUrl = exports.isExtendedResultType = exports.executeWithRetry = exports.decryptData = exports.encryptData = exports.logError = exports.runAsyncWrapper = exports.getMessage = exports.log = exports.CodeError = void 0;
36
36
  const crypto = __importStar(require("crypto-js"));
37
37
  const storage_1 = require("../storage");
38
38
  class CodeError extends Error {
@@ -133,3 +133,13 @@ function isExtendedResultType(data) {
133
133
  return !!dataTyped && !Array.isArray(dataTyped);
134
134
  }
135
135
  exports.isExtendedResultType = isExtendedResultType;
136
+ function getFileExtension(filePath) {
137
+ return filePath.split('.').pop();
138
+ }
139
+ function getLogoUrl(config, moduleConfig, modulePath) {
140
+ if (!moduleConfig && !modulePath) {
141
+ return `/logo.${getFileExtension(config.imagePath)}`;
142
+ }
143
+ return `/logo${modulePath}/logo.${getFileExtension((moduleConfig === null || moduleConfig === void 0 ? void 0 : moduleConfig.imagePath) || config.imagePath)}`;
144
+ }
145
+ exports.getLogoUrl = getLogoUrl;
@@ -150,7 +150,12 @@
150
150
  })
151
151
  )
152
152
  .then(checkResponse)
153
- .then(res => openOAuthPopup(res.url));
153
+ .then(res => openOAuthPopup(res.url))
154
+ .catch(e => {
155
+ loginButton.setAttribute('disabled', false);
156
+ loginButton.setAttribute('is-loading', false);
157
+ catchRejection(e, 'Can\'t get oauth token');
158
+ });
154
159
  }
155
160
 
156
161
  function openOAuthPopup(url) {
@@ -238,4 +243,4 @@
238
243
 
239
244
  </script>
240
245
 
241
- </html>
246
+ </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crowdin/app-project-module",
3
- "version": "0.28.3",
3
+ "version": "0.28.5",
4
4
  "description": "Module that generates for you all common endpoints for serving standalone Crowdin App",
5
5
  "main": "out/index.js",
6
6
  "types": "out/index.d.ts",
@@ -30,12 +30,12 @@
30
30
  "@babel/preset-react": "^7.18.6",
31
31
  "@emotion/react": "^11.10.6",
32
32
  "@emotion/styled": "^11.10.6",
33
- "@mui/icons-material": "^5.11.11",
33
+ "@mui/icons-material": "^5.11.16",
34
34
  "@mui/material": "^5.11.12",
35
35
  "@rjsf/core": "^5.2.0",
36
36
  "@rjsf/mui": "^5.2.0",
37
- "@rjsf/utils": "^5.2.0",
38
- "@rjsf/validator-ajv8": "^5.2.0",
37
+ "@rjsf/utils": "^5.6.2",
38
+ "@rjsf/validator-ajv8": "^5.6.2",
39
39
  "@rollup/plugin-babel": "^6.0.3",
40
40
  "@rollup/plugin-commonjs": "^24.0.1",
41
41
  "@rollup/plugin-json": "^6.0.0",
@@ -45,7 +45,7 @@
45
45
  "@types/crypto-js": "^4.0.0",
46
46
  "@types/express": "4.17.17",
47
47
  "@types/express-handlebars": "^5.3.1",
48
- "@types/jest": "^29.5.0",
48
+ "@types/jest": "^29.5.1",
49
49
  "@types/node": "^12.20.55",
50
50
  "@types/node-cron": "^3.0.7",
51
51
  "@typescript-eslint/eslint-plugin": "^2.3.1",
@@ -55,7 +55,7 @@
55
55
  "eslint-plugin-prettier": "^3.1.1",
56
56
  "jest": "^29.5.0",
57
57
  "jest-junit": "^15.0.0",
58
- "prettier": "^2.8.1",
58
+ "prettier": "^2.8.8",
59
59
  "react": "^18.2.0",
60
60
  "react-dom": "^18.2.0",
61
61
  "rollup": "^3.20.2",