@arbidocs/react 0.5.69 → 0.5.70

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
@@ -6817,6 +6817,32 @@ function useClaimNativeAlias(onClaimed) {
6817
6817
  }
6818
6818
  });
6819
6819
  }
6820
+ function useClaimSecureMail() {
6821
+ const arbi = chunkY7S2SQH3_cjs.useArbi();
6822
+ const { client } = useMailClient();
6823
+ const queryClient = reactQuery.useQueryClient();
6824
+ const keys = React.useRef(/* @__PURE__ */ new Map());
6825
+ const mutation = reactQuery.useMutation({
6826
+ mutationFn: (id) => {
6827
+ const fragmentKey = keys.current.get(id);
6828
+ keys.current.delete(id);
6829
+ if (!fragmentKey) return Promise.reject(new Error("Open the original link from your email"));
6830
+ return arbi.secureMail.claim(id, fragmentKey, client.fetch);
6831
+ },
6832
+ networkMode: "always",
6833
+ gcTime: 0,
6834
+ onSuccess: () => queryClient.invalidateQueries({ queryKey: chunkGQAXAZN7_cjs.mailQueryKeys.all() })
6835
+ });
6836
+ const { mutateAsync } = mutation;
6837
+ const claim = React.useCallback(
6838
+ (id, fragmentKey) => {
6839
+ keys.current.set(id, fragmentKey);
6840
+ return mutateAsync(id);
6841
+ },
6842
+ [mutateAsync]
6843
+ );
6844
+ return { claim, isPending: mutation.isPending };
6845
+ }
6820
6846
  function useConnectMailAccount() {
6821
6847
  const { client } = useMailClient();
6822
6848
  const queryClient = reactQuery.useQueryClient();
@@ -17407,6 +17433,7 @@ exports.useChatThread = useChatThread;
17407
17433
  exports.useChatUnreadTotal = useChatUnreadTotal;
17408
17434
  exports.useChats = useChats;
17409
17435
  exports.useClaimNativeAlias = useClaimNativeAlias;
17436
+ exports.useClaimSecureMail = useClaimSecureMail;
17410
17437
  exports.useCloseAgentSession = useCloseAgentSession;
17411
17438
  exports.useCommandPalette = useCommandPalette;
17412
17439
  exports.useConfigSchema = useConfigSchema;