@hyper.software/visitor-integrations-client 1.2.26
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/lib/client/src/config.d.ts +3 -0
- package/lib/client/src/config.js +11 -0
- package/lib/client/src/config.js.map +1 -0
- package/lib/client/src/index.d.ts +4 -0
- package/lib/client/src/index.js +21 -0
- package/lib/client/src/index.js.map +1 -0
- package/lib/client/src/interfaces.d.ts +24 -0
- package/lib/client/src/interfaces.js +14 -0
- package/lib/client/src/interfaces.js.map +1 -0
- package/lib/client/src/service.d.ts +29 -0
- package/lib/client/src/service.js +105 -0
- package/lib/client/src/service.js.map +1 -0
- package/lib/src/interfaces/bookings.d.ts +41 -0
- package/lib/src/interfaces/bookings.js +3 -0
- package/lib/src/interfaces/bookings.js.map +1 -0
- package/lib/src/interfaces/channels.d.ts +15 -0
- package/lib/src/interfaces/channels.js +3 -0
- package/lib/src/interfaces/channels.js.map +1 -0
- package/lib/src/interfaces/index.d.ts +196 -0
- package/lib/src/interfaces/index.js +25 -0
- package/lib/src/interfaces/index.js.map +1 -0
- package/package.json +24 -0
- package/src/config.ts +12 -0
- package/src/index.ts +9 -0
- package/src/interfaces.ts +27 -0
- package/src/mocks/index.ts +0 -0
- package/src/service.ts +198 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setConfig = exports.GLOBAL_CONFIG = void 0;
|
|
4
|
+
exports.GLOBAL_CONFIG = {
|
|
5
|
+
baseUrl: '',
|
|
6
|
+
};
|
|
7
|
+
function setConfig(options) {
|
|
8
|
+
exports.GLOBAL_CONFIG = Object.assign(Object.assign({}, exports.GLOBAL_CONFIG), options);
|
|
9
|
+
}
|
|
10
|
+
exports.setConfig = setConfig;
|
|
11
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/config.ts"],"names":[],"mappings":";;;AAEW,QAAA,aAAa,GAAmB;IACzC,OAAO,EAAE,EAAE;CACZ,CAAC;AAEF,SAAgB,SAAS,CAAC,OAAuB;IAC/C,qBAAa,mCACR,qBAAa,GACb,OAAO,CACX,CAAC;AACJ,CAAC;AALD,8BAKC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.init = void 0;
|
|
14
|
+
const config_1 = require("./config");
|
|
15
|
+
__exportStar(require("./interfaces"), exports);
|
|
16
|
+
__exportStar(require("./service"), exports);
|
|
17
|
+
function init(options) {
|
|
18
|
+
config_1.setConfig(options);
|
|
19
|
+
}
|
|
20
|
+
exports.init = init;
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qCAAqC;AAGrC,+CAA6B;AAC7B,4CAA0B;AAE1B,SAAgB,IAAI,CAAC,OAAuB;IAC1C,kBAAS,CAAC,OAAO,CAAC,CAAC;AACrB,CAAC;AAFD,oBAEC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export * from '../../src/interfaces';
|
|
2
|
+
export interface IInitOptions {
|
|
3
|
+
baseUrl: string;
|
|
4
|
+
apiKey?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface IPartnerFeatures {
|
|
7
|
+
movein: boolean;
|
|
8
|
+
myNeighborhood: boolean;
|
|
9
|
+
tenantMarketplace: boolean;
|
|
10
|
+
adminPortfolio: boolean;
|
|
11
|
+
propertiesAdvanced: boolean;
|
|
12
|
+
tasks: boolean;
|
|
13
|
+
scoring: boolean;
|
|
14
|
+
selling: boolean;
|
|
15
|
+
commercial: boolean;
|
|
16
|
+
eSignature: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface IAddress {
|
|
19
|
+
streetName?: string;
|
|
20
|
+
streetNumber?: string;
|
|
21
|
+
zipCode?: string;
|
|
22
|
+
city?: string;
|
|
23
|
+
country?: string;
|
|
24
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("../../src/interfaces"), exports);
|
|
14
|
+
//# sourceMappingURL=interfaces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/interfaces.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uDAAqC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { IRequestOptions, IBackendApiClientResponse } from '@usevisitor/backend-api-client';
|
|
2
|
+
import { ISyncChannelData, IInboundMappedChannel, ICompany, IRoomType, IRoomTypesAvailability, IChannel, IUpsertRestrictionsPayload, IAcceptRejectBooking } from './interfaces';
|
|
3
|
+
import { IPricePlan, IUpdatePricingPayload } from '../../src/interfaces';
|
|
4
|
+
export declare const createCompany: (company: ICompany, config?: IRequestOptions) => Promise<IBackendApiClientResponse<string>>;
|
|
5
|
+
export declare const updateCompany: (company: ICompany, config?: IRequestOptions) => Promise<IBackendApiClientResponse<void>>;
|
|
6
|
+
export declare const deleteCompany: (company: ICompany, config?: IRequestOptions) => Promise<IBackendApiClientResponse<void>>;
|
|
7
|
+
export declare const createRoomType: (company: ICompany, roomType: IRoomType, config?: IRequestOptions) => Promise<IBackendApiClientResponse<string>>;
|
|
8
|
+
export declare const updateRoomType: (company: ICompany, roomType: IRoomType, config?: IRequestOptions) => Promise<IBackendApiClientResponse<void>>;
|
|
9
|
+
export declare const deleteRoomType: (company: ICompany, roomType: IRoomType, config?: IRequestOptions) => Promise<IBackendApiClientResponse<void>>;
|
|
10
|
+
export declare const createOrUpdateAvailability: (company: ICompany, availability: IRoomTypesAvailability, config?: IRequestOptions) => Promise<IBackendApiClientResponse<string>>;
|
|
11
|
+
export declare const upsertRestrictions: (company: ICompany, restrictions: IUpsertRestrictionsPayload, config?: IRequestOptions) => Promise<IBackendApiClientResponse<string>>;
|
|
12
|
+
export declare const getPricePlans: (company: ICompany, config?: IRequestOptions) => Promise<IBackendApiClientResponse<IPricePlan[]>>;
|
|
13
|
+
export declare const createPricePlan: (company: ICompany, pricePlan: IPricePlan, config?: IRequestOptions) => Promise<IBackendApiClientResponse<string>>;
|
|
14
|
+
export declare const updatePricing: (company: ICompany, planId: string, pricing: IUpdatePricingPayload, config?: IRequestOptions) => Promise<IBackendApiClientResponse<IPricePlan[]>>;
|
|
15
|
+
export declare const deletePricePlan: (company: ICompany, pricePlan: IPricePlan, config?: IRequestOptions) => Promise<IBackendApiClientResponse<IPricePlan[]>>;
|
|
16
|
+
export declare const createChannel: (company: ICompany, channel: IChannel, config?: IRequestOptions) => Promise<IBackendApiClientResponse<{
|
|
17
|
+
oauthConnectLink?: string;
|
|
18
|
+
id?: string;
|
|
19
|
+
}>>;
|
|
20
|
+
export declare const getChannelById: (company: ICompany, channel: IChannel, config?: IRequestOptions) => Promise<IBackendApiClientResponse<IInboundMappedChannel>>;
|
|
21
|
+
export declare const updateChannel: (company: ICompany, channel: IChannel, config?: IRequestOptions) => Promise<IBackendApiClientResponse<void>>;
|
|
22
|
+
export declare const deleteChannel: (company: ICompany, channel: IChannel, config?: IRequestOptions) => Promise<IBackendApiClientResponse<void>>;
|
|
23
|
+
export declare const syncChannelData: (company: ICompany, channelId: string, channelData: ISyncChannelData, config?: IRequestOptions) => Promise<IBackendApiClientResponse<void>>;
|
|
24
|
+
export declare const acceptBooking: (company: ICompany, acceptBookingPayload: IAcceptRejectBooking, config?: IRequestOptions) => Promise<IBackendApiClientResponse<{
|
|
25
|
+
oauthConnectLink?: string;
|
|
26
|
+
}>>;
|
|
27
|
+
export declare const rejectBooking: (company: ICompany, rejectBookingPayload: IAcceptRejectBooking, config?: IRequestOptions) => Promise<IBackendApiClientResponse<{
|
|
28
|
+
oauthConnectLink?: string;
|
|
29
|
+
}>>;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rejectBooking = exports.acceptBooking = exports.syncChannelData = exports.deleteChannel = exports.updateChannel = exports.getChannelById = exports.createChannel = exports.deletePricePlan = exports.updatePricing = exports.createPricePlan = exports.getPricePlans = exports.upsertRestrictions = exports.createOrUpdateAvailability = exports.deleteRoomType = exports.updateRoomType = exports.createRoomType = exports.deleteCompany = exports.updateCompany = exports.createCompany = void 0;
|
|
4
|
+
const backend_api_client_1 = require("@usevisitor/backend-api-client");
|
|
5
|
+
const config_1 = require("./config");
|
|
6
|
+
const httpClient = () => new backend_api_client_1.BackendApiClient({
|
|
7
|
+
baseURL: config_1.GLOBAL_CONFIG.baseUrl,
|
|
8
|
+
serviceName: '[[INTEGRATIONS-CLIENT]]',
|
|
9
|
+
auth: {
|
|
10
|
+
apiKey: config_1.GLOBAL_CONFIG.apiKey,
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
const createCompany = async (company, config) => {
|
|
14
|
+
return httpClient().post('/companies', company, config);
|
|
15
|
+
};
|
|
16
|
+
exports.createCompany = createCompany;
|
|
17
|
+
const updateCompany = async (company, config) => {
|
|
18
|
+
return httpClient().put(`/companies/${company.id}`, company, config);
|
|
19
|
+
};
|
|
20
|
+
exports.updateCompany = updateCompany;
|
|
21
|
+
const deleteCompany = async (company, config) => {
|
|
22
|
+
return httpClient().del(`/companies/${company.id}`, company, config);
|
|
23
|
+
};
|
|
24
|
+
exports.deleteCompany = deleteCompany;
|
|
25
|
+
const createRoomType = async (company, roomType, config) => {
|
|
26
|
+
var _a, _b;
|
|
27
|
+
return httpClient().post(`/companies/${(_b = (_a = company.integrations) === null || _a === void 0 ? void 0 : _a.bnovo) === null || _b === void 0 ? void 0 : _b.id}/room-types`, roomType, config);
|
|
28
|
+
};
|
|
29
|
+
exports.createRoomType = createRoomType;
|
|
30
|
+
const updateRoomType = async (company, roomType, config) => {
|
|
31
|
+
var _a, _b, _c, _d;
|
|
32
|
+
return httpClient().put(`/companies/${(_b = (_a = company.integrations) === null || _a === void 0 ? void 0 : _a.bnovo) === null || _b === void 0 ? void 0 : _b.id}/room-types/${(_d = (_c = roomType.integrations) === null || _c === void 0 ? void 0 : _c.bnovo) === null || _d === void 0 ? void 0 : _d.id}`, roomType, config);
|
|
33
|
+
};
|
|
34
|
+
exports.updateRoomType = updateRoomType;
|
|
35
|
+
const deleteRoomType = async (company, roomType, config) => {
|
|
36
|
+
var _a, _b, _c, _d;
|
|
37
|
+
return httpClient().del(`/companies/${(_b = (_a = company.integrations) === null || _a === void 0 ? void 0 : _a.bnovo) === null || _b === void 0 ? void 0 : _b.id}/room-types/${(_d = (_c = roomType.integrations) === null || _c === void 0 ? void 0 : _c.bnovo) === null || _d === void 0 ? void 0 : _d.id}`, roomType, config);
|
|
38
|
+
};
|
|
39
|
+
exports.deleteRoomType = deleteRoomType;
|
|
40
|
+
const createOrUpdateAvailability = async (company, availability, config) => {
|
|
41
|
+
var _a, _b;
|
|
42
|
+
return httpClient().post(`/companies/${(_b = (_a = company.integrations) === null || _a === void 0 ? void 0 : _a.bnovo) === null || _b === void 0 ? void 0 : _b.id}/availability`, availability, config);
|
|
43
|
+
};
|
|
44
|
+
exports.createOrUpdateAvailability = createOrUpdateAvailability;
|
|
45
|
+
const upsertRestrictions = async (company, restrictions, config) => {
|
|
46
|
+
var _a, _b;
|
|
47
|
+
return httpClient().post(`/companies/${(_b = (_a = company.integrations) === null || _a === void 0 ? void 0 : _a.bnovo) === null || _b === void 0 ? void 0 : _b.id}/restrictions`, restrictions, config);
|
|
48
|
+
};
|
|
49
|
+
exports.upsertRestrictions = upsertRestrictions;
|
|
50
|
+
const getPricePlans = async (company, config) => {
|
|
51
|
+
var _a, _b;
|
|
52
|
+
return httpClient().get(`/companies/${(_b = (_a = company.integrations) === null || _a === void 0 ? void 0 : _a.bnovo) === null || _b === void 0 ? void 0 : _b.id}/price-plans`, config);
|
|
53
|
+
};
|
|
54
|
+
exports.getPricePlans = getPricePlans;
|
|
55
|
+
const createPricePlan = async (company, pricePlan, config) => {
|
|
56
|
+
var _a, _b;
|
|
57
|
+
return httpClient().post(`/companies/${(_b = (_a = company.integrations) === null || _a === void 0 ? void 0 : _a.bnovo) === null || _b === void 0 ? void 0 : _b.id}/price-plans`, pricePlan, config);
|
|
58
|
+
};
|
|
59
|
+
exports.createPricePlan = createPricePlan;
|
|
60
|
+
const updatePricing = async (company, planId, pricing, config) => {
|
|
61
|
+
var _a, _b;
|
|
62
|
+
return httpClient().put(`/companies/${(_b = (_a = company.integrations) === null || _a === void 0 ? void 0 : _a.bnovo) === null || _b === void 0 ? void 0 : _b.id}/price-plans/${planId}`, pricing, config);
|
|
63
|
+
};
|
|
64
|
+
exports.updatePricing = updatePricing;
|
|
65
|
+
const deletePricePlan = async (company, pricePlan, config) => {
|
|
66
|
+
var _a, _b;
|
|
67
|
+
return httpClient().del(`/companies/${(_b = (_a = company.integrations) === null || _a === void 0 ? void 0 : _a.bnovo) === null || _b === void 0 ? void 0 : _b.id}/price-plans/${pricePlan.integrations.bnovo.id}`, config);
|
|
68
|
+
};
|
|
69
|
+
exports.deletePricePlan = deletePricePlan;
|
|
70
|
+
const createChannel = async (company, channel, config) => {
|
|
71
|
+
var _a, _b;
|
|
72
|
+
return httpClient().post(`/companies/${(_b = (_a = company.integrations) === null || _a === void 0 ? void 0 : _a.bnovo) === null || _b === void 0 ? void 0 : _b.id}/channels`, channel, config);
|
|
73
|
+
};
|
|
74
|
+
exports.createChannel = createChannel;
|
|
75
|
+
const getChannelById = async (company, channel, config) => {
|
|
76
|
+
var _a, _b, _c, _d;
|
|
77
|
+
return httpClient().get(`/companies/${(_b = (_a = company.integrations) === null || _a === void 0 ? void 0 : _a.bnovo) === null || _b === void 0 ? void 0 : _b.id}/channels/${(_d = (_c = channel.integrations) === null || _c === void 0 ? void 0 : _c.bnovo) === null || _d === void 0 ? void 0 : _d.id}`, config);
|
|
78
|
+
};
|
|
79
|
+
exports.getChannelById = getChannelById;
|
|
80
|
+
const updateChannel = async (company, channel, config) => {
|
|
81
|
+
var _a, _b, _c, _d;
|
|
82
|
+
return httpClient().put(`/companies/${(_b = (_a = company.integrations) === null || _a === void 0 ? void 0 : _a.bnovo) === null || _b === void 0 ? void 0 : _b.id}/channels/${(_d = (_c = channel.integrations) === null || _c === void 0 ? void 0 : _c.bnovo) === null || _d === void 0 ? void 0 : _d.id}`, channel, config);
|
|
83
|
+
};
|
|
84
|
+
exports.updateChannel = updateChannel;
|
|
85
|
+
const deleteChannel = async (company, channel, config) => {
|
|
86
|
+
var _a, _b, _c, _d;
|
|
87
|
+
return httpClient().del(`/companies/${(_b = (_a = company.integrations) === null || _a === void 0 ? void 0 : _a.bnovo) === null || _b === void 0 ? void 0 : _b.id}/channels/${(_d = (_c = channel.integrations) === null || _c === void 0 ? void 0 : _c.bnovo) === null || _d === void 0 ? void 0 : _d.id}`, channel, config);
|
|
88
|
+
};
|
|
89
|
+
exports.deleteChannel = deleteChannel;
|
|
90
|
+
const syncChannelData = async (company, channelId, channelData, config) => {
|
|
91
|
+
var _a, _b;
|
|
92
|
+
return httpClient().post(`/companies/${(_b = (_a = company.integrations) === null || _a === void 0 ? void 0 : _a.bnovo) === null || _b === void 0 ? void 0 : _b.id}/channels/${channelId}/sync-data`, channelData, config);
|
|
93
|
+
};
|
|
94
|
+
exports.syncChannelData = syncChannelData;
|
|
95
|
+
const acceptBooking = async (company, acceptBookingPayload, config) => {
|
|
96
|
+
var _a, _b;
|
|
97
|
+
return httpClient().post(`/companies/${(_b = (_a = company.integrations) === null || _a === void 0 ? void 0 : _a.bnovo) === null || _b === void 0 ? void 0 : _b.id}/bookings/accept`, acceptBookingPayload, config);
|
|
98
|
+
};
|
|
99
|
+
exports.acceptBooking = acceptBooking;
|
|
100
|
+
const rejectBooking = async (company, rejectBookingPayload, config) => {
|
|
101
|
+
var _a, _b;
|
|
102
|
+
return httpClient().post(`/companies/${(_b = (_a = company.integrations) === null || _a === void 0 ? void 0 : _a.bnovo) === null || _b === void 0 ? void 0 : _b.id}/bookings/reject`, rejectBookingPayload, config);
|
|
103
|
+
};
|
|
104
|
+
exports.rejectBooking = rejectBooking;
|
|
105
|
+
//# sourceMappingURL=service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../../src/service.ts"],"names":[],"mappings":";;;AAAA,uEAA8G;AAC9G,qCAAyC;AAazC,MAAM,UAAU,GAAG,GAAG,EAAE,CACtB,IAAI,qCAAgB,CAAC;IACnB,OAAO,EA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EACjB,oBAA0C,EAC1C,MAAwB,EAC2C,EAAE;;IACrE,OAAO,UAAU,EAAE,CAAC,IAAI,CAAC,cAAc,YAAA,OAAO,CAAC,YAAY,0CAAE,KAAK,0CAAE,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,CAAC,CAAC;AAC1H,CAAC,CAAC;AANW,QAAA,aAAa,iBAMxB;AAEK,MAAM,aAAa,GAAG,KAAK,EAChC,OAAiB,EACjB,oBAA0C,EAC1C,MAAwB,EAC2C,EAAE;;IACrE,OAAO,UAAU,EAAE,CAAC,IAAI,CAAC,cAAc,YAAA,OAAO,CAAC,YAAY,0CAAE,KAAK,0CAAE,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,CAAC,CAAC;AAC1H,CAAC,CAAC;AANW,QAAA,aAAa,iBAMxB"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { BOOKING_SOURCE } from '@usevisitor/main-api-client';
|
|
2
|
+
export interface IInboundBooking {
|
|
3
|
+
data: {
|
|
4
|
+
account_id: string;
|
|
5
|
+
booking_numbers: string[];
|
|
6
|
+
};
|
|
7
|
+
sign: string;
|
|
8
|
+
}
|
|
9
|
+
export interface IAcceptRejectBooking {
|
|
10
|
+
channelId?: string;
|
|
11
|
+
code?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface IExternalBooking {
|
|
14
|
+
status?: 'CREATED' | 'CANCELED';
|
|
15
|
+
companyId: string;
|
|
16
|
+
code: string;
|
|
17
|
+
roomTypeId: string;
|
|
18
|
+
checkinDate: string;
|
|
19
|
+
checkoutDate: string;
|
|
20
|
+
totalCost?: number;
|
|
21
|
+
firstName: string;
|
|
22
|
+
lastName: string;
|
|
23
|
+
email: string;
|
|
24
|
+
phoneNumber?: string;
|
|
25
|
+
numberOfAdults?: number;
|
|
26
|
+
numberOfChildren?: number;
|
|
27
|
+
numberOfRooms?: number;
|
|
28
|
+
isFetched?: boolean;
|
|
29
|
+
bookingSource: BOOKING_SOURCE;
|
|
30
|
+
extra: {
|
|
31
|
+
details?: string;
|
|
32
|
+
isPaid?: boolean;
|
|
33
|
+
otaComission?: number;
|
|
34
|
+
otaBookingId?: string;
|
|
35
|
+
arrivalTime?: string;
|
|
36
|
+
breakfastIncluded?: boolean;
|
|
37
|
+
breakfastCost?: number;
|
|
38
|
+
excludedFees?: number;
|
|
39
|
+
};
|
|
40
|
+
isSynced?: boolean;
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bookings.js","sourceRoot":"","sources":["../../../../src/interfaces/bookings.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface ISyncChannelData {
|
|
2
|
+
otaSettingsId: string;
|
|
3
|
+
roomTypes: {
|
|
4
|
+
externalRoomTypeId: string;
|
|
5
|
+
otaRoomTypeId: string;
|
|
6
|
+
}[];
|
|
7
|
+
occupancies?: {
|
|
8
|
+
externalOccupancyId: string;
|
|
9
|
+
otaOccupancyId: string;
|
|
10
|
+
}[];
|
|
11
|
+
plans?: {
|
|
12
|
+
externalPlanId: string;
|
|
13
|
+
otaPlanId: string;
|
|
14
|
+
}[];
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channels.js","sourceRoot":"","sources":["../../../../src/interfaces/channels.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { CHANNEL_TYPE } from '@usevisitor/main-api-client';
|
|
2
|
+
import { CURRENCY } from '@usevisitor/partner-client/lib/client/src/interfaces';
|
|
3
|
+
export { LANGUAGE, CURRENCY } from '@usevisitor/common-models/lib/interfaces';
|
|
4
|
+
export declare type DateOrString = Date | string;
|
|
5
|
+
export interface ITimestamps {
|
|
6
|
+
createdAt?: DateOrString;
|
|
7
|
+
updatedAt?: DateOrString;
|
|
8
|
+
deletedAt?: DateOrString;
|
|
9
|
+
}
|
|
10
|
+
export interface IUser extends ITimestamps {
|
|
11
|
+
id?: string;
|
|
12
|
+
email?: string;
|
|
13
|
+
password?: string;
|
|
14
|
+
tokenInfo?: any;
|
|
15
|
+
firstName?: string;
|
|
16
|
+
lastName?: string;
|
|
17
|
+
profilePhoto?: string;
|
|
18
|
+
isActive?: boolean;
|
|
19
|
+
resetPasswordId?: string;
|
|
20
|
+
currentCompany?: ICompany;
|
|
21
|
+
companies?: ICompany[];
|
|
22
|
+
isTenant?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface ICompany extends ITimestamps {
|
|
25
|
+
id?: string;
|
|
26
|
+
name?: string;
|
|
27
|
+
stars?: number;
|
|
28
|
+
partnerId?: string;
|
|
29
|
+
companyCreatedByUserId?: string;
|
|
30
|
+
newBookingsResponsibleUserId?: string;
|
|
31
|
+
isEnabled?: boolean;
|
|
32
|
+
isDefault?: boolean;
|
|
33
|
+
phoneNumbers?: string[];
|
|
34
|
+
timezone?: string;
|
|
35
|
+
address?: {
|
|
36
|
+
streetName?: string;
|
|
37
|
+
streetNumber?: string;
|
|
38
|
+
zipCode?: string;
|
|
39
|
+
city?: string;
|
|
40
|
+
country?: string;
|
|
41
|
+
};
|
|
42
|
+
checkinTime?: {
|
|
43
|
+
start: DateOrString;
|
|
44
|
+
end: DateOrString;
|
|
45
|
+
};
|
|
46
|
+
checkoutTime?: {
|
|
47
|
+
start: DateOrString;
|
|
48
|
+
end: DateOrString;
|
|
49
|
+
};
|
|
50
|
+
currency?: CURRENCY;
|
|
51
|
+
email?: string;
|
|
52
|
+
integrations?: {
|
|
53
|
+
bnovo?: {
|
|
54
|
+
id?: string;
|
|
55
|
+
isEnabled?: boolean;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export interface IRoomType extends ITimestamps {
|
|
60
|
+
id?: string;
|
|
61
|
+
companyId?: string;
|
|
62
|
+
name?: string;
|
|
63
|
+
price?: number;
|
|
64
|
+
maxNumberOfAdults?: number;
|
|
65
|
+
description?: string;
|
|
66
|
+
images?: IFile[];
|
|
67
|
+
amenities?: any;
|
|
68
|
+
integrations?: IRoomTypeIntegrations;
|
|
69
|
+
}
|
|
70
|
+
export interface IRoomTypeIntegrations {
|
|
71
|
+
bnovo?: {
|
|
72
|
+
id?: string;
|
|
73
|
+
isEnabled?: boolean;
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
export declare type IRoomTypesAvailability = {
|
|
77
|
+
[roomTypeId: string]: {
|
|
78
|
+
integrations?: IRoomTypeIntegrations;
|
|
79
|
+
availability?: {
|
|
80
|
+
[date: string]: number;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
export declare type IUpdatePricingPayload = {
|
|
85
|
+
planId: string;
|
|
86
|
+
pricing: {
|
|
87
|
+
[roomTypeId: string]: {
|
|
88
|
+
[date: string]: number;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
export interface IPartner extends ITimestamps {
|
|
93
|
+
id?: string;
|
|
94
|
+
name?: string;
|
|
95
|
+
subdomains?: string[];
|
|
96
|
+
themeData?: any;
|
|
97
|
+
}
|
|
98
|
+
export interface ISortField {
|
|
99
|
+
field?: string;
|
|
100
|
+
direction?: string;
|
|
101
|
+
}
|
|
102
|
+
export interface IPagingField {
|
|
103
|
+
skip?: number;
|
|
104
|
+
take?: number;
|
|
105
|
+
}
|
|
106
|
+
export interface ISortFilterPaging<T> {
|
|
107
|
+
filter?: T;
|
|
108
|
+
sort?: ISortField;
|
|
109
|
+
paging?: IPagingField;
|
|
110
|
+
}
|
|
111
|
+
export interface IListResultWithCount<T> {
|
|
112
|
+
list: T[];
|
|
113
|
+
filterCount?: number;
|
|
114
|
+
selectedCount?: number;
|
|
115
|
+
totalCount: number;
|
|
116
|
+
}
|
|
117
|
+
export declare enum SORT_DIRECTION {
|
|
118
|
+
ASC = "ASC",
|
|
119
|
+
DESC = "DESC"
|
|
120
|
+
}
|
|
121
|
+
export interface IFile {
|
|
122
|
+
resourcePath?: string;
|
|
123
|
+
size?: number;
|
|
124
|
+
order?: number;
|
|
125
|
+
type?: string;
|
|
126
|
+
name?: string;
|
|
127
|
+
}
|
|
128
|
+
export interface IChannel {
|
|
129
|
+
id?: string;
|
|
130
|
+
type?: CHANNEL_TYPE;
|
|
131
|
+
credentials?: any;
|
|
132
|
+
integrations?: {
|
|
133
|
+
bnovo?: {
|
|
134
|
+
id?: string;
|
|
135
|
+
isEnabled?: boolean;
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
export interface IInboundMappedChannel extends IChannel {
|
|
140
|
+
rooms?: {
|
|
141
|
+
id: string;
|
|
142
|
+
name: string;
|
|
143
|
+
extra: any;
|
|
144
|
+
plans: any[];
|
|
145
|
+
published: any;
|
|
146
|
+
roomModification: number;
|
|
147
|
+
assignedInOtherHotelName: string;
|
|
148
|
+
assignedInOtherOtaSettings: boolean;
|
|
149
|
+
}[];
|
|
150
|
+
plans?: {
|
|
151
|
+
id: string;
|
|
152
|
+
name: string;
|
|
153
|
+
extra: any[];
|
|
154
|
+
currency: string;
|
|
155
|
+
allPlansIds: any[];
|
|
156
|
+
room_categories: string[];
|
|
157
|
+
planModification: number;
|
|
158
|
+
roomsOccupancies: {
|
|
159
|
+
[otaRoomId: string]: {
|
|
160
|
+
[roomOccupancyId: string]: number;
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
}[];
|
|
164
|
+
occupancies?: {
|
|
165
|
+
id: string;
|
|
166
|
+
name: string;
|
|
167
|
+
extra: any[];
|
|
168
|
+
currency: string;
|
|
169
|
+
allPlansIds: any[];
|
|
170
|
+
room_categories: string[];
|
|
171
|
+
planModification: number;
|
|
172
|
+
roomsOccupancies: {
|
|
173
|
+
[otaRoomId: string]: {
|
|
174
|
+
[roomOccupancyId: string]: number;
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
}[];
|
|
178
|
+
}
|
|
179
|
+
export interface IUpsertRestrictionsPayload {
|
|
180
|
+
pricePlanId: number;
|
|
181
|
+
restrictions: {
|
|
182
|
+
[roomTypeId: string]: {
|
|
183
|
+
[date: string]: {
|
|
184
|
+
min_stay: 0;
|
|
185
|
+
min_stay_arrival: 0;
|
|
186
|
+
max_stay: 0;
|
|
187
|
+
closed: 0;
|
|
188
|
+
closed_arrival: 0;
|
|
189
|
+
closed_departure: 0;
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
export * from './channels';
|
|
195
|
+
export * from './bookings';
|
|
196
|
+
export * from '@usevisitor/common-models/lib/interfaces';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.SORT_DIRECTION = exports.CURRENCY = exports.LANGUAGE = void 0;
|
|
14
|
+
var interfaces_1 = require("@usevisitor/common-models/lib/interfaces");
|
|
15
|
+
Object.defineProperty(exports, "LANGUAGE", { enumerable: true, get: function () { return interfaces_1.LANGUAGE; } });
|
|
16
|
+
Object.defineProperty(exports, "CURRENCY", { enumerable: true, get: function () { return interfaces_1.CURRENCY; } });
|
|
17
|
+
var SORT_DIRECTION;
|
|
18
|
+
(function (SORT_DIRECTION) {
|
|
19
|
+
SORT_DIRECTION["ASC"] = "ASC";
|
|
20
|
+
SORT_DIRECTION["DESC"] = "DESC";
|
|
21
|
+
})(SORT_DIRECTION = exports.SORT_DIRECTION || (exports.SORT_DIRECTION = {}));
|
|
22
|
+
__exportStar(require("./channels"), exports);
|
|
23
|
+
__exportStar(require("./bookings"), exports);
|
|
24
|
+
__exportStar(require("@usevisitor/common-models/lib/interfaces"), exports);
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAGA,uEAA8E;AAArE,sGAAA,QAAQ,OAAA;AAAE,sGAAA,QAAQ,OAAA;AAgI3B,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,6BAAW,CAAA;IACX,+BAAa,CAAA;AACf,CAAC,EAHW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAGzB;AA+ED,6CAA2B;AAC3B,6CAA2B;AAC3B,2EAAyD"}
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hyper.software/visitor-integrations-client",
|
|
3
|
+
"version": "1.2.26",
|
|
4
|
+
"main": "./lib/client/src/index.js",
|
|
5
|
+
"types": "./lib/client/src/index.d.ts",
|
|
6
|
+
"author": "Raul Tomescu <tomescu.raul+hyper@gmail.com>",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"repository": {},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"lint": "./node_modules/tslint/bin/tslint 'src/**/*.ts'",
|
|
11
|
+
"build": "rm -rf ./lib/* && tsc",
|
|
12
|
+
"publish-package": "git add . && git commit -m 'Publish package' --allow-empty && tslint './src/**/*.ts?(x)' --fix && rm -rf ./lib && yarn build && npm version patch && npm publish"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@usevisitor/backend-api-client": "^1.1.1",
|
|
16
|
+
"@usevisitor/sqs": "^1.1.2",
|
|
17
|
+
"qs": "^6.9.1"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"tslint": "^6.0.0",
|
|
21
|
+
"tslint-eslint-rules": "^5.4.0",
|
|
22
|
+
"typescript": "^4.1.3"
|
|
23
|
+
}
|
|
24
|
+
}
|
package/src/config.ts
ADDED
package/src/index.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export * from '../../src/interfaces';
|
|
2
|
+
|
|
3
|
+
export interface IInitOptions {
|
|
4
|
+
baseUrl: string;
|
|
5
|
+
apiKey?: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface IPartnerFeatures {
|
|
9
|
+
movein: boolean;
|
|
10
|
+
myNeighborhood: boolean;
|
|
11
|
+
tenantMarketplace: boolean;
|
|
12
|
+
adminPortfolio: boolean;
|
|
13
|
+
propertiesAdvanced: boolean;
|
|
14
|
+
tasks: boolean;
|
|
15
|
+
scoring: boolean;
|
|
16
|
+
selling: boolean;
|
|
17
|
+
commercial: boolean;
|
|
18
|
+
eSignature: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface IAddress {
|
|
22
|
+
streetName?: string;
|
|
23
|
+
streetNumber?: string;
|
|
24
|
+
zipCode?: string;
|
|
25
|
+
city?: string;
|
|
26
|
+
country?: string;
|
|
27
|
+
}
|
|
File without changes
|
package/src/service.ts
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { BackendApiClient, IRequestOptions, IBackendApiClientResponse } from '@usevisitor/backend-api-client';
|
|
2
|
+
import { GLOBAL_CONFIG } from './config';
|
|
3
|
+
import {
|
|
4
|
+
ISyncChannelData,
|
|
5
|
+
IInboundMappedChannel,
|
|
6
|
+
ICompany,
|
|
7
|
+
IRoomType,
|
|
8
|
+
IRoomTypesAvailability,
|
|
9
|
+
IChannel,
|
|
10
|
+
IUpsertRestrictionsPayload,
|
|
11
|
+
IAcceptRejectBooking,
|
|
12
|
+
} from './interfaces';
|
|
13
|
+
import { IPricePlan, IUpdatePricingPayload } from '../../src/interfaces';
|
|
14
|
+
|
|
15
|
+
const httpClient = () =>
|
|
16
|
+
new BackendApiClient({
|
|
17
|
+
baseURL: GLOBAL_CONFIG.baseUrl,
|
|
18
|
+
serviceName: '[[INTEGRATIONS-CLIENT]]',
|
|
19
|
+
auth: {
|
|
20
|
+
apiKey: GLOBAL_CONFIG.apiKey,
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export const createCompany = async (
|
|
25
|
+
company: ICompany,
|
|
26
|
+
config?: IRequestOptions,
|
|
27
|
+
): Promise<IBackendApiClientResponse<string>> => {
|
|
28
|
+
return httpClient().post('/companies', company, config);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const updateCompany = async (
|
|
32
|
+
company: ICompany,
|
|
33
|
+
config?: IRequestOptions,
|
|
34
|
+
): Promise<IBackendApiClientResponse<void>> => {
|
|
35
|
+
return httpClient().put(`/companies/${company.id}`, company, config);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const deleteCompany = async (
|
|
39
|
+
company: ICompany,
|
|
40
|
+
config?: IRequestOptions,
|
|
41
|
+
): Promise<IBackendApiClientResponse<void>> => {
|
|
42
|
+
return httpClient().del(`/companies/${company.id}`, company, config);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const createRoomType = async (
|
|
46
|
+
company: ICompany,
|
|
47
|
+
roomType: IRoomType,
|
|
48
|
+
config?: IRequestOptions,
|
|
49
|
+
): Promise<IBackendApiClientResponse<string>> => {
|
|
50
|
+
return httpClient().post(`/companies/${company.integrations?.bnovo?.id}/room-types`, roomType, config);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const updateRoomType = async (
|
|
54
|
+
company: ICompany,
|
|
55
|
+
roomType: IRoomType,
|
|
56
|
+
config?: IRequestOptions,
|
|
57
|
+
): Promise<IBackendApiClientResponse<void>> => {
|
|
58
|
+
return httpClient().put(
|
|
59
|
+
`/companies/${company.integrations?.bnovo?.id}/room-types/${roomType.integrations?.bnovo?.id}`,
|
|
60
|
+
roomType,
|
|
61
|
+
config,
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const deleteRoomType = async (
|
|
66
|
+
company: ICompany,
|
|
67
|
+
roomType: IRoomType,
|
|
68
|
+
config?: IRequestOptions,
|
|
69
|
+
): Promise<IBackendApiClientResponse<void>> => {
|
|
70
|
+
return httpClient().del(
|
|
71
|
+
`/companies/${company.integrations?.bnovo?.id}/room-types/${roomType.integrations?.bnovo?.id}`,
|
|
72
|
+
roomType,
|
|
73
|
+
config,
|
|
74
|
+
);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export const createOrUpdateAvailability = async (
|
|
78
|
+
company: ICompany,
|
|
79
|
+
availability: IRoomTypesAvailability,
|
|
80
|
+
config?: IRequestOptions,
|
|
81
|
+
): Promise<IBackendApiClientResponse<string>> => {
|
|
82
|
+
return httpClient().post(`/companies/${company.integrations?.bnovo?.id}/availability`, availability, config);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export const upsertRestrictions = async (
|
|
86
|
+
company: ICompany,
|
|
87
|
+
restrictions: IUpsertRestrictionsPayload,
|
|
88
|
+
config?: IRequestOptions,
|
|
89
|
+
): Promise<IBackendApiClientResponse<string>> => {
|
|
90
|
+
return httpClient().post(`/companies/${company.integrations?.bnovo?.id}/restrictions`, restrictions, config);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export const getPricePlans = async (
|
|
94
|
+
company: ICompany,
|
|
95
|
+
config?: IRequestOptions,
|
|
96
|
+
): Promise<IBackendApiClientResponse<IPricePlan[]>> => {
|
|
97
|
+
return httpClient().get(`/companies/${company.integrations?.bnovo?.id}/price-plans`, config);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export const createPricePlan = async (
|
|
101
|
+
company: ICompany,
|
|
102
|
+
pricePlan: IPricePlan,
|
|
103
|
+
config?: IRequestOptions,
|
|
104
|
+
): Promise<IBackendApiClientResponse<string>> => {
|
|
105
|
+
return httpClient().post(`/companies/${company.integrations?.bnovo?.id}/price-plans`, pricePlan, config);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export const updatePricing = async (
|
|
109
|
+
company: ICompany,
|
|
110
|
+
planId: string,
|
|
111
|
+
pricing: IUpdatePricingPayload,
|
|
112
|
+
config?: IRequestOptions,
|
|
113
|
+
): Promise<IBackendApiClientResponse<IPricePlan[]>> => {
|
|
114
|
+
return httpClient().put(`/companies/${company.integrations?.bnovo?.id}/price-plans/${planId}`, pricing, config);
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export const deletePricePlan = async (
|
|
118
|
+
company: ICompany,
|
|
119
|
+
pricePlan: IPricePlan,
|
|
120
|
+
config?: IRequestOptions,
|
|
121
|
+
): Promise<IBackendApiClientResponse<IPricePlan[]>> => {
|
|
122
|
+
return httpClient().del(
|
|
123
|
+
`/companies/${company.integrations?.bnovo?.id}/price-plans/${pricePlan.integrations.bnovo.id}`,
|
|
124
|
+
config,
|
|
125
|
+
);
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
export const createChannel = async (
|
|
129
|
+
company: ICompany,
|
|
130
|
+
channel: IChannel,
|
|
131
|
+
config?: IRequestOptions,
|
|
132
|
+
): Promise<IBackendApiClientResponse<{ oauthConnectLink?: string; id?: string }>> => {
|
|
133
|
+
return httpClient().post(`/companies/${company.integrations?.bnovo?.id}/channels`, channel, config);
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export const getChannelById = async (
|
|
137
|
+
company: ICompany,
|
|
138
|
+
channel: IChannel,
|
|
139
|
+
config?: IRequestOptions,
|
|
140
|
+
): Promise<IBackendApiClientResponse<IInboundMappedChannel>> => {
|
|
141
|
+
return httpClient().get(
|
|
142
|
+
`/companies/${company.integrations?.bnovo?.id}/channels/${channel.integrations?.bnovo?.id}`,
|
|
143
|
+
config,
|
|
144
|
+
);
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export const updateChannel = async (
|
|
148
|
+
company: ICompany,
|
|
149
|
+
channel: IChannel,
|
|
150
|
+
config?: IRequestOptions,
|
|
151
|
+
): Promise<IBackendApiClientResponse<void>> => {
|
|
152
|
+
return httpClient().put(
|
|
153
|
+
`/companies/${company.integrations?.bnovo?.id}/channels/${channel.integrations?.bnovo?.id}`,
|
|
154
|
+
channel,
|
|
155
|
+
config,
|
|
156
|
+
);
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export const deleteChannel = async (
|
|
160
|
+
company: ICompany,
|
|
161
|
+
channel: IChannel,
|
|
162
|
+
config?: IRequestOptions,
|
|
163
|
+
): Promise<IBackendApiClientResponse<void>> => {
|
|
164
|
+
return httpClient().del(
|
|
165
|
+
`/companies/${company.integrations?.bnovo?.id}/channels/${channel.integrations?.bnovo?.id}`,
|
|
166
|
+
channel,
|
|
167
|
+
config,
|
|
168
|
+
);
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
export const syncChannelData = async (
|
|
172
|
+
company: ICompany,
|
|
173
|
+
channelId: string,
|
|
174
|
+
channelData: ISyncChannelData,
|
|
175
|
+
config?: IRequestOptions,
|
|
176
|
+
): Promise<IBackendApiClientResponse<void>> => {
|
|
177
|
+
return httpClient().post(
|
|
178
|
+
`/companies/${company.integrations?.bnovo?.id}/channels/${channelId}/sync-data`,
|
|
179
|
+
channelData,
|
|
180
|
+
config,
|
|
181
|
+
);
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
export const acceptBooking = async (
|
|
185
|
+
company: ICompany,
|
|
186
|
+
acceptBookingPayload: IAcceptRejectBooking,
|
|
187
|
+
config?: IRequestOptions,
|
|
188
|
+
): Promise<IBackendApiClientResponse<{ oauthConnectLink?: string }>> => {
|
|
189
|
+
return httpClient().post(`/companies/${company.integrations?.bnovo?.id}/bookings/accept`, acceptBookingPayload, config);
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
export const rejectBooking = async (
|
|
193
|
+
company: ICompany,
|
|
194
|
+
rejectBookingPayload: IAcceptRejectBooking,
|
|
195
|
+
config?: IRequestOptions,
|
|
196
|
+
): Promise<IBackendApiClientResponse<{ oauthConnectLink?: string }>> => {
|
|
197
|
+
return httpClient().post(`/companies/${company.integrations?.bnovo?.id}/bookings/reject`, rejectBookingPayload, config);
|
|
198
|
+
};
|