@connectedxm/admin 7.8.0 → 7.8.1
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 +2 -97
- package/dist/index.d.cts +8 -37
- package/dist/index.d.ts +8 -37
- package/dist/index.js +2 -93
- package/openapi.json +29 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -846,93 +846,6 @@ 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
|
-
|
|
936
849
|
// src/utilities/MergeInfinitePages.ts
|
|
937
850
|
function MergeInfinitePages(data) {
|
|
938
851
|
return data.pages.reduce(
|
|
@@ -1129,11 +1042,11 @@ var useConnectedInfiniteQuery = (queryKeys, queryFn, params = {}, options = {
|
|
|
1129
1042
|
};
|
|
1130
1043
|
|
|
1131
1044
|
// src/AdminAPI.ts
|
|
1132
|
-
import
|
|
1045
|
+
import axios2 from "axios";
|
|
1133
1046
|
var GetAdminAPI = async (params) => {
|
|
1134
1047
|
const token = !!params.getToken && await params.getToken();
|
|
1135
1048
|
const executeAs = params.getExecuteAs ? await params.getExecuteAs() : void 0;
|
|
1136
|
-
return
|
|
1049
|
+
return axios2.create({
|
|
1137
1050
|
baseURL: params.apiUrl,
|
|
1138
1051
|
headers: {
|
|
1139
1052
|
organization: params.organizationId,
|
|
@@ -42631,13 +42544,9 @@ export {
|
|
|
42631
42544
|
WidgetCategory,
|
|
42632
42545
|
WidgetType,
|
|
42633
42546
|
ZERO_DECIMAL_CURRENCIES,
|
|
42634
|
-
createMapboxSessionToken,
|
|
42635
42547
|
getCurrencySymbol,
|
|
42636
42548
|
isUUID,
|
|
42637
42549
|
isZeroDecimalCurrency,
|
|
42638
|
-
mapFeatureToAddress,
|
|
42639
|
-
mapboxRetrieve,
|
|
42640
|
-
mapboxSuggest,
|
|
42641
42550
|
setFirstPageData,
|
|
42642
42551
|
useAcceptGroupRequest,
|
|
42643
42552
|
useAddAccountFollower,
|
package/openapi.json
CHANGED
|
@@ -103910,6 +103910,10 @@
|
|
|
103910
103910
|
"name": {
|
|
103911
103911
|
"type": "string"
|
|
103912
103912
|
},
|
|
103913
|
+
"room": {
|
|
103914
|
+
"type": "string",
|
|
103915
|
+
"nullable": true
|
|
103916
|
+
},
|
|
103913
103917
|
"address1": {
|
|
103914
103918
|
"type": "string",
|
|
103915
103919
|
"nullable": true
|
|
@@ -103950,6 +103954,7 @@
|
|
|
103950
103954
|
"required": [
|
|
103951
103955
|
"id",
|
|
103952
103956
|
"name",
|
|
103957
|
+
"room",
|
|
103953
103958
|
"address1",
|
|
103954
103959
|
"address2",
|
|
103955
103960
|
"zip",
|
|
@@ -116953,6 +116958,10 @@
|
|
|
116953
116958
|
"name": {
|
|
116954
116959
|
"type": "string"
|
|
116955
116960
|
},
|
|
116961
|
+
"room": {
|
|
116962
|
+
"type": "string",
|
|
116963
|
+
"nullable": true
|
|
116964
|
+
},
|
|
116956
116965
|
"description": {
|
|
116957
116966
|
"type": "string",
|
|
116958
116967
|
"nullable": true
|
|
@@ -116984,6 +116993,14 @@
|
|
|
116984
116993
|
"zip": {
|
|
116985
116994
|
"type": "string",
|
|
116986
116995
|
"nullable": true
|
|
116996
|
+
},
|
|
116997
|
+
"latitude": {
|
|
116998
|
+
"type": "number",
|
|
116999
|
+
"nullable": true
|
|
117000
|
+
},
|
|
117001
|
+
"longitude": {
|
|
117002
|
+
"type": "number",
|
|
117003
|
+
"nullable": true
|
|
116987
117004
|
}
|
|
116988
117005
|
},
|
|
116989
117006
|
"required": [
|
|
@@ -117013,6 +117030,10 @@
|
|
|
117013
117030
|
"name": {
|
|
117014
117031
|
"type": "string"
|
|
117015
117032
|
},
|
|
117033
|
+
"room": {
|
|
117034
|
+
"type": "string",
|
|
117035
|
+
"nullable": true
|
|
117036
|
+
},
|
|
117016
117037
|
"description": {
|
|
117017
117038
|
"type": "string",
|
|
117018
117039
|
"nullable": true
|
|
@@ -117044,6 +117065,14 @@
|
|
|
117044
117065
|
"zip": {
|
|
117045
117066
|
"type": "string",
|
|
117046
117067
|
"nullable": true
|
|
117068
|
+
},
|
|
117069
|
+
"latitude": {
|
|
117070
|
+
"type": "number",
|
|
117071
|
+
"nullable": true
|
|
117072
|
+
},
|
|
117073
|
+
"longitude": {
|
|
117074
|
+
"type": "number",
|
|
117075
|
+
"nullable": true
|
|
117047
117076
|
}
|
|
117048
117077
|
}
|
|
117049
117078
|
},
|