@tribecloud/sdk 1.0.0 → 1.0.1
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/dist/esm/core.d.ts +19 -2
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +15218 -10
- package/dist/esm/types.d.ts +59 -1
- package/dist/iife/sdk.min.js +59 -20
- package/package.json +4 -1
package/dist/esm/types.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ export interface MagicLinkOptions {
|
|
|
45
45
|
}
|
|
46
46
|
export interface AuthConfig {
|
|
47
47
|
authEnabled: boolean;
|
|
48
|
+
accessMode: string;
|
|
48
49
|
magicLinkEnabled: boolean;
|
|
49
50
|
captchaEnabled: boolean;
|
|
50
51
|
captchaProvider: string | null;
|
|
@@ -52,18 +53,71 @@ export interface AuthConfig {
|
|
|
52
53
|
captchaRequiredForRegistration: boolean;
|
|
53
54
|
captchaRequiredForLogin: boolean;
|
|
54
55
|
breachedPasswordPolicy: string;
|
|
56
|
+
googleEnabled: boolean;
|
|
57
|
+
githubEnabled: boolean;
|
|
58
|
+
discordEnabled: boolean;
|
|
59
|
+
twitterEnabled: boolean;
|
|
60
|
+
}
|
|
61
|
+
export type SocialProvider = "google" | "github" | "discord" | "twitter";
|
|
62
|
+
export interface RedirectOptions {
|
|
63
|
+
/** Override the redirect URL (defaults to current page URL) */
|
|
64
|
+
redirectUrl?: string;
|
|
65
|
+
}
|
|
66
|
+
export interface PaymentOptions {
|
|
67
|
+
/** Token mint address, or "SOL" for native SOL */
|
|
68
|
+
mint: string;
|
|
69
|
+
/** Human-readable amount, e.g. "2.5" */
|
|
70
|
+
amount: string;
|
|
71
|
+
/** Optional memo shown in the payment */
|
|
72
|
+
memo?: string;
|
|
73
|
+
/** Optional metadata stored with the payment */
|
|
74
|
+
metadata?: Record<string, unknown>;
|
|
75
|
+
}
|
|
76
|
+
export interface PaymentResult {
|
|
77
|
+
/** Payment ID for verification */
|
|
78
|
+
id: string;
|
|
79
|
+
/** Solana Pay URL — use as QR code data */
|
|
80
|
+
paymentUrl: string;
|
|
81
|
+
/** When this payment request expires */
|
|
82
|
+
expiresAt: string;
|
|
83
|
+
}
|
|
84
|
+
export interface PaymentStatus {
|
|
85
|
+
status: "pending" | "confirmed" | "expired";
|
|
86
|
+
txSignature: string | null;
|
|
87
|
+
}
|
|
88
|
+
export interface AcceptedToken {
|
|
89
|
+
mint: string;
|
|
90
|
+
symbol: string;
|
|
91
|
+
name: string;
|
|
92
|
+
logoUrl: string | null;
|
|
93
|
+
decimals: number;
|
|
94
|
+
}
|
|
95
|
+
export interface PaymentConfig {
|
|
96
|
+
paymentsEnabled: boolean;
|
|
97
|
+
paymentWalletAddress: string | null;
|
|
98
|
+
acceptedTokens: AcceptedToken[];
|
|
55
99
|
}
|
|
56
100
|
export interface TribeSDK {
|
|
57
101
|
register(email: string, password: string): Promise<{
|
|
58
102
|
user: User;
|
|
103
|
+
userToken?: string | null;
|
|
59
104
|
}>;
|
|
60
105
|
login(email: string, password: string): Promise<{
|
|
61
106
|
user: User;
|
|
107
|
+
userToken?: string | null;
|
|
62
108
|
}>;
|
|
109
|
+
/** Redirect to the hosted login page */
|
|
110
|
+
redirectToLogin(options?: RedirectOptions): void;
|
|
111
|
+
/** Redirect to the hosted register page */
|
|
112
|
+
redirectToRegister(options?: RedirectOptions): void;
|
|
113
|
+
/** Redirect to a social login provider (google, github, discord, twitter) */
|
|
114
|
+
redirectToSocialLogin(provider: SocialProvider, options?: RedirectOptions): void;
|
|
63
115
|
logout(): Promise<void>;
|
|
64
116
|
getSession(): Promise<{
|
|
65
117
|
user: User;
|
|
118
|
+
userToken?: string | null;
|
|
66
119
|
} | null>;
|
|
120
|
+
getUserToken(): string | null;
|
|
67
121
|
track(eventName: string, data?: Record<string, unknown>): void;
|
|
68
122
|
feedback(message: string, options?: FeedbackOptions): Promise<void>;
|
|
69
123
|
getFeatureFlag(key: string): Promise<boolean>;
|
|
@@ -76,6 +130,7 @@ export interface TribeSDK {
|
|
|
76
130
|
requestMagicLink(email: string, options?: MagicLinkOptions): Promise<void>;
|
|
77
131
|
verifyMagicLink(token: string): Promise<{
|
|
78
132
|
user: User;
|
|
133
|
+
userToken?: string | null;
|
|
79
134
|
}>;
|
|
80
135
|
getAuthConfig(): Promise<AuthConfig>;
|
|
81
136
|
getActiveDevices(): Promise<ActiveDevice[]>;
|
|
@@ -85,10 +140,13 @@ export interface TribeSDK {
|
|
|
85
140
|
listApiKeys(): Promise<ApiKey[]>;
|
|
86
141
|
deleteApiKey(id: string): Promise<void>;
|
|
87
142
|
invalidateAllSessions(): Promise<void>;
|
|
143
|
+
getPaymentConfig(): Promise<PaymentConfig>;
|
|
144
|
+
getQrCode(options: PaymentOptions): Promise<PaymentResult>;
|
|
145
|
+
sendViaPhantom(options: PaymentOptions): Promise<PaymentStatus>;
|
|
146
|
+
verifyPayment(paymentId: string, txSignature?: string): Promise<PaymentStatus>;
|
|
88
147
|
}
|
|
89
148
|
export interface TribeConfig {
|
|
90
149
|
siteId: string;
|
|
91
|
-
baseUrl: string;
|
|
92
150
|
/** Whether to auto-track pageviews and navigation. Defaults to true. */
|
|
93
151
|
autoTrack?: boolean;
|
|
94
152
|
}
|