diff --git a/backend/app/Resources/Account/AccountResource.php b/backend/app/Resources/Account/AccountResource.php index 1c8000acab..dcc55f687f 100644 --- a/backend/app/Resources/Account/AccountResource.php +++ b/backend/app/Resources/Account/AccountResource.php @@ -14,6 +14,7 @@ class AccountResource extends JsonResource public function toArray(Request $request): array { $activeStripePlatform = $this->getPrimaryStripePlatform(); + $isHiEvents = config('app.is_hi_events', false); return [ 'id' => $this->getId(), @@ -31,6 +32,9 @@ public function toArray(Request $request): array 'stripe_account_details' => $activeStripePlatform->getStripeAccountDetails(), 'stripe_platform' => $this->getActiveStripePlatform()?->value, ]), + $this->mergeWhen($isHiEvents, fn() => [ + 'stripe_hi_events_primary_platform' => config('services.stripe.primary_platform') + ]), $this->mergeWhen($this->getConfiguration() !== null, fn() => [ 'configuration' => new AccountConfigurationResource($this->getConfiguration()), diff --git a/frontend/src/components/common/PoweredByFooter/index.tsx b/frontend/src/components/common/PoweredByFooter/index.tsx index b7ea50f5a2..0f8013dcfb 100644 --- a/frontend/src/components/common/PoweredByFooter/index.tsx +++ b/frontend/src/components/common/PoweredByFooter/index.tsx @@ -1,8 +1,9 @@ import {t} from "@lingui/macro"; import classes from "./FloatingPoweredBy.module.scss"; import classNames from "classnames"; -import React from "react"; +import React, {useMemo} from "react"; import {iHavePurchasedALicence, isHiEvents} from "../../../utilites/helpers.ts"; +import {getConfig} from "../../../utilites/config.ts"; /** * (c) Hi.Events Ltd 2025 @@ -17,29 +18,54 @@ import {iHavePurchasedALicence, isHiEvents} from "../../../utilites/helpers.ts"; * * If you wish to remove this notice, a commercial license is available at: https://hi.events/licensing */ -export const PoweredByFooter = (props: React.DetailedHTMLProps, HTMLDivElement>) => { +export const PoweredByFooter = ( + props: React.DetailedHTMLProps, HTMLDivElement> +) => { if (iHavePurchasedALicence()) { return <>; } + const link = useMemo(() => { + let host = getConfig("VITE_FRONTEND_URL") ?? "unknown"; + let medium = "app"; + + if (typeof window !== "undefined" && window.location) { + host = window.location.hostname; + medium = window.location.pathname.includes("/widget") ? "widget" : "app"; + } + + const url = new URL("https://hi.events"); + url.searchParams.set("utm_source", "app-powered-by-footer"); + url.searchParams.set("utm_medium", isHiEvents() ? medium : 'self-hosted-' + medium); + url.searchParams.set("utm_campaign", "powered-by"); + url.searchParams.set("utm_content", isHiEvents() ? "hi.events" : host); + + return url.toString(); + }, []); + const footerContent = isHiEvents() ? ( <> - {t`Planning an event?`} {' '} - + {t`Planning an event?`}{" "} + {t`Try Hi.Events Free`} ) : ( <> - {t`Powered by`} {' '} - + {t`Powered by`}{" "} + Hi.Events - 🚀 + {" "} + 🚀 ); diff --git a/frontend/src/components/routes/account/ManageAccount/sections/PaymentSettings/index.tsx b/frontend/src/components/routes/account/ManageAccount/sections/PaymentSettings/index.tsx index 6c22f8584f..5b359e5266 100644 --- a/frontend/src/components/routes/account/ManageAccount/sections/PaymentSettings/index.tsx +++ b/frontend/src/components/routes/account/ManageAccount/sections/PaymentSettings/index.tsx @@ -105,8 +105,7 @@ const MigrationBanner = ({stripeData}: { stripeData: StripeConnectAccountsRespon
- {t`Ready to Upgrade?`} - {t`Complete the setup below to continue`} + {t`Complete the setup below to continue`}
@@ -370,7 +369,6 @@ const HiEventsConnectStatus = ({account}: { account: Account }) => { const hasIrelandAccount = !!ieAccount; const isIrelandComplete = ieAccount?.is_setup_complete === true; - // Build the appropriate UI based on clear conditions let content; if (isIrelandComplete) { @@ -442,7 +440,7 @@ const HiEventsConnectStatus = ({account}: { account: Account }) => { variant="light" size="sm" leftSection={} - onClick={() => handleSetupStripe('ie')} + onClick={() => handleSetupStripe((account?.stripe_hi_events_primary_platform || 'ie') as 'ca' | 'ie')} > {t`Connect with Stripe`} diff --git a/frontend/src/types.ts b/frontend/src/types.ts index ce2dd91f01..dd515bd706 100644 --- a/frontend/src/types.ts +++ b/frontend/src/types.ts @@ -99,6 +99,7 @@ export interface Account { configuration?: AccountConfiguration; requires_manual_verification?: boolean; stripe_platform: string; + stripe_hi_events_primary_platform?: string; } export interface AccountConfiguration { diff --git a/frontend/src/utilites/helpers.ts b/frontend/src/utilites/helpers.ts index 33aa0853b4..656368bf5a 100644 --- a/frontend/src/utilites/helpers.ts +++ b/frontend/src/utilites/helpers.ts @@ -111,7 +111,7 @@ export const iHavePurchasedALicence = () => { } export const isHiEvents = () => { - return true; + return getConfig('VITE_FRONTEND_URL')?.includes('.hi.events'); } export const isEmptyHtml = (content: string) => {