@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 CHANGED
@@ -410,6 +410,7 @@ __export(index_exports, {
410
410
  DeleteEventFaqSectionTranslation: () => DeleteEventFaqSectionTranslation,
411
411
  DeleteEventFollowup: () => DeleteEventFollowup,
412
412
  DeleteEventFollowupTranslation: () => DeleteEventFollowupTranslation,
413
+ DeleteEventLocation: () => DeleteEventLocation,
413
414
  DeleteEventMatch: () => DeleteEventMatch,
414
415
  DeleteEventMediaItem: () => DeleteEventMediaItem,
415
416
  DeleteEventMediaItemTranslation: () => DeleteEventMediaItemTranslation,
@@ -1355,7 +1356,6 @@ __export(index_exports, {
1355
1356
  INVOICE_QUERY_KEY: () => INVOICE_QUERY_KEY,
1356
1357
  ImageModerationLevel: () => ImageModerationLevel,
1357
1358
  ImageType: () => ImageType,
1358
- ImpersonateAccount: () => ImpersonateAccount,
1359
1359
  ImportItemStatus: () => ImportItemStatus,
1360
1360
  ImportRooms: () => ImportRooms,
1361
1361
  ImportType: () => ImportType,
@@ -2133,6 +2133,7 @@ __export(index_exports, {
2133
2133
  SendAnnouncementPreview: () => SendAnnouncementPreview,
2134
2134
  SendInvoice: () => SendInvoice,
2135
2135
  SeriesQuestionType: () => SeriesQuestionType,
2136
+ SetEventLocation: () => SetEventLocation,
2136
2137
  SideEffectActionType: () => SideEffectActionType,
2137
2138
  SideEffectTriggerType: () => SideEffectTriggerType,
2138
2139
  StartEventRoundMatchmaking: () => StartEventRoundMatchmaking,
@@ -2385,9 +2386,13 @@ __export(index_exports, {
2385
2386
  WidgetCategory: () => WidgetCategory,
2386
2387
  WidgetType: () => WidgetType,
2387
2388
  ZERO_DECIMAL_CURRENCIES: () => ZERO_DECIMAL_CURRENCIES,
2389
+ createMapboxSessionToken: () => createMapboxSessionToken,
2388
2390
  getCurrencySymbol: () => getCurrencySymbol,
2389
2391
  isUUID: () => isUUID,
2390
2392
  isZeroDecimalCurrency: () => isZeroDecimalCurrency,
2393
+ mapFeatureToAddress: () => mapFeatureToAddress,
2394
+ mapboxRetrieve: () => mapboxRetrieve,
2395
+ mapboxSuggest: () => mapboxSuggest,
2391
2396
  setFirstPageData: () => setFirstPageData,
2392
2397
  useAcceptGroupRequest: () => useAcceptGroupRequest,
2393
2398
  useAddAccountFollower: () => useAddAccountFollower,
@@ -2644,6 +2649,7 @@ __export(index_exports, {
2644
2649
  useDeleteEventFaqSectionTranslation: () => useDeleteEventFaqSectionTranslation,
2645
2650
  useDeleteEventFollowup: () => useDeleteEventFollowup,
2646
2651
  useDeleteEventFollowupTranslation: () => useDeleteEventFollowupTranslation,
2652
+ useDeleteEventLocation: () => useDeleteEventLocation,
2647
2653
  useDeleteEventMatch: () => useDeleteEventMatch,
2648
2654
  useDeleteEventMediaItem: () => useDeleteEventMediaItem,
2649
2655
  useDeleteEventMediaItemTranslation: () => useDeleteEventMediaItemTranslation,
@@ -3301,7 +3307,6 @@ __export(index_exports, {
3301
3307
  useGetVideoCaptions: () => useGetVideoCaptions,
3302
3308
  useGetVideoDownloadStatus: () => useGetVideoDownloadStatus,
3303
3309
  useGetVideos: () => useGetVideos,
3304
- useImpersonateAccount: () => useImpersonateAccount,
3305
3310
  useImportRooms: () => useImportRooms,
3306
3311
  useIndexEventPasses: () => useIndexEventPasses,
3307
3312
  useInitiateVideoDownload: () => useInitiateVideoDownload,
@@ -3407,6 +3412,7 @@ __export(index_exports, {
3407
3412
  useSelfLeaveOrganization: () => useSelfLeaveOrganization,
3408
3413
  useSendAnnouncementPreview: () => useSendAnnouncementPreview,
3409
3414
  useSendInvoice: () => useSendInvoice,
3415
+ useSetEventLocation: () => useSetEventLocation,
3410
3416
  useStartEventRoundMatchmaking: () => useStartEventRoundMatchmaking,
3411
3417
  useStartEventSessionRoundMatchmaking: () => useStartEventSessionRoundMatchmaking,
3412
3418
  useSwitchImage: () => useSwitchImage,
@@ -4457,6 +4463,93 @@ var isUUID = (id) => {
4457
4463
  return uuidRegex.test(id);
4458
4464
  };
4459
4465
 
4466
+ // src/utilities/MapboxSearch.ts
4467
+ var import_axios2 = __toESM(require("axios"), 1);
4468
+ var SUGGEST_URL = "https://api.mapbox.com/search/searchbox/v1/suggest";
4469
+ var RETRIEVE_URL = "https://api.mapbox.com/search/searchbox/v1/retrieve";
4470
+ var REQUEST_TIMEOUT_MS = 1e4;
4471
+ var createMapboxSessionToken = () => {
4472
+ try {
4473
+ if (typeof globalThis.crypto !== "undefined" && typeof globalThis.crypto.randomUUID === "function") {
4474
+ return globalThis.crypto.randomUUID();
4475
+ }
4476
+ } catch {
4477
+ }
4478
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
4479
+ const r = Math.random() * 16 | 0;
4480
+ const v = c === "x" ? r : r & 3 | 8;
4481
+ return v.toString(16);
4482
+ });
4483
+ };
4484
+ var mapFeatureToAddress = (feature) => {
4485
+ const p = feature?.properties ?? {};
4486
+ const ctx = p.context ?? {};
4487
+ const geo = feature?.geometry?.coordinates ?? [];
4488
+ const coords = p.coordinates ?? { longitude: geo[0], latitude: geo[1] };
4489
+ const isPoi = p.feature_type === "poi";
4490
+ return {
4491
+ venue: isPoi ? p.name || null : null,
4492
+ address1: ctx.address?.name || (isPoi ? null : p.name) || null,
4493
+ address2: null,
4494
+ city: ctx.place?.name || null,
4495
+ state: ctx.region?.region_code || ctx.region?.name || null,
4496
+ country: ctx.country?.country_code || null,
4497
+ zip: ctx.postcode?.name || null,
4498
+ latitude: typeof coords.latitude === "number" ? coords.latitude : null,
4499
+ longitude: typeof coords.longitude === "number" ? coords.longitude : null,
4500
+ fullAddress: p.full_address ?? null
4501
+ };
4502
+ };
4503
+ var mapboxSuggest = async (query, {
4504
+ accessToken,
4505
+ sessionToken,
4506
+ country,
4507
+ limit = 6,
4508
+ language = "en"
4509
+ }) => {
4510
+ if (!accessToken || !query || query.trim().length < 2) return [];
4511
+ try {
4512
+ const { data } = await import_axios2.default.get(SUGGEST_URL, {
4513
+ params: {
4514
+ q: query,
4515
+ access_token: accessToken,
4516
+ session_token: sessionToken,
4517
+ language,
4518
+ limit,
4519
+ ...country ? { country } : {}
4520
+ },
4521
+ timeout: REQUEST_TIMEOUT_MS
4522
+ });
4523
+ const suggestions = data?.suggestions ?? [];
4524
+ return suggestions.map((s) => ({
4525
+ mapboxId: s.mapbox_id,
4526
+ name: s.name,
4527
+ fullAddress: s.full_address ?? null,
4528
+ placeFormatted: s.place_formatted ?? null,
4529
+ featureType: s.feature_type ?? ""
4530
+ }));
4531
+ } catch {
4532
+ return [];
4533
+ }
4534
+ };
4535
+ var mapboxRetrieve = async (mapboxId, { accessToken, sessionToken }) => {
4536
+ if (!accessToken || !mapboxId) return null;
4537
+ try {
4538
+ const { data } = await import_axios2.default.get(
4539
+ `${RETRIEVE_URL}/${encodeURIComponent(mapboxId)}`,
4540
+ {
4541
+ params: { access_token: accessToken, session_token: sessionToken },
4542
+ timeout: REQUEST_TIMEOUT_MS
4543
+ }
4544
+ );
4545
+ const feature = data?.features?.[0];
4546
+ if (!feature) return null;
4547
+ return mapFeatureToAddress(feature);
4548
+ } catch {
4549
+ return null;
4550
+ }
4551
+ };
4552
+
4460
4553
  // src/utilities/MergeInfinitePages.ts
4461
4554
  function MergeInfinitePages(data) {
4462
4555
  return data.pages.reduce(
@@ -4651,11 +4744,11 @@ var useConnectedInfiniteQuery = (queryKeys, queryFn, params = {}, options = {
4651
4744
  };
4652
4745
 
4653
4746
  // src/AdminAPI.ts
4654
- var import_axios2 = __toESM(require("axios"), 1);
4747
+ var import_axios3 = __toESM(require("axios"), 1);
4655
4748
  var GetAdminAPI = async (params) => {
4656
4749
  const token = !!params.getToken && await params.getToken();
4657
4750
  const executeAs = params.getExecuteAs ? await params.getExecuteAs() : void 0;
4658
- return import_axios2.default.create({
4751
+ return import_axios3.default.create({
4659
4752
  baseURL: params.apiUrl,
4660
4753
  headers: {
4661
4754
  organization: params.organizationId,
@@ -26176,22 +26269,6 @@ var useExportAccount = (options = {}) => {
26176
26269
  return useConnectedMutation(ExportAccount, options);
26177
26270
  };
26178
26271
 
26179
- // src/mutations/accounts/useImpersonateAccount.ts
26180
- var ImpersonateAccount = async ({
26181
- accountId,
26182
- username,
26183
- adminApiParams
26184
- }) => {
26185
- const connectedXM = await GetAdminAPI(adminApiParams);
26186
- const { data } = await connectedXM.post(
26187
- `/accounts/${accountId}/impersonate/${username}`
26188
- );
26189
- return data;
26190
- };
26191
- var useImpersonateAccount = (options = {}) => {
26192
- return useConnectedMutation(ImpersonateAccount, options);
26193
- };
26194
-
26195
26272
  // src/mutations/accounts/useSyncAccount.ts
26196
26273
  var SyncAccount = async ({
26197
26274
  accountId,
@@ -37725,6 +37802,26 @@ var useDeleteEvent = (options = {}) => {
37725
37802
  return useConnectedMutation(DeleteEvent, options);
37726
37803
  };
37727
37804
 
37805
+ // src/mutations/events/useDeleteEventLocation.ts
37806
+ var DeleteEventLocation = async ({
37807
+ eventId,
37808
+ adminApiParams,
37809
+ queryClient
37810
+ }) => {
37811
+ const connectedXM = await GetAdminAPI(adminApiParams);
37812
+ const { data } = await connectedXM.delete(
37813
+ `/events/${eventId}/location`
37814
+ );
37815
+ if (queryClient && data.status === "ok") {
37816
+ queryClient.invalidateQueries({ queryKey: EVENTS_QUERY_KEY() });
37817
+ SET_EVENT_QUERY_DATA(queryClient, [data.data?.id], data);
37818
+ }
37819
+ return data;
37820
+ };
37821
+ var useDeleteEventLocation = (options = {}) => {
37822
+ return useConnectedMutation(DeleteEventLocation, options);
37823
+ };
37824
+
37728
37825
  // src/mutations/events/useDisableEventBuildMode.ts
37729
37826
  var DisableEventBuildMode = async ({
37730
37827
  eventId,
@@ -37759,6 +37856,28 @@ var useEnableEventBuildMode = (options = {}) => {
37759
37856
  return useConnectedMutation(EnableEventBuildMode, options);
37760
37857
  };
37761
37858
 
37859
+ // src/mutations/events/useSetEventLocation.ts
37860
+ var SetEventLocation = async ({
37861
+ eventId,
37862
+ location,
37863
+ adminApiParams,
37864
+ queryClient
37865
+ }) => {
37866
+ const connectedXM = await GetAdminAPI(adminApiParams);
37867
+ const { data } = await connectedXM.put(
37868
+ `/events/${eventId}/location`,
37869
+ location
37870
+ );
37871
+ if (queryClient && data.status === "ok") {
37872
+ queryClient.invalidateQueries({ queryKey: EVENTS_QUERY_KEY() });
37873
+ SET_EVENT_QUERY_DATA(queryClient, [data.data?.id], data);
37874
+ }
37875
+ return data;
37876
+ };
37877
+ var useSetEventLocation = (options = {}) => {
37878
+ return useConnectedMutation(SetEventLocation, options);
37879
+ };
37880
+
37762
37881
  // src/mutations/events/useUpdateEvent.ts
37763
37882
  var UpdateEvent = async ({
37764
37883
  eventId,
@@ -44147,6 +44266,7 @@ var useUpdateTier = (options = {}) => {
44147
44266
  DeleteEventFaqSectionTranslation,
44148
44267
  DeleteEventFollowup,
44149
44268
  DeleteEventFollowupTranslation,
44269
+ DeleteEventLocation,
44150
44270
  DeleteEventMatch,
44151
44271
  DeleteEventMediaItem,
44152
44272
  DeleteEventMediaItemTranslation,
@@ -45092,7 +45212,6 @@ var useUpdateTier = (options = {}) => {
45092
45212
  INVOICE_QUERY_KEY,
45093
45213
  ImageModerationLevel,
45094
45214
  ImageType,
45095
- ImpersonateAccount,
45096
45215
  ImportItemStatus,
45097
45216
  ImportRooms,
45098
45217
  ImportType,
@@ -45870,6 +45989,7 @@ var useUpdateTier = (options = {}) => {
45870
45989
  SendAnnouncementPreview,
45871
45990
  SendInvoice,
45872
45991
  SeriesQuestionType,
45992
+ SetEventLocation,
45873
45993
  SideEffectActionType,
45874
45994
  SideEffectTriggerType,
45875
45995
  StartEventRoundMatchmaking,
@@ -46122,9 +46242,13 @@ var useUpdateTier = (options = {}) => {
46122
46242
  WidgetCategory,
46123
46243
  WidgetType,
46124
46244
  ZERO_DECIMAL_CURRENCIES,
46245
+ createMapboxSessionToken,
46125
46246
  getCurrencySymbol,
46126
46247
  isUUID,
46127
46248
  isZeroDecimalCurrency,
46249
+ mapFeatureToAddress,
46250
+ mapboxRetrieve,
46251
+ mapboxSuggest,
46128
46252
  setFirstPageData,
46129
46253
  useAcceptGroupRequest,
46130
46254
  useAddAccountFollower,
@@ -46381,6 +46505,7 @@ var useUpdateTier = (options = {}) => {
46381
46505
  useDeleteEventFaqSectionTranslation,
46382
46506
  useDeleteEventFollowup,
46383
46507
  useDeleteEventFollowupTranslation,
46508
+ useDeleteEventLocation,
46384
46509
  useDeleteEventMatch,
46385
46510
  useDeleteEventMediaItem,
46386
46511
  useDeleteEventMediaItemTranslation,
@@ -47038,7 +47163,6 @@ var useUpdateTier = (options = {}) => {
47038
47163
  useGetVideoCaptions,
47039
47164
  useGetVideoDownloadStatus,
47040
47165
  useGetVideos,
47041
- useImpersonateAccount,
47042
47166
  useImportRooms,
47043
47167
  useIndexEventPasses,
47044
47168
  useInitiateVideoDownload,
@@ -47144,6 +47268,7 @@ var useUpdateTier = (options = {}) => {
47144
47268
  useSelfLeaveOrganization,
47145
47269
  useSendAnnouncementPreview,
47146
47270
  useSendInvoice,
47271
+ useSetEventLocation,
47147
47272
  useStartEventRoundMatchmaking,
47148
47273
  useStartEventSessionRoundMatchmaking,
47149
47274
  useSwitchImage,