@hubs101/js-api-skd-client 1.0.10464 → 1.0.10465
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 +13 -1
- 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._addMediaFolder = exports._deleteMediaDirectoryFiles = exports._deleteMediaDirectories = exports._fetchMediaFileDetails = exports._fetchMediaDirectoryFiles = void 0;
|
|
14
|
+
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
|
@@ -74,7 +74,7 @@ function EventAPIProvider(props) {
|
|
|
74
74
|
if (!baseUrl) {
|
|
75
75
|
return false;
|
|
76
76
|
}
|
|
77
|
-
setConfig({ baseUrl });
|
|
77
|
+
setConfig({ baseUrl, token: undefined });
|
|
78
78
|
return true;
|
|
79
79
|
}, [config]);
|
|
80
80
|
const fetchEventRegistrations = react_1.default.useCallback((eventId) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -945,6 +945,14 @@ function EventAPIProvider(props) {
|
|
|
945
945
|
(0, api_1.validateConfig)(config);
|
|
946
946
|
return (0, event_1._fetchMediaFileDetails)(config.baseUrl, config.token, accountId, path);
|
|
947
947
|
}), [config, config.baseUrl, config.token]);
|
|
948
|
+
const uploadImageToFolder = react_1.default.useCallback((accountId, folderPath, fileName, blob) => __awaiter(this, void 0, void 0, function* () {
|
|
949
|
+
(0, api_1.validateConfig)(config);
|
|
950
|
+
return (0, event_1._uploadImageToFolder)(config.baseUrl, config.token, accountId, folderPath, fileName, blob);
|
|
951
|
+
}), [config, config.baseUrl, config.token]);
|
|
952
|
+
const renameFolder = react_1.default.useCallback((accountId, path, name_old, name_new) => __awaiter(this, void 0, void 0, function* () {
|
|
953
|
+
(0, api_1.validateConfig)(config);
|
|
954
|
+
return (0, event_1._renameFolder)(config.baseUrl, config.token, accountId, path, name_old, name_new);
|
|
955
|
+
}), [config, config.baseUrl, config.token]);
|
|
948
956
|
return (react_1.default.createElement(EventAPIContext_1.default.Provider, { value: {
|
|
949
957
|
config,
|
|
950
958
|
init,
|
|
@@ -1166,6 +1174,8 @@ function EventAPIProvider(props) {
|
|
|
1166
1174
|
fetchMediaDirectories,
|
|
1167
1175
|
fetchMediaDirectoryFiles,
|
|
1168
1176
|
fetchMediaFileDetails,
|
|
1177
|
+
uploadImageToFolder,
|
|
1178
|
+
renameFolder,
|
|
1169
1179
|
} }, props.children));
|
|
1170
1180
|
}
|
|
1171
1181
|
exports.EventAPIProvider = EventAPIProvider;
|
|
@@ -1388,5 +1398,7 @@ exports.BaseAPI = {
|
|
|
1388
1398
|
fetchMediaDirectories: event_1._fetchMediaDirectories,
|
|
1389
1399
|
fetchMediaDirectoryFiles: event_1._fetchMediaDirectoryFiles,
|
|
1390
1400
|
fetchMediaFileDetails: event_1._fetchMediaFileDetails,
|
|
1401
|
+
uploadImageToFolder: event_1._uploadImageToFolder,
|
|
1402
|
+
renameFolder: event_1._renameFolder,
|
|
1391
1403
|
};
|
|
1392
1404
|
exports.useAPIContext = EventAPIContext_1.useAPIContext;
|
package/lib/types/base.d.ts
CHANGED
|
@@ -318,6 +318,8 @@ export type BaseAPIType = {
|
|
|
318
318
|
fetchMediaDirectories: (basePath: string, token: string, accountId: string, path: string) => Promise<Directory>;
|
|
319
319
|
fetchMediaDirectoryFiles: (basePath: string, token: string, accountId: string, path: string) => Promise<DirectoryFiles>;
|
|
320
320
|
fetchMediaFileDetails: (basePath: string, token: string, accountId: string, filepath: string) => Promise<FileDetails>;
|
|
321
|
+
uploadImageToFolder: (basePath: string, token: string, accountId: string, folderPath: string, fileName: string, blob: Blob) => Promise<APIResponse>;
|
|
322
|
+
renameFolder: (basePath: string, token: string, accountId: string, path: string, name_old: string, name_new: string) => Promise<APIResponse>;
|
|
321
323
|
};
|
|
322
324
|
export type EventAPIType = {
|
|
323
325
|
config: BaseAPIConfigType;
|
|
@@ -564,6 +566,8 @@ export type EventAPIType = {
|
|
|
564
566
|
fetchMediaDirectories: (accountId: string, path: string) => Promise<Directory>;
|
|
565
567
|
fetchMediaDirectoryFiles: (accountId: string, path: string) => Promise<DirectoryFiles>;
|
|
566
568
|
fetchMediaFileDetails: (accountId: string, filepath: string) => Promise<FileDetails>;
|
|
569
|
+
uploadImageToFolder: (accountId: string, folderPath: string, fileName: string, blob: Blob) => Promise<APIResponse>;
|
|
570
|
+
renameFolder: (accountId: string, path: string, name_old: string, name_new: string) => Promise<APIResponse>;
|
|
567
571
|
};
|
|
568
572
|
export type BaseAPIConfigType = {
|
|
569
573
|
baseUrl?: string;
|