@wrcb/cb-common 1.0.736 → 1.0.738

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.
@@ -0,0 +1,3 @@
1
+ import { Request, Response, NextFunction } from 'express';
2
+ import { BadRequestError } from '../server';
3
+ export declare const requireRightApiVersion: (req: Request, res: Response, next: NextFunction) => BadRequestError | Response<any, Record<string, any>> | undefined;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.requireRightApiVersion = void 0;
4
+ const server_1 = require("../server");
5
+ const requireRightApiVersion = (req, res, next) => {
6
+ try {
7
+ const tenant = req.headers['x-tenant'];
8
+ if (!tenant)
9
+ return new server_1.BadRequestError('ProvideTenant');
10
+ const tenantData = server_1.TenantDataService.getTenantData(tenant);
11
+ const backendApiVersion = tenantData.BACKEND_API_VERSION;
12
+ const appVersion = req.headers['x-app-version'];
13
+ if (appVersion && appVersion !== backendApiVersion) {
14
+ return res.status(426).json({
15
+ errors: [{ message: 'AppUpdateRequired' }],
16
+ backendApiVersion,
17
+ currentVersion: appVersion
18
+ });
19
+ }
20
+ }
21
+ catch (e) { }
22
+ next();
23
+ };
24
+ exports.requireRightApiVersion = requireRightApiVersion;
@@ -66,6 +66,7 @@ export interface RatingCriteria {
66
66
  }
67
67
  export interface TenantData {
68
68
  TENANT: Tenant;
69
+ BACKEND_API_VERSION: string;
69
70
  SITE_NAME: string;
70
71
  SITE_URL: string;
71
72
  SITE_WHATSAPP_SUPPORT: string;
@@ -271,10 +271,11 @@ exports.TenantDataService = TenantDataService;
271
271
  TenantDataService.tenantDataMap = {
272
272
  [tenant_1.Tenant.PoliticaBet]: {
273
273
  TENANT: tenant_1.Tenant.PoliticaBet,
274
+ BACKEND_API_VERSION: '1',
274
275
  SITE_NAME: 'PoliticaBet',
275
276
  SITE_URL: 'https://politicabet.com',
276
277
  SITE_WHATSAPP_SUPPORT: '37988083717',
277
- SITE_WHATSAPP_BOT: '11921974030',
278
+ SITE_WHATSAPP_BOT: '5511921974030',
278
279
  WHATSAPP_BOT_NUMBER_ID: '970274559506875',
279
280
  WHATSAPP_TOKEN: '',
280
281
  WHATSAPP_API_URL: 'https://graph.facebook.com',
@@ -355,10 +356,11 @@ TenantDataService.tenantDataMap = {
355
356
  },
356
357
  [tenant_1.Tenant.TourismApp]: {
357
358
  TENANT: tenant_1.Tenant.TourismApp,
359
+ BACKEND_API_VERSION: '1',
358
360
  SITE_NAME: 'Tourism Site',
359
361
  SITE_URL: 'https://tourism.dev',
360
362
  SITE_WHATSAPP_SUPPORT: '37988083717',
361
- SITE_WHATSAPP_BOT: '11921974030',
363
+ SITE_WHATSAPP_BOT: '5511921974030',
362
364
  WHATSAPP_BOT_NUMBER_ID: '970274559506875',
363
365
  WHATSAPP_TOKEN: '',
364
366
  WHATSAPP_API_URL: 'https://graph.facebook.com',
@@ -439,10 +441,11 @@ TenantDataService.tenantDataMap = {
439
441
  },
440
442
  [tenant_1.Tenant.PrivateShow]: {
441
443
  TENANT: tenant_1.Tenant.PrivateShow,
444
+ BACKEND_API_VERSION: '1',
442
445
  SITE_NAME: 'Private Show',
443
446
  SITE_URL: 'https://privateshow.com.br',
444
447
  SITE_WHATSAPP_SUPPORT: '37988083717',
445
- SITE_WHATSAPP_BOT: '11921974030',
448
+ SITE_WHATSAPP_BOT: '5511921974030',
446
449
  WHATSAPP_BOT_NUMBER_ID: '970274559506875',
447
450
  WHATSAPP_TOKEN: '',
448
451
  WHATSAPP_API_URL: 'https://graph.facebook.com',
@@ -509,10 +512,11 @@ TenantDataService.tenantDataMap = {
509
512
  },
510
513
  [tenant_1.Tenant.PromoApp]: {
511
514
  TENANT: tenant_1.Tenant.PromoApp,
515
+ BACKEND_API_VERSION: '1',
512
516
  SITE_NAME: 'Promo app',
513
517
  SITE_URL: 'https://promoapp.com.br',
514
518
  SITE_WHATSAPP_SUPPORT: '37988083717',
515
- SITE_WHATSAPP_BOT: '11921974030',
519
+ SITE_WHATSAPP_BOT: '5511921974030',
516
520
  WHATSAPP_BOT_NUMBER_ID: '970274559506875',
517
521
  WHATSAPP_TOKEN: '',
518
522
  WHATSAPP_API_URL: 'https://graph.facebook.com',
@@ -561,10 +565,11 @@ TenantDataService.tenantDataMap = {
561
565
  },
562
566
  [tenant_1.Tenant.Compranomia]: {
563
567
  TENANT: tenant_1.Tenant.Compranomia,
568
+ BACKEND_API_VERSION: '1',
564
569
  SITE_NAME: 'Compranomia',
565
570
  SITE_URL: 'https://compranomia.com.br',
566
571
  SITE_WHATSAPP_SUPPORT: '37988083717',
567
- SITE_WHATSAPP_BOT: '11921974030',
572
+ SITE_WHATSAPP_BOT: '5511921974030',
568
573
  WHATSAPP_BOT_NUMBER_ID: '970274559506875',
569
574
  WHATSAPP_TOKEN: 'EAAWmZCkXuYDcBQspVZCCE4gzZBI4x9kCy4768IZBAP3rcipZBQaGsJeuvmwniEqwoZATRFyv44ZCvZCwQslD4RXvZA0whuGR3nesfMti3Px4TsoslH29MwqfpWYPJrQk4PwU7gKtawijVSHY6LYhNqLXI4dqmJtgGbWAgAAfSDjhtXf6LCkM0fp5dpdlfVjqg8wZDZD',
570
575
  WHATSAPP_API_URL: 'https://graph.facebook.com',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrcb/cb-common",
3
- "version": "1.0.736",
3
+ "version": "1.0.738",
4
4
  "description": "Common resources between services",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",