@cord-sdk/react
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -10,8 +10,7 @@ import React from 'react'; | ||
declare type Props = { | ||
sessionToken?: string | undefined | null; | ||
clientAuthToken?: string | undefined | null; | ||
clientAuthToken: string | undefined | null; | ||
enableTasks?: boolean; | ||
cordScriptUrl?: string; | ||
}; | ||
export declare function CordProvider({ sessionToken, clientAuthToken, enableTasks, cordScriptUrl, children, }: React.PropsWithChildren<Props>): JSX.Element; | ||
export declare function CordProvider({ clientAuthToken, enableTasks, cordScriptUrl, children, }: React.PropsWithChildren<Props>): JSX.Element; | ||
export {}; |
@@ -1,4 +0,3 @@ | ||
/// <reference types="react" /> | ||
export declare function useCustomEventListeners<T extends Record<string, unknown[]>>(events: { | ||
[P in keyof T]: ((...args: T[P]) => unknown) | undefined; | ||
}): import("react").Dispatch<import("react").SetStateAction<Element | null>>; |
@@ -79,3 +79,3 @@ 'use strict'; | ||
function CordProvider(_a) { | ||
var sessionToken = _a.sessionToken, clientAuthToken = _a.clientAuthToken, enableTasks = _a.enableTasks, cordScriptUrl = _a.cordScriptUrl, children = _a.children; | ||
var clientAuthToken = _a.clientAuthToken, enableTasks = _a.enableTasks, cordScriptUrl = _a.cordScriptUrl, children = _a.children; | ||
var _b = React.useState(null), sdk = _b[0], setSDK = _b[1]; | ||
@@ -106,6 +106,8 @@ var _c = React.useState(), context = _c[0], setContext = _c[1]; | ||
React.useEffect(function () { | ||
if (sdk && (sessionToken || clientAuthToken)) { | ||
var token = clientAuthToken || sessionToken; | ||
if (sdk && clientAuthToken) { | ||
sdk | ||
.init({ client_auth_token: token, enable_tasks: enableTasks }) | ||
.init({ | ||
client_auth_token: clientAuthToken, | ||
enable_tasks: enableTasks, | ||
}) | ||
.then(function () { | ||
@@ -121,3 +123,3 @@ setSDK(sdk); | ||
} | ||
}, [sdk, sessionToken, clientAuthToken, enableTasks]); | ||
}, [sdk, clientAuthToken, enableTasks]); | ||
var value = React.useMemo(function () { return ({ sdk: sdk, context: context, setContext: setContext }); }, [sdk, context, setContext]); | ||
@@ -124,0 +126,0 @@ return React__default["default"].createElement(CordContext.Provider, { value: value }, children); |
{ | ||
"name": "@cord-sdk/react", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"homepage": "https://docs.cord.com/", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
440
62777