@hubs101/js-api-skd-client 1.0.10640 → 1.0.10641
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.
|
@@ -18,7 +18,9 @@ export declare const _registerManagerNative: (basePath: string, accountId: strin
|
|
|
18
18
|
export declare const _confirmManager: (basePath: string, accountId: string, data: any) => Promise<any>;
|
|
19
19
|
export declare const _confirmManagerNative: (basePath: string, accountId: string, data: any) => Promise<any>;
|
|
20
20
|
export declare const _inviteFinanceManager: (basePath: string, token: string, accountId: string, data: any) => Promise<any>;
|
|
21
|
+
export declare const _inviteSalesManager: (basePath: string, token: string, accountId: string, data: any) => Promise<any>;
|
|
21
22
|
export declare const _deleteFinanceManager: (basePath: string, token: string, accountId: string, profileId: string) => Promise<any>;
|
|
23
|
+
export declare const _deleteSalesManager: (basePath: string, token: string, accountId: string, profileId: string) => Promise<any>;
|
|
22
24
|
export declare const _deletePaymentAccount: (basePath: string, token: string, paymentAccountId: string) => Promise<any>;
|
|
23
25
|
export declare const _fetchAccountEvents: (basePath: string, token: string, url: string) => Promise<ResponseAccountEventsType>;
|
|
24
26
|
export declare const _fetchEventsByAccount: (basePath: string, token: string, accountId: string, params?: string) => Promise<ResponseAccountEventsType>;
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports._deleteFeed = exports._updateFeed = exports._createFeed = exports._fetchFeed = exports._fetchFeeds = exports._updateSessionTypes = exports._fetchSessionTypes = exports._updatePackages = exports._deleteColocatedEvents = exports._editColocatedEvents = exports._createColocatedEvents = exports._fetchColocatedEventDetails = exports._fetchColocatedEvents = exports._updateAccountGroup = exports._createAccountGroup = exports._fetchAccountGroups = exports._fetchEventsByAccount = exports._fetchAccountEvents = exports._deletePaymentAccount = exports._deleteFinanceManager = exports._inviteFinanceManager = exports._confirmManagerNative = exports._confirmManager = exports._registerManagerNative = exports._registerManager = exports._deleteContentManager = exports._inviteContentManager = exports._updatePaymentAccount = exports._createPaymentAccount = exports._fetchPaymentAccounts = exports._fetchPaymentAccount = exports._sendNewPassword = exports._resetPassword = exports._logout = exports._login = void 0;
|
|
12
|
+
exports._deleteFeed = exports._updateFeed = exports._createFeed = exports._fetchFeed = exports._fetchFeeds = exports._updateSessionTypes = exports._fetchSessionTypes = exports._updatePackages = exports._deleteColocatedEvents = exports._editColocatedEvents = exports._createColocatedEvents = exports._fetchColocatedEventDetails = exports._fetchColocatedEvents = exports._updateAccountGroup = exports._createAccountGroup = exports._fetchAccountGroups = exports._fetchEventsByAccount = exports._fetchAccountEvents = exports._deletePaymentAccount = exports._deleteSalesManager = exports._deleteFinanceManager = exports._inviteSalesManager = exports._inviteFinanceManager = exports._confirmManagerNative = exports._confirmManager = exports._registerManagerNative = exports._registerManager = exports._deleteContentManager = exports._inviteContentManager = exports._updatePaymentAccount = exports._createPaymentAccount = exports._fetchPaymentAccounts = exports._fetchPaymentAccount = exports._sendNewPassword = exports._resetPassword = exports._logout = exports._login = void 0;
|
|
13
13
|
const api_1 = require("../../utils/api");
|
|
14
14
|
const base_1 = require("../../utils/base");
|
|
15
15
|
const _login = (basePath, email, password) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -111,12 +111,24 @@ const _inviteFinanceManager = (basePath, token, accountId, data) => __awaiter(vo
|
|
|
111
111
|
return response;
|
|
112
112
|
});
|
|
113
113
|
exports._inviteFinanceManager = _inviteFinanceManager;
|
|
114
|
+
const _inviteSalesManager = (basePath, token, accountId, data) => __awaiter(void 0, void 0, void 0, function* () {
|
|
115
|
+
const base = (0, base_1.getBasePath)(basePath);
|
|
116
|
+
const response = yield (0, api_1.postRequestWE)(`${base.ACCOUNTS}/${accountId}/managers/sales`, data, token);
|
|
117
|
+
return response;
|
|
118
|
+
});
|
|
119
|
+
exports._inviteSalesManager = _inviteSalesManager;
|
|
114
120
|
const _deleteFinanceManager = (basePath, token, accountId, profileId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
115
121
|
const base = (0, base_1.getBasePath)(basePath);
|
|
116
122
|
const response = yield (0, api_1.deleteRequestWE)(`${base.ACCOUNTS}/${accountId}/managers/finances/${profileId}`, token);
|
|
117
123
|
return response;
|
|
118
124
|
});
|
|
119
125
|
exports._deleteFinanceManager = _deleteFinanceManager;
|
|
126
|
+
const _deleteSalesManager = (basePath, token, accountId, profileId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
127
|
+
const base = (0, base_1.getBasePath)(basePath);
|
|
128
|
+
const response = yield (0, api_1.deleteRequestWE)(`${base.ACCOUNTS}/${accountId}/managers/sales/${profileId}`, token);
|
|
129
|
+
return response;
|
|
130
|
+
});
|
|
131
|
+
exports._deleteSalesManager = _deleteSalesManager;
|
|
120
132
|
const _deletePaymentAccount = (basePath, token, paymentAccountId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
121
133
|
const base = (0, base_1.getBasePath)(basePath);
|
|
122
134
|
const response = yield (0, api_1.deleteRequestWE)(`${base.PAYMENT_ACCOUNTS}/${paymentAccountId}`, token);
|
package/lib/index.js
CHANGED
|
@@ -427,10 +427,18 @@ function EventAPIProvider(props) {
|
|
|
427
427
|
(0, api_1.validateConfig)(config);
|
|
428
428
|
return (0, authentication_1._inviteFinanceManager)(config.baseUrl, config.token, accountId, data);
|
|
429
429
|
}), [config, config.baseUrl, config.token]);
|
|
430
|
+
const inviteSalesManager = (0, react_1.useCallback)((accountId, data) => __awaiter(this, void 0, void 0, function* () {
|
|
431
|
+
(0, api_1.validateConfig)(config);
|
|
432
|
+
return (0, authentication_1._inviteSalesManager)(config.baseUrl, config.token, accountId, data);
|
|
433
|
+
}), [config, config.baseUrl, config.token]);
|
|
430
434
|
const deleteFinanceManager = (0, react_1.useCallback)((accountId, profileId) => __awaiter(this, void 0, void 0, function* () {
|
|
431
435
|
(0, api_1.validateConfig)(config);
|
|
432
436
|
return (0, authentication_1._deleteFinanceManager)(config.baseUrl, config.token, accountId, profileId);
|
|
433
437
|
}), [config, config.baseUrl, config.token]);
|
|
438
|
+
const deleteSalesManager = (0, react_1.useCallback)((accountId, profileId) => __awaiter(this, void 0, void 0, function* () {
|
|
439
|
+
(0, api_1.validateConfig)(config);
|
|
440
|
+
return (0, authentication_1._deleteSalesManager)(config.baseUrl, config.token, accountId, profileId);
|
|
441
|
+
}), [config, config.baseUrl, config.token]);
|
|
434
442
|
const deletePaymentAccount = (0, react_1.useCallback)((paymentAccountId) => __awaiter(this, void 0, void 0, function* () {
|
|
435
443
|
(0, api_1.validateConfig)(config);
|
|
436
444
|
return (0, authentication_1._deletePaymentAccount)(config.baseUrl, config.token, paymentAccountId);
|
|
@@ -1260,7 +1268,9 @@ function EventAPIProvider(props) {
|
|
|
1260
1268
|
confirmManager,
|
|
1261
1269
|
confirmManagerNative,
|
|
1262
1270
|
inviteFinanceManager,
|
|
1271
|
+
inviteSalesManager,
|
|
1263
1272
|
deleteFinanceManager,
|
|
1273
|
+
deleteSalesManager,
|
|
1264
1274
|
deletePaymentAccount,
|
|
1265
1275
|
fetchAccountEvents,
|
|
1266
1276
|
fetchPaymentAccount,
|
|
@@ -1533,6 +1543,8 @@ exports.BaseAPI = {
|
|
|
1533
1543
|
updatePaymentAccount: authentication_1._updatePaymentAccount,
|
|
1534
1544
|
inviteContentManager: authentication_1._inviteContentManager,
|
|
1535
1545
|
deleteContentManager: authentication_1._deleteContentManager,
|
|
1546
|
+
inviteSalesManager: authentication_1._inviteSalesManager,
|
|
1547
|
+
deleteSalesManager: authentication_1._deleteSalesManager,
|
|
1536
1548
|
registerManager: authentication_1._registerManager,
|
|
1537
1549
|
registerManagerNative: authentication_1._registerManagerNative,
|
|
1538
1550
|
confirmManager: authentication_1._confirmManager,
|
package/lib/types/base.d.ts
CHANGED
|
@@ -146,7 +146,9 @@ export type BaseAPIType = {
|
|
|
146
146
|
confirmManager: (basePath: string, accountId: string, data: any) => Promise<any>;
|
|
147
147
|
confirmManagerNative: (basePath: string, accountId: string, data: any) => Promise<any>;
|
|
148
148
|
inviteFinanceManager: (basePath: string, token: string, accountId: string, data: any) => Promise<any>;
|
|
149
|
+
inviteSalesManager: (basePath: string, token: string, accountId: string, data: any) => Promise<any>;
|
|
149
150
|
deleteFinanceManager: (basePath: string, token: string, accountId: string, profileId: string) => Promise<any>;
|
|
151
|
+
deleteSalesManager: (basePath: string, token: string, accountId: string, profileId: string) => Promise<any>;
|
|
150
152
|
deletePaymentAccount: (basePath: string, token: string, paymentAccountId: string) => Promise<any>;
|
|
151
153
|
fetchAccountEvents: (basePath: string, token: string, url: string) => Promise<ResponseAccountEventsType>;
|
|
152
154
|
fetchPaymentAccount: (basePath: string, token: string, paymentAccountId: string) => Promise<any>;
|
package/package.json
CHANGED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export type FileAttachment = {
|
|
2
|
-
path?: string;
|
|
3
|
-
uri?: string;
|
|
4
|
-
source?: {
|
|
5
|
-
uri?: string;
|
|
6
|
-
};
|
|
7
|
-
mime?: string;
|
|
8
|
-
type?: string;
|
|
9
|
-
filename?: string;
|
|
10
|
-
name?: string;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Utility function to prepare FormData for file uploads (images, PDFs, docs)
|
|
14
|
-
* @param postData - The data to be sent
|
|
15
|
-
* @param attachment - The file attachment(s) - can be single file or array of files
|
|
16
|
-
* @returns FormData object ready for upload
|
|
17
|
-
*/
|
|
18
|
-
export declare const prepareFormDataForFiles: (postData: any, attachment?: FileAttachment | FileAttachment[]) => FormData;
|
package/lib/utils/formatters.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.prepareFormDataForFiles = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Utility function to prepare FormData for file uploads (images, PDFs, docs)
|
|
6
|
-
* @param postData - The data to be sent
|
|
7
|
-
* @param attachment - The file attachment(s) - can be single file or array of files
|
|
8
|
-
* @returns FormData object ready for upload
|
|
9
|
-
*/
|
|
10
|
-
const prepareFormDataForFiles = (postData, attachment) => {
|
|
11
|
-
const formData = new FormData();
|
|
12
|
-
// Handle different field names that might be used
|
|
13
|
-
const description = postData.description || postData.content || postData.text || "";
|
|
14
|
-
const eventId = postData.event_id || postData.event || postData.eventId || "";
|
|
15
|
-
// Add description (API expects 'description' field)
|
|
16
|
-
if (description) {
|
|
17
|
-
formData.append("description", description);
|
|
18
|
-
}
|
|
19
|
-
// Add event ID if provided - API expects 'event' field, not 'event_id'
|
|
20
|
-
if (eventId) {
|
|
21
|
-
formData.append("event", eventId);
|
|
22
|
-
}
|
|
23
|
-
// Add attachment(s) if provided (image, PDF, doc)
|
|
24
|
-
if (attachment) {
|
|
25
|
-
// Handle both single attachment and array of attachments
|
|
26
|
-
const attachments = Array.isArray(attachment) ? attachment : [attachment];
|
|
27
|
-
attachments.forEach((file, index) => {
|
|
28
|
-
var _a;
|
|
29
|
-
if (!file)
|
|
30
|
-
return;
|
|
31
|
-
// Handle different file data structures
|
|
32
|
-
const filePath = file.path || file.uri || ((_a = file.source) === null || _a === void 0 ? void 0 : _a.uri);
|
|
33
|
-
const fileMime = file.mime || file.type || "application/octet-stream";
|
|
34
|
-
const fileName = file.filename ||
|
|
35
|
-
file.name ||
|
|
36
|
-
`${new Date().getTime()}_${index}.${fileMime.split("/")[1] || "file"}`;
|
|
37
|
-
// Validate file
|
|
38
|
-
if (filePath) {
|
|
39
|
-
// Handle platform-specific URI formatting
|
|
40
|
-
let fileUri = filePath;
|
|
41
|
-
if (!filePath.startsWith("file://") &&
|
|
42
|
-
!filePath.startsWith("content://")) {
|
|
43
|
-
fileUri = `file://${filePath}`;
|
|
44
|
-
}
|
|
45
|
-
// Determine the field name based on file type or use default
|
|
46
|
-
let fieldName = "image"; // default field name
|
|
47
|
-
if (fileMime.startsWith("image/")) {
|
|
48
|
-
fieldName = "image";
|
|
49
|
-
}
|
|
50
|
-
else if (fileMime.includes("pdf")) {
|
|
51
|
-
fieldName = "document";
|
|
52
|
-
}
|
|
53
|
-
else if (fileMime.includes("word") || fileMime.includes("document")) {
|
|
54
|
-
fieldName = "document";
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
fieldName = "file";
|
|
58
|
-
}
|
|
59
|
-
// If multiple files of same type, append index to avoid overwriting
|
|
60
|
-
const finalFieldName = attachments.length > 1 ? `${fieldName}_${index}` : fieldName;
|
|
61
|
-
formData.append(finalFieldName, {
|
|
62
|
-
name: fileName,
|
|
63
|
-
type: fileMime,
|
|
64
|
-
uri: fileUri,
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
// Add any additional fields
|
|
70
|
-
if (postData.tags) {
|
|
71
|
-
formData.append("tags", JSON.stringify(postData.tags));
|
|
72
|
-
}
|
|
73
|
-
if (postData.visibility) {
|
|
74
|
-
formData.append("visibility", postData.visibility);
|
|
75
|
-
}
|
|
76
|
-
// Add title if provided
|
|
77
|
-
if (postData.title) {
|
|
78
|
-
formData.append("title", postData.title);
|
|
79
|
-
}
|
|
80
|
-
return formData;
|
|
81
|
-
};
|
|
82
|
-
exports.prepareFormDataForFiles = prepareFormDataForFiles;
|