venue-js 1.1.1 → 1.2.0-next.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.d.mts +13 -4
- package/dist/index.d.ts +13 -4
- package/dist/index.js +83 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +81 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -658,8 +658,10 @@ type Filter = EqFilter | InFilter;
|
|
|
658
658
|
type Filters = Record<string, Filter>;
|
|
659
659
|
|
|
660
660
|
interface VenueClientOptions {
|
|
661
|
+
mode?: "delivery" | "preview";
|
|
661
662
|
projectId: string;
|
|
662
|
-
apiKey
|
|
663
|
+
apiKey?: string;
|
|
664
|
+
previewToken?: string;
|
|
663
665
|
baseUrl?: string;
|
|
664
666
|
queryClient?: QueryClient;
|
|
665
667
|
}
|
|
@@ -701,8 +703,15 @@ declare const GEOJSON_FEATURE_TYPES: FeatureType[];
|
|
|
701
703
|
declare const ALL_FEATURE_TYPES: FeatureType[];
|
|
702
704
|
declare const defaultFeatureQueryOptionsMap: Record<FeatureType, FeatureQueryOptions>;
|
|
703
705
|
|
|
704
|
-
declare function
|
|
705
|
-
declare
|
|
706
|
+
declare function fetchDeliveryApi<T extends FeatureType = FeatureType>(projectId: string, apiKey: string, featureType: FeatureType, baseUrl?: string): Promise<FeatureResponseMap[T][]>;
|
|
707
|
+
declare function fetchPreviewApi<T extends FeatureType = FeatureType>(projectId: string, previewToken: string, featureType: FeatureType, baseUrl?: string): Promise<FeatureResponseMap[T][]>;
|
|
708
|
+
declare const safeFetchFeature: <T extends FeatureType = FeatureType>(featureType: FeatureType, params: {
|
|
709
|
+
mode: "delivery" | "preview";
|
|
710
|
+
projectId: string;
|
|
711
|
+
apiKey: string;
|
|
712
|
+
previewToken?: string;
|
|
713
|
+
baseUrl: string;
|
|
714
|
+
}) => Promise<FeatureResponseMap[T][]>;
|
|
706
715
|
|
|
707
716
|
declare const getDataClient: (options: VenueClientOptions) => VenueDataClient;
|
|
708
717
|
|
|
@@ -1211,4 +1220,4 @@ declare const VENUE_EVENTS: {
|
|
|
1211
1220
|
VENUE_MOVEINTOVIEW: string;
|
|
1212
1221
|
};
|
|
1213
1222
|
|
|
1214
|
-
export { ALL_FEATURE_TYPES, ALWAYS_VISIBLE_FEATURE_TYPES, type AmenityFeature, type AmenityFeaturePopulated, type AmenityGeometry, type AmenityProperties, type AnchorFeature, type AnchorFeaturePopulated, type AnchorGeometry, type AnchorProperties, BASE_LAYER_NAME, DEFAULT_BASE_URL, DEFAULT_HIGHLIGHT_OPTIONS, DEFAULT_LOCALE, DEFAULT_SET_HIGHLIGHT_2DELEMENT_IDS_OPTIONS, DESTINATION_MARKER_ID, type DetailFeature, type DetailGeometry, type DetailProperties, type ElementFeature, type ElementGeometry, type ElementProperties, type EventFeature, type EventGeometry, type EventProperties, type FeaturePopulatedResponseMap, type FeatureQueryOptions, type FeatureResponseMap, type FeatureType, type FilterParams, type FindParams, type FixtureFeature, type FixtureFeaturePopulated, type FixtureGeometry, type FixtureProperties, GEOJSON_FEATURE_TYPES, HIGHLIGHT_LAYER_NAME, IMDF_FEATURE_TYPES, type Id, type ImdfFeature, IndoorMap, type InternalFilterByType, type InternalFindById, type KioskFeature, type KioskFeaturePopulated, type KioskGeometry, type KioskProperties, LAST_USER_LOCATION_ELEMENT_ID_PREFIX, LAYERS, LAYER_FEATURE_TYPE_OBJ, LAYER_OPTIONS, LOCALE_SYMBOL_KEY, type LabelFeature, type LabelGeometry, type LabelProperties, type LevelFeature, type LevelFeaturePopulated, type LevelGeometry, type LevelProperties, MARKER_LAYER_NAME, type Media, type MediaFile, type Model3d, NONIMDF_FEATURE_TYPES, ORIGIN_MARKER_ID, type OccupantFeature, type OccupantFeaturePopulated, type OccupantGeometry, type OccupantProperties, type OpeningFeature, type OpeningFeaturePopulated, type OpeningGeometry, type OpeningProperties, POI_MARKER_LAYER_NAME, type Page, type PolygonalFeature, type PopulatableFeatureType, type PopulatedParams, type PrivilegeFeature, type PrivilegeGeometry, type PrivilegeProperties, type PromotionFeature, type PromotionProperties, type RelationshipFeature, type RelationshipGeometry, type RelationshipProperties, type SectionFeature, type SectionFeaturePopulated, type SectionGeometry, type SectionProperties, type SponsoredContentFeature, type SponsoredContentLegacyType, type SponsoredContentPlacementType, type SponsoredContentStrapiV4ApiResponse, type TaxonomyFeature, type TaxonomyFeaturePopulated, type TaxonomyGeometry, type TaxonomyProperties, USER_LOCATION_ELEMENT_ID, USER_LOCATION_LAYER_NAME, type UnitFeature, type UnitFeaturePopulated, type UnitGeometry, type UnitProperties, VENUE_EVENTS, type VenueClientOptions, type VenueDataClient, type VenueFeature, type VenueFeaturePopulated, type VenueGeometry, type VenueProperties, createPolygonFromLineString, createSpriteMaterialByLabelSymbol, createStyledUIMarkerElement, defaultFeatureQueryOptionsMap,
|
|
1223
|
+
export { ALL_FEATURE_TYPES, ALWAYS_VISIBLE_FEATURE_TYPES, type AmenityFeature, type AmenityFeaturePopulated, type AmenityGeometry, type AmenityProperties, type AnchorFeature, type AnchorFeaturePopulated, type AnchorGeometry, type AnchorProperties, BASE_LAYER_NAME, DEFAULT_BASE_URL, DEFAULT_HIGHLIGHT_OPTIONS, DEFAULT_LOCALE, DEFAULT_SET_HIGHLIGHT_2DELEMENT_IDS_OPTIONS, DESTINATION_MARKER_ID, type DetailFeature, type DetailGeometry, type DetailProperties, type ElementFeature, type ElementGeometry, type ElementProperties, type EventFeature, type EventGeometry, type EventProperties, type FeaturePopulatedResponseMap, type FeatureQueryOptions, type FeatureResponseMap, type FeatureType, type FilterParams, type FindParams, type FixtureFeature, type FixtureFeaturePopulated, type FixtureGeometry, type FixtureProperties, GEOJSON_FEATURE_TYPES, HIGHLIGHT_LAYER_NAME, IMDF_FEATURE_TYPES, type Id, type ImdfFeature, IndoorMap, type InternalFilterByType, type InternalFindById, type KioskFeature, type KioskFeaturePopulated, type KioskGeometry, type KioskProperties, LAST_USER_LOCATION_ELEMENT_ID_PREFIX, LAYERS, LAYER_FEATURE_TYPE_OBJ, LAYER_OPTIONS, LOCALE_SYMBOL_KEY, type LabelFeature, type LabelGeometry, type LabelProperties, type LevelFeature, type LevelFeaturePopulated, type LevelGeometry, type LevelProperties, MARKER_LAYER_NAME, type Media, type MediaFile, type Model3d, NONIMDF_FEATURE_TYPES, ORIGIN_MARKER_ID, type OccupantFeature, type OccupantFeaturePopulated, type OccupantGeometry, type OccupantProperties, type OpeningFeature, type OpeningFeaturePopulated, type OpeningGeometry, type OpeningProperties, POI_MARKER_LAYER_NAME, type Page, type PolygonalFeature, type PopulatableFeatureType, type PopulatedParams, type PrivilegeFeature, type PrivilegeGeometry, type PrivilegeProperties, type PromotionFeature, type PromotionProperties, type RelationshipFeature, type RelationshipGeometry, type RelationshipProperties, type SectionFeature, type SectionFeaturePopulated, type SectionGeometry, type SectionProperties, type SponsoredContentFeature, type SponsoredContentLegacyType, type SponsoredContentPlacementType, type SponsoredContentStrapiV4ApiResponse, type TaxonomyFeature, type TaxonomyFeaturePopulated, type TaxonomyGeometry, type TaxonomyProperties, USER_LOCATION_ELEMENT_ID, USER_LOCATION_LAYER_NAME, type UnitFeature, type UnitFeaturePopulated, type UnitGeometry, type UnitProperties, VENUE_EVENTS, type VenueClientOptions, type VenueDataClient, type VenueFeature, type VenueFeaturePopulated, type VenueGeometry, type VenueProperties, createPolygonFromLineString, createSpriteMaterialByLabelSymbol, createStyledUIMarkerElement, defaultFeatureQueryOptionsMap, fetchDeliveryApi, fetchPreviewApi, getBearingBetweenPoints, getCenterFromGeometry, getDataClient, getExtrudeConfigByFeature, getFeatureByLocationId, getLocationByAmenity, getLocationByFeature, getLocationByOccupant, getLocationIdByFeature, getOrdinalByLocationId, getRelatedLocationIdsByFeature, getRelatedLocationsByAmenity, getRelatedLocationsByFeature, getRelatedLocationsByOccupant, getSuitablyValueBetweenBearings, isClickableFeature, safeFetchFeature, styledFeatureGenerator };
|
package/dist/index.d.ts
CHANGED
|
@@ -658,8 +658,10 @@ type Filter = EqFilter | InFilter;
|
|
|
658
658
|
type Filters = Record<string, Filter>;
|
|
659
659
|
|
|
660
660
|
interface VenueClientOptions {
|
|
661
|
+
mode?: "delivery" | "preview";
|
|
661
662
|
projectId: string;
|
|
662
|
-
apiKey
|
|
663
|
+
apiKey?: string;
|
|
664
|
+
previewToken?: string;
|
|
663
665
|
baseUrl?: string;
|
|
664
666
|
queryClient?: QueryClient;
|
|
665
667
|
}
|
|
@@ -701,8 +703,15 @@ declare const GEOJSON_FEATURE_TYPES: FeatureType[];
|
|
|
701
703
|
declare const ALL_FEATURE_TYPES: FeatureType[];
|
|
702
704
|
declare const defaultFeatureQueryOptionsMap: Record<FeatureType, FeatureQueryOptions>;
|
|
703
705
|
|
|
704
|
-
declare function
|
|
705
|
-
declare
|
|
706
|
+
declare function fetchDeliveryApi<T extends FeatureType = FeatureType>(projectId: string, apiKey: string, featureType: FeatureType, baseUrl?: string): Promise<FeatureResponseMap[T][]>;
|
|
707
|
+
declare function fetchPreviewApi<T extends FeatureType = FeatureType>(projectId: string, previewToken: string, featureType: FeatureType, baseUrl?: string): Promise<FeatureResponseMap[T][]>;
|
|
708
|
+
declare const safeFetchFeature: <T extends FeatureType = FeatureType>(featureType: FeatureType, params: {
|
|
709
|
+
mode: "delivery" | "preview";
|
|
710
|
+
projectId: string;
|
|
711
|
+
apiKey: string;
|
|
712
|
+
previewToken?: string;
|
|
713
|
+
baseUrl: string;
|
|
714
|
+
}) => Promise<FeatureResponseMap[T][]>;
|
|
706
715
|
|
|
707
716
|
declare const getDataClient: (options: VenueClientOptions) => VenueDataClient;
|
|
708
717
|
|
|
@@ -1211,4 +1220,4 @@ declare const VENUE_EVENTS: {
|
|
|
1211
1220
|
VENUE_MOVEINTOVIEW: string;
|
|
1212
1221
|
};
|
|
1213
1222
|
|
|
1214
|
-
export { ALL_FEATURE_TYPES, ALWAYS_VISIBLE_FEATURE_TYPES, type AmenityFeature, type AmenityFeaturePopulated, type AmenityGeometry, type AmenityProperties, type AnchorFeature, type AnchorFeaturePopulated, type AnchorGeometry, type AnchorProperties, BASE_LAYER_NAME, DEFAULT_BASE_URL, DEFAULT_HIGHLIGHT_OPTIONS, DEFAULT_LOCALE, DEFAULT_SET_HIGHLIGHT_2DELEMENT_IDS_OPTIONS, DESTINATION_MARKER_ID, type DetailFeature, type DetailGeometry, type DetailProperties, type ElementFeature, type ElementGeometry, type ElementProperties, type EventFeature, type EventGeometry, type EventProperties, type FeaturePopulatedResponseMap, type FeatureQueryOptions, type FeatureResponseMap, type FeatureType, type FilterParams, type FindParams, type FixtureFeature, type FixtureFeaturePopulated, type FixtureGeometry, type FixtureProperties, GEOJSON_FEATURE_TYPES, HIGHLIGHT_LAYER_NAME, IMDF_FEATURE_TYPES, type Id, type ImdfFeature, IndoorMap, type InternalFilterByType, type InternalFindById, type KioskFeature, type KioskFeaturePopulated, type KioskGeometry, type KioskProperties, LAST_USER_LOCATION_ELEMENT_ID_PREFIX, LAYERS, LAYER_FEATURE_TYPE_OBJ, LAYER_OPTIONS, LOCALE_SYMBOL_KEY, type LabelFeature, type LabelGeometry, type LabelProperties, type LevelFeature, type LevelFeaturePopulated, type LevelGeometry, type LevelProperties, MARKER_LAYER_NAME, type Media, type MediaFile, type Model3d, NONIMDF_FEATURE_TYPES, ORIGIN_MARKER_ID, type OccupantFeature, type OccupantFeaturePopulated, type OccupantGeometry, type OccupantProperties, type OpeningFeature, type OpeningFeaturePopulated, type OpeningGeometry, type OpeningProperties, POI_MARKER_LAYER_NAME, type Page, type PolygonalFeature, type PopulatableFeatureType, type PopulatedParams, type PrivilegeFeature, type PrivilegeGeometry, type PrivilegeProperties, type PromotionFeature, type PromotionProperties, type RelationshipFeature, type RelationshipGeometry, type RelationshipProperties, type SectionFeature, type SectionFeaturePopulated, type SectionGeometry, type SectionProperties, type SponsoredContentFeature, type SponsoredContentLegacyType, type SponsoredContentPlacementType, type SponsoredContentStrapiV4ApiResponse, type TaxonomyFeature, type TaxonomyFeaturePopulated, type TaxonomyGeometry, type TaxonomyProperties, USER_LOCATION_ELEMENT_ID, USER_LOCATION_LAYER_NAME, type UnitFeature, type UnitFeaturePopulated, type UnitGeometry, type UnitProperties, VENUE_EVENTS, type VenueClientOptions, type VenueDataClient, type VenueFeature, type VenueFeaturePopulated, type VenueGeometry, type VenueProperties, createPolygonFromLineString, createSpriteMaterialByLabelSymbol, createStyledUIMarkerElement, defaultFeatureQueryOptionsMap,
|
|
1223
|
+
export { ALL_FEATURE_TYPES, ALWAYS_VISIBLE_FEATURE_TYPES, type AmenityFeature, type AmenityFeaturePopulated, type AmenityGeometry, type AmenityProperties, type AnchorFeature, type AnchorFeaturePopulated, type AnchorGeometry, type AnchorProperties, BASE_LAYER_NAME, DEFAULT_BASE_URL, DEFAULT_HIGHLIGHT_OPTIONS, DEFAULT_LOCALE, DEFAULT_SET_HIGHLIGHT_2DELEMENT_IDS_OPTIONS, DESTINATION_MARKER_ID, type DetailFeature, type DetailGeometry, type DetailProperties, type ElementFeature, type ElementGeometry, type ElementProperties, type EventFeature, type EventGeometry, type EventProperties, type FeaturePopulatedResponseMap, type FeatureQueryOptions, type FeatureResponseMap, type FeatureType, type FilterParams, type FindParams, type FixtureFeature, type FixtureFeaturePopulated, type FixtureGeometry, type FixtureProperties, GEOJSON_FEATURE_TYPES, HIGHLIGHT_LAYER_NAME, IMDF_FEATURE_TYPES, type Id, type ImdfFeature, IndoorMap, type InternalFilterByType, type InternalFindById, type KioskFeature, type KioskFeaturePopulated, type KioskGeometry, type KioskProperties, LAST_USER_LOCATION_ELEMENT_ID_PREFIX, LAYERS, LAYER_FEATURE_TYPE_OBJ, LAYER_OPTIONS, LOCALE_SYMBOL_KEY, type LabelFeature, type LabelGeometry, type LabelProperties, type LevelFeature, type LevelFeaturePopulated, type LevelGeometry, type LevelProperties, MARKER_LAYER_NAME, type Media, type MediaFile, type Model3d, NONIMDF_FEATURE_TYPES, ORIGIN_MARKER_ID, type OccupantFeature, type OccupantFeaturePopulated, type OccupantGeometry, type OccupantProperties, type OpeningFeature, type OpeningFeaturePopulated, type OpeningGeometry, type OpeningProperties, POI_MARKER_LAYER_NAME, type Page, type PolygonalFeature, type PopulatableFeatureType, type PopulatedParams, type PrivilegeFeature, type PrivilegeGeometry, type PrivilegeProperties, type PromotionFeature, type PromotionProperties, type RelationshipFeature, type RelationshipGeometry, type RelationshipProperties, type SectionFeature, type SectionFeaturePopulated, type SectionGeometry, type SectionProperties, type SponsoredContentFeature, type SponsoredContentLegacyType, type SponsoredContentPlacementType, type SponsoredContentStrapiV4ApiResponse, type TaxonomyFeature, type TaxonomyFeaturePopulated, type TaxonomyGeometry, type TaxonomyProperties, USER_LOCATION_ELEMENT_ID, USER_LOCATION_LAYER_NAME, type UnitFeature, type UnitFeaturePopulated, type UnitGeometry, type UnitProperties, VENUE_EVENTS, type VenueClientOptions, type VenueDataClient, type VenueFeature, type VenueFeaturePopulated, type VenueGeometry, type VenueProperties, createPolygonFromLineString, createSpriteMaterialByLabelSymbol, createStyledUIMarkerElement, defaultFeatureQueryOptionsMap, fetchDeliveryApi, fetchPreviewApi, getBearingBetweenPoints, getCenterFromGeometry, getDataClient, getExtrudeConfigByFeature, getFeatureByLocationId, getLocationByAmenity, getLocationByFeature, getLocationByOccupant, getLocationIdByFeature, getOrdinalByLocationId, getRelatedLocationIdsByFeature, getRelatedLocationsByAmenity, getRelatedLocationsByFeature, getRelatedLocationsByOccupant, getSuitablyValueBetweenBearings, isClickableFeature, safeFetchFeature, styledFeatureGenerator };
|
package/dist/index.js
CHANGED
|
@@ -58,7 +58,8 @@ __export(index_exports, {
|
|
|
58
58
|
createSpriteMaterialByLabelSymbol: () => createSpriteMaterialByLabelSymbol,
|
|
59
59
|
createStyledUIMarkerElement: () => createStyledUIMarkerElement,
|
|
60
60
|
defaultFeatureQueryOptionsMap: () => defaultFeatureQueryOptionsMap,
|
|
61
|
-
|
|
61
|
+
fetchDeliveryApi: () => fetchDeliveryApi,
|
|
62
|
+
fetchPreviewApi: () => fetchPreviewApi,
|
|
62
63
|
getBearingBetweenPoints: () => getBearingBetweenPoints,
|
|
63
64
|
getCenterFromGeometry: () => getCenterFromGeometry,
|
|
64
65
|
getDataClient: () => getDataClient,
|
|
@@ -161,7 +162,7 @@ var defaultFeatureQueryOptionsMap = {
|
|
|
161
162
|
};
|
|
162
163
|
|
|
163
164
|
// src/data/api/delivery-project.ts
|
|
164
|
-
async function
|
|
165
|
+
async function fetchDeliveryApi(projectId, apiKey, featureType, baseUrl = DEFAULT_BASE_URL) {
|
|
165
166
|
switch (featureType) {
|
|
166
167
|
case "label":
|
|
167
168
|
case "element": {
|
|
@@ -195,14 +196,78 @@ async function fetchFeature(projectId, apiKey, featureType, baseUrl = DEFAULT_BA
|
|
|
195
196
|
}
|
|
196
197
|
}
|
|
197
198
|
}
|
|
198
|
-
|
|
199
|
+
async function fetchPreviewApi(projectId, previewToken, featureType, baseUrl = DEFAULT_BASE_URL) {
|
|
200
|
+
switch (featureType) {
|
|
201
|
+
case "label":
|
|
202
|
+
case "element": {
|
|
203
|
+
const pluralFeatureType = `${featureType}s`;
|
|
204
|
+
const res = await fetch(
|
|
205
|
+
`${baseUrl}/preview/projects/${projectId}/${pluralFeatureType}.geojson`,
|
|
206
|
+
{
|
|
207
|
+
headers: {
|
|
208
|
+
Authorization: `Bearer ${previewToken}`
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
);
|
|
212
|
+
if (res.status !== 200) return [];
|
|
213
|
+
const items = await res.json();
|
|
214
|
+
return items;
|
|
215
|
+
}
|
|
216
|
+
case "sponsored-content": {
|
|
217
|
+
const res = await fetch(
|
|
218
|
+
`${baseUrl}/preview/projects/${projectId}/sponsored-content.json`,
|
|
219
|
+
{
|
|
220
|
+
headers: {
|
|
221
|
+
Authorization: `Bearer ${previewToken}`
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
);
|
|
225
|
+
if (res.status !== 200) return [];
|
|
226
|
+
const jsonRes = await res.json();
|
|
227
|
+
const items = jsonRes.data;
|
|
228
|
+
return items.map((item) => ({
|
|
229
|
+
id: item.id,
|
|
230
|
+
...item.attributes
|
|
231
|
+
}));
|
|
232
|
+
}
|
|
233
|
+
default: {
|
|
234
|
+
const res = await fetch(
|
|
235
|
+
`${baseUrl}/preview/projects/${projectId}/imdf/${featureType}.geojson`,
|
|
236
|
+
{
|
|
237
|
+
headers: {
|
|
238
|
+
Authorization: `Bearer ${previewToken}`
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
);
|
|
242
|
+
if (res.status !== 200) return [];
|
|
243
|
+
const collections = await res.json();
|
|
244
|
+
return collections.features;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
var safeFetchFeature = async (featureType, params) => {
|
|
249
|
+
const mode = params.mode ?? "delivery";
|
|
250
|
+
const projectId = params.projectId;
|
|
251
|
+
const apiKey = params.apiKey;
|
|
252
|
+
const previewToken = params.previewToken;
|
|
253
|
+
const baseUrl = params.baseUrl ?? DEFAULT_BASE_URL;
|
|
199
254
|
try {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
255
|
+
let result = [];
|
|
256
|
+
if (mode === "delivery") {
|
|
257
|
+
result = await fetchDeliveryApi(
|
|
258
|
+
projectId,
|
|
259
|
+
apiKey,
|
|
260
|
+
featureType,
|
|
261
|
+
baseUrl
|
|
262
|
+
);
|
|
263
|
+
} else if (mode === "preview") {
|
|
264
|
+
result = await fetchPreviewApi(
|
|
265
|
+
projectId,
|
|
266
|
+
previewToken,
|
|
267
|
+
featureType,
|
|
268
|
+
baseUrl
|
|
269
|
+
);
|
|
270
|
+
}
|
|
206
271
|
return result ?? [];
|
|
207
272
|
} catch (e) {
|
|
208
273
|
return Promise.resolve([]);
|
|
@@ -481,18 +546,22 @@ function matchFilters(item, filters) {
|
|
|
481
546
|
var getDataClient = (options) => {
|
|
482
547
|
const observers = /* @__PURE__ */ new Map();
|
|
483
548
|
const queryClient = options.queryClient ?? new import_query_core.QueryClient();
|
|
484
|
-
const { projectId, apiKey, baseUrl } = options;
|
|
549
|
+
const { mode = "delivery", projectId, apiKey, baseUrl, previewToken } = options;
|
|
485
550
|
if (!projectId)
|
|
486
551
|
throw new Error(
|
|
487
552
|
"Cannot create VenueDataClient. Reason: `projectId` is missing"
|
|
488
553
|
);
|
|
489
|
-
if (!apiKey)
|
|
554
|
+
if (mode === "delivery" && !apiKey)
|
|
490
555
|
throw new Error(
|
|
491
556
|
"Cannot create VenueDataClient. Reason: `apiKey` is missing"
|
|
492
557
|
);
|
|
558
|
+
if (mode === "preview" && !previewToken)
|
|
559
|
+
throw new Error(
|
|
560
|
+
"Cannot create VenueDataClient. Reason: `previewToken` is missing"
|
|
561
|
+
);
|
|
493
562
|
const createDeliveryApiQueryOptions = (featureType) => ({
|
|
494
563
|
queryKey: ["_deliveryapi", featureType],
|
|
495
|
-
queryFn: () => safeFetchFeature(projectId, apiKey,
|
|
564
|
+
queryFn: () => safeFetchFeature(featureType, { mode, projectId, apiKey, previewToken, baseUrl })
|
|
496
565
|
});
|
|
497
566
|
const internalFilterByType = async (featureType) => {
|
|
498
567
|
try {
|
|
@@ -5248,7 +5317,8 @@ var IndoorMap = class extends EventTarget {
|
|
|
5248
5317
|
createSpriteMaterialByLabelSymbol,
|
|
5249
5318
|
createStyledUIMarkerElement,
|
|
5250
5319
|
defaultFeatureQueryOptionsMap,
|
|
5251
|
-
|
|
5320
|
+
fetchDeliveryApi,
|
|
5321
|
+
fetchPreviewApi,
|
|
5252
5322
|
getBearingBetweenPoints,
|
|
5253
5323
|
getCenterFromGeometry,
|
|
5254
5324
|
getDataClient,
|