@kiminix/tp-client 2.22.0 → 2.23.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,8 +1,11 @@
1
1
  import { AllBusiness } from "./types/get-all";
2
2
  import { Business } from "./types/get-id";
3
- import { MenuCategory } from "./types/get-carte-menus";
3
+ import { UpdateBusinessRequest } from "./types/update-business";
4
4
  export declare class BusinessAPIs {
5
5
  static getAll(timestamp: number, page?: number, size?: number): Promise<AllBusiness[]>;
6
6
  static get(identifier: string): Promise<Business | undefined>;
7
- static getCarteMenus(identifier: string): Promise<MenuCategory[]>;
7
+ static update(props: {
8
+ token: string;
9
+ request: UpdateBusinessRequest;
10
+ }): Promise<void>;
8
11
  }
@@ -35,8 +35,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
35
35
  }
36
36
  };
37
37
  import axios from "axios";
38
- import { base } from "../constants";
39
38
  import { parseISO } from "date-fns";
39
+ import { base } from "../constants";
40
40
  import { RequestUtils } from "../utils/request-utils";
41
41
  // business module APIs
42
42
  var BusinessAPIs = /** @class */ (function () {
@@ -87,17 +87,19 @@ var BusinessAPIs = /** @class */ (function () {
87
87
  });
88
88
  });
89
89
  };
90
- BusinessAPIs.getCarteMenus = function (identifier) {
90
+ BusinessAPIs.update = function (props) {
91
91
  return __awaiter(this, void 0, void 0, function () {
92
92
  var _this = this;
93
93
  return __generator(this, function (_a) {
94
94
  return [2 /*return*/, RequestUtils.send(function () { return __awaiter(_this, void 0, void 0, function () {
95
95
  return __generator(this, function (_a) {
96
96
  switch (_a.label) {
97
- case 0: return [4 /*yield*/, axios.get(base + "/business/".concat(identifier, "/carte-menus"))
98
- .then(function (response) {
99
- return response.data;
100
- })];
97
+ case 0: return [4 /*yield*/, axios.put(base + "/business", props.request, {
98
+ headers: {
99
+ 'Authorization': "".concat(props.token)
100
+ }
101
+ })
102
+ .then(function (_) { return undefined; })];
101
103
  case 1: return [2 /*return*/, _a.sent()];
102
104
  }
103
105
  });
@@ -1,4 +1,3 @@
1
- export * from "./types/get-carte-menus";
2
1
  export * from "./types/get-all";
3
2
  export * from "./types/get-id";
4
3
  export { BusinessAPIs } from './apis';
@@ -1,4 +1,3 @@
1
- export * from "./types/get-carte-menus";
2
1
  export * from "./types/get-all";
3
2
  export * from "./types/get-id";
4
3
  export { BusinessAPIs } from './apis';
@@ -3,8 +3,6 @@ export interface AllBusiness {
3
3
  identifier: string;
4
4
  name: string;
5
5
  address: string;
6
- images: string[];
7
6
  maxCashbackApply: number;
8
- averagePrice: number | undefined;
9
7
  specialities: string[] | undefined;
10
8
  }
@@ -9,14 +9,14 @@ export interface Business {
9
9
  licence: Licence | undefined;
10
10
  createdAt: Date;
11
11
  address: string;
12
- googleMapUrl: string;
12
+ googleMapsUrl: string;
13
+ googleMapsReviewLink: string;
14
+ socialLinks: [];
13
15
  phones: string[];
14
- images: string[];
15
16
  email: string;
16
17
  description: string | undefined;
17
18
  maxCashbackApply: number;
18
- openingHours: OpeningHours[];
19
- averagePrice: number | undefined;
19
+ openingHours: OpeningHours | undefined;
20
20
  specialities: string[] | undefined;
21
21
  telegram?: TelegramConfig | undefined;
22
22
  template?: Template | undefined;
@@ -1,8 +1,26 @@
1
+ import { LocalTime } from "../../types";
1
2
  export interface OpeningHours {
2
- from: string;
3
- to: string;
3
+ sunday: TimeSlot[];
4
+ monday: TimeSlot[];
5
+ tuesday: TimeSlot[];
6
+ wednesday: TimeSlot[];
7
+ thursday: TimeSlot[];
8
+ friday: TimeSlot[];
9
+ saturday: TimeSlot[];
10
+ }
11
+ export interface TimeSlot {
12
+ openTime: LocalTime;
13
+ closeTime: LocalTime;
4
14
  }
5
15
  export interface TelegramConfig {
6
16
  chatId: string | undefined;
7
17
  inviteLink: string | undefined;
8
18
  }
19
+ export interface SocialLinks {
20
+ facebook?: string | undefined;
21
+ instagram?: string | undefined;
22
+ twitter?: string | undefined;
23
+ tiktok?: string | undefined;
24
+ youtube?: string | undefined;
25
+ website?: string | undefined;
26
+ }
@@ -0,0 +1,10 @@
1
+ import { OpeningHours, SocialLinks } from "./shared";
2
+ export interface UpdateBusinessRequest {
3
+ name: string;
4
+ address: string;
5
+ phones: string[];
6
+ openingHours?: OpeningHours | undefined;
7
+ socialLinks?: SocialLinks | undefined;
8
+ googleMapsUrl?: string | undefined;
9
+ googleMapsReviewLink?: string | undefined;
10
+ }
@@ -10,7 +10,6 @@ export interface BusinessOfDeal {
10
10
  address: string;
11
11
  images: string[];
12
12
  maxCashbackApply: number;
13
- averagePrice: number | undefined;
14
13
  specialities: string[] | undefined;
15
14
  }
16
15
  export interface Deal {
@@ -0,0 +1,16 @@
1
+ import { Response } from "../types/business-signin";
2
+ export declare class IamAdminAPIs {
3
+ static myBusiness(props: {
4
+ token: string;
5
+ }): Promise<IamAdminAPIs.MyBusiness[]>;
6
+ static signIn(props: {
7
+ businessId: string;
8
+ token: string;
9
+ }): Promise<Response>;
10
+ }
11
+ export declare namespace IamAdminAPIs {
12
+ interface MyBusiness {
13
+ id: string;
14
+ name: string;
15
+ }
16
+ }
@@ -35,19 +35,35 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
35
35
  }
36
36
  };
37
37
  import axios from "axios";
38
- import { base } from "../constants";
39
- import { RequestUtils } from "../utils/request-utils";
38
+ import { base } from "../../constants";
39
+ import { RequestUtils } from "../../utils/request-utils";
40
40
  // iam module APIs
41
41
  var IamAdminAPIs = /** @class */ (function () {
42
42
  function IamAdminAPIs() {
43
43
  }
44
- IamAdminAPIs.signIn = function (identifier, password) {
44
+ IamAdminAPIs.myBusiness = function (props) {
45
45
  return __awaiter(this, void 0, void 0, function () {
46
46
  return __generator(this, function (_a) {
47
47
  return [2 /*return*/, RequestUtils.send(function () {
48
- return axios.post(base + "/iam/admin/sign-in", { identifier: identifier, password: password }, {
48
+ return axios.get(base + "/iam/admin/my-business", {
49
49
  headers: {
50
- 'Content-Type': 'application/json'
50
+ 'Content-Type': 'application/json',
51
+ 'Authorization': "".concat(props.token)
52
+ }
53
+ })
54
+ .then(function (response) { return response.data; });
55
+ })];
56
+ });
57
+ });
58
+ };
59
+ IamAdminAPIs.signIn = function (props) {
60
+ return __awaiter(this, void 0, void 0, function () {
61
+ return __generator(this, function (_a) {
62
+ return [2 /*return*/, RequestUtils.send(function () {
63
+ return axios.get(base + "/iam/admin/sign-in/".concat(props.businessId), {
64
+ headers: {
65
+ 'Content-Type': 'application/json',
66
+ 'Authorization': "".concat(props.token)
51
67
  }
52
68
  })
53
69
  .then(function (response) { return response.data; });
@@ -5,7 +5,7 @@ export * from './types/update-profile';
5
5
  export * from './types/user-signin';
6
6
  export * from './types/user-signup-validate';
7
7
  export * from './types/user-signup';
8
- export { IamAdminAPIs } from './admin-apis';
8
+ export { IamAdminAPIs } from './api/signin-admin';
9
9
  export { IamUserAPIs } from './user-apis';
10
10
  export { GetRolesAdminAPI } from './api/get-roles';
11
11
  export { GetAdminsAPI } from './api/get-admins';
package/dist/iam/index.js CHANGED
@@ -5,7 +5,7 @@ export * from './types/update-profile';
5
5
  export * from './types/user-signin';
6
6
  export * from './types/user-signup-validate';
7
7
  export * from './types/user-signup';
8
- export { IamAdminAPIs } from './admin-apis';
8
+ export { IamAdminAPIs } from './api/signin-admin';
9
9
  export { IamUserAPIs } from './user-apis';
10
10
  // api
11
11
  export { GetRolesAdminAPI } from './api/get-roles';
@@ -10,17 +10,17 @@ export declare namespace GetMenuAdminAPI {
10
10
  isPublic: boolean;
11
11
  products: Product[];
12
12
  }
13
- class Product {
13
+ interface Product {
14
14
  id: string;
15
15
  label: string;
16
- description?: string;
16
+ description?: string | undefined;
17
17
  picture?: string | undefined;
18
18
  variants: Variant[];
19
19
  }
20
20
  function isAvailable(product: Product): boolean;
21
21
  interface Variant {
22
22
  id: string;
23
- label?: string;
23
+ label?: string | undefined;
24
24
  isAvailable: boolean;
25
25
  price: number;
26
26
  discount?: number;
@@ -58,12 +58,6 @@ var GetMenuAdminAPI = /** @class */ (function () {
58
58
  }());
59
59
  export { GetMenuAdminAPI };
60
60
  (function (GetMenuAdminAPI) {
61
- var Product = /** @class */ (function () {
62
- function Product() {
63
- }
64
- return Product;
65
- }());
66
- GetMenuAdminAPI.Product = Product;
67
61
  function isAvailable(product) {
68
62
  return product.variants.map(function (variant) { return variant.isAvailable; })
69
63
  .reduce(function (a, b) { return a || b; }, false);
@@ -1,3 +1,4 @@
1
+ import { OpeningHours, SocialLinks } from "../../../business/types/shared";
1
2
  export interface Menu {
2
3
  qrCodeLabel: string;
3
4
  business: BusinessOfMenu;
@@ -7,35 +8,31 @@ export interface BusinessOfMenu {
7
8
  id: string;
8
9
  identifier: string;
9
10
  name: string;
10
- coverPhoto: string;
11
- logo?: string;
12
- socialLinks?: SocialLinks;
13
- }
14
- export interface SocialLinks {
15
- facebook?: string;
16
- instagram?: string;
17
- twitter?: string;
18
- tiktok?: string;
19
- youtube?: string;
20
- website?: string;
21
- googleMapReview?: string;
11
+ coverPhoto?: string | undefined;
12
+ logo?: string | undefined;
13
+ phones: string[];
14
+ address: string;
15
+ openingHours?: OpeningHours | undefined;
16
+ googleMapsUrl?: string | undefined;
17
+ googleMapsReview?: string | undefined;
18
+ socialLinks?: SocialLinks | undefined;
22
19
  }
23
20
  export interface Category {
24
21
  label: string;
25
22
  isPublic: boolean;
26
23
  products: Product[];
27
24
  }
28
- export declare class Product {
25
+ export interface Product {
29
26
  id: string;
30
27
  label: string;
31
- description?: string;
28
+ description?: string | undefined;
32
29
  picture?: string | undefined;
33
30
  variants: Variant[];
34
31
  }
35
32
  export declare function isAvailable(product: Product): boolean;
36
33
  export interface Variant {
37
34
  id: string;
38
- label?: string;
35
+ label?: string | undefined;
39
36
  isAvailable: boolean;
40
37
  price: number;
41
38
  discount?: number;
@@ -1,9 +1,3 @@
1
- var Product = /** @class */ (function () {
2
- function Product() {
3
- }
4
- return Product;
5
- }());
6
- export { Product };
7
1
  export function isAvailable(product) {
8
2
  return product.variants.map(function (variant) { return variant.isAvailable; })
9
3
  .reduce(function (a, b) { return a || b; }, false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiminix/tp-client",
3
- "version": "2.22.0",
3
+ "version": "2.23.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -1,9 +0,0 @@
1
- export interface MenuItem {
2
- name: string;
3
- description?: string;
4
- price: number;
5
- }
6
- export interface MenuCategory {
7
- name: string;
8
- items: MenuItem[];
9
- }
@@ -1,4 +0,0 @@
1
- import { Response } from "./types/business-signin";
2
- export declare class IamAdminAPIs {
3
- static signIn(identifier: string, password: string): Promise<Response>;
4
- }