@telicent-oss/ds 0.27.0 → 0.27.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/ds.js CHANGED
@@ -70073,7 +70073,7 @@ Use an identity property function instead: \`{ "type": "identity", "property": $
70073
70073
  }
70074
70074
  query(t3, e2, r3, n2) {
70075
70075
  this.loadVTLayers();
70076
- const i2 = t3.params || {}, s3 = rs / t3.tileSize / t3.scale, o3 = Nr(i2.filter), l2 = t3.queryGeometry, u2 = t3.queryPadding * s3, c2 = bc(l2), h2 = this.grid.query(c2.minX - u2, c2.minY - u2, c2.maxX + u2, c2.maxY + u2), p3 = bc(t3.cameraQueryGeometry), f2 = this.grid3D.query(p3.minX - u2, p3.minY - u2, p3.maxX + u2, p3.maxY + u2, (e3, r4, n3, i3) => function(t4, e4, r5, n4, i4) {
70076
+ const i2 = t3.params || {}, s3 = rs / t3.tileSize / t3.scale, o3 = Nr(i2.filter), l2 = t3.queryGeometry, u2 = t3.queryPadding * s3, c2 = bc2(l2), h2 = this.grid.query(c2.minX - u2, c2.minY - u2, c2.maxX + u2, c2.maxY + u2), p3 = bc2(t3.cameraQueryGeometry), f2 = this.grid3D.query(p3.minX - u2, p3.minY - u2, p3.maxX + u2, p3.maxY + u2, (e3, r4, n3, i3) => function(t4, e4, r5, n4, i4) {
70077
70077
  for (const a2 of t4) if (e4 <= a2.x && r5 <= a2.y && n4 >= a2.x && i4 >= a2.y) return true;
70078
70078
  const s4 = [new a(e4, r5), new a(e4, i4), new a(n4, i4), new a(n4, r5)];
70079
70079
  if (t4.length > 2) {
@@ -70147,7 +70147,7 @@ Use an identity property function instead: \`{ "type": "identity", "property": $
70147
70147
  return s3 && s3.evaluate ? s3.evaluate(r3, n2, i2) : s3;
70148
70148
  });
70149
70149
  }
70150
- function bc(t3) {
70150
+ function bc2(t3) {
70151
70151
  let e2 = 1 / 0, r3 = 1 / 0, n2 = -1 / 0, i2 = -1 / 0;
70152
70152
  for (const a2 of t3) e2 = Math.min(e2, a2.x), r3 = Math.min(r3, a2.y), n2 = Math.max(n2, a2.x), i2 = Math.max(i2, a2.y);
70153
70153
  return { minX: e2, minY: r3, maxX: n2, maxY: i2 };
@@ -80443,35 +80443,46 @@ const FeatureMap = ({
80443
80443
  /* @__PURE__ */ jsx$1(FlexGridItem, { flexGrow: 0, p: 1, children: /* @__PURE__ */ jsx$1(LayerSelector, { ...styleSelector.props }) })
80444
80444
  ] }) }) }) });
80445
80445
  };
80446
+ const listeners = /* @__PURE__ */ new Set();
80447
+ let lastMessage = null;
80448
+ const bc = new BroadcastChannel("auth-events");
80449
+ bc.onmessage = (event) => {
80450
+ lastMessage = event.data;
80451
+ listeners.forEach((listener2) => listener2(event.data));
80452
+ };
80453
+ function onAuthEvent(callback) {
80454
+ listeners.add(callback);
80455
+ if (lastMessage !== null) {
80456
+ callback(lastMessage);
80457
+ }
80458
+ return () => {
80459
+ listeners.delete(callback);
80460
+ };
80461
+ }
80446
80462
  const AuthModal = ({
80447
- channelName = "auth-events",
80448
80463
  signOutUrl,
80449
80464
  debounceMs = 5e3
80450
80465
  }) => {
80451
- const bc = new BroadcastChannel(channelName);
80452
80466
  const alreadyTriggered = useRef(false);
80453
80467
  const [isOpen, setIsOpen] = useState(false);
80454
80468
  const handleLoginClick = () => {
80455
80469
  window.open(signOutUrl, "_blank");
80456
80470
  };
80457
- const handleAuthMessage = useCallback((message) => {
80458
- if (message.data.toLowerCase() === "unauthorized" && !alreadyTriggered.current) {
80459
- setIsOpen(true);
80460
- alreadyTriggered.current = true;
80461
- setTimeout(() => alreadyTriggered.current = false, debounceMs);
80462
- } else if (message.data.toLowerCase() === "authorized") {
80463
- setIsOpen(false);
80464
- alreadyTriggered.current = false;
80465
- }
80466
- }, []);
80467
80471
  useEffect(() => {
80468
- if (!channelName) return;
80469
- bc.addEventListener("message", handleAuthMessage);
80470
- return () => {
80471
- bc.removeEventListener("message", handleAuthMessage);
80472
- bc.close();
80473
- };
80474
- }, [channelName]);
80472
+ const unsubscribe = onAuthEvent((event) => {
80473
+ if (event === "unauthorized" && !alreadyTriggered.current) {
80474
+ setIsOpen(true);
80475
+ alreadyTriggered.current = true;
80476
+ setTimeout(() => {
80477
+ alreadyTriggered.current = false;
80478
+ }, debounceMs);
80479
+ } else if (event === "authorized") {
80480
+ setIsOpen(false);
80481
+ alreadyTriggered.current = false;
80482
+ }
80483
+ });
80484
+ return unsubscribe;
80485
+ }, []);
80475
80486
  return /* @__PURE__ */ jsx$1(Modal2, { hideCloseButton: true, onClose: () => {
80476
80487
  }, sx: {
80477
80488
  m: 2,
package/dist/ds.umd.cjs CHANGED
@@ -70091,7 +70091,7 @@ Use an identity property function instead: \`{ "type": "identity", "property": $
70091
70091
  }
70092
70092
  query(t3, e2, r3, n2) {
70093
70093
  this.loadVTLayers();
70094
- const i2 = t3.params || {}, s3 = rs / t3.tileSize / t3.scale, o3 = Nr(i2.filter), l2 = t3.queryGeometry, u2 = t3.queryPadding * s3, c2 = bc(l2), h2 = this.grid.query(c2.minX - u2, c2.minY - u2, c2.maxX + u2, c2.maxY + u2), p3 = bc(t3.cameraQueryGeometry), f2 = this.grid3D.query(p3.minX - u2, p3.minY - u2, p3.maxX + u2, p3.maxY + u2, (e3, r4, n3, i3) => function(t4, e4, r5, n4, i4) {
70094
+ const i2 = t3.params || {}, s3 = rs / t3.tileSize / t3.scale, o3 = Nr(i2.filter), l2 = t3.queryGeometry, u2 = t3.queryPadding * s3, c2 = bc2(l2), h2 = this.grid.query(c2.minX - u2, c2.minY - u2, c2.maxX + u2, c2.maxY + u2), p3 = bc2(t3.cameraQueryGeometry), f2 = this.grid3D.query(p3.minX - u2, p3.minY - u2, p3.maxX + u2, p3.maxY + u2, (e3, r4, n3, i3) => function(t4, e4, r5, n4, i4) {
70095
70095
  for (const a2 of t4) if (e4 <= a2.x && r5 <= a2.y && n4 >= a2.x && i4 >= a2.y) return true;
70096
70096
  const s4 = [new a(e4, r5), new a(e4, i4), new a(n4, i4), new a(n4, r5)];
70097
70097
  if (t4.length > 2) {
@@ -70165,7 +70165,7 @@ Use an identity property function instead: \`{ "type": "identity", "property": $
70165
70165
  return s3 && s3.evaluate ? s3.evaluate(r3, n2, i2) : s3;
70166
70166
  });
70167
70167
  }
70168
- function bc(t3) {
70168
+ function bc2(t3) {
70169
70169
  let e2 = 1 / 0, r3 = 1 / 0, n2 = -1 / 0, i2 = -1 / 0;
70170
70170
  for (const a2 of t3) e2 = Math.min(e2, a2.x), r3 = Math.min(r3, a2.y), n2 = Math.max(n2, a2.x), i2 = Math.max(i2, a2.y);
70171
70171
  return { minX: e2, minY: r3, maxX: n2, maxY: i2 };
@@ -80461,35 +80461,46 @@ uniform ${i3} ${s4} u_${a3};
80461
80461
  /* @__PURE__ */ jsx$1(FlexGridItem, { flexGrow: 0, p: 1, children: /* @__PURE__ */ jsx$1(LayerSelector, { ...styleSelector.props }) })
80462
80462
  ] }) }) }) });
80463
80463
  };
80464
+ const listeners = /* @__PURE__ */ new Set();
80465
+ let lastMessage = null;
80466
+ const bc = new BroadcastChannel("auth-events");
80467
+ bc.onmessage = (event) => {
80468
+ lastMessage = event.data;
80469
+ listeners.forEach((listener2) => listener2(event.data));
80470
+ };
80471
+ function onAuthEvent(callback) {
80472
+ listeners.add(callback);
80473
+ if (lastMessage !== null) {
80474
+ callback(lastMessage);
80475
+ }
80476
+ return () => {
80477
+ listeners.delete(callback);
80478
+ };
80479
+ }
80464
80480
  const AuthModal = ({
80465
- channelName = "auth-events",
80466
80481
  signOutUrl,
80467
80482
  debounceMs = 5e3
80468
80483
  }) => {
80469
- const bc = new BroadcastChannel(channelName);
80470
80484
  const alreadyTriggered = React$2.useRef(false);
80471
80485
  const [isOpen, setIsOpen] = React$2.useState(false);
80472
80486
  const handleLoginClick = () => {
80473
80487
  window.open(signOutUrl, "_blank");
80474
80488
  };
80475
- const handleAuthMessage = React$2.useCallback((message) => {
80476
- if (message.data.toLowerCase() === "unauthorized" && !alreadyTriggered.current) {
80477
- setIsOpen(true);
80478
- alreadyTriggered.current = true;
80479
- setTimeout(() => alreadyTriggered.current = false, debounceMs);
80480
- } else if (message.data.toLowerCase() === "authorized") {
80481
- setIsOpen(false);
80482
- alreadyTriggered.current = false;
80483
- }
80484
- }, []);
80485
80489
  React$2.useEffect(() => {
80486
- if (!channelName) return;
80487
- bc.addEventListener("message", handleAuthMessage);
80488
- return () => {
80489
- bc.removeEventListener("message", handleAuthMessage);
80490
- bc.close();
80491
- };
80492
- }, [channelName]);
80490
+ const unsubscribe = onAuthEvent((event) => {
80491
+ if (event === "unauthorized" && !alreadyTriggered.current) {
80492
+ setIsOpen(true);
80493
+ alreadyTriggered.current = true;
80494
+ setTimeout(() => {
80495
+ alreadyTriggered.current = false;
80496
+ }, debounceMs);
80497
+ } else if (event === "authorized") {
80498
+ setIsOpen(false);
80499
+ alreadyTriggered.current = false;
80500
+ }
80501
+ });
80502
+ return unsubscribe;
80503
+ }, []);
80493
80504
  return /* @__PURE__ */ jsx$1(Modal, { hideCloseButton: true, onClose: () => {
80494
80505
  }, sx: {
80495
80506
  m: 2,
@@ -1,5 +1,5 @@
1
1
  /// <reference lib="webworker" />
2
- console.info("sw.js version: 0.27.0");
2
+ console.info("sw.js version: 0.27.1");
3
3
  self.addEventListener("install", () => self.skipWaiting());
4
4
  self.addEventListener("activate", (event) =>
5
5
  event.waitUntil(self.clients.claim())
@@ -1,5 +1,4 @@
1
1
  interface AuthRedirectModalProps {
2
- channelName?: string;
3
2
  signOutUrl: string;
4
3
  debounceMs?: number;
5
4
  }
@@ -0,0 +1,4 @@
1
+ type AuthEvent = "unauthorized" | "authorized";
2
+ export declare function onAuthEvent(callback: (event: AuthEvent) => void): () => void;
3
+ export declare function broadcastAuthEvent(event: AuthEvent): void;
4
+ export {};
@@ -1,10 +1,10 @@
1
1
  import { AxiosInstance } from 'axios';
2
- import { QueryClient, QueryKey } from '@tanstack/react-query';
2
+ import { QueryClient } from '@tanstack/react-query';
3
3
 
4
4
  export interface SessionHandlingConfig {
5
5
  queryClient?: QueryClient;
6
- keysToInvalidate?: QueryKey[];
7
6
  broadcastChannel?: BroadcastChannel;
7
+ keysToInvalidate?: string[];
8
8
  }
9
9
  export interface AuthConfig {
10
10
  getToken: () => string | null;
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "url": "https://github.com/telicent-oss/telicent-ds.git"
8
8
  },
9
9
  "type": "module",
10
- "version": "0.27.0",
10
+ "version": "0.27.1",
11
11
  "private": false,
12
12
  "dependencies": {
13
13
  "@emotion/react": "^11.10.6",