starta.apiclient 1.37.5950 → 1.37.6005
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/index.d.ts +1 -1
- package/lib/request.js +20 -8
- package/lib/services/_helpers.js +1 -1
- package/lib/services/accounts.d.ts +3 -3
- package/lib/services/accounts.js +28 -12
- package/lib/services/chats.d.ts +1 -1
- package/lib/services/chats.js +2 -2
- package/lib/services/emailConfirmations.js +1 -2
- package/lib/services/index.js +1 -1
- package/lib/services/logItems.d.ts +1 -1
- package/lib/services/logItems.js +1 -1
- package/lib/services/marketingCampaigns.d.ts +1 -1
- package/lib/services/marketingCampaigns.js +6 -3
- package/lib/services/organizations/cashRegisters.js +1 -1
- package/lib/services/organizations/customers/customerComments.d.ts +2 -2
- package/lib/services/organizations/customers/customerComments.js +4 -4
- package/lib/services/organizations/customers/index.js +1 -1
- package/lib/services/organizations/index.d.ts +5 -5
- package/lib/services/organizations/index.js +27 -12
- package/lib/services/organizations/integrations.d.ts +1 -1
- package/lib/services/organizations/integrations.js +1 -1
- package/lib/services/organizations/orders.d.ts +22 -14
- package/lib/services/organizations/orders.js +3 -3
- package/lib/services/organizations/productCategories.js +1 -1
- package/lib/services/organizations/products.js +1 -1
- package/lib/services/organizations/public.d.ts +2 -2
- package/lib/services/organizations/public.js +2 -2
- package/lib/services/organizations/schedules.d.ts +2 -2
- package/lib/services/organizations/schedules.js +3 -3
- package/lib/services/organizations/seminars.js +4 -1
- package/lib/services/organizations/services.js +2 -2
- package/lib/services/organizations/techcards.d.ts +15 -8
- package/lib/services/organizations/warehouses.js +1 -1
- package/lib/services/organizations/worklogs.d.ts +3 -3
- package/lib/services/organizations/worklogs.js +3 -3
- package/lib/services/passwordResets.d.ts +2 -2
- package/lib/services/passwordResets.js +9 -3
- package/lib/services/phoneConfirmations.d.ts +1 -1
- package/lib/services/phoneConfirmations.js +5 -3
- package/lib/services/search.d.ts +2 -2
- package/lib/services/search.js +2 -2
- package/lib/services/serviceCategories.d.ts +1 -1
- package/lib/services/serviceCategories.js +1 -1
- package/lib/services/sessions.d.ts +2 -2
- package/lib/services/sessions.js +2 -2
- package/lib/services/system.js +4 -3
- package/lib/types.d.ts +15 -15
- package/package.json +11 -3
package/lib/index.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ import factory from './factory';
|
|
|
2
2
|
import StartaApiClient from './services';
|
|
3
3
|
import { StartaRequestRunner, StartaRequestConfig, StartaRequestData, StartaRequestMiddlewares, StartaResponse } from './types';
|
|
4
4
|
export default factory;
|
|
5
|
-
export { StartaApiClient, StartaRequestRunner, StartaRequestConfig, StartaRequestData, StartaRequestMiddlewares, StartaResponse };
|
|
5
|
+
export { StartaApiClient, StartaRequestRunner, StartaRequestConfig, StartaRequestData, StartaRequestMiddlewares, StartaResponse, };
|
package/lib/request.js
CHANGED
|
@@ -15,7 +15,9 @@ const requestFactory = (baseURL, middlewares) => {
|
|
|
15
15
|
let authHeaderToken = '';
|
|
16
16
|
return {
|
|
17
17
|
replaceBaseUrl: (newBaseUrl) => requestFactory(newBaseUrl(baseURL), middlewares),
|
|
18
|
-
setAuthHeaderToken: token => {
|
|
18
|
+
setAuthHeaderToken: (token) => {
|
|
19
|
+
authHeaderToken = token;
|
|
20
|
+
},
|
|
19
21
|
performRequest: ({ url, method, urlParams, body, config = {}, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
22
|
if (middlewares === null || middlewares === void 0 ? void 0 : middlewares.requestSlowMoDelayMS) {
|
|
21
23
|
yield delay(middlewares === null || middlewares === void 0 ? void 0 : middlewares.requestSlowMoDelayMS);
|
|
@@ -32,23 +34,32 @@ const requestFactory = (baseURL, middlewares) => {
|
|
|
32
34
|
}
|
|
33
35
|
if (middlewares.headers) {
|
|
34
36
|
const headers = middlewares.headers();
|
|
35
|
-
Object.keys(headers).map(h => {
|
|
37
|
+
Object.keys(headers).map((h) => {
|
|
36
38
|
config.headers[h] = headers[h];
|
|
37
39
|
});
|
|
38
40
|
}
|
|
39
|
-
const requestConfig = Object.assign({ baseURL: config.rewriteBaseUrl
|
|
40
|
-
|
|
41
|
+
const requestConfig = Object.assign({ baseURL: config.rewriteBaseUrl
|
|
42
|
+
? config.rewriteBaseUrl(baseURL)
|
|
43
|
+
: baseURL, method, params: urlParams, data: body, withCredentials: true }, config);
|
|
44
|
+
if (middlewares === null || middlewares === void 0 ? void 0 : middlewares.logger) {
|
|
45
|
+
middlewares === null || middlewares === void 0 ? void 0 : middlewares.logger(`Sending request to: ${url} with config:`, requestConfig);
|
|
46
|
+
}
|
|
41
47
|
return (0, axios_1.default)(url, requestConfig)
|
|
42
48
|
.then(onSuccess, onErrorFactory(middlewares))
|
|
43
49
|
.then(({ success, data, httpResponse }) => {
|
|
44
|
-
(middlewares === null || middlewares === void 0 ? void 0 : middlewares.logger)
|
|
50
|
+
if (middlewares === null || middlewares === void 0 ? void 0 : middlewares.logger) {
|
|
51
|
+
middlewares === null || middlewares === void 0 ? void 0 : middlewares.logger(`received result from request to ${url}`, {
|
|
52
|
+
success,
|
|
53
|
+
data,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
45
56
|
return { success, data, httpResponse };
|
|
46
57
|
});
|
|
47
|
-
})
|
|
58
|
+
}),
|
|
48
59
|
};
|
|
49
60
|
};
|
|
50
61
|
exports.requestFactory = requestFactory;
|
|
51
|
-
const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
|
|
62
|
+
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
52
63
|
function onSuccess(response) {
|
|
53
64
|
return {
|
|
54
65
|
httpResponse: response,
|
|
@@ -67,7 +78,8 @@ const onErrorFactory = (middlewares) => (error) => {
|
|
|
67
78
|
if ((middlewares === null || middlewares === void 0 ? void 0 : middlewares.onForbidden) && ((_b = result.httpResponse) === null || _b === void 0 ? void 0 : _b.status) === 403) {
|
|
68
79
|
middlewares === null || middlewares === void 0 ? void 0 : middlewares.onForbidden(result);
|
|
69
80
|
}
|
|
70
|
-
else if ((middlewares === null || middlewares === void 0 ? void 0 : middlewares.onUnauthorized) &&
|
|
81
|
+
else if ((middlewares === null || middlewares === void 0 ? void 0 : middlewares.onUnauthorized) &&
|
|
82
|
+
((_c = result.httpResponse) === null || _c === void 0 ? void 0 : _c.status) === 401) {
|
|
71
83
|
middlewares === null || middlewares === void 0 ? void 0 : middlewares.onUnauthorized(result);
|
|
72
84
|
}
|
|
73
85
|
return result;
|
package/lib/services/_helpers.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.buildQuery = void 0;
|
|
4
4
|
const buildQuery = (query, prefix = '') => {
|
|
5
|
-
|
|
5
|
+
const resultString = objectToQueryString(query, prefix);
|
|
6
6
|
if (resultString) {
|
|
7
7
|
return resultString.replace('&', '?');
|
|
8
8
|
}
|
|
@@ -2,7 +2,7 @@ import { OrderStatus, StartaRequestRunner } from '../types';
|
|
|
2
2
|
export default class Accounts {
|
|
3
3
|
private _requestRunner;
|
|
4
4
|
constructor(requestRunner: StartaRequestRunner);
|
|
5
|
-
index({ type, skip, limit, toApprove, isApprovedToSearch, marketplaceComplient, adminsOnly, filter, sortColumn, sortDirection, onlyTop, countryIso2, onboardingStep, assignee, hasComment, createdFrom, createdTo, updatedFrom, updatedTo }: {
|
|
5
|
+
index({ type, skip, limit, toApprove, isApprovedToSearch, marketplaceComplient, adminsOnly, filter, sortColumn, sortDirection, onlyTop, countryIso2, onboardingStep, assignee, hasComment, createdFrom, createdTo, updatedFrom, updatedTo, }: {
|
|
6
6
|
type?: 'organization' | 'user';
|
|
7
7
|
skip: number;
|
|
8
8
|
limit: number;
|
|
@@ -95,7 +95,7 @@ export default class Accounts {
|
|
|
95
95
|
getAddressSuggestions(login: string, term: string, language?: string): Promise<import("../types").StartaResponse>;
|
|
96
96
|
setStatus(login: string, status: 'client' | 'potentialOrganization' | 'hasOrganization' | 'onboarding' | 'trial' | 'license'): Promise<import("../types").StartaResponse>;
|
|
97
97
|
setBillingModel(organizationLogin: string, billingModel: 'regular' | 'blogger' | 'promo1usd' | '3months'): Promise<import("../types").StartaResponse>;
|
|
98
|
-
orders(login: string, { organizationLogin, from, to, status, products, sortColumn, sortDirection, statusOperator }: {
|
|
98
|
+
orders(login: string, { organizationLogin, from, to, status, products, sortColumn, sortDirection, statusOperator, }: {
|
|
99
99
|
organizationLogin?: any;
|
|
100
100
|
from?: string;
|
|
101
101
|
to?: string;
|
|
@@ -114,7 +114,7 @@ export default class Accounts {
|
|
|
114
114
|
resetConfirmations(login: string): Promise<import("../types").StartaResponse>;
|
|
115
115
|
assign(login: string, { assinedLogins }: AssignedRequest): Promise<import("../types").StartaResponse>;
|
|
116
116
|
}
|
|
117
|
-
export
|
|
117
|
+
export type AssignedRequest = {
|
|
118
118
|
assinedLogins: Array<{
|
|
119
119
|
login: string;
|
|
120
120
|
}>;
|
package/lib/services/accounts.js
CHANGED
|
@@ -5,11 +5,28 @@ class Accounts {
|
|
|
5
5
|
constructor(requestRunner) {
|
|
6
6
|
this._requestRunner = requestRunner;
|
|
7
7
|
}
|
|
8
|
-
index({ type, skip, limit, toApprove, isApprovedToSearch, marketplaceComplient, adminsOnly, filter, sortColumn, sortDirection, onlyTop, countryIso2, onboardingStep, assignee, hasComment, createdFrom, createdTo, updatedFrom, updatedTo }) {
|
|
8
|
+
index({ type, skip, limit, toApprove, isApprovedToSearch, marketplaceComplient, adminsOnly, filter, sortColumn, sortDirection, onlyTop, countryIso2, onboardingStep, assignee, hasComment, createdFrom, createdTo, updatedFrom, updatedTo, }) {
|
|
9
9
|
return this._requestRunner.performRequest({
|
|
10
10
|
url: `accounts${(0, _helpers_1.buildQuery)({
|
|
11
|
-
type,
|
|
12
|
-
|
|
11
|
+
type,
|
|
12
|
+
skip,
|
|
13
|
+
limit,
|
|
14
|
+
toApprove,
|
|
15
|
+
isApprovedToSearch,
|
|
16
|
+
marketplaceComplient,
|
|
17
|
+
adminsOnly,
|
|
18
|
+
filter,
|
|
19
|
+
sortColumn,
|
|
20
|
+
sortDirection,
|
|
21
|
+
onlyTop,
|
|
22
|
+
countryIso2,
|
|
23
|
+
onboardingStep,
|
|
24
|
+
assignee,
|
|
25
|
+
hasComment,
|
|
26
|
+
createdFrom,
|
|
27
|
+
createdTo,
|
|
28
|
+
updatedFrom,
|
|
29
|
+
updatedTo,
|
|
13
30
|
})}`,
|
|
14
31
|
method: 'GET',
|
|
15
32
|
});
|
|
@@ -21,7 +38,7 @@ class Accounts {
|
|
|
21
38
|
body: {
|
|
22
39
|
isAdmin,
|
|
23
40
|
role,
|
|
24
|
-
}
|
|
41
|
+
},
|
|
25
42
|
});
|
|
26
43
|
}
|
|
27
44
|
update(login, { firstName, lastName, timeZone }) {
|
|
@@ -49,8 +66,8 @@ class Accounts {
|
|
|
49
66
|
url: `accounts/massMainData`,
|
|
50
67
|
method: 'POST',
|
|
51
68
|
body: {
|
|
52
|
-
logins
|
|
53
|
-
}
|
|
69
|
+
logins,
|
|
70
|
+
},
|
|
54
71
|
});
|
|
55
72
|
}
|
|
56
73
|
serviceProviders(login) {
|
|
@@ -71,7 +88,7 @@ class Accounts {
|
|
|
71
88
|
method: 'POST',
|
|
72
89
|
body: {
|
|
73
90
|
organizationLogin,
|
|
74
|
-
}
|
|
91
|
+
},
|
|
75
92
|
});
|
|
76
93
|
}
|
|
77
94
|
removeServiceProvider(login, organizationLogin) {
|
|
@@ -234,7 +251,7 @@ class Accounts {
|
|
|
234
251
|
body: { billingModel },
|
|
235
252
|
});
|
|
236
253
|
}
|
|
237
|
-
orders(login, { organizationLogin, from, to, status, products, sortColumn, sortDirection, statusOperator }) {
|
|
254
|
+
orders(login, { organizationLogin, from, to, status, products, sortColumn, sortDirection, statusOperator, }) {
|
|
238
255
|
return this._requestRunner.performRequest({
|
|
239
256
|
url: `accounts/${login}/orders${(0, _helpers_1.buildQuery)({
|
|
240
257
|
organizationLogin,
|
|
@@ -244,7 +261,7 @@ class Accounts {
|
|
|
244
261
|
products,
|
|
245
262
|
sortColumn,
|
|
246
263
|
sortDirection,
|
|
247
|
-
statusOperator
|
|
264
|
+
statusOperator,
|
|
248
265
|
})}`,
|
|
249
266
|
method: 'GET',
|
|
250
267
|
});
|
|
@@ -260,10 +277,9 @@ class Accounts {
|
|
|
260
277
|
url: `accounts/${login}/assignedAccounts`,
|
|
261
278
|
method: 'POST',
|
|
262
279
|
body: {
|
|
263
|
-
assinedLogins
|
|
264
|
-
}
|
|
280
|
+
assinedLogins,
|
|
281
|
+
},
|
|
265
282
|
});
|
|
266
283
|
}
|
|
267
284
|
}
|
|
268
285
|
exports.default = Accounts;
|
|
269
|
-
;
|
package/lib/services/chats.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export default class Chats {
|
|
|
9
9
|
setLastSeenMessageTime(login: any, loginWith: any, { time }: {
|
|
10
10
|
time: any;
|
|
11
11
|
}): Promise<import("../types").StartaResponse>;
|
|
12
|
-
addMessage(login: any, loginWith: any, { message: { text, imageIds
|
|
12
|
+
addMessage(login: any, loginWith: any, { message: { text, imageIds }, }: {
|
|
13
13
|
message: {
|
|
14
14
|
text: string;
|
|
15
15
|
imageIds?: string[];
|
package/lib/services/chats.js
CHANGED
|
@@ -32,7 +32,7 @@ class Chats {
|
|
|
32
32
|
url: `accounts/${login}/chats/${loginWith}/lastSeenMessageTime`,
|
|
33
33
|
method: 'PUT',
|
|
34
34
|
body: {
|
|
35
|
-
time
|
|
35
|
+
time,
|
|
36
36
|
},
|
|
37
37
|
config: {
|
|
38
38
|
rewriteBaseUrl: (url) => {
|
|
@@ -41,7 +41,7 @@ class Chats {
|
|
|
41
41
|
},
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
|
-
addMessage(login, loginWith, { message: { text, imageIds
|
|
44
|
+
addMessage(login, loginWith, { message: { text, imageIds }, }) {
|
|
45
45
|
return this._requestRunner.performRequest({
|
|
46
46
|
url: `accounts/${login}/chats/${loginWith}/messages`,
|
|
47
47
|
method: 'POST',
|
package/lib/services/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { StartaRequestRunner } from '../types';
|
|
|
2
2
|
export default class LogItems {
|
|
3
3
|
private _requestRunner;
|
|
4
4
|
constructor(requestRunner: StartaRequestRunner);
|
|
5
|
-
create({ level, message, location, app, appVersion }: {
|
|
5
|
+
create({ level, message, location, app, appVersion, }: {
|
|
6
6
|
level: 'debug' | 'info' | 'warn' | 'error';
|
|
7
7
|
message: string;
|
|
8
8
|
location?: string;
|
package/lib/services/logItems.js
CHANGED
|
@@ -4,7 +4,7 @@ class LogItems {
|
|
|
4
4
|
constructor(requestRunner) {
|
|
5
5
|
this._requestRunner = requestRunner;
|
|
6
6
|
}
|
|
7
|
-
create({ level, message, location, app, appVersion }) {
|
|
7
|
+
create({ level, message, location, app, appVersion, }) {
|
|
8
8
|
return this._requestRunner.performRequest({
|
|
9
9
|
url: `logItems`,
|
|
10
10
|
method: 'POST',
|
|
@@ -2,7 +2,7 @@ import { StartaRequestRunner } from '../types';
|
|
|
2
2
|
export default class MarketingCampaigns {
|
|
3
3
|
private _requestRunner;
|
|
4
4
|
constructor(requestRunner: StartaRequestRunner);
|
|
5
|
-
index({ status, statusOperator }?: {
|
|
5
|
+
index({ status, statusOperator, }?: {
|
|
6
6
|
status?: null | 'completed';
|
|
7
7
|
statusOperator?: '$eq' | '$neq';
|
|
8
8
|
}): Promise<import("../types").StartaResponse>;
|
|
@@ -5,7 +5,10 @@ class MarketingCampaigns {
|
|
|
5
5
|
constructor(requestRunner) {
|
|
6
6
|
this._requestRunner = requestRunner;
|
|
7
7
|
}
|
|
8
|
-
index({ status, statusOperator } = {
|
|
8
|
+
index({ status, statusOperator, } = {
|
|
9
|
+
status: undefined,
|
|
10
|
+
statusOperator: '$eq',
|
|
11
|
+
}) {
|
|
9
12
|
return this._requestRunner.performRequest({
|
|
10
13
|
method: 'GET',
|
|
11
14
|
url: `marketingCampaigns${(0, _helpers_1.buildQuery)({ status, statusOperator })}`,
|
|
@@ -16,7 +19,7 @@ class MarketingCampaigns {
|
|
|
16
19
|
url: `marketingCampaigns/${id}/cost`,
|
|
17
20
|
method: 'PUT',
|
|
18
21
|
body: {
|
|
19
|
-
cost
|
|
22
|
+
cost,
|
|
20
23
|
},
|
|
21
24
|
});
|
|
22
25
|
}
|
|
@@ -25,7 +28,7 @@ class MarketingCampaigns {
|
|
|
25
28
|
url: `marketingCampaigns/${id}/status`,
|
|
26
29
|
method: 'PUT',
|
|
27
30
|
body: {
|
|
28
|
-
status
|
|
31
|
+
status,
|
|
29
32
|
},
|
|
30
33
|
});
|
|
31
34
|
}
|
|
@@ -40,7 +40,7 @@ class CashRegisters {
|
|
|
40
40
|
delete(organizationLogin, cashRegisterId) {
|
|
41
41
|
return this._requestRunner.performRequest({
|
|
42
42
|
url: `accounts/${organizationLogin}/cashRegisters/${cashRegisterId}`,
|
|
43
|
-
method: 'DELETE'
|
|
43
|
+
method: 'DELETE',
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
setDefaults(organizationLogin, cashRegisterId, nonCashRegisterId) {
|
|
@@ -17,13 +17,13 @@ export default class CustomerComments {
|
|
|
17
17
|
dueDate?: string;
|
|
18
18
|
}): Promise<import("../../../types").StartaResponse>;
|
|
19
19
|
delete(organizationLogin: string, customerId: string, commentId: string): Promise<import("../../../types").StartaResponse>;
|
|
20
|
-
getTasks(organizationLogin: string, { assignedTo, dueDateFrom, dueDateTo, status }?: {
|
|
20
|
+
getTasks(organizationLogin: string, { assignedTo, dueDateFrom, dueDateTo, status, }?: {
|
|
21
21
|
assignedTo?: string;
|
|
22
22
|
dueDateFrom?: string;
|
|
23
23
|
dueDateTo?: string;
|
|
24
24
|
status?: 'new' | 'completed' | 'canceled';
|
|
25
25
|
}): Promise<import("../../../types").StartaResponse>;
|
|
26
|
-
getTasksByDate(organizationLogin: string, { assignedTo, dueDateFrom, dueDateTo, status }?: {
|
|
26
|
+
getTasksByDate(organizationLogin: string, { assignedTo, dueDateFrom, dueDateTo, status, }?: {
|
|
27
27
|
assignedTo?: string;
|
|
28
28
|
dueDateFrom?: string;
|
|
29
29
|
dueDateTo?: string;
|
|
@@ -42,24 +42,24 @@ class CustomerComments {
|
|
|
42
42
|
method: 'DELETE',
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
|
-
getTasks(organizationLogin, { assignedTo, dueDateFrom, dueDateTo, status } = {}) {
|
|
45
|
+
getTasks(organizationLogin, { assignedTo, dueDateFrom, dueDateTo, status, } = {}) {
|
|
46
46
|
return this._requestRunner.performRequest({
|
|
47
47
|
url: `accounts/${organizationLogin}/tasks${(0, _helpers_1.buildQuery)({
|
|
48
48
|
assignedTo,
|
|
49
49
|
dueDateFrom,
|
|
50
50
|
dueDateTo,
|
|
51
|
-
status
|
|
51
|
+
status,
|
|
52
52
|
})}`,
|
|
53
53
|
method: 'GET',
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
|
-
getTasksByDate(organizationLogin, { assignedTo, dueDateFrom, dueDateTo, status } = {}) {
|
|
56
|
+
getTasksByDate(organizationLogin, { assignedTo, dueDateFrom, dueDateTo, status, } = {}) {
|
|
57
57
|
return this._requestRunner.performRequest({
|
|
58
58
|
url: `accounts/${organizationLogin}/tasks/countByDate${(0, _helpers_1.buildQuery)({
|
|
59
59
|
assignedTo,
|
|
60
60
|
dueDateFrom,
|
|
61
61
|
dueDateTo,
|
|
62
|
-
status
|
|
62
|
+
status,
|
|
63
63
|
})}`,
|
|
64
64
|
method: 'GET',
|
|
65
65
|
});
|
|
@@ -22,7 +22,7 @@ import CashRegisterShifts from './cashRegisterShifts';
|
|
|
22
22
|
import Billing from './billing';
|
|
23
23
|
import Techcards from './techcards';
|
|
24
24
|
import Memberships from './memberships';
|
|
25
|
-
export
|
|
25
|
+
export type TariffDetails = {
|
|
26
26
|
tariff: 'lite' | 'pro';
|
|
27
27
|
period: 'monthly' | 'yearly' | 'ltl';
|
|
28
28
|
successUrl?: string;
|
|
@@ -31,7 +31,7 @@ export declare type TariffDetails = {
|
|
|
31
31
|
export default class Organizations {
|
|
32
32
|
private _requestRunner;
|
|
33
33
|
constructor(requestRunner: StartaRequestRunner);
|
|
34
|
-
create(account: any, { login, name, currency, timeZone, orgType, countryIso2, answerForHowManyEmployees }: {
|
|
34
|
+
create(account: any, { login, name, currency, timeZone, orgType, countryIso2, answerForHowManyEmployees, }: {
|
|
35
35
|
login: string;
|
|
36
36
|
name: string;
|
|
37
37
|
currency: string;
|
|
@@ -41,7 +41,7 @@ export default class Organizations {
|
|
|
41
41
|
answerForHowManyEmployees?: '1' | '2-5' | '6-15' | '16+' | '2-10' | '2-3' | '4-10' | '11+' | '10-100' | '100+';
|
|
42
42
|
}): Promise<import("../../types").StartaResponse>;
|
|
43
43
|
delete(ownerLogin: any, organizationLogin: any): Promise<import("../../types").StartaResponse>;
|
|
44
|
-
update(account: any, { name, nameTranslations, subtitle, timeZone }: {
|
|
44
|
+
update(account: any, { name, nameTranslations, subtitle, timeZone, }: {
|
|
45
45
|
name: string;
|
|
46
46
|
nameTranslations?: Object;
|
|
47
47
|
timeZone: string;
|
|
@@ -83,7 +83,7 @@ export default class Organizations {
|
|
|
83
83
|
}): Promise<import("../../types").StartaResponse>;
|
|
84
84
|
setDescription(organizationLogin: any, description: any): Promise<import("../../types").StartaResponse>;
|
|
85
85
|
getBookingWidgetSettings(organizationLogin: any): Promise<import("../../types").StartaResponse>;
|
|
86
|
-
setBookingWidgetSettings(organizationLogin: any, { enabled, bookingInterval, theme, schedulingPreference, multibookingEnabled, confirmOrders }: {
|
|
86
|
+
setBookingWidgetSettings(organizationLogin: any, { enabled, bookingInterval, theme, schedulingPreference, multibookingEnabled, confirmOrders, }: {
|
|
87
87
|
enabled: boolean;
|
|
88
88
|
bookingInterval?: number;
|
|
89
89
|
theme?: 'dark' | 'light' | 'pink';
|
|
@@ -107,7 +107,7 @@ export default class Organizations {
|
|
|
107
107
|
setForYearBonus(organizationLogin: string, bonusForYearUntil: string): Promise<import("../../types").StartaResponse>;
|
|
108
108
|
getBillingInfo(organizationLogin: string, month?: string): Promise<import("../../types").StartaResponse>;
|
|
109
109
|
setTariff(organizationLogin: string, { tariff, period, successUrl, cancelUrl }: TariffDetails): Promise<import("../../types").StartaResponse>;
|
|
110
|
-
addBalance(organizationLogin: string, { amount, comment, type }: {
|
|
110
|
+
addBalance(organizationLogin: string, { amount, comment, type, }: {
|
|
111
111
|
amount: number;
|
|
112
112
|
comment: string;
|
|
113
113
|
type: 'system';
|
|
@@ -28,11 +28,19 @@ class Organizations {
|
|
|
28
28
|
constructor(requestRunner) {
|
|
29
29
|
this._requestRunner = requestRunner;
|
|
30
30
|
}
|
|
31
|
-
create(account, { login, name, currency, timeZone, orgType, countryIso2, answerForHowManyEmployees }) {
|
|
31
|
+
create(account, { login, name, currency, timeZone, orgType, countryIso2, answerForHowManyEmployees, }) {
|
|
32
32
|
return this._requestRunner.performRequest({
|
|
33
33
|
url: `accounts/${account}/organizations`,
|
|
34
34
|
method: 'POST',
|
|
35
|
-
body: {
|
|
35
|
+
body: {
|
|
36
|
+
login,
|
|
37
|
+
name,
|
|
38
|
+
currency,
|
|
39
|
+
timeZone,
|
|
40
|
+
orgType,
|
|
41
|
+
countryIso2,
|
|
42
|
+
answerForHowManyEmployees,
|
|
43
|
+
},
|
|
36
44
|
});
|
|
37
45
|
}
|
|
38
46
|
delete(ownerLogin, organizationLogin) {
|
|
@@ -41,7 +49,7 @@ class Organizations {
|
|
|
41
49
|
method: 'DELETE',
|
|
42
50
|
});
|
|
43
51
|
}
|
|
44
|
-
update(account, { name, nameTranslations, subtitle, timeZone }) {
|
|
52
|
+
update(account, { name, nameTranslations, subtitle, timeZone, }) {
|
|
45
53
|
return this._requestRunner.performRequest({
|
|
46
54
|
url: `accounts/${account}`,
|
|
47
55
|
method: 'PUT',
|
|
@@ -101,7 +109,7 @@ class Organizations {
|
|
|
101
109
|
body: {
|
|
102
110
|
enabled,
|
|
103
111
|
discount,
|
|
104
|
-
}
|
|
112
|
+
},
|
|
105
113
|
});
|
|
106
114
|
}
|
|
107
115
|
setFirstOrderDiscountSettings(organizationLogin, { enabled, discount, discountType, discountFor, }) {
|
|
@@ -113,7 +121,7 @@ class Organizations {
|
|
|
113
121
|
discount,
|
|
114
122
|
discountType,
|
|
115
123
|
discountFor,
|
|
116
|
-
}
|
|
124
|
+
},
|
|
117
125
|
});
|
|
118
126
|
}
|
|
119
127
|
setDescription(organizationLogin, description) {
|
|
@@ -129,11 +137,18 @@ class Organizations {
|
|
|
129
137
|
method: 'GET',
|
|
130
138
|
});
|
|
131
139
|
}
|
|
132
|
-
setBookingWidgetSettings(organizationLogin, { enabled, bookingInterval, theme, schedulingPreference, multibookingEnabled, confirmOrders }) {
|
|
140
|
+
setBookingWidgetSettings(organizationLogin, { enabled, bookingInterval, theme, schedulingPreference, multibookingEnabled, confirmOrders, }) {
|
|
133
141
|
return this._requestRunner.performRequest({
|
|
134
142
|
url: `accounts/${organizationLogin}/bookingWidget/settings`,
|
|
135
143
|
method: 'PATCH',
|
|
136
|
-
body: {
|
|
144
|
+
body: {
|
|
145
|
+
enabled,
|
|
146
|
+
bookingInterval,
|
|
147
|
+
theme,
|
|
148
|
+
schedulingPreference,
|
|
149
|
+
multibookingEnabled,
|
|
150
|
+
confirmOrders,
|
|
151
|
+
},
|
|
137
152
|
});
|
|
138
153
|
}
|
|
139
154
|
setBookingWidgetStyles(organizationLogin, bookingWidgetStyles) {
|
|
@@ -181,7 +196,7 @@ class Organizations {
|
|
|
181
196
|
method: 'PUT',
|
|
182
197
|
body: {
|
|
183
198
|
isTop,
|
|
184
|
-
}
|
|
199
|
+
},
|
|
185
200
|
});
|
|
186
201
|
}
|
|
187
202
|
setSNSubscribers(organizationLogin, snSubscribers) {
|
|
@@ -190,7 +205,7 @@ class Organizations {
|
|
|
190
205
|
method: 'PUT',
|
|
191
206
|
body: {
|
|
192
207
|
snSubscribers,
|
|
193
|
-
}
|
|
208
|
+
},
|
|
194
209
|
});
|
|
195
210
|
}
|
|
196
211
|
setEndOfTrial(organizationLogin, endOfTrialAt) {
|
|
@@ -199,7 +214,7 @@ class Organizations {
|
|
|
199
214
|
method: 'PUT',
|
|
200
215
|
body: {
|
|
201
216
|
endOfTrialAt,
|
|
202
|
-
}
|
|
217
|
+
},
|
|
203
218
|
});
|
|
204
219
|
}
|
|
205
220
|
setForYearBonus(organizationLogin, bonusForYearUntil) {
|
|
@@ -208,7 +223,7 @@ class Organizations {
|
|
|
208
223
|
method: 'PUT',
|
|
209
224
|
body: {
|
|
210
225
|
bonusForYearUntil,
|
|
211
|
-
}
|
|
226
|
+
},
|
|
212
227
|
});
|
|
213
228
|
}
|
|
214
229
|
getBillingInfo(organizationLogin, month) {
|
|
@@ -224,7 +239,7 @@ class Organizations {
|
|
|
224
239
|
body: { tariff, period, successUrl, cancelUrl },
|
|
225
240
|
});
|
|
226
241
|
}
|
|
227
|
-
addBalance(organizationLogin, { amount, comment, type }) {
|
|
242
|
+
addBalance(organizationLogin, { amount, comment, type, }) {
|
|
228
243
|
return this._requestRunner.performRequest({
|
|
229
244
|
url: `accounts/${organizationLogin}/balance`,
|
|
230
245
|
method: 'POST',
|
|
@@ -16,7 +16,7 @@ export default class Integrations {
|
|
|
16
16
|
merchantAccount: any;
|
|
17
17
|
merchantSecretKey: any;
|
|
18
18
|
}): Promise<import("../../types").StartaResponse>;
|
|
19
|
-
setTurboSMS(organizationLogin: string, { enabled, authToken, sender, verified }: {
|
|
19
|
+
setTurboSMS(organizationLogin: string, { enabled, authToken, sender, verified, }: {
|
|
20
20
|
enabled: boolean;
|
|
21
21
|
authToken: string;
|
|
22
22
|
sender: string;
|
|
@@ -25,7 +25,7 @@ class Integrations {
|
|
|
25
25
|
body: { enabled, merchantAccount, merchantSecretKey },
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
|
-
setTurboSMS(organizationLogin, { enabled, authToken, sender, verified }) {
|
|
28
|
+
setTurboSMS(organizationLogin, { enabled, authToken, sender, verified, }) {
|
|
29
29
|
return this._requestRunner.performRequest({
|
|
30
30
|
url: `accounts/${organizationLogin}/integrations/turbosms`,
|
|
31
31
|
method: 'PUT',
|
|
@@ -30,14 +30,18 @@ export default class Orders {
|
|
|
30
30
|
get(organizationOrCustomerLogin: string, orderId: any): Promise<import("../../types").StartaResponse>;
|
|
31
31
|
add(organizationLogin: string, { products, usedMaterials, starttime, endtime, customerId, scheduleId, status, repeatSettings, discountType, discount, organizationComment, }: {
|
|
32
32
|
products: Array<{
|
|
33
|
-
|
|
34
|
-
id: any;
|
|
33
|
+
id: string;
|
|
35
34
|
executors?: Array<string>;
|
|
36
35
|
amount?: number;
|
|
37
|
-
timeOffset?: number;
|
|
38
36
|
price?: number;
|
|
37
|
+
} & ({
|
|
38
|
+
type: 'service' | 'roomRent' | 'seminar';
|
|
39
|
+
timeOffset?: number;
|
|
39
40
|
duration?: number;
|
|
40
|
-
}
|
|
41
|
+
} | {
|
|
42
|
+
type: 'product';
|
|
43
|
+
warehouseId: string;
|
|
44
|
+
})>;
|
|
41
45
|
usedMaterials?: Array<{
|
|
42
46
|
serviceId: string;
|
|
43
47
|
techcardId?: string;
|
|
@@ -64,16 +68,20 @@ export default class Orders {
|
|
|
64
68
|
discount?: number;
|
|
65
69
|
organizationComment?: string;
|
|
66
70
|
}): Promise<import("../../types").StartaResponse>;
|
|
67
|
-
update(organizationLogin:
|
|
71
|
+
update(organizationLogin: string, orderId: string, { products, usedMaterials, starttime, endtime, scheduleId, status, repeatSettings, discountType, discount, organizationComment, }: {
|
|
68
72
|
products: Array<{
|
|
69
|
-
|
|
70
|
-
id: any;
|
|
73
|
+
id: string;
|
|
71
74
|
executors?: Array<string>;
|
|
72
75
|
amount?: number;
|
|
73
|
-
timeOffset?: number;
|
|
74
76
|
price?: number;
|
|
77
|
+
} & ({
|
|
78
|
+
type: 'service' | 'roomRent' | 'seminar';
|
|
79
|
+
timeOffset?: number;
|
|
75
80
|
duration?: number;
|
|
76
|
-
}
|
|
81
|
+
} | {
|
|
82
|
+
type: 'product';
|
|
83
|
+
warehouseId: string;
|
|
84
|
+
})>;
|
|
77
85
|
usedMaterials?: Array<{
|
|
78
86
|
serviceId: string;
|
|
79
87
|
techcardId?: string;
|
|
@@ -99,11 +107,11 @@ export default class Orders {
|
|
|
99
107
|
discount?: number;
|
|
100
108
|
organizationComment?: string;
|
|
101
109
|
}): Promise<import("../../types").StartaResponse>;
|
|
102
|
-
delete(organizationLogin:
|
|
103
|
-
setConfirmation(organizationOrCustomerLogin:
|
|
104
|
-
isConfirmed:
|
|
110
|
+
delete(organizationLogin: string, orderId: string): Promise<import("../../types").StartaResponse>;
|
|
111
|
+
setConfirmation(organizationOrCustomerLogin: string, orderId: string, { isConfirmed }: {
|
|
112
|
+
isConfirmed: boolean;
|
|
105
113
|
}): Promise<import("../../types").StartaResponse>;
|
|
106
|
-
setShownInNotificationCenter(organizationOrCustomerLogin:
|
|
107
|
-
isShownInNotificationCenter:
|
|
114
|
+
setShownInNotificationCenter(organizationOrCustomerLogin: string, orderId: string, { isShownInNotificationCenter }: {
|
|
115
|
+
isShownInNotificationCenter: boolean;
|
|
108
116
|
}): Promise<import("../../types").StartaResponse>;
|
|
109
117
|
}
|
|
@@ -90,8 +90,8 @@ class Orders {
|
|
|
90
90
|
url: `accounts/${organizationOrCustomerLogin}/orders/${orderId}/confirmation`,
|
|
91
91
|
method: 'PUT',
|
|
92
92
|
body: {
|
|
93
|
-
isConfirmed
|
|
94
|
-
}
|
|
93
|
+
isConfirmed,
|
|
94
|
+
},
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
97
|
setShownInNotificationCenter(organizationOrCustomerLogin, orderId, { isShownInNotificationCenter }) {
|
|
@@ -100,7 +100,7 @@ class Orders {
|
|
|
100
100
|
method: 'PUT',
|
|
101
101
|
body: {
|
|
102
102
|
isShownInNotificationCenter,
|
|
103
|
-
}
|
|
103
|
+
},
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
106
|
}
|
|
@@ -4,7 +4,7 @@ export default class Public {
|
|
|
4
4
|
constructor(requestRunner: StartaRequestRunner);
|
|
5
5
|
info(organizationLogin: string): Promise<import("../../types").StartaResponse>;
|
|
6
6
|
getContact(organizationLogin: string, contactIndex: number, recaptchaToken?: string): Promise<import("../../types").StartaResponse>;
|
|
7
|
-
getAvailableTimeSlots(organizationLogin: string, { products, month, scheduleId }: {
|
|
7
|
+
getAvailableTimeSlots(organizationLogin: string, { products, month, scheduleId, }: {
|
|
8
8
|
products: Array<{
|
|
9
9
|
type: any;
|
|
10
10
|
id: any;
|
|
@@ -23,7 +23,7 @@ export default class Public {
|
|
|
23
23
|
text: string;
|
|
24
24
|
}): Promise<import("../../types").StartaResponse>;
|
|
25
25
|
getLastFeedbacks(organizationLogin: string): Promise<import("../../types").StartaResponse>;
|
|
26
|
-
createOrder(organizationLogin: any, { products, starttime, scheduleId, customerInfo, customerComment }: {
|
|
26
|
+
createOrder(organizationLogin: any, { products, starttime, scheduleId, customerInfo, customerComment, }: {
|
|
27
27
|
products: Array<{
|
|
28
28
|
type: any;
|
|
29
29
|
id: any;
|
|
@@ -18,7 +18,7 @@ class Public {
|
|
|
18
18
|
body: { recaptchaToken },
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
-
getAvailableTimeSlots(organizationLogin, { products, month, scheduleId }) {
|
|
21
|
+
getAvailableTimeSlots(organizationLogin, { products, month, scheduleId, }) {
|
|
22
22
|
return this._requestRunner.performRequest({
|
|
23
23
|
url: `accounts/${organizationLogin}/public/availableTimeSlots${(0, _helpers_1.buildQuery)({
|
|
24
24
|
month,
|
|
@@ -48,7 +48,7 @@ class Public {
|
|
|
48
48
|
method: 'GET',
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
|
-
createOrder(organizationLogin, { products, starttime, scheduleId, customerInfo, customerComment }) {
|
|
51
|
+
createOrder(organizationLogin, { products, starttime, scheduleId, customerInfo, customerComment, }) {
|
|
52
52
|
return this._requestRunner.performRequest({
|
|
53
53
|
url: `accounts/${organizationLogin}/public/orders`,
|
|
54
54
|
method: 'POST',
|
|
@@ -2,8 +2,8 @@ import { StartaRequestRunner, OrganizationSchedule } from '../../types';
|
|
|
2
2
|
export default class Schedules {
|
|
3
3
|
private _requestRunner;
|
|
4
4
|
constructor(requestRunner: StartaRequestRunner);
|
|
5
|
-
add(organizationLogin: any, { name, location, schedule, services
|
|
6
|
-
update(organizationLogin: any, scheduleId: any, { name, location, schedule, services
|
|
5
|
+
add(organizationLogin: any, { name, location, schedule, services }: OrganizationSchedule): Promise<import("../../types").StartaResponse>;
|
|
6
|
+
update(organizationLogin: any, scheduleId: any, { name, location, schedule, services }: OrganizationSchedule): Promise<import("../../types").StartaResponse>;
|
|
7
7
|
delete(organizationLogin: any, scheduleId: any): Promise<import("../../types").StartaResponse>;
|
|
8
8
|
getMap(organizationLogin: any, scheduleId: any): Promise<import("../../types").StartaResponse>;
|
|
9
9
|
}
|
|
@@ -4,7 +4,7 @@ class Schedules {
|
|
|
4
4
|
constructor(requestRunner) {
|
|
5
5
|
this._requestRunner = requestRunner;
|
|
6
6
|
}
|
|
7
|
-
add(organizationLogin, { name, location, schedule, services
|
|
7
|
+
add(organizationLogin, { name, location, schedule, services }) {
|
|
8
8
|
return this._requestRunner.performRequest({
|
|
9
9
|
url: `accounts/${organizationLogin}/schedules`,
|
|
10
10
|
method: 'POST',
|
|
@@ -16,7 +16,7 @@ class Schedules {
|
|
|
16
16
|
},
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
update(organizationLogin, scheduleId, { name, location, schedule, services
|
|
19
|
+
update(organizationLogin, scheduleId, { name, location, schedule, services }) {
|
|
20
20
|
return this._requestRunner.performRequest({
|
|
21
21
|
url: `accounts/${organizationLogin}/schedules/${scheduleId}`,
|
|
22
22
|
method: 'PUT',
|
|
@@ -31,7 +31,7 @@ class Schedules {
|
|
|
31
31
|
delete(organizationLogin, scheduleId) {
|
|
32
32
|
return this._requestRunner.performRequest({
|
|
33
33
|
url: `accounts/${organizationLogin}/schedules/${scheduleId}`,
|
|
34
|
-
method: 'DELETE'
|
|
34
|
+
method: 'DELETE',
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
getMap(organizationLogin, scheduleId) {
|
|
@@ -21,7 +21,10 @@ class Services {
|
|
|
21
21
|
method: 'GET',
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
add(organizationLogin, { name, starttime, endtime, experts = [], price, description, status = 'new', location: { online, description: locationDescription } = {
|
|
24
|
+
add(organizationLogin, { name, starttime, endtime, experts = [], price, description, status = 'new', location: { online, description: locationDescription } = {
|
|
25
|
+
online: null,
|
|
26
|
+
description: null,
|
|
27
|
+
}, }) {
|
|
25
28
|
return this._requestRunner.performRequest({
|
|
26
29
|
url: `accounts/${organizationLogin}/seminars`,
|
|
27
30
|
method: 'POST',
|
|
@@ -26,7 +26,7 @@ class Services {
|
|
|
26
26
|
blockMoreThanThreshholdBookingsPerCustomerPerDay,
|
|
27
27
|
bookingsPerCustomerPerDayThreshold,
|
|
28
28
|
schedules,
|
|
29
|
-
serviceCategoryId
|
|
29
|
+
serviceCategoryId,
|
|
30
30
|
},
|
|
31
31
|
});
|
|
32
32
|
}
|
|
@@ -52,7 +52,7 @@ class Services {
|
|
|
52
52
|
blockMoreThanThreshholdBookingsPerCustomerPerDay,
|
|
53
53
|
bookingsPerCustomerPerDayThreshold,
|
|
54
54
|
disableBookingByCustomer,
|
|
55
|
-
serviceCategoryId
|
|
55
|
+
serviceCategoryId,
|
|
56
56
|
},
|
|
57
57
|
});
|
|
58
58
|
}
|
|
@@ -11,14 +11,21 @@ export default class Techcards {
|
|
|
11
11
|
executors: Array<string>;
|
|
12
12
|
steps?: Array<{
|
|
13
13
|
name: string;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
isEnabled: boolean;
|
|
15
|
+
serviceIds: Array<string>;
|
|
16
|
+
customerIds: Array<string>;
|
|
17
|
+
executors: Array<string>;
|
|
18
|
+
steps?: Array<{
|
|
19
|
+
name: string;
|
|
20
|
+
items?: Array<{
|
|
21
|
+
type: 'product';
|
|
22
|
+
warehouseId: string;
|
|
23
|
+
productId: string;
|
|
24
|
+
amount: number;
|
|
25
|
+
} | {
|
|
26
|
+
type: 'comment';
|
|
27
|
+
comment: string;
|
|
28
|
+
}>;
|
|
22
29
|
}>;
|
|
23
30
|
}>;
|
|
24
31
|
}): Promise<import("../../types").StartaResponse>;
|
|
@@ -2,18 +2,18 @@ import { StartaRequestRunner } from '../../types';
|
|
|
2
2
|
export default class Worklogs {
|
|
3
3
|
private _requestRunner;
|
|
4
4
|
constructor(requestRunner: StartaRequestRunner);
|
|
5
|
-
index(organizationLogin: any, { memberLogin, type }: {
|
|
5
|
+
index(organizationLogin: any, { memberLogin, type, }: {
|
|
6
6
|
memberLogin?: string;
|
|
7
7
|
type: 'holiday' | 'vacation' | 'lock';
|
|
8
8
|
}): Promise<import("../../types").StartaResponse>;
|
|
9
|
-
add(organizationLogin: any, { memberLogin, worklogName, start, end, type }: {
|
|
9
|
+
add(organizationLogin: any, { memberLogin, worklogName, start, end, type, }: {
|
|
10
10
|
memberLogin?: string;
|
|
11
11
|
worklogName?: string;
|
|
12
12
|
start: string;
|
|
13
13
|
end: string;
|
|
14
14
|
type: 'holiday' | 'vacation' | 'lock';
|
|
15
15
|
}): Promise<import("../../types").StartaResponse>;
|
|
16
|
-
update(organizationLogin: string, { worklogid, worklogName, start, end }: {
|
|
16
|
+
update(organizationLogin: string, { worklogid, worklogName, start, end, }: {
|
|
17
17
|
worklogid: string;
|
|
18
18
|
worklogName: string;
|
|
19
19
|
start: string;
|
|
@@ -5,7 +5,7 @@ class Worklogs {
|
|
|
5
5
|
constructor(requestRunner) {
|
|
6
6
|
this._requestRunner = requestRunner;
|
|
7
7
|
}
|
|
8
|
-
index(organizationLogin, { memberLogin, type }) {
|
|
8
|
+
index(organizationLogin, { memberLogin, type, }) {
|
|
9
9
|
return this._requestRunner.performRequest({
|
|
10
10
|
url: `accounts/${organizationLogin}/worklogs${(0, _helpers_1.buildQuery)({
|
|
11
11
|
memberLogin,
|
|
@@ -14,14 +14,14 @@ class Worklogs {
|
|
|
14
14
|
method: 'GET',
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
|
-
add(organizationLogin, { memberLogin, worklogName, start, end, type }) {
|
|
17
|
+
add(organizationLogin, { memberLogin, worklogName, start, end, type, }) {
|
|
18
18
|
return this._requestRunner.performRequest({
|
|
19
19
|
url: `accounts/${organizationLogin}/worklogs`,
|
|
20
20
|
method: 'POST',
|
|
21
21
|
body: { memberLogin, worklogName, start, end, type },
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
update(organizationLogin, { worklogid, worklogName, start, end }) {
|
|
24
|
+
update(organizationLogin, { worklogid, worklogName, start, end, }) {
|
|
25
25
|
return this._requestRunner.performRequest({
|
|
26
26
|
url: `accounts/${organizationLogin}/worklogs/${worklogid}`,
|
|
27
27
|
method: 'PUT',
|
|
@@ -2,11 +2,11 @@ import { StartaRequestRunner } from '../types';
|
|
|
2
2
|
export default class EmailConfirmations {
|
|
3
3
|
private _requestRunner;
|
|
4
4
|
constructor(requestRunner: StartaRequestRunner);
|
|
5
|
-
create({ email, recaptchaToken }: {
|
|
5
|
+
create({ email, recaptchaToken, }: {
|
|
6
6
|
email: string;
|
|
7
7
|
recaptchaToken?: string;
|
|
8
8
|
}): Promise<import("../types").StartaResponse>;
|
|
9
|
-
setPassword({ token, email, password, passwordConfirm, recaptchaToken, authMethod }: {
|
|
9
|
+
setPassword({ token, email, password, passwordConfirm, recaptchaToken, authMethod, }: {
|
|
10
10
|
token: any;
|
|
11
11
|
email: any;
|
|
12
12
|
password: any;
|
|
@@ -4,18 +4,24 @@ class EmailConfirmations {
|
|
|
4
4
|
constructor(requestRunner) {
|
|
5
5
|
this._requestRunner = requestRunner;
|
|
6
6
|
}
|
|
7
|
-
create({ email, recaptchaToken }) {
|
|
7
|
+
create({ email, recaptchaToken, }) {
|
|
8
8
|
return this._requestRunner.performRequest({
|
|
9
9
|
url: `passwordResets`,
|
|
10
10
|
method: 'POST',
|
|
11
11
|
body: { email, recaptchaToken },
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
|
-
setPassword({ token, email, password, passwordConfirm, recaptchaToken, authMethod }) {
|
|
14
|
+
setPassword({ token, email, password, passwordConfirm, recaptchaToken, authMethod, }) {
|
|
15
15
|
return this._requestRunner.performRequest({
|
|
16
16
|
url: `passwordResets/${token}`,
|
|
17
17
|
method: 'PUT',
|
|
18
|
-
body: {
|
|
18
|
+
body: {
|
|
19
|
+
password,
|
|
20
|
+
email,
|
|
21
|
+
passwordConfirm,
|
|
22
|
+
recaptchaToken,
|
|
23
|
+
authMethod: authMethod || 'cookie',
|
|
24
|
+
},
|
|
19
25
|
});
|
|
20
26
|
}
|
|
21
27
|
}
|
|
@@ -3,7 +3,7 @@ export default class PhoneConfirmations {
|
|
|
3
3
|
private _requestRunner;
|
|
4
4
|
constructor(requestRunner: StartaRequestRunner);
|
|
5
5
|
confirm(confirmPhoneToken: any): Promise<import("../types").StartaResponse>;
|
|
6
|
-
create({ phone, customVerification, recaptchaToken, language }: {
|
|
6
|
+
create({ phone, customVerification, recaptchaToken, language, }: {
|
|
7
7
|
phone: string;
|
|
8
8
|
customVerification?: {
|
|
9
9
|
type: 'provider';
|
|
@@ -11,15 +11,17 @@ class PhoneConfirmations {
|
|
|
11
11
|
body: {},
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
|
-
create({ phone, customVerification, recaptchaToken, language }) {
|
|
14
|
+
create({ phone, customVerification, recaptchaToken, language, }) {
|
|
15
15
|
return this._requestRunner.performRequest({
|
|
16
16
|
url: `phoneConfirmations`,
|
|
17
17
|
method: 'POST',
|
|
18
18
|
body: {
|
|
19
|
-
phone,
|
|
19
|
+
phone,
|
|
20
|
+
customVerification,
|
|
21
|
+
recaptchaToken,
|
|
22
|
+
language,
|
|
20
23
|
},
|
|
21
24
|
});
|
|
22
25
|
}
|
|
23
26
|
}
|
|
24
27
|
exports.default = PhoneConfirmations;
|
|
25
|
-
;
|
package/lib/services/search.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { StartaRequestRunner } from '../types';
|
|
|
2
2
|
export default class Search {
|
|
3
3
|
private _requestRunner;
|
|
4
4
|
constructor(requestRunner: StartaRequestRunner);
|
|
5
|
-
index({ term, categoryKey, type, location, free, mfuDiscount, languages, isTop, discounts }?: {
|
|
5
|
+
index({ term, categoryKey, type, location, free, mfuDiscount, languages, isTop, discounts, }?: {
|
|
6
6
|
term?: string;
|
|
7
7
|
categoryKey?: string;
|
|
8
8
|
type?: 'organization' | 'service';
|
|
@@ -26,7 +26,7 @@ export default class Search {
|
|
|
26
26
|
isTop?: boolean;
|
|
27
27
|
discounts?: boolean;
|
|
28
28
|
}): Promise<import("../types").StartaResponse>;
|
|
29
|
-
getSections({ term, categoryKey, type, location, free, mfuDiscount, languages, isTop, discounts }?: {
|
|
29
|
+
getSections({ term, categoryKey, type, location, free, mfuDiscount, languages, isTop, discounts, }?: {
|
|
30
30
|
term?: string;
|
|
31
31
|
categoryKey?: string;
|
|
32
32
|
type?: 'organization' | 'service';
|
package/lib/services/search.js
CHANGED
|
@@ -5,7 +5,7 @@ class Search {
|
|
|
5
5
|
constructor(requestRunner) {
|
|
6
6
|
this._requestRunner = requestRunner;
|
|
7
7
|
}
|
|
8
|
-
index({ term, categoryKey, type, location, free, mfuDiscount, languages, isTop, discounts } = {}) {
|
|
8
|
+
index({ term, categoryKey, type, location, free, mfuDiscount, languages, isTop, discounts, } = {}) {
|
|
9
9
|
return this._requestRunner.performRequest({
|
|
10
10
|
url: `searchItems${(0, _helpers_1.buildQuery)({ term, categoryKey, type, location, free, mfuDiscount, languages, isTop, discounts })}`,
|
|
11
11
|
method: 'GET',
|
|
@@ -16,7 +16,7 @@ class Search {
|
|
|
16
16
|
},
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
getSections({ term, categoryKey, type, location, free, mfuDiscount, languages, isTop, discounts } = {}) {
|
|
19
|
+
getSections({ term, categoryKey, type, location, free, mfuDiscount, languages, isTop, discounts, } = {}) {
|
|
20
20
|
return this._requestRunner.performRequest({
|
|
21
21
|
url: `searchItemsSections${(0, _helpers_1.buildQuery)({ term, categoryKey, type, location, free, mfuDiscount, languages, isTop, discounts })}`,
|
|
22
22
|
method: 'GET',
|
|
@@ -27,7 +27,7 @@ export default class ServiceCategories {
|
|
|
27
27
|
synonyms?: string;
|
|
28
28
|
showAsMainCategory?: boolean;
|
|
29
29
|
}): Promise<import("../types").StartaResponse>;
|
|
30
|
-
updateCategoriesOrder({ children }: {
|
|
30
|
+
updateCategoriesOrder({ children, }: {
|
|
31
31
|
children: string[];
|
|
32
32
|
}, parentId?: string): Promise<import("../types").StartaResponse>;
|
|
33
33
|
delete(id: any): Promise<import("../types").StartaResponse>;
|
|
@@ -34,7 +34,7 @@ class ServiceCategories {
|
|
|
34
34
|
},
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
-
updateCategoriesOrder({ children }, parentId) {
|
|
37
|
+
updateCategoriesOrder({ children, }, parentId) {
|
|
38
38
|
return this._requestRunner.performRequest({
|
|
39
39
|
url: `serviceCategories/${parentId || 'root'}/children`,
|
|
40
40
|
method: 'PUT',
|
|
@@ -3,14 +3,14 @@ export default class Sessions {
|
|
|
3
3
|
private _requestRunner;
|
|
4
4
|
constructor(requestRunner: StartaRequestRunner);
|
|
5
5
|
current(): Promise<import("../types").StartaResponse>;
|
|
6
|
-
create({ login, password, authMethod, recaptchaToken, shortSession }: {
|
|
6
|
+
create({ login, password, authMethod, recaptchaToken, shortSession, }: {
|
|
7
7
|
login: string;
|
|
8
8
|
password: string;
|
|
9
9
|
authMethod?: string;
|
|
10
10
|
recaptchaToken?: string;
|
|
11
11
|
shortSession?: boolean;
|
|
12
12
|
}): Promise<import("../types").StartaResponse>;
|
|
13
|
-
createSocial({ token, sn, authMethod }: {
|
|
13
|
+
createSocial({ token, sn, authMethod, }: {
|
|
14
14
|
token: any;
|
|
15
15
|
sn: 'google' | 'facebook';
|
|
16
16
|
authMethod: 'cookie' | 'header';
|
package/lib/services/sessions.js
CHANGED
|
@@ -10,14 +10,14 @@ class Sessions {
|
|
|
10
10
|
method: 'GET',
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
|
-
create({ login, password, authMethod = 'cookie', recaptchaToken, shortSession }) {
|
|
13
|
+
create({ login, password, authMethod = 'cookie', recaptchaToken, shortSession, }) {
|
|
14
14
|
return this._requestRunner.performRequest({
|
|
15
15
|
url: `sessions`,
|
|
16
16
|
method: 'POST',
|
|
17
17
|
body: { login, password, authMethod, recaptchaToken, shortSession },
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
-
createSocial({ token, sn, authMethod }) {
|
|
20
|
+
createSocial({ token, sn, authMethod, }) {
|
|
21
21
|
return this._requestRunner.performRequest({
|
|
22
22
|
url: `sessions/social`,
|
|
23
23
|
method: 'POST',
|
package/lib/services/system.js
CHANGED
|
@@ -43,7 +43,7 @@ class EmailConfirmations {
|
|
|
43
43
|
utm_campaign,
|
|
44
44
|
utm_term,
|
|
45
45
|
utm_content,
|
|
46
|
-
groupBy
|
|
46
|
+
groupBy,
|
|
47
47
|
})}`,
|
|
48
48
|
method: 'GET',
|
|
49
49
|
});
|
|
@@ -75,8 +75,9 @@ class EmailConfirmations {
|
|
|
75
75
|
url: `accounts/${login}/confirmations`,
|
|
76
76
|
method: 'PUT',
|
|
77
77
|
body: {
|
|
78
|
-
email,
|
|
79
|
-
|
|
78
|
+
email,
|
|
79
|
+
phone,
|
|
80
|
+
},
|
|
80
81
|
});
|
|
81
82
|
}
|
|
82
83
|
}
|
package/lib/types.d.ts
CHANGED
|
@@ -4,18 +4,18 @@ export interface StartaRequestRunner {
|
|
|
4
4
|
setAuthHeaderToken: (token: string) => void;
|
|
5
5
|
replaceBaseUrl: (newBaseUrl: (baseURL: string) => string) => StartaRequestRunner;
|
|
6
6
|
}
|
|
7
|
-
export
|
|
7
|
+
export type DraftjsObject = {
|
|
8
8
|
blocks: any;
|
|
9
9
|
entityMap: any;
|
|
10
10
|
};
|
|
11
|
-
export
|
|
11
|
+
export type StartaRequestData = {
|
|
12
12
|
url: string;
|
|
13
13
|
method: Method;
|
|
14
14
|
body?: any;
|
|
15
15
|
urlParams?: any;
|
|
16
16
|
config?: StartaRequestConfig;
|
|
17
17
|
};
|
|
18
|
-
export
|
|
18
|
+
export type StartaResponse = {
|
|
19
19
|
httpResponse?: AxiosResponse<any, any>;
|
|
20
20
|
success: boolean;
|
|
21
21
|
data: any;
|
|
@@ -24,7 +24,7 @@ export declare type StartaResponse = {
|
|
|
24
24
|
export interface StartaRequestConfig extends AxiosRequestConfig {
|
|
25
25
|
rewriteBaseUrl?: (baseUrl: string) => string;
|
|
26
26
|
}
|
|
27
|
-
export
|
|
27
|
+
export type StartaRequestMiddlewares = {
|
|
28
28
|
onForbidden?: (response: StartaResponse) => void;
|
|
29
29
|
onUnauthorized?: (response: StartaResponse) => void;
|
|
30
30
|
logger?: (...args: any[]) => void;
|
|
@@ -32,14 +32,14 @@ export declare type StartaRequestMiddlewares = {
|
|
|
32
32
|
headers?: () => AxiosRequestHeaders;
|
|
33
33
|
requestSlowMoDelayMS?: number;
|
|
34
34
|
};
|
|
35
|
-
export
|
|
35
|
+
export type Interval = {
|
|
36
36
|
from: string;
|
|
37
37
|
to: string;
|
|
38
38
|
};
|
|
39
|
-
export
|
|
39
|
+
export type DaySchedule = {
|
|
40
40
|
intervals: Array<Interval>;
|
|
41
41
|
};
|
|
42
|
-
export
|
|
42
|
+
export type WeeklySchedule = {
|
|
43
43
|
mon?: DaySchedule;
|
|
44
44
|
tue?: DaySchedule;
|
|
45
45
|
wed?: DaySchedule;
|
|
@@ -48,7 +48,7 @@ export declare type WeeklySchedule = {
|
|
|
48
48
|
sat?: DaySchedule;
|
|
49
49
|
sun?: DaySchedule;
|
|
50
50
|
};
|
|
51
|
-
export
|
|
51
|
+
export type Schedule = {
|
|
52
52
|
weekly?: WeeklySchedule;
|
|
53
53
|
daily?: {
|
|
54
54
|
workForDays: number;
|
|
@@ -57,8 +57,8 @@ export declare type Schedule = {
|
|
|
57
57
|
daySchedule: DaySchedule;
|
|
58
58
|
};
|
|
59
59
|
};
|
|
60
|
-
export
|
|
61
|
-
export
|
|
60
|
+
export type MeasurementUnit = 'ampoule' | 'can' | 'gram' | 'dose' | 'other' | 'capsule' | 'kilogram' | 'box' | 'liter' | 'meter' | 'microliter' | 'milligram' | 'milliliter' | 'millimeters' | 'set' | 'unit' | 'pair' | 'bottle' | 'portion' | 'procedure' | 'roll' | 'centimeter' | 'tube' | 'pack' | 'vial' | 'syringe' | 'piece';
|
|
61
|
+
export type Product = {
|
|
62
62
|
name: string;
|
|
63
63
|
sku?: string;
|
|
64
64
|
category?: {
|
|
@@ -77,7 +77,7 @@ export declare type Product = {
|
|
|
77
77
|
criticalStock?: number;
|
|
78
78
|
desiredStock?: number;
|
|
79
79
|
};
|
|
80
|
-
export
|
|
80
|
+
export type ProductOperation = {
|
|
81
81
|
organizationLogin: string;
|
|
82
82
|
date: Date;
|
|
83
83
|
type: 'receiving' | 'writeOff';
|
|
@@ -95,7 +95,7 @@ export declare type ProductOperation = {
|
|
|
95
95
|
isPaid?: boolean;
|
|
96
96
|
comment?: string;
|
|
97
97
|
};
|
|
98
|
-
export
|
|
98
|
+
export type OrganizationSchedule = {
|
|
99
99
|
name: any;
|
|
100
100
|
location: {
|
|
101
101
|
isOnline: boolean;
|
|
@@ -126,8 +126,8 @@ export declare type OrganizationSchedule = {
|
|
|
126
126
|
enabled: boolean;
|
|
127
127
|
}>;
|
|
128
128
|
};
|
|
129
|
-
export
|
|
130
|
-
export
|
|
129
|
+
export type OrderStatus = 'new' | 'inprogress' | 'canceled' | 'completed';
|
|
130
|
+
export type OrderRepeatSettings = {
|
|
131
131
|
enabled: boolean;
|
|
132
132
|
interval: {
|
|
133
133
|
every: number;
|
|
@@ -136,6 +136,6 @@ export declare type OrderRepeatSettings = {
|
|
|
136
136
|
filter?: Array<number>;
|
|
137
137
|
finish: {
|
|
138
138
|
type: 'never' | 'date' | 'times';
|
|
139
|
-
value?: Date |
|
|
139
|
+
value?: Date | number;
|
|
140
140
|
};
|
|
141
141
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "starta.apiclient",
|
|
3
|
-
"version": "1.37.
|
|
3
|
+
"version": "1.37.6005",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"description": "Wrapper for starta.one api",
|
|
6
6
|
"author": "Collaboracia OÜ",
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"scripts": {
|
|
9
9
|
"build": "tsc",
|
|
10
10
|
"format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
|
|
11
|
-
"lint": "
|
|
11
|
+
"lint": "eslint '*/**/*.{js,ts}' --quiet",
|
|
12
|
+
"lint:fix": "eslint '*/**/*.{js,ts}' --fix",
|
|
12
13
|
"prepare": "npm run build"
|
|
13
14
|
},
|
|
14
15
|
"files": [
|
|
@@ -18,7 +19,14 @@
|
|
|
18
19
|
"axios": "^0.24.0"
|
|
19
20
|
},
|
|
20
21
|
"devDependencies": {
|
|
21
|
-
"
|
|
22
|
+
"@typescript-eslint/eslint-plugin": "^6.19.1",
|
|
23
|
+
"@typescript-eslint/parser": "^6.19.1",
|
|
24
|
+
"eslint": "^8.56.0",
|
|
25
|
+
"eslint-config-airbnb-typescript": "^17.1.0",
|
|
26
|
+
"eslint-config-prettier": "^9.1.0",
|
|
27
|
+
"eslint-plugin-import": "^2.29.1",
|
|
28
|
+
"eslint-plugin-prettier": "^5.1.3",
|
|
29
|
+
"prettier": "^3.2.4",
|
|
22
30
|
"tslint": "^6.1.3",
|
|
23
31
|
"tslint-config-prettier": "^1.18.0",
|
|
24
32
|
"typescript": "^4.0.2"
|