@deallony/shared 1.2.64 → 1.2.69
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/cjs/constants/company/Company.d.ts +12 -0
- package/dist/cjs/constants/company/Company.js +13 -1
- package/dist/cjs/constants/events/Event.js +3 -0
- package/dist/cjs/constants/events/EventPricing.d.ts +44 -0
- package/dist/cjs/constants/events/EventPricing.js +18 -0
- package/dist/cjs/constants/events/index.d.ts +1 -0
- package/dist/cjs/constants/events/index.js +1 -0
- package/dist/cjs/constants/routes/app.d.ts +30 -1
- package/dist/cjs/constants/routes/app.js +7 -1
- package/dist/cjs/dto/ai/gemini-api-key.dto.d.ts +4 -1
- package/dist/cjs/dto/analysis/Analysis.dto.d.ts +4 -0
- package/dist/cjs/dto/analysis/Analysis.dto.js +2 -0
- package/dist/cjs/dto/events/Event.dto.d.ts +3 -1
- package/dist/cjs/dto/index.d.ts +1 -0
- package/dist/cjs/dto/index.js +2 -1
- package/dist/cjs/schema/ad/save-ad.schema.d.ts +35 -0
- package/dist/cjs/schema/ad/save-ad.schema.js +23 -1
- package/dist/cjs/schema/ai/gemini-api-key.schema.d.ts +46 -3
- package/dist/cjs/schema/ai/gemini-api-key.schema.js +36 -9
- package/dist/cjs/schema/analysis/analysis-report.schema.d.ts +17 -0
- package/dist/cjs/schema/analysis/analysis-report.schema.js +29 -0
- package/dist/cjs/schema/analysis/index.d.ts +1 -0
- package/dist/cjs/schema/analysis/index.js +17 -0
- package/dist/cjs/schema/communication/index.d.ts +1 -0
- package/dist/cjs/schema/communication/index.js +1 -0
- package/dist/cjs/schema/communication/offer.schema.d.ts +49 -0
- package/dist/cjs/schema/communication/offer.schema.js +31 -0
- package/dist/cjs/schema/communication/support-ticket.schema.d.ts +3 -3
- package/dist/cjs/schema/events/Event.schema.d.ts +20 -0
- package/dist/cjs/schema/events/Event.schema.js +11 -1
- package/dist/cjs/schema/index.d.ts +1 -0
- package/dist/cjs/schema/index.js +2 -1
- package/dist/cjs/types/ad/Ad.d.ts +27 -1
- package/dist/cjs/types/ad-common/PriceType.d.ts +2 -0
- package/dist/cjs/types/analysis/AnalysisDailySnapshot.d.ts +98 -0
- package/dist/cjs/types/common/MetaData.d.ts +3 -0
- package/dist/cjs/types/communication/Chat.d.ts +30 -1
- package/dist/cjs/types/communication/Chat.js +10 -1
- package/dist/cjs/types/company/Company.d.ts +26 -0
- package/dist/cjs/types/events/Event.d.ts +8 -0
- package/dist/cjs/types/integrations/GeminiApiKey.d.ts +11 -2
- package/dist/cjs/utils/analysis.d.ts +7 -0
- package/dist/cjs/utils/analysis.js +14 -0
- package/dist/cjs/utils/index.d.ts +2 -0
- package/dist/cjs/utils/index.js +2 -0
- package/dist/cjs/utils/rentPrices.d.ts +8 -0
- package/dist/cjs/utils/rentPrices.js +33 -0
- package/dist/esm/constants/company/Company.js +12 -0
- package/dist/esm/constants/events/Event.js +3 -0
- package/dist/esm/constants/events/EventPricing.js +15 -0
- package/dist/esm/constants/events/index.js +1 -0
- package/dist/esm/constants/routes/app.js +7 -1
- package/dist/esm/dto/analysis/Analysis.dto.js +1 -0
- package/dist/esm/dto/index.js +1 -0
- package/dist/esm/schema/ad/save-ad.schema.js +22 -0
- package/dist/esm/schema/ai/gemini-api-key.schema.js +35 -8
- package/dist/esm/schema/analysis/analysis-report.schema.js +26 -0
- package/dist/esm/schema/analysis/index.js +1 -0
- package/dist/esm/schema/communication/index.js +1 -0
- package/dist/esm/schema/communication/offer.schema.js +28 -0
- package/dist/esm/schema/events/Event.schema.js +11 -1
- package/dist/esm/schema/index.js +1 -0
- package/dist/esm/types/communication/Chat.js +9 -0
- package/dist/esm/utils/analysis.js +10 -0
- package/dist/esm/utils/index.js +2 -0
- package/dist/esm/utils/rentPrices.js +26 -0
- package/package.json +58 -58
|
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./ai-conversation.schema"), exports);
|
|
18
18
|
__exportStar(require("./support-ticket.schema"), exports);
|
|
19
|
+
__exportStar(require("./offer.schema"), exports);
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const offerStatusSchema: z.ZodEnum<{
|
|
3
|
+
pending: "pending";
|
|
4
|
+
accepted: "accepted";
|
|
5
|
+
countered: "countered";
|
|
6
|
+
declined: "declined";
|
|
7
|
+
}>;
|
|
8
|
+
/** PRICE_OFFER payload. Replies (accept, counter, decline) point at the offer they answer. */
|
|
9
|
+
export declare const priceOfferPayloadSchema: z.ZodObject<{
|
|
10
|
+
provider: z.ZodObject<{
|
|
11
|
+
offered_price: z.ZodCoercedNumber<unknown>;
|
|
12
|
+
currency_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
requester: z.ZodObject<{
|
|
15
|
+
offered_price: z.ZodCoercedNumber<unknown>;
|
|
16
|
+
currency_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
19
|
+
pending: "pending";
|
|
20
|
+
accepted: "accepted";
|
|
21
|
+
countered: "countered";
|
|
22
|
+
declined: "declined";
|
|
23
|
+
}>>;
|
|
24
|
+
reply_to_message_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
25
|
+
note: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
/** RENT_OFFER payload: prices are per period, duration counts periods. */
|
|
28
|
+
export declare const rentOfferPayloadSchema: z.ZodObject<{
|
|
29
|
+
provider: z.ZodObject<{
|
|
30
|
+
offered_price: z.ZodCoercedNumber<unknown>;
|
|
31
|
+
currency_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
requester: z.ZodObject<{
|
|
34
|
+
offered_price: z.ZodCoercedNumber<unknown>;
|
|
35
|
+
currency_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
38
|
+
pending: "pending";
|
|
39
|
+
accepted: "accepted";
|
|
40
|
+
countered: "countered";
|
|
41
|
+
declined: "declined";
|
|
42
|
+
}>>;
|
|
43
|
+
reply_to_message_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
44
|
+
note: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
45
|
+
price_type_id: z.ZodCoercedNumber<unknown>;
|
|
46
|
+
currency_id: z.ZodCoercedNumber<unknown>;
|
|
47
|
+
duration: z.ZodCoercedNumber<unknown>;
|
|
48
|
+
start_date: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
49
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rentOfferPayloadSchema = exports.priceOfferPayloadSchema = exports.offerStatusSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.offerStatusSchema = zod_1.z.enum(["pending", "accepted", "countered", "declined"]);
|
|
6
|
+
// The seller's side can be 0 when the ad has no price; the backend requires a positive buyer price
|
|
7
|
+
const offerSideSchema = zod_1.z.object({
|
|
8
|
+
offered_price: zod_1.z.coerce.number().min(0),
|
|
9
|
+
currency_id: zod_1.z.coerce.number().int().positive().optional(),
|
|
10
|
+
});
|
|
11
|
+
/** PRICE_OFFER payload. Replies (accept, counter, decline) point at the offer they answer. */
|
|
12
|
+
exports.priceOfferPayloadSchema = zod_1.z.object({
|
|
13
|
+
provider: offerSideSchema,
|
|
14
|
+
requester: offerSideSchema,
|
|
15
|
+
status: exports.offerStatusSchema.optional(),
|
|
16
|
+
reply_to_message_id: zod_1.z.coerce.number().int().positive().optional().nullable(),
|
|
17
|
+
/** Free text the sender added; the message text itself is a readable summary for older apps */
|
|
18
|
+
note: zod_1.z.string().trim().max(1000).optional().nullable(),
|
|
19
|
+
});
|
|
20
|
+
/** RENT_OFFER payload: prices are per period, duration counts periods. */
|
|
21
|
+
exports.rentOfferPayloadSchema = exports.priceOfferPayloadSchema.extend({
|
|
22
|
+
price_type_id: zod_1.z.coerce.number().int().positive(),
|
|
23
|
+
currency_id: zod_1.z.coerce.number().int().positive(),
|
|
24
|
+
duration: zod_1.z.coerce.number().int().min(1).max(1000),
|
|
25
|
+
start_date: zod_1.z
|
|
26
|
+
.string()
|
|
27
|
+
.trim()
|
|
28
|
+
.regex(/^\d{4}-\d{2}-\d{2}$/)
|
|
29
|
+
.optional()
|
|
30
|
+
.nullable(),
|
|
31
|
+
});
|
|
@@ -16,22 +16,22 @@ export declare const SupportTicketPrioritySchema: z.ZodEnum<{
|
|
|
16
16
|
}>;
|
|
17
17
|
export declare const SupportTicketCategorySchema: z.ZodEnum<{
|
|
18
18
|
payment: "payment";
|
|
19
|
+
other: "other";
|
|
19
20
|
technical_issue: "technical_issue";
|
|
20
21
|
account: "account";
|
|
21
22
|
advertisement: "advertisement";
|
|
22
23
|
complaint: "complaint";
|
|
23
|
-
other: "other";
|
|
24
24
|
}>;
|
|
25
25
|
export declare const SupportTicketCreateSchema: z.ZodObject<{
|
|
26
26
|
title: z.ZodString;
|
|
27
27
|
description: z.ZodString;
|
|
28
28
|
category: z.ZodDefault<z.ZodEnum<{
|
|
29
29
|
payment: "payment";
|
|
30
|
+
other: "other";
|
|
30
31
|
technical_issue: "technical_issue";
|
|
31
32
|
account: "account";
|
|
32
33
|
advertisement: "advertisement";
|
|
33
34
|
complaint: "complaint";
|
|
34
|
-
other: "other";
|
|
35
35
|
}>>;
|
|
36
36
|
priority: z.ZodDefault<z.ZodEnum<{
|
|
37
37
|
low: "low";
|
|
@@ -51,11 +51,11 @@ export declare const SupportTicketAiCreateSchema: z.ZodObject<{
|
|
|
51
51
|
description: z.ZodString;
|
|
52
52
|
category: z.ZodDefault<z.ZodEnum<{
|
|
53
53
|
payment: "payment";
|
|
54
|
+
other: "other";
|
|
54
55
|
technical_issue: "technical_issue";
|
|
55
56
|
account: "account";
|
|
56
57
|
advertisement: "advertisement";
|
|
57
58
|
complaint: "complaint";
|
|
58
|
-
other: "other";
|
|
59
59
|
}>>;
|
|
60
60
|
priority: z.ZodDefault<z.ZodEnum<{
|
|
61
61
|
low: "low";
|
|
@@ -28,6 +28,8 @@ export declare const eventBaseSchema: z.ZodObject<{
|
|
|
28
28
|
event_type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
29
29
|
event_template: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
30
30
|
venue_id: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
31
|
+
venue_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
32
|
+
location_label: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
31
33
|
invitation_scan_type: z.ZodOptional<z.ZodEnum<{
|
|
32
34
|
none: "none";
|
|
33
35
|
qrcode: "qrcode";
|
|
@@ -63,6 +65,8 @@ export declare const createEventSchema: z.ZodObject<{
|
|
|
63
65
|
event_type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
64
66
|
event_template: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
65
67
|
venue_id: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
68
|
+
venue_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
69
|
+
location_label: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
66
70
|
invitation_scan_type: z.ZodOptional<z.ZodEnum<{
|
|
67
71
|
none: "none";
|
|
68
72
|
qrcode: "qrcode";
|
|
@@ -98,6 +102,8 @@ export declare const updateEventSchema: z.ZodObject<{
|
|
|
98
102
|
event_type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
99
103
|
event_template: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
100
104
|
venue_id: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
105
|
+
venue_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
106
|
+
location_label: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
101
107
|
invitation_scan_type: z.ZodOptional<z.ZodEnum<{
|
|
102
108
|
none: "none";
|
|
103
109
|
qrcode: "qrcode";
|
|
@@ -134,6 +140,8 @@ export declare const saveEventSchema: z.ZodObject<{
|
|
|
134
140
|
event_type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
135
141
|
event_template: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
136
142
|
venue_id: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
143
|
+
venue_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
144
|
+
location_label: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
137
145
|
invitation_scan_type: z.ZodOptional<z.ZodEnum<{
|
|
138
146
|
none: "none";
|
|
139
147
|
qrcode: "qrcode";
|
|
@@ -141,6 +149,18 @@ export declare const saveEventSchema: z.ZodObject<{
|
|
|
141
149
|
}>>;
|
|
142
150
|
id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
143
151
|
}, z.core.$strip>;
|
|
152
|
+
export declare const publishEventSchema: z.ZodObject<{
|
|
153
|
+
id: z.ZodCoercedNumber<unknown>;
|
|
154
|
+
method: z.ZodEnum<{
|
|
155
|
+
combined: "combined";
|
|
156
|
+
balance: "balance";
|
|
157
|
+
loyalty: "loyalty";
|
|
158
|
+
}>;
|
|
159
|
+
points_used: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
160
|
+
}, z.core.$strip>;
|
|
161
|
+
export declare const eventIdSchema: z.ZodObject<{
|
|
162
|
+
id: z.ZodCoercedNumber<unknown>;
|
|
163
|
+
}, z.core.$strip>;
|
|
144
164
|
export declare const getEventsFilterSchema: z.ZodObject<{
|
|
145
165
|
is_published: z.ZodOptional<z.ZodBoolean>;
|
|
146
166
|
search: z.ZodOptional<z.ZodString>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getEventsFilterSchema = exports.saveEventSchema = exports.updateEventSchema = exports.createEventSchema = exports.eventBaseSchema = void 0;
|
|
3
|
+
exports.getEventsFilterSchema = exports.eventIdSchema = exports.publishEventSchema = exports.saveEventSchema = exports.updateEventSchema = exports.createEventSchema = exports.eventBaseSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const EventTimeline_schema_1 = require("./EventTimeline.schema");
|
|
6
6
|
const EventWedding_schema_1 = require("./EventWedding.schema");
|
|
@@ -17,6 +17,8 @@ exports.eventBaseSchema = zod_1.z.object({
|
|
|
17
17
|
event_type: zod_1.z.string().trim().max(255).nullable().optional(),
|
|
18
18
|
event_template: zod_1.z.string().trim().max(255).nullable().optional(),
|
|
19
19
|
venue_id: zod_1.z.coerce.number().int().positive().nullable().optional(),
|
|
20
|
+
venue_name: zod_1.z.string().trim().max(255).nullable().optional(),
|
|
21
|
+
location_label: zod_1.z.string().trim().nullable().optional(),
|
|
20
22
|
invitation_scan_type: zod_1.z.enum(events_1.EventInvitationScanTypeValues).optional(),
|
|
21
23
|
});
|
|
22
24
|
exports.createEventSchema = exports.eventBaseSchema;
|
|
@@ -26,6 +28,14 @@ exports.updateEventSchema = exports.eventBaseSchema.extend({
|
|
|
26
28
|
exports.saveEventSchema = exports.eventBaseSchema.extend({
|
|
27
29
|
id: zod_1.z.coerce.number().int().positive().optional(),
|
|
28
30
|
});
|
|
31
|
+
exports.publishEventSchema = zod_1.z.object({
|
|
32
|
+
id: zod_1.z.coerce.number().int().positive(),
|
|
33
|
+
method: zod_1.z.enum(events_1.EventPublishPaymentMethodValues),
|
|
34
|
+
points_used: zod_1.z.coerce.number().int().nonnegative().optional(),
|
|
35
|
+
});
|
|
36
|
+
exports.eventIdSchema = zod_1.z.object({
|
|
37
|
+
id: zod_1.z.coerce.number().int().positive(),
|
|
38
|
+
});
|
|
29
39
|
exports.getEventsFilterSchema = zod_1.z.object({
|
|
30
40
|
is_published: zod_1.z.boolean().optional(),
|
|
31
41
|
search: zod_1.z.string().trim().optional(),
|
package/dist/cjs/schema/index.js
CHANGED
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.POTENTIAL_USERS = exports.ADDRESSES = exports.COMMUNICATION = exports.PAYMENTS = exports.EVENTS = exports.COMMON = exports.AI = exports.AD = void 0;
|
|
36
|
+
exports.ANALYSIS = exports.POTENTIAL_USERS = exports.ADDRESSES = exports.COMMUNICATION = exports.PAYMENTS = exports.EVENTS = exports.COMMON = exports.AI = exports.AD = void 0;
|
|
37
37
|
exports.AD = __importStar(require("./ad"));
|
|
38
38
|
exports.AI = __importStar(require("./ai"));
|
|
39
39
|
exports.COMMON = __importStar(require("./common"));
|
|
@@ -42,3 +42,4 @@ exports.PAYMENTS = __importStar(require("./payments"));
|
|
|
42
42
|
exports.COMMUNICATION = __importStar(require("./communication"));
|
|
43
43
|
exports.ADDRESSES = __importStar(require("./addresses/addresses.schema"));
|
|
44
44
|
exports.POTENTIAL_USERS = __importStar(require("./potential-users"));
|
|
45
|
+
exports.ANALYSIS = __importStar(require("./analysis"));
|
|
@@ -8,6 +8,20 @@ import { IService } from "../service/Service";
|
|
|
8
8
|
import { IUsedProduct } from "../used-product/UsedProduct";
|
|
9
9
|
import { Category, Currency } from "..";
|
|
10
10
|
import { IAdminBoundary } from "../geo";
|
|
11
|
+
import type { ICompany } from "../company/Company";
|
|
12
|
+
import type { IPriceType } from "../ad-common/PriceType";
|
|
13
|
+
/** One rent price of an ad for one period (a price type linked to "For Rent", e.g. Daily). */
|
|
14
|
+
export type IAdRentPrice = {
|
|
15
|
+
id?: number;
|
|
16
|
+
ad_id?: number;
|
|
17
|
+
price_type_id: number;
|
|
18
|
+
price: number;
|
|
19
|
+
/** price converted to the base currency, used for filtering and sorting */
|
|
20
|
+
base_price?: number | null;
|
|
21
|
+
/** the price shown on cards; mirrors ads.price */
|
|
22
|
+
is_main?: boolean;
|
|
23
|
+
price_type?: IPriceType | null;
|
|
24
|
+
};
|
|
11
25
|
export type IAd = {
|
|
12
26
|
id?: number;
|
|
13
27
|
user_id?: number;
|
|
@@ -33,6 +47,9 @@ export type IAd = {
|
|
|
33
47
|
by_call?: boolean;
|
|
34
48
|
} | null;
|
|
35
49
|
selected_phone: string | null;
|
|
50
|
+
/** Optional company the ad is published under */
|
|
51
|
+
company_id?: number | null;
|
|
52
|
+
company?: Pick<ICompany, "id" | "name" | "type"> | null;
|
|
36
53
|
user?: IUser;
|
|
37
54
|
media: IMedia[] | null;
|
|
38
55
|
subject_type?: SubjectTable;
|
|
@@ -44,11 +61,15 @@ export type IAd = {
|
|
|
44
61
|
service?: IService | null;
|
|
45
62
|
product?: IUsedProduct | null;
|
|
46
63
|
adminBoundary?: IAdminBoundary | null;
|
|
64
|
+
/** Rent ads (motors and properties): one price per period */
|
|
65
|
+
rent_prices?: IAdRentPrice[] | null;
|
|
66
|
+
/** In a list filtered by rent_price_type_id: the rent price of that period */
|
|
67
|
+
matched_rent_price?: IAdRentPrice | null;
|
|
47
68
|
created_at?: string | Date;
|
|
48
69
|
updated_at?: string | Date;
|
|
49
70
|
expires_at?: string | Date | null;
|
|
50
71
|
};
|
|
51
|
-
export type SaveAdDto = Partial<Omit<IAd, "created_at" | "updated_at" | "views" | "user" | "promotions">> & {
|
|
72
|
+
export type SaveAdDto = Partial<Omit<IAd, "created_at" | "updated_at" | "views" | "user" | "promotions" | "company">> & {
|
|
52
73
|
id?: number;
|
|
53
74
|
latitude?: number;
|
|
54
75
|
longitude?: number;
|
|
@@ -62,6 +83,7 @@ export type GetAdsFilterDto = {
|
|
|
62
83
|
boundary_ids?: number[];
|
|
63
84
|
category_id?: number;
|
|
64
85
|
user_id?: number;
|
|
86
|
+
company_id?: number;
|
|
65
87
|
subject_type?: SubjectTable;
|
|
66
88
|
search?: string;
|
|
67
89
|
status?: string;
|
|
@@ -70,6 +92,10 @@ export type GetAdsFilterDto = {
|
|
|
70
92
|
currency_id?: number;
|
|
71
93
|
min_price?: number;
|
|
72
94
|
max_price?: number;
|
|
95
|
+
/** Rent period (price type id): price range and price sorting then use that period's price */
|
|
96
|
+
rent_price_type_id?: number;
|
|
97
|
+
sort_by?: "price" | "created_at" | "views";
|
|
98
|
+
sort_order?: "ASC" | "DESC";
|
|
73
99
|
parent_category_id?: number;
|
|
74
100
|
property?: {
|
|
75
101
|
property_type_id?: number;
|
|
@@ -17,9 +17,29 @@ type AdInteractions = {
|
|
|
17
17
|
* High-level app engagement and system health
|
|
18
18
|
*/
|
|
19
19
|
type AppMetrics = {
|
|
20
|
+
/** App opens on the snapshot day */
|
|
20
21
|
device_open_count: number;
|
|
21
22
|
chat_messages_count: number;
|
|
22
23
|
chat_rooms_count: number;
|
|
24
|
+
/** Opens of all devices ever, when the snapshot was taken; the day's opens are the difference to the previous day */
|
|
25
|
+
device_open_total?: number;
|
|
26
|
+
};
|
|
27
|
+
/** A number for each subject type */
|
|
28
|
+
export type AnalysisSubjectTypeCounts = {
|
|
29
|
+
services: number;
|
|
30
|
+
products: number;
|
|
31
|
+
properties: number;
|
|
32
|
+
motors: number;
|
|
33
|
+
};
|
|
34
|
+
/** Views of one category on one day, counting only ads placed directly in it (not its sub-categories) */
|
|
35
|
+
export type AnalysisCategoryViews = {
|
|
36
|
+
category_id: number;
|
|
37
|
+
views: number;
|
|
38
|
+
};
|
|
39
|
+
/** What was created on the snapshot day */
|
|
40
|
+
type ContentMetrics = {
|
|
41
|
+
new_ads: AnalysisSubjectTypeCounts;
|
|
42
|
+
new_users: number;
|
|
23
43
|
};
|
|
24
44
|
export type IAnalysisDailySnapshot = {
|
|
25
45
|
id: number;
|
|
@@ -35,5 +55,83 @@ export type IAnalysisDailySnapshot = {
|
|
|
35
55
|
motors: CategoryMetrics;
|
|
36
56
|
/** General app-wide engagement metrics */
|
|
37
57
|
app_metrics: AppMetrics;
|
|
58
|
+
/** Views per category on the day; empty on legacy snapshots */
|
|
59
|
+
category_views: AnalysisCategoryViews[];
|
|
60
|
+
content_metrics: ContentMetrics;
|
|
61
|
+
/**
|
|
62
|
+
* 1: legacy, `views_count` held all-time totals instead of the day's views.
|
|
63
|
+
* 2 (`SCHEMA.ANALYSIS.ANALYSIS_METRICS_VERSION`): daily views, Asia/Damascus days.
|
|
64
|
+
*/
|
|
65
|
+
metrics_version: number;
|
|
66
|
+
};
|
|
67
|
+
/** A snapshot as listed: without the per-category views */
|
|
68
|
+
export type IAnalysisDailySnapshotRow = Omit<IAnalysisDailySnapshot, 'category_views'>;
|
|
69
|
+
/** Sums over a period of daily snapshots */
|
|
70
|
+
export type IAnalysisReportTotals = {
|
|
71
|
+
views: AnalysisSubjectTypeCounts & {
|
|
72
|
+
total: number;
|
|
73
|
+
};
|
|
74
|
+
ad_interactions: AdInteractions;
|
|
75
|
+
app_metrics: Omit<AppMetrics, 'device_open_total'>;
|
|
76
|
+
content_metrics: ContentMetrics;
|
|
77
|
+
/** See `UTILS.analysisEngagementTotal` */
|
|
78
|
+
engagement_total: number;
|
|
79
|
+
/** Days in the period that have a snapshot */
|
|
80
|
+
days_count: number;
|
|
81
|
+
};
|
|
82
|
+
/** A category with the views of its ads and of all its sub-categories' ads */
|
|
83
|
+
export type IAnalysisCategoryNode = {
|
|
84
|
+
id: number;
|
|
85
|
+
name: string;
|
|
86
|
+
parent_id: number | null;
|
|
87
|
+
views: number;
|
|
88
|
+
/** Views in the period just before (`previous_from`..`previous_to`) */
|
|
89
|
+
previous_views: number;
|
|
90
|
+
/** Views in the same days one week earlier (`week_ago_from`..`week_ago_to`) */
|
|
91
|
+
week_ago_views: number;
|
|
92
|
+
children: IAnalysisCategoryNode[];
|
|
93
|
+
};
|
|
94
|
+
/** Top level of the category tree: one subject type with its top-level categories */
|
|
95
|
+
export type IAnalysisSubjectTypeNode = {
|
|
96
|
+
/** Category `type`: services, used_products, motors or properties */
|
|
97
|
+
subject_type: string;
|
|
98
|
+
views: number;
|
|
99
|
+
previous_views: number;
|
|
100
|
+
week_ago_views: number;
|
|
101
|
+
children: IAnalysisCategoryNode[];
|
|
102
|
+
};
|
|
103
|
+
export type IAnalysisTopAd = {
|
|
104
|
+
ad_id: number;
|
|
105
|
+
title: string | null;
|
|
106
|
+
subject_type: string | null;
|
|
107
|
+
category_id: number | null;
|
|
108
|
+
category_name: string | null;
|
|
109
|
+
views: number;
|
|
110
|
+
previous_views: number;
|
|
111
|
+
week_ago_views: number;
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Body of `admin/analysis/snapshots/report`: the period `from`..`to` compared with the period of the
|
|
115
|
+
* same length just before it, and with the same days one week earlier
|
|
116
|
+
*/
|
|
117
|
+
export type IAnalysisReport = {
|
|
118
|
+
from: string;
|
|
119
|
+
to: string;
|
|
120
|
+
previous_from: string;
|
|
121
|
+
previous_to: string;
|
|
122
|
+
/** `from`..`to` moved back 7 days, e.g. last Sunday for a Sunday */
|
|
123
|
+
week_ago_from: string;
|
|
124
|
+
week_ago_to: string;
|
|
125
|
+
totals: IAnalysisReportTotals;
|
|
126
|
+
previous_totals: IAnalysisReportTotals;
|
|
127
|
+
week_ago_totals: IAnalysisReportTotals;
|
|
128
|
+
/** Daily rows for the trend chart: the period, extended to at least the last 30 days up to `to` */
|
|
129
|
+
trend: IAnalysisDailySnapshotRow[];
|
|
130
|
+
/** Subject types, each with its top-level categories; sorted by views */
|
|
131
|
+
category_tree: IAnalysisSubjectTypeNode[];
|
|
132
|
+
/** Most viewed ads in the period; empty for days older than the kept daily view records */
|
|
133
|
+
top_ads: IAnalysisTopAd[];
|
|
134
|
+
/** Days in the period whose view counts are legacy all-time totals; their views are left out of the sums */
|
|
135
|
+
legacy_days: string[];
|
|
38
136
|
};
|
|
39
137
|
export {};
|
|
@@ -13,6 +13,9 @@ export type MetaDataType = {
|
|
|
13
13
|
maxPriceProperties: number;
|
|
14
14
|
maxPriceMotors: number;
|
|
15
15
|
maxPriceUsedProducts: number;
|
|
16
|
+
/** Highest price per rent period (price type id → base price) */
|
|
17
|
+
maxRentPricesProperties?: Record<number, number>;
|
|
18
|
+
maxRentPricesMotors?: Record<number, number>;
|
|
16
19
|
};
|
|
17
20
|
};
|
|
18
21
|
export type MetaDataDefaults = {
|
|
@@ -41,8 +41,37 @@ export type IChatMessage = {
|
|
|
41
41
|
export declare enum MessageTypeEnum {
|
|
42
42
|
TEXT = 1,
|
|
43
43
|
PRICE_OFFER = 2,
|
|
44
|
-
CONTACT_INVITATION = 3
|
|
44
|
+
CONTACT_INVITATION = 3,
|
|
45
|
+
RENT_OFFER = 4
|
|
45
46
|
}
|
|
47
|
+
/** Lifecycle of a price or rent offer. A reply is a new message pointing at the offer it answers. */
|
|
48
|
+
export declare enum OfferStatusEnum {
|
|
49
|
+
PENDING = "pending",
|
|
50
|
+
ACCEPTED = "accepted",
|
|
51
|
+
COUNTERED = "countered",
|
|
52
|
+
DECLINED = "declined"
|
|
53
|
+
}
|
|
54
|
+
export type OfferSide = {
|
|
55
|
+
offered_price: number;
|
|
56
|
+
currency_id?: number;
|
|
57
|
+
};
|
|
58
|
+
/** Payload of PRICE_OFFER messages (sale offers). status and reply_to_message_id are optional for old messages. */
|
|
59
|
+
export type PriceOfferPayload = {
|
|
60
|
+
provider: OfferSide;
|
|
61
|
+
requester: OfferSide;
|
|
62
|
+
status?: OfferStatusEnum;
|
|
63
|
+
reply_to_message_id?: number | null;
|
|
64
|
+
note?: string | null;
|
|
65
|
+
};
|
|
66
|
+
/** Payload of RENT_OFFER messages: prices are per period (price_type_id). */
|
|
67
|
+
export type RentOfferPayload = PriceOfferPayload & {
|
|
68
|
+
price_type_id: number;
|
|
69
|
+
currency_id: number;
|
|
70
|
+
/** number of periods, e.g. 3 (months) */
|
|
71
|
+
duration: number;
|
|
72
|
+
/** YYYY-MM-DD */
|
|
73
|
+
start_date?: string | null;
|
|
74
|
+
};
|
|
46
75
|
export { MessageTypeEnum as MessageTypeType };
|
|
47
76
|
export type ContactInvitationPayload = {
|
|
48
77
|
version: 1;
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MessageTypeType = exports.MessageTypeEnum = void 0;
|
|
3
|
+
exports.MessageTypeType = exports.OfferStatusEnum = exports.MessageTypeEnum = void 0;
|
|
4
4
|
var MessageTypeEnum;
|
|
5
5
|
(function (MessageTypeEnum) {
|
|
6
6
|
MessageTypeEnum[MessageTypeEnum["TEXT"] = 1] = "TEXT";
|
|
7
7
|
MessageTypeEnum[MessageTypeEnum["PRICE_OFFER"] = 2] = "PRICE_OFFER";
|
|
8
8
|
MessageTypeEnum[MessageTypeEnum["CONTACT_INVITATION"] = 3] = "CONTACT_INVITATION";
|
|
9
|
+
MessageTypeEnum[MessageTypeEnum["RENT_OFFER"] = 4] = "RENT_OFFER";
|
|
9
10
|
})(MessageTypeEnum || (exports.MessageTypeType = exports.MessageTypeEnum = MessageTypeEnum = {}));
|
|
11
|
+
/** Lifecycle of a price or rent offer. A reply is a new message pointing at the offer it answers. */
|
|
12
|
+
var OfferStatusEnum;
|
|
13
|
+
(function (OfferStatusEnum) {
|
|
14
|
+
OfferStatusEnum["PENDING"] = "pending";
|
|
15
|
+
OfferStatusEnum["ACCEPTED"] = "accepted";
|
|
16
|
+
OfferStatusEnum["COUNTERED"] = "countered";
|
|
17
|
+
OfferStatusEnum["DECLINED"] = "declined";
|
|
18
|
+
})(OfferStatusEnum || (exports.OfferStatusEnum = OfferStatusEnum = {}));
|
|
@@ -1,10 +1,36 @@
|
|
|
1
1
|
import type { IUser } from '../user/User';
|
|
2
2
|
import type { IEventVenue } from '../events/EventVenue';
|
|
3
|
+
export type CompanyMemberRole = 'owner' | 'admin' | 'member';
|
|
4
|
+
export type CompanyType = 'company' | 'team' | 'other';
|
|
5
|
+
export type ICompanyMember = {
|
|
6
|
+
id?: number;
|
|
7
|
+
company_id: number;
|
|
8
|
+
user_id: number;
|
|
9
|
+
role: CompanyMemberRole;
|
|
10
|
+
added_by_user_id?: number | null;
|
|
11
|
+
user?: IUser | null;
|
|
12
|
+
company?: ICompany | null;
|
|
13
|
+
created_at?: string | Date;
|
|
14
|
+
};
|
|
3
15
|
export type ICompany = {
|
|
4
16
|
id?: number;
|
|
5
17
|
name: string;
|
|
18
|
+
type?: CompanyType;
|
|
6
19
|
user_id?: number | null;
|
|
7
20
|
user?: IUser | null;
|
|
8
21
|
venues?: IEventVenue[];
|
|
22
|
+
members?: ICompanyMember[];
|
|
23
|
+
/** The signed-in user's role, on "my companies" responses */
|
|
24
|
+
my_role?: CompanyMemberRole;
|
|
25
|
+
status: string;
|
|
26
|
+
};
|
|
27
|
+
/** Public company profile: no phone numbers or other private data */
|
|
28
|
+
export type ICompanyProfile = {
|
|
29
|
+
id: number;
|
|
30
|
+
name: string;
|
|
31
|
+
type: CompanyType;
|
|
9
32
|
status: string;
|
|
33
|
+
members_count: number;
|
|
34
|
+
ads_count: number;
|
|
35
|
+
created_at?: string | Date;
|
|
10
36
|
};
|
|
@@ -2,6 +2,7 @@ import type { IEventTimeline } from "./EventTimeline";
|
|
|
2
2
|
import type { IEventRsvp } from "./EventRsvp";
|
|
3
3
|
import type { IEventWedding } from "./EventWedding";
|
|
4
4
|
import type { IEventVenue } from "./EventVenue";
|
|
5
|
+
import type { IUser } from "../user/User";
|
|
5
6
|
import { EventInvitationScanType } from "../../constants/events";
|
|
6
7
|
export type IEvent = {
|
|
7
8
|
id?: number;
|
|
@@ -19,4 +20,11 @@ export type IEvent = {
|
|
|
19
20
|
rsvps?: IEventRsvp[];
|
|
20
21
|
venue_id?: number | null;
|
|
21
22
|
venue?: IEventVenue | null;
|
|
23
|
+
venue_name?: string | null;
|
|
24
|
+
location_label?: string | null;
|
|
25
|
+
user_id?: number | null;
|
|
26
|
+
user?: IUser | null;
|
|
27
|
+
payment_id?: number | null;
|
|
28
|
+
paid_amount?: string | null;
|
|
29
|
+
paid_at?: string | Date | null;
|
|
22
30
|
};
|
|
@@ -1,12 +1,21 @@
|
|
|
1
|
+
/** google = Gemini, anthropic = Claude */
|
|
2
|
+
export type AiProvider = 'gemini' | 'anthropic';
|
|
3
|
+
/** priority = first available key in order; balanced = least tokens used today */
|
|
4
|
+
export type AiKeySelectionMode = 'priority' | 'balanced';
|
|
5
|
+
export type IAiKeySettings = {
|
|
6
|
+
selection_mode: AiKeySelectionMode;
|
|
7
|
+
};
|
|
1
8
|
/**
|
|
2
|
-
*
|
|
9
|
+
* An AI API key (Gemini or Claude) as the dashboard sees it. The key itself never leaves backend-core in this
|
|
3
10
|
* shape: only `api_key_masked` is sent.
|
|
4
11
|
*/
|
|
5
12
|
export type IGeminiApiKey = {
|
|
6
13
|
id: number;
|
|
7
14
|
name: string;
|
|
15
|
+
provider: AiProvider;
|
|
8
16
|
/** e.g. "AIza…f3Kq" */
|
|
9
17
|
api_key_masked: string;
|
|
18
|
+
/** Default model; a service may ask for another model of the same provider */
|
|
10
19
|
model_name: string;
|
|
11
20
|
/** Dashboard order, starting at 1 */
|
|
12
21
|
sort_order: number;
|
|
@@ -17,7 +26,7 @@ export type IGeminiApiKey = {
|
|
|
17
26
|
daily_tokens: number;
|
|
18
27
|
/** The day daily_tokens belongs to (YYYY-MM-DD) */
|
|
19
28
|
daily_usage_date: string | null;
|
|
20
|
-
/** The key is skipped until this time, after
|
|
29
|
+
/** The key is skipped until this time, after the provider rejected it (quota, overload, bad key) */
|
|
21
30
|
cooldown_until: string | null;
|
|
22
31
|
last_used_at: string | null;
|
|
23
32
|
last_error: string | null;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { IAnalysisDailySnapshot } from "../types/analysis/AnalysisDailySnapshot";
|
|
2
|
+
type EngagementSource = Pick<IAnalysisDailySnapshot, 'ad_interactions'> & {
|
|
3
|
+
app_metrics: Pick<IAnalysisDailySnapshot['app_metrics'], 'chat_messages_count' | 'chat_rooms_count'>;
|
|
4
|
+
};
|
|
5
|
+
/** Engagement of a day: WhatsApp, call and chat clicks, shares, chat messages and new chat rooms */
|
|
6
|
+
export declare const analysisEngagementTotal: ({ ad_interactions: a, app_metrics: m }: EngagementSource) => number;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.analysisEngagementTotal = void 0;
|
|
4
|
+
/** Engagement of a day: WhatsApp, call and chat clicks, shares, chat messages and new chat rooms */
|
|
5
|
+
const analysisEngagementTotal = ({ ad_interactions: a, app_metrics: m }) => {
|
|
6
|
+
var _a, _b, _c, _d, _e, _f;
|
|
7
|
+
return ((_a = a === null || a === void 0 ? void 0 : a.whatsapp_clicks) !== null && _a !== void 0 ? _a : 0) +
|
|
8
|
+
((_b = a === null || a === void 0 ? void 0 : a.call_clicks) !== null && _b !== void 0 ? _b : 0) +
|
|
9
|
+
((_c = a === null || a === void 0 ? void 0 : a.chat_clicks) !== null && _c !== void 0 ? _c : 0) +
|
|
10
|
+
((_d = a === null || a === void 0 ? void 0 : a.shares) !== null && _d !== void 0 ? _d : 0) +
|
|
11
|
+
((_e = m === null || m === void 0 ? void 0 : m.chat_messages_count) !== null && _e !== void 0 ? _e : 0) +
|
|
12
|
+
((_f = m === null || m === void 0 ? void 0 : m.chat_rooms_count) !== null && _f !== void 0 ? _f : 0);
|
|
13
|
+
};
|
|
14
|
+
exports.analysisEngagementTotal = analysisEngagementTotal;
|
package/dist/cjs/utils/index.js
CHANGED
|
@@ -17,3 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./converter"), exports);
|
|
18
18
|
__exportStar(require("./routes"), exports);
|
|
19
19
|
__exportStar(require("./adMedia"), exports);
|
|
20
|
+
__exportStar(require("./analysis"), exports);
|
|
21
|
+
__exportStar(require("./rentPrices"), exports);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IAd, IAdRentPrice } from "../types/ad/Ad";
|
|
2
|
+
/** The rent price shown on cards: the one marked main, else the first listed. */
|
|
3
|
+
export declare const getMainRentPrice: (ad?: Pick<IAd, "rent_prices"> | null) => IAdRentPrice | null;
|
|
4
|
+
/** The price to show for an ad in a list: the filtered period, else the main rent price. */
|
|
5
|
+
export declare const getDisplayRentPrice: (ad?: Pick<IAd, "rent_prices" | "matched_rent_price"> | null, priceTypeId?: number | null) => IAdRentPrice | null;
|
|
6
|
+
/** Rent prices ordered from the shortest period to the longest. */
|
|
7
|
+
export declare const sortRentPrices: (prices?: IAdRentPrice[] | null) => IAdRentPrice[];
|
|
8
|
+
export declare const rentOfferTotal: (pricePerPeriod: number, duration: number) => number;
|