@followgate/js 0.14.1 → 0.15.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 +35 -0
- package/dist/index.js +9 -8
- package/dist/index.mjs +9 -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: 4px;">
|
|
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">
|
|
@@ -1101,15 +1104,13 @@ var FollowGateClient = class {
|
|
|
1101
1104
|
` : ""}
|
|
1102
1105
|
</div>
|
|
1103
1106
|
<p class="fg-verify-hint">Verification may take some time</p>
|
|
1104
|
-
<
|
|
1105
|
-
${ICONS.warning}
|
|
1106
|
-
<p><strong>Note:</strong> Access may be revoked if actions are not completed.</p>
|
|
1107
|
-
</div>
|
|
1107
|
+
<p style="color: rgba(255,255,255,0.4); font-size: 11px; margin: 8px 0 16px; text-align: center;">Access may be revoked if actions are not completed.</p>
|
|
1108
1108
|
<button class="fg-btn fg-btn-green" id="fg-finish-btn">
|
|
1109
1109
|
${ICONS.check}
|
|
1110
|
-
Got it
|
|
1110
|
+
Got it \u2014 Continue
|
|
1111
1111
|
</button>
|
|
1112
1112
|
${hasFollow || hasRepost ? `
|
|
1113
|
+
<p style="color: rgba(255,255,255,0.4); font-size: 11px; margin: 12px 0 6px; text-align: center;">Missed something? Open again:</p>
|
|
1113
1114
|
<div class="fg-btn-row">
|
|
1114
1115
|
${hasFollow ? `
|
|
1115
1116
|
<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: 4px;">
|
|
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">
|
|
@@ -1075,15 +1078,13 @@ var FollowGateClient = class {
|
|
|
1075
1078
|
` : ""}
|
|
1076
1079
|
</div>
|
|
1077
1080
|
<p class="fg-verify-hint">Verification may take some time</p>
|
|
1078
|
-
<
|
|
1079
|
-
${ICONS.warning}
|
|
1080
|
-
<p><strong>Note:</strong> Access may be revoked if actions are not completed.</p>
|
|
1081
|
-
</div>
|
|
1081
|
+
<p style="color: rgba(255,255,255,0.4); font-size: 11px; margin: 8px 0 16px; text-align: center;">Access may be revoked if actions are not completed.</p>
|
|
1082
1082
|
<button class="fg-btn fg-btn-green" id="fg-finish-btn">
|
|
1083
1083
|
${ICONS.check}
|
|
1084
|
-
Got it
|
|
1084
|
+
Got it \u2014 Continue
|
|
1085
1085
|
</button>
|
|
1086
1086
|
${hasFollow || hasRepost ? `
|
|
1087
|
+
<p style="color: rgba(255,255,255,0.4); font-size: 11px; margin: 12px 0 6px; text-align: center;">Missed something? Open again:</p>
|
|
1087
1088
|
<div class="fg-btn-row">
|
|
1088
1089
|
${hasFollow ? `
|
|
1089
1090
|
<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.0",
|
|
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",
|