@alba-cars/common-modules 1.5.7 → 1.5.8
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/core/utils/formatCurrency.d.ts +11 -0
- package/dist/core/utils/formatCurrency.js +39 -0
- package/dist/core/utils/index.d.ts +1 -0
- package/dist/core/utils/index.js +1 -0
- package/dist/features/google-review/data/dto/google_review_dto.d.ts +1 -0
- package/dist/features/google-review/data/dto/google_review_dto.js +5 -0
- package/dist/features/lead/data/dto/lead_prefernce_dto.d.ts +7 -0
- package/dist/features/lead/data/dto/lead_prefernce_dto.js +36 -0
- package/dist/features/sales-team/data/dto/SalesAgentDTO.d.ts +1 -0
- package/dist/features/sales-team/data/dto/SalesAgentDTO.js +5 -0
- package/package.json +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formats a number as UAE Dirham (AED) currency with proper comma separation
|
|
3
|
+
* @param amount The numeric value to be formatted
|
|
4
|
+
* @param options Optional configuration for formatting
|
|
5
|
+
* @returns Formatted currency string
|
|
6
|
+
*/
|
|
7
|
+
export declare const formatCurrency: (amount?: number | null, options?: {
|
|
8
|
+
currency?: string;
|
|
9
|
+
minimumFractionDigits?: number;
|
|
10
|
+
maximumFractionDigits?: number;
|
|
11
|
+
}) => string;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatCurrency = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Formats a number as UAE Dirham (AED) currency with proper comma separation
|
|
6
|
+
* @param amount The numeric value to be formatted
|
|
7
|
+
* @param options Optional configuration for formatting
|
|
8
|
+
* @returns Formatted currency string
|
|
9
|
+
*/
|
|
10
|
+
const formatCurrency = (amount, options = {}) => {
|
|
11
|
+
// If amount is null or undefined, return 'N/A'
|
|
12
|
+
if (amount == null)
|
|
13
|
+
return 'N/A';
|
|
14
|
+
// Default options
|
|
15
|
+
const { currency = 'AED', minimumFractionDigits = 0, maximumFractionDigits = 0 } = options;
|
|
16
|
+
try {
|
|
17
|
+
// Use English locale to ensure consistent formatting
|
|
18
|
+
const formatter = new Intl.NumberFormat('en-US', {
|
|
19
|
+
minimumFractionDigits,
|
|
20
|
+
maximumFractionDigits,
|
|
21
|
+
useGrouping: true
|
|
22
|
+
});
|
|
23
|
+
// Format the number with comma separation
|
|
24
|
+
const formattedAmount = formatter.format(amount);
|
|
25
|
+
// Prepend AED to the formatted amount
|
|
26
|
+
return `AED ${formattedAmount}`;
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
// Fallback formatting if Intl.NumberFormat fails
|
|
30
|
+
console.warn('Currency formatting failed, using basic formatting', error);
|
|
31
|
+
// Basic fallback formatting
|
|
32
|
+
const baseFormatted = amount.toLocaleString('en-US', {
|
|
33
|
+
minimumFractionDigits,
|
|
34
|
+
maximumFractionDigits
|
|
35
|
+
});
|
|
36
|
+
return `AED ${baseFormatted}`;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
exports.formatCurrency = formatCurrency;
|
package/dist/core/utils/index.js
CHANGED
|
@@ -17,3 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./global-utils"), exports);
|
|
18
18
|
__exportStar(require("./global-constants"), exports);
|
|
19
19
|
__exportStar(require("./global_validators"), exports);
|
|
20
|
+
__exportStar(require("./formatCurrency"), exports);
|
|
@@ -108,6 +108,11 @@ class GoogleReviewResponseDTO {
|
|
|
108
108
|
exports.GoogleReviewResponseDTO = GoogleReviewResponseDTO;
|
|
109
109
|
class ReviewGetDTO {
|
|
110
110
|
}
|
|
111
|
+
__decorate([
|
|
112
|
+
(0, class_validator_1.IsString)(),
|
|
113
|
+
(0, class_validator_1.IsOptional)(),
|
|
114
|
+
__metadata("design:type", String)
|
|
115
|
+
], ReviewGetDTO.prototype, "id", void 0);
|
|
111
116
|
__decorate([
|
|
112
117
|
(0, class_validator_1.IsString)(),
|
|
113
118
|
(0, class_validator_1.IsOptional)(),
|
|
@@ -8,6 +8,8 @@ export declare class LeadPreferencesDTO {
|
|
|
8
8
|
preferredModel?: string;
|
|
9
9
|
preferredYearMin?: number;
|
|
10
10
|
preferredYearMax?: number;
|
|
11
|
+
mileageMin?: number;
|
|
12
|
+
mileageMax?: number;
|
|
11
13
|
preferredColors?: string[];
|
|
12
14
|
preferredFeatures?: string[];
|
|
13
15
|
additionalPreferences?: string;
|
|
@@ -22,6 +24,8 @@ export declare class LeadPreferencesUpdateDTO {
|
|
|
22
24
|
preferredModel?: string;
|
|
23
25
|
preferredYearMin?: number;
|
|
24
26
|
preferredYearMax?: number;
|
|
27
|
+
mileageMin?: number;
|
|
28
|
+
mileageMax?: number;
|
|
25
29
|
preferredColors?: string[];
|
|
26
30
|
preferredFeatures?: string[];
|
|
27
31
|
additionalPreferences?: string;
|
|
@@ -36,6 +40,8 @@ export declare class LeadPreferencesCreateDTO {
|
|
|
36
40
|
preferredModel?: string;
|
|
37
41
|
preferredYearMin?: number;
|
|
38
42
|
preferredYearMax?: number;
|
|
43
|
+
mileageMin?: number;
|
|
44
|
+
mileageMax?: number;
|
|
39
45
|
preferredColors?: string[];
|
|
40
46
|
preferredFeatures?: string[];
|
|
41
47
|
additionalPreferences?: string;
|
|
@@ -49,6 +55,7 @@ export declare class LeadPreferencesFilter extends TypedFilter {
|
|
|
49
55
|
make?: string;
|
|
50
56
|
model?: string;
|
|
51
57
|
yearRange?: Range;
|
|
58
|
+
mileageRange?: Range;
|
|
52
59
|
colors?: string[];
|
|
53
60
|
features?: string[];
|
|
54
61
|
search?: string;
|
|
@@ -60,6 +60,16 @@ __decorate([
|
|
|
60
60
|
(0, class_validator_1.IsNumber)(),
|
|
61
61
|
__metadata("design:type", Number)
|
|
62
62
|
], LeadPreferencesDTO.prototype, "preferredYearMax", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
(0, class_validator_1.IsOptional)(),
|
|
65
|
+
(0, class_validator_1.IsNumber)(),
|
|
66
|
+
__metadata("design:type", Number)
|
|
67
|
+
], LeadPreferencesDTO.prototype, "mileageMin", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
(0, class_validator_1.IsOptional)(),
|
|
70
|
+
(0, class_validator_1.IsNumber)(),
|
|
71
|
+
__metadata("design:type", Number)
|
|
72
|
+
], LeadPreferencesDTO.prototype, "mileageMax", void 0);
|
|
63
73
|
__decorate([
|
|
64
74
|
(0, class_validator_1.IsOptional)(),
|
|
65
75
|
(0, class_validator_1.IsArray)(),
|
|
@@ -120,6 +130,16 @@ __decorate([
|
|
|
120
130
|
(0, class_validator_1.IsNumber)(),
|
|
121
131
|
__metadata("design:type", Number)
|
|
122
132
|
], LeadPreferencesUpdateDTO.prototype, "preferredYearMax", void 0);
|
|
133
|
+
__decorate([
|
|
134
|
+
(0, class_validator_1.IsOptional)(),
|
|
135
|
+
(0, class_validator_1.IsNumber)(),
|
|
136
|
+
__metadata("design:type", Number)
|
|
137
|
+
], LeadPreferencesUpdateDTO.prototype, "mileageMin", void 0);
|
|
138
|
+
__decorate([
|
|
139
|
+
(0, class_validator_1.IsOptional)(),
|
|
140
|
+
(0, class_validator_1.IsNumber)(),
|
|
141
|
+
__metadata("design:type", Number)
|
|
142
|
+
], LeadPreferencesUpdateDTO.prototype, "mileageMax", void 0);
|
|
123
143
|
__decorate([
|
|
124
144
|
(0, class_validator_1.IsOptional)(),
|
|
125
145
|
(0, class_validator_1.IsArray)(),
|
|
@@ -180,6 +200,16 @@ __decorate([
|
|
|
180
200
|
(0, class_validator_1.IsNumber)(),
|
|
181
201
|
__metadata("design:type", Number)
|
|
182
202
|
], LeadPreferencesCreateDTO.prototype, "preferredYearMax", void 0);
|
|
203
|
+
__decorate([
|
|
204
|
+
(0, class_validator_1.IsOptional)(),
|
|
205
|
+
(0, class_validator_1.IsNumber)(),
|
|
206
|
+
__metadata("design:type", Number)
|
|
207
|
+
], LeadPreferencesCreateDTO.prototype, "mileageMin", void 0);
|
|
208
|
+
__decorate([
|
|
209
|
+
(0, class_validator_1.IsOptional)(),
|
|
210
|
+
(0, class_validator_1.IsNumber)(),
|
|
211
|
+
__metadata("design:type", Number)
|
|
212
|
+
], LeadPreferencesCreateDTO.prototype, "mileageMax", void 0);
|
|
183
213
|
__decorate([
|
|
184
214
|
(0, class_validator_1.IsOptional)(),
|
|
185
215
|
(0, class_validator_1.IsArray)(),
|
|
@@ -227,6 +257,12 @@ __decorate([
|
|
|
227
257
|
(0, class_transformer_1.Type)(() => core_1.Range),
|
|
228
258
|
__metadata("design:type", core_1.Range)
|
|
229
259
|
], LeadPreferencesFilter.prototype, "yearRange", void 0);
|
|
260
|
+
__decorate([
|
|
261
|
+
(0, class_validator_1.IsOptional)(),
|
|
262
|
+
(0, class_validator_1.ValidateNested)(),
|
|
263
|
+
(0, class_transformer_1.Type)(() => core_1.Range),
|
|
264
|
+
__metadata("design:type", core_1.Range)
|
|
265
|
+
], LeadPreferencesFilter.prototype, "mileageRange", void 0);
|
|
230
266
|
__decorate([
|
|
231
267
|
(0, class_validator_1.IsOptional)(),
|
|
232
268
|
(0, class_validator_1.IsArray)(),
|
|
@@ -26,6 +26,11 @@ class SalesAgentGetDTO {
|
|
|
26
26
|
return (0, class_transformer_1.classToPlain)(this);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, class_validator_1.IsOptional)(),
|
|
31
|
+
(0, class_validator_1.IsString)(),
|
|
32
|
+
__metadata("design:type", String)
|
|
33
|
+
], SalesAgentGetDTO.prototype, "photo", void 0);
|
|
29
34
|
exports.SalesAgentGetDTO = SalesAgentGetDTO;
|
|
30
35
|
class SalesAgentCreateDTO {
|
|
31
36
|
constructor() {
|
package/package.json
CHANGED