Merge branch 'libracart' into staging_environment
This commit is contained in:
commit
a4982af00e
3 changed files with 46 additions and 21 deletions
2
package-lock.json
generated
2
package-lock.json
generated
|
|
@ -10911,7 +10911,7 @@
|
||||||
},
|
},
|
||||||
"node_modules/protobuf-ts": {
|
"node_modules/protobuf-ts": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#0e34386a27695f7cd98099015870a19c38f62bc6",
|
"resolved": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#87f996caee82bac1cca2743d4158e38a1a13320e",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"protobufjs": "^6.8.8"
|
"protobufjs": "^6.8.8"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ import {
|
||||||
import ResponsiveDialog from "common/ResponsiveDialog";
|
import ResponsiveDialog from "common/ResponsiveDialog";
|
||||||
import { teamScope, User } from "models";
|
import { teamScope, User } from "models";
|
||||||
import { pond } from "protobuf-ts/pond";
|
import { pond } from "protobuf-ts/pond";
|
||||||
import { useSnackbar, useUserAPI } from "providers";
|
import { useGlobalState, useSnackbar, useUserAPI } from "providers";
|
||||||
import { useLibraCartProxyAPI } from "providers/pond/libracartProxyAPI";
|
import { useLibraCartProxyAPI } from "providers/pond/libracartProxyAPI";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import TeamSearch from "teams/TeamSearch";
|
import TeamSearch from "teams/TeamSearch";
|
||||||
|
|
@ -33,7 +33,7 @@ export default function LibraCartAccess() {
|
||||||
const libracartAPI = useLibraCartProxyAPI();
|
const libracartAPI = useLibraCartProxyAPI();
|
||||||
//const [dataOps, setDataOps] = useState<pond.DataOption[]>([]);
|
//const [dataOps, setDataOps] = useState<pond.DataOption[]>([]);
|
||||||
const { openSnack } = useSnackbar();
|
const { openSnack } = useSnackbar();
|
||||||
//const [{ as }] = useGlobalState();
|
const [{ as }] = useGlobalState();
|
||||||
|
|
||||||
|
|
||||||
const submitNewOrganization = () => {
|
const submitNewOrganization = () => {
|
||||||
|
|
@ -174,28 +174,45 @@ export default function LibraCartAccess() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box style={{ padding: 10 }}>
|
<Box style={{ padding: 10 }}>
|
||||||
<Grid container direction="row" alignContent="center" alignItems="center" wrap="nowrap">
|
<Grid container direction="row" alignContent="center" alignItems="center" wrap="nowrap" width="100%" justifyContent="space-between">
|
||||||
<Grid>
|
<Grid container direction="row" alignContent="center" alignItems="center" wrap="nowrap">
|
||||||
<Button
|
<Grid>
|
||||||
variant="contained"
|
<Button
|
||||||
color="primary"
|
variant="contained"
|
||||||
onClick={e => {
|
color="primary"
|
||||||
e.preventDefault();
|
onClick={e => {
|
||||||
window.open(`https://staging.cloud.agrimatics.com/grain/integrations`, "_blank");
|
e.preventDefault();
|
||||||
}}>
|
window.open(`https://staging.cloud.agrimatics.com/grain/integrations`, "_blank");
|
||||||
Link Libra Cart Account
|
}}>
|
||||||
</Button>
|
Link Libra Cart Account
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
<Grid>
|
||||||
|
<Tooltip
|
||||||
|
title='The integration can be found by selecting my account in the corner,
|
||||||
|
selecting the "Manage Account" option and then selecting integrations in the left side menu'>
|
||||||
|
<Help />
|
||||||
|
</Tooltip>
|
||||||
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Tooltip
|
<Tooltip title={"This will Sync the data for all LibraCart accounts linked to " + (as ? "this team" : "your account")}>
|
||||||
title='The integration can be found by selecting my account in the corner, selecting the "Manage Account" option and then selecting integrations in the left side menu'
|
<Button
|
||||||
>
|
variant="contained"
|
||||||
<Help />
|
color="primary"
|
||||||
|
onClick={e => {
|
||||||
|
libracartAPI.syncData().then(resp => {}).catch(err => {})
|
||||||
|
}}>
|
||||||
|
Sync
|
||||||
|
</Button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
<Box paddingTop={2}>
|
||||||
|
<Typography>
|
||||||
|
LibraCart data will sync every 6 hours, if the data is needed immediately you can select the Sync button. It may take up to 15 minutes for the data to appear in our platform.
|
||||||
|
</Typography>
|
||||||
|
</Box>
|
||||||
|
|
||||||
{newOrgDialog()}
|
{newOrgDialog()}
|
||||||
</Box>
|
</Box>
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import { pond } from "protobuf-ts/pond";
|
||||||
import React, { createContext, PropsWithChildren, useContext } from "react";
|
import React, { createContext, PropsWithChildren, useContext } from "react";
|
||||||
//import { or } from "utils";
|
//import { or } from "utils";
|
||||||
import { pondURL } from "./pond";
|
import { pondURL } from "./pond";
|
||||||
|
import { useGlobalState } from "providers/StateContainer";
|
||||||
|
|
||||||
export interface ILibraCartProxyAPIContext {
|
export interface ILibraCartProxyAPIContext {
|
||||||
//add new organization
|
//add new organization
|
||||||
|
|
@ -33,6 +34,7 @@ export interface ILibraCartProxyAPIContext {
|
||||||
libracartKey?: string,
|
libracartKey?: string,
|
||||||
as?: string
|
as?: string
|
||||||
) => Promise<AxiosResponse<pond.ListLibraCartDestinationsResponse>>;
|
) => Promise<AxiosResponse<pond.ListLibraCartDestinationsResponse>>;
|
||||||
|
syncData: () => Promise<any>
|
||||||
}
|
}
|
||||||
|
|
||||||
export const LibraCartProxyAPIContext = createContext<ILibraCartProxyAPIContext>(
|
export const LibraCartProxyAPIContext = createContext<ILibraCartProxyAPIContext>(
|
||||||
|
|
@ -43,6 +45,7 @@ interface Props {}
|
||||||
|
|
||||||
export default function LibraCartProvider(props: PropsWithChildren<Props>) {
|
export default function LibraCartProvider(props: PropsWithChildren<Props>) {
|
||||||
const { children } = props;
|
const { children } = props;
|
||||||
|
const [{as}] = useGlobalState();
|
||||||
const { post, get, put } = useHTTP();
|
const { post, get, put } = useHTTP();
|
||||||
|
|
||||||
const addAccount = (
|
const addAccount = (
|
||||||
|
|
@ -104,13 +107,18 @@ export default function LibraCartProvider(props: PropsWithChildren<Props>) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const syncData = () => {
|
||||||
|
return get(pondURL("/libracartImport" + (as ? "?as=" + as : "")))
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<LibraCartProxyAPIContext.Provider
|
<LibraCartProxyAPIContext.Provider
|
||||||
value={{
|
value={{
|
||||||
addAccount,
|
addAccount,
|
||||||
listAccounts,
|
listAccounts,
|
||||||
updateAccount,
|
updateAccount,
|
||||||
listDestinations
|
listDestinations,
|
||||||
|
syncData
|
||||||
}}>
|
}}>
|
||||||
{children}
|
{children}
|
||||||
</LibraCartProxyAPIContext.Provider>
|
</LibraCartProxyAPIContext.Provider>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue