@proulr/sdui-components 0.1.62 → 0.1.64

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": "@proulr/sdui-components",
3
- "version": "0.1.62",
3
+ "version": "0.1.64",
4
4
  "type": "module",
5
5
  "main": "./src/renderer/index.ts",
6
6
  "types": "./src/renderer/index.ts",
@@ -52,6 +52,8 @@ type DiscoverMapProps = LayoutProps & {
52
52
  labelRef?: string;
53
53
  pinsRef?: string;
54
54
  height?: number;
55
+ /** When set, overrides default (interactive only while pins are empty). */
56
+ interactive?: boolean;
55
57
  };
56
58
 
57
59
  export const DiscoverMap: BdcComponent = (props) => layoutBlock('discover_map', props as DiscoverMapProps);
@@ -350,6 +350,13 @@ function readMapPins(data: Record<string, unknown>, ref: string) {
350
350
  const lat = typeof row.lat === 'number' ? row.lat : Number(row.lat);
351
351
  const lng = typeof row.lng === 'number' ? row.lng : Number(row.lng);
352
352
  if (!id || !Number.isFinite(lat) || !Number.isFinite(lng)) return null;
353
+ const distanceRaw = row.distance_m;
354
+ const distance_m =
355
+ typeof distanceRaw === 'number' && Number.isFinite(distanceRaw)
356
+ ? distanceRaw
357
+ : typeof distanceRaw === 'string' && Number.isFinite(Number(distanceRaw))
358
+ ? Number(distanceRaw)
359
+ : null;
353
360
  return {
354
361
  id,
355
362
  lat,
@@ -357,6 +364,11 @@ function readMapPins(data: Record<string, unknown>, ref: string) {
357
364
  display_name: typeof row.display_name === 'string' ? row.display_name : null,
358
365
  primary_photo_path:
359
366
  typeof row.primary_photo_path === 'string' ? row.primary_photo_path : null,
367
+ is_online: row.is_online === true || row.is_online === false ? row.is_online : null,
368
+ is_hosting: row.is_hosting === true || row.is_hosting === false ? row.is_hosting : null,
369
+ mood_text: typeof row.mood_text === 'string' ? row.mood_text : null,
370
+ distance_m,
371
+ status_label: typeof row.status_label === 'string' ? row.status_label : null,
360
372
  };
361
373
  })
362
374
  .filter((pin): pin is NonNullable<typeof pin> => Boolean(pin));
@@ -380,6 +392,9 @@ export function SduiDiscoverMapBlock({ block, data, onAction }: SduiBlockRenderP
380
392
  const centerMoveToken =
381
393
  typeof data.map_center_move_token === 'number' ? data.map_center_move_token : 0;
382
394
  const pins = pinsRef ? readMapPins(data, pinsRef) : [];
395
+ const interactiveOverride = block.props.interactive;
396
+ const interactive =
397
+ typeof interactiveOverride === 'boolean' ? interactiveOverride : pins.length === 0;
383
398
 
384
399
  if (hybrid.renderDiscoverMap) {
385
400
  return (
@@ -389,7 +404,7 @@ export function SduiDiscoverMapBlock({ block, data, onAction }: SduiBlockRenderP
389
404
  label: regionLabel,
390
405
  height,
391
406
  pins,
392
- interactive: pins.length === 0,
407
+ interactive,
393
408
  centerMoveToken,
394
409
  onCenterChange: hybrid.onDiscoverMapCenterChange ?? (() => {}),
395
410
  onPinPress: (profileId) => onAction('open_profile', { profile_id: profileId }),
@@ -18,6 +18,11 @@ export type SduiHybridDiscoverMapPin = {
18
18
  lng: number;
19
19
  display_name?: string | null;
20
20
  primary_photo_path?: string | null;
21
+ is_online?: boolean | null;
22
+ is_hosting?: boolean | null;
23
+ mood_text?: string | null;
24
+ distance_m?: number | null;
25
+ status_label?: string | null;
21
26
  };
22
27
 
23
28
  export type SduiHybridDiscoverMapProps = {