crumb-widget 1.0.4 → 1.0.5
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/README.md +1 -1
- package/dist/module.d.ts +3 -3
- package/dist/module.js +22 -22
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ Built with Svelte 5, distributed as a **single self-contained JavaScript file**
|
|
|
29
29
|
<body>
|
|
30
30
|
<div
|
|
31
31
|
id="crumb-widget"
|
|
32
|
-
data-
|
|
32
|
+
data-server="https://myserver.com/main_server/"
|
|
33
33
|
data-service-body="3"
|
|
34
34
|
></div>
|
|
35
35
|
<script type="module" src="https://cdn.aws.bmlt.app/crumb-widget.js"></script>
|
package/dist/module.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ declare interface MarkerConfig {
|
|
|
33
33
|
* import { mountCrumbWidget } from 'crumb-widget';
|
|
34
34
|
*
|
|
35
35
|
* mountCrumbWidget(document.getElementById('my-widget'), {
|
|
36
|
-
*
|
|
36
|
+
* serverUrl: 'https://bmlt.example.org/main_server/',
|
|
37
37
|
* serviceBodyIds: [1, 2, 3],
|
|
38
38
|
* });
|
|
39
39
|
* ```
|
|
@@ -41,8 +41,8 @@ declare interface MarkerConfig {
|
|
|
41
41
|
export declare function mountCrumbWidget(el: HTMLElement, options: MountOptions): void;
|
|
42
42
|
|
|
43
43
|
export declare interface MountOptions extends CrumbWidgetConfig {
|
|
44
|
-
/** URL of the BMLT
|
|
45
|
-
|
|
44
|
+
/** URL of the BMLT server (required) */
|
|
45
|
+
serverUrl: string;
|
|
46
46
|
/** Service body IDs to filter by (defaults to all) */
|
|
47
47
|
serviceBodyIds?: number[];
|
|
48
48
|
}
|
package/dist/module.js
CHANGED
|
@@ -3366,7 +3366,7 @@ var lo = /* @__PURE__ */ function(e) {
|
|
|
3366
3366
|
return e.GET_SEARCH_RESULTS = "GetSearchResults", e.GET_FORMATS = "GetFormats", e.GET_SERVICE_BODIES = "GetServiceBodies", e.GET_CHANGES = "GetChanges", e.GET_FIELD_KEYS = "GetFieldKeys", e.GET_FIELD_VALUES = "GetFieldValues", e.GET_NAWS_DUMP = "GetNAWSDump", e.GET_SERVER_INFO = "GetServerInfo", e.GET_COVERAGE_AREA = "GetCoverageArea", e;
|
|
3367
3367
|
}({});
|
|
3368
3368
|
function _o(e) {
|
|
3369
|
-
let {
|
|
3369
|
+
let { serverURL: t, format: n, endpoint: r, parameters: i = {} } = e, a = `${t.endsWith("/") ? t : `${t}/`}client_interface/${n}/`, o = new URLSearchParams();
|
|
3370
3370
|
return o.set("switcher", r), Object.entries(i).forEach(([e, t]) => {
|
|
3371
3371
|
t != null && (Array.isArray(t) ? t.forEach((t, n) => {
|
|
3372
3372
|
(typeof t == "number" || typeof t == "string") && o.append(`${e}[]`, t.toString());
|
|
@@ -3394,10 +3394,10 @@ function vo(e, t) {
|
|
|
3394
3394
|
function yo(e) {
|
|
3395
3395
|
try {
|
|
3396
3396
|
let t = new URL(e);
|
|
3397
|
-
if (!["http:", "https:"].includes(t.protocol)) throw Error("
|
|
3397
|
+
if (!["http:", "https:"].includes(t.protocol)) throw Error("Server URL must use http or https protocol");
|
|
3398
3398
|
return t.href.replace(/\/$/, "");
|
|
3399
3399
|
} catch (t) {
|
|
3400
|
-
let n = /* @__PURE__ */ Error(`Invalid
|
|
3400
|
+
let n = /* @__PURE__ */ Error(`Invalid server URL: ${e}`);
|
|
3401
3401
|
throw n.cause = t, n;
|
|
3402
3402
|
}
|
|
3403
3403
|
}
|
|
@@ -3413,16 +3413,16 @@ function xo(e) {
|
|
|
3413
3413
|
}
|
|
3414
3414
|
var So = class {
|
|
3415
3415
|
constructor(e) {
|
|
3416
|
-
ua(this, "timeout", void 0), ua(this, "userAgent", void 0), ua(this, "geocodingService", void 0), ua(this, "
|
|
3417
|
-
let {
|
|
3418
|
-
this.
|
|
3416
|
+
ua(this, "timeout", void 0), ua(this, "userAgent", void 0), ua(this, "geocodingService", void 0), ua(this, "serverURL", void 0), ua(this, "defaultFormat", void 0);
|
|
3417
|
+
let { serverURL: t, defaultFormat: n = ho.JSON, timeout: r = 3e4, userAgent: i = "bmlt-query-client/1.0.0", geocodingOptions: a = {}, enableGeocoding: o = !0 } = e;
|
|
3418
|
+
this.serverURL = yo(t), this.defaultFormat = n, this.timeout = r, this.userAgent = i, o && (this.geocodingService = new mo(a));
|
|
3419
3419
|
}
|
|
3420
3420
|
async makeRequest(e, t = {}, n = this.defaultFormat) {
|
|
3421
3421
|
let r;
|
|
3422
3422
|
try {
|
|
3423
3423
|
vo(e, n);
|
|
3424
3424
|
let i = _o({
|
|
3425
|
-
|
|
3425
|
+
serverURL: this.serverURL,
|
|
3426
3426
|
format: n,
|
|
3427
3427
|
endpoint: e,
|
|
3428
3428
|
parameters: t
|
|
@@ -3516,11 +3516,11 @@ var So = class {
|
|
|
3516
3516
|
if (!this.geocodingService) throw Error("Geocoding is not enabled. Initialize client with enableGeocoding: true");
|
|
3517
3517
|
return this.geocodingService.reverseGeocode(e, t);
|
|
3518
3518
|
}
|
|
3519
|
-
|
|
3520
|
-
return this.
|
|
3519
|
+
getServerURL() {
|
|
3520
|
+
return this.serverURL;
|
|
3521
3521
|
}
|
|
3522
|
-
|
|
3523
|
-
this.
|
|
3522
|
+
setServerURL(e) {
|
|
3523
|
+
this.serverURL = yo(e);
|
|
3524
3524
|
}
|
|
3525
3525
|
getDefaultFormat() {
|
|
3526
3526
|
return this.defaultFormat;
|
|
@@ -4422,7 +4422,7 @@ function $o(e) {
|
|
|
4422
4422
|
Yo.setLanguage(n.includes(t) ? t : "en"), Zo(Yo);
|
|
4423
4423
|
}
|
|
4424
4424
|
var Z = ln({
|
|
4425
|
-
|
|
4425
|
+
serverUrl: "",
|
|
4426
4426
|
serviceBodyIds: [],
|
|
4427
4427
|
defaultView: "list",
|
|
4428
4428
|
containerId: "crumb-widget",
|
|
@@ -4460,12 +4460,12 @@ function ts(e) {
|
|
|
4460
4460
|
}
|
|
4461
4461
|
async function ns(e, t = []) {
|
|
4462
4462
|
if (!e) {
|
|
4463
|
-
Q.error = "No
|
|
4463
|
+
Q.error = "No server URL configured. Add data-server to your embed element.";
|
|
4464
4464
|
return;
|
|
4465
4465
|
}
|
|
4466
4466
|
Q.loading = !0, Q.error = null;
|
|
4467
4467
|
try {
|
|
4468
|
-
let { meetings: n, formats: r } = await new So({
|
|
4468
|
+
let { meetings: n, formats: r } = await new So({ serverURL: e }).searchMeetingsWithFormats({
|
|
4469
4469
|
...t.length > 0 ? {
|
|
4470
4470
|
services: t,
|
|
4471
4471
|
recursive: !0
|
|
@@ -4482,12 +4482,12 @@ async function ns(e, t = []) {
|
|
|
4482
4482
|
}
|
|
4483
4483
|
async function rs(e, t, n, r = 10) {
|
|
4484
4484
|
if (!e) {
|
|
4485
|
-
Q.error = "No
|
|
4485
|
+
Q.error = "No server URL configured. Add data-server to your embed element.";
|
|
4486
4486
|
return;
|
|
4487
4487
|
}
|
|
4488
4488
|
Q.loading = !0, Q.error = null;
|
|
4489
4489
|
try {
|
|
4490
|
-
let { meetings: i, formats: a } = await new So({
|
|
4490
|
+
let { meetings: i, formats: a } = await new So({ serverURL: e }).searchMeetingsWithFormats({
|
|
4491
4491
|
lat_val: t,
|
|
4492
4492
|
long_val: n,
|
|
4493
4493
|
geo_width: r,
|
|
@@ -4615,11 +4615,11 @@ function ks(e, t) {
|
|
|
4615
4615
|
});
|
|
4616
4616
|
async function re() {
|
|
4617
4617
|
if ($.geoActive) {
|
|
4618
|
-
$.geoActive = !1, P(y, "idle"), await ns(Z.
|
|
4618
|
+
$.geoActive = !1, P(y, "idle"), await ns(Z.serverUrl, Z.serviceBodyIds);
|
|
4619
4619
|
return;
|
|
4620
4620
|
}
|
|
4621
4621
|
H(y) !== "locating" && (P(y, "locating"), navigator.geolocation.getCurrentPosition(async (e) => {
|
|
4622
|
-
await rs(Z.
|
|
4622
|
+
await rs(Z.serverUrl, e.coords.latitude, e.coords.longitude, Z.geolocationRadius), Q.error ? (P(te, Q.error, !0), P(y, "error"), ne && clearTimeout(ne), ne = setTimeout(() => P(y, "idle"), a)) : ($.geoActive = !0, P(y, "active"));
|
|
4623
4623
|
}, (e) => {
|
|
4624
4624
|
P(te, Ro(e.code, n()), !0), P(y, "error"), ne && clearTimeout(ne), ne = setTimeout(() => P(y, "idle"), a);
|
|
4625
4625
|
}, { timeout: 1e4 }));
|
|
@@ -10122,10 +10122,10 @@ function ll(e, t) {
|
|
|
10122
10122
|
ji(async () => {
|
|
10123
10123
|
let e = new URLSearchParams(window.location.search).get("view"), r = e === "auto" || !e && t.config.geolocation;
|
|
10124
10124
|
(e === "map" || !e && !t.config.geolocation && t.config.defaultView === "map") && ($.view = "map"), r ? navigator.geolocation ? (Q.loading = !0, navigator.geolocation.getCurrentPosition(async (e) => {
|
|
10125
|
-
await rs(t.config.
|
|
10125
|
+
await rs(t.config.serverUrl, e.coords.latitude, e.coords.longitude, t.config.geolocationRadius), Q.error || ($.geoActive = !0, $.view = "map");
|
|
10126
10126
|
}, (e) => {
|
|
10127
10127
|
Q.error = Ro(e.code, n()), Q.loading = !1;
|
|
10128
|
-
}, { timeout: 1e4 })) : Q.error = n().locationError : await ns(t.config.
|
|
10128
|
+
}, { timeout: 1e4 })) : Q.error = n().locationError : await ns(t.config.serverUrl, t.config.serviceBodyIds);
|
|
10129
10129
|
});
|
|
10130
10130
|
let a = /* @__PURE__ */ M(() => Lo(Q.meetings, $.filters)), o = /* @__PURE__ */ M(() => {
|
|
10131
10131
|
let e = Pi.location.match(/^\/(.+)-(\d+)$/);
|
|
@@ -10181,7 +10181,7 @@ function ll(e, t) {
|
|
|
10181
10181
|
return $.geoActive;
|
|
10182
10182
|
},
|
|
10183
10183
|
onsearcharea: async (e, n) => {
|
|
10184
|
-
await rs(t.config.
|
|
10184
|
+
await rs(t.config.serverUrl, e, n, t.config.geolocationRadius);
|
|
10185
10185
|
}
|
|
10186
10186
|
});
|
|
10187
10187
|
}, c = (e) => {
|
|
@@ -10209,7 +10209,7 @@ var ul = [
|
|
|
10209
10209
|
"address"
|
|
10210
10210
|
];
|
|
10211
10211
|
function dl(e, t) {
|
|
10212
|
-
Z.
|
|
10212
|
+
Z.serverUrl = t.serverUrl, Z.serviceBodyIds = t.serviceBodyIds ?? [], Z.containerId = e.id || "crumb-widget", Z.defaultView = t.defaultView ?? "list", Z.locationMarker = t.map?.markers?.location, Z.tiles = t.map?.tiles, Z.tilesDark = t.map?.tiles_dark, Z.columns = t.columns ?? ul, Z.geolocation = t.geolocation ?? !1, Z.geolocationRadius = t.geolocationRadius ?? 10, Z.height = t.height, Z.darkMode = t.darkMode ?? !1, Z.nowOffset = t.nowOffset ?? 10, Z.hideHeader = t.hideHeader ?? !1, $o(t.language ?? (typeof navigator < "u" ? navigator.language : "en")), Z.darkMode === "auto" ? e.classList.add("bmlt-dark-auto") : Z.darkMode === !0 && e.classList.add("bmlt-dark-force"), console.log("[crumb-widget] v1.0.5+735866f"), Gr(ll, {
|
|
10213
10213
|
target: e,
|
|
10214
10214
|
props: { config: Z }
|
|
10215
10215
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "crumb-widget",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
70
|
"@bmlt-enabled/svelte-spa-router": "^5.0.7",
|
|
71
|
-
"bmlt-query-client": "^1.0.
|
|
71
|
+
"bmlt-query-client": "^1.0.8",
|
|
72
72
|
"globals": "^17.4.0",
|
|
73
73
|
"leaflet": "^1.9.4",
|
|
74
74
|
"localized-strings": "^2.0.3"
|