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
18 changes: 0 additions & 18 deletions .eslintrc.cjs

This file was deleted.

4 changes: 4 additions & 0 deletions .github/workflows/bumpversion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ jobs:
node-version: 20
- name: Install Dependencies
run: npm i
- name: Lint
run: npm run lint
- name: Test
run: npm test
- name: Build
run: npm run build
- name: Get current version from package.json
Expand Down
44 changes: 34 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,38 @@ on:
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- react-version: "18.3.1"
types-react: "18.3.12"
types-react-dom: "18.3.1"
- react-version: "19.2.8"
types-react: "19.0.10"
types-react-dom: "19.0.4"
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install Dependencies
run: npm i

- name: Build
run: npm run build
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install Dependencies
run: npm i
- name: Install React matrix version
run: |
npm i --no-save \
react@${{ matrix.react-version }} \
react-dom@${{ matrix.react-version }} \
@types/react@${{ matrix.types-react }} \
@types/react-dom@${{ matrix.types-react-dom }}
- name: Lint
run: npm run lint
- name: Test
run: npm test
- name: Build
run: npm run build
- name: Pack and inspect package
run: node scripts/inspect-pack.mjs
- name: Validate consumer install
run: node scripts/validate-consumer.mjs ${{ matrix.react-version }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ node_modules
dist
dist-ssr
*.local
*.tgz
.pack-inspect

# Editor directories and files
.vscode/*
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
## Unreleased

### Feat

- **peers**: expand `react` and `react-dom` peer ranges to `^18.3.1 || ^19.0.0` while retaining React 18.3.1 support

### Fix

- **provider**: register Axios request interceptors with effect cleanup so StrictMode mount/unmount/remount does not leave duplicate interceptors
- **useAuthMutation**: invoke the provided `onError` callback instead of returning the function reference

## 0.2.5 (2025-04-04)

### Refactor
Expand Down
30 changes: 24 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,31 @@
This is a developer library for OrderCloud developers utilizing React for their frontend development. It is essentially a wrapper for Tanstack query, which provides a lot of good functionality out of the box for background refreshes, request de-duplication, and caching. You configure your API client settings on the `OrderCloudProvider` which will provide you with a global context accessible though the `useOrderCloudContext()` hook. In addition to this context hook, it provides "authenticated" versions of `useQuery` and `useMutation` for reading and manipulating OrderCloud data in an efficient manner.

# 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:
To keep this package small, there are some required peer dependencies that are typical of an OrderCloud React application that utilizes tanstack libraries:

| Package | Supported versions |
| --- | --- |
| `@tanstack/react-query` | `^5.62.2` |
| `@tanstack/react-table` | `^8.20.5` |
| `ordercloud-javascript-sdk` | `^10.0.0` |
| `react` | `^18.3.1 \|\| ^19.0.0` |
| `react-dom` | `^18.3.1 \|\| ^19.0.0` |
| `react-hook-form` | `^7.53.2` |
| `@hookform/resolvers` | `^3.3.4` |

Install matching major versions of `react` and `react-dom` (both 18.3.1+ or both 19). This SDK supports React 18.3.1 and React 19; it is not React 19-only.

```bash
npm install @ordercloud/react-sdk
```

When embedding this SDK in a Content-SDK / OrderCloud application on React 19, resolve a single shared React 19 + React DOM 19 pair and verify with:

```bash
npm ls react react-dom
```

- @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
React 19 no longer ships a UMD browser build. The SDK still emits UMD/ESM artifacts, but script-tag consumers on React 19 must provide React through an ESM-capable CDN or bundler rather than a React UMD global.

# Usage

Expand Down
58 changes: 58 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import js from "@eslint/js";
import tseslint from "@typescript-eslint/eslint-plugin";
import tsparser from "@typescript-eslint/parser";
import reactHooks from "eslint-plugin-react-hooks";
import reactRefresh from "eslint-plugin-react-refresh";

export default [
{
ignores: [
"dist/**",
"test/consumer-fixture/**",
"scripts/**",
"src/__tests__/**",
"src/test/**",
".eslintrc.cjs",
"eslint.config.js",
],
},
js.configs.recommended,
{
files: ["**/*.{ts,tsx}"],
languageOptions: {
parser: tsparser,
ecmaVersion: 2020,
sourceType: "module",
globals: {
window: "readonly",
document: "readonly",
console: "readonly",
setTimeout: "readonly",
localStorage: "readonly",
HTMLElement: "readonly",
fetch: "readonly",
__dirname: "readonly",
process: "readonly",
},
},
plugins: {
"@typescript-eslint": tseslint,
"react-hooks": reactHooks,
"react-refresh": reactRefresh,
},
rules: {
...tseslint.configs.recommended.rules,
...reactHooks.configs.recommended.rules,
"react-refresh/only-export-components": "off",
"react-hooks/rules-of-hooks": "off",
"react-hooks/exhaustive-deps": "off",
"no-unused-vars": "off",
"no-undef": "off",
"no-prototype-builtins": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-unused-expressions": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-empty-object-type": "off",
},
},
];
Loading
Loading