Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
f37aa2a
Phase 1: add ConnectionHealth and OAuthCsrf types (Ref #9546)
jonaslagoni May 5, 2026
465abc8
Phase 2: failing tests for oauthCsrf utilities (Ref #9546)
jonaslagoni May 5, 2026
b41d51a
Phase 3: implement oauthCsrf utilities (Ref #9546)
jonaslagoni May 5, 2026
8aefa51
Phase 4: failing tests for StatusBadge pending_confirmation branch (R…
jonaslagoni May 5, 2026
edec7f1
Phase 5: StatusBadge pending_confirmation branch (Ref #9546)
jonaslagoni May 5, 2026
b780bc8
Phase 6: failing tests for AuthorizeButton OAuth CSRF flow (Ref #9546)
jonaslagoni May 5, 2026
881f741
Phase 7: AuthorizeButton OAuth CSRF flow (Ref #9546)
jonaslagoni May 5, 2026
adf48b5
Phase 8: failing tests for handleRedirect OAuth CSRF flow (Ref #9546)
jonaslagoni May 5, 2026
4bbae96
Phase 9: handleRedirect OAuth CSRF flow + nonce on TopBar/ButtonLayou…
jonaslagoni May 5, 2026
2e0eea9
Phase 11: refactor abandoned per plan bail criteria (Ref #9546)
jonaslagoni May 5, 2026
16cce50
Add PR description for OAuth CSRF fix (Ref #9546)
jonaslagoni May 5, 2026
7390b70
Adapt example app into a Vault CSRF testing harness (Ref #9546)
jonaslagoni May 5, 2026
7712318
Switch example app from parcel to vite (Ref #9546)
jonaslagoni May 6, 2026
576f87e
Simplify example to just render <Vault> from .env config (Ref #9546)
jonaslagoni May 6, 2026
95ffa3f
Add plan and research for example app CSS import (Ref #9546)
jonaslagoni May 6, 2026
f80147f
Restore example app styling by importing dist/styles.css (Ref #9546)
jonaslagoni May 6, 2026
fab7543
fix css problem
jonaslagoni May 7, 2026
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.DS_Store
node_modules
.cache
.parcel-cache
dist
.env
storybook-static
Expand Down
9 changes: 9 additions & 0 deletions example/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copy to .env and fill in. .env is gitignored.
# Use a session JWT from an account in unify's `oauthCsrf` allowlist
# (22222222 / 11111111 / cm3mogvfz004ebogk8rqdbgpi) to exercise the
# new nonce + /confirm path.
VITE_VAULT_TOKEN=
VITE_VAULT_UNIFIED_API=crm
VITE_VAULT_SERVICE_ID=hubspot
# Leave blank for production unify, or set to e.g. https://staging-unify.apideck.com
VITE_VAULT_UNIFY_BASE_URL=
2 changes: 1 addition & 1 deletion example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

<body>
<div id="root"></div>
<script src="./index.tsx"></script>
<script type="module" src="/index.tsx"></script>
</body>
</html>
36 changes: 31 additions & 5 deletions example/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,39 @@
import 'react-app-polyfill/ie11';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { Thing } from '../.';
import { Vault } from '../.';
import '../dist/styles.css';

// Configure via example/.env (see .env.example):
// VITE_VAULT_TOKEN, VITE_VAULT_UNIFIED_API, VITE_VAULT_SERVICE_ID,
// VITE_VAULT_UNIFY_BASE_URL (optional, e.g. staging)
const env = (import.meta as any).env ?? {};
const token: string = env.VITE_VAULT_TOKEN ?? '';
const unifiedApi: string = env.VITE_VAULT_UNIFIED_API ?? 'crm';
const serviceId: string = env.VITE_VAULT_SERVICE_ID ?? 'hubspot';
const unifyBaseUrl: string | undefined = env.VITE_VAULT_UNIFY_BASE_URL;

const App = () => {
if (!token) {
return (
<div style={{ padding: 24, fontFamily: 'system-ui' }}>
<h1>No JWT configured</h1>
<p>
Create <code>example/.env</code> with{' '}
<code>VITE_VAULT_TOKEN=…</code> (see <code>.env.example</code>) and
restart <code>yarn start</code>.
</p>
</div>
);
}

return (
<div>
<Thing />
</div>
<Vault
token={token}
open
unifiedApi={unifiedApi}
serviceId={serviceId}
unifyBaseUrl={unifyBaseUrl}
/>
);
};

Expand Down
27 changes: 14 additions & 13 deletions example/package.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
{
"name": "example",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"private": true,
"scripts": {
"start": "parcel index.html",
"build": "parcel build index.html"
"start": "vite",
"build": "vite build"
},
"dependencies": {
"react-app-polyfill": "^1.0.0"
},
"alias": {
"react": "../node_modules/react",
"react-dom": "../node_modules/react-dom/profiling",
"scheduler/tracing": "../node_modules/scheduler/tracing-profiling"
"react": "17.0.2",
"react-dom": "17.0.2"
},
"devDependencies": {
"@types/react": "^16.9.11",
"@types/react-dom": "^16.8.4",
"parcel": "^1.12.3",
"typescript": "^3.4.5"
"@types/react": "17.0.39",
"@types/react-dom": "17.0.11",
"@vitejs/plugin-react": "^4.3.4",
"typescript": "^4.5.5",
"vite": "^5.4.11"
},
"resolutions": {
"@types/react": "17.0.39",
"@types/react-dom": "17.0.11"
}
}
17 changes: 8 additions & 9 deletions example/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
{
"compilerOptions": {
"allowSyntheticDefaultImports": false,
"target": "es6",
"module": "commonjs",
"target": "es2020",
"module": "esnext",
"jsx": "react",
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"noImplicitAny": false,
"noUnusedLocals": false,
"noUnusedParameters": false,
"removeComments": true,
"strictNullChecks": true,
"preserveConstEnums": true,
"sourceMap": true,
"lib": ["es2015", "es2016", "dom"],
"types": ["node"]
}
"skipLibCheck": true,
"lib": ["es2020", "dom", "dom.iterable"]
},
"include": ["index.tsx", "vite.config.ts"]
}
25 changes: 25 additions & 0 deletions example/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import path from 'path';

// Force a single React copy across the example AND the in-tree vault-core source.
// Without this, Vite finds nested React copies in the parent's node_modules and
// the React tree fails with "Invalid hook call".
export default defineConfig({
plugins: [react()],
resolve: {
dedupe: ['react', 'react-dom'],
alias: {
react: path.resolve(__dirname, '../node_modules/react'),
'react-dom': path.resolve(__dirname, '../node_modules/react-dom'),
},
},
optimizeDeps: {
include: ['react', 'react-dom'],
},
css: { postcss: { plugins: [] } },
server: {
port: 1234,
open: false,
},
});
Loading
Loading