hububb-saas-shared 1.2.58 → 1.2.59

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,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
+ }
@@ -9,3 +9,4 @@ 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";
@@ -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.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,8 @@ 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; } });
@@ -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),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "commonjs",
3
3
  "name": "hububb-saas-shared",
4
- "version": "1.2.58",
4
+ "version": "1.2.59",
5
5
  "description": "This is a shared package for the hububb saas project",
6
6
  "types": "./dist/index.d.ts",
7
7
  "main": "./dist/index.js",