mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-14 17:37:46 +00:00
Revert/undo-788f5083-ef8657bb (#8353)
This reverts the addition of GTM for 1.38, as it was still present in the built files. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-8353-Revert-undo-788f5083-ef8657bb-2f66d73d365081818d43fcaab220a4ef) by [Unito](https://www.unito.io)
This commit is contained in:
@@ -6,7 +6,6 @@ import {
|
||||
useFirebaseAuthStore
|
||||
} from '@/stores/firebaseAuthStore'
|
||||
import type { TierKey } from '@/platform/cloud/subscription/constants/tierPricing'
|
||||
import { startSubscriptionPurchaseTracking } from '@/platform/cloud/subscription/utils/subscriptionPurchaseTracker'
|
||||
import type { BillingCycle } from './subscriptionTierRank'
|
||||
|
||||
type CheckoutTier = TierKey | `${TierKey}-yearly`
|
||||
@@ -79,7 +78,6 @@ export async function performSubscriptionCheckout(
|
||||
const data = await response.json()
|
||||
|
||||
if (data.checkout_url) {
|
||||
startSubscriptionPurchaseTracking(tierKey, currentBillingCycle)
|
||||
if (openInNewTab) {
|
||||
window.open(data.checkout_url, '_blank')
|
||||
} else {
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
import type { TierKey } from '@/platform/cloud/subscription/constants/tierPricing'
|
||||
import type { BillingCycle } from './subscriptionTierRank'
|
||||
|
||||
type PendingSubscriptionPurchase = {
|
||||
tierKey: TierKey
|
||||
billingCycle: BillingCycle
|
||||
timestamp: number
|
||||
}
|
||||
|
||||
const STORAGE_KEY = 'pending_subscription_purchase'
|
||||
const MAX_AGE_MS = 24 * 60 * 60 * 1000 // 24 hours
|
||||
const VALID_TIERS: TierKey[] = ['standard', 'creator', 'pro', 'founder']
|
||||
const VALID_CYCLES: BillingCycle[] = ['monthly', 'yearly']
|
||||
|
||||
const safeRemove = (): void => {
|
||||
try {
|
||||
localStorage.removeItem(STORAGE_KEY)
|
||||
} catch {
|
||||
// Ignore storage errors (e.g. private browsing mode)
|
||||
}
|
||||
}
|
||||
|
||||
export function startSubscriptionPurchaseTracking(
|
||||
tierKey: TierKey,
|
||||
billingCycle: BillingCycle
|
||||
): void {
|
||||
if (typeof window === 'undefined') return
|
||||
try {
|
||||
const payload: PendingSubscriptionPurchase = {
|
||||
tierKey,
|
||||
billingCycle,
|
||||
timestamp: Date.now()
|
||||
}
|
||||
localStorage.setItem(STORAGE_KEY, JSON.stringify(payload))
|
||||
} catch {
|
||||
// Ignore storage errors (e.g. private browsing mode)
|
||||
}
|
||||
}
|
||||
|
||||
export function getPendingSubscriptionPurchase(): PendingSubscriptionPurchase | null {
|
||||
if (typeof window === 'undefined') return null
|
||||
|
||||
try {
|
||||
const raw = localStorage.getItem(STORAGE_KEY)
|
||||
if (!raw) return null
|
||||
|
||||
const parsed = JSON.parse(raw) as PendingSubscriptionPurchase
|
||||
if (!parsed || typeof parsed !== 'object') {
|
||||
safeRemove()
|
||||
return null
|
||||
}
|
||||
|
||||
const { tierKey, billingCycle, timestamp } = parsed
|
||||
if (
|
||||
!VALID_TIERS.includes(tierKey) ||
|
||||
!VALID_CYCLES.includes(billingCycle) ||
|
||||
typeof timestamp !== 'number'
|
||||
) {
|
||||
safeRemove()
|
||||
return null
|
||||
}
|
||||
|
||||
if (Date.now() - timestamp > MAX_AGE_MS) {
|
||||
safeRemove()
|
||||
return null
|
||||
}
|
||||
|
||||
return parsed
|
||||
} catch {
|
||||
safeRemove()
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
export function clearPendingSubscriptionPurchase(): void {
|
||||
if (typeof window === 'undefined') return
|
||||
safeRemove()
|
||||
}
|
||||
Reference in New Issue
Block a user