@followgate/js 0.5.0 → 0.6.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/dist/index.d.mts +39 -58
- package/dist/index.d.ts +39 -58
- package/dist/index.js +753 -63
- package/dist/index.mjs +753 -63
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -6,6 +6,13 @@ type Platform = 'twitter' | 'bluesky' | 'linkedin';
|
|
|
6
6
|
* Supported social actions
|
|
7
7
|
*/
|
|
8
8
|
type SocialAction = 'follow' | 'repost' | 'like';
|
|
9
|
+
/**
|
|
10
|
+
* Twitter/X configuration
|
|
11
|
+
*/
|
|
12
|
+
interface TwitterConfig {
|
|
13
|
+
handle: string;
|
|
14
|
+
tweetId?: string;
|
|
15
|
+
}
|
|
9
16
|
/**
|
|
10
17
|
* SDK Configuration
|
|
11
18
|
*/
|
|
@@ -14,6 +21,10 @@ interface FollowGateConfig {
|
|
|
14
21
|
apiKey: string;
|
|
15
22
|
apiUrl?: string;
|
|
16
23
|
debug?: boolean;
|
|
24
|
+
twitter?: TwitterConfig;
|
|
25
|
+
onComplete?: () => void;
|
|
26
|
+
theme?: 'dark' | 'light';
|
|
27
|
+
accentColor?: string;
|
|
17
28
|
}
|
|
18
29
|
/**
|
|
19
30
|
* SDK Error class with helpful messages
|
|
@@ -56,28 +67,45 @@ interface UnlockStatus {
|
|
|
56
67
|
}
|
|
57
68
|
/**
|
|
58
69
|
* FollowGate SDK Client
|
|
59
|
-
*
|
|
60
|
-
* Simple username-based flow:
|
|
61
|
-
* 1. User enters username
|
|
62
|
-
* 2. User clicks intent URLs to follow/repost
|
|
63
|
-
* 3. User confirms they did it
|
|
64
|
-
* 4. App is unlocked
|
|
65
|
-
*
|
|
66
|
-
* No OAuth required!
|
|
67
70
|
*/
|
|
68
71
|
declare class FollowGateClient {
|
|
69
72
|
private config;
|
|
70
73
|
private listeners;
|
|
71
74
|
private currentUser;
|
|
72
75
|
private completedActions;
|
|
76
|
+
private modalElement;
|
|
77
|
+
private stylesInjected;
|
|
73
78
|
/**
|
|
74
79
|
* Initialize the SDK
|
|
75
|
-
* @throws {FollowGateError} If configuration is invalid
|
|
76
80
|
*/
|
|
77
81
|
init(config: FollowGateConfig): void;
|
|
82
|
+
/**
|
|
83
|
+
* Show the FollowGate modal
|
|
84
|
+
* If user is already unlocked, calls onComplete immediately
|
|
85
|
+
*/
|
|
86
|
+
show(): void;
|
|
87
|
+
/**
|
|
88
|
+
* Hide the modal
|
|
89
|
+
*/
|
|
90
|
+
hide(): void;
|
|
91
|
+
private injectStyles;
|
|
92
|
+
private createModal;
|
|
93
|
+
private getContentElement;
|
|
94
|
+
private renderUsernameStep;
|
|
95
|
+
private handleUsernameSubmit;
|
|
96
|
+
private renderFollowStep;
|
|
97
|
+
private handleFollowClick;
|
|
98
|
+
private showFollowConfirmation;
|
|
99
|
+
private handleFollowConfirm;
|
|
100
|
+
private renderRepostStep;
|
|
101
|
+
private handleRepostClick;
|
|
102
|
+
private showRepostConfirmation;
|
|
103
|
+
private handleRepostConfirm;
|
|
104
|
+
private renderConfirmStep;
|
|
105
|
+
private handleFinish;
|
|
106
|
+
private renderStepIndicator;
|
|
78
107
|
/**
|
|
79
108
|
* Set the user's social username
|
|
80
|
-
* This is the main entry point - no OAuth needed!
|
|
81
109
|
*/
|
|
82
110
|
setUsername(username: string, platform?: Platform): void;
|
|
83
111
|
/**
|
|
@@ -92,73 +120,26 @@ declare class FollowGateClient {
|
|
|
92
120
|
* Clear stored session
|
|
93
121
|
*/
|
|
94
122
|
reset(): void;
|
|
95
|
-
/**
|
|
96
|
-
* Get follow intent URL for a platform
|
|
97
|
-
*/
|
|
98
123
|
getFollowUrl(platform: Platform, target: string): string;
|
|
99
|
-
/**
|
|
100
|
-
* Get repost/retweet intent URL for a platform
|
|
101
|
-
*/
|
|
102
124
|
getRepostUrl(platform: Platform, target: string): string;
|
|
103
|
-
/**
|
|
104
|
-
* Get like intent URL for a platform
|
|
105
|
-
*/
|
|
106
125
|
getLikeUrl(platform: Platform, target: string): string;
|
|
107
|
-
/**
|
|
108
|
-
* Open intent URL in new window
|
|
109
|
-
*/
|
|
110
126
|
openIntent(options: CompleteOptions): Promise<void>;
|
|
111
|
-
/**
|
|
112
|
-
* Mark an action as completed (trust-first)
|
|
113
|
-
* Call this when user confirms they did the action
|
|
114
|
-
*/
|
|
115
127
|
complete(options: CompleteOptions): Promise<void>;
|
|
116
|
-
/**
|
|
117
|
-
* Mark the gate as unlocked
|
|
118
|
-
* Call this when all required actions are done
|
|
119
|
-
*/
|
|
120
128
|
unlock(): Promise<void>;
|
|
121
|
-
/**
|
|
122
|
-
* Check if gate is unlocked
|
|
123
|
-
*/
|
|
124
129
|
isUnlocked(): boolean;
|
|
125
|
-
/**
|
|
126
|
-
* Get unlock status with details
|
|
127
|
-
*/
|
|
128
130
|
getUnlockStatus(): UnlockStatus;
|
|
129
|
-
/**
|
|
130
|
-
* Get completed actions
|
|
131
|
-
*/
|
|
132
131
|
getCompletedActions(): CompleteOptions[];
|
|
133
|
-
/**
|
|
134
|
-
* Register event listener
|
|
135
|
-
*/
|
|
136
132
|
on(event: EventType, callback: EventCallback): void;
|
|
137
|
-
/**
|
|
138
|
-
* Remove event listener
|
|
139
|
-
*/
|
|
140
133
|
off(event: EventType, callback: EventCallback): void;
|
|
141
|
-
/**
|
|
142
|
-
* Restore session from localStorage
|
|
143
|
-
*/
|
|
144
134
|
private restoreSession;
|
|
145
|
-
/**
|
|
146
|
-
* Save completed actions to localStorage
|
|
147
|
-
*/
|
|
148
135
|
private saveCompletedActions;
|
|
149
|
-
/**
|
|
150
|
-
* Build intent URL for platform
|
|
151
|
-
*/
|
|
152
136
|
private buildIntentUrl;
|
|
153
137
|
private buildTwitterUrl;
|
|
154
138
|
private buildBlueskyUrl;
|
|
155
139
|
private buildLinkedInUrl;
|
|
156
|
-
/**
|
|
157
|
-
* Track analytics event
|
|
158
|
-
*/
|
|
159
140
|
private trackEvent;
|
|
160
141
|
private emit;
|
|
161
142
|
}
|
|
162
143
|
declare const FollowGate: FollowGateClient;
|
|
163
144
|
|
|
164
|
-
export { type CompleteOptions, type EventCallback, type EventType, FollowGate, FollowGateClient, type FollowGateConfig, FollowGateError, type Platform, type SocialAction, type UnlockStatus, type UserInfo };
|
|
145
|
+
export { type CompleteOptions, type EventCallback, type EventType, FollowGate, FollowGateClient, type FollowGateConfig, FollowGateError, type Platform, type SocialAction, type TwitterConfig, type UnlockStatus, type UserInfo };
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,13 @@ type Platform = 'twitter' | 'bluesky' | 'linkedin';
|
|
|
6
6
|
* Supported social actions
|
|
7
7
|
*/
|
|
8
8
|
type SocialAction = 'follow' | 'repost' | 'like';
|
|
9
|
+
/**
|
|
10
|
+
* Twitter/X configuration
|
|
11
|
+
*/
|
|
12
|
+
interface TwitterConfig {
|
|
13
|
+
handle: string;
|
|
14
|
+
tweetId?: string;
|
|
15
|
+
}
|
|
9
16
|
/**
|
|
10
17
|
* SDK Configuration
|
|
11
18
|
*/
|
|
@@ -14,6 +21,10 @@ interface FollowGateConfig {
|
|
|
14
21
|
apiKey: string;
|
|
15
22
|
apiUrl?: string;
|
|
16
23
|
debug?: boolean;
|
|
24
|
+
twitter?: TwitterConfig;
|
|
25
|
+
onComplete?: () => void;
|
|
26
|
+
theme?: 'dark' | 'light';
|
|
27
|
+
accentColor?: string;
|
|
17
28
|
}
|
|
18
29
|
/**
|
|
19
30
|
* SDK Error class with helpful messages
|
|
@@ -56,28 +67,45 @@ interface UnlockStatus {
|
|
|
56
67
|
}
|
|
57
68
|
/**
|
|
58
69
|
* FollowGate SDK Client
|
|
59
|
-
*
|
|
60
|
-
* Simple username-based flow:
|
|
61
|
-
* 1. User enters username
|
|
62
|
-
* 2. User clicks intent URLs to follow/repost
|
|
63
|
-
* 3. User confirms they did it
|
|
64
|
-
* 4. App is unlocked
|
|
65
|
-
*
|
|
66
|
-
* No OAuth required!
|
|
67
70
|
*/
|
|
68
71
|
declare class FollowGateClient {
|
|
69
72
|
private config;
|
|
70
73
|
private listeners;
|
|
71
74
|
private currentUser;
|
|
72
75
|
private completedActions;
|
|
76
|
+
private modalElement;
|
|
77
|
+
private stylesInjected;
|
|
73
78
|
/**
|
|
74
79
|
* Initialize the SDK
|
|
75
|
-
* @throws {FollowGateError} If configuration is invalid
|
|
76
80
|
*/
|
|
77
81
|
init(config: FollowGateConfig): void;
|
|
82
|
+
/**
|
|
83
|
+
* Show the FollowGate modal
|
|
84
|
+
* If user is already unlocked, calls onComplete immediately
|
|
85
|
+
*/
|
|
86
|
+
show(): void;
|
|
87
|
+
/**
|
|
88
|
+
* Hide the modal
|
|
89
|
+
*/
|
|
90
|
+
hide(): void;
|
|
91
|
+
private injectStyles;
|
|
92
|
+
private createModal;
|
|
93
|
+
private getContentElement;
|
|
94
|
+
private renderUsernameStep;
|
|
95
|
+
private handleUsernameSubmit;
|
|
96
|
+
private renderFollowStep;
|
|
97
|
+
private handleFollowClick;
|
|
98
|
+
private showFollowConfirmation;
|
|
99
|
+
private handleFollowConfirm;
|
|
100
|
+
private renderRepostStep;
|
|
101
|
+
private handleRepostClick;
|
|
102
|
+
private showRepostConfirmation;
|
|
103
|
+
private handleRepostConfirm;
|
|
104
|
+
private renderConfirmStep;
|
|
105
|
+
private handleFinish;
|
|
106
|
+
private renderStepIndicator;
|
|
78
107
|
/**
|
|
79
108
|
* Set the user's social username
|
|
80
|
-
* This is the main entry point - no OAuth needed!
|
|
81
109
|
*/
|
|
82
110
|
setUsername(username: string, platform?: Platform): void;
|
|
83
111
|
/**
|
|
@@ -92,73 +120,26 @@ declare class FollowGateClient {
|
|
|
92
120
|
* Clear stored session
|
|
93
121
|
*/
|
|
94
122
|
reset(): void;
|
|
95
|
-
/**
|
|
96
|
-
* Get follow intent URL for a platform
|
|
97
|
-
*/
|
|
98
123
|
getFollowUrl(platform: Platform, target: string): string;
|
|
99
|
-
/**
|
|
100
|
-
* Get repost/retweet intent URL for a platform
|
|
101
|
-
*/
|
|
102
124
|
getRepostUrl(platform: Platform, target: string): string;
|
|
103
|
-
/**
|
|
104
|
-
* Get like intent URL for a platform
|
|
105
|
-
*/
|
|
106
125
|
getLikeUrl(platform: Platform, target: string): string;
|
|
107
|
-
/**
|
|
108
|
-
* Open intent URL in new window
|
|
109
|
-
*/
|
|
110
126
|
openIntent(options: CompleteOptions): Promise<void>;
|
|
111
|
-
/**
|
|
112
|
-
* Mark an action as completed (trust-first)
|
|
113
|
-
* Call this when user confirms they did the action
|
|
114
|
-
*/
|
|
115
127
|
complete(options: CompleteOptions): Promise<void>;
|
|
116
|
-
/**
|
|
117
|
-
* Mark the gate as unlocked
|
|
118
|
-
* Call this when all required actions are done
|
|
119
|
-
*/
|
|
120
128
|
unlock(): Promise<void>;
|
|
121
|
-
/**
|
|
122
|
-
* Check if gate is unlocked
|
|
123
|
-
*/
|
|
124
129
|
isUnlocked(): boolean;
|
|
125
|
-
/**
|
|
126
|
-
* Get unlock status with details
|
|
127
|
-
*/
|
|
128
130
|
getUnlockStatus(): UnlockStatus;
|
|
129
|
-
/**
|
|
130
|
-
* Get completed actions
|
|
131
|
-
*/
|
|
132
131
|
getCompletedActions(): CompleteOptions[];
|
|
133
|
-
/**
|
|
134
|
-
* Register event listener
|
|
135
|
-
*/
|
|
136
132
|
on(event: EventType, callback: EventCallback): void;
|
|
137
|
-
/**
|
|
138
|
-
* Remove event listener
|
|
139
|
-
*/
|
|
140
133
|
off(event: EventType, callback: EventCallback): void;
|
|
141
|
-
/**
|
|
142
|
-
* Restore session from localStorage
|
|
143
|
-
*/
|
|
144
134
|
private restoreSession;
|
|
145
|
-
/**
|
|
146
|
-
* Save completed actions to localStorage
|
|
147
|
-
*/
|
|
148
135
|
private saveCompletedActions;
|
|
149
|
-
/**
|
|
150
|
-
* Build intent URL for platform
|
|
151
|
-
*/
|
|
152
136
|
private buildIntentUrl;
|
|
153
137
|
private buildTwitterUrl;
|
|
154
138
|
private buildBlueskyUrl;
|
|
155
139
|
private buildLinkedInUrl;
|
|
156
|
-
/**
|
|
157
|
-
* Track analytics event
|
|
158
|
-
*/
|
|
159
140
|
private trackEvent;
|
|
160
141
|
private emit;
|
|
161
142
|
}
|
|
162
143
|
declare const FollowGate: FollowGateClient;
|
|
163
144
|
|
|
164
|
-
export { type CompleteOptions, type EventCallback, type EventType, FollowGate, FollowGateClient, type FollowGateConfig, FollowGateError, type Platform, type SocialAction, type UnlockStatus, type UserInfo };
|
|
145
|
+
export { type CompleteOptions, type EventCallback, type EventType, FollowGate, FollowGateClient, type FollowGateConfig, FollowGateError, type Platform, type SocialAction, type TwitterConfig, type UnlockStatus, type UserInfo };
|