@epic-web/workshop-app 5.21.0 → 5.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-BwQvf4AS.js","sources":["../../../app/routes/_app+/account.tsx"],"sourcesContent":["import { deleteCache } from '@epic-web/workshop-utils/cache.server'\nimport {\n\
|
|
1
|
+
{"version":3,"file":"account-BwQvf4AS.js","sources":["../../../app/routes/_app+/account.tsx"],"sourcesContent":["import { deleteCache } from '@epic-web/workshop-utils/cache.server'\nimport {\n\tlogout,\n\trequireAuthInfo,\n\tsetPreferences,\n} from '@epic-web/workshop-utils/db.server'\nimport { type SEOHandle } from '@nasa-gcn/remix-seo'\nimport { redirect, type LoaderFunctionArgs } from '@remix-run/node'\nimport { Form, Link } from '@remix-run/react'\nimport { Button } from '#app/components/button.tsx'\nimport { Icon } from '#app/components/icons.tsx'\nimport { SimpleTooltip } from '#app/components/ui/tooltip.js'\nimport { useOptionalDiscordMember, useUser } from '#app/components/user.tsx'\nimport { useWorkshopConfig } from '#app/components/workshop-config.tsx'\nimport { ensureUndeployed } from '#app/utils/misc.tsx'\nimport { redirectWithToast } from '#app/utils/toast.server.ts'\n\nexport const handle: SEOHandle = {\n\tgetSitemapEntries: () => null,\n}\n\nexport async function loader({ request }: LoaderFunctionArgs) {\n\tensureUndeployed()\n\tawait requireAuthInfo({ request })\n\treturn {}\n}\n\nexport async function action({ request }: { request: Request }) {\n\tensureUndeployed()\n\tconst formData = await request.formData()\n\tconst intent = formData.get('intent')\n\tif (intent === 'logout') {\n\t\tawait logout()\n\t\tawait deleteCache()\n\t\treturn redirectWithToast('/login', {\n\t\t\ttype: 'success',\n\t\t\ttitle: 'Logged out',\n\t\t\tdescription: 'Goodbye! Come back soon!',\n\t\t})\n\t} else if (intent === 'presence-opt-out') {\n\t\tconst optOut = formData.get('optOut') === 'true'\n\t\tawait setPreferences({ presence: { optOut } })\n\t\treturn redirectWithToast('/account', {\n\t\t\ttitle: optOut ? 'Opted out' : 'Opted in',\n\t\t\tdescription: `You are now ${optOut ? 'invisible' : 'visible'}.`,\n\t\t\ttype: 'success',\n\t\t})\n\t}\n\n\treturn redirect('/account')\n}\n\nfunction useConnectDiscordURL() {\n\tconst {\n\t\tproduct: { host },\n\t} = useWorkshopConfig()\n\treturn `https://${host}/discord`\n}\n\nexport default function Account() {\n\tconst user = useUser()\n\tconst config = useWorkshopConfig()\n\tconst discordMember = useOptionalDiscordMember()\n\tconst connectDiscordURL = useConnectDiscordURL()\n\n\treturn (\n\t\t<main className=\"container flex h-full w-full max-w-3xl flex-grow flex-col items-center justify-center gap-4\">\n\t\t\t{user.imageUrlLarge ? (\n\t\t\t\t<img\n\t\t\t\t\tclassName=\"h-36 w-36 rounded-full\"\n\t\t\t\t\talt={discordMember?.displayName ?? user.name ?? user.email}\n\t\t\t\t\tsrc={user.imageUrlLarge}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<Icon name=\"User\" className=\"flex-shrink-0\" size=\"lg\" />\n\t\t\t)}\n\t\t\t<h1 className=\"mb-1 text-2xl\">Your Account</h1>\n\t\t\t<p className=\"text-center text-gray-700 dark:text-gray-300\">\n\t\t\t\t{user.name\n\t\t\t\t\t? `Hi ${\n\t\t\t\t\t\t\tdiscordMember?.displayName ?? user.name\n\t\t\t\t\t\t}, your device is logged in with ${user.email}.`\n\t\t\t\t\t: `Your device is logged in with ${user.email}.`}\n\t\t\t</p>\n\t\t\t{discordMember ? (\n\t\t\t\t<>\n\t\t\t\t\t<p className=\"text-center text-gray-700 dark:text-gray-300\">\n\t\t\t\t\t\tAnd you are connected to discord as{' '}\n\t\t\t\t\t\t<a\n\t\t\t\t\t\t\thref={`https://discord.com/users/${discordMember.id}`}\n\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\tclassName=\"underline\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{discordMember.displayName}\n\t\t\t\t\t\t</a>\n\t\t\t\t\t\t.\n\t\t\t\t\t</p>\n\t\t\t\t</>\n\t\t\t) : (\n\t\t\t\t<div className=\"flex items-center gap-2\">\n\t\t\t\t\t<Link\n\t\t\t\t\t\tto={connectDiscordURL}\n\t\t\t\t\t\tclassName=\"inline-flex items-center gap-2 underline\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Icon name=\"Discord\" size=\"lg\" />\n\t\t\t\t\t\tConnect Discord\n\t\t\t\t\t</Link>\n\t\t\t\t\t<SimpleTooltip content=\"This will give you access to the exclusive Discord channels for Epic Web\">\n\t\t\t\t\t\t<Icon name=\"Question\" tabIndex={0} />\n\t\t\t\t\t</SimpleTooltip>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t\t<div className=\"flex items-center gap-2\">\n\t\t\t\t<Form method=\"post\">\n\t\t\t\t\t<Button varient=\"mono\" name=\"intent\" value=\"logout\">\n\t\t\t\t\t\tLog device out\n\t\t\t\t\t</Button>\n\t\t\t\t</Form>\n\t\t\t\t<SimpleTooltip\n\t\t\t\t\tcontent={\n\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\tNote: it is your <i className=\"italic\">device</i> that's logged\n\t\t\t\t\t\t\tin, not your browser.\n\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\tSo all browsers on this device will be logged in with the same\n\t\t\t\t\t\t\taccount on this device.\n\t\t\t\t\t\t</div>\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<Icon name=\"Question\" tabIndex={0} />\n\t\t\t\t</SimpleTooltip>\n\t\t\t</div>\n\t\t\t<hr className=\"w-full\" />\n\t\t\t<ul className=\"flex list-inside list-disc flex-col gap-2 self-start\">\n\t\t\t\t<li>\n\t\t\t\t\t<Link\n\t\t\t\t\t\tto={`https://${config.product.host}/profile`}\n\t\t\t\t\t\tclassName=\"inline-flex gap-1 underline\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<span>Manage your account</span>\n\t\t\t\t\t\t<Icon name=\"ExternalLink\" />\n\t\t\t\t\t</Link>\n\t\t\t\t</li>\n\t\t\t\t<li>\n\t\t\t\t\t<Link to=\"/preferences\" className=\"underline\">\n\t\t\t\t\t\tManage your preferences\n\t\t\t\t\t</Link>\n\t\t\t\t</li>\n\t\t\t\t<li>\n\t\t\t\t\t<Link to=\"/onboarding\" className=\"underline\">\n\t\t\t\t\t\tReview onboarding\n\t\t\t\t\t</Link>\n\t\t\t\t</li>\n\t\t\t\t<li>\n\t\t\t\t\t<Link to=\"/support\" className=\"underline\">\n\t\t\t\t\t\tGet support\n\t\t\t\t\t</Link>\n\t\t\t\t</li>\n\t\t\t</ul>\n\t\t</main>\n\t)\n}\n"],"names":["handle","getSitemapEntries","useConnectDiscordURL","product","host","useWorkshopConfig","Account","user","useUser","config","discordMember","useOptionalDiscordMember","connectDiscordURL","jsxs","className","children","imageUrlLarge","jsx","alt","displayName","name","email","src","Icon","size","Fragment","href","id","target","rel","Link","to","SimpleTooltip","content","tabIndex","Form","method","Button","varient","value"],"mappings":"sTAiBO,MAAMA,EAAoB,CAChCC,kBAAmBA,IAAM,IAC1B,EAiCA,SAASC,GAAuB,CACzB,KAAA,CACLC,QAAS,CAAEC,KAAAA,CAAK,GACbC,EAAkB,EACtB,MAAO,WAAWD,CAAI,UACvB,CAEA,SAAwBE,GAAU,CACjC,MAAMC,EAAOC,IACPC,EAASJ,IACTK,EAAgBC,IAChBC,EAAoBV,IAGzB,OAAAW,EAAAA,KAAC,OAAK,CAAAC,UAAU,8FACdC,SAAA,CAAAR,EAAKS,cACLC,EAAAA,IAAC,MAAA,CACAH,UAAU,yBACVI,KAAKR,GAAAA,YAAAA,EAAeS,cAAeZ,EAAKa,MAAQb,EAAKc,MACrDC,IAAKf,EAAKS,aAAA,CACX,QAECO,EAAK,CAAAH,KAAK,OAAON,UAAU,gBAAgBU,KAAK,IAAK,CAAA,EAEtDP,EAAA,IAAA,KAAA,CAAGH,UAAU,gB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AG,CAAA,CACpC,CAAA,CACD,CAAA,EACAjB,EAAA,IAAC,KAAG,CAAAH,UAAU,QAAS,CAAA,EACvBD,EAAA,KAAC,KAAG,CAAAC,UAAU,uDACbC,SAAA,CAAAE,EAAA,IAAC,KACA,CAAAF,SAAAF,EAAA,KAACiB,EAAA,CACAC,GAAI,WAAWtB,EAAON,QAAQC,IAAI,WAClCU,UAAU,8BAEVC,SAAA,CAAAE,EAAA,IAAC,QAAKF,SAAmB,qBAAA,CAAA,EACzBE,EAAA,IAACM,EAAK,CAAAH,KAAK,cAAe,CAAA,CAAA,EAC3B,CACD,CAAA,EACAH,EAAA,IAAC,MACAF,SAACE,EAAA,IAAAa,EAAA,CAAKC,GAAG,eAAejB,UAAU,YAAYC,SAAA,0BAE9C,CACD,CAAA,EACAE,EAAA,IAAC,MACAF,SAACE,EAAA,IAAAa,EAAA,CAAKC,GAAG,cAAcjB,UAAU,YAAYC,SAAA,oBAE7C,CACD,CAAA,EACAE,EAAA,IAAC,MACAF,SAACE,EAAA,IAAAa,EAAA,CAAKC,GAAG,WAAWjB,UAAU,YAAYC,SAAA,cAE1C,CACD,CAAA,CAAA,CACD,CAAA,CAAA,CACD,CAAA,CAEF"}
|
package/build/server/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { renderToPipeableStream, renderToStaticMarkup } from "react-dom/server";
|
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import { makeSingletonCache, cachified, deleteCache, compiledCodeCache, shouldForceFresh, fsCache, getAllFileCacheEntries, ogCache } from "@epic-web/workshop-utils/cache.server";
|
|
9
9
|
import { getWorkshopConfig } from "@epic-web/workshop-utils/config.server";
|
|
10
|
-
import { getAuthInfo, getPreferences, muteNotification, readOnboardingData, requireAuthInfo,
|
|
10
|
+
import { getAuthInfo, getPreferences, muteNotification, readOnboardingData, requireAuthInfo, logout, setPreferences, PlayerPreferencesSchema, setAuthInfo, deleteDb, markOnboardingVideoWatched } from "@epic-web/workshop-utils/db.server";
|
|
11
11
|
import { getUserInfo, userHasAccessToWorkshop, getProgress, updateProgress, getEpicVideoInfos } from "@epic-web/workshop-utils/epic-api.server";
|
|
12
12
|
import { getUserId, getSetClientIdCookieHeader } from "@epic-web/workshop-utils/user.server";
|
|
13
13
|
import { z } from "zod";
|
|
@@ -3488,7 +3488,7 @@ async function action$a({ request }) {
|
|
|
3488
3488
|
const formData = await request.formData();
|
|
3489
3489
|
const intent = formData.get("intent");
|
|
3490
3490
|
if (intent === "logout") {
|
|
3491
|
-
await
|
|
3491
|
+
await logout();
|
|
3492
3492
|
await deleteCache();
|
|
3493
3493
|
return redirectWithToast("/login", {
|
|
3494
3494
|
type: "success",
|