@singi-labs/sifa-sdk 0.7.7 → 0.7.9

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.
@@ -251,6 +251,13 @@ interface Profile {
251
251
  availableToUtc?: number;
252
252
  pdsProvider?: PdsProviderInfo | null;
253
253
  claimed: boolean;
254
+ /**
255
+ * User-set opt-out flag from `id.sifa.profile.self.discoverable`. When
256
+ * `false`, the rendering app emits `noindex` and excludes the page from
257
+ * sitemaps. Absent means default-true (current behavior for existing
258
+ * records that predate this field).
259
+ */
260
+ discoverable?: boolean;
254
261
  isOwnProfile?: boolean;
255
262
  createdAt?: string;
256
263
  trustStats?: TrustStat[];
@@ -275,4 +282,4 @@ interface Profile {
275
282
  externalAccounts?: ExternalAccount[];
276
283
  }
277
284
 
278
- export type { ActiveApp as A, Endorsement as E, FeedItem as F, LocationValue as L, ProfileSkill as P, SkillRef as S, TrustStat as T, VerifiedAccount as V, PdsProviderInfo as a, EndorsementData as b, ExternalAccount as c, ExternalAccountKeytraceClaim as d, LanguageProficiency as e, Profile as f, ProfileCertification as g, ProfileCourse as h, ProfileEducation as i, ProfileHonor as j, ProfileIndustry as k, ProfileLanguage as l, ProfileLocation as m, ProfileOverrideSource as n, ProfilePosition as o, ProfileProject as p, ProfilePublication as q, ProfileVolunteering as r, PublicationContributor as s, SkillSuggestion as t };
285
+ export type { ActiveApp as A, Endorsement as E, FeedItem as F, LocationValue as L, ProfileSkill as P, SkillRef as S, TrustStat as T, VerifiedAccount as V, PdsProviderInfo as a, Profile as b, EndorsementData as c, ExternalAccount as d, ExternalAccountKeytraceClaim as e, LanguageProficiency as f, ProfileCertification as g, ProfileCourse as h, ProfileEducation as i, ProfileHonor as j, ProfileIndustry as k, ProfileLanguage as l, ProfileLocation as m, ProfileOverrideSource as n, ProfilePosition as o, ProfileProject as p, ProfilePublication as q, ProfileVolunteering as r, PublicationContributor as s, SkillSuggestion as t };
@@ -251,6 +251,13 @@ interface Profile {
251
251
  availableToUtc?: number;
252
252
  pdsProvider?: PdsProviderInfo | null;
253
253
  claimed: boolean;
254
+ /**
255
+ * User-set opt-out flag from `id.sifa.profile.self.discoverable`. When
256
+ * `false`, the rendering app emits `noindex` and excludes the page from
257
+ * sitemaps. Absent means default-true (current behavior for existing
258
+ * records that predate this field).
259
+ */
260
+ discoverable?: boolean;
254
261
  isOwnProfile?: boolean;
255
262
  createdAt?: string;
256
263
  trustStats?: TrustStat[];
@@ -275,4 +282,4 @@ interface Profile {
275
282
  externalAccounts?: ExternalAccount[];
276
283
  }
277
284
 
278
- export type { ActiveApp as A, Endorsement as E, FeedItem as F, LocationValue as L, ProfileSkill as P, SkillRef as S, TrustStat as T, VerifiedAccount as V, PdsProviderInfo as a, EndorsementData as b, ExternalAccount as c, ExternalAccountKeytraceClaim as d, LanguageProficiency as e, Profile as f, ProfileCertification as g, ProfileCourse as h, ProfileEducation as i, ProfileHonor as j, ProfileIndustry as k, ProfileLanguage as l, ProfileLocation as m, ProfileOverrideSource as n, ProfilePosition as o, ProfileProject as p, ProfilePublication as q, ProfileVolunteering as r, PublicationContributor as s, SkillSuggestion as t };
285
+ export type { ActiveApp as A, Endorsement as E, FeedItem as F, LocationValue as L, ProfileSkill as P, SkillRef as S, TrustStat as T, VerifiedAccount as V, PdsProviderInfo as a, Profile as b, EndorsementData as c, ExternalAccount as d, ExternalAccountKeytraceClaim as e, LanguageProficiency as f, ProfileCertification as g, ProfileCourse as h, ProfileEducation as i, ProfileHonor as j, ProfileIndustry as k, ProfileLanguage as l, ProfileLocation as m, ProfileOverrideSource as n, ProfilePosition as o, ProfileProject as p, ProfilePublication as q, ProfileVolunteering as r, PublicationContributor as s, SkillSuggestion as t };
package/dist/index.cjs CHANGED
@@ -944,6 +944,48 @@ function completenessScore(c) {
944
944
  function completenessPercent(c) {
945
945
  return Math.round(completenessScore(c) / COMPLETENESS_MAX_SCORE * 100);
946
946
  }
947
+
948
+ // src/logic/profile-dimensions.ts
949
+ var DIMENSIONS_MAX_SCORE = 6;
950
+ var MIN_SKILLS = 3;
951
+ function nonEmptyString(value) {
952
+ return typeof value === "string" && value.trim().length > 0;
953
+ }
954
+ function dimensionsFromInputs(inputs) {
955
+ return {
956
+ avatar: inputs.hasAvatar,
957
+ headline: inputs.hasHeadline,
958
+ about: inputs.hasAbout,
959
+ currentPosition: inputs.currentPositionCount > 0,
960
+ skills: inputs.skillCount >= MIN_SKILLS,
961
+ education: inputs.educationCount > 0
962
+ };
963
+ }
964
+ function profileToDimensionInputs(profile) {
965
+ const positions = profile.positions ?? [];
966
+ const skills = profile.skills ?? [];
967
+ const education = profile.education ?? [];
968
+ const currentPositionCount = positions.filter((p) => !p.endedAt).length;
969
+ return {
970
+ hasAvatar: nonEmptyString(profile.avatar),
971
+ hasHeadline: nonEmptyString(profile.headline),
972
+ hasAbout: nonEmptyString(profile.about),
973
+ currentPositionCount,
974
+ skillCount: skills.length,
975
+ educationCount: education.length
976
+ };
977
+ }
978
+ function getFilledDimensionsMap(profile) {
979
+ return dimensionsFromInputs(profileToDimensionInputs(profile));
980
+ }
981
+ function countFilledDimensions(input) {
982
+ const map = "hasAvatar" in input ? dimensionsFromInputs(input) : getFilledDimensionsMap(input);
983
+ let n = 0;
984
+ for (const v of Object.values(map)) {
985
+ if (v) n++;
986
+ }
987
+ return n;
988
+ }
947
989
  function maxGraphemes(max) {
948
990
  return (value) => {
949
991
  const segmenter = new Intl.Segmenter(void 0, { granularity: "grapheme" });
@@ -1085,6 +1127,7 @@ var ProfileSelfRecordSchema = zod.z.object({
1085
1127
  preferredWorkplace: zod.z.array(zod.z.string()).max(3).optional(),
1086
1128
  langs: zod.z.array(languageTagSchema).max(3).optional(),
1087
1129
  labels: selfLabelsSchema.optional(),
1130
+ discoverable: zod.z.boolean().optional(),
1088
1131
  createdAt: datetimeSchema
1089
1132
  });
1090
1133
  var ProfileSkillRecordSchema = zod.z.object({
@@ -1104,17 +1147,19 @@ var ProfileVolunteeringRecordSchema = zod.z.object({
1104
1147
  });
1105
1148
 
1106
1149
  // src/index.ts
1107
- var SIFA_SDK_VERSION = "0.7.7";
1150
+ var SIFA_SDK_VERSION = "0.7.9";
1108
1151
 
1109
1152
  exports.CATEGORY_LABELS = CATEGORY_LABELS;
1110
1153
  exports.CATEGORY_ORDER = CATEGORY_ORDER;
1111
1154
  exports.COMPLETENESS_MAX_SCORE = COMPLETENESS_MAX_SCORE;
1112
1155
  exports.CONTINENTS = CONTINENTS;
1113
1156
  exports.COUNTRIES = COUNTRIES;
1157
+ exports.DIMENSIONS_MAX_SCORE = DIMENSIONS_MAX_SCORE;
1114
1158
  exports.EndorsementConfirmationRecordSchema = EndorsementConfirmationRecordSchema;
1115
1159
  exports.EndorsementRecordSchema = EndorsementRecordSchema;
1116
1160
  exports.GraphFollowRecordSchema = GraphFollowRecordSchema;
1117
1161
  exports.INDUSTRY_OPTIONS = INDUSTRY_OPTIONS;
1162
+ exports.MIN_SKILLS = MIN_SKILLS;
1118
1163
  exports.PLATFORM_LABELS = PLATFORM_LABELS;
1119
1164
  exports.PLATFORM_OPTIONS = PLATFORM_OPTIONS;
1120
1165
  exports.ProfileCertificationRecordSchema = ProfileCertificationRecordSchema;
@@ -1138,12 +1183,14 @@ exports.cidSchema = cidSchema;
1138
1183
  exports.completenessPercent = completenessPercent;
1139
1184
  exports.completenessScore = completenessScore;
1140
1185
  exports.contrastRatio = contrastRatio;
1186
+ exports.countFilledDimensions = countFilledDimensions;
1141
1187
  exports.countryCodeToFlag = countryCodeToFlag;
1142
1188
  exports.dateRangeExtractor = dateRangeExtractor;
1143
1189
  exports.datetimeSchema = datetimeSchema;
1144
1190
  exports.dedupeSkills = dedupeSkills;
1145
1191
  exports.detectPdsProvider = detectPdsProvider;
1146
1192
  exports.didSchema = didSchema;
1193
+ exports.dimensionsFromInputs = dimensionsFromInputs;
1147
1194
  exports.findIndustry = findIndustry;
1148
1195
  exports.formatDistanceToNow = formatDistanceToNow;
1149
1196
  exports.formatLocation = formatLocation;
@@ -1151,6 +1198,7 @@ exports.formatRelativeTime = formatRelativeTime;
1151
1198
  exports.getContinent = getContinent;
1152
1199
  exports.getDisplayLabel = getDisplayLabel;
1153
1200
  exports.getFaviconUrl = getFaviconUrl;
1201
+ exports.getFilledDimensionsMap = getFilledDimensionsMap;
1154
1202
  exports.getHandleStem = getHandleStem;
1155
1203
  exports.getIndustryLabelKey = getIndustryLabelKey;
1156
1204
  exports.getPdsDisplayName = getPdsDisplayName;
@@ -1164,6 +1212,7 @@ exports.maxGraphemes = maxGraphemes;
1164
1212
  exports.meetsContrastAA = meetsContrastAA;
1165
1213
  exports.parseLocationString = parseLocationString;
1166
1214
  exports.pdsProviderFromApi = pdsProviderFromApi;
1215
+ exports.profileToDimensionInputs = profileToDimensionInputs;
1167
1216
  exports.relativeLuminance = relativeLuminance;
1168
1217
  exports.rgbToString = rgbToString;
1169
1218
  exports.sanitizeHandleInput = sanitizeHandleInput;