@hubs101/js-api-skd-client 1.0.10481 → 1.0.10482
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/api/event/index.d.ts +2 -0
- package/lib/api/event/index.js +32 -7
- package/lib/index.js +12 -0
- package/lib/types/base.d.ts +4 -0
- package/package.json +1 -1
package/lib/api/event/index.d.ts
CHANGED
|
@@ -124,6 +124,8 @@ export declare const _deletePortfolioBlogPage: (basePath: string, token: string,
|
|
|
124
124
|
export declare const _fetchMediaDirectories: (basePath: string, token: string, accountId: string, path: string) => Promise<Directory>;
|
|
125
125
|
export declare const _fetchMediaDirectoryFiles: (basePath: string, token: string, accountId: string, path: string) => Promise<DirectoryFiles>;
|
|
126
126
|
export declare const _fetchMediaFileDetails: (basePath: string, token: string, accountId: string, filepath: string) => Promise<FileDetails>;
|
|
127
|
+
export declare const _uploadImageToFolder: (basePath: string, token: string, accountId: string, folderPath: string, fileName: string, blob: Blob) => Promise<APIResponse>;
|
|
128
|
+
export declare const _renameFolder: (basePath: string, token: string, accountId: string, path: string, name_old: string, name_new: string) => Promise<APIResponse>;
|
|
127
129
|
export declare const _deleteMediaDirectories: (basePath: string, token: string, accountId: string, path: string, name: string) => Promise<APIResponse>;
|
|
128
130
|
export declare const _deleteMediaDirectoryFiles: (basePath: string, token: string, accountId: string, filepath: string) => Promise<APIResponse>;
|
|
129
131
|
export declare const _addMediaFolder: (basePath: string, token: string, accountId: string, path: string, name: string) => Promise<APIResponse>;
|
package/lib/api/event/index.js
CHANGED
|
@@ -11,7 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports._fetchMyBookings = exports._createBooking = exports._checkBooking = exports._resendBookingEmail = exports._resendTicketEmail = exports._fetchEventAttendeeActions = exports._fetchEventGroups = exports._unpinExhibition = exports._pinExhibition = exports._unpinDocument = exports._pinDocument = exports._reportExhibitionAction = exports._deleteDocument = exports._updateDocument = exports._createDocument = exports._assignDocumentToEvent = exports._fetchEventDocuments = exports._fetchUserRegistrationsEvents = exports._fetchEventStreams = exports._fetchEventLocations = exports._deleteLocation = exports._updateLocation = exports._createLocation = exports._fetchExhibitionDetails = exports._deleteDiscount = exports._updateDiscount = exports._createDiscount = exports._fetchEventDiscounts = exports._deleteTicket = exports._updateTicket = exports._createTicket = exports._deleteOption = exports._updateOption = exports._createOption = exports._deleteGroup = exports._updateGroup = exports._createGroup = exports._importAgenda = exports._fetchAttendeesAvailabilities = exports._updateEventTemplates = exports._fetchEventTemplates = exports._fetchEventNotifications = exports._sendSingleNotification = exports._sendNotification = exports._fetchEventDetails = exports._fetchExhibitions = exports._fetchEventsForAccount = exports._fetchTickets = exports._fetchAccounts = exports._fetchEventRegistrations = void 0;
|
|
13
13
|
exports._fetchMediaDirectories = exports._deletePortfolioBlogPage = exports._updatePortfolioBlogPage = exports._createBlogPage = exports._fetchBlogPages = exports._fetchPortfolioEvents = exports._fetchPortfolioDetails = exports._updatePortfolio = exports._createPortfolio = exports._unassignPortfolio = exports._assignPortfolio = exports._deletePortfolio = exports._fetchPortfolios = exports._deleteExhibition = exports._updateExhibition = exports._importExhibition = exports._createExhibition = exports._fetchMyExhibitions = exports._fetchAllExhibitions = exports._deleteStream = exports._updateStream = exports._createStream = exports._fetchYoutubeContent = exports._fetchZoomContent = exports._createEvent = exports._unassignPaymentAccount = exports._assignPaymentAccount = exports._fetchEventOptions = exports._fetchEventTickets = exports._updateEvent = exports._deletePage = exports._updatePage = exports._createPage = exports._fetchEventPages = exports._updateAccountWithFiles = exports._fetchMySessions = exports._fetchEditableEvents = exports._fetchSpeakers = exports._fetchAccountDetails = exports._eventInvitationRegistration = exports._createFreeTrialAccount = exports._fetchEventOrderedTickets = exports._confirmBooking = exports._fetchEventBookings = exports._acceptInternTicket = exports._acceptTicket = exports._postTicketDetails = exports._fetchTicketDetails = exports._assignTicket = exports._fetchAccountBookings = void 0;
|
|
14
|
-
exports._updateEventWebsite = exports._addMediaFolder = exports._deleteMediaDirectoryFiles = exports._deleteMediaDirectories = exports._fetchMediaFileDetails = exports._fetchMediaDirectoryFiles = void 0;
|
|
14
|
+
exports._updateEventWebsite = exports._addMediaFolder = exports._deleteMediaDirectoryFiles = exports._deleteMediaDirectories = exports._renameFolder = exports._uploadImageToFolder = exports._fetchMediaFileDetails = exports._fetchMediaDirectoryFiles = void 0;
|
|
15
15
|
const api_1 = require("../../utils/api");
|
|
16
16
|
const base_1 = require("../../utils/base");
|
|
17
17
|
const _fetchEventRegistrations = (basePath, token, eventId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -634,22 +634,47 @@ const _deletePortfolioBlogPage = (basePath, token, portfolioId, blogPostId) => _
|
|
|
634
634
|
exports._deletePortfolioBlogPage = _deletePortfolioBlogPage;
|
|
635
635
|
const _fetchMediaDirectories = (basePath, token, accountId, path) => __awaiter(void 0, void 0, void 0, function* () {
|
|
636
636
|
const base = (0, base_1.getBasePath)(basePath);
|
|
637
|
-
const { data
|
|
638
|
-
return (
|
|
637
|
+
const { data } = yield (0, api_1.getRequest)(`${base.ACCOUNTS}/media/${accountId}/directories?path=${path}`, token);
|
|
638
|
+
return (data === null || data === void 0 ? void 0 : data.data) || data;
|
|
639
639
|
});
|
|
640
640
|
exports._fetchMediaDirectories = _fetchMediaDirectories;
|
|
641
641
|
const _fetchMediaDirectoryFiles = (basePath, token, accountId, path) => __awaiter(void 0, void 0, void 0, function* () {
|
|
642
642
|
const base = (0, base_1.getBasePath)(basePath);
|
|
643
|
-
const { data
|
|
644
|
-
return (
|
|
643
|
+
const { data } = yield (0, api_1.getRequest)(`${base.ACCOUNTS}/media/${accountId}/files?path=${path}`, token);
|
|
644
|
+
return (data === null || data === void 0 ? void 0 : data.data) || data;
|
|
645
645
|
});
|
|
646
646
|
exports._fetchMediaDirectoryFiles = _fetchMediaDirectoryFiles;
|
|
647
647
|
const _fetchMediaFileDetails = (basePath, token, accountId, filepath) => __awaiter(void 0, void 0, void 0, function* () {
|
|
648
648
|
const base = (0, base_1.getBasePath)(basePath);
|
|
649
|
-
const { data
|
|
650
|
-
return (
|
|
649
|
+
const { data } = yield (0, api_1.getRequest)(`${base.ACCOUNTS}/media/${accountId}/filedetails?filepath=${filepath}`, token);
|
|
650
|
+
return (data === null || data === void 0 ? void 0 : data.data) || data;
|
|
651
651
|
});
|
|
652
652
|
exports._fetchMediaFileDetails = _fetchMediaFileDetails;
|
|
653
|
+
const _uploadImageToFolder = (basePath, token, accountId, folderPath, fileName, blob) => __awaiter(void 0, void 0, void 0, function* () {
|
|
654
|
+
const base = (0, base_1.getBasePath)(basePath);
|
|
655
|
+
const f = new File([blob], fileName);
|
|
656
|
+
const formData = new FormData();
|
|
657
|
+
formData.append("file", {
|
|
658
|
+
uri: f,
|
|
659
|
+
name: fileName,
|
|
660
|
+
type: f.type,
|
|
661
|
+
});
|
|
662
|
+
const { response } = yield (0, api_1.postFilesAndDataRequest)(`${base.ACCOUNTS}/media/${accountId}/file?path=${folderPath}`, {
|
|
663
|
+
image: f,
|
|
664
|
+
}, [formData], token);
|
|
665
|
+
return (response === null || response === void 0 ? void 0 : response.data) || response;
|
|
666
|
+
});
|
|
667
|
+
exports._uploadImageToFolder = _uploadImageToFolder;
|
|
668
|
+
const _renameFolder = (basePath, token, accountId, path, name_old, name_new) => __awaiter(void 0, void 0, void 0, function* () {
|
|
669
|
+
const base = (0, base_1.getBasePath)(basePath);
|
|
670
|
+
const { data } = yield (0, api_1.postFilesAndDataRequest)(`${base.ACCOUNTS}/media/${accountId}/directory`, {
|
|
671
|
+
path,
|
|
672
|
+
name_old,
|
|
673
|
+
name: name_new,
|
|
674
|
+
}, [], token, "put");
|
|
675
|
+
return (data === null || data === void 0 ? void 0 : data.data) || data;
|
|
676
|
+
});
|
|
677
|
+
exports._renameFolder = _renameFolder;
|
|
653
678
|
const _deleteMediaDirectories = (basePath, token, accountId, path, name) => __awaiter(void 0, void 0, void 0, function* () {
|
|
654
679
|
const base = (0, base_1.getBasePath)(basePath);
|
|
655
680
|
const response = yield (0, api_1.deleteRequest)(`${base.ACCOUNTS}/media/${accountId}/directory?path=${path}&name=${name}`, { path, name }, token);
|
package/lib/index.js
CHANGED
|
@@ -950,6 +950,14 @@ function EventAPIProvider(props) {
|
|
|
950
950
|
(0, api_1.validateConfig)(config);
|
|
951
951
|
return (0, event_1._fetchMediaFileDetails)(config.baseUrl, config.token, accountId, path);
|
|
952
952
|
}), [config, config.baseUrl, config.token]);
|
|
953
|
+
const uploadImageToFolder = (0, react_1.useCallback)((accountId, folderPath, fileName, blob) => __awaiter(this, void 0, void 0, function* () {
|
|
954
|
+
(0, api_1.validateConfig)(config);
|
|
955
|
+
return (0, event_1._uploadImageToFolder)(config.baseUrl, config.token, accountId, folderPath, fileName, blob);
|
|
956
|
+
}), [config, config.baseUrl, config.token]);
|
|
957
|
+
const renameFolder = (0, react_1.useCallback)((accountId, path, name_old, name_new) => __awaiter(this, void 0, void 0, function* () {
|
|
958
|
+
(0, api_1.validateConfig)(config);
|
|
959
|
+
return (0, event_1._renameFolder)(config.baseUrl, config.token, accountId, path, name_old, name_new);
|
|
960
|
+
}), [config, config.baseUrl, config.token]);
|
|
953
961
|
return (react_1.default.createElement(EventAPIContext_1.default.Provider, { value: {
|
|
954
962
|
config,
|
|
955
963
|
init,
|
|
@@ -1172,6 +1180,8 @@ function EventAPIProvider(props) {
|
|
|
1172
1180
|
fetchMediaDirectories,
|
|
1173
1181
|
fetchMediaDirectoryFiles,
|
|
1174
1182
|
fetchMediaFileDetails,
|
|
1183
|
+
uploadImageToFolder,
|
|
1184
|
+
renameFolder,
|
|
1175
1185
|
} }, props.children));
|
|
1176
1186
|
}
|
|
1177
1187
|
exports.BaseAPI = {
|
|
@@ -1394,5 +1404,7 @@ exports.BaseAPI = {
|
|
|
1394
1404
|
fetchMediaDirectories: event_1._fetchMediaDirectories,
|
|
1395
1405
|
fetchMediaDirectoryFiles: event_1._fetchMediaDirectoryFiles,
|
|
1396
1406
|
fetchMediaFileDetails: event_1._fetchMediaFileDetails,
|
|
1407
|
+
uploadImageToFolder: event_1._uploadImageToFolder,
|
|
1408
|
+
renameFolder: event_1._renameFolder,
|
|
1397
1409
|
};
|
|
1398
1410
|
exports.useAPIContext = EventAPIContext_1.useAPIContext;
|
package/lib/types/base.d.ts
CHANGED
|
@@ -321,6 +321,8 @@ export type BaseAPIType = {
|
|
|
321
321
|
fetchMediaDirectories: (basePath: string, token: string, accountId: string, path: string) => Promise<Directory>;
|
|
322
322
|
fetchMediaDirectoryFiles: (basePath: string, token: string, accountId: string, path: string) => Promise<DirectoryFiles>;
|
|
323
323
|
fetchMediaFileDetails: (basePath: string, token: string, accountId: string, filepath: string) => Promise<FileDetails>;
|
|
324
|
+
uploadImageToFolder: (basePath: string, token: string, accountId: string, folderPath: string, fileName: string, blob: Blob) => Promise<APIResponse>;
|
|
325
|
+
renameFolder: (basePath: string, token: string, accountId: string, path: string, name_old: string, name_new: string) => Promise<APIResponse>;
|
|
324
326
|
};
|
|
325
327
|
export type EventAPIType = {
|
|
326
328
|
config: BaseAPIConfigType;
|
|
@@ -570,6 +572,8 @@ export type EventAPIType = {
|
|
|
570
572
|
fetchMediaDirectories: (accountId: string, path: string) => Promise<Directory>;
|
|
571
573
|
fetchMediaDirectoryFiles: (accountId: string, path: string) => Promise<DirectoryFiles>;
|
|
572
574
|
fetchMediaFileDetails: (accountId: string, filepath: string) => Promise<FileDetails>;
|
|
575
|
+
uploadImageToFolder: (accountId: string, folderPath: string, fileName: string, blob: Blob) => Promise<APIResponse>;
|
|
576
|
+
renameFolder: (accountId: string, path: string, name_old: string, name_new: string) => Promise<APIResponse>;
|
|
573
577
|
};
|
|
574
578
|
export type BaseAPIConfigType = {
|
|
575
579
|
baseUrl?: string;
|