@panoramax/web-viewer 4.0.2-develop-682e2a36 → 4.0.2-develop-b600651e

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panoramax/web-viewer",
3
- "version": "4.0.2-develop-682e2a36",
3
+ "version": "4.0.2-develop-b600651e",
4
4
  "description": "Panoramax web viewer for geolocated pictures",
5
5
  "main": "build/index.js",
6
6
  "author": "Panoramax team",
@@ -150,7 +150,7 @@ export default class URLHandler extends EventTarget {
150
150
  // If hash is compressed
151
151
  if(keyvals.s) {
152
152
  const shortVals = Object.fromEntries(
153
- keyvals.s
153
+ decodeURIComponent(keyvals.s)
154
154
  .split(";")
155
155
  .map(kv => [kv[0], kv.substring(1)])
156
156
  );
@@ -243,6 +243,48 @@ describe("currentURLParams", () => {
243
243
  const uh = new URLHandler(v);
244
244
  expect(uh.currentURLParams()).toStrictEqual({});
245
245
  });
246
+
247
+ it("works with shortlinks", () => {
248
+ delete window.location;
249
+ window.location = { search: "?s=fp;s2;pa0270208-d79d-49a9-85c7-a352bb96962e;c282.09/9.34/30;m17/43.107492/5.868459;va;bs" };
250
+ const v = { addEventListener: jest.fn() };
251
+ const uh = new URLHandler(v);
252
+ expect(uh.currentURLParams()).toStrictEqual({
253
+ "focus": "pic",
254
+ "speed": 200,
255
+ "pic": "a0270208-d79d-49a9-85c7-a352bb96962e",
256
+ "xyz": "282.09/9.34/30",
257
+ "map": "17/43.107492/5.868459",
258
+ "theme": "age",
259
+ "background": "streets",
260
+ "camera": undefined,
261
+ "date_from": undefined,
262
+ "date_to": undefined,
263
+ "pic_score": undefined,
264
+ "users": undefined
265
+ });
266
+ });
267
+
268
+ it("works with shortlinks urlEncoded", () => {
269
+ delete window.location;
270
+ window.location = { search: "?s=fp%3Bs2%3Bpa0270208-d79d-49a9-85c7-a352bb96962e%3Bc282.09/9.34/30%3Bm17/43.107492/5.868459%3Bva%3Bbs" };
271
+ const v = { addEventListener: jest.fn() };
272
+ const uh = new URLHandler(v);
273
+ expect(uh.currentURLParams()).toStrictEqual({
274
+ "focus": "pic",
275
+ "speed": 200,
276
+ "pic": "a0270208-d79d-49a9-85c7-a352bb96962e",
277
+ "xyz": "282.09/9.34/30",
278
+ "map": "17/43.107492/5.868459",
279
+ "theme": "age",
280
+ "background": "streets",
281
+ "camera": undefined,
282
+ "date_from": undefined,
283
+ "date_to": undefined,
284
+ "pic_score": undefined,
285
+ "users": undefined
286
+ });
287
+ });
246
288
  });
247
289
 
248
290
  describe("currentMapString", () => {