@postrun/react 2.0.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 +26 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +91 -5
- package/dist/index.d.ts +91 -5
- package/dist/index.js +26 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
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) {
|
|
@@ -889,12 +893,18 @@ function useCreatePost(profileId) {
|
|
|
889
893
|
},
|
|
890
894
|
queryClient
|
|
891
895
|
);
|
|
896
|
+
const post = mutation.data;
|
|
892
897
|
return {
|
|
893
898
|
create: mutation.mutateAsync,
|
|
894
899
|
isPending: mutation.isPending,
|
|
895
900
|
error: mutation.error,
|
|
896
|
-
data:
|
|
901
|
+
data: post,
|
|
897
902
|
reset: mutation.reset,
|
|
903
|
+
// Derived publish outcome (see the JSDoc above) — `undefined`/`false`/`[]`
|
|
904
|
+
// until the first create resolves; computed from the returned post only.
|
|
905
|
+
status: post?.status,
|
|
906
|
+
isPublished: post ? js.isPublished(post) : false,
|
|
907
|
+
failedVariants: post ? js.failedVariants(post) : [],
|
|
898
908
|
// The profile's connections must load before `create` can resolve a channel;
|
|
899
909
|
// gate on this so a call during loading isn't mislabeled "not connected".
|
|
900
910
|
isReady: connections.isSuccess,
|
|
@@ -958,6 +968,19 @@ function useDeletePost() {
|
|
|
958
968
|
queryClient
|
|
959
969
|
);
|
|
960
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
|
+
}
|
|
961
984
|
function fileKey(file) {
|
|
962
985
|
return file ? `${file.name}:${file.size}:${file.lastModified}` : "";
|
|
963
986
|
}
|
|
@@ -1682,6 +1705,7 @@ exports.connectionKeys = connectionKeys;
|
|
|
1682
1705
|
exports.mediaKeys = mediaKeys;
|
|
1683
1706
|
exports.postKeys = postKeys;
|
|
1684
1707
|
exports.profileKeys = profileKeys;
|
|
1708
|
+
exports.tiktokKeys = tiktokKeys;
|
|
1685
1709
|
exports.useCalendar = useCalendar;
|
|
1686
1710
|
exports.useConnect = useConnect;
|
|
1687
1711
|
exports.useConnection = useConnection;
|
|
@@ -1706,6 +1730,7 @@ exports.useProfile = useProfile;
|
|
|
1706
1730
|
exports.useProfiles = useProfiles;
|
|
1707
1731
|
exports.useProfilesInfinite = useProfilesInfinite;
|
|
1708
1732
|
exports.useSelectAccount = useSelectAccount;
|
|
1733
|
+
exports.useTikTokCreatorInfo = useTikTokCreatorInfo;
|
|
1709
1734
|
exports.useUpdateMedia = useUpdateMedia;
|
|
1710
1735
|
exports.useUpdatePost = useUpdatePost;
|
|
1711
1736
|
exports.useUpdateProfile = useUpdateProfile;
|