1 |
- {"version":3,"file":"static/chunks/44462.395641c9ceea67ca.js","mappings":"qJAAO,E,oHAAKA,GAAAA,EACI,eAAG,kBADPA,EAEa,wBAAG,2B,CAFhBA,IAAAA,EAAgB,KCQ5B,IAAMC,EAA0BC,KAC9B,W,OAAM,mCAAoE,C,wDAGtEC,EAA0BD,KAC9B,W,OAAM,mCAAiE,C,wDAuCzE,EAhCsC,Y,IAAGE,EAAY,EAAZA,aACjC,GAAaC,EAAAA,EAAAA,MAAXC,OAEFC,EAAc,W,OAAA,iBAAOC,G,iEAUzB,OATAF,GACEG,EAAAA,EAAAA,OACA,SAACC,GACC,OAAO,kBAAKA,GAAkB,CAAEN,aAAc,SAEhD,CACEO,YAAY,IAGhB,C,GAAMC,EAAAA,EAAAA,IAAqB,CAAEJ,iBAAAA,K,cAA7B,S,2BAVyBA,G,gCAAP,GAapB,GAAIJ,EAAaS,OAASb,EAAiBc,eACzC,OACE,SAACb,EAAuB,CAACM,YAAa,W,OAAMA,EAAYP,EAAiBc,mBAG7E,GAAIV,EAAaS,OAASb,EAAiBG,wBACzC,OACE,SAACA,EAAuB,CACtBI,YAAa,W,OAAMA,EAAYP,EAAiBG,4BAKtD,MAAM,IAAIY,MAAM","sources":["webpack://_N_E/./types/auth/Announcement.ts","webpack://_N_E/./src/components/Auth/Announcements/AnnouncementModalBodyResolver.tsx"],"sourcesContent":["export enum AnnouncementType {\n AuthOnboarding = 'auth-onboarding',\n CollectionsAnnouncement = 'collections-announcement',\n}\n\ntype Announcement = {\n id: string;\n type: AnnouncementType;\n};\n\nexport default Announcement;\n","import dynamic from 'next/dynamic';\nimport { useSWRConfig } from 'swr';\n\nimport { completeAnnouncement } from '@/utils/auth/api';\nimport { makeUserProfileUrl } from '@/utils/auth/apiPaths';\nimport Announcement, { AnnouncementType } from 'types/auth/Announcement';\nimport UserProfile from 'types/auth/UserProfile';\n\nconst WelcomeMessageModalBody = dynamic(\n () => import('@/components/Auth/Announcements/AuthOnboardingAnnouncement'),\n);\n\nconst CollectionsAnnouncement = dynamic(\n () => import('@/components/Auth/Announcements/CollectionsAnnouncement'),\n);\n\ntype AnnouncementModalBodyResolverProps = {\n announcement: Announcement;\n};\n\nconst AnnouncementModalBodyResolver = ({ announcement }: AnnouncementModalBodyResolverProps) => {\n const { mutate } = useSWRConfig();\n\n const onCompleted = async (announcementType: AnnouncementType) => {\n mutate(\n makeUserProfileUrl(),\n (currentProfileData: UserProfile) => {\n return { ...currentProfileData, announcement: null };\n },\n {\n revalidate: false,\n },\n );\n await completeAnnouncement({ announcementType });\n };\n\n if (announcement.type === AnnouncementType.AuthOnboarding) {\n return (\n <WelcomeMessageModalBody onCompleted={() => onCompleted(AnnouncementType.AuthOnboarding)} />\n );\n }\n if (announcement.type === AnnouncementType.CollectionsAnnouncement) {\n return (\n <CollectionsAnnouncement\n onCompleted={() => onCompleted(AnnouncementType.CollectionsAnnouncement)}\n />\n );\n }\n\n throw new Error(\"AnnouncementModalBodyResolver doesn't support this announcement type\");\n};\n\nexport default AnnouncementModalBodyResolver;\n"],"names":["AnnouncementType","WelcomeMessageModalBody","dynamic","CollectionsAnnouncement","announcement","useSWRConfig","mutate","onCompleted","announcementType","makeUserProfileUrl","currentProfileData","revalidate","completeAnnouncement","type","AuthOnboarding","Error"],"sourceRoot":""}
|