@connectedxm/admin 7.5.0 → 7.8.0
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/dist/index.cjs +147 -22
- package/dist/index.d.cts +2578 -34
- package/dist/index.d.ts +2578 -34
- package/dist/index.js +139 -20
- package/openapi.json +2631 -2480
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -846,6 +846,93 @@ var isUUID = (id) => {
|
|
|
846
846
|
return uuidRegex.test(id);
|
|
847
847
|
};
|
|
848
848
|
|
|
849
|
+
// src/utilities/MapboxSearch.ts
|
|
850
|
+
import axios2 from "axios";
|
|
851
|
+
var SUGGEST_URL = "https://api.mapbox.com/search/searchbox/v1/suggest";
|
|
852
|
+
var RETRIEVE_URL = "https://api.mapbox.com/search/searchbox/v1/retrieve";
|
|
853
|
+
var REQUEST_TIMEOUT_MS = 1e4;
|
|
854
|
+
var createMapboxSessionToken = () => {
|
|
855
|
+
try {
|
|
856
|
+
if (typeof globalThis.crypto !== "undefined" && typeof globalThis.crypto.randomUUID === "function") {
|
|
857
|
+
return globalThis.crypto.randomUUID();
|
|
858
|
+
}
|
|
859
|
+
} catch {
|
|
860
|
+
}
|
|
861
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
|
862
|
+
const r = Math.random() * 16 | 0;
|
|
863
|
+
const v = c === "x" ? r : r & 3 | 8;
|
|
864
|
+
return v.toString(16);
|
|
865
|
+
});
|
|
866
|
+
};
|
|
867
|
+
var mapFeatureToAddress = (feature) => {
|
|
868
|
+
const p = feature?.properties ?? {};
|
|
869
|
+
const ctx = p.context ?? {};
|
|
870
|
+
const geo = feature?.geometry?.coordinates ?? [];
|
|
871
|
+
const coords = p.coordinates ?? { longitude: geo[0], latitude: geo[1] };
|
|
872
|
+
const isPoi = p.feature_type === "poi";
|
|
873
|
+
return {
|
|
874
|
+
venue: isPoi ? p.name || null : null,
|
|
875
|
+
address1: ctx.address?.name || (isPoi ? null : p.name) || null,
|
|
876
|
+
address2: null,
|
|
877
|
+
city: ctx.place?.name || null,
|
|
878
|
+
state: ctx.region?.region_code || ctx.region?.name || null,
|
|
879
|
+
country: ctx.country?.country_code || null,
|
|
880
|
+
zip: ctx.postcode?.name || null,
|
|
881
|
+
latitude: typeof coords.latitude === "number" ? coords.latitude : null,
|
|
882
|
+
longitude: typeof coords.longitude === "number" ? coords.longitude : null,
|
|
883
|
+
fullAddress: p.full_address ?? null
|
|
884
|
+
};
|
|
885
|
+
};
|
|
886
|
+
var mapboxSuggest = async (query, {
|
|
887
|
+
accessToken,
|
|
888
|
+
sessionToken,
|
|
889
|
+
country,
|
|
890
|
+
limit = 6,
|
|
891
|
+
language = "en"
|
|
892
|
+
}) => {
|
|
893
|
+
if (!accessToken || !query || query.trim().length < 2) return [];
|
|
894
|
+
try {
|
|
895
|
+
const { data } = await axios2.get(SUGGEST_URL, {
|
|
896
|
+
params: {
|
|
897
|
+
q: query,
|
|
898
|
+
access_token: accessToken,
|
|
899
|
+
session_token: sessionToken,
|
|
900
|
+
language,
|
|
901
|
+
limit,
|
|
902
|
+
...country ? { country } : {}
|
|
903
|
+
},
|
|
904
|
+
timeout: REQUEST_TIMEOUT_MS
|
|
905
|
+
});
|
|
906
|
+
const suggestions = data?.suggestions ?? [];
|
|
907
|
+
return suggestions.map((s) => ({
|
|
908
|
+
mapboxId: s.mapbox_id,
|
|
909
|
+
name: s.name,
|
|
910
|
+
fullAddress: s.full_address ?? null,
|
|
911
|
+
placeFormatted: s.place_formatted ?? null,
|
|
912
|
+
featureType: s.feature_type ?? ""
|
|
913
|
+
}));
|
|
914
|
+
} catch {
|
|
915
|
+
return [];
|
|
916
|
+
}
|
|
917
|
+
};
|
|
918
|
+
var mapboxRetrieve = async (mapboxId, { accessToken, sessionToken }) => {
|
|
919
|
+
if (!accessToken || !mapboxId) return null;
|
|
920
|
+
try {
|
|
921
|
+
const { data } = await axios2.get(
|
|
922
|
+
`${RETRIEVE_URL}/${encodeURIComponent(mapboxId)}`,
|
|
923
|
+
{
|
|
924
|
+
params: { access_token: accessToken, session_token: sessionToken },
|
|
925
|
+
timeout: REQUEST_TIMEOUT_MS
|
|
926
|
+
}
|
|
927
|
+
);
|
|
928
|
+
const feature = data?.features?.[0];
|
|
929
|
+
if (!feature) return null;
|
|
930
|
+
return mapFeatureToAddress(feature);
|
|
931
|
+
} catch {
|
|
932
|
+
return null;
|
|
933
|
+
}
|
|
934
|
+
};
|
|
935
|
+
|
|
849
936
|
// src/utilities/MergeInfinitePages.ts
|
|
850
937
|
function MergeInfinitePages(data) {
|
|
851
938
|
return data.pages.reduce(
|
|
@@ -1042,11 +1129,11 @@ var useConnectedInfiniteQuery = (queryKeys, queryFn, params = {}, options = {
|
|
|
1042
1129
|
};
|
|
1043
1130
|
|
|
1044
1131
|
// src/AdminAPI.ts
|
|
1045
|
-
import
|
|
1132
|
+
import axios3 from "axios";
|
|
1046
1133
|
var GetAdminAPI = async (params) => {
|
|
1047
1134
|
const token = !!params.getToken && await params.getToken();
|
|
1048
1135
|
const executeAs = params.getExecuteAs ? await params.getExecuteAs() : void 0;
|
|
1049
|
-
return
|
|
1136
|
+
return axios3.create({
|
|
1050
1137
|
baseURL: params.apiUrl,
|
|
1051
1138
|
headers: {
|
|
1052
1139
|
organization: params.organizationId,
|
|
@@ -22572,22 +22659,6 @@ var useExportAccount = (options = {}) => {
|
|
|
22572
22659
|
return useConnectedMutation(ExportAccount, options);
|
|
22573
22660
|
};
|
|
22574
22661
|
|
|
22575
|
-
// src/mutations/accounts/useImpersonateAccount.ts
|
|
22576
|
-
var ImpersonateAccount = async ({
|
|
22577
|
-
accountId,
|
|
22578
|
-
username,
|
|
22579
|
-
adminApiParams
|
|
22580
|
-
}) => {
|
|
22581
|
-
const connectedXM = await GetAdminAPI(adminApiParams);
|
|
22582
|
-
const { data } = await connectedXM.post(
|
|
22583
|
-
`/accounts/${accountId}/impersonate/${username}`
|
|
22584
|
-
);
|
|
22585
|
-
return data;
|
|
22586
|
-
};
|
|
22587
|
-
var useImpersonateAccount = (options = {}) => {
|
|
22588
|
-
return useConnectedMutation(ImpersonateAccount, options);
|
|
22589
|
-
};
|
|
22590
|
-
|
|
22591
22662
|
// src/mutations/accounts/useSyncAccount.ts
|
|
22592
22663
|
var SyncAccount = async ({
|
|
22593
22664
|
accountId,
|
|
@@ -34121,6 +34192,26 @@ var useDeleteEvent = (options = {}) => {
|
|
|
34121
34192
|
return useConnectedMutation(DeleteEvent, options);
|
|
34122
34193
|
};
|
|
34123
34194
|
|
|
34195
|
+
// src/mutations/events/useDeleteEventLocation.ts
|
|
34196
|
+
var DeleteEventLocation = async ({
|
|
34197
|
+
eventId,
|
|
34198
|
+
adminApiParams,
|
|
34199
|
+
queryClient
|
|
34200
|
+
}) => {
|
|
34201
|
+
const connectedXM = await GetAdminAPI(adminApiParams);
|
|
34202
|
+
const { data } = await connectedXM.delete(
|
|
34203
|
+
`/events/${eventId}/location`
|
|
34204
|
+
);
|
|
34205
|
+
if (queryClient && data.status === "ok") {
|
|
34206
|
+
queryClient.invalidateQueries({ queryKey: EVENTS_QUERY_KEY() });
|
|
34207
|
+
SET_EVENT_QUERY_DATA(queryClient, [data.data?.id], data);
|
|
34208
|
+
}
|
|
34209
|
+
return data;
|
|
34210
|
+
};
|
|
34211
|
+
var useDeleteEventLocation = (options = {}) => {
|
|
34212
|
+
return useConnectedMutation(DeleteEventLocation, options);
|
|
34213
|
+
};
|
|
34214
|
+
|
|
34124
34215
|
// src/mutations/events/useDisableEventBuildMode.ts
|
|
34125
34216
|
var DisableEventBuildMode = async ({
|
|
34126
34217
|
eventId,
|
|
@@ -34155,6 +34246,28 @@ var useEnableEventBuildMode = (options = {}) => {
|
|
|
34155
34246
|
return useConnectedMutation(EnableEventBuildMode, options);
|
|
34156
34247
|
};
|
|
34157
34248
|
|
|
34249
|
+
// src/mutations/events/useSetEventLocation.ts
|
|
34250
|
+
var SetEventLocation = async ({
|
|
34251
|
+
eventId,
|
|
34252
|
+
location,
|
|
34253
|
+
adminApiParams,
|
|
34254
|
+
queryClient
|
|
34255
|
+
}) => {
|
|
34256
|
+
const connectedXM = await GetAdminAPI(adminApiParams);
|
|
34257
|
+
const { data } = await connectedXM.put(
|
|
34258
|
+
`/events/${eventId}/location`,
|
|
34259
|
+
location
|
|
34260
|
+
);
|
|
34261
|
+
if (queryClient && data.status === "ok") {
|
|
34262
|
+
queryClient.invalidateQueries({ queryKey: EVENTS_QUERY_KEY() });
|
|
34263
|
+
SET_EVENT_QUERY_DATA(queryClient, [data.data?.id], data);
|
|
34264
|
+
}
|
|
34265
|
+
return data;
|
|
34266
|
+
};
|
|
34267
|
+
var useSetEventLocation = (options = {}) => {
|
|
34268
|
+
return useConnectedMutation(SetEventLocation, options);
|
|
34269
|
+
};
|
|
34270
|
+
|
|
34158
34271
|
// src/mutations/events/useUpdateEvent.ts
|
|
34159
34272
|
var UpdateEvent = async ({
|
|
34160
34273
|
eventId,
|
|
@@ -40542,6 +40655,7 @@ export {
|
|
|
40542
40655
|
DeleteEventFaqSectionTranslation,
|
|
40543
40656
|
DeleteEventFollowup,
|
|
40544
40657
|
DeleteEventFollowupTranslation,
|
|
40658
|
+
DeleteEventLocation,
|
|
40545
40659
|
DeleteEventMatch,
|
|
40546
40660
|
DeleteEventMediaItem,
|
|
40547
40661
|
DeleteEventMediaItemTranslation,
|
|
@@ -41487,7 +41601,6 @@ export {
|
|
|
41487
41601
|
INVOICE_QUERY_KEY,
|
|
41488
41602
|
ImageModerationLevel,
|
|
41489
41603
|
ImageType,
|
|
41490
|
-
ImpersonateAccount,
|
|
41491
41604
|
ImportItemStatus,
|
|
41492
41605
|
ImportRooms,
|
|
41493
41606
|
ImportType,
|
|
@@ -42265,6 +42378,7 @@ export {
|
|
|
42265
42378
|
SendAnnouncementPreview,
|
|
42266
42379
|
SendInvoice,
|
|
42267
42380
|
SeriesQuestionType,
|
|
42381
|
+
SetEventLocation,
|
|
42268
42382
|
SideEffectActionType,
|
|
42269
42383
|
SideEffectTriggerType,
|
|
42270
42384
|
StartEventRoundMatchmaking,
|
|
@@ -42517,9 +42631,13 @@ export {
|
|
|
42517
42631
|
WidgetCategory,
|
|
42518
42632
|
WidgetType,
|
|
42519
42633
|
ZERO_DECIMAL_CURRENCIES,
|
|
42634
|
+
createMapboxSessionToken,
|
|
42520
42635
|
getCurrencySymbol,
|
|
42521
42636
|
isUUID,
|
|
42522
42637
|
isZeroDecimalCurrency,
|
|
42638
|
+
mapFeatureToAddress,
|
|
42639
|
+
mapboxRetrieve,
|
|
42640
|
+
mapboxSuggest,
|
|
42523
42641
|
setFirstPageData,
|
|
42524
42642
|
useAcceptGroupRequest,
|
|
42525
42643
|
useAddAccountFollower,
|
|
@@ -42776,6 +42894,7 @@ export {
|
|
|
42776
42894
|
useDeleteEventFaqSectionTranslation,
|
|
42777
42895
|
useDeleteEventFollowup,
|
|
42778
42896
|
useDeleteEventFollowupTranslation,
|
|
42897
|
+
useDeleteEventLocation,
|
|
42779
42898
|
useDeleteEventMatch,
|
|
42780
42899
|
useDeleteEventMediaItem,
|
|
42781
42900
|
useDeleteEventMediaItemTranslation,
|
|
@@ -43433,7 +43552,6 @@ export {
|
|
|
43433
43552
|
useGetVideoCaptions,
|
|
43434
43553
|
useGetVideoDownloadStatus,
|
|
43435
43554
|
useGetVideos,
|
|
43436
|
-
useImpersonateAccount,
|
|
43437
43555
|
useImportRooms,
|
|
43438
43556
|
useIndexEventPasses,
|
|
43439
43557
|
useInitiateVideoDownload,
|
|
@@ -43539,6 +43657,7 @@ export {
|
|
|
43539
43657
|
useSelfLeaveOrganization,
|
|
43540
43658
|
useSendAnnouncementPreview,
|
|
43541
43659
|
useSendInvoice,
|
|
43660
|
+
useSetEventLocation,
|
|
43542
43661
|
useStartEventRoundMatchmaking,
|
|
43543
43662
|
useStartEventSessionRoundMatchmaking,
|
|
43544
43663
|
useSwitchImage,
|