@singi-labs/sifa-sdk 0.10.2 → 0.10.3

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
@@ -1749,6 +1749,86 @@ function isVisibleActivityItem(collection, record) {
1749
1749
  return rule(record);
1750
1750
  }
1751
1751
 
1752
+ // src/publishers/registry.ts
1753
+ var STANDARD_PUBLISHER_ID = "standard";
1754
+ var PUBLISHERS = Object.freeze([
1755
+ {
1756
+ id: "leaflet",
1757
+ name: "Leaflet",
1758
+ hostSuffixes: ["leaflet.pub"],
1759
+ homeUrl: "https://leaflet.pub"
1760
+ },
1761
+ {
1762
+ id: "pckt",
1763
+ name: "pckt",
1764
+ hostSuffixes: ["pckt.blog"],
1765
+ homeUrl: "https://pckt.blog"
1766
+ },
1767
+ {
1768
+ id: "offprint",
1769
+ name: "Offprint",
1770
+ hostSuffixes: ["offprint.app"],
1771
+ homeUrl: "https://offprint.app"
1772
+ },
1773
+ {
1774
+ id: "whitewind",
1775
+ name: "WhiteWind",
1776
+ hostSuffixes: ["whtwnd.com"],
1777
+ homeUrl: "https://whtwnd.com"
1778
+ },
1779
+ {
1780
+ id: "unthread",
1781
+ name: "Unthread",
1782
+ hostSuffixes: ["unthread.at"],
1783
+ homeUrl: "https://unthread.at"
1784
+ },
1785
+ {
1786
+ id: "blento",
1787
+ name: "Blento",
1788
+ hostSuffixes: ["blento.io"],
1789
+ homeUrl: "https://blento.io"
1790
+ }
1791
+ ]);
1792
+ var PUBLISHERS_BY_ID = new Map(PUBLISHERS.map((p) => [p.id, p]));
1793
+ function getPublisherById(id) {
1794
+ return PUBLISHERS_BY_ID.get(id);
1795
+ }
1796
+ function getPublisherByHost(hostname) {
1797
+ const host = hostname.toLowerCase();
1798
+ for (const publisher of PUBLISHERS) {
1799
+ for (const suffix of publisher.hostSuffixes) {
1800
+ if (host === suffix || host.endsWith(`.${suffix}`)) {
1801
+ return publisher;
1802
+ }
1803
+ }
1804
+ }
1805
+ return void 0;
1806
+ }
1807
+ function getPublisherFromSiteUrl(siteUrl) {
1808
+ let hostname;
1809
+ let homeUrl;
1810
+ try {
1811
+ const parsed2 = new URL(siteUrl);
1812
+ hostname = parsed2.hostname;
1813
+ homeUrl = `${parsed2.protocol}//${parsed2.hostname}`;
1814
+ } catch {
1815
+ return {
1816
+ id: STANDARD_PUBLISHER_ID,
1817
+ name: siteUrl,
1818
+ hostSuffixes: [],
1819
+ homeUrl: siteUrl
1820
+ };
1821
+ }
1822
+ const matched = getPublisherByHost(hostname);
1823
+ if (matched) return matched;
1824
+ return {
1825
+ id: STANDARD_PUBLISHER_ID,
1826
+ name: hostname,
1827
+ hostSuffixes: [],
1828
+ homeUrl
1829
+ };
1830
+ }
1831
+
1752
1832
  // src/logic/profile-completeness.ts
1753
1833
  var COMPLETENESS_MAX_SCORE = 6;
1754
1834
  function completenessScore(c) {
@@ -2068,7 +2148,7 @@ var ProfileVolunteeringRecordSchema = zod.z.object({
2068
2148
  });
2069
2149
 
2070
2150
  // src/index.ts
2071
- var SIFA_SDK_VERSION = "0.10.2";
2151
+ var SIFA_SDK_VERSION = "0.10.3";
2072
2152
 
2073
2153
  exports.ACTIVITY_TIERS = ACTIVITY_TIERS;
2074
2154
  exports.ACTIVITY_VISIBILITY_RULES = ACTIVITY_VISIBILITY_RULES;
@@ -2101,6 +2181,7 @@ exports.MIN_SKILLS = MIN_SKILLS;
2101
2181
  exports.OPEN_TO_OPTIONS = OPEN_TO_OPTIONS;
2102
2182
  exports.PLATFORM_LABELS = PLATFORM_LABELS;
2103
2183
  exports.PLATFORM_OPTIONS = PLATFORM_OPTIONS;
2184
+ exports.PUBLISHERS = PUBLISHERS;
2104
2185
  exports.ProfileCertificationRecordSchema = ProfileCertificationRecordSchema;
2105
2186
  exports.ProfileCourseRecordSchema = ProfileCourseRecordSchema;
2106
2187
  exports.ProfileEducationRecordSchema = ProfileEducationRecordSchema;
@@ -2116,6 +2197,7 @@ exports.ProfileVolunteeringRecordSchema = ProfileVolunteeringRecordSchema;
2116
2197
  exports.PublicationAuthorSchema = PublicationAuthorSchema;
2117
2198
  exports.SIFA_SDK_VERSION = SIFA_SDK_VERSION;
2118
2199
  exports.SKILL_CATEGORIES = SKILL_CATEGORIES;
2200
+ exports.STANDARD_PUBLISHER_ID = STANDARD_PUBLISHER_ID;
2119
2201
  exports.SifaFeedItemSchema = SifaFeedItemSchema;
2120
2202
  exports.WORKPLACE_TYPE_LABELS = WORKPLACE_TYPE_LABELS;
2121
2203
  exports.WORKPLACE_TYPE_OPTIONS = WORKPLACE_TYPE_OPTIONS;
@@ -2155,6 +2237,9 @@ exports.getLexiconEntry = getLexiconEntry;
2155
2237
  exports.getOpenToLabelKey = getOpenToLabelKey;
2156
2238
  exports.getPdsDisplayName = getPdsDisplayName;
2157
2239
  exports.getPlatformLabel = getPlatformLabel;
2240
+ exports.getPublisherByHost = getPublisherByHost;
2241
+ exports.getPublisherById = getPublisherById;
2242
+ exports.getPublisherFromSiteUrl = getPublisherFromSiteUrl;
2158
2243
  exports.getTierMeta = getTierMeta;
2159
2244
  exports.getWorkplaceTypeLabel = getWorkplaceTypeLabel;
2160
2245
  exports.groupSkillsByCategory = groupSkillsByCategory;