@singi-labs/sifa-sdk 0.7.7 → 0.7.8

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.
@@ -275,4 +275,4 @@ interface Profile {
275
275
  externalAccounts?: ExternalAccount[];
276
276
  }
277
277
 
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 };
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, 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 };
@@ -275,4 +275,4 @@ interface Profile {
275
275
  externalAccounts?: ExternalAccount[];
276
276
  }
277
277
 
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 };
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, 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" });
@@ -1104,17 +1146,19 @@ var ProfileVolunteeringRecordSchema = zod.z.object({
1104
1146
  });
1105
1147
 
1106
1148
  // src/index.ts
1107
- var SIFA_SDK_VERSION = "0.7.7";
1149
+ var SIFA_SDK_VERSION = "0.7.8";
1108
1150
 
1109
1151
  exports.CATEGORY_LABELS = CATEGORY_LABELS;
1110
1152
  exports.CATEGORY_ORDER = CATEGORY_ORDER;
1111
1153
  exports.COMPLETENESS_MAX_SCORE = COMPLETENESS_MAX_SCORE;
1112
1154
  exports.CONTINENTS = CONTINENTS;
1113
1155
  exports.COUNTRIES = COUNTRIES;
1156
+ exports.DIMENSIONS_MAX_SCORE = DIMENSIONS_MAX_SCORE;
1114
1157
  exports.EndorsementConfirmationRecordSchema = EndorsementConfirmationRecordSchema;
1115
1158
  exports.EndorsementRecordSchema = EndorsementRecordSchema;
1116
1159
  exports.GraphFollowRecordSchema = GraphFollowRecordSchema;
1117
1160
  exports.INDUSTRY_OPTIONS = INDUSTRY_OPTIONS;
1161
+ exports.MIN_SKILLS = MIN_SKILLS;
1118
1162
  exports.PLATFORM_LABELS = PLATFORM_LABELS;
1119
1163
  exports.PLATFORM_OPTIONS = PLATFORM_OPTIONS;
1120
1164
  exports.ProfileCertificationRecordSchema = ProfileCertificationRecordSchema;
@@ -1138,12 +1182,14 @@ exports.cidSchema = cidSchema;
1138
1182
  exports.completenessPercent = completenessPercent;
1139
1183
  exports.completenessScore = completenessScore;
1140
1184
  exports.contrastRatio = contrastRatio;
1185
+ exports.countFilledDimensions = countFilledDimensions;
1141
1186
  exports.countryCodeToFlag = countryCodeToFlag;
1142
1187
  exports.dateRangeExtractor = dateRangeExtractor;
1143
1188
  exports.datetimeSchema = datetimeSchema;
1144
1189
  exports.dedupeSkills = dedupeSkills;
1145
1190
  exports.detectPdsProvider = detectPdsProvider;
1146
1191
  exports.didSchema = didSchema;
1192
+ exports.dimensionsFromInputs = dimensionsFromInputs;
1147
1193
  exports.findIndustry = findIndustry;
1148
1194
  exports.formatDistanceToNow = formatDistanceToNow;
1149
1195
  exports.formatLocation = formatLocation;
@@ -1151,6 +1197,7 @@ exports.formatRelativeTime = formatRelativeTime;
1151
1197
  exports.getContinent = getContinent;
1152
1198
  exports.getDisplayLabel = getDisplayLabel;
1153
1199
  exports.getFaviconUrl = getFaviconUrl;
1200
+ exports.getFilledDimensionsMap = getFilledDimensionsMap;
1154
1201
  exports.getHandleStem = getHandleStem;
1155
1202
  exports.getIndustryLabelKey = getIndustryLabelKey;
1156
1203
  exports.getPdsDisplayName = getPdsDisplayName;
@@ -1164,6 +1211,7 @@ exports.maxGraphemes = maxGraphemes;
1164
1211
  exports.meetsContrastAA = meetsContrastAA;
1165
1212
  exports.parseLocationString = parseLocationString;
1166
1213
  exports.pdsProviderFromApi = pdsProviderFromApi;
1214
+ exports.profileToDimensionInputs = profileToDimensionInputs;
1167
1215
  exports.relativeLuminance = relativeLuminance;
1168
1216
  exports.rgbToString = rgbToString;
1169
1217
  exports.sanitizeHandleInput = sanitizeHandleInput;