diff --git a/package-lock.json b/package-lock.json index 81f47c4..5289754 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10911,7 +10911,7 @@ }, "node_modules/protobuf-ts": { "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": { "protobufjs": "^6.8.8" } diff --git a/src/integrations/LibraCart/LibraCartAccess.tsx b/src/integrations/LibraCart/LibraCartAccess.tsx index d075b8e..eb39433 100644 --- a/src/integrations/LibraCart/LibraCartAccess.tsx +++ b/src/integrations/LibraCart/LibraCartAccess.tsx @@ -15,7 +15,7 @@ import { import ResponsiveDialog from "common/ResponsiveDialog"; import { teamScope, User } from "models"; import { pond } from "protobuf-ts/pond"; -import { useSnackbar, useUserAPI } from "providers"; +import { useGlobalState, useSnackbar, useUserAPI } from "providers"; import { useLibraCartProxyAPI } from "providers/pond/libracartProxyAPI"; import React, { useEffect, useState } from "react"; import TeamSearch from "teams/TeamSearch"; @@ -33,7 +33,7 @@ export default function LibraCartAccess() { const libracartAPI = useLibraCartProxyAPI(); //const [dataOps, setDataOps] = useState([]); const { openSnack } = useSnackbar(); - //const [{ as }] = useGlobalState(); + const [{ as }] = useGlobalState(); const submitNewOrganization = () => { @@ -174,28 +174,45 @@ export default function LibraCartAccess() { return ( - - - + + + + + + + + + + - - + + - - + + + 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. + + {newOrgDialog()} diff --git a/src/providers/pond/libracartProxyAPI.tsx b/src/providers/pond/libracartProxyAPI.tsx index d4f8bb5..b56f65b 100644 --- a/src/providers/pond/libracartProxyAPI.tsx +++ b/src/providers/pond/libracartProxyAPI.tsx @@ -4,6 +4,7 @@ import { pond } from "protobuf-ts/pond"; import React, { createContext, PropsWithChildren, useContext } from "react"; //import { or } from "utils"; import { pondURL } from "./pond"; +import { useGlobalState } from "providers/StateContainer"; export interface ILibraCartProxyAPIContext { //add new organization @@ -33,6 +34,7 @@ export interface ILibraCartProxyAPIContext { libracartKey?: string, as?: string ) => Promise>; + syncData: () => Promise } export const LibraCartProxyAPIContext = createContext( @@ -43,6 +45,7 @@ interface Props {} export default function LibraCartProvider(props: PropsWithChildren) { const { children } = props; + const [{as}] = useGlobalState(); const { post, get, put } = useHTTP(); const addAccount = ( @@ -104,13 +107,18 @@ export default function LibraCartProvider(props: PropsWithChildren) { ) } + const syncData = () => { + return get(pondURL("/libracartImport" + (as ? "?as=" + as : ""))) + } + return ( {children}