@followgate/js 0.14.1 → 0.15.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/README.md +35 -0
- package/dist/index.js +15 -8
- package/dist/index.mjs +15 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -108,6 +108,41 @@ FollowGate.on('unlocked', (data) => {
|
|
|
108
108
|
});
|
|
109
109
|
```
|
|
110
110
|
|
|
111
|
+
## Username Input (2 Methods)
|
|
112
|
+
|
|
113
|
+
The SDK needs the user's social media username to work. There are exactly 2 ways to provide it:
|
|
114
|
+
|
|
115
|
+
**Method 1: User enters username manually (default)**
|
|
116
|
+
If no username is passed, the modal shows a Welcome step where the user types their username.
|
|
117
|
+
|
|
118
|
+
```typescript
|
|
119
|
+
FollowGate.init({
|
|
120
|
+
appId: 'your-app-id',
|
|
121
|
+
apiKey: 'fg_live_xxx',
|
|
122
|
+
twitter: { handle: 'your_handle' },
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
FollowGate.show(); // → Modal starts with username input step
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**Method 2: App passes username via code (skips Welcome step)**
|
|
129
|
+
If your app already knows the user's username (e.g. from your own auth system), pass it directly. The Welcome step is skipped entirely.
|
|
130
|
+
|
|
131
|
+
```typescript
|
|
132
|
+
FollowGate.init({
|
|
133
|
+
appId: 'your-app-id',
|
|
134
|
+
apiKey: 'fg_live_xxx',
|
|
135
|
+
twitter: {
|
|
136
|
+
handle: 'your_handle',
|
|
137
|
+
username: 'their_x_username', // ← skips Welcome step
|
|
138
|
+
},
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
FollowGate.show(); // → Modal starts directly with Follow step
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
> **Note:** No Twitter API calls are made in either case. The SDK uses intent URLs only.
|
|
145
|
+
|
|
111
146
|
## Configuration Options
|
|
112
147
|
|
|
113
148
|
```typescript
|
package/dist/index.js
CHANGED
|
@@ -790,9 +790,9 @@ var FollowGateClient = class {
|
|
|
790
790
|
const allowSkip = this.serverConfig?.allowSkip ?? false;
|
|
791
791
|
const welcomeTitle = this.serverConfig?.welcomeTitle || "Unlock Free Access";
|
|
792
792
|
const welcomeMessage = this.serverConfig?.welcomeMessage || "Enter your X username to get started";
|
|
793
|
-
let explanationText = handle ? `
|
|
793
|
+
let explanationText = handle ? `Follow @${handle} on X${hasRepost ? " and repost a post" : ""} to unlock.` : `Complete a quick action on X to unlock.`;
|
|
794
794
|
if (allowSkip) {
|
|
795
|
-
explanationText += ` You can skip
|
|
795
|
+
explanationText += ` You can skip single steps, but it really helps the developer.`;
|
|
796
796
|
}
|
|
797
797
|
content.innerHTML = `
|
|
798
798
|
<div class="fg-icon-box">
|
|
@@ -1086,7 +1086,10 @@ var FollowGateClient = class {
|
|
|
1086
1086
|
verifyText = "Verifying repost";
|
|
1087
1087
|
}
|
|
1088
1088
|
content.innerHTML = `
|
|
1089
|
-
<
|
|
1089
|
+
<div style="display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 16px;">
|
|
1090
|
+
<span style="color: #4ade80; width: 28px; height: 28px;">${ICONS.check}</span>
|
|
1091
|
+
<h2 class="fg-title" style="margin: 0;">${this.escapeHtml(successTitle)}</h2>
|
|
1092
|
+
</div>
|
|
1090
1093
|
${successMessage ? `<p class="fg-subtitle" style="margin-bottom: 16px;">${this.escapeHtml(successMessage)}</p>` : ""}
|
|
1091
1094
|
<div class="fg-verify-box">
|
|
1092
1095
|
<div class="fg-verify-box-left">
|
|
@@ -1100,16 +1103,20 @@ var FollowGateClient = class {
|
|
|
1100
1103
|
</div>
|
|
1101
1104
|
` : ""}
|
|
1102
1105
|
</div>
|
|
1103
|
-
<
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1106
|
+
<div style="text-align: center; margin: 8px 0;">
|
|
1107
|
+
<p style="color: #4ade80; font-size: 13px; margin: 0; display: flex; align-items: center; justify-content: center; gap: 6px;">
|
|
1108
|
+
<span style="width: 14px; height: 14px;">${ICONS.check}</span>
|
|
1109
|
+
Access granted
|
|
1110
|
+
</p>
|
|
1111
|
+
<p class="fg-verify-hint" style="margin: 4px 0 0;">Final verification may take some time</p>
|
|
1107
1112
|
</div>
|
|
1113
|
+
<p style="color: rgba(250, 204, 21, 0.6); font-size: 11px; margin: 16px 0 20px; text-align: center;">Access may be revoked if actions are not completed.</p>
|
|
1108
1114
|
<button class="fg-btn fg-btn-green" id="fg-finish-btn">
|
|
1109
1115
|
${ICONS.check}
|
|
1110
|
-
Got it
|
|
1116
|
+
Got it \u2014 Continue
|
|
1111
1117
|
</button>
|
|
1112
1118
|
${hasFollow || hasRepost ? `
|
|
1119
|
+
<p style="color: rgba(255,255,255,0.4); font-size: 11px; margin: 24px 0 6px; text-align: center;">Missed something? Open again:</p>
|
|
1113
1120
|
<div class="fg-btn-row">
|
|
1114
1121
|
${hasFollow ? `
|
|
1115
1122
|
<button class="fg-btn fg-btn-secondary" id="fg-redo-follow">
|
package/dist/index.mjs
CHANGED
|
@@ -764,9 +764,9 @@ var FollowGateClient = class {
|
|
|
764
764
|
const allowSkip = this.serverConfig?.allowSkip ?? false;
|
|
765
765
|
const welcomeTitle = this.serverConfig?.welcomeTitle || "Unlock Free Access";
|
|
766
766
|
const welcomeMessage = this.serverConfig?.welcomeMessage || "Enter your X username to get started";
|
|
767
|
-
let explanationText = handle ? `
|
|
767
|
+
let explanationText = handle ? `Follow @${handle} on X${hasRepost ? " and repost a post" : ""} to unlock.` : `Complete a quick action on X to unlock.`;
|
|
768
768
|
if (allowSkip) {
|
|
769
|
-
explanationText += ` You can skip
|
|
769
|
+
explanationText += ` You can skip single steps, but it really helps the developer.`;
|
|
770
770
|
}
|
|
771
771
|
content.innerHTML = `
|
|
772
772
|
<div class="fg-icon-box">
|
|
@@ -1060,7 +1060,10 @@ var FollowGateClient = class {
|
|
|
1060
1060
|
verifyText = "Verifying repost";
|
|
1061
1061
|
}
|
|
1062
1062
|
content.innerHTML = `
|
|
1063
|
-
<
|
|
1063
|
+
<div style="display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 16px;">
|
|
1064
|
+
<span style="color: #4ade80; width: 28px; height: 28px;">${ICONS.check}</span>
|
|
1065
|
+
<h2 class="fg-title" style="margin: 0;">${this.escapeHtml(successTitle)}</h2>
|
|
1066
|
+
</div>
|
|
1064
1067
|
${successMessage ? `<p class="fg-subtitle" style="margin-bottom: 16px;">${this.escapeHtml(successMessage)}</p>` : ""}
|
|
1065
1068
|
<div class="fg-verify-box">
|
|
1066
1069
|
<div class="fg-verify-box-left">
|
|
@@ -1074,16 +1077,20 @@ var FollowGateClient = class {
|
|
|
1074
1077
|
</div>
|
|
1075
1078
|
` : ""}
|
|
1076
1079
|
</div>
|
|
1077
|
-
<
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1080
|
+
<div style="text-align: center; margin: 8px 0;">
|
|
1081
|
+
<p style="color: #4ade80; font-size: 13px; margin: 0; display: flex; align-items: center; justify-content: center; gap: 6px;">
|
|
1082
|
+
<span style="width: 14px; height: 14px;">${ICONS.check}</span>
|
|
1083
|
+
Access granted
|
|
1084
|
+
</p>
|
|
1085
|
+
<p class="fg-verify-hint" style="margin: 4px 0 0;">Final verification may take some time</p>
|
|
1081
1086
|
</div>
|
|
1087
|
+
<p style="color: rgba(250, 204, 21, 0.6); font-size: 11px; margin: 16px 0 20px; text-align: center;">Access may be revoked if actions are not completed.</p>
|
|
1082
1088
|
<button class="fg-btn fg-btn-green" id="fg-finish-btn">
|
|
1083
1089
|
${ICONS.check}
|
|
1084
|
-
Got it
|
|
1090
|
+
Got it \u2014 Continue
|
|
1085
1091
|
</button>
|
|
1086
1092
|
${hasFollow || hasRepost ? `
|
|
1093
|
+
<p style="color: rgba(255,255,255,0.4); font-size: 11px; margin: 24px 0 6px; text-align: center;">Missed something? Open again:</p>
|
|
1087
1094
|
<div class="fg-btn-row">
|
|
1088
1095
|
${hasFollow ? `
|
|
1089
1096
|
<button class="fg-btn fg-btn-secondary" id="fg-redo-follow">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@followgate/js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.1",
|
|
4
4
|
"description": "FollowGate SDK - Grow your audience with every download. Require social actions (follow, repost) before users can access your app.",
|
|
5
5
|
"author": "FollowGate <hello@followgate.app>",
|
|
6
6
|
"homepage": "https://followgate.app",
|