@followgate/js 0.8.0 → 0.8.2

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 CHANGED
@@ -26,6 +26,7 @@ interface FollowGateConfig {
26
26
  onComplete?: () => void;
27
27
  theme?: 'dark' | 'light';
28
28
  accentColor?: string;
29
+ allowSkip?: boolean;
29
30
  }
30
31
  /**
31
32
  * SDK Error class with helpful messages
@@ -107,6 +108,7 @@ declare class FollowGateClient {
107
108
  private renderUsernameStep;
108
109
  private handleUsernameSubmit;
109
110
  private renderFollowStep;
111
+ private handleSkipFollow;
110
112
  private handleFollowClick;
111
113
  private showFollowConfirmation;
112
114
  private handleFollowConfirm;
package/dist/index.d.ts CHANGED
@@ -26,6 +26,7 @@ interface FollowGateConfig {
26
26
  onComplete?: () => void;
27
27
  theme?: 'dark' | 'light';
28
28
  accentColor?: string;
29
+ allowSkip?: boolean;
29
30
  }
30
31
  /**
31
32
  * SDK Error class with helpful messages
@@ -107,6 +108,7 @@ declare class FollowGateClient {
107
108
  private renderUsernameStep;
108
109
  private handleUsernameSubmit;
109
110
  private renderFollowStep;
111
+ private handleSkipFollow;
110
112
  private handleFollowClick;
111
113
  private showFollowConfirmation;
112
114
  private handleFollowConfirm;
package/dist/index.js CHANGED
@@ -307,9 +307,65 @@ var MODAL_STYLES = `
307
307
  height: 20px;
308
308
  color: #fbbf24;
309
309
  flex-shrink: 0;
310
+ }
311
+
312
+ .fg-verify-box {
313
+ background: rgba(59, 130, 246, 0.05);
314
+ border: 1px solid rgba(96, 165, 250, 0.5);
315
+ border-radius: 12px;
316
+ padding: 10px 14px;
317
+ margin-bottom: 8px;
318
+ display: flex;
319
+ align-items: center;
320
+ justify-content: space-between;
321
+ gap: 10px;
322
+ }
323
+
324
+ .fg-verify-box-left {
325
+ display: flex;
326
+ align-items: center;
327
+ gap: 8px;
328
+ flex-shrink: 0;
329
+ }
330
+
331
+ .fg-verify-spinner {
332
+ width: 18px;
333
+ height: 18px;
334
+ border: 2px solid rgba(96, 165, 250, 0.3);
335
+ border-top-color: #60a5fa;
336
+ border-radius: 50%;
337
+ animation: fg-spin 1s linear infinite;
338
+ flex-shrink: 0;
339
+ }
340
+
341
+ .fg-verify-text {
342
+ font-size: 13px;
343
+ color: #93c5fd;
344
+ white-space: nowrap;
345
+ }
346
+
347
+ .fg-verify-hint {
348
+ font-size: 12px;
349
+ color: #64748b;
350
+ text-align: center;
351
+ margin-bottom: 16px;
310
352
  margin-top: 2px;
311
353
  }
312
354
 
355
+ .fg-skip-link {
356
+ display: block;
357
+ text-align: center;
358
+ font-size: 12px;
359
+ color: #64748b;
360
+ margin-top: 16px;
361
+ cursor: pointer;
362
+ transition: color 0.2s;
363
+ }
364
+
365
+ .fg-skip-link:hover {
366
+ color: #94a3b8;
367
+ }
368
+
313
369
  .fg-warning-box p {
314
370
  font-size: 14px;
315
371
  color: #fde68a;
@@ -613,10 +669,22 @@ var FollowGateClient = class {
613
669
  </button>
614
670
  </div>
615
671
  <p class="fg-hint">A new window will open. Return here after following.</p>
672
+ ${this.config.allowSkip ? '<span class="fg-skip-link" id="fg-skip-follow">skip this step</span>' : ""}
616
673
  `;
617
674
  document.getElementById("fg-follow-btn")?.addEventListener("click", () => {
618
675
  this.handleFollowClick();
619
676
  });
677
+ document.getElementById("fg-skip-follow")?.addEventListener("click", () => {
678
+ this.handleSkipFollow();
679
+ });
680
+ }
681
+ handleSkipFollow() {
682
+ if (!this.config?.twitter) return;
683
+ if (this.config.twitter.tweetId) {
684
+ this.renderRepostStep();
685
+ } else {
686
+ this.renderConfirmStep();
687
+ }
620
688
  }
621
689
  handleFollowClick() {
622
690
  if (!this.config?.twitter) return;
@@ -712,10 +780,14 @@ var FollowGateClient = class {
712
780
  </button>
713
781
  </div>
714
782
  <p class="fg-hint">A new window will open. Return here after reposting.</p>
783
+ ${this.config.allowSkip ? '<span class="fg-skip-link" id="fg-skip-repost">skip this step</span>' : ""}
715
784
  `;
716
785
  document.getElementById("fg-repost-btn")?.addEventListener("click", () => {
717
786
  this.handleRepostClick();
718
787
  });
788
+ document.getElementById("fg-skip-repost")?.addEventListener("click", () => {
789
+ this.renderConfirmStep();
790
+ });
719
791
  }
720
792
  handleRepostClick() {
721
793
  if (!this.config?.twitter?.tweetId) return;
@@ -784,8 +856,22 @@ var FollowGateClient = class {
784
856
  renderConfirmStep() {
785
857
  const content = this.getContentElement();
786
858
  if (!content) return;
859
+ const username = this.currentUser?.username;
787
860
  content.innerHTML = `
788
861
  <h2 class="fg-title">Almost done!</h2>
862
+ <div class="fg-verify-box">
863
+ <div class="fg-verify-box-left">
864
+ <div class="fg-verify-spinner"></div>
865
+ <span class="fg-verify-text">Verifying follow & repost</span>
866
+ </div>
867
+ ${username ? `
868
+ <div class="fg-user-badge" style="margin: 0; padding: 4px 10px; gap: 6px;">
869
+ <div class="fg-user-badge-dot" style="background: #facc15; width: 6px; height: 6px;"></div>
870
+ <span class="fg-user-badge-text" style="font-size: 12px;">@${username}</span>
871
+ </div>
872
+ ` : ""}
873
+ </div>
874
+ <p class="fg-verify-hint">Verification may take some time</p>
789
875
  <div class="fg-warning-box">
790
876
  ${ICONS.warning}
791
877
  <p><strong>Note:</strong> Access may be revoked if actions are not completed.</p>
@@ -1018,7 +1104,10 @@ var FollowGateClient = class {
1018
1104
  );
1019
1105
  if (!response.ok) {
1020
1106
  if (this.config.debug) {
1021
- console.warn("[FollowGate] Verification check failed:", response.status);
1107
+ console.warn(
1108
+ "[FollowGate] Verification check failed:",
1109
+ response.status
1110
+ );
1022
1111
  }
1023
1112
  return false;
1024
1113
  }
@@ -1157,7 +1246,10 @@ var FollowGateClient = class {
1157
1246
  if (response.ok) {
1158
1247
  console.log("[FollowGate] Completion saved to server");
1159
1248
  } else {
1160
- console.warn("[FollowGate] Failed to save completion:", response.status);
1249
+ console.warn(
1250
+ "[FollowGate] Failed to save completion:",
1251
+ response.status
1252
+ );
1161
1253
  }
1162
1254
  }
1163
1255
  } catch (error) {
package/dist/index.mjs CHANGED
@@ -281,9 +281,65 @@ var MODAL_STYLES = `
281
281
  height: 20px;
282
282
  color: #fbbf24;
283
283
  flex-shrink: 0;
284
+ }
285
+
286
+ .fg-verify-box {
287
+ background: rgba(59, 130, 246, 0.05);
288
+ border: 1px solid rgba(96, 165, 250, 0.5);
289
+ border-radius: 12px;
290
+ padding: 10px 14px;
291
+ margin-bottom: 8px;
292
+ display: flex;
293
+ align-items: center;
294
+ justify-content: space-between;
295
+ gap: 10px;
296
+ }
297
+
298
+ .fg-verify-box-left {
299
+ display: flex;
300
+ align-items: center;
301
+ gap: 8px;
302
+ flex-shrink: 0;
303
+ }
304
+
305
+ .fg-verify-spinner {
306
+ width: 18px;
307
+ height: 18px;
308
+ border: 2px solid rgba(96, 165, 250, 0.3);
309
+ border-top-color: #60a5fa;
310
+ border-radius: 50%;
311
+ animation: fg-spin 1s linear infinite;
312
+ flex-shrink: 0;
313
+ }
314
+
315
+ .fg-verify-text {
316
+ font-size: 13px;
317
+ color: #93c5fd;
318
+ white-space: nowrap;
319
+ }
320
+
321
+ .fg-verify-hint {
322
+ font-size: 12px;
323
+ color: #64748b;
324
+ text-align: center;
325
+ margin-bottom: 16px;
284
326
  margin-top: 2px;
285
327
  }
286
328
 
329
+ .fg-skip-link {
330
+ display: block;
331
+ text-align: center;
332
+ font-size: 12px;
333
+ color: #64748b;
334
+ margin-top: 16px;
335
+ cursor: pointer;
336
+ transition: color 0.2s;
337
+ }
338
+
339
+ .fg-skip-link:hover {
340
+ color: #94a3b8;
341
+ }
342
+
287
343
  .fg-warning-box p {
288
344
  font-size: 14px;
289
345
  color: #fde68a;
@@ -587,10 +643,22 @@ var FollowGateClient = class {
587
643
  </button>
588
644
  </div>
589
645
  <p class="fg-hint">A new window will open. Return here after following.</p>
646
+ ${this.config.allowSkip ? '<span class="fg-skip-link" id="fg-skip-follow">skip this step</span>' : ""}
590
647
  `;
591
648
  document.getElementById("fg-follow-btn")?.addEventListener("click", () => {
592
649
  this.handleFollowClick();
593
650
  });
651
+ document.getElementById("fg-skip-follow")?.addEventListener("click", () => {
652
+ this.handleSkipFollow();
653
+ });
654
+ }
655
+ handleSkipFollow() {
656
+ if (!this.config?.twitter) return;
657
+ if (this.config.twitter.tweetId) {
658
+ this.renderRepostStep();
659
+ } else {
660
+ this.renderConfirmStep();
661
+ }
594
662
  }
595
663
  handleFollowClick() {
596
664
  if (!this.config?.twitter) return;
@@ -686,10 +754,14 @@ var FollowGateClient = class {
686
754
  </button>
687
755
  </div>
688
756
  <p class="fg-hint">A new window will open. Return here after reposting.</p>
757
+ ${this.config.allowSkip ? '<span class="fg-skip-link" id="fg-skip-repost">skip this step</span>' : ""}
689
758
  `;
690
759
  document.getElementById("fg-repost-btn")?.addEventListener("click", () => {
691
760
  this.handleRepostClick();
692
761
  });
762
+ document.getElementById("fg-skip-repost")?.addEventListener("click", () => {
763
+ this.renderConfirmStep();
764
+ });
693
765
  }
694
766
  handleRepostClick() {
695
767
  if (!this.config?.twitter?.tweetId) return;
@@ -758,8 +830,22 @@ var FollowGateClient = class {
758
830
  renderConfirmStep() {
759
831
  const content = this.getContentElement();
760
832
  if (!content) return;
833
+ const username = this.currentUser?.username;
761
834
  content.innerHTML = `
762
835
  <h2 class="fg-title">Almost done!</h2>
836
+ <div class="fg-verify-box">
837
+ <div class="fg-verify-box-left">
838
+ <div class="fg-verify-spinner"></div>
839
+ <span class="fg-verify-text">Verifying follow & repost</span>
840
+ </div>
841
+ ${username ? `
842
+ <div class="fg-user-badge" style="margin: 0; padding: 4px 10px; gap: 6px;">
843
+ <div class="fg-user-badge-dot" style="background: #facc15; width: 6px; height: 6px;"></div>
844
+ <span class="fg-user-badge-text" style="font-size: 12px;">@${username}</span>
845
+ </div>
846
+ ` : ""}
847
+ </div>
848
+ <p class="fg-verify-hint">Verification may take some time</p>
763
849
  <div class="fg-warning-box">
764
850
  ${ICONS.warning}
765
851
  <p><strong>Note:</strong> Access may be revoked if actions are not completed.</p>
@@ -992,7 +1078,10 @@ var FollowGateClient = class {
992
1078
  );
993
1079
  if (!response.ok) {
994
1080
  if (this.config.debug) {
995
- console.warn("[FollowGate] Verification check failed:", response.status);
1081
+ console.warn(
1082
+ "[FollowGate] Verification check failed:",
1083
+ response.status
1084
+ );
996
1085
  }
997
1086
  return false;
998
1087
  }
@@ -1131,7 +1220,10 @@ var FollowGateClient = class {
1131
1220
  if (response.ok) {
1132
1221
  console.log("[FollowGate] Completion saved to server");
1133
1222
  } else {
1134
- console.warn("[FollowGate] Failed to save completion:", response.status);
1223
+ console.warn(
1224
+ "[FollowGate] Failed to save completion:",
1225
+ response.status
1226
+ );
1135
1227
  }
1136
1228
  }
1137
1229
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@followgate/js",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
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",