@hubs101/js-api-skd-client 1.0.10480 → 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.
@@ -124,9 +124,11 @@ 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>;
130
132
  export declare const _updateEventWebsite: (basePath: string, token: string, eventId: string, keyData: string, data: {
131
- website_content: Record<string, string | boolean>[];
133
+ website_content: Record<string, string | boolean | File>[];
132
134
  }, files?: any) => Promise<ResponseAPIType1>;
@@ -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: 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);
@@ -553,10 +553,10 @@ export type EventServerResponse = {
553
553
  }[];
554
554
  webinar: string;
555
555
  website_content: {
556
- keytopics: Record<string, string | boolean>[];
557
- targetgroups: Record<string, string | boolean>[];
558
- testimonials: Record<string, string | boolean>[];
559
- whoattend: Record<string, string | boolean>[];
556
+ keytopics: Record<string, string | boolean | File>[];
557
+ targetgroups: Record<string, string | boolean | File>[];
558
+ testimonials: Record<string, string | boolean | File>[];
559
+ whoattend: Record<string, string | boolean | File>[];
560
560
  };
561
561
  };
562
562
  export type AccountInput = {
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;
@@ -92,7 +92,7 @@ export type BaseAPIType = {
92
92
  deleteMediaDirectories: (basePath: string, token: string, accountId: string, path: string, name: string) => Promise<APIResponse>;
93
93
  addMediaFolder: (basePath: string, token: string, accountId: string, path: string, name: string) => Promise<APIResponse>;
94
94
  updateEventWebsite: (basePath: string, token: string, eventId: string, keyData: string, data: {
95
- website_content: Record<string, string | boolean>[];
95
+ website_content: Record<string, string | boolean | File>[];
96
96
  }, files?: any) => Promise<ResponseAPIType1>;
97
97
  deleteMediaDirectoryFiles: (basePath: string, token: string, accountId: string, filepath: string) => Promise<APIResponse>;
98
98
  updateAccountGroup: (basePath: string, token: string, accountId: string, groupId: string, data: GroupInputType) => Promise<GroupResponseType>;
@@ -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;
@@ -344,7 +346,7 @@ export type EventAPIType = {
344
346
  deleteMediaDirectories: (accountId: string, path: string, name: string) => Promise<APIResponse>;
345
347
  addMediaFolder: (accountId: string, path: string, name: string) => Promise<APIResponse>;
346
348
  updateEventWebsite: (eventId: string, keyData: string, data: {
347
- website_content: Record<string, string | boolean>[];
349
+ website_content: Record<string, string | boolean | File>[];
348
350
  }, files?: any) => Promise<ResponseAPIType1>;
349
351
  deleteMediaDirectoryFiles: (accountId: string, filepath: string) => Promise<APIResponse>;
350
352
  updateAccountGroup: (accountId: string, groupId: string, data: GroupInputType) => Promise<GroupResponseType>;
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubs101/js-api-skd-client",
3
- "version": "1.0.10480",
3
+ "version": "1.0.10482",
4
4
  "author": "Liveware",
5
5
  "scripts": {
6
6
  "test": "jest --config jestconfig.json",