@connectedxm/admin 7.5.1 → 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 -2
- package/dist/index.d.cts +100 -15
- package/dist/index.d.ts +100 -15
- package/dist/index.js +139 -2
- package/openapi.json +207 -56
- package/package.json +1 -1
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,
|
|
@@ -2132,6 +2133,7 @@ __export(index_exports, {
|
|
|
2132
2133
|
SendAnnouncementPreview: () => SendAnnouncementPreview,
|
|
2133
2134
|
SendInvoice: () => SendInvoice,
|
|
2134
2135
|
SeriesQuestionType: () => SeriesQuestionType,
|
|
2136
|
+
SetEventLocation: () => SetEventLocation,
|
|
2135
2137
|
SideEffectActionType: () => SideEffectActionType,
|
|
2136
2138
|
SideEffectTriggerType: () => SideEffectTriggerType,
|
|
2137
2139
|
StartEventRoundMatchmaking: () => StartEventRoundMatchmaking,
|
|
@@ -2384,9 +2386,13 @@ __export(index_exports, {
|
|
|
2384
2386
|
WidgetCategory: () => WidgetCategory,
|
|
2385
2387
|
WidgetType: () => WidgetType,
|
|
2386
2388
|
ZERO_DECIMAL_CURRENCIES: () => ZERO_DECIMAL_CURRENCIES,
|
|
2389
|
+
createMapboxSessionToken: () => createMapboxSessionToken,
|
|
2387
2390
|
getCurrencySymbol: () => getCurrencySymbol,
|
|
2388
2391
|
isUUID: () => isUUID,
|
|
2389
2392
|
isZeroDecimalCurrency: () => isZeroDecimalCurrency,
|
|
2393
|
+
mapFeatureToAddress: () => mapFeatureToAddress,
|
|
2394
|
+
mapboxRetrieve: () => mapboxRetrieve,
|
|
2395
|
+
mapboxSuggest: () => mapboxSuggest,
|
|
2390
2396
|
setFirstPageData: () => setFirstPageData,
|
|
2391
2397
|
useAcceptGroupRequest: () => useAcceptGroupRequest,
|
|
2392
2398
|
useAddAccountFollower: () => useAddAccountFollower,
|
|
@@ -2643,6 +2649,7 @@ __export(index_exports, {
|
|
|
2643
2649
|
useDeleteEventFaqSectionTranslation: () => useDeleteEventFaqSectionTranslation,
|
|
2644
2650
|
useDeleteEventFollowup: () => useDeleteEventFollowup,
|
|
2645
2651
|
useDeleteEventFollowupTranslation: () => useDeleteEventFollowupTranslation,
|
|
2652
|
+
useDeleteEventLocation: () => useDeleteEventLocation,
|
|
2646
2653
|
useDeleteEventMatch: () => useDeleteEventMatch,
|
|
2647
2654
|
useDeleteEventMediaItem: () => useDeleteEventMediaItem,
|
|
2648
2655
|
useDeleteEventMediaItemTranslation: () => useDeleteEventMediaItemTranslation,
|
|
@@ -3405,6 +3412,7 @@ __export(index_exports, {
|
|
|
3405
3412
|
useSelfLeaveOrganization: () => useSelfLeaveOrganization,
|
|
3406
3413
|
useSendAnnouncementPreview: () => useSendAnnouncementPreview,
|
|
3407
3414
|
useSendInvoice: () => useSendInvoice,
|
|
3415
|
+
useSetEventLocation: () => useSetEventLocation,
|
|
3408
3416
|
useStartEventRoundMatchmaking: () => useStartEventRoundMatchmaking,
|
|
3409
3417
|
useStartEventSessionRoundMatchmaking: () => useStartEventSessionRoundMatchmaking,
|
|
3410
3418
|
useSwitchImage: () => useSwitchImage,
|
|
@@ -4455,6 +4463,93 @@ var isUUID = (id) => {
|
|
|
4455
4463
|
return uuidRegex.test(id);
|
|
4456
4464
|
};
|
|
4457
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
|
+
|
|
4458
4553
|
// src/utilities/MergeInfinitePages.ts
|
|
4459
4554
|
function MergeInfinitePages(data) {
|
|
4460
4555
|
return data.pages.reduce(
|
|
@@ -4649,11 +4744,11 @@ var useConnectedInfiniteQuery = (queryKeys, queryFn, params = {}, options = {
|
|
|
4649
4744
|
};
|
|
4650
4745
|
|
|
4651
4746
|
// src/AdminAPI.ts
|
|
4652
|
-
var
|
|
4747
|
+
var import_axios3 = __toESM(require("axios"), 1);
|
|
4653
4748
|
var GetAdminAPI = async (params) => {
|
|
4654
4749
|
const token = !!params.getToken && await params.getToken();
|
|
4655
4750
|
const executeAs = params.getExecuteAs ? await params.getExecuteAs() : void 0;
|
|
4656
|
-
return
|
|
4751
|
+
return import_axios3.default.create({
|
|
4657
4752
|
baseURL: params.apiUrl,
|
|
4658
4753
|
headers: {
|
|
4659
4754
|
organization: params.organizationId,
|
|
@@ -37707,6 +37802,26 @@ var useDeleteEvent = (options = {}) => {
|
|
|
37707
37802
|
return useConnectedMutation(DeleteEvent, options);
|
|
37708
37803
|
};
|
|
37709
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
|
+
|
|
37710
37825
|
// src/mutations/events/useDisableEventBuildMode.ts
|
|
37711
37826
|
var DisableEventBuildMode = async ({
|
|
37712
37827
|
eventId,
|
|
@@ -37741,6 +37856,28 @@ var useEnableEventBuildMode = (options = {}) => {
|
|
|
37741
37856
|
return useConnectedMutation(EnableEventBuildMode, options);
|
|
37742
37857
|
};
|
|
37743
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
|
+
|
|
37744
37881
|
// src/mutations/events/useUpdateEvent.ts
|
|
37745
37882
|
var UpdateEvent = async ({
|
|
37746
37883
|
eventId,
|
|
@@ -44129,6 +44266,7 @@ var useUpdateTier = (options = {}) => {
|
|
|
44129
44266
|
DeleteEventFaqSectionTranslation,
|
|
44130
44267
|
DeleteEventFollowup,
|
|
44131
44268
|
DeleteEventFollowupTranslation,
|
|
44269
|
+
DeleteEventLocation,
|
|
44132
44270
|
DeleteEventMatch,
|
|
44133
44271
|
DeleteEventMediaItem,
|
|
44134
44272
|
DeleteEventMediaItemTranslation,
|
|
@@ -45851,6 +45989,7 @@ var useUpdateTier = (options = {}) => {
|
|
|
45851
45989
|
SendAnnouncementPreview,
|
|
45852
45990
|
SendInvoice,
|
|
45853
45991
|
SeriesQuestionType,
|
|
45992
|
+
SetEventLocation,
|
|
45854
45993
|
SideEffectActionType,
|
|
45855
45994
|
SideEffectTriggerType,
|
|
45856
45995
|
StartEventRoundMatchmaking,
|
|
@@ -46103,9 +46242,13 @@ var useUpdateTier = (options = {}) => {
|
|
|
46103
46242
|
WidgetCategory,
|
|
46104
46243
|
WidgetType,
|
|
46105
46244
|
ZERO_DECIMAL_CURRENCIES,
|
|
46245
|
+
createMapboxSessionToken,
|
|
46106
46246
|
getCurrencySymbol,
|
|
46107
46247
|
isUUID,
|
|
46108
46248
|
isZeroDecimalCurrency,
|
|
46249
|
+
mapFeatureToAddress,
|
|
46250
|
+
mapboxRetrieve,
|
|
46251
|
+
mapboxSuggest,
|
|
46109
46252
|
setFirstPageData,
|
|
46110
46253
|
useAcceptGroupRequest,
|
|
46111
46254
|
useAddAccountFollower,
|
|
@@ -46362,6 +46505,7 @@ var useUpdateTier = (options = {}) => {
|
|
|
46362
46505
|
useDeleteEventFaqSectionTranslation,
|
|
46363
46506
|
useDeleteEventFollowup,
|
|
46364
46507
|
useDeleteEventFollowupTranslation,
|
|
46508
|
+
useDeleteEventLocation,
|
|
46365
46509
|
useDeleteEventMatch,
|
|
46366
46510
|
useDeleteEventMediaItem,
|
|
46367
46511
|
useDeleteEventMediaItemTranslation,
|
|
@@ -47124,6 +47268,7 @@ var useUpdateTier = (options = {}) => {
|
|
|
47124
47268
|
useSelfLeaveOrganization,
|
|
47125
47269
|
useSendAnnouncementPreview,
|
|
47126
47270
|
useSendInvoice,
|
|
47271
|
+
useSetEventLocation,
|
|
47127
47272
|
useStartEventRoundMatchmaking,
|
|
47128
47273
|
useStartEventSessionRoundMatchmaking,
|
|
47129
47274
|
useSwitchImage,
|