@ecency/sdk 1.0.55 → 1.0.56

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.
@@ -1,12 +1,12 @@
1
1
  var Q = Object.defineProperty;
2
2
  var _ = (e, t, n) => t in e ? Q(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var S = (e, t, n) => _(e, typeof t != "symbol" ? t + "" : t, n);
3
+ var O = (e, t, n) => _(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import { QueryClient as K, useMutation as l, useQuery as q, useInfiniteQuery as j, queryOptions as p, infiniteQueryOptions as F } from "@tanstack/react-query";
5
5
  import { Client as D, PrivateKey as h, cryptoUtils as P, RCAPI as N } from "@hiveio/dhive";
6
6
  import g from "hivesigner";
7
7
  class M {
8
8
  constructor() {
9
- S(this, "length", 0);
9
+ O(this, "length", 0);
10
10
  }
11
11
  clear() {
12
12
  throw new Error("Method not implemented.");
@@ -52,19 +52,19 @@ const i = {
52
52
  queryClient: new K(),
53
53
  plausibleHost: "https://pl.ecency.com"
54
54
  };
55
- var C;
55
+ var S;
56
56
  ((e) => {
57
57
  function t(n) {
58
58
  i.queryClient = n;
59
59
  }
60
60
  e.setQueryClient = t;
61
- })(C || (C = {}));
61
+ })(S || (S = {}));
62
62
  function E(e) {
63
63
  let t = atob(e);
64
64
  if (t[0] === "{")
65
65
  return JSON.parse(t);
66
66
  }
67
- const f = (e) => {
67
+ const d = (e) => {
68
68
  try {
69
69
  const t = i.storage.getItem(
70
70
  i.storagePrefix + "_user_" + e
@@ -74,7 +74,7 @@ const f = (e) => {
74
74
  console.error(t);
75
75
  return;
76
76
  }
77
- }, y = (e) => f(e) && f(e).accessToken, k = (e) => f(e) && f(e).postingKey, T = (e) => f(e) && f(e).loginType, L = (e) => f(e) && f(e).refreshToken;
77
+ }, y = (e) => d(e) && d(e).accessToken, k = (e) => d(e) && d(e).postingKey, T = (e) => d(e) && d(e).loginType, L = (e) => d(e) && d(e).refreshToken;
78
78
  function J() {
79
79
  return new Promise((e) => {
80
80
  var t;
@@ -173,7 +173,7 @@ function ee() {
173
173
  });
174
174
  }
175
175
  const u = () => i.queryClient;
176
- var b;
176
+ var C;
177
177
  ((e) => {
178
178
  function t(s) {
179
179
  return u().getQueryData(s);
@@ -209,7 +209,7 @@ var b;
209
209
  };
210
210
  }
211
211
  e.generateClientServerInfiniteQuery = a;
212
- })(b || (b = {}));
212
+ })(C || (C = {}));
213
213
  function H(e) {
214
214
  return p({
215
215
  queryKey: ["get-account-full", e],
@@ -349,28 +349,21 @@ function se(e) {
349
349
  return I(
350
350
  ["accounts", "update", t],
351
351
  e,
352
- ({ profile: n, tokens: o, beneficiary: r }) => [
353
- [
354
- "account_update2",
355
- {
356
- account: e,
357
- json_metadata: "",
358
- posting_json_metadata: JSON.stringify({
359
- ...JSON.parse((t == null ? void 0 : t.posting_json_metadata) || "{}"),
360
- profile: { ...n, version: 2 },
361
- tokens: o,
362
- // See https://docs.ecency.com/communities/default-beneficiary/
363
- ...r ? {
364
- beneficiary: {
365
- account: r == null ? void 0 : r.username,
366
- weight: r == null ? void 0 : r.reward
367
- }
368
- } : {}
369
- }),
370
- extensions: []
371
- }
372
- ]
373
- ]
352
+ ({ profile: n, tokens: o }) => {
353
+ const r = {
354
+ ...JSON.parse((t == null ? void 0 : t.posting_json_metadata) || "{}"),
355
+ profile: { ...t == null ? void 0 : t.profile, ...n, version: 2 }
356
+ };
357
+ return o && o.length > 0 && (r.tokens = o), [
358
+ [
359
+ "account_update2",
360
+ {
361
+ account: e,
362
+ posting_json_metadata: JSON.stringify(r)
363
+ }
364
+ ]
365
+ ];
366
+ }
374
367
  );
375
368
  }
376
369
  function ae(e, t, n, o) {
@@ -540,7 +533,7 @@ function le(e) {
540
533
  }
541
534
  });
542
535
  }
543
- function de(e, t = "Active") {
536
+ function fe(e, t = "Active") {
544
537
  return l({
545
538
  mutationKey: ["operations", "sign-keychain", e],
546
539
  mutationFn: ({ operation: n }) => {
@@ -552,7 +545,7 @@ function de(e, t = "Active") {
552
545
  }
553
546
  });
554
547
  }
555
- function fe(e = "/") {
548
+ function de(e = "/") {
556
549
  return l({
557
550
  mutationKey: ["operations", "sign-hivesigner", e],
558
551
  mutationFn: async ({ operation: t }) => g.sendOperation(t, { callback: e }, () => {
@@ -604,7 +597,7 @@ function we(e = 20) {
604
597
  refetchOnMount: !0
605
598
  });
606
599
  }
607
- function O(e) {
600
+ function b(e) {
608
601
  return p({
609
602
  queryKey: ["posts", "fragments", e],
610
603
  queryFn: async () => (await fetch(
@@ -657,13 +650,13 @@ function me(e) {
657
650
  )).json(),
658
651
  onSuccess(t) {
659
652
  u().setQueryData(
660
- O(e).queryKey,
653
+ b(e).queryKey,
661
654
  (n) => [t, ...n ?? []]
662
655
  );
663
656
  }
664
657
  });
665
658
  }
666
- function Oe(e, t) {
659
+ function be(e, t) {
667
660
  return l({
668
661
  mutationKey: ["posts", "edit-fragment", e, t],
669
662
  mutationFn: async ({ title: n, body: o }) => (await fetch(
@@ -683,7 +676,7 @@ function Oe(e, t) {
683
676
  )).json(),
684
677
  onSuccess(n) {
685
678
  u().setQueryData(
686
- O(e).queryKey,
679
+ b(e).queryKey,
687
680
  (o) => {
688
681
  if (!o)
689
682
  return [];
@@ -694,7 +687,7 @@ function Oe(e, t) {
694
687
  }
695
688
  });
696
689
  }
697
- function Se(e, t) {
690
+ function Oe(e, t) {
698
691
  return l({
699
692
  mutationKey: ["posts", "remove-fragment", e],
700
693
  mutationFn: async () => fetch(i.privateApiHost + "/private-api/fragments-delete", {
@@ -709,7 +702,7 @@ function Se(e, t) {
709
702
  }),
710
703
  onSuccess() {
711
704
  u().setQueryData(
712
- O(e).queryKey,
705
+ b(e).queryKey,
713
706
  (n) => [...n ?? []].filter(({ id: o }) => o !== t)
714
707
  );
715
708
  }
@@ -738,7 +731,7 @@ function A(e, t) {
738
731
  }
739
732
  });
740
733
  }
741
- const Ce = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
734
+ const Se = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
742
735
  __proto__: null,
743
736
  useRecordActivity: A
744
737
  }, Symbol.toStringTag, { value: "Module" }));
@@ -813,7 +806,7 @@ const $ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
813
806
  __proto__: null,
814
807
  getAccountTokenQueryOptions: m,
815
808
  getAccountVideosQueryOptions: z
816
- }, Symbol.toStringTag, { value: "Module" })), be = {
809
+ }, Symbol.toStringTag, { value: "Module" })), Ce = {
817
810
  queries: $
818
811
  };
819
812
  function Ke() {
@@ -926,7 +919,7 @@ function Qe(e, t) {
926
919
  }
927
920
  });
928
921
  }
929
- var d = /* @__PURE__ */ ((e) => (e.OWNER = "owner", e.ADMIN = "admin", e.MOD = "mod", e.MEMBER = "member", e.GUEST = "guest", e.MUTED = "muted", e))(d || {});
922
+ var f = /* @__PURE__ */ ((e) => (e.OWNER = "owner", e.ADMIN = "admin", e.MOD = "mod", e.MEMBER = "member", e.GUEST = "guest", e.MUTED = "muted", e))(f || {});
930
923
  const _e = {
931
924
  owner: [
932
925
  "admin",
@@ -958,19 +951,19 @@ function Fe({
958
951
  userRole: t,
959
952
  subscribed: n
960
953
  }) {
961
- const o = t === d.MUTED ? !1 : e === "Topic" ? !0 : [d.OWNER, d.ADMIN, d.MOD, d.MEMBER].includes(
954
+ const o = t === f.MUTED ? !1 : e === "Topic" ? !0 : [f.OWNER, f.ADMIN, f.MOD, f.MEMBER].includes(
962
955
  t
963
956
  ), r = (() => {
964
- if (t === d.MUTED) return !1;
957
+ if (t === f.MUTED) return !1;
965
958
  switch (e) {
966
959
  case "Topic":
967
960
  return !0;
968
961
  case "Journal":
969
- return t !== d.GUEST || n;
962
+ return t !== f.GUEST || n;
970
963
  case "Council":
971
964
  return o;
972
965
  }
973
- })(), c = [d.OWNER, d.ADMIN, d.MOD].includes(t);
966
+ })(), c = [f.OWNER, f.ADMIN, f.MOD].includes(t);
974
967
  return {
975
968
  canPost: o,
976
969
  canComment: r,
@@ -979,13 +972,13 @@ function Fe({
979
972
  }
980
973
  export {
981
974
  i as CONFIG,
982
- C as ConfigManager,
983
- Ce as EcencyAnalytics,
984
- b as EcencyQueriesManager,
975
+ S as ConfigManager,
976
+ Se as EcencyAnalytics,
977
+ C as EcencyQueriesManager,
985
978
  U as HiveSignerIntegration,
986
979
  R as Keychain,
987
- d as ROLES,
988
- be as ThreeSpeakIntegration,
980
+ f as ROLES,
981
+ Ce as ThreeSpeakIntegration,
989
982
  B as broadcastJson,
990
983
  ne as checkUsernameWalletsPendingQueryOptions,
991
984
  y as getAccessToken,
@@ -999,7 +992,7 @@ export {
999
992
  Qe as getCommunityContextQueryOptions,
1000
993
  Fe as getCommunityPermissions,
1001
994
  je as getCommunityType,
1002
- O as getFragmentsQueryOptions,
995
+ b as getFragmentsQueryOptions,
1003
996
  ke as getGameStatusCheckQueryOptions,
1004
997
  ge as getHiveEngineTokensListQueryOptions,
1005
998
  T as getLoginType,
@@ -1011,7 +1004,7 @@ export {
1011
1004
  x as getRelationshipBetweenAccountsQueryOptions,
1012
1005
  te as getSearchAccountsByUsernameQueryOptions,
1013
1006
  we as getTrendingTagsQueryOptions,
1014
- f as getUser,
1007
+ d as getUser,
1015
1008
  ee as makeQueryClient,
1016
1009
  _e as roleMap,
1017
1010
  pe as useAccountFavouriteAdd,
@@ -1022,10 +1015,10 @@ export {
1022
1015
  ce as useBookmarkAdd,
1023
1016
  ue as useBookmarkDelete,
1024
1017
  I as useBroadcastMutation,
1025
- Oe as useEditFragment,
1018
+ be as useEditFragment,
1026
1019
  Te as useGameClaim,
1027
- Se as useRemoveFragment,
1028
- fe as useSignOperationByHivesigner,
1020
+ Oe as useRemoveFragment,
1021
+ de as useSignOperationByHivesigner,
1029
1022
  le as useSignOperationByKey,
1030
- de as useSignOperationByKeychain
1023
+ fe as useSignOperationByKeychain
1031
1024
  };
@@ -1,15 +1,12 @@
1
+ import { AccountProfile } from '../types';
1
2
  interface Payload {
2
- profile: Record<string, any>;
3
+ profile: Partial<AccountProfile>;
3
4
  tokens: {
4
5
  symbol: string;
5
6
  meta: {
6
7
  address: string;
7
8
  };
8
9
  }[];
9
- beneficiary: {
10
- username: string;
11
- reward: number;
12
- };
13
10
  }
14
11
  export declare function useAccountUpdate(username: string): import('@tanstack/react-query').UseMutationResult<any, Error, Partial<Payload>, unknown>;
15
12
  export {};
@@ -2,7 +2,20 @@ import { AccountFollowStats } from '../types';
2
2
  export declare function getAccountFullQueryOptions(username: string): import('@tanstack/query-core').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<{
3
3
  readonly follow_stats: AccountFollowStats | undefined;
4
4
  readonly reputation: number;
5
- readonly profile: any;
5
+ readonly profile: {
6
+ readonly reputation: number;
7
+ readonly about?: string;
8
+ readonly cover_image?: string;
9
+ readonly location?: string;
10
+ readonly name?: string;
11
+ readonly profile_image?: string;
12
+ readonly website?: string;
13
+ readonly pinned?: string;
14
+ readonly beneficiary?: {
15
+ account: string;
16
+ weight: number;
17
+ };
18
+ };
6
19
  readonly vesting_balance: string | import('@hiveio/dhive').Asset;
7
20
  readonly transfer_history: any[];
8
21
  readonly market_history: any[];
@@ -86,7 +99,20 @@ export declare function getAccountFullQueryOptions(username: string): import('@t
86
99
  }, Error, {
87
100
  readonly follow_stats: AccountFollowStats | undefined;
88
101
  readonly reputation: number;
89
- readonly profile: any;
102
+ readonly profile: {
103
+ readonly reputation: number;
104
+ readonly about?: string;
105
+ readonly cover_image?: string;
106
+ readonly location?: string;
107
+ readonly name?: string;
108
+ readonly profile_image?: string;
109
+ readonly website?: string;
110
+ readonly pinned?: string;
111
+ readonly beneficiary?: {
112
+ account: string;
113
+ weight: number;
114
+ };
115
+ };
90
116
  readonly vesting_balance: string | import('@hiveio/dhive').Asset;
91
117
  readonly transfer_history: any[];
92
118
  readonly market_history: any[];
@@ -171,7 +197,20 @@ export declare function getAccountFullQueryOptions(username: string): import('@t
171
197
  queryFn?: import('@tanstack/query-core').QueryFunction<{
172
198
  readonly follow_stats: AccountFollowStats | undefined;
173
199
  readonly reputation: number;
174
- readonly profile: any;
200
+ readonly profile: {
201
+ readonly reputation: number;
202
+ readonly about?: string;
203
+ readonly cover_image?: string;
204
+ readonly location?: string;
205
+ readonly name?: string;
206
+ readonly profile_image?: string;
207
+ readonly website?: string;
208
+ readonly pinned?: string;
209
+ readonly beneficiary?: {
210
+ account: string;
211
+ weight: number;
212
+ };
213
+ };
175
214
  readonly vesting_balance: string | import('@hiveio/dhive').Asset;
176
215
  readonly transfer_history: any[];
177
216
  readonly market_history: any[];
@@ -258,7 +297,20 @@ export declare function getAccountFullQueryOptions(username: string): import('@t
258
297
  [dataTagSymbol]: {
259
298
  readonly follow_stats: AccountFollowStats | undefined;
260
299
  readonly reputation: number;
261
- readonly profile: any;
300
+ readonly profile: {
301
+ readonly reputation: number;
302
+ readonly about?: string;
303
+ readonly cover_image?: string;
304
+ readonly location?: string;
305
+ readonly name?: string;
306
+ readonly profile_image?: string;
307
+ readonly website?: string;
308
+ readonly pinned?: string;
309
+ readonly beneficiary?: {
310
+ account: string;
311
+ weight: number;
312
+ };
313
+ };
262
314
  readonly vesting_balance: string | import('@hiveio/dhive').Asset;
263
315
  readonly transfer_history: any[];
264
316
  readonly market_history: any[];
@@ -0,0 +1,13 @@
1
+ export interface AccountProfile {
2
+ about?: string;
3
+ cover_image?: string;
4
+ location?: string;
5
+ name?: string;
6
+ profile_image?: string;
7
+ website?: string;
8
+ pinned?: string;
9
+ beneficiary?: {
10
+ account: string;
11
+ weight: number;
12
+ };
13
+ }
@@ -3,3 +3,4 @@ export * from './account-reputation';
3
3
  export * from './account-relationship';
4
4
  export * from './account-bookmark';
5
5
  export * from './account-favourite';
6
+ export * from './account-profile';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ecency/sdk",
3
3
  "private": false,
4
- "version": "1.0.55",
4
+ "version": "1.0.56",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "main": "./dist/ecency-sdk.umd.js",