@crowdin/app-project-module 0.28.7 → 0.28.9

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.
@@ -46,12 +46,12 @@ function prepareCrowdinRequest(jwtToken, config, optional = false, checkSubscrip
46
46
  exports.prepareCrowdinRequest = prepareCrowdinRequest;
47
47
  function handle(config, optional = false, checkSubscriptionExpiration = true) {
48
48
  return (0, util_1.runAsyncWrapper)((req, res, next) => __awaiter(this, void 0, void 0, function* () {
49
- const tokenJwt = getToken(req);
50
- if (!tokenJwt) {
49
+ const jwtToken = getToken(req);
50
+ if (!jwtToken) {
51
51
  return res.status(403).send({ error: 'Access denied' });
52
52
  }
53
53
  try {
54
- const data = yield prepareCrowdinRequest(tokenJwt, config, optional, checkSubscriptionExpiration);
54
+ const data = yield prepareCrowdinRequest(jwtToken, config, optional, checkSubscriptionExpiration);
55
55
  req.crowdinContext = data.context;
56
56
  if (data.client) {
57
57
  req.crowdinApiClient = data.client;
@@ -76,9 +76,9 @@ function handle(config, optional = false, checkSubscriptionExpiration = true) {
76
76
  }
77
77
  exports.default = handle;
78
78
  function getToken(req) {
79
- const tokenJwt = (req.query.tokenJwt || req.query.jwtToken);
80
- if (tokenJwt) {
81
- return tokenJwt;
79
+ const jwtToken = req.query.jwtToken;
80
+ if (jwtToken) {
81
+ return jwtToken;
82
82
  }
83
83
  if (req.headers.authorization) {
84
84
  if (req.headers.authorization.startsWith('Bearer ') || req.headers.authorization.startsWith('bearer ')) {
@@ -19,12 +19,12 @@ function handle(config, allowUnauthorized = false) {
19
19
  next();
20
20
  return;
21
21
  }
22
- const tokenJwt = req.query.tokenJwt;
23
- if (!tokenJwt) {
22
+ const jwtToken = req.query.jwtToken;
23
+ if (!jwtToken) {
24
24
  return res.status(403).send({ error: 'Access denied' });
25
25
  }
26
26
  (0, util_1.log)('Validating jwt token from incoming request', config.logger);
27
- const jwtPayload = yield (0, crowdin_apps_functions_1.validateJwtToken)(tokenJwt, config.clientSecret, config.jwtValidationOptions);
27
+ const jwtPayload = yield (0, crowdin_apps_functions_1.validateJwtToken)(jwtToken, config.clientSecret, config.jwtValidationOptions);
28
28
  const id = `${jwtPayload.domain || jwtPayload.context.organization_id}`;
29
29
  (0, util_1.log)('Loading crowdin credentials', config.logger);
30
30
  const credentials = yield (0, storage_1.getStorage)().getCrowdinCredentials(id);
@@ -270,9 +270,10 @@ export interface IntegrationLogic {
270
270
  */
271
271
  webhooks?: Webhooks;
272
272
  }
273
- export type FormEntity = FormField | FormDelimeter;
274
- export interface FormDelimeter {
275
- label: string;
273
+ export type FormEntity = FormField | FormDelimiter;
274
+ export interface FormDelimiter {
275
+ label?: string;
276
+ labelHtml?: string;
276
277
  }
277
278
  export interface LoginForm {
278
279
  fields: FormEntity[];