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IAAAA,QAAkB,CAAC,IAAU,OAANT,EAAM,MAEjC,EAAG,CAACG,EAAYC,EAAMH,EAAQD,EAAM,EAEpC,GAAM,MAAElC,CAAI,CAAE,CAAG4C,CAAAA,EAAAA,EAAAA,EAAAA,CAAMA,CAA2B,iBAAkB,IAClE7C,CAAAA,EAAAA,EAAAA,CAAAA,CAAaA,CAAC,iBAAkB,CAC9B8C,GAAIP,EAAKQ,MAAM,IAIfC,GAAoB,EAClB,SAAEC,CAAO,SAAEC,CAAO,WAAEC,CAAS,QAAEC,CAAM,QAAEC,CAAM,OAAEC,CAAK,CAAE,CAAGlB,EAAOmB,KAAK,OAK3E,EAJIN,EAIA,CAJWC,GAAWC,GAAaC,GAAUC,GAAUC,CAAAA,GAAO,CAChEN,GAAW,GAGR/C,GAIH,GAJS,EAIT,KAACc,EAAAA,OAAaA,CAAAA,CAACE,MAAM,sBACnB,UAACgB,EAAAA,CACCgB,QAASA,EACTC,QAASA,EACTC,UAAWA,EACXC,OAAQA,EACRC,OAAQA,EACRC,MAAOA,EACPN,SAAUA,EACVQ,iBAAkBvD,EAAKwD,oBAAoB,KAZxC,IAgBX","sources":["webpack://_N_E/?a720","webpack://_N_E/./utils/api-helpers.ts","webpack://_N_E/./public/Raraity_Primary_Icon_Chartreuse.svg","webpack://_N_E/./components/Layout/ContentLayout.tsx","webpack://_N_E/./pages/create-story.tsx"],"sourcesContent":["\n (window.__NEXT_P = window.__NEXT_P || []).push([\n \"/create-story\",\n function () {\n return require(\"private-next-pages/create-story.tsx\");\n }\n ]);\n if(module.hot) {\n module.hot.dispose(function () {\n window.__NEXT_P.push([\"/create-story\"])\n });\n }\n ","export async function fetchGetJSON(url: string) {\n try {\n const data = await fetch(url).then((res) => res.json());\n return data;\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n }\n throw err;\n }\n}\n\nexport async function fetchPostJSON(url: string, data?: object) {\n try {\n // Default options are marked with *\n const response = await fetch(url, {\n method: \"POST\", // *GET, POST, PUT, DELETE, etc.\n mode: \"cors\", // no-cors, *cors, same-origin\n cache: \"no-cache\", // *default, no-cache, reload, force-cache, only-if-cached\n credentials: \"same-origin\", // include, *same-origin, omit\n headers: {\n \"Content-Type\": \"application/json\",\n // 'Content-Type': 'application/x-www-form-urlencoded',\n },\n redirect: \"follow\", // manual, *follow, error\n referrerPolicy: \"no-referrer\", // no-referrer, *client\n body: JSON.stringify(data || {}), // body data type must match \"Content-Type\" header\n });\n return await response.json(); // parses JSON response into native JavaScript objects\n } catch (err) {\n if (err instanceof Error) {\n throw new Error(err.message);\n }\n throw err;\n }\n}\n","export default {\"src\":\"/_next/static/media/Raraity_Primary_Icon_Chartreuse.2e9c99e2.svg\",\"height\":1728,\"width\":1439,\"blurWidth\":0,\"blurHeight\":0};","import dynamic from \"next/dynamic\";\nimport React from \"react\";\nimport Image from \"next/image\";\nimport Chartreuse from \"../../public/Raraity_Primary_Icon_Chartreuse.svg\";\n\nconst Header = dynamic(() => import(\"./Header\"));\n\ntype ContentLayoutProps = {\n children: React.ReactNode;\n title: string;\n};\n\nfunction ContentLayout({ children, title }: ContentLayoutProps) {\n return (\n <>\n
\n \n {/* MOBILE Background Design with Chartreuse 'R' Logos */}\n
\n {/* MOBILE Top Right Corner R */}\n
\n \"Raraity\"\n
\n {/* MOBILE Bottom Right Corner R */}\n
\n \"Raraity\"\n
\n {/* MOBILE Bottom Left Corner R */}\n
\n \"Raraity\"\n
\n {/* MOBILE Top Right Corner R */}\n
\n \"Raraity\"\n
\n
\n {/* DESKTOP | Background Design with 2 Chartreuse 'R' Logos */}\n
\n {/* DESKTOP Right R */}\n
\n \"Raraity\"\n
\n {/* DESKTOP Left R [this R is rotated 180 degrees] */}\n
\n \"Raraity\"\n
\n
\n {/* Wave Below Navbar */}\n
\n {/* Top wavy SVG */}\n \n \n\n \n \n
\n
\n {children}\n
\n \n \n );\n}\n\nexport default ContentLayout;\n","import React, { useEffect } from \"react\";\nimport { useRouter } from \"next/router\";\nimport { useAuthenticator } from \"@aws-amplify/ui-react\";\nimport dynamic from \"next/dynamic\";\nimport useSWR from \"swr\";\nimport LogRocket from \"logrocket\";\nimport type { GetServerSideProps } from \"next\";\nimport { fetchUserAttributes } from \"@aws-amplify/auth/server\";\nimport ContentLayout from \"../components/Layout/ContentLayout\";\nimport { fetchPostJSON } from \"../utils/api-helpers\";\nimport { runWithAmplifyServerContext } from \"../utils/amplifyServerUtils\";\nimport { RemainingApiResponseData } from \"../src/types\";\n\nconst CreateStoryComponent = dynamic(() => import(\"../components/CreateStory\"));\n\nexport const getServerSideProps: GetServerSideProps = async ({ req, res }) => {\n try {\n const userAttributes = await runWithAmplifyServerContext({\n nextServerContext: { request: req, response: res },\n operation: (contextSpec) => fetchUserAttributes(contextSpec),\n });\n return {\n props: {\n email: userAttributes.email,\n },\n };\n } catch (err) {\n console.log(err);\n return {\n props: {\n email: null,\n },\n };\n }\n};\n\nfunction CreateStory({ email }) {\n const router = useRouter();\n const { authStatus, user } = useAuthenticator((context) => [\n context.authStatus,\n context.user,\n ]);\n\n useEffect(() => {\n if (authStatus === \"unauthenticated\") {\n router.push(\"/login\");\n }\n if (authStatus === \"authenticated\" && user) {\n LogRocket.log(\"Adding user attribute...\");\n LogRocket.identify(`'${email}'`);\n }\n }, [authStatus, user, router, email]);\n\n const { data } = useSWR(\"/api/remaining\", () =>\n fetchPostJSON(\"/api/remaining\", {\n id: user.userId,\n }),\n );\n\n let discover: boolean = false;\n const { feeling, subject, subOption, medium, styles, color } = router.query;\n if (feeling || subject || subOption || medium || styles || color) {\n discover = true;\n }\n\n if (!data) {\n return null;\n }\n return (\n \n \n \n );\n}\n\nexport default CreateStory;\n"],"names":["fetchGetJSON","url","fetch","then","res","json","err","Error","message","fetchPostJSON","data","response","method","mode","cache","credentials","headers","redirect","referrerPolicy","body","JSON","stringify","Header","dynamic","ContentLayout","children","title","div","className","style","backgroundColor","Image","src","Chartreuse","alt","svg","viewBox","preserveAspectRatio","xmlns","path","fill","d","CreateStoryComponent","CreateStory","email","router","useRouter","authStatus","user","useAuthenticator","context","useEffect","push","LogRocket","useSWR","id","userId","discover","feeling","subject","subOption","medium","styles","color","query","remainingCredits","remainingGenerations"],"sourceRoot":"","ignoreList":[]}