@clerk/nextjs
Version:
Clerk SDK for NextJS
26 lines • 942 B
JavaScript
import "../../chunk-BUSYA2B4.js";
import React, { useEffect } from "react";
import { createOrReadKeylessAction } from "../keyless-actions";
const KeylessCreatorOrReader = (props) => {
const { children } = props;
const [state, fetchKeys] = React.useActionState(createOrReadKeylessAction, null);
useEffect(() => {
React.startTransition(() => {
fetchKeys();
});
}, []);
if (!React.isValidElement(children)) {
return children;
}
return React.cloneElement(children, {
key: state == null ? void 0 : state.publishableKey,
publishableKey: state == null ? void 0 : state.publishableKey,
__internal_keyless_claimKeylessApplicationUrl: state == null ? void 0 : state.claimUrl,
__internal_keyless_copyInstanceKeysUrl: state == null ? void 0 : state.apiKeysUrl,
__internal_bypassMissingPublishableKey: true
});
};
export {
KeylessCreatorOrReader
};
//# sourceMappingURL=keyless-creator-reader.js.map