@followgate/js 0.12.1 → 0.13.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 +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +27 -6
- package/dist/index.mjs +27 -6
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -28,6 +28,7 @@ interface FollowGateConfig {
|
|
|
28
28
|
onComplete?: () => void;
|
|
29
29
|
theme?: 'dark' | 'light';
|
|
30
30
|
accentColor?: string;
|
|
31
|
+
forceShow?: boolean;
|
|
31
32
|
}
|
|
32
33
|
/**
|
|
33
34
|
* SDK Error class with helpful messages
|
|
@@ -102,7 +103,7 @@ declare class FollowGateClient {
|
|
|
102
103
|
private fetchServerConfig;
|
|
103
104
|
/**
|
|
104
105
|
* Show the FollowGate modal
|
|
105
|
-
* If user is already unlocked, calls onComplete immediately
|
|
106
|
+
* If user is already unlocked, calls onComplete immediately (unless forceShow is true)
|
|
106
107
|
*/
|
|
107
108
|
show(): Promise<void>;
|
|
108
109
|
/**
|
|
@@ -147,9 +148,14 @@ declare class FollowGateClient {
|
|
|
147
148
|
*/
|
|
148
149
|
hasUsername(): boolean;
|
|
149
150
|
/**
|
|
150
|
-
* Clear stored session
|
|
151
|
+
* Clear stored session (user, actions, and unlock status)
|
|
151
152
|
*/
|
|
152
153
|
reset(): void;
|
|
154
|
+
/**
|
|
155
|
+
* Clear only the unlock status (keeps user and actions)
|
|
156
|
+
* Useful for allowing users to go through the flow again
|
|
157
|
+
*/
|
|
158
|
+
clearUnlockStatus(): void;
|
|
153
159
|
getFollowUrl(platform: Platform, target: string): string;
|
|
154
160
|
getRepostUrl(platform: Platform, target: string): string;
|
|
155
161
|
getLikeUrl(platform: Platform, target: string): string;
|
package/dist/index.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ interface FollowGateConfig {
|
|
|
28
28
|
onComplete?: () => void;
|
|
29
29
|
theme?: 'dark' | 'light';
|
|
30
30
|
accentColor?: string;
|
|
31
|
+
forceShow?: boolean;
|
|
31
32
|
}
|
|
32
33
|
/**
|
|
33
34
|
* SDK Error class with helpful messages
|
|
@@ -102,7 +103,7 @@ declare class FollowGateClient {
|
|
|
102
103
|
private fetchServerConfig;
|
|
103
104
|
/**
|
|
104
105
|
* Show the FollowGate modal
|
|
105
|
-
* If user is already unlocked, calls onComplete immediately
|
|
106
|
+
* If user is already unlocked, calls onComplete immediately (unless forceShow is true)
|
|
106
107
|
*/
|
|
107
108
|
show(): Promise<void>;
|
|
108
109
|
/**
|
|
@@ -147,9 +148,14 @@ declare class FollowGateClient {
|
|
|
147
148
|
*/
|
|
148
149
|
hasUsername(): boolean;
|
|
149
150
|
/**
|
|
150
|
-
* Clear stored session
|
|
151
|
+
* Clear stored session (user, actions, and unlock status)
|
|
151
152
|
*/
|
|
152
153
|
reset(): void;
|
|
154
|
+
/**
|
|
155
|
+
* Clear only the unlock status (keeps user and actions)
|
|
156
|
+
* Useful for allowing users to go through the flow again
|
|
157
|
+
*/
|
|
158
|
+
clearUnlockStatus(): void;
|
|
153
159
|
getFollowUrl(platform: Platform, target: string): string;
|
|
154
160
|
getRepostUrl(platform: Platform, target: string): string;
|
|
155
161
|
getLikeUrl(platform: Platform, target: string): string;
|
package/dist/index.js
CHANGED
|
@@ -598,18 +598,27 @@ var FollowGateClient = class {
|
|
|
598
598
|
}
|
|
599
599
|
/**
|
|
600
600
|
* Show the FollowGate modal
|
|
601
|
-
* If user is already unlocked, calls onComplete immediately
|
|
601
|
+
* If user is already unlocked, calls onComplete immediately (unless forceShow is true)
|
|
602
602
|
*/
|
|
603
603
|
async show() {
|
|
604
604
|
if (!this.config) {
|
|
605
605
|
throw new Error("[FollowGate] SDK not initialized. Call init() first.");
|
|
606
606
|
}
|
|
607
607
|
if (this.isUnlocked()) {
|
|
608
|
-
if (this.config.
|
|
609
|
-
|
|
608
|
+
if (this.config.forceShow) {
|
|
609
|
+
this.clearUnlockStatus();
|
|
610
|
+
if (this.config.debug) {
|
|
611
|
+
console.log("[FollowGate] forceShow enabled - cleared unlock status, showing modal");
|
|
612
|
+
}
|
|
613
|
+
} else {
|
|
614
|
+
console.warn(
|
|
615
|
+
"[FollowGate] Modal skipped - user already unlocked.",
|
|
616
|
+
"Use forceShow: true in init() to always show modal, or call FollowGate.reset() to clear.",
|
|
617
|
+
this.config.userId ? `(userId: ${this.config.userId})` : "(no userId set)"
|
|
618
|
+
);
|
|
619
|
+
this.config.onComplete?.();
|
|
620
|
+
return;
|
|
610
621
|
}
|
|
611
|
-
this.config.onComplete?.();
|
|
612
|
-
return;
|
|
613
622
|
}
|
|
614
623
|
await this.fetchServerConfig();
|
|
615
624
|
if (this.config.twitter?.username && !this.hasUsername()) {
|
|
@@ -1111,7 +1120,7 @@ var FollowGateClient = class {
|
|
|
1111
1120
|
return this.currentUser !== null;
|
|
1112
1121
|
}
|
|
1113
1122
|
/**
|
|
1114
|
-
* Clear stored session
|
|
1123
|
+
* Clear stored session (user, actions, and unlock status)
|
|
1115
1124
|
*/
|
|
1116
1125
|
reset() {
|
|
1117
1126
|
this.currentUser = null;
|
|
@@ -1125,6 +1134,18 @@ var FollowGateClient = class {
|
|
|
1125
1134
|
console.log("[FollowGate] Session reset");
|
|
1126
1135
|
}
|
|
1127
1136
|
}
|
|
1137
|
+
/**
|
|
1138
|
+
* Clear only the unlock status (keeps user and actions)
|
|
1139
|
+
* Useful for allowing users to go through the flow again
|
|
1140
|
+
*/
|
|
1141
|
+
clearUnlockStatus() {
|
|
1142
|
+
if (typeof localStorage !== "undefined") {
|
|
1143
|
+
localStorage.removeItem(this.getStorageKey("followgate_unlocked"));
|
|
1144
|
+
}
|
|
1145
|
+
if (this.config?.debug) {
|
|
1146
|
+
console.log("[FollowGate] Unlock status cleared");
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1128
1149
|
// ============================================
|
|
1129
1150
|
// Intent URL Methods
|
|
1130
1151
|
// ============================================
|
package/dist/index.mjs
CHANGED
|
@@ -572,18 +572,27 @@ var FollowGateClient = class {
|
|
|
572
572
|
}
|
|
573
573
|
/**
|
|
574
574
|
* Show the FollowGate modal
|
|
575
|
-
* If user is already unlocked, calls onComplete immediately
|
|
575
|
+
* If user is already unlocked, calls onComplete immediately (unless forceShow is true)
|
|
576
576
|
*/
|
|
577
577
|
async show() {
|
|
578
578
|
if (!this.config) {
|
|
579
579
|
throw new Error("[FollowGate] SDK not initialized. Call init() first.");
|
|
580
580
|
}
|
|
581
581
|
if (this.isUnlocked()) {
|
|
582
|
-
if (this.config.
|
|
583
|
-
|
|
582
|
+
if (this.config.forceShow) {
|
|
583
|
+
this.clearUnlockStatus();
|
|
584
|
+
if (this.config.debug) {
|
|
585
|
+
console.log("[FollowGate] forceShow enabled - cleared unlock status, showing modal");
|
|
586
|
+
}
|
|
587
|
+
} else {
|
|
588
|
+
console.warn(
|
|
589
|
+
"[FollowGate] Modal skipped - user already unlocked.",
|
|
590
|
+
"Use forceShow: true in init() to always show modal, or call FollowGate.reset() to clear.",
|
|
591
|
+
this.config.userId ? `(userId: ${this.config.userId})` : "(no userId set)"
|
|
592
|
+
);
|
|
593
|
+
this.config.onComplete?.();
|
|
594
|
+
return;
|
|
584
595
|
}
|
|
585
|
-
this.config.onComplete?.();
|
|
586
|
-
return;
|
|
587
596
|
}
|
|
588
597
|
await this.fetchServerConfig();
|
|
589
598
|
if (this.config.twitter?.username && !this.hasUsername()) {
|
|
@@ -1085,7 +1094,7 @@ var FollowGateClient = class {
|
|
|
1085
1094
|
return this.currentUser !== null;
|
|
1086
1095
|
}
|
|
1087
1096
|
/**
|
|
1088
|
-
* Clear stored session
|
|
1097
|
+
* Clear stored session (user, actions, and unlock status)
|
|
1089
1098
|
*/
|
|
1090
1099
|
reset() {
|
|
1091
1100
|
this.currentUser = null;
|
|
@@ -1099,6 +1108,18 @@ var FollowGateClient = class {
|
|
|
1099
1108
|
console.log("[FollowGate] Session reset");
|
|
1100
1109
|
}
|
|
1101
1110
|
}
|
|
1111
|
+
/**
|
|
1112
|
+
* Clear only the unlock status (keeps user and actions)
|
|
1113
|
+
* Useful for allowing users to go through the flow again
|
|
1114
|
+
*/
|
|
1115
|
+
clearUnlockStatus() {
|
|
1116
|
+
if (typeof localStorage !== "undefined") {
|
|
1117
|
+
localStorage.removeItem(this.getStorageKey("followgate_unlocked"));
|
|
1118
|
+
}
|
|
1119
|
+
if (this.config?.debug) {
|
|
1120
|
+
console.log("[FollowGate] Unlock status cleared");
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1102
1123
|
// ============================================
|
|
1103
1124
|
// Intent URL Methods
|
|
1104
1125
|
// ============================================
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@followgate/js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.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",
|