@alba-cars/common-modules 1.4.2 → 1.4.4

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.
@@ -17,6 +17,11 @@ interface VehicleEndpoints extends BaseEndpoint {
17
17
  interface BlogEndpoints extends BaseEndpoint {
18
18
  getOneBySlug: EndpointFunction;
19
19
  }
20
+ type MetaEndpoints = BaseEndpoint & {
21
+ aiGenerateTitle: EndpointFunction;
22
+ aiGenerateDescription: EndpointFunction;
23
+ aiGenerateKeyword: EndpointFunction;
24
+ };
20
25
  type APIEndpointType = {
21
26
  vehicle: VehicleEndpoints;
22
27
  blogs: BlogEndpoints;
@@ -25,7 +30,7 @@ type APIEndpointType = {
25
30
  TestDrive: BaseEndpoint;
26
31
  vehicleMake: BaseEndpoint;
27
32
  vehicleModel: BaseEndpoint;
28
- vehicleMeta: BaseEndpoint;
33
+ vehicleMeta: MetaEndpoints;
29
34
  vehicleInspection: BaseEndpoint;
30
35
  vehicleOrder: BaseEndpoint;
31
36
  vehicleFeatures: BaseEndpoint;
@@ -45,6 +50,9 @@ export declare const UTIL_ENDPOINTS: {
45
50
  media: {
46
51
  createS3Url: string;
47
52
  preprocessMediaUrl: string;
53
+ removeS3Media: string;
54
+ removeVehicleMedia: string;
55
+ removeByIdentifier: string;
48
56
  };
49
57
  };
50
58
  export declare const AUTH_ENDPOINTS: {
@@ -63,6 +63,9 @@ exports.API_ENDPOINTS = {
63
63
  getOne: (id) => `/vehicle-meta-data/${id}`,
64
64
  deleteOne: (id) => `/vehicle-meta-data/${id}`,
65
65
  updateOne: (id) => `/vehicle-meta-data/${id}`,
66
+ aiGenerateTitle: (id) => `/vehicle-meta-data/generate/title/${id}`,
67
+ aiGenerateDescription: (id) => `/vehicle-meta-data/generate/description/${id}`,
68
+ aiGenerateKeyword: (id) => `/vehicle-meta-data/generate/keywords/${id}`,
66
69
  },
67
70
  TestDrive: {
68
71
  getAll: `/test-drive-requests`,
@@ -161,6 +164,9 @@ exports.UTIL_ENDPOINTS = {
161
164
  media: {
162
165
  createS3Url: "/utils/get-upload-url",
163
166
  preprocessMediaUrl: "/utils/process-media",
167
+ removeS3Media: '/utils/remove-s3',
168
+ removeVehicleMedia: '/utils/remove-vehcile-media',
169
+ removeByIdentifier: '/utils/remove-by-identifier'
164
170
  },
165
171
  };
166
172
  exports.AUTH_ENDPOINTS = {
@@ -10,18 +10,23 @@ const BASE_URL = process.env.NEXT_PUBLIC_API_URL;
10
10
  const AUTH_STORAGE_KEY = "auth_tokens";
11
11
  let isRefreshing = false;
12
12
  let refreshSubscribers = [];
13
+ const isServer = typeof window === "undefined";
13
14
  const getTokens = () => {
14
- if (typeof window === "undefined")
15
+ if (isServer)
15
16
  return null;
16
17
  const tokens = localStorage.getItem(AUTH_STORAGE_KEY);
17
18
  return tokens ? JSON.parse(tokens) : null;
18
19
  };
19
20
  exports.getTokens = getTokens;
20
21
  const setTokens = (tokens) => {
22
+ if (isServer)
23
+ return;
21
24
  localStorage.setItem(AUTH_STORAGE_KEY, JSON.stringify(tokens));
22
25
  };
23
26
  exports.setTokens = setTokens;
24
27
  const removeTokens = () => {
28
+ if (isServer)
29
+ return;
25
30
  localStorage.removeItem(AUTH_STORAGE_KEY);
26
31
  };
27
32
  exports.removeTokens = removeTokens;
@@ -4,6 +4,7 @@ export declare class RegisterDTO {
4
4
  password: string;
5
5
  name?: string;
6
6
  phone?: string;
7
+ savedFavoriteVehicles?: string[];
7
8
  static fromPlain(entity: any): RegisterDTO;
8
9
  toPlain(): Record<string, unknown>;
9
10
  validate(): string[];
@@ -11,6 +12,7 @@ export declare class RegisterDTO {
11
12
  export declare class LoginDTO {
12
13
  email: string;
13
14
  password: string;
15
+ savedFavoriteVehicles?: string[];
14
16
  static fromPlain(entity: any): LoginDTO;
15
17
  toPlain(): Record<string, unknown>;
16
18
  validate(): string[];
@@ -41,6 +41,12 @@ __decorate([
41
41
  (0, class_validator_1.IsString)(),
42
42
  __metadata("design:type", String)
43
43
  ], RegisterDTO.prototype, "phone", void 0);
44
+ __decorate([
45
+ (0, class_validator_1.IsOptional)(),
46
+ (0, class_validator_1.IsString)({ each: true }),
47
+ (0, class_validator_1.IsUUID)("4", { each: true }),
48
+ __metadata("design:type", Array)
49
+ ], RegisterDTO.prototype, "savedFavoriteVehicles", void 0);
44
50
  exports.RegisterDTO = RegisterDTO;
45
51
  class LoginDTO {
46
52
  static fromPlain(entity) {
@@ -62,6 +68,12 @@ __decorate([
62
68
  (0, class_validator_1.IsString)(),
63
69
  __metadata("design:type", String)
64
70
  ], LoginDTO.prototype, "password", void 0);
71
+ __decorate([
72
+ (0, class_validator_1.IsOptional)(),
73
+ (0, class_validator_1.IsString)({ each: true }),
74
+ (0, class_validator_1.IsUUID)("4", { each: true }),
75
+ __metadata("design:type", Array)
76
+ ], LoginDTO.prototype, "savedFavoriteVehicles", void 0);
65
77
  exports.LoginDTO = LoginDTO;
66
78
  class AuthResponseDTO {
67
79
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.4.2",
6
+ "version": "1.4.4",
7
7
  "description": "A package containing DTOs, validation classes and common modules and interfaces for Alba Cars",
8
8
  "main": "dist/index.js",
9
9
  "types": "dist/index.d.ts",