@singi-labs/sifa-sdk 0.12.55 → 0.12.57

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/index.cjs CHANGED
@@ -699,6 +699,12 @@ var OPEN_TO_OPTIONS = [
699
699
  token: "board",
700
700
  group: "work"
701
701
  },
702
+ {
703
+ value: "id.sifa.defs#speakingEngagements",
704
+ labelKey: "speakingEngagements",
705
+ token: "speaking",
706
+ group: "work"
707
+ },
702
708
  {
703
709
  value: "id.sifa.defs#mentoringOthers",
704
710
  labelKey: "mentoringOthers",
@@ -2372,6 +2378,32 @@ function countryCodeToFlag(code) {
2372
2378
  return String.fromCodePoint(a - 65 + 127462, b - 65 + 127462);
2373
2379
  }
2374
2380
 
2381
+ // src/format/location-segments.ts
2382
+ function clean(value) {
2383
+ const trimmed = value?.trim();
2384
+ return trimmed ? trimmed : null;
2385
+ }
2386
+ function locationSegments(loc, options = {}) {
2387
+ if (!loc) return [];
2388
+ const ordered = [
2389
+ { kind: "locality", value: clean(loc.locality ?? loc.city) },
2390
+ { kind: "region", value: clean(loc.region) },
2391
+ { kind: "country", value: clean(loc.country) }
2392
+ ];
2393
+ const segments = [];
2394
+ for (const { kind, value } of ordered) {
2395
+ if (value === null) continue;
2396
+ const previous = segments[segments.length - 1];
2397
+ if (previous && previous.label.toLowerCase() === value.toLowerCase()) continue;
2398
+ segments.push({
2399
+ kind,
2400
+ label: value,
2401
+ searchHref: kind === "country" && options.searchable !== false ? `/search?${new URLSearchParams({ country: value }).toString()}` : null
2402
+ });
2403
+ }
2404
+ return segments;
2405
+ }
2406
+
2375
2407
  // src/format/pds-utils.ts
2376
2408
  var BSKY_PROFILE_BASE = "https://bsky.app/profile/";
2377
2409
  var PDS_PROVIDERS = [
@@ -2653,27 +2685,27 @@ function meetsContrastAA(foreground, background) {
2653
2685
  }
2654
2686
 
2655
2687
  // src/import/presentation-csv.ts
2656
- function clean(value) {
2688
+ function clean2(value) {
2657
2689
  return (value ?? "").trim();
2658
2690
  }
2659
2691
  function parsePresentationDuration(input) {
2660
- const numbers = (clean(input).match(/\d+/g) ?? []).map((n) => Number.parseInt(n, 10)).filter((n) => Number.isInteger(n) && n > 0);
2692
+ const numbers = (clean2(input).match(/\d+/g) ?? []).map((n) => Number.parseInt(n, 10)).filter((n) => Number.isInteger(n) && n > 0);
2661
2693
  const min = numbers.at(0);
2662
2694
  if (min === void 0) return void 0;
2663
2695
  const max = numbers.at(1);
2664
2696
  return max !== void 0 && max >= min ? { minMinutes: min, maxMinutes: max } : { minMinutes: min };
2665
2697
  }
2666
2698
  function durationFromMinutes(minRaw, maxRaw) {
2667
- const min = Number.parseInt(clean(minRaw), 10);
2699
+ const min = Number.parseInt(clean2(minRaw), 10);
2668
2700
  if (!Number.isInteger(min) || min < 1) return void 0;
2669
- const max = Number.parseInt(clean(maxRaw), 10);
2701
+ const max = Number.parseInt(clean2(maxRaw), 10);
2670
2702
  return Number.isInteger(max) && max >= min ? { minMinutes: min, maxMinutes: max } : { minMinutes: min };
2671
2703
  }
2672
2704
  function parseIntendedAudiences(input, delimiter = ";") {
2673
- return clean(input).split(delimiter).map((s) => s.trim()).filter(Boolean);
2705
+ return clean2(input).split(delimiter).map((s) => s.trim()).filter(Boolean);
2674
2706
  }
2675
2707
  function stripHtmlToText(input) {
2676
- const text = clean(input).replace(/<\s*br\s*\/?>/gi, "\n").replace(/<\/\s*(p|div|li|h[1-6])\s*>/gi, "\n").replace(/<[^>]*>/g, "").replace(/&nbsp;/gi, " ").replace(/&amp;/gi, "&").replace(/&lt;/gi, "<").replace(/&gt;/gi, ">").replace(/&quot;/gi, '"').replace(/&#0*39;|&apos;/gi, "'");
2708
+ const text = clean2(input).replace(/<\s*br\s*\/?>/gi, "\n").replace(/<\/\s*(p|div|li|h[1-6])\s*>/gi, "\n").replace(/<[^>]*>/g, "").replace(/&nbsp;/gi, " ").replace(/&amp;/gi, "&").replace(/&lt;/gi, "<").replace(/&gt;/gi, ">").replace(/&quot;/gi, '"').replace(/&#0*39;|&apos;/gi, "'");
2677
2709
  return text.replace(/[ \t]+/g, " ").replace(/ *\n */g, "\n").replace(/\n{3,}/g, "\n\n").trim();
2678
2710
  }
2679
2711
  var ROLE_TOKENS = {
@@ -2685,7 +2717,7 @@ var ROLE_TOKENS = {
2685
2717
  host: "id.sifa.defs#host"
2686
2718
  };
2687
2719
  function normalizePresentationRole(value) {
2688
- const v = clean(value).toLowerCase();
2720
+ const v = clean2(value).toLowerCase();
2689
2721
  if (!v) return void 0;
2690
2722
  if (v.startsWith("id.sifa.defs#")) return v;
2691
2723
  const exact = ROLE_TOKENS[v];
@@ -2710,14 +2742,14 @@ var MODE_FRAGMENTS = {
2710
2742
  hybrid: "#hybrid"
2711
2743
  };
2712
2744
  function normalizePresentationMode(value) {
2713
- const v = clean(value).toLowerCase();
2745
+ const v = clean2(value).toLowerCase();
2714
2746
  if (!v) return void 0;
2715
2747
  if (v.startsWith("community.lexicon.calendar.event#")) return v;
2716
2748
  const fragment = MODE_FRAGMENTS[v];
2717
2749
  return fragment ? `community.lexicon.calendar.event${fragment}` : void 0;
2718
2750
  }
2719
2751
  function link(uri, type) {
2720
- const u = clean(uri);
2752
+ const u = clean2(uri);
2721
2753
  return u ? { uri: u, type } : void 0;
2722
2754
  }
2723
2755
  function presentationCsvRowToRecord(row) {
@@ -2729,12 +2761,12 @@ function presentationCsvRowToRecord(row) {
2729
2761
  link(row.recording_url, "id.sifa.defs#linkRecording"),
2730
2762
  link(row.writeup_url, "id.sifa.defs#linkWriteup")
2731
2763
  ].filter((l) => l !== void 0);
2732
- const record = { title: clean(row.title) };
2764
+ const record = { title: clean2(row.title) };
2733
2765
  if (description) record.description = description;
2734
2766
  if (duration) record.duration = duration;
2735
2767
  if (intendedAudiences.length) record.intendedAudiences = intendedAudiences;
2736
2768
  if (links.length) record.links = links;
2737
- return { key: clean(row.presentation_key) || void 0, record };
2769
+ return { key: clean2(row.presentation_key) || void 0, record };
2738
2770
  }
2739
2771
  function presentationDeliveryCsvRowToRecord(row) {
2740
2772
  const links = [
@@ -2742,10 +2774,10 @@ function presentationDeliveryCsvRowToRecord(row) {
2742
2774
  link(row.recording_url, "id.sifa.defs#linkRecording")
2743
2775
  ].filter((l) => l !== void 0);
2744
2776
  const record = {};
2745
- const title = clean(row.title);
2746
- const eventName = clean(row.event_name);
2747
- const date = clean(row.date);
2748
- const location = clean(row.location);
2777
+ const title = clean2(row.title);
2778
+ const eventName = clean2(row.event_name);
2779
+ const date = clean2(row.date);
2780
+ const location = clean2(row.location);
2749
2781
  const role = normalizePresentationRole(row.role);
2750
2782
  const mode = normalizePresentationMode(row.mode);
2751
2783
  if (title) record.title = title;
@@ -2755,7 +2787,7 @@ function presentationDeliveryCsvRowToRecord(row) {
2755
2787
  if (location) record.location = location;
2756
2788
  if (mode) record.mode = mode;
2757
2789
  if (links.length) record.links = links;
2758
- return { presentationKey: clean(row.presentation_key) || void 0, record };
2790
+ return { presentationKey: clean2(row.presentation_key) || void 0, record };
2759
2791
  }
2760
2792
 
2761
2793
  // src/cards/app-url-patterns.ts
@@ -5592,7 +5624,7 @@ function describeSifaRecord(collection, value) {
5592
5624
  }
5593
5625
 
5594
5626
  // src/index.ts
5595
- var SIFA_SDK_VERSION = "0.12.55";
5627
+ var SIFA_SDK_VERSION = "0.12.57";
5596
5628
 
5597
5629
  exports.ACTIVITY_TIERS = ACTIVITY_TIERS;
5598
5630
  exports.ACTIVITY_VERBS = ACTIVITY_VERBS;
@@ -5777,6 +5809,7 @@ exports.isVisibleActivityItem = isVisibleActivityItem;
5777
5809
  exports.languageTagSchema = languageTagSchema;
5778
5810
  exports.lexiconDateExtractor = lexiconDateExtractor;
5779
5811
  exports.limitCombiningMarks = limitCombiningMarks;
5812
+ exports.locationSegments = locationSegments;
5780
5813
  exports.looksLikeDomain = looksLikeDomain;
5781
5814
  exports.makeGraphFollowRecordSchema = makeGraphFollowRecordSchema;
5782
5815
  exports.maxGraphemes = maxGraphemes;