@hubs101/js-api-skd-client 1.0.10463 → 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.
@@ -124,5 +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>;
131
+ export declare const _addMediaFolder: (basePath: string, token: string, accountId: string, path: string, name: string) => Promise<APIResponse>;
@@ -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._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: portfolioPages } = yield (0, api_1.getRequest)(`${base.ACCOUNTS}/media/${accountId}/directories?path=${path}`, token);
638
- return (portfolioPages === null || portfolioPages === void 0 ? void 0 : portfolioPages.data) || portfolioPages;
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: portfolioPages } = yield (0, api_1.getRequest)(`${base.ACCOUNTS}/media/${accountId}/files?path=${path}`, token);
644
- return (portfolioPages === null || portfolioPages === void 0 ? void 0 : portfolioPages.data) || portfolioPages;
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: portfolioPages } = yield (0, api_1.getRequest)(`${base.ACCOUNTS}/media/${accountId}/filedetails?filepath=${filepath}`, token);
650
- return (portfolioPages === null || portfolioPages === void 0 ? void 0 : portfolioPages.data) || portfolioPages;
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);
@@ -662,3 +687,9 @@ const _deleteMediaDirectoryFiles = (basePath, token, accountId, filepath) => __a
662
687
  return response;
663
688
  });
664
689
  exports._deleteMediaDirectoryFiles = _deleteMediaDirectoryFiles;
690
+ const _addMediaFolder = (basePath, token, accountId, path, name) => __awaiter(void 0, void 0, void 0, function* () {
691
+ const base = (0, base_1.getBasePath)(basePath);
692
+ const response = yield (0, api_1.postRequestWE)(`${base.ACCOUNTS}/media/${accountId}/directory`, { path, name }, token);
693
+ return response;
694
+ });
695
+ exports._addMediaFolder = _addMediaFolder;
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* () {
@@ -145,6 +145,10 @@ function EventAPIProvider(props) {
145
145
  (0, api_1.validateConfig)(config);
146
146
  return (0, event_1._deleteMediaDirectories)(config.baseUrl, config.token, accountId, path, name);
147
147
  }), [config, config.baseUrl, config.token]);
148
+ const addMediaFolder = (0, react_1.useCallback)((accountId, path, name) => __awaiter(this, void 0, void 0, function* () {
149
+ (0, api_1.validateConfig)(config);
150
+ return (0, event_1._addMediaFolder)(config.baseUrl, config.token, accountId, path, name);
151
+ }), [config, config.baseUrl, config.token]);
148
152
  const deleteMediaDirectoryFiles = (0, react_1.useCallback)((accountId, filepath) => __awaiter(this, void 0, void 0, function* () {
149
153
  (0, api_1.validateConfig)(config);
150
154
  return (0, event_1._deleteMediaDirectoryFiles)(config.baseUrl, config.token, accountId, filepath);
@@ -941,6 +945,14 @@ function EventAPIProvider(props) {
941
945
  (0, api_1.validateConfig)(config);
942
946
  return (0, event_1._fetchMediaFileDetails)(config.baseUrl, config.token, accountId, path);
943
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]);
944
956
  return (react_1.default.createElement(EventAPIContext_1.default.Provider, { value: {
945
957
  config,
946
958
  init,
@@ -961,6 +973,7 @@ function EventAPIProvider(props) {
961
973
  unpinExhibition,
962
974
  fetchEventGroups,
963
975
  deleteMediaDirectories,
976
+ addMediaFolder,
964
977
  deleteMediaDirectoryFiles,
965
978
  updateAccountGroup,
966
979
  updateVisibilityAttendee,
@@ -1161,6 +1174,8 @@ function EventAPIProvider(props) {
1161
1174
  fetchMediaDirectories,
1162
1175
  fetchMediaDirectoryFiles,
1163
1176
  fetchMediaFileDetails,
1177
+ uploadImageToFolder,
1178
+ renameFolder,
1164
1179
  } }, props.children));
1165
1180
  }
1166
1181
  exports.EventAPIProvider = EventAPIProvider;
@@ -1180,6 +1195,7 @@ exports.BaseAPI = {
1180
1195
  unpinExhibition: event_1._unpinExhibition,
1181
1196
  fetchEventGroups: event_1._fetchEventGroups,
1182
1197
  deleteMediaDirectories: event_1._deleteMediaDirectories,
1198
+ addMediaFolder: event_1._addMediaFolder,
1183
1199
  deleteMediaDirectoryFiles: event_1._deleteMediaDirectoryFiles,
1184
1200
  updateAccountGroup: authentication_1._updateAccountGroup,
1185
1201
  updateVisibilityAttendee: attendee_1._updateVisibilityAttendee,
@@ -1382,5 +1398,7 @@ exports.BaseAPI = {
1382
1398
  fetchMediaDirectories: event_1._fetchMediaDirectories,
1383
1399
  fetchMediaDirectoryFiles: event_1._fetchMediaDirectoryFiles,
1384
1400
  fetchMediaFileDetails: event_1._fetchMediaFileDetails,
1401
+ uploadImageToFolder: event_1._uploadImageToFolder,
1402
+ renameFolder: event_1._renameFolder,
1385
1403
  };
1386
1404
  exports.useAPIContext = EventAPIContext_1.useAPIContext;
@@ -90,6 +90,7 @@ export type BaseAPIType = {
90
90
  getPublicRegistrationForm: (basePath: string, eventId: string) => Promise<any>;
91
91
  fetchEventGroups: (basePath: string, token: string, eventId: string) => Promise<GroupServerResponse[]>;
92
92
  deleteMediaDirectories: (basePath: string, token: string, accountId: string, path: string, name: string) => Promise<APIResponse>;
93
+ addMediaFolder: (basePath: string, token: string, accountId: string, path: string, name: string) => Promise<APIResponse>;
93
94
  deleteMediaDirectoryFiles: (basePath: string, token: string, accountId: string, filepath: string) => Promise<APIResponse>;
94
95
  updateAccountGroup: (basePath: string, token: string, accountId: string, groupId: string, data: GroupInputType) => Promise<GroupResponseType>;
95
96
  fetchAccountGroups: (basePath: string, token: string, accountId: string, type: GroupType) => Promise<ResponsePaginationType<GroupResponseType>>;
@@ -317,6 +318,8 @@ export type BaseAPIType = {
317
318
  fetchMediaDirectories: (basePath: string, token: string, accountId: string, path: string) => Promise<Directory>;
318
319
  fetchMediaDirectoryFiles: (basePath: string, token: string, accountId: string, path: string) => Promise<DirectoryFiles>;
319
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>;
320
323
  };
321
324
  export type EventAPIType = {
322
325
  config: BaseAPIConfigType;
@@ -338,6 +341,7 @@ export type EventAPIType = {
338
341
  unpinExhibition: (exhibitionId: string) => Promise<boolean>;
339
342
  fetchEventGroups: (eventId: string) => Promise<GroupServerResponse[]>;
340
343
  deleteMediaDirectories: (accountId: string, path: string, name: string) => Promise<APIResponse>;
344
+ addMediaFolder: (accountId: string, path: string, name: string) => Promise<APIResponse>;
341
345
  deleteMediaDirectoryFiles: (accountId: string, filepath: string) => Promise<APIResponse>;
342
346
  updateAccountGroup: (accountId: string, groupId: string, data: GroupInputType) => Promise<GroupResponseType>;
343
347
  fetchAccountGroups: (accountId: string, type: GroupType) => Promise<ResponsePaginationType<GroupResponseType>>;
@@ -562,6 +566,8 @@ export type EventAPIType = {
562
566
  fetchMediaDirectories: (accountId: string, path: string) => Promise<Directory>;
563
567
  fetchMediaDirectoryFiles: (accountId: string, path: string) => Promise<DirectoryFiles>;
564
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>;
565
571
  };
566
572
  export type BaseAPIConfigType = {
567
573
  baseUrl?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubs101/js-api-skd-client",
3
- "version": "1.0.10463",
3
+ "version": "1.0.10465",
4
4
  "author": "Liveware",
5
5
  "scripts": {
6
6
  "test": "jest --config jestconfig.json",