Skip to content

Commit 252d11c

Browse files
chore: remove debugging code (and introduced bug showing trial after login)
1 parent 709a033 commit 252d11c

File tree

3 files changed

+1
-156
lines changed

3 files changed

+1
-156
lines changed

components/AuthModal.tsx

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -123,19 +123,6 @@ export const AuthModal: React.FC<AuthModalProps> = ({
123123
};
124124

125125
const handleAppleSignIn = async () => {
126-
// Debug: Store that modal function was called
127-
if (typeof window !== "undefined") {
128-
try {
129-
sessionStorage.setItem(
130-
"apple_modal_handler_called",
131-
new Date().toISOString(),
132-
);
133-
(window as any).appleModalHandlerCalled = true;
134-
} catch (e) {
135-
// Ignore storage errors
136-
}
137-
}
138-
139126
setIsLoading(true);
140127
try {
141128
// Save last used method
@@ -385,22 +372,7 @@ export const AuthModal: React.FC<AuthModalProps> = ({
385372
type="button"
386373
intent="secondary"
387374
size="medium"
388-
onClick={(e) => {
389-
// Debug: Log that button was clicked
390-
if (typeof window !== "undefined") {
391-
try {
392-
sessionStorage.setItem(
393-
"apple_button_clicked",
394-
new Date().toISOString(),
395-
);
396-
(window as any).appleButtonClicked = true;
397-
} catch (err) {
398-
// Ignore storage errors
399-
}
400-
}
401-
console.log("Apple button clicked!"); // This should work even in production
402-
handleAppleSignIn();
403-
}}
375+
onClick={handleAppleSignIn}
404376
disabled={isLoading}
405377
className="w-full flex items-center justify-center gap-3 relative"
406378
>

contexts/AuthContext.tsx

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -98,19 +98,6 @@ export const AuthProvider: React.FC<AuthProviderProps> = ({ children }) => {
9898
};
9999

100100
const signInWithApple = async () => {
101-
// Debug: Store that this function was called
102-
if (typeof window !== "undefined") {
103-
try {
104-
sessionStorage.setItem(
105-
"apple_auth_context_called",
106-
new Date().toISOString(),
107-
);
108-
(window as any).appleAuthContextCalled = true;
109-
} catch (e) {
110-
// Ignore storage errors
111-
}
112-
}
113-
114101
try {
115102
const result = await AuthService.createAppleSession();
116103
return {

lib/appwrite/auth.ts

Lines changed: 0 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -78,20 +78,6 @@ export class AuthService {
7878
redirectUrl,
7979
);
8080

81-
// Debug: Store what we actually got back from Appwrite for Google
82-
if (typeof window !== "undefined") {
83-
try {
84-
sessionStorage.setItem("google_oauth_response_type", typeof url);
85-
sessionStorage.setItem(
86-
"google_oauth_response_value",
87-
JSON.stringify(url),
88-
);
89-
(window as any).googleOAuthResponse = url;
90-
} catch (e) {
91-
// Ignore storage errors
92-
}
93-
}
94-
9581
if (typeof url === "string") {
9682
window.location.href = url;
9783
}
@@ -134,117 +120,17 @@ export class AuthService {
134120

135121
const redirectUrl = `${window.location.origin}/auth/callback`;
136122

137-
// Add debug info to sessionStorage for production debugging
138-
if (typeof window !== "undefined") {
139-
const debugInfo = {
140-
timestamp: new Date().toISOString(),
141-
action: "apple_oauth_start",
142-
redirectUrl,
143-
origin: window.location.origin,
144-
hostname: window.location.hostname,
145-
};
146-
147-
try {
148-
sessionStorage.setItem(
149-
"apple_oauth_debug",
150-
JSON.stringify(debugInfo),
151-
);
152-
// Also add to window object for console inspection
153-
(window as any).appleOAuthDebug = debugInfo;
154-
} catch (e) {
155-
// Ignore storage errors
156-
}
157-
}
158-
159-
// Debug: Store that we're about to call createOAuth2Session
160-
if (typeof window !== "undefined") {
161-
try {
162-
sessionStorage.setItem(
163-
"apple_oauth_before_call",
164-
new Date().toISOString(),
165-
);
166-
} catch (e) {
167-
// Ignore storage errors
168-
}
169-
}
170-
171123
const url = await account!.createOAuth2Session(
172124
"apple" as any,
173125
redirectUrl,
174126
redirectUrl,
175127
);
176128

177-
// Debug: Store what we actually got back from Appwrite
178-
if (typeof window !== "undefined") {
179-
try {
180-
sessionStorage.setItem(
181-
"apple_oauth_after_call",
182-
new Date().toISOString(),
183-
);
184-
sessionStorage.setItem("apple_oauth_response_type", typeof url);
185-
sessionStorage.setItem(
186-
"apple_oauth_response_value",
187-
JSON.stringify(url),
188-
);
189-
(window as any).appleOAuthResponse = url;
190-
} catch (e) {
191-
// Ignore storage errors
192-
}
193-
}
194-
195-
// If we get here without an error and url is undefined,
196-
// it might mean Appwrite handles the redirect internally
197-
if (url === undefined) {
198-
// Store that we got undefined but no error
199-
if (typeof window !== "undefined") {
200-
try {
201-
sessionStorage.setItem(
202-
"apple_oauth_undefined_no_error",
203-
new Date().toISOString(),
204-
);
205-
} catch (e) {
206-
// Ignore storage errors
207-
}
208-
}
209-
}
210-
211129
if (typeof url === "string") {
212-
// Store success info
213-
if (typeof window !== "undefined") {
214-
try {
215-
sessionStorage.setItem("apple_oauth_redirect_url", url);
216-
} catch (e) {
217-
// Ignore storage errors
218-
}
219-
}
220130
window.location.href = url;
221131
}
222132
return { success: true };
223133
} catch (error: any) {
224-
// Store error info for debugging in production
225-
if (typeof window !== "undefined") {
226-
const errorInfo = {
227-
timestamp: new Date().toISOString(),
228-
action: "apple_oauth_error",
229-
message: error.message,
230-
code: error.code,
231-
type: error.type,
232-
name: error.name,
233-
stack: error.stack,
234-
};
235-
236-
try {
237-
sessionStorage.setItem(
238-
"apple_oauth_error",
239-
JSON.stringify(errorInfo),
240-
);
241-
// Also add to window object
242-
(window as any).appleOAuthError = errorInfo;
243-
} catch (e) {
244-
// Ignore storage errors
245-
}
246-
}
247-
248134
return {
249135
success: false,
250136
error: {

0 commit comments

Comments
 (0)