@postrun/react 2.1.0 → 2.2.0

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/index.cjs CHANGED
@@ -140,6 +140,10 @@ var connectionKeys = {
140
140
  detail: (id) => [...connectionKeys.details(), id],
141
141
  accounts: (id) => [...connectionKeys.all, "accounts", id]
142
142
  };
143
+ var tiktokKeys = {
144
+ all: [ROOT, "tiktok"],
145
+ creatorInfo: (connectionId) => [...tiktokKeys.all, "creator-info", connectionId]
146
+ };
143
147
 
144
148
  // src/profiles.ts
145
149
  function useProfiles(query) {
@@ -964,6 +968,19 @@ function useDeletePost() {
964
968
  queryClient
965
969
  );
966
970
  }
971
+ function useTikTokCreatorInfo(connectionId) {
972
+ const { client, queryClient } = usePostrun();
973
+ return reactQuery.useQuery(
974
+ {
975
+ // `connectionId ?? ''` only ever keys the cache when the query is enabled
976
+ // (a non-null id), so the empty fallback is never used to fetch.
977
+ queryKey: tiktokKeys.creatorInfo(connectionId ?? ""),
978
+ queryFn: async () => (await js.tiktokCreatorInfo({ client, path: { id: connectionId ?? "" } })).data,
979
+ enabled: connectionId !== null
980
+ },
981
+ queryClient
982
+ );
983
+ }
967
984
  function fileKey(file) {
968
985
  return file ? `${file.name}:${file.size}:${file.lastModified}` : "";
969
986
  }
@@ -1688,6 +1705,7 @@ exports.connectionKeys = connectionKeys;
1688
1705
  exports.mediaKeys = mediaKeys;
1689
1706
  exports.postKeys = postKeys;
1690
1707
  exports.profileKeys = profileKeys;
1708
+ exports.tiktokKeys = tiktokKeys;
1691
1709
  exports.useCalendar = useCalendar;
1692
1710
  exports.useConnect = useConnect;
1693
1711
  exports.useConnection = useConnection;
@@ -1712,6 +1730,7 @@ exports.useProfile = useProfile;
1712
1730
  exports.useProfiles = useProfiles;
1713
1731
  exports.useProfilesInfinite = useProfilesInfinite;
1714
1732
  exports.useSelectAccount = useSelectAccount;
1733
+ exports.useTikTokCreatorInfo = useTikTokCreatorInfo;
1715
1734
  exports.useUpdateMedia = useUpdateMedia;
1716
1735
  exports.useUpdatePost = useUpdatePost;
1717
1736
  exports.useUpdateProfile = useUpdateProfile;