@civic/profile
Advanced tools
Comparing version
@@ -16,3 +16,2 @@ import { __awaiter } from "tslib"; | ||
get() { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -24,3 +23,5 @@ try { | ||
} | ||
return mapResponse((_a = res.contents) !== null && _a !== void 0 ? _a : {}); | ||
const profile = res.contents | ||
? Object.assign(Object.assign({}, res.contents), { identifiers: res.identifiers }) : {}; | ||
return mapResponse(profile); | ||
} | ||
@@ -27,0 +28,0 @@ catch (e) { |
import { pathOr } from "ramda"; | ||
export function mapResponse(publicProfile) { | ||
var _a; | ||
const name = pathOr(undefined, ["name", "value"], publicProfile); | ||
const image = pathOr(undefined, ["image", "value"], publicProfile); | ||
const headline = pathOr(undefined, ["headline", "value"], publicProfile); | ||
const identifiers = (_a = publicProfile.identifiers) === null || _a === void 0 ? void 0 : _a.map((i) => ({ | ||
type: i.type, | ||
value: i.value, | ||
})); | ||
const verified = false; | ||
@@ -11,2 +16,3 @@ const profileResult = { | ||
headline: headline ? { value: headline, verified } : undefined, | ||
identifiers, | ||
}; | ||
@@ -13,0 +19,0 @@ return JSON.stringify(profileResult); |
@@ -16,2 +16,6 @@ import { Connection } from "@solana/web3.js"; | ||
} & Verifiable; | ||
export type VerifiedIdentifier = { | ||
type: string; | ||
value: string; | ||
}; | ||
export type Profile = { | ||
@@ -21,2 +25,3 @@ name?: ProfileName; | ||
headline?: ProfileHeadline; | ||
identifiers?: VerifiedIdentifier[]; | ||
}; | ||
@@ -23,0 +28,0 @@ export type CivicProfileFunctions = { |
@@ -19,3 +19,2 @@ "use strict"; | ||
get() { | ||
var _a; | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
@@ -27,3 +26,5 @@ try { | ||
} | ||
return (0, utils_1.mapResponse)((_a = res.contents) !== null && _a !== void 0 ? _a : {}); | ||
const profile = res.contents | ||
? Object.assign(Object.assign({}, res.contents), { identifiers: res.identifiers }) : {}; | ||
return (0, utils_1.mapResponse)(profile); | ||
} | ||
@@ -30,0 +31,0 @@ catch (e) { |
@@ -6,5 +6,10 @@ "use strict"; | ||
function mapResponse(publicProfile) { | ||
var _a; | ||
const name = (0, ramda_1.pathOr)(undefined, ["name", "value"], publicProfile); | ||
const image = (0, ramda_1.pathOr)(undefined, ["image", "value"], publicProfile); | ||
const headline = (0, ramda_1.pathOr)(undefined, ["headline", "value"], publicProfile); | ||
const identifiers = (_a = publicProfile.identifiers) === null || _a === void 0 ? void 0 : _a.map((i) => ({ | ||
type: i.type, | ||
value: i.value, | ||
})); | ||
const verified = false; | ||
@@ -15,2 +20,3 @@ const profileResult = { | ||
headline: headline ? { value: headline, verified } : undefined, | ||
identifiers, | ||
}; | ||
@@ -17,0 +23,0 @@ return JSON.stringify(profileResult); |
{ | ||
"name": "@civic/profile", | ||
"version": "0.5.0-beta.1", | ||
"version": "0.5.0", | ||
"description": "Civic Profile SDK", | ||
@@ -40,3 +40,2 @@ "repository": "git@github.com:civicteam/civic.me.git", | ||
"devDependencies": { | ||
"@civic/civic-eth-provider": "^0.0.9", | ||
"@ethersproject/bignumber": "^5.7.0", | ||
@@ -43,0 +42,0 @@ "@types/chai": "^4.3.1", |
53400
1.22%21
-4.55%1205
1.6%