solloop 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +89 -2
- package/THIRD_PARTY_NOTICES.txt +353 -0
- package/esm/chunk-BvjMblAr.js +47 -0
- package/esm/chunk-Dwvo-ZwZ.js +74 -0
- package/esm/index.js +1 -0
- package/esm/react-chunk-0PAV0iQq.js +75 -0
- package/esm/react-chunk-C9Ij-QyN.js +47 -0
- package/esm/react.js +1 -0
- package/package.json +37 -4
- package/types/index.d.ts +25 -0
- package/types/public-types.d.ts +61 -0
- package/types/react.d.ts +18 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `solloop` npm package's public types, and the only source its published
|
|
3
|
+
* declarations are emitted from (`scripts/pack-npm.ts`).
|
|
4
|
+
*
|
|
5
|
+
* No imports, on purpose. The workspace packages are bundled into the
|
|
6
|
+
* JavaScript but not published, so a type that reached into `@solloop/core`
|
|
7
|
+
* would ship a declaration that cannot resolve on a merchant's machine. The
|
|
8
|
+
* source imports these definitions instead of restating them, and
|
|
9
|
+
* `tests/public-types.test.ts` pins the ones that mirror an internal type.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export type SolLoopCluster = 'mainnet-beta' | 'devnet' | 'localnet';
|
|
13
|
+
|
|
14
|
+
/** What each host event carries: `CustomEvent.detail`, or the React callback's argument. */
|
|
15
|
+
export interface SolLoopEventDetails {
|
|
16
|
+
'solloop:connected': { address: string };
|
|
17
|
+
'solloop:subscribing': Record<string, never>;
|
|
18
|
+
/** A UI hint, not proof of payment: verify on chain or via the webhook. */
|
|
19
|
+
'solloop:subscribed': { signature: string; subscriptionPda: string };
|
|
20
|
+
'solloop:error': { code: string; message: string };
|
|
21
|
+
'solloop:cancelled': Record<string, never>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type SolLoopEventName = keyof SolLoopEventDetails;
|
|
25
|
+
|
|
26
|
+
/** The attributes `<solloop-subscribe>` reads. Unknown values fall back to defaults. */
|
|
27
|
+
export interface SolLoopSubscribeAttributes {
|
|
28
|
+
/** A SolLoop plan id (`plan_8xK2m`) or a plan PDA. */
|
|
29
|
+
plan: string;
|
|
30
|
+
theme?: 'light' | 'auto';
|
|
31
|
+
/** Hex colour. */
|
|
32
|
+
accent?: string;
|
|
33
|
+
/** CSS length for the outer corner radius. */
|
|
34
|
+
radius?: string;
|
|
35
|
+
locale?: string;
|
|
36
|
+
cluster?: SolLoopCluster;
|
|
37
|
+
rpc?: string;
|
|
38
|
+
'success-url'?: string;
|
|
39
|
+
'api-url'?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface SolLoopSubscribeProps {
|
|
43
|
+
/** A SolLoop plan id (`plan_8xK2m`) or a plan PDA. */
|
|
44
|
+
plan: string;
|
|
45
|
+
theme?: 'light' | 'auto';
|
|
46
|
+
/** Hex colour. */
|
|
47
|
+
accent?: string;
|
|
48
|
+
/** CSS length for the outer corner radius. */
|
|
49
|
+
radius?: string;
|
|
50
|
+
locale?: string;
|
|
51
|
+
cluster?: SolLoopCluster;
|
|
52
|
+
rpcUrl?: string;
|
|
53
|
+
successUrl?: string;
|
|
54
|
+
apiUrl?: string;
|
|
55
|
+
className?: string;
|
|
56
|
+
onConnected?: (detail: SolLoopEventDetails['solloop:connected']) => void;
|
|
57
|
+
onSubscribing?: () => void;
|
|
58
|
+
onSubscribed?: (detail: SolLoopEventDetails['solloop:subscribed']) => void;
|
|
59
|
+
onError?: (detail: SolLoopEventDetails['solloop:error']) => void;
|
|
60
|
+
onCancelled?: () => void;
|
|
61
|
+
}
|
package/types/react.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Published as `solloop/react`'s types; mirrors src/react.tsx.
|
|
2
|
+
import type { ReactElement } from 'react';
|
|
3
|
+
import type { SolLoopSubscribeProps } from './public-types.js';
|
|
4
|
+
|
|
5
|
+
export type {
|
|
6
|
+
SolLoopCluster,
|
|
7
|
+
SolLoopEventDetails,
|
|
8
|
+
SolLoopSubscribeProps,
|
|
9
|
+
} from './public-types.js';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The subscribe widget for React apps. Renders into a shadow root, so your
|
|
13
|
+
* global styles cannot reach it.
|
|
14
|
+
*
|
|
15
|
+
* `onSubscribed` is a UI hint, not proof of payment: gate access on your
|
|
16
|
+
* backend by verifying the subscription on chain or via the webhook.
|
|
17
|
+
*/
|
|
18
|
+
export declare function SolLoopSubscribe(props: SolLoopSubscribeProps): ReactElement;
|