@singi-labs/sifa-sdk 0.12.14 → 0.12.15
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 +20 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +20 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3011,6 +3011,7 @@ var streamCardVMSchema = zod.z.lazy(
|
|
|
3011
3011
|
tier: zod.z.enum(["creation", "action", "filtered"]),
|
|
3012
3012
|
timestamp: zod.z.string(),
|
|
3013
3013
|
title: zod.z.string(),
|
|
3014
|
+
sourceUrl: zod.z.string().optional(),
|
|
3014
3015
|
body: streamCardBodySchema.optional(),
|
|
3015
3016
|
media: zod.z.array(streamMediaSchema).optional(),
|
|
3016
3017
|
externalLink: streamExternalLinkSchema.optional(),
|
|
@@ -3186,6 +3187,20 @@ var TITLE_BY_VERB = {
|
|
|
3186
3187
|
function buildTitle(verb, label) {
|
|
3187
3188
|
return TITLE_BY_VERB[verb](label);
|
|
3188
3189
|
}
|
|
3190
|
+
function resolveSourceUrl(item, record) {
|
|
3191
|
+
const authorDid = didFromUri(item.uri);
|
|
3192
|
+
if (!authorDid) return void 0;
|
|
3193
|
+
const authorHandle = asNonEmptyString(item.authorHandle) ?? asNonEmptyString(record.handle);
|
|
3194
|
+
const url = resolveCardUrl({
|
|
3195
|
+
collection: item.collection,
|
|
3196
|
+
record,
|
|
3197
|
+
uri: item.uri,
|
|
3198
|
+
rkey: item.rkey,
|
|
3199
|
+
authorDid,
|
|
3200
|
+
...authorHandle ? { authorHandle } : {}
|
|
3201
|
+
});
|
|
3202
|
+
return url && /^https?:\/\//i.test(url) ? url : void 0;
|
|
3203
|
+
}
|
|
3189
3204
|
function readTheme(record) {
|
|
3190
3205
|
const theme = asRecord(record?.publicationTheme ?? record?.theme);
|
|
3191
3206
|
if (!theme) return void 0;
|
|
@@ -3683,6 +3698,10 @@ function toStreamCardVM(item, options = {}) {
|
|
|
3683
3698
|
};
|
|
3684
3699
|
const theme = readTheme(record);
|
|
3685
3700
|
if (theme) vm.theme = theme;
|
|
3701
|
+
if (record) {
|
|
3702
|
+
const sourceUrl = resolveSourceUrl(item, record);
|
|
3703
|
+
if (sourceUrl) vm.sourceUrl = sourceUrl;
|
|
3704
|
+
}
|
|
3686
3705
|
if (item.subject) {
|
|
3687
3706
|
vm.subject = { kind: "post", post: toStreamCardVM(item.subject, options) };
|
|
3688
3707
|
}
|
|
@@ -4544,7 +4563,7 @@ var ProfileVolunteeringRecordSchema = zod.z.object({
|
|
|
4544
4563
|
});
|
|
4545
4564
|
|
|
4546
4565
|
// src/index.ts
|
|
4547
|
-
var SIFA_SDK_VERSION = "0.12.
|
|
4566
|
+
var SIFA_SDK_VERSION = "0.12.15";
|
|
4548
4567
|
|
|
4549
4568
|
exports.ACTIVITY_TIERS = ACTIVITY_TIERS;
|
|
4550
4569
|
exports.ACTIVITY_VERBS = ACTIVITY_VERBS;
|