@kiminix/tp-client 1.16.0 → 1.18.0
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/enum.d.ts
CHANGED
|
@@ -20,3 +20,11 @@ export declare enum ReservationEventKind {
|
|
|
20
20
|
CanceledBusiness = "canceled_business",
|
|
21
21
|
Updated = "updated"
|
|
22
22
|
}
|
|
23
|
+
export declare enum CancellationReason {
|
|
24
|
+
UnavailablePlace = "unavailable_place",
|
|
25
|
+
UnreachableCustomer = "unreachable_customer",
|
|
26
|
+
CustomerRequest = "customer_request",
|
|
27
|
+
NonCompliant = "non_compliant",
|
|
28
|
+
ForceMajeur = "force_majeur",
|
|
29
|
+
Other = "other"
|
|
30
|
+
}
|
package/dist/enum.js
CHANGED
|
@@ -24,3 +24,12 @@ export var ReservationEventKind;
|
|
|
24
24
|
ReservationEventKind["CanceledBusiness"] = "canceled_business";
|
|
25
25
|
ReservationEventKind["Updated"] = "updated";
|
|
26
26
|
})(ReservationEventKind || (ReservationEventKind = {}));
|
|
27
|
+
export var CancellationReason;
|
|
28
|
+
(function (CancellationReason) {
|
|
29
|
+
CancellationReason["UnavailablePlace"] = "unavailable_place";
|
|
30
|
+
CancellationReason["UnreachableCustomer"] = "unreachable_customer";
|
|
31
|
+
CancellationReason["CustomerRequest"] = "customer_request";
|
|
32
|
+
CancellationReason["NonCompliant"] = "non_compliant";
|
|
33
|
+
CancellationReason["ForceMajeur"] = "force_majeur";
|
|
34
|
+
CancellationReason["Other"] = "other";
|
|
35
|
+
})(CancellationReason || (CancellationReason = {}));
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { ReservationStatus, TimelineDirection } from "../enum";
|
|
1
|
+
import { CancellationReason, ReservationStatus, TimelineDirection } from "../enum";
|
|
2
2
|
import { GetTransitionsRequest } from "../reservations/types/admin/get-available-transitions";
|
|
3
3
|
import { GetByIdRequest } from "./types/admin/get-id";
|
|
4
|
-
import { PatchStatusRequest } from "./types/admin/patch-status";
|
|
5
4
|
import { Reservation } from "./types/shared";
|
|
6
5
|
import { Either } from "purify-ts";
|
|
7
6
|
export declare class ReservationsAdminAPIs {
|
|
@@ -14,7 +13,15 @@ export declare class ReservationsAdminAPIs {
|
|
|
14
13
|
}): Promise<Reservation[]>;
|
|
15
14
|
static getById({ token, id }: GetByIdRequest): Promise<Reservation>;
|
|
16
15
|
static getAvailableTransitions({ token, reservationId }: GetTransitionsRequest): Promise<ReservationStatus[]>;
|
|
17
|
-
static patchStatus(
|
|
16
|
+
static patchStatus(props: {
|
|
17
|
+
token?: string;
|
|
18
|
+
id: string;
|
|
19
|
+
status: ReservationStatus;
|
|
20
|
+
cancellation?: {
|
|
21
|
+
reason: CancellationReason;
|
|
22
|
+
notes?: string;
|
|
23
|
+
};
|
|
24
|
+
}): Promise<Either<Error, any>>;
|
|
18
25
|
static reserveOnMenu(props: {
|
|
19
26
|
token?: string;
|
|
20
27
|
id: string;
|
|
@@ -122,31 +122,34 @@ var ReservationsAdminAPIs = /** @class */ (function () {
|
|
|
122
122
|
});
|
|
123
123
|
});
|
|
124
124
|
};
|
|
125
|
-
ReservationsAdminAPIs.patchStatus = function (
|
|
126
|
-
var token = _a.token, id = _a.id, status = _a.status;
|
|
125
|
+
ReservationsAdminAPIs.patchStatus = function (props) {
|
|
127
126
|
return __awaiter(this, void 0, void 0, function () {
|
|
128
|
-
return __generator(this, function (
|
|
129
|
-
switch (
|
|
130
|
-
case 0: return [4 /*yield*/, axios.patch(base + "/reservations/admin
|
|
127
|
+
return __generator(this, function (_a) {
|
|
128
|
+
switch (_a.label) {
|
|
129
|
+
case 0: return [4 /*yield*/, axios.patch(base + "/reservations/admin", {
|
|
130
|
+
id: props.id,
|
|
131
|
+
status: props.status,
|
|
132
|
+
cancellation: props.cancellation
|
|
133
|
+
}, {
|
|
131
134
|
headers: {
|
|
132
|
-
'Authorization': "".concat(token)
|
|
135
|
+
'Authorization': "".concat(props.token)
|
|
133
136
|
}
|
|
134
137
|
})
|
|
135
|
-
.then(function (response) { return response.data; })
|
|
138
|
+
.then(function (response) { return Right(response.data); })
|
|
136
139
|
.catch(function (error) {
|
|
137
140
|
// handle error
|
|
138
141
|
if (error.response.status == 401)
|
|
139
|
-
|
|
142
|
+
return Left(Error("unauthorized"));
|
|
140
143
|
else if (error.response.status == 404)
|
|
141
|
-
|
|
144
|
+
return Left(Error("not_found"));
|
|
142
145
|
else if (error.response.status == 400) {
|
|
143
146
|
var response = error.response.data;
|
|
144
|
-
|
|
147
|
+
return Left(Error(response.code));
|
|
145
148
|
}
|
|
146
149
|
else
|
|
147
|
-
|
|
150
|
+
return Left(Error('internal_error'));
|
|
148
151
|
})];
|
|
149
|
-
case 1: return [2 /*return*/,
|
|
152
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
150
153
|
}
|
|
151
154
|
});
|
|
152
155
|
});
|
|
@@ -172,17 +175,17 @@ var ReservationsAdminAPIs = /** @class */ (function () {
|
|
|
172
175
|
.catch(function (error) {
|
|
173
176
|
// handle error
|
|
174
177
|
if (error.response.status == 401)
|
|
175
|
-
return Left(
|
|
178
|
+
return Left(Error("unauthorized"));
|
|
176
179
|
else if (error.response.status == 404)
|
|
177
|
-
return Left(
|
|
180
|
+
return Left(Error("not_found"));
|
|
178
181
|
else if (error.response.status == 400) {
|
|
179
182
|
//unavailable_day
|
|
180
183
|
//inactive_manual_booking
|
|
181
184
|
var response = error.response.data;
|
|
182
|
-
|
|
185
|
+
return Left(Error(response.code));
|
|
183
186
|
}
|
|
184
187
|
else
|
|
185
|
-
return Left(
|
|
188
|
+
return Left(Error('internal_error'));
|
|
186
189
|
})];
|
|
187
190
|
case 1: return [2 /*return*/, _a.sent()];
|
|
188
191
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReservationEventKind, ReservationStatus } from "../../enum";
|
|
1
|
+
import { CancellationReason, ReservationEventKind, ReservationStatus } from "../../enum";
|
|
2
2
|
export interface Business {
|
|
3
3
|
id: string;
|
|
4
4
|
identifier: string;
|
|
@@ -50,9 +50,3 @@ export interface Cancellation {
|
|
|
50
50
|
reason: CancellationReason;
|
|
51
51
|
notes?: string;
|
|
52
52
|
}
|
|
53
|
-
declare enum CancellationReason {
|
|
54
|
-
CustomerRequest = "customer_request",
|
|
55
|
-
UnreachableCustomer = "unreachable_customer",
|
|
56
|
-
Other = "other"
|
|
57
|
-
}
|
|
58
|
-
export {};
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
var CancellationReason;
|
|
2
|
-
(function (CancellationReason) {
|
|
3
|
-
CancellationReason["CustomerRequest"] = "customer_request";
|
|
4
|
-
CancellationReason["UnreachableCustomer"] = "unreachable_customer";
|
|
5
|
-
CancellationReason["Other"] = "other";
|
|
6
|
-
})(CancellationReason || (CancellationReason = {}));
|
|
7
1
|
export {};
|