hububb-saas-shared 1.2.58 → 1.2.60
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/helpers/chat-thread.d.ts +17 -0
- package/dist/helpers/chat-thread.js +36 -0
- package/dist/helpers/cleaning-estimate.d.ts +7 -0
- package/dist/helpers/cleaning-estimate.js +36 -0
- package/dist/helpers/index.d.ts +2 -0
- package/dist/helpers/index.js +9 -1
- package/dist/schemas/thread/index.d.ts +3 -0
- package/dist/schemas/thread/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const AIRBNB_SUPPORT_THREAD_TITLE = "Airbnb Support";
|
|
2
|
+
export declare function isAirbnbSupportThreadTitle(title?: string | null): boolean;
|
|
3
|
+
/** Airbnb ↔ host support threads from Channex (not guest inquiries). */
|
|
4
|
+
export declare function isAirbnbSupportThread(params: {
|
|
5
|
+
externalSource?: string | null;
|
|
6
|
+
title?: string | null;
|
|
7
|
+
bookingId?: string | null;
|
|
8
|
+
isAirbnbSupportThread?: boolean | null;
|
|
9
|
+
}): boolean;
|
|
10
|
+
/** Whether a Channex Airbnb thread is a pre-booking guest inquiry (not Airbnb Support). */
|
|
11
|
+
export declare function resolveAirbnbInquiryThread(params: {
|
|
12
|
+
externalSource?: string | null;
|
|
13
|
+
bookingId?: string | null;
|
|
14
|
+
title?: string | null;
|
|
15
|
+
hasInquirySystemMessage?: boolean;
|
|
16
|
+
existingIsInquiryThread?: boolean;
|
|
17
|
+
}): boolean;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AIRBNB_SUPPORT_THREAD_TITLE = void 0;
|
|
4
|
+
exports.isAirbnbSupportThreadTitle = isAirbnbSupportThreadTitle;
|
|
5
|
+
exports.isAirbnbSupportThread = isAirbnbSupportThread;
|
|
6
|
+
exports.resolveAirbnbInquiryThread = resolveAirbnbInquiryThread;
|
|
7
|
+
exports.AIRBNB_SUPPORT_THREAD_TITLE = "Airbnb Support";
|
|
8
|
+
function isAirbnbSupportThreadTitle(title) {
|
|
9
|
+
if (!(title === null || title === void 0 ? void 0 : title.trim()))
|
|
10
|
+
return false;
|
|
11
|
+
return title.trim().toLowerCase() === exports.AIRBNB_SUPPORT_THREAD_TITLE.toLowerCase();
|
|
12
|
+
}
|
|
13
|
+
/** Airbnb ↔ host support threads from Channex (not guest inquiries). */
|
|
14
|
+
function isAirbnbSupportThread(params) {
|
|
15
|
+
var _a;
|
|
16
|
+
if (params.isAirbnbSupportThread)
|
|
17
|
+
return true;
|
|
18
|
+
if (((_a = params.externalSource) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== "airbnb")
|
|
19
|
+
return false;
|
|
20
|
+
if (params.bookingId)
|
|
21
|
+
return false;
|
|
22
|
+
return isAirbnbSupportThreadTitle(params.title);
|
|
23
|
+
}
|
|
24
|
+
/** Whether a Channex Airbnb thread is a pre-booking guest inquiry (not Airbnb Support). */
|
|
25
|
+
function resolveAirbnbInquiryThread(params) {
|
|
26
|
+
var _a;
|
|
27
|
+
if (params.bookingId)
|
|
28
|
+
return false;
|
|
29
|
+
if (((_a = params.externalSource) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== "airbnb")
|
|
30
|
+
return false;
|
|
31
|
+
if (isAirbnbSupportThread(params))
|
|
32
|
+
return false;
|
|
33
|
+
if (params.hasInquirySystemMessage)
|
|
34
|
+
return true;
|
|
35
|
+
return !!params.existingIsInquiryThread;
|
|
36
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fixed cleaning duration estimates by property size.
|
|
3
|
+
* Not based on historical task durations (which can be skewed by forgotten clock-outs).
|
|
4
|
+
*/
|
|
5
|
+
export declare function estimateCleaningHoursByProperty(bedrooms?: number | null, propertyType?: string | null): number;
|
|
6
|
+
/** Formats cleaning duration for display, e.g. 3.5 → "3h 30m", 2 → "2h". */
|
|
7
|
+
export declare function formatCleaningDuration(hours: number): string;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.estimateCleaningHoursByProperty = estimateCleaningHoursByProperty;
|
|
4
|
+
exports.formatCleaningDuration = formatCleaningDuration;
|
|
5
|
+
/**
|
|
6
|
+
* Fixed cleaning duration estimates by property size.
|
|
7
|
+
* Not based on historical task durations (which can be skewed by forgotten clock-outs).
|
|
8
|
+
*/
|
|
9
|
+
function estimateCleaningHoursByProperty(bedrooms, propertyType) {
|
|
10
|
+
const bedCount = bedrooms !== null && bedrooms !== void 0 ? bedrooms : 0;
|
|
11
|
+
if (propertyType === "STUDIO" || bedCount === 0) {
|
|
12
|
+
return 1;
|
|
13
|
+
}
|
|
14
|
+
if (bedCount === 1) {
|
|
15
|
+
return 2;
|
|
16
|
+
}
|
|
17
|
+
if (bedCount === 2) {
|
|
18
|
+
return 3;
|
|
19
|
+
}
|
|
20
|
+
if (bedCount === 3) {
|
|
21
|
+
return 3.5;
|
|
22
|
+
}
|
|
23
|
+
return 4;
|
|
24
|
+
}
|
|
25
|
+
/** Formats cleaning duration for display, e.g. 3.5 → "3h 30m", 2 → "2h". */
|
|
26
|
+
function formatCleaningDuration(hours) {
|
|
27
|
+
const wholeHours = Math.floor(hours);
|
|
28
|
+
const minutes = Math.round((hours - wholeHours) * 60);
|
|
29
|
+
if (minutes === 0) {
|
|
30
|
+
return `${wholeHours}h`;
|
|
31
|
+
}
|
|
32
|
+
if (wholeHours === 0) {
|
|
33
|
+
return `${minutes}m`;
|
|
34
|
+
}
|
|
35
|
+
return `${wholeHours}h ${minutes}m`;
|
|
36
|
+
}
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -9,3 +9,5 @@ export interface Timestamp {
|
|
|
9
9
|
}
|
|
10
10
|
export declare const firestoreTimestampSchema: z.ZodType<Timestamp>;
|
|
11
11
|
export { getReservationXeroSyncView, type ReservationXeroSyncView, type XeroSyncStatus, } from "./reservation-xero";
|
|
12
|
+
export { AIRBNB_SUPPORT_THREAD_TITLE, isAirbnbSupportThread, isAirbnbSupportThreadTitle, resolveAirbnbInquiryThread, } from "./chat-thread";
|
|
13
|
+
export { estimateCleaningHoursByProperty, formatCleaningDuration, } from "./cleaning-estimate";
|
package/dist/helpers/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getReservationXeroSyncView = exports.firestoreTimestampSchema = void 0;
|
|
3
|
+
exports.formatCleaningDuration = exports.estimateCleaningHoursByProperty = exports.resolveAirbnbInquiryThread = exports.isAirbnbSupportThreadTitle = exports.isAirbnbSupportThread = exports.AIRBNB_SUPPORT_THREAD_TITLE = exports.getReservationXeroSyncView = exports.firestoreTimestampSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
// Create a complete type-safe timestamp schema
|
|
6
6
|
exports.firestoreTimestampSchema = zod_1.z
|
|
@@ -15,3 +15,11 @@ exports.firestoreTimestampSchema = zod_1.z
|
|
|
15
15
|
.refine((val) => val && typeof val.toDate === "function", "Must be a valid Timestamp");
|
|
16
16
|
var reservation_xero_1 = require("./reservation-xero");
|
|
17
17
|
Object.defineProperty(exports, "getReservationXeroSyncView", { enumerable: true, get: function () { return reservation_xero_1.getReservationXeroSyncView; } });
|
|
18
|
+
var chat_thread_1 = require("./chat-thread");
|
|
19
|
+
Object.defineProperty(exports, "AIRBNB_SUPPORT_THREAD_TITLE", { enumerable: true, get: function () { return chat_thread_1.AIRBNB_SUPPORT_THREAD_TITLE; } });
|
|
20
|
+
Object.defineProperty(exports, "isAirbnbSupportThread", { enumerable: true, get: function () { return chat_thread_1.isAirbnbSupportThread; } });
|
|
21
|
+
Object.defineProperty(exports, "isAirbnbSupportThreadTitle", { enumerable: true, get: function () { return chat_thread_1.isAirbnbSupportThreadTitle; } });
|
|
22
|
+
Object.defineProperty(exports, "resolveAirbnbInquiryThread", { enumerable: true, get: function () { return chat_thread_1.resolveAirbnbInquiryThread; } });
|
|
23
|
+
var cleaning_estimate_1 = require("./cleaning-estimate");
|
|
24
|
+
Object.defineProperty(exports, "estimateCleaningHoursByProperty", { enumerable: true, get: function () { return cleaning_estimate_1.estimateCleaningHoursByProperty; } });
|
|
25
|
+
Object.defineProperty(exports, "formatCleaningDuration", { enumerable: true, get: function () { return cleaning_estimate_1.formatCleaningDuration; } });
|
|
@@ -1420,6 +1420,7 @@ export declare const ChatThreadSchema: z.ZodObject<{
|
|
|
1420
1420
|
propertyNickname?: string | undefined;
|
|
1421
1421
|
}>>;
|
|
1422
1422
|
isInquiryThread: z.ZodOptional<z.ZodBoolean>;
|
|
1423
|
+
isAirbnbSupportThread: z.ZodOptional<z.ZodBoolean>;
|
|
1423
1424
|
whatsappTemplateSent: z.ZodOptional<z.ZodBoolean>;
|
|
1424
1425
|
whatsappUserReplied: z.ZodOptional<z.ZodBoolean>;
|
|
1425
1426
|
lastWhatsappMessageSentAt: z.ZodOptional<z.ZodType<import("../../helpers").Timestamp, z.ZodTypeDef, import("../../helpers").Timestamp>>;
|
|
@@ -1734,6 +1735,7 @@ export declare const ChatThreadSchema: z.ZodObject<{
|
|
|
1734
1735
|
propertyNickname?: string | undefined;
|
|
1735
1736
|
} | undefined;
|
|
1736
1737
|
isInquiryThread?: boolean | undefined;
|
|
1738
|
+
isAirbnbSupportThread?: boolean | undefined;
|
|
1737
1739
|
whatsappTemplateSent?: boolean | undefined;
|
|
1738
1740
|
whatsappUserReplied?: boolean | undefined;
|
|
1739
1741
|
lastWhatsappMessageSentAt?: import("../../helpers").Timestamp | undefined;
|
|
@@ -1943,6 +1945,7 @@ export declare const ChatThreadSchema: z.ZodObject<{
|
|
|
1943
1945
|
propertyNickname?: string | undefined;
|
|
1944
1946
|
} | undefined;
|
|
1945
1947
|
isInquiryThread?: boolean | undefined;
|
|
1948
|
+
isAirbnbSupportThread?: boolean | undefined;
|
|
1946
1949
|
whatsappTemplateSent?: boolean | undefined;
|
|
1947
1950
|
whatsappUserReplied?: boolean | undefined;
|
|
1948
1951
|
lastWhatsappMessageSentAt?: import("../../helpers").Timestamp | undefined;
|
|
@@ -100,6 +100,7 @@ exports.ChatThreadSchema = (0, zod_1.object)({
|
|
|
100
100
|
property: (0, zod_1.optional)(property_1.propertySchema),
|
|
101
101
|
})),
|
|
102
102
|
isInquiryThread: (0, zod_1.optional)((0, zod_1.boolean)()),
|
|
103
|
+
isAirbnbSupportThread: (0, zod_1.optional)((0, zod_1.boolean)()),
|
|
103
104
|
whatsappTemplateSent: (0, zod_1.optional)((0, zod_1.boolean)()),
|
|
104
105
|
whatsappUserReplied: (0, zod_1.optional)((0, zod_1.boolean)()),
|
|
105
106
|
lastWhatsappMessageSentAt: (0, zod_1.optional)(helpers_1.firestoreTimestampSchema),
|