@ecency/sdk 1.3.2 → 1.3.4
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/browser/index.d.ts +1 -0
- package/dist/browser/index.js +12 -4
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +12 -4
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.mjs +12 -4
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/node/index.mjs
CHANGED
|
@@ -700,19 +700,27 @@ function sanitizeTokens(tokens) {
|
|
|
700
700
|
return { ...rest, meta: safeMeta };
|
|
701
701
|
});
|
|
702
702
|
}
|
|
703
|
+
function getExistingProfile(data) {
|
|
704
|
+
try {
|
|
705
|
+
const parsed = JSON.parse(data?.posting_json_metadata || "{}");
|
|
706
|
+
if (parsed && typeof parsed === "object" && parsed.profile && typeof parsed.profile === "object") {
|
|
707
|
+
return parsed.profile;
|
|
708
|
+
}
|
|
709
|
+
} catch (e) {
|
|
710
|
+
}
|
|
711
|
+
return {};
|
|
712
|
+
}
|
|
703
713
|
function getBuiltProfile({
|
|
704
714
|
profile,
|
|
705
715
|
tokens,
|
|
706
716
|
data
|
|
707
717
|
}) {
|
|
708
|
-
const metadata = R.
|
|
709
|
-
JSON.parse(data?.posting_json_metadata || "{}").profile,
|
|
710
|
-
R.mergeDeep(profile ?? {})
|
|
711
|
-
);
|
|
718
|
+
const metadata = R.mergeDeep(getExistingProfile(data), profile ?? {});
|
|
712
719
|
if (tokens && tokens.length > 0) {
|
|
713
720
|
metadata.tokens = tokens;
|
|
714
721
|
}
|
|
715
722
|
metadata.tokens = sanitizeTokens(metadata.tokens);
|
|
723
|
+
metadata.version = 2;
|
|
716
724
|
return metadata;
|
|
717
725
|
}
|
|
718
726
|
function useAccountUpdate(username) {
|