@ecency/sdk 1.1.21 → 1.1.22

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,8 +1,8 @@
1
1
  var V = Object.defineProperty;
2
2
  var W = (e, t, n) => t in e ? V(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var T = (e, t, n) => W(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { QueryClient as F, useMutation as d, useQuery as S, useInfiniteQuery as z, queryOptions as p, useQueryClient as P, infiniteQueryOptions as $ } from "@tanstack/react-query";
5
- import { Client as R, PrivateKey as _, cryptoUtils as L, RCAPI as X } from "@hiveio/dhive";
4
+ import { QueryClient as F, useMutation as d, useQuery as S, useInfiniteQuery as z, queryOptions as p, useQueryClient as P, infiniteQueryOptions as R } from "@tanstack/react-query";
5
+ import { Client as $, PrivateKey as _, cryptoUtils as L, RCAPI as X } from "@hiveio/dhive";
6
6
  import K from "hivesigner";
7
7
  import * as f from "remeda";
8
8
  class Y {
@@ -29,7 +29,7 @@ const c = {
29
29
  privateApiHost: "https://ecency.com",
30
30
  storage: typeof window > "u" ? new Y() : window.localStorage,
31
31
  storagePrefix: "ecency",
32
- hiveClient: new R(
32
+ hiveClient: new $(
33
33
  [
34
34
  "https://api.hive.blog",
35
35
  "https://api.deathwing.me",
@@ -268,9 +268,9 @@ function we() {
268
268
  ), o = await c.hiveClient.database.call(
269
269
  "get_reward_fund",
270
270
  ["post"]
271
- ), r = m(e.total_vesting_fund_hive).amount / m(e.total_vesting_shares).amount * 1e6, a = m(t.current_median_history.base).amount, s = m(t.current_median_history.quote).amount, i = parseFloat(o.recent_claims), u = m(o.reward_balance).amount, h = e.hbd_print_rate, k = e.hbd_interest_rate, O = e.head_block_number, N = m(
271
+ ), r = m(e.total_vesting_fund_hive).amount / m(e.total_vesting_shares).amount * 1e6, a = m(t.current_median_history.base).amount, s = m(t.current_median_history.quote).amount, i = parseFloat(o.recent_claims), u = m(o.reward_balance).amount, h = e.hbd_print_rate, k = e.hbd_interest_rate, O = e.head_block_number, I = m(
272
272
  e.total_vesting_fund_hive
273
- ).amount, I = m(
273
+ ).amount, M = m(
274
274
  e.total_vesting_shares
275
275
  ).amount, x = m(e.virtual_supply).amount, U = e.vesting_reward_percent, G = n.account_creation_fee;
276
276
  return {
@@ -282,8 +282,8 @@ function we() {
282
282
  hbdPrintRate: h,
283
283
  hbdInterestRate: k,
284
284
  headBlock: O,
285
- totalVestingFund: N,
286
- totalVestingShares: I,
285
+ totalVestingFund: I,
286
+ totalVestingShares: M,
287
287
  virtualSupply: x,
288
288
  vestingRewardPercent: U,
289
289
  accountCreationFee: G
@@ -512,7 +512,7 @@ function D({
512
512
  function Ae(e) {
513
513
  const t = P(), { data: n } = S(b(e));
514
514
  return ne(
515
- ["accounts", "update", n == null ? void 0 : n.name],
515
+ ["accounts", "update"],
516
516
  e,
517
517
  (o) => {
518
518
  if (!n)
@@ -935,7 +935,7 @@ function Je(e) {
935
935
  }
936
936
  });
937
937
  }
938
- function Me(e, t = "Active") {
938
+ function Ne(e, t = "Active") {
939
939
  return d({
940
940
  mutationKey: ["operations", "sign-keychain", e],
941
941
  mutationFn: ({ operation: n }) => {
@@ -947,21 +947,21 @@ function Me(e, t = "Active") {
947
947
  }
948
948
  });
949
949
  }
950
- function Ne(e = "/") {
950
+ function Ie(e = "/") {
951
951
  return d({
952
952
  mutationKey: ["operations", "sign-hivesigner", e],
953
953
  mutationFn: async ({ operation: t }) => K.sendOperation(t, { callback: e }, () => {
954
954
  })
955
955
  });
956
956
  }
957
- function Ie() {
957
+ function Me() {
958
958
  return p({
959
959
  queryKey: ["operations", "chain-properties"],
960
960
  queryFn: async () => await c.hiveClient.database.getChainProperties()
961
961
  });
962
962
  }
963
963
  function xe(e = 20) {
964
- return $({
964
+ return R({
965
965
  queryKey: ["posts", "trending-tags"],
966
966
  queryFn: async ({ pageParam: { afterTag: t } }) => c.hiveClient.database.call("get_trending_tags", [t, e]).then(
967
967
  (n) => n.filter((o) => o.name !== "").filter((o) => !o.name.startsWith("hive-")).map((o) => o.name)
@@ -1085,7 +1085,7 @@ function We(e, t) {
1085
1085
  }
1086
1086
  });
1087
1087
  }
1088
- function M(e, t) {
1088
+ function N(e, t) {
1089
1089
  return d({
1090
1090
  mutationKey: ["analytics", t],
1091
1091
  mutationFn: async () => {
@@ -1110,7 +1110,7 @@ function M(e, t) {
1110
1110
  }
1111
1111
  const ze = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1112
1112
  __proto__: null,
1113
- useRecordActivity: M
1113
+ useRecordActivity: N
1114
1114
  }, Symbol.toStringTag, { value: "Module" }));
1115
1115
  function ce(e, t) {
1116
1116
  return p({
@@ -1183,10 +1183,10 @@ const de = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1183
1183
  __proto__: null,
1184
1184
  getAccountTokenQueryOptions: q,
1185
1185
  getAccountVideosQueryOptions: ye
1186
- }, Symbol.toStringTag, { value: "Module" })), $e = {
1186
+ }, Symbol.toStringTag, { value: "Module" })), Re = {
1187
1187
  queries: de
1188
1188
  };
1189
- function Re(e) {
1189
+ function $e(e) {
1190
1190
  return p({
1191
1191
  queryKey: ["integrations", "hiveposh", "links", e],
1192
1192
  queryFn: async () => {
@@ -1211,7 +1211,29 @@ function Re(e) {
1211
1211
  }
1212
1212
  });
1213
1213
  }
1214
- function Le() {
1214
+ function Le({
1215
+ url: e,
1216
+ dimensions: t = [],
1217
+ metrics: n = ["visitors", "pageviews", "visit_duration"],
1218
+ enabled: o = !0
1219
+ }) {
1220
+ return p({
1221
+ queryKey: ["integrations", "plausible", e, t, n],
1222
+ queryFn: async () => await (await fetch("https://ecency.com/api/stats", {
1223
+ method: "POST",
1224
+ body: JSON.stringify({
1225
+ metrics: n,
1226
+ url: encodeURIComponent(e),
1227
+ dimensions: t
1228
+ }),
1229
+ headers: {
1230
+ "Content-Type": "application/json"
1231
+ }
1232
+ })).json(),
1233
+ enabled: !!e && o
1234
+ });
1235
+ }
1236
+ function Xe() {
1215
1237
  return p({
1216
1238
  queryKey: ["resource-credits", "stats"],
1217
1239
  queryFn: async () => (await c.hiveClient.call(
@@ -1221,14 +1243,14 @@ function Le() {
1221
1243
  )).rc_stats
1222
1244
  });
1223
1245
  }
1224
- function Xe(e) {
1246
+ function Ye(e) {
1225
1247
  return p({
1226
1248
  queryKey: ["resource-credits", "account", e],
1227
1249
  queryFn: async () => new X(c.hiveClient).findRCAccounts([e]),
1228
1250
  enabled: !!e
1229
1251
  });
1230
1252
  }
1231
- function Ye(e, t) {
1253
+ function Ze(e, t) {
1232
1254
  return p({
1233
1255
  queryKey: ["games", "status-check", t, e],
1234
1256
  enabled: !!e,
@@ -1251,8 +1273,8 @@ function Ye(e, t) {
1251
1273
  }
1252
1274
  });
1253
1275
  }
1254
- function Ze(e, t, n) {
1255
- const { mutateAsync: o } = M(
1276
+ function et(e, t, n) {
1277
+ const { mutateAsync: o } = N(
1256
1278
  e,
1257
1279
  "spin-rolled"
1258
1280
  );
@@ -1281,7 +1303,7 @@ function Ze(e, t, n) {
1281
1303
  }
1282
1304
  });
1283
1305
  }
1284
- function et(e, t, n = 100, o = void 0, r = !0) {
1306
+ function tt(e, t, n = 100, o = void 0, r = !0) {
1285
1307
  return p({
1286
1308
  queryKey: ["communities", "list", e, t, n],
1287
1309
  enabled: r,
@@ -1301,7 +1323,7 @@ function et(e, t, n = 100, o = void 0, r = !0) {
1301
1323
  }
1302
1324
  });
1303
1325
  }
1304
- function tt(e, t) {
1326
+ function nt(e, t) {
1305
1327
  return p({
1306
1328
  queryKey: ["community", "context", e, t],
1307
1329
  enabled: !!e && !!t,
@@ -1322,7 +1344,7 @@ function tt(e, t) {
1322
1344
  });
1323
1345
  }
1324
1346
  var g = /* @__PURE__ */ ((e) => (e.OWNER = "owner", e.ADMIN = "admin", e.MOD = "mod", e.MEMBER = "member", e.GUEST = "guest", e.MUTED = "muted", e))(g || {});
1325
- const nt = {
1347
+ const ot = {
1326
1348
  owner: [
1327
1349
  "admin",
1328
1350
  "mod",
@@ -1345,10 +1367,10 @@ const nt = {
1345
1367
  /* MUTED */
1346
1368
  ]
1347
1369
  };
1348
- function ot(e, t) {
1370
+ function rt(e, t) {
1349
1371
  return e.startsWith("hive-3") || t === 3 ? "Council" : e.startsWith("hive-2") || t === 2 ? "Journal" : "Topic";
1350
1372
  }
1351
- function rt({
1373
+ function it({
1352
1374
  communityType: e,
1353
1375
  userRole: t,
1354
1376
  subscribed: n
@@ -1380,39 +1402,40 @@ export {
1380
1402
  pe as HiveSignerIntegration,
1381
1403
  ve as Keychain,
1382
1404
  g as ROLES,
1383
- $e as ThreeSpeakIntegration,
1405
+ Re as ThreeSpeakIntegration,
1384
1406
  oe as broadcastJson,
1385
1407
  Se as checkUsernameWalletsPendingQueryOptions,
1386
1408
  se as dedupeAndSortKeyAuths,
1387
1409
  l as getAccessToken,
1388
1410
  b as getAccountFullQueryOptions,
1389
1411
  qe as getAccountPendingRecoveryQueryOptions,
1390
- Xe as getAccountRcQueryOptions,
1412
+ Ye as getAccountRcQueryOptions,
1391
1413
  Oe as getAccountRecoveriesQueryOptions,
1392
1414
  ke as getAccountSubscriptionsQueryOptions,
1393
1415
  Ke as getActiveAccountBookmarksQueryOptions,
1394
1416
  Ce as getActiveAccountFavouritesQueryOptions,
1395
- Ie as getChainPropertiesQueryOptions,
1396
- et as getCommunitiesQueryOptions,
1397
- tt as getCommunityContextQueryOptions,
1398
- rt as getCommunityPermissions,
1399
- ot as getCommunityType,
1417
+ Me as getChainPropertiesQueryOptions,
1418
+ tt as getCommunitiesQueryOptions,
1419
+ nt as getCommunityContextQueryOptions,
1420
+ it as getCommunityPermissions,
1421
+ rt as getCommunityType,
1400
1422
  we as getDynamicPropsQueryOptions,
1401
1423
  A as getFragmentsQueryOptions,
1402
- Ye as getGameStatusCheckQueryOptions,
1403
- Re as getHivePoshLinksQueryOptions,
1424
+ Ze as getGameStatusCheckQueryOptions,
1425
+ $e as getHivePoshLinksQueryOptions,
1404
1426
  J as getLoginType,
1405
1427
  H as getPostingKey,
1406
1428
  Ue as getPromotedPostsQuery,
1407
1429
  y as getQueryClient,
1408
- Le as getRcStatsQueryOptions,
1430
+ Xe as getRcStatsQueryOptions,
1409
1431
  _e as getRefreshToken,
1410
1432
  re as getRelationshipBetweenAccountsQueryOptions,
1411
1433
  be as getSearchAccountsByUsernameQueryOptions,
1434
+ Le as getStatsQueryOptions,
1412
1435
  xe as getTrendingTagsQueryOptions,
1413
1436
  w as getUser,
1414
1437
  me as makeQueryClient,
1415
- nt as roleMap,
1438
+ ot as roleMap,
1416
1439
  De as useAccountFavouriteAdd,
1417
1440
  Fe as useAccountFavouriteDelete,
1418
1441
  Te as useAccountRelationsUpdate,
@@ -1427,9 +1450,9 @@ export {
1427
1450
  Qe as useBookmarkDelete,
1428
1451
  ne as useBroadcastMutation,
1429
1452
  Ve as useEditFragment,
1430
- Ze as useGameClaim,
1453
+ et as useGameClaim,
1431
1454
  We as useRemoveFragment,
1432
- Ne as useSignOperationByHivesigner,
1455
+ Ie as useSignOperationByHivesigner,
1433
1456
  Je as useSignOperationByKey,
1434
- Me as useSignOperationByKeychain
1457
+ Ne as useSignOperationByKeychain
1435
1458
  };
@@ -1,3 +1,4 @@
1
1
  export * from './3speak';
2
2
  export * from './hivesigner';
3
3
  export * from './hiveposh';
4
+ export * from './plausible';
@@ -0,0 +1 @@
1
+ export * from './queries';
@@ -0,0 +1,29 @@
1
+ export interface StatsResponse {
2
+ results: [
3
+ {
4
+ metrics: number[];
5
+ dimensions: string[];
6
+ }
7
+ ];
8
+ query: {
9
+ site_id: string;
10
+ metrics: string[];
11
+ date_range: string[];
12
+ filters: unknown[];
13
+ };
14
+ }
15
+ interface UseStatsQueryOptions {
16
+ url: string;
17
+ dimensions?: string[];
18
+ metrics?: string[];
19
+ enabled?: boolean;
20
+ }
21
+ export declare function getStatsQueryOptions({ url, dimensions, metrics, enabled, }: UseStatsQueryOptions): import('@tanstack/query-core').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<StatsResponse, Error, StatsResponse, (string | string[])[]>, "queryFn"> & {
22
+ queryFn?: import('@tanstack/query-core').QueryFunction<StatsResponse, (string | string[])[], never> | undefined;
23
+ } & {
24
+ queryKey: (string | string[])[] & {
25
+ [dataTagSymbol]: StatsResponse;
26
+ [dataTagErrorSymbol]: Error;
27
+ };
28
+ };
29
+ export {};
@@ -0,0 +1 @@
1
+ export * from './get-stats-query-options';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ecency/sdk",
3
3
  "private": false,
4
- "version": "1.1.21",
4
+ "version": "1.1.22",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "main": "./dist/ecency-sdk.umd.js",