2026-04-16-3 add secur ,billing ,documents ,
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
import maplibregl from 'maplibre-gl';
|
||||
|
||||
export interface IntaleqMapOptions extends Omit<maplibregl.MapOptions, 'container'> {
|
||||
container: string | HTMLElement;
|
||||
apiKey: string;
|
||||
styleType?: 'obsidian' | 'light' | 'hybrid';
|
||||
}
|
||||
|
||||
/**
|
||||
* Intaleq Maps JS SDK
|
||||
* Optimized for Jordan & Syria mapping services.
|
||||
*/
|
||||
export class IntaleqMap extends maplibregl.Map {
|
||||
private readonly intaleqApiKey: string;
|
||||
|
||||
constructor(options: IntaleqMapOptions) {
|
||||
const { apiKey, styleType = 'obsidian', ...mapOptions } = options;
|
||||
|
||||
// Construct the Intaleq style URL
|
||||
// In production, this points to our tile server with the API key
|
||||
const styleUrl = `https://maps.intaleq.com/styles/${styleType}/style.json?key=${apiKey}`;
|
||||
|
||||
super({
|
||||
...mapOptions,
|
||||
style: styleUrl,
|
||||
hash: mapOptions.hash ?? true,
|
||||
center: mapOptions.center ?? [35.9239, 31.9522], // Default to Amman
|
||||
zoom: mapOptions.zoom ?? 12,
|
||||
transformRequest: (url: string) => {
|
||||
// Automatically append API key to all tile and asset requests
|
||||
if (url.includes('intaleq.com')) {
|
||||
const separator = url.includes('?') ? '&' : '?';
|
||||
return {
|
||||
url: `${url}${separator}key=${apiKey}`
|
||||
};
|
||||
}
|
||||
return { url };
|
||||
}
|
||||
});
|
||||
|
||||
this.intaleqApiKey = apiKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to search for places using Intaleq Geocoding API
|
||||
*/
|
||||
async search(query: string) {
|
||||
const response = await fetch(`https://map-saas.intaleq.com/v1/geocoding/search?q=${encodeURIComponent(query)}&key=${this.intaleqApiKey}`);
|
||||
return response.json();
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to get routes using Intaleq Routing API
|
||||
*/
|
||||
async getRoute(start: [number, number], end: [number, number], profile: 'car' | 'bike' | 'foot' = 'car') {
|
||||
const response = await fetch(`https://map-saas.intaleq.com/v1/routing/route?start=${start.join(',')}&end=${end.join(',')}&profile=${profile}&key=${this.intaleqApiKey}`);
|
||||
return response.json();
|
||||
}
|
||||
}
|
||||
|
||||
export { maplibregl };
|
||||
Reference in New Issue
Block a user