@kiminix/tp-client 2.30.0 → 2.31.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.
@@ -0,0 +1,32 @@
1
+ import { Patch } from "../../../utils/patch-utils";
2
+ import { OpeningHours, SocialLinks, TemplateLayout } from "../../types/shared";
3
+ /**
4
+ * patch order fields
5
+ *
6
+ * @param token
7
+ * @param id
8
+ * @param status
9
+ */
10
+ export declare class PatchBusinessAdminAPI {
11
+ static patch(props: {
12
+ token: string;
13
+ request: PatchBusinessAdminAPI.Request;
14
+ }): Promise<void>;
15
+ }
16
+ export declare namespace PatchBusinessAdminAPI {
17
+ interface Request {
18
+ name?: Patch<string> | undefined;
19
+ identifier?: Patch<string> | undefined;
20
+ address?: Patch<string> | undefined;
21
+ phones?: Patch<string[]> | undefined;
22
+ openingHours?: Patch<OpeningHours> | undefined;
23
+ socialLinks?: Patch<SocialLinks> | undefined;
24
+ googleMapsUrl?: Patch<string> | undefined;
25
+ googleMapsReviewLink?: Patch<string> | undefined;
26
+ logo?: Patch<string> | undefined;
27
+ coverPhoto?: Patch<string> | undefined;
28
+ templateLayout?: Patch<TemplateLayout> | undefined;
29
+ templateThemeColors?: Patch<string> | undefined;
30
+ templateBackgroundPatterns?: Patch<string> | undefined;
31
+ }
32
+ }
@@ -38,27 +38,35 @@ import axios from "axios";
38
38
  import { base } from "../../../constants";
39
39
  import { RequestUtils } from "../../../utils/request-utils";
40
40
  /**
41
- * update template
42
- * @error internal_error
41
+ * patch order fields
42
+ *
43
43
  * @param token
44
+ * @param id
45
+ * @param status
44
46
  */
45
- var UpdateTemplateAdminAPI = /** @class */ (function () {
46
- function UpdateTemplateAdminAPI() {
47
+ var PatchBusinessAdminAPI = /** @class */ (function () {
48
+ function PatchBusinessAdminAPI() {
47
49
  }
48
- UpdateTemplateAdminAPI.update = function (props) {
50
+ PatchBusinessAdminAPI.patch = function (props) {
49
51
  return __awaiter(this, void 0, void 0, function () {
52
+ var _this = this;
50
53
  return __generator(this, function (_a) {
51
- return [2 /*return*/, RequestUtils.send(function () {
52
- return axios.patch(base + "/menus/admin/templates", props.request, {
53
- headers: {
54
- 'Authorization': "".concat(props.token)
54
+ return [2 /*return*/, RequestUtils.send(function () { return __awaiter(_this, void 0, void 0, function () {
55
+ return __generator(this, function (_a) {
56
+ switch (_a.label) {
57
+ case 0: return [4 /*yield*/, axios.patch(base + "/business", props.request, {
58
+ headers: {
59
+ 'Authorization': "".concat(props.token)
60
+ }
61
+ })
62
+ .then(function (_) { return undefined; })];
63
+ case 1: return [2 /*return*/, _a.sent()];
55
64
  }
56
- })
57
- .then(function (_) { return undefined; });
58
- })];
65
+ });
66
+ }); })];
59
67
  });
60
68
  });
61
69
  };
62
- return UpdateTemplateAdminAPI;
70
+ return PatchBusinessAdminAPI;
63
71
  }());
64
- export { UpdateTemplateAdminAPI };
72
+ export { PatchBusinessAdminAPI };
@@ -1,11 +1,6 @@
1
1
  import { AllBusiness } from "./types/get-all";
2
2
  import { Business } from "./types/get-id";
3
- import { PatchBusinessRequest } from "./types/update-business";
4
3
  export declare class BusinessAPIs {
5
4
  static getAll(timestamp: number, page?: number, size?: number): Promise<AllBusiness[]>;
6
5
  static get(identifier: string): Promise<Business | undefined>;
7
- static patch(props: {
8
- token: string;
9
- request: PatchBusinessRequest;
10
- }): Promise<void>;
11
6
  }
@@ -39,6 +39,7 @@ import { parseISO } from "date-fns";
39
39
  import { base } from "../constants";
40
40
  import { RequestUtils } from "../utils/request-utils";
41
41
  // business module APIs
42
+ //TODO to be refactored into multiple api files in admin/api folder
42
43
  var BusinessAPIs = /** @class */ (function () {
43
44
  function BusinessAPIs() {
44
45
  }
@@ -87,26 +88,6 @@ var BusinessAPIs = /** @class */ (function () {
87
88
  });
88
89
  });
89
90
  };
90
- BusinessAPIs.patch = function (props) {
91
- return __awaiter(this, void 0, void 0, function () {
92
- var _this = this;
93
- return __generator(this, function (_a) {
94
- return [2 /*return*/, RequestUtils.send(function () { return __awaiter(_this, void 0, void 0, function () {
95
- return __generator(this, function (_a) {
96
- switch (_a.label) {
97
- case 0: return [4 /*yield*/, axios.patch(base + "/business", props.request, {
98
- headers: {
99
- 'Authorization': "".concat(props.token)
100
- }
101
- })
102
- .then(function (_) { return undefined; })];
103
- case 1: return [2 /*return*/, _a.sent()];
104
- }
105
- });
106
- }); })];
107
- });
108
- });
109
- };
110
91
  return BusinessAPIs;
111
92
  }());
112
93
  export { BusinessAPIs };
@@ -2,3 +2,4 @@ export * from "./types/get-all";
2
2
  export * from "./types/get-id";
3
3
  export { BusinessAPIs } from './apis';
4
4
  export { BusinessAdminAPIs } from './admin-apis';
5
+ export * from "./admin/api/patch-business-api";
@@ -2,3 +2,5 @@ export * from "./types/get-all";
2
2
  export * from "./types/get-id";
3
3
  export { BusinessAPIs } from './apis';
4
4
  export { BusinessAdminAPIs } from './admin-apis';
5
+ // admin apis
6
+ export * from "./admin/api/patch-business-api";
@@ -24,7 +24,9 @@ export interface SocialLinks {
24
24
  youtube?: string | undefined;
25
25
  website?: string | undefined;
26
26
  }
27
+ export type TemplateLayout = "slider" | "list";
27
28
  export interface Template {
28
- id: string;
29
- theme?: string | undefined;
29
+ layout: TemplateLayout;
30
+ themeColors?: string | undefined;
31
+ backgroundPattern?: string | undefined;
30
32
  }
@@ -19,7 +19,6 @@ export * from "./admin/api/search-orders-api";
19
19
  export * from "./admin/api/statistic/bills-recap-api";
20
20
  export * from "./admin/api/statistic/products-recap-api";
21
21
  export * from "./admin/api/update-order-api";
22
- export * from "./admin/api/update-template-api";
23
22
  export * from "./admin/api/upsert-categories-api";
24
23
  export * from "./admin/api/upsert-product-api";
25
24
  export * from "./admin/types/get-calls-response";
@@ -21,7 +21,6 @@ export * from "./admin/api/search-orders-api";
21
21
  export * from "./admin/api/statistic/bills-recap-api";
22
22
  export * from "./admin/api/statistic/products-recap-api";
23
23
  export * from "./admin/api/update-order-api";
24
- export * from "./admin/api/update-template-api";
25
24
  export * from "./admin/api/upsert-categories-api";
26
25
  export * from "./admin/api/upsert-product-api";
27
26
  export * from "./admin/types/get-calls-response";
@@ -4,7 +4,7 @@ export interface BackgroundProps {
4
4
  name: string;
5
5
  style: () => CSSProperties;
6
6
  }
7
- export declare namespace BackgroundStyle {
7
+ export declare namespace BackgroundPatterns {
8
8
  export const registry: {
9
9
  foods: {
10
10
  name: string;
@@ -156,6 +156,7 @@ export declare namespace BackgroundStyle {
156
156
  };
157
157
  };
158
158
  export const all: BackgroundProps[];
159
+ export function get(id: string): BackgroundProps | undefined;
159
160
  function foods(): React.CSSProperties;
160
161
  function bubbles(): React.CSSProperties;
161
162
  function dots(): React.CSSProperties;
@@ -13,9 +13,9 @@ function readThemeColor(cssVar, fallback) {
13
13
  }
14
14
  // all patterns functions are inspired from :
15
15
  // https://heropatterns.com/
16
- export var BackgroundStyle;
17
- (function (BackgroundStyle) {
18
- BackgroundStyle.registry = {
16
+ export var BackgroundPatterns;
17
+ (function (BackgroundPatterns) {
18
+ BackgroundPatterns.registry = {
19
19
  foods: { name: 'Foods', style: foods },
20
20
  bubbles: { name: 'Bubbles', style: bubbles },
21
21
  dots: { name: 'Dots', style: dots },
@@ -54,10 +54,14 @@ export var BackgroundStyle;
54
54
  topography: { name: 'Topography', style: topography },
55
55
  pieFactory: { name: 'Pie Factory', style: pieFactory },
56
56
  };
57
- BackgroundStyle.all = Object.entries(BackgroundStyle.registry).map(function (_a) {
57
+ BackgroundPatterns.all = Object.entries(BackgroundPatterns.registry).map(function (_a) {
58
58
  var id = _a[0], _b = _a[1], name = _b.name, style = _b.style;
59
59
  return ({ id: id, name: name, style: style });
60
60
  });
61
+ function get(id) {
62
+ return BackgroundPatterns.all.find(function (p) { return p.id === id; });
63
+ }
64
+ BackgroundPatterns.get = get;
61
65
  function foods() {
62
66
  var fg = readThemeColor('--c-primary-300');
63
67
  return {
@@ -317,4 +321,4 @@ export var BackgroundStyle;
317
321
  backgroundImage: "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'%3E%3Cg fill-rule='evenodd'%3E%3Cg fill='".concat(fg, "' fill-opacity='0.3' fill-rule='nonzero'%3E%3Cpath d='M29 58.58l7.38-7.39A30.95 30.95 0 0 1 29 37.84a30.95 30.95 0 0 1-7.38 13.36l7.37 7.38zm1.4 1.41l.01.01h-2.84l-7.37-7.38A30.95 30.95 0 0 1 6.84 60H0v-1.02a28.9 28.9 0 0 0 18.79-7.78L0 32.41v-4.84L18.78 8.79A28.9 28.9 0 0 0 0 1.02V0h6.84a30.95 30.95 0 0 1 13.35 7.38L27.57 0h2.84l7.39 7.38A30.95 30.95 0 0 1 51.16 0H60v27.58-.01V60h-8.84a30.95 30.95 0 0 1-13.37-7.4L30.4 60zM29 1.41l-7.4 7.38A30.95 30.95 0 0 1 29 22.16 30.95 30.95 0 0 1 36.38 8.8L29 1.4zM58 1A28.9 28.9 0 0 0 39.2 8.8L58 27.58V1.02zm-20.2 9.2A28.9 28.9 0 0 0 30.02 29h26.56L37.8 10.21zM30.02 31a28.9 28.9 0 0 0 7.77 18.79l18.79-18.79H30.02zm9.18 20.2A28.9 28.9 0 0 0 58 59V32.4L39.2 51.19zm-19-1.4a28.9 28.9 0 0 0 7.78-18.8H1.41l18.8 18.8zm7.78-20.8A28.9 28.9 0 0 0 20.2 10.2L1.41 29h26.57z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E\")"),
318
322
  };
319
323
  }
320
- })(BackgroundStyle || (BackgroundStyle = {}));
324
+ })(BackgroundPatterns || (BackgroundPatterns = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiminix/tp-client",
3
- "version": "2.30.0",
3
+ "version": "2.31.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -1,12 +0,0 @@
1
- import { Patch } from "../../utils/patch-utils";
2
- import { OpeningHours, SocialLinks } from "./shared";
3
- export interface PatchBusinessRequest {
4
- name?: Patch<string> | undefined;
5
- identifier?: Patch<string> | undefined;
6
- address?: Patch<string> | undefined;
7
- phones?: Patch<string[]> | undefined;
8
- openingHours?: Patch<OpeningHours> | undefined;
9
- socialLinks?: Patch<SocialLinks> | undefined;
10
- googleMapsUrl?: Patch<string> | undefined;
11
- googleMapsReviewLink?: Patch<string> | undefined;
12
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,19 +0,0 @@
1
- /**
2
- * update template
3
- * @error internal_error
4
- * @param token
5
- */
6
- export declare class UpdateTemplateAdminAPI {
7
- static update(props: {
8
- token?: string;
9
- request: UpdateTemplateAdminAPI.Request;
10
- }): Promise<undefined>;
11
- }
12
- export declare namespace UpdateTemplateAdminAPI {
13
- interface Request {
14
- id?: string | undefined;
15
- theme?: string | undefined;
16
- logo?: string | undefined;
17
- coverPhoto?: string | undefined;
18
- }
19
- }