Skip to content
Merged

Test #4701

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,16 @@ const JsonImportModal = ({ onClose }: { onClose: () => void }) => {

const utmParams = getUtmParams();
if (utmParams.shortUrlContent) setValue('name', utmParams.shortUrlContent);

removeUtmWorkflow();
removeUtmParams();
},
{ manual: false }
);

const handleCloseJsonImportModal = () => {
onClose();
removeUtmParams();
removeUtmWorkflow();
};

const avatar = watch('avatar');
const {
File,
Expand Down Expand Up @@ -132,6 +135,8 @@ const JsonImportModal = ({ onClose }: { onClose: () => void }) => {
router.push(`/app/detail?appId=${id}`);
loadMyApps();
onClose();
removeUtmParams();
removeUtmWorkflow();
},
successToast: t('common:common.Create Success')
}
Expand All @@ -141,7 +146,6 @@ const JsonImportModal = ({ onClose }: { onClose: () => void }) => {
<>
<MyModal
isOpen
onClose={onClose}
isLoading={isCreating || isFetching}
title={t('app:type.Import from json')}
iconSrc="common/importLight"
Expand Down Expand Up @@ -182,7 +186,7 @@ const JsonImportModal = ({ onClose }: { onClose: () => void }) => {
</Box>
</ModalBody>
<ModalFooter gap={4}>
<Button variant={'whiteBase'} onClick={onClose}>
<Button variant={'whiteBase'} onClick={handleCloseJsonImportModal}>
{t('common:common.Cancel')}
</Button>
<Button onClick={handleSubmit(onSubmit)}>{t('common:common.Confirm')}</Button>
Expand Down
4 changes: 3 additions & 1 deletion projects/app/src/web/context/useInitApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ export const useInitApp = () => {
...(utm_medium && { shortUrlMedium: utm_medium }),
...(utm_content && { shortUrlContent: utm_content })
};
setUtmParams(utmParams);
if (utm_workflow) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不可能为空呀

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可能啊,有的推文是没有json的

setUtmParams(utmParams);
}
setFastGPTSem({ keyword: k, ...utmParams });

const newPath = getPathWithoutMarketingParams();
Expand Down
6 changes: 3 additions & 3 deletions projects/app/src/web/support/marketing/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ export const setBdVId = (bdVid?: string) => {
};

export const getUtmWorkflow = () => {
return sessionStorage.getItem('utm_workflow') || undefined;
return localStorage.getItem('utm_workflow') || undefined;
};
export const setUtmWorkflow = (utmWorkflow?: string) => {
if (!utmWorkflow) return;
sessionStorage.setItem('utm_workflow', utmWorkflow);
localStorage.setItem('utm_workflow', utmWorkflow);
};
export const removeUtmWorkflow = () => {
sessionStorage.removeItem('utm_workflow');
localStorage.removeItem('utm_workflow');
};

export const getUtmParams = () => {
Expand Down
Loading