@kiminix/tp-client 1.20.0 → 1.22.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.
@@ -1,7 +1,5 @@
1
- import { Deal } from "./types/get-id";
2
- import { Deal as DealPage } from "./types/get-pages";
3
- import { GetPage } from "./types/get-pages";
1
+ import { Deal, GetDealsRequest } from "./types";
4
2
  export declare class DealsAPIs {
5
- static getPage({ timestamp, page, size, tags, businessId }: GetPage): Promise<DealPage[]>;
3
+ static getPage({ page, size, tags }: GetDealsRequest): Promise<Deal[]>;
6
4
  static get(identifier: string): Promise<Deal | undefined>;
7
5
  }
@@ -41,18 +41,16 @@ var DealsAPIs = /** @class */ (function () {
41
41
  function DealsAPIs() {
42
42
  }
43
43
  DealsAPIs.getPage = function (_a) {
44
- var timestamp = _a.timestamp, _b = _a.page, page = _b === void 0 ? 1 : _b, _c = _a.size, size = _c === void 0 ? 12 : _c, _d = _a.tags, tags = _d === void 0 ? [] : _d, businessId = _a.businessId;
44
+ var _b = _a.page, page = _b === void 0 ? 1 : _b, _c = _a.size, size = _c === void 0 ? 12 : _c, _d = _a.tags, tags = _d === void 0 ? [] : _d;
45
45
  return __awaiter(this, void 0, void 0, function () {
46
46
  var queryParams;
47
47
  return __generator(this, function (_e) {
48
48
  switch (_e.label) {
49
49
  case 0:
50
50
  queryParams = [
51
- "timestamp=".concat(timestamp),
52
51
  "page=".concat(page),
53
52
  "size=".concat(size),
54
- ((tags === null || tags === void 0 ? void 0 : tags.length) > 0) ? "tags=".concat(tags.join(',')) : undefined,
55
- businessId ? "business=".concat(businessId) : undefined
53
+ ((tags === null || tags === void 0 ? void 0 : tags.length) > 0) ? "tags=".concat(tags.join(',')) : undefined
56
54
  ]
57
55
  .filter(function (value) { return value; })
58
56
  .join("&");
@@ -73,9 +71,7 @@ var DealsAPIs = /** @class */ (function () {
73
71
  case 0: return [4 /*yield*/, axios.get(base + "/deals/".concat(identifier))
74
72
  .then(function (response) {
75
73
  var data = response.data;
76
- data.startAt = new Date(data.startAt);
77
- data.endAt = new Date(data.endAt);
78
- data.createdAt = new Date(data.createdAt);
74
+ data.updatedAt = new Date(data.updatedAt);
79
75
  return data;
80
76
  })
81
77
  .catch(function (error) {
@@ -1,40 +1,30 @@
1
+ import { Licence } from "../../types";
2
+
1
3
  export interface Price {
2
4
  reduced: number;
3
5
  current: number;
4
- weekend: number;
5
- }
6
- export interface Review {
7
- stars: number;
8
- count: number;
9
- link?: string;
10
6
  }
7
+
11
8
  export interface Business {
12
9
  id: string;
13
10
  identifier: string;
14
11
  name: string;
15
- createdAt: Date;
16
12
  address: string;
17
- images: string[];
18
- review?: Review;
13
+ licence?: Licence;
19
14
  }
20
15
  export interface Deal {
21
16
  id: string;
22
17
  identifier: string;
23
18
  title: string;
24
- images: string[];
25
- adultPrice: Price;
26
- childPrice: Price;
27
- createdAt: Date;
28
- startAt: Date;
29
- endAt: Date;
30
19
  isExpired: boolean;
31
20
  discount: number;
21
+ price: Price;
22
+ images: string[];
32
23
  business: Business;
24
+ updatedAt: Date;
33
25
  }
34
26
  export type GetPage = {
35
- timestamp: number;
36
27
  page?: number;
37
28
  size?: number;
38
29
  tags?: string[];
39
- businessId?: string;
40
30
  };
@@ -0,0 +1,28 @@
1
+ import { Licence } from "../types";
2
+ export interface GetDealsRequest {
3
+ page?: number;
4
+ size?: number;
5
+ tags?: string[];
6
+ }
7
+ export interface Price {
8
+ reduced: number;
9
+ current: number;
10
+ }
11
+ export interface Business {
12
+ id: string;
13
+ identifier: string;
14
+ name: string;
15
+ address: string;
16
+ licence?: Licence;
17
+ }
18
+ export interface Deal {
19
+ id: string;
20
+ identifier: string;
21
+ title: string;
22
+ isExpired: boolean;
23
+ discount: number;
24
+ price: Price;
25
+ images: string[];
26
+ business: Business;
27
+ updatedAt: Date;
28
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,7 +1,7 @@
1
1
  import { Either } from "purify-ts";
2
2
  import { PresetMenu } from "../types/preset-menu";
3
- import { UpdateDiscountRequest } from "./types/update-discount";
3
+ import { UpsertDiscountRequest } from "./types/update-discount";
4
4
  export declare class PresetMenusDiscountAdminAPIs {
5
- static update({ token, id, // preset menu id
6
- day, isAvailable, adultPrice, childPrice, minBookingTotal }: UpdateDiscountRequest): Promise<Either<Error, PresetMenu>>;
5
+ static upsert({ token, id, // preset menu id
6
+ days, isAvailable, adultPrice, childPrice, minBookingTotal }: UpsertDiscountRequest): Promise<Either<Error, PresetMenu>>;
7
7
  }
@@ -41,15 +41,15 @@ import { Left, Right } from "purify-ts";
41
41
  var PresetMenusDiscountAdminAPIs = /** @class */ (function () {
42
42
  function PresetMenusDiscountAdminAPIs() {
43
43
  }
44
- PresetMenusDiscountAdminAPIs.update = function (_a) {
44
+ PresetMenusDiscountAdminAPIs.upsert = function (_a) {
45
45
  var token = _a.token, id = _a.id, // preset menu id
46
- day = _a.day, isAvailable = _a.isAvailable, adultPrice = _a.adultPrice, childPrice = _a.childPrice, minBookingTotal = _a.minBookingTotal;
46
+ days = _a.days, isAvailable = _a.isAvailable, adultPrice = _a.adultPrice, childPrice = _a.childPrice, minBookingTotal = _a.minBookingTotal;
47
47
  return __awaiter(this, void 0, void 0, function () {
48
48
  return __generator(this, function (_b) {
49
49
  switch (_b.label) {
50
50
  case 0: return [4 /*yield*/, axios.patch(base + "/preset-menus/admin/discounts", {
51
51
  id: id,
52
- day: day,
52
+ days: days,
53
53
  isAvailable: isAvailable,
54
54
  adultPrice: adultPrice,
55
55
  childPrice: childPrice,
@@ -1,6 +1,6 @@
1
- export interface UpdateDiscountRequest {
1
+ export interface UpsertDiscountRequest {
2
2
  id: string;
3
- day: string;
3
+ days: string[];
4
4
  isAvailable: Boolean;
5
5
  adultPrice: number;
6
6
  childPrice?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiminix/tp-client",
3
- "version": "1.20.0",
3
+ "version": "1.22.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [