@singi-labs/sifa-sdk 0.19.52 → 0.19.53

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
@@ -5598,6 +5598,35 @@ function renderAsLine(vm) {
5598
5598
  return !isSelfAuthoredRich(vm);
5599
5599
  }
5600
5600
 
5601
+ // src/stream/stream-card-content.ts
5602
+ function streamCardBodyContent(body) {
5603
+ if (!body) return null;
5604
+ if ("text" in body && body.text?.trim()) return body.text.trim();
5605
+ if ("title" in body && body.title?.trim()) return body.title.trim();
5606
+ if ("venueName" in body && body.venueName?.trim()) return body.venueName.trim();
5607
+ if ("communityName" in body && body.communityName?.trim()) return body.communityName.trim();
5608
+ return null;
5609
+ }
5610
+ function streamCardSubjectText(subject) {
5611
+ if (!subject) return null;
5612
+ switch (subject.kind) {
5613
+ case "record":
5614
+ return subject.title?.trim() || null;
5615
+ case "person":
5616
+ return subject.displayName?.trim() || subject.handle?.trim() || null;
5617
+ case "post":
5618
+ return streamCardBodyContent(subject.post.body);
5619
+ }
5620
+ }
5621
+ function streamCardContent(vm) {
5622
+ const subjectText = streamCardSubjectText(vm.subject);
5623
+ if (subjectText) {
5624
+ const subjectUrl = vm.subject && "url" in vm.subject ? vm.subject.url ?? null : null;
5625
+ return { text: subjectText, url: subjectUrl ?? vm.sourceUrl ?? null };
5626
+ }
5627
+ return { text: streamCardBodyContent(vm.body), url: vm.sourceUrl ?? null };
5628
+ }
5629
+
5601
5630
  // src/logic/profile-completeness.ts
5602
5631
  var COMPLETENESS_MAX_SCORE = 6;
5603
5632
  function completenessScore(c) {
@@ -7128,7 +7157,7 @@ function describeSifaRecord(collection, value) {
7128
7157
  }
7129
7158
 
7130
7159
  // src/index.ts
7131
- var SIFA_SDK_VERSION = "0.19.52";
7160
+ var SIFA_SDK_VERSION = "0.19.53";
7132
7161
 
7133
7162
  exports.ACTIVITY_TIERS = ACTIVITY_TIERS;
7134
7163
  exports.ACTIVITY_VERBS = ACTIVITY_VERBS;
@@ -7436,8 +7465,11 @@ exports.sortPublications = sortPublications;
7436
7465
  exports.splitCoursesByRole = splitCoursesByRole;
7437
7466
  exports.streamAddressSchema = streamAddressSchema;
7438
7467
  exports.streamAuthorSchema = streamAuthorSchema;
7468
+ exports.streamCardBodyContent = streamCardBodyContent;
7439
7469
  exports.streamCardBodySchema = streamCardBodySchema;
7470
+ exports.streamCardContent = streamCardContent;
7440
7471
  exports.streamCardSubjectSchema = streamCardSubjectSchema;
7472
+ exports.streamCardSubjectText = streamCardSubjectText;
7441
7473
  exports.streamCardVMSchema = streamCardVMSchema;
7442
7474
  exports.streamExternalLinkSchema = streamExternalLinkSchema;
7443
7475
  exports.streamGeoSchema = streamGeoSchema;