@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 CHANGED
@@ -2386,13 +2386,9 @@ __export(index_exports, {
2386
2386
  WidgetCategory: () => WidgetCategory,
2387
2387
  WidgetType: () => WidgetType,
2388
2388
  ZERO_DECIMAL_CURRENCIES: () => ZERO_DECIMAL_CURRENCIES,
2389
- createMapboxSessionToken: () => createMapboxSessionToken,
2390
2389
  getCurrencySymbol: () => getCurrencySymbol,
2391
2390
  isUUID: () => isUUID,
2392
2391
  isZeroDecimalCurrency: () => isZeroDecimalCurrency,
2393
- mapFeatureToAddress: () => mapFeatureToAddress,
2394
- mapboxRetrieve: () => mapboxRetrieve,
2395
- mapboxSuggest: () => mapboxSuggest,
2396
2392
  setFirstPageData: () => setFirstPageData,
2397
2393
  useAcceptGroupRequest: () => useAcceptGroupRequest,
2398
2394
  useAddAccountFollower: () => useAddAccountFollower,
@@ -4463,93 +4459,6 @@ var isUUID = (id) => {
4463
4459
  return uuidRegex.test(id);
4464
4460
  };
4465
4461
 
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
-
4553
4462
  // src/utilities/MergeInfinitePages.ts
4554
4463
  function MergeInfinitePages(data) {
4555
4464
  return data.pages.reduce(
@@ -4744,11 +4653,11 @@ var useConnectedInfiniteQuery = (queryKeys, queryFn, params = {}, options = {
4744
4653
  };
4745
4654
 
4746
4655
  // src/AdminAPI.ts
4747
- var import_axios3 = __toESM(require("axios"), 1);
4656
+ var import_axios2 = __toESM(require("axios"), 1);
4748
4657
  var GetAdminAPI = async (params) => {
4749
4658
  const token = !!params.getToken && await params.getToken();
4750
4659
  const executeAs = params.getExecuteAs ? await params.getExecuteAs() : void 0;
4751
- return import_axios3.default.create({
4660
+ return import_axios2.default.create({
4752
4661
  baseURL: params.apiUrl,
4753
4662
  headers: {
4754
4663
  organization: params.organizationId,
@@ -46242,13 +46151,9 @@ var useUpdateTier = (options = {}) => {
46242
46151
  WidgetCategory,
46243
46152
  WidgetType,
46244
46153
  ZERO_DECIMAL_CURRENCIES,
46245
- createMapboxSessionToken,
46246
46154
  getCurrencySymbol,
46247
46155
  isUUID,
46248
46156
  isZeroDecimalCurrency,
46249
- mapFeatureToAddress,
46250
- mapboxRetrieve,
46251
- mapboxSuggest,
46252
46157
  setFirstPageData,
46253
46158
  useAcceptGroupRequest,
46254
46159
  useAddAccountFollower,