@trade-it/react 0.2.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/README.md +37 -2
- package/dist/index.cjs +1362 -64
- package/dist/index.d.cts +32 -7
- package/dist/index.d.ts +32 -7
- package/dist/index.js +1354 -68
- package/package.json +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@trade-it/react` will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## Unreleased
|
|
6
|
+
|
|
7
|
+
## 1.0.0 - 2026-10-15
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- Portal onboarding with email OTP or social sign-in, a typed async `onAuthorization` callback, and exchange acknowledgments
|
|
12
|
+
- Exact iframe-source checks and automatic closure deferred until authorization is saved
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- Size the desktop Connection portal around the embedded connect flow while preserving the wider Trade modal
|
|
17
|
+
- Keep Connect full-screen on mobile and tall enough for the connected-account continuation state and embedded footer
|
|
18
|
+
- Use a dark loading screen and animate the Trade It logo from its recognizable shape
|
|
19
|
+
|
|
5
20
|
## 0.2.0 - 2026-07-27
|
|
6
21
|
|
|
7
22
|
### Added
|
package/README.md
CHANGED
|
@@ -21,10 +21,45 @@ Full integration guides, examples, and API references:
|
|
|
21
21
|
|
|
22
22
|
- [React SDK Overview](https://docs.tradeit.app/sdk)
|
|
23
23
|
- [Authentication](https://docs.tradeit.app/sdk/authentication)
|
|
24
|
-
- [
|
|
24
|
+
- [Portal · Connection mode](https://docs.tradeit.app/sdk/connect)
|
|
25
25
|
- [Place Trades](https://docs.tradeit.app/sdk/trades)
|
|
26
26
|
- [SDK Enums Reference](https://docs.tradeit.app/sdk/enums)
|
|
27
27
|
|
|
28
28
|
## Notes
|
|
29
29
|
|
|
30
|
-
- Use the Trade It
|
|
30
|
+
- Use the Trade It skill to have your AI agent integrate Trade It: `npx skills add trade-it-inc/skills --skill trade-it-skill`
|
|
31
|
+
|
|
32
|
+
## Trade It Portal
|
|
33
|
+
|
|
34
|
+
Your backend calls `POST /api/portal`: use Basic client credentials with `oauth_options` to select Onboarding mode, or the user’s Bearer access token without `oauth_options` to select Connection mode. Pass the returned URL to `openConnect`. Your backend supplies a registered `redirect_uri` on the embedding website’s origin. Include `oauth_options.email_hint` to start with an email code, or omit it to offer Google, Apple, X, Discord, and email sign-in. Users can switch methods; social sign-in opens a popup and returns to the same portal. Trade It explains access, authenticates the user, and opens brokerage connection inside the same iframe. Your backend can optionally supply `connect_options.brokerage_code` or `connect_options.brokerage_filter` when creating the portal URL, using the same behavior as a connect session.
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
const tradeIt = useTradeIt({
|
|
38
|
+
onAuthorization: async authorization => {
|
|
39
|
+
const response = await fetch('/api/tradeit/complete', {
|
|
40
|
+
method: 'POST',
|
|
41
|
+
headers: { 'Content-Type': 'application/json' },
|
|
42
|
+
body: JSON.stringify(authorization),
|
|
43
|
+
});
|
|
44
|
+
if (!response.ok) throw new Error('Could not save Trade It access');
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
tradeIt.openConnect({ launch: { mode: 'connect', url: onboardingUrl } });
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
`onAuthorization` receives `{ code, state, issuer }`; resolve it only after your authenticated backend validates the attempt and saves the OAuth tokens. Rejection is reported inside the iframe. Brokerage connection starts immediately, and automatic closure waits for the callback. Credential events do not go to the generic `onEvent` callback.
|
|
52
|
+
|
|
53
|
+
See the [Onboarding mode guide](https://docs.tradeit.app/sdk/onboarding) for the server endpoints, PKCE/state validation, and account ownership rules. The same SDK method opens subsequent connections without another authorization event. Standard redirect OAuth remains available for custom sign-in experiences.
|
|
54
|
+
|
|
55
|
+
## Releasing
|
|
56
|
+
|
|
57
|
+
Add notes under **Unreleased** in `CHANGELOG.md` and commit your changes first. From the repository root, prepare a release with:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
npm run release:minor --workspace=@trade-it/react
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Use `release:major` or `release:patch` for other increments. The script versions the changelog, bumps the package and lockfile, then creates a commit and a package-specific tag. When releasing core too, prepare core first so React includes its updated dependency.
|
|
64
|
+
|
|
65
|
+
To release both SDK packages together, use `npm run release:sdk:minor` (or `major` / `patch`) from the root. Push the commits and tags, then use the existing SDK publish workflow or `npm run publish:sdk`. Release preparation does not build, publish, or push.
|