From 050225bdb1d3e136880ec8a144dcd6f2ba577d40 Mon Sep 17 00:00:00 2001 From: csawatzky Date: Thu, 14 Aug 2025 14:00:33 -0600 Subject: [PATCH] adding little description about the data sync and adding a sync button --- package-lock.json | 2 +- .../LibraCart/LibraCartAccess.tsx | 55 ++++++++++++------- src/providers/pond/libracartProxyAPI.tsx | 10 +++- 3 files changed, 46 insertions(+), 21 deletions(-) diff --git a/package-lock.json b/package-lock.json index b89d4cd..34a1da0 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#c68c727be5b1076bbb534996a13d5e3285c6ca68", + "resolved": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#8308e3c2a3bbc296d152b2df83246de3d0df4321", "dependencies": { "protobufjs": "^6.8.8" } diff --git a/src/integrations/LibraCart/LibraCartAccess.tsx b/src/integrations/LibraCart/LibraCartAccess.tsx index fae3362..5d31b66 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 integration_url = process.env.REACT_APP_LIBRACART_INTEGRATION_URL; const integration_url = import.meta.env.VITE_LIBRACART_INTEGRATION_URL; @@ -176,28 +176,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}