@integration-app/react
Advanced tools
Comparing version 0.1.14 to 0.1.15
@@ -10,3 +10,3 @@ import { IntegrationAppClient } from '@integration-app/sdk'; | ||
export declare const IntegrationAppProvider: ({ token, apiUri, uiUri, children, }: IntegrationAppProviderProps) => JSX.Element; | ||
export declare function useIntegrationApp(): IntegrationAppClient; | ||
export default function useIntegrationApp(): IntegrationAppClient; | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.useIntegrationApp = exports.IntegrationAppProvider = void 0; | ||
exports.IntegrationAppProvider = void 0; | ||
const jsx_runtime_1 = require("react/jsx-runtime"); | ||
@@ -21,3 +21,3 @@ const sdk_1 = require("@integration-app/sdk"); | ||
} | ||
exports.useIntegrationApp = useIntegrationApp; | ||
exports.default = useIntegrationApp; | ||
//# sourceMappingURL=integration-app-context.js.map |
@@ -5,6 +5,6 @@ "use strict"; | ||
const tslib_1 = require("tslib"); | ||
const integration_app_context_1 = require("../contexts/integration-app-context"); | ||
const integration_app_context_1 = tslib_1.__importDefault(require("../contexts/integration-app-context")); | ||
const useGetter_1 = tslib_1.__importDefault(require("../hooks/useGetter")); | ||
function useDataSourceCollection(dataSource) { | ||
const integrationApp = (0, integration_app_context_1.useIntegrationApp)(); | ||
const integrationApp = (0, integration_app_context_1.default)(); | ||
const { data: collection, ...rest } = (0, useGetter_1.default)(dataSource?.id, () => integrationApp.dataSourceInstance(dataSource.id).getCollection()); | ||
@@ -11,0 +11,0 @@ return { |
@@ -5,6 +5,6 @@ "use strict"; | ||
const tslib_1 = require("tslib"); | ||
const integration_app_context_1 = require("../contexts/integration-app-context"); | ||
const integration_app_context_1 = tslib_1.__importDefault(require("../contexts/integration-app-context")); | ||
const useGetter_1 = tslib_1.__importDefault(require("../hooks/useGetter")); | ||
function useDataSourceLocations(dataSource, args) { | ||
const integrationApp = (0, integration_app_context_1.useIntegrationApp)(); | ||
const integrationApp = (0, integration_app_context_1.default)(); | ||
const { data, ...rest } = (0, useGetter_1.default)(dataSource ? `dataSource?.id/${JSON.stringify(args)}` : undefined, () => integrationApp.dataSourceInstance(dataSource.id).getLocations(args)); | ||
@@ -11,0 +11,0 @@ return { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.useElement = void 0; | ||
const tslib_1 = require("tslib"); | ||
const react_1 = require("react"); | ||
const integration_app_context_1 = require("../contexts/integration-app-context"); | ||
const integration_app_context_1 = tslib_1.__importDefault(require("../contexts/integration-app-context")); | ||
function useElement(props, accessorGenerator) { | ||
const integrationApp = (0, integration_app_context_1.useIntegrationApp)(); | ||
const integrationApp = (0, integration_app_context_1.default)(); | ||
const [data, setData] = (0, react_1.useState)(); | ||
@@ -9,0 +10,0 @@ const [loading, setLoading] = (0, react_1.useState)(true); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.useElements = void 0; | ||
const integration_app_context_1 = require("../contexts/integration-app-context"); | ||
const tslib_1 = require("tslib"); | ||
const integration_app_context_1 = tslib_1.__importDefault(require("../contexts/integration-app-context")); | ||
const react_1 = require("react"); | ||
function useElements(initialQuery, accessorGenerator) { | ||
const integrationApp = (0, integration_app_context_1.useIntegrationApp)(); | ||
const integrationApp = (0, integration_app_context_1.default)(); | ||
const [items, setItems] = (0, react_1.useState)([]); | ||
const [nextCursor, setNextCursor] = (0, react_1.useState)(undefined); | ||
const [loading, setLoading] = (0, react_1.useState)(true); | ||
const [loading, setLoading] = (0, react_1.useState)(false); | ||
const [error, setError] = (0, react_1.useState)(null); | ||
function loadMore() { | ||
async function loadMore() { | ||
setError(null); | ||
@@ -20,10 +21,13 @@ setLoading(true); | ||
queryParams.cursor = nextCursor; | ||
return accessorGenerator(integrationApp) | ||
.find(queryParams) | ||
.then((data) => { | ||
try { | ||
const data = await accessorGenerator(integrationApp).find(queryParams); | ||
setNextCursor(data.cursor); | ||
setItems((prevItems) => [...prevItems, ...data.items]); | ||
}) | ||
.catch(setError) | ||
.finally(() => setLoading(false)); | ||
setItems([...items, ...data.items]); | ||
} | ||
catch (e) { | ||
setError(e); | ||
} | ||
finally { | ||
setLoading(false); | ||
} | ||
} | ||
@@ -30,0 +34,0 @@ (0, react_1.useEffect)(() => { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
const react_1 = require("react"); | ||
const integration_app_context_1 = require("../contexts/integration-app-context"); | ||
const integration_app_context_1 = tslib_1.__importDefault(require("../contexts/integration-app-context")); | ||
function useGetter(key, getter) { | ||
const integrationApp = (0, integration_app_context_1.useIntegrationApp)(); | ||
const integrationApp = (0, integration_app_context_1.default)(); | ||
const [data, setData] = (0, react_1.useState)(); | ||
@@ -8,0 +9,0 @@ const [loading, setLoading] = (0, react_1.useState)(true); |
@@ -1,2 +0,2 @@ | ||
export { useIntegrationApp, IntegrationAppProvider, } from './contexts/integration-app-context'; | ||
export { default as useIntegrationApp, IntegrationAppProvider, } from './contexts/integration-app-context'; | ||
export { useConnectorSpec } from './integrations/useConnectionSpec'; | ||
@@ -3,0 +3,0 @@ export { useIntegration } from './integrations/useIntegration'; |
@@ -5,3 +5,3 @@ "use strict"; | ||
var integration_app_context_1 = require("./contexts/integration-app-context"); | ||
Object.defineProperty(exports, "useIntegrationApp", { enumerable: true, get: function () { return integration_app_context_1.useIntegrationApp; } }); | ||
Object.defineProperty(exports, "useIntegrationApp", { enumerable: true, get: function () { return __importDefault(integration_app_context_1).default; } }); | ||
Object.defineProperty(exports, "IntegrationAppProvider", { enumerable: true, get: function () { return integration_app_context_1.IntegrationAppProvider; } }); | ||
@@ -8,0 +8,0 @@ var useConnectionSpec_1 = require("./integrations/useConnectionSpec"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.useConnectorSpec = void 0; | ||
const tslib_1 = require("tslib"); | ||
const react_1 = require("react"); | ||
const integration_app_context_1 = require("../contexts/integration-app-context"); | ||
const integration_app_context_1 = tslib_1.__importDefault(require("../contexts/integration-app-context")); | ||
function useConnectorSpec(integrationKey) { | ||
const integrationApp = (0, integration_app_context_1.useIntegrationApp)(); | ||
const integrationApp = (0, integration_app_context_1.default)(); | ||
const [data, setData] = (0, react_1.useState)(null); | ||
@@ -9,0 +10,0 @@ const [loading, setLoading] = (0, react_1.useState)(true); |
{ | ||
"name": "@integration-app/react", | ||
"version": "0.1.14", | ||
"version": "0.1.15", | ||
"description": "React SDK for building native integrations.", | ||
@@ -5,0 +5,0 @@ "author": "integration.app", |
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
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
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
47784
684