AW-483-484-485-fix-bugs
This commit is contained in:
parent
ded38f67ef
commit
24731122fa
@ -13,7 +13,8 @@ export interface PayloadCreate {
|
||||
source: string, // Type: string
|
||||
sign: boolean, // Type: boolean
|
||||
signDate: string | undefined, // Type: string, ISO Date
|
||||
utm: IUTM // Type: { [key: string]: string } - Optional
|
||||
utm: IUTM, // Type: { [key: string]: string } - Optional
|
||||
domain: string // Type: string
|
||||
}
|
||||
|
||||
export interface PayloadUpdate {
|
||||
|
||||
@ -225,7 +225,12 @@ function App(): JSX.Element {
|
||||
|
||||
if (isPageAvailable) {
|
||||
const utm = parseQueryParams();
|
||||
dispatch(actions.utm.update(utm));
|
||||
console.log('App component - parsed UTM on page:', location.pathname, utm);
|
||||
// Only update UTM if there are new parameters and they're not empty
|
||||
if (Object.keys(utm).length > 0) {
|
||||
console.log('App component - dispatching UTM update:', utm);
|
||||
dispatch(actions.utm.update(utm));
|
||||
}
|
||||
}
|
||||
}, [dispatch, location.pathname]);
|
||||
|
||||
|
||||
@ -20,6 +20,8 @@ import { EUnleashFlags, useUnleash } from "@/hooks/ab/unleash/useUnleash";
|
||||
import { IFunnelPaymentVariant } from "@/api/resources/Session";
|
||||
import { useFunnel } from "@/hooks/funnel/useFunnel";
|
||||
|
||||
const environments = import.meta.env;
|
||||
|
||||
interface IPaymentPageProps {
|
||||
isSinglePayment?: boolean;
|
||||
className?: string;
|
||||
@ -50,7 +52,7 @@ function PaymentPage({
|
||||
funnel,
|
||||
paymentPlacement,
|
||||
onError,
|
||||
onSuccess,
|
||||
// onSuccess,
|
||||
onBack,
|
||||
onPopState,
|
||||
}: IPaymentPageProps) {
|
||||
@ -114,7 +116,10 @@ function PaymentPage({
|
||||
currency,
|
||||
value: ((activeProduct?.trialPrice || 100) / 100).toFixed(2),
|
||||
});
|
||||
onSuccess?.();
|
||||
// onSuccess?.();
|
||||
|
||||
const redirectUrl = `${environments.AURA_NEW_SITE_URL}/auth/callback?jwtToken=${token}&nextUrl=/ap`;
|
||||
return window.location.replace(redirectUrl);
|
||||
}
|
||||
|
||||
function onModalClosed(): void {
|
||||
|
||||
1
src/env.d.ts
vendored
1
src/env.d.ts
vendored
@ -12,4 +12,5 @@ interface ImportMetaEnv {
|
||||
AURA_GA_MEASUREMENT_ID: string,
|
||||
AURA_UNLEASH_URL: string,
|
||||
AURA_UNLEASH_CLIENT_KEY: string,
|
||||
AURA_NEW_SITE_URL: string,
|
||||
}
|
||||
@ -27,17 +27,21 @@ export const useSession = () => {
|
||||
sessionId: session[source],
|
||||
status: "old"
|
||||
}
|
||||
};
|
||||
}
|
||||
try {
|
||||
const sessionFromServer = await api.createSession({
|
||||
const sessionParams = {
|
||||
feature,
|
||||
locale: language,
|
||||
timezone,
|
||||
source,
|
||||
sign: checked,
|
||||
signDate: dateOfCheck.length ? dateOfCheck : undefined,
|
||||
utm
|
||||
});
|
||||
utm,
|
||||
domain: window.location.hostname
|
||||
};
|
||||
console.log('Creating session with parameters:', sessionParams);
|
||||
const sessionFromServer = await api.createSession(sessionParams);
|
||||
console.log('Session creation response:', sessionFromServer);
|
||||
if (sessionFromServer?.sessionId?.length && sessionFromServer?.status === "success") {
|
||||
dispatch(actions.session.update({
|
||||
session: sessionFromServer.sessionId,
|
||||
@ -46,13 +50,14 @@ export const useSession = () => {
|
||||
localStorage.setItem(`${source}_sessionId`, sessionFromServer.sessionId);
|
||||
return sessionFromServer
|
||||
}
|
||||
console.error('Session creation failed - invalid response:', sessionFromServer);
|
||||
setIsError(true);
|
||||
return {
|
||||
status: "error",
|
||||
sessionId: ""
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error('Session creation failed with error:', error);
|
||||
setIsError(true);
|
||||
return {
|
||||
status: "error",
|
||||
|
||||
10
src/init.tsx
10
src/init.tsx
@ -24,12 +24,22 @@ import HeadData from "./utils/Helmet";
|
||||
import Clarity from '@microsoft/clarity';
|
||||
import { InitializationProvider } from "./initialization";
|
||||
import { getSourceByPathname } from "./utils/source.utils";
|
||||
import { parseQueryParams } from "./services/url";
|
||||
import { actions } from "./store";
|
||||
|
||||
pdfjs.GlobalWorkerOptions.workerSrc = `https://unpkg.com/pdfjs-dist@${pdfjs.version}/legacy/build/pdf.worker.min.js`;
|
||||
|
||||
const environments = import.meta.env;
|
||||
|
||||
const init = async () => {
|
||||
// Parse UTM parameters from URL at initialization
|
||||
const utm = parseQueryParams();
|
||||
console.log('UTM parameters parsed at init:', utm);
|
||||
if (Object.keys(utm).length > 0) {
|
||||
console.log('Dispatching UTM update:', utm);
|
||||
store.dispatch(actions.utm.update(utm));
|
||||
}
|
||||
|
||||
await setLanguage();
|
||||
const api = createApi();
|
||||
|
||||
|
||||
@ -12,8 +12,7 @@ const utmSlice = createSlice({
|
||||
initialState,
|
||||
reducers: {
|
||||
update(state, action: PayloadAction<IUTM>) {
|
||||
state = action.payload
|
||||
return state
|
||||
return { ...state, ...action.payload }
|
||||
},
|
||||
},
|
||||
extraReducers: (builder) => builder.addCase('reset', () => initialState)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user