@withone/connect 0.8.2 → 0.9.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/README.md +158 -370
- package/dist/button.d.ts +9 -10
- package/dist/constants.d.ts +8 -4
- package/dist/index.cjs.js +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.esm.js +1 -1
- package/dist/next.cjs.js +104 -0
- package/dist/next.d.ts +36 -0
- package/dist/next.esm.js +98 -0
- package/dist/node.cjs.js +69 -0
- package/dist/node.d.ts +33 -0
- package/dist/node.esm.js +67 -0
- package/dist/platforms.d.ts +21 -0
- package/dist/react.cjs.js +1 -1
- package/dist/react.d.ts +2 -19
- package/dist/react.esm.js +1 -1
- package/dist/return.d.ts +11 -0
- package/dist/server/index.cjs.js +349 -0
- package/dist/server/index.d.ts +32 -0
- package/dist/server/index.esm.js +344 -0
- package/dist/server/oauth.d.ts +24 -0
- package/dist/server/types.d.ts +136 -0
- package/dist/svelte.cjs.js +1 -1
- package/dist/svelte.d.ts +14 -4
- package/dist/svelte.esm.js +1 -1
- package/dist/types.d.ts +80 -0
- package/dist/useOneConnect.d.ts +13 -2
- package/dist/vue.cjs.js +1 -1
- package/dist/vue.d.ts +20 -18
- package/dist/vue.esm.js +1 -1
- package/dist/wrapper-options.d.ts +20 -15
- package/package.json +37 -15
- package/skills/one-connect/SKILL.md +194 -0
- package/src/button.ts +106 -137
- package/src/constants.ts +10 -4
- package/src/index.ts +17 -2
- package/src/next.ts +133 -0
- package/src/node.ts +107 -0
- package/src/platforms.ts +89 -0
- package/src/react.ts +23 -66
- package/src/return.ts +30 -0
- package/src/server/index.ts +382 -0
- package/src/server/oauth.ts +98 -0
- package/src/server/types.ts +155 -0
- package/src/svelte.ts +15 -15
- package/src/types.ts +87 -0
- package/src/useOneConnect.ts +36 -69
- package/src/vue.ts +23 -29
- package/src/wrapper-options.ts +46 -23
- package/dist/index.umd.js +0 -1
- package/dist/types/index.d.ts +0 -92
- package/src/react-types.d.ts +0 -23
- package/src/svelte-types.d.ts +0 -27
- package/src/types/index.d.ts +0 -92
- package/src/vue-types.d.ts +0 -16
package/src/types/index.d.ts
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Public types for @withone/connect.
|
|
3
|
-
*
|
|
4
|
-
* The SDK deliberately knows nothing about OAuth internals: state, PKCE
|
|
5
|
-
* and the client secret live on the consumer's backend (see README).
|
|
6
|
-
* The SDK only sends the tab to One's hosted connect page and reports
|
|
7
|
-
* how the flow ended when the user comes back.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/** How a completed flow reports back on the return URL. */
|
|
11
|
-
export interface OneConnectResult {
|
|
12
|
-
status: "success" | "error";
|
|
13
|
-
/** Human-readable detail for the error case. */
|
|
14
|
-
message?: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface OneConnectProps {
|
|
18
|
-
/**
|
|
19
|
-
* The consumer's OWN backend route that starts the flow. It must
|
|
20
|
-
* generate `state` + PKCE, set them in an httpOnly cookie, and 302
|
|
21
|
-
* to One's /oauth/authorize (full recipe in the README). Relative
|
|
22
|
-
* paths resolve against the host page's origin.
|
|
23
|
-
*/
|
|
24
|
-
authorize: {
|
|
25
|
-
url: string;
|
|
26
|
-
};
|
|
27
|
-
/** Theme for One's hosted page. Carried on the URL fragment
|
|
28
|
-
* (#one_theme=…), which survives the redirect chain — the consumer's
|
|
29
|
-
* backend forwards nothing. */
|
|
30
|
-
appTheme?: "dark" | "light";
|
|
31
|
-
/** Fired on return when the callback redirect carried
|
|
32
|
-
* ?one_connect=success. The token exchange already happened on the
|
|
33
|
-
* consumer's backend by this point. */
|
|
34
|
-
onSuccess?: () => void;
|
|
35
|
-
/** Fired on return when the callback redirect carried an error. */
|
|
36
|
-
onError?: (error: string) => void;
|
|
37
|
-
/** Reserved for future use — the hosted flow's cancel path returns
|
|
38
|
-
* through onError with the OAuth error string. */
|
|
39
|
-
onClose?: () => void;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export interface OneConnectHandle {
|
|
43
|
-
/** Navigates the tab to One's hosted connect flow. */
|
|
44
|
-
open: () => void;
|
|
45
|
-
/** No-op in the full-page flow — kept so hosts can call it
|
|
46
|
-
* unconditionally (e.g. on unmount). */
|
|
47
|
-
close: (options?: { keepResult?: boolean }) => void;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/** A provider chip on the pre-built button. The SDK ships no One URLs,
|
|
51
|
-
* so icon sources are the consumer's to provide. */
|
|
52
|
-
export interface ConnectButtonPlatform {
|
|
53
|
-
name: string;
|
|
54
|
-
imageUrl?: string;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export interface ConnectButtonOptions {
|
|
58
|
-
/** Everything useOneConnect takes — the button wires open() and the
|
|
59
|
-
* Connecting/Connected states around your callbacks. */
|
|
60
|
-
connect: OneConnectProps;
|
|
61
|
-
/** "Connect your apps" unless overridden. */
|
|
62
|
-
label?: string;
|
|
63
|
-
/** default = neutral pill; accent = brand-colored pill; block =
|
|
64
|
-
* full-width consent card with description + "Secured by One" foot. */
|
|
65
|
-
variant?: "default" | "accent" | "block";
|
|
66
|
-
/** Matches the host page, not One's page (that's connect.appTheme). */
|
|
67
|
-
theme?: "light" | "dark";
|
|
68
|
-
/** Provider chips fanned on hover; first four render, the rest fold
|
|
69
|
-
* into the +N chip together with moreCount. */
|
|
70
|
-
platforms?: ConnectButtonPlatform[];
|
|
71
|
-
/** Extra count for the +N chip (e.g. 274 for "the whole catalog"). */
|
|
72
|
-
moreCount?: number;
|
|
73
|
-
/** Sub-line on the block variant, shown while idle. */
|
|
74
|
-
description?: string;
|
|
75
|
-
/** accent variant fill; lime (#CCFF00) when omitted. */
|
|
76
|
-
accentColor?: string;
|
|
77
|
-
/** Label for the connected state ("4 apps connected"). */
|
|
78
|
-
connectedLabel?: string;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export interface ConnectButtonHandle {
|
|
82
|
-
/** Manually override the visual state. */
|
|
83
|
-
setState: (state: "idle" | "connecting" | "connected") => void;
|
|
84
|
-
/** Remove the button and tear down the flow wiring. */
|
|
85
|
-
destroy: () => void;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/** Registers the <one-connect-button> custom element (no-op on servers
|
|
89
|
-
* and when already registered). Importing the package does this
|
|
90
|
-
* automatically in browsers; calling it manually is only needed if a
|
|
91
|
-
* bundler stripped module side effects. */
|
|
92
|
-
export declare function registerConnectButton(): void;
|
package/src/vue-types.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/** Hand-maintained declarations for the "@withone/connect/vue" subpath. */
|
|
2
|
-
import type { DefineComponent } from "vue";
|
|
3
|
-
import type { ConnectButtonPlatform } from "./types";
|
|
4
|
-
|
|
5
|
-
export declare const ConnectButton: DefineComponent<{
|
|
6
|
-
authorizeUrl: string;
|
|
7
|
-
appTheme?: "light" | "dark";
|
|
8
|
-
label?: string;
|
|
9
|
-
variant?: "default" | "accent" | "block";
|
|
10
|
-
theme?: "light" | "dark";
|
|
11
|
-
platforms?: ConnectButtonPlatform[];
|
|
12
|
-
moreCount?: number;
|
|
13
|
-
description?: string;
|
|
14
|
-
accentColor?: string;
|
|
15
|
-
connectedLabel?: string;
|
|
16
|
-
}>;
|