Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ This is a developer library for OrderCloud developers utilizing React for their
# Peer Dependencies
To keep this package small, there are some required peer dependencies that are typical of an OrderCloud React application that utilizies tanstack libraries:

- @tanstack/react-query@^5.20.1
- @tanstack/react-table@^8.11.8
- ordercloud-javascript-sdk@^5.3.0
- react@^18.2.0
- react-dom@^18.2.0
- @tanstack/react-query@^5.62.2
- @tanstack/react-table@^8.20.5
- ordercloud-javascript-sdk@^11.1.0 || ^12.0.0
- react@^18.3.1
- react-dom@^18.3.1

# Usage

Expand Down Expand Up @@ -105,7 +105,7 @@ This hook supports all of the normal `UseQueryOptions` documented by Tanstack. I
Here is an example of using the `useAuthQuery` hook to create a hook that returns the current user.
```tsx
import { Me, MeUser, OrderCloudError, RequiredDeep } from "ordercloud-javascript-sdk";
import { useAuthQuery } from "@rwatt451/ordercloud-react";
import { useAuthQuery } from "@ordercloud/react-sdk";
import { UseMutationResult, UseQueryResult } from "@tanstack/react-query";

export function useCurrentUser():UseQueryResult<RequiredDeep<MeUser>, OrderCloudError> {
Expand All @@ -128,7 +128,7 @@ This hook supports all of the normal `UseMutationOptions` documented by Tanstack
Here is an example of using the `useAuthMutation` hook to create a `UseMutationResult` for modifying the current user.
```tsx
import { Me, MeUser, OrderCloudError, RequiredDeep } from "ordercloud-javascript-sdk";
import { queryClient, useAuthMutation } from "@rwatt451/ordercloud-react";
import { queryClient, useAuthMutation } from "@ordercloud/react-sdk";
import { UseMutationResult } from "@tanstack/react-query";

export function useMutateCurrentUser():UseMutationResult<RequiredDeep<MeUser>, unknown, Partial<MeUser>, unknown> {
Expand Down Expand Up @@ -163,7 +163,7 @@ An **optional** `UseQueryOptions` object. It is recommended to use a `staleTime
### Usage
Here is an example of using the `useOcResourceList` hook to create a `UseQueryResult` for modifying the current user.
```tsx
import { useOcResourceList } from "@rwatt451/ordercloud-react";
import { useOcResourceList } from "@ordercloud/react-sdk";

const dataQuery = useOcResourceList('Orders', { IsSubmitted: true }, { direction: 'Incoming' }, {
staleTime: 300000, // 5 min
Expand All @@ -187,7 +187,7 @@ An **optional** `UseQueryOptions` object. It is recommended to use a `staleTime
### Usage
Here is an example of using the `useOcResourceGet` hook to create a `UseQueryResult` for modifying the current user.
```tsx
import { useOcResourceGet } from "@rwatt451/ordercloud-react";
import { useOcResourceGet } from "@ordercloud/react-sdk";

const dataQuery = useOcResourceGet('Catalogs', { buyerID: 'BuyerA' }, {
staleTime: 'Infinity',
Expand All @@ -214,7 +214,7 @@ An **optional** boolean that indicates if an item is new. If new, the Create op
### Usage
Here is an example of using the `useMutateOcResource` hook to create a `UseMutationResult` for modifying the current user.
```tsx
import { useMutateOcResource } from "@rwatt451/ordercloud-react";
import { useMutateOcResource } from "@ordercloud/react-sdk";
import { useCallback } from "react";

const { mutateAsync: saveAsync } = useMutateOcResource('Products')
Expand Down Expand Up @@ -244,7 +244,7 @@ An **optional** `UseMutationOptions` object.
### Usage
Here is an example of using the `useDeleteOcResource` hook to create a `UseMutationResult` for modifying the current user.
```tsx
import { useDeleteOcResource } from "@rwatt451/ordercloud-react";
import { useDeleteOcResource } from "@ordercloud/react-sdk";
import { useCallback } from "react";

const { mutateAsync: deleteAsync } = useDeleteOcResource('Orders', { direction: 'Outgoing' })
Expand Down Expand Up @@ -280,7 +280,7 @@ An **optional** `UseQueryOptions` object. It is recommended to use a `staleTime
### Usage
Here is an example of using the `useListAssignments` hook to create a `UseQueryResult` for modifying the current user.
```tsx
import { useOcResourceList } from "@rwatt451/ordercloud-react";
import { useOcResourceList } from "@ordercloud/react-sdk";

const dataQuery = useListAssignments('Catalogs', { ID: '100|101|102' }, {
staleTime: 300000, // 5 min
Expand All @@ -307,7 +307,7 @@ An **optional** `UseMutationOptions` object.
### Usage
Here is an example of using the `useMutateAssignment` hook to create a `UseMutationResult` for modifying the current user.
```tsx
import { useMutateAssignment } from "@rwatt451/ordercloud-react";
import { useMutateAssignment } from "@ordercloud/react-sdk";
import { useCallback } from "react";

const { mutateAsync: saveAssignmentAsync } = useMutateAssignment('Categories', { catalogID: 'DefaultCatalog', categoryID: 'SoftGoods' })
Expand Down Expand Up @@ -340,7 +340,7 @@ An **optional** `UseMutationOptions` object.
### Usage
Here is an example of using the `useDeleteAssignment` hook to create a `UseMutationResult` for modifying the current user.
```tsx
import { useDeleteAssignment } from "@rwatt451/ordercloud-react";
import { useDeleteAssignment } from "@ordercloud/react-sdk";
import { useCallback } from "react";

const { mutateAsync: deleteAsync } = useDeleteAssignment('Categories', { catalogID: 'DefaultCatalog', categoryID: 'SoftGoods' })
Expand Down
Loading
Loading