diff --git a/.env.example b/.env.example index 3dd4887..4a68b68 100644 --- a/.env.example +++ b/.env.example @@ -8,7 +8,8 @@ DATABASE_URL="postgresql://username:password@localhost:5432/products_show_develo NEXTAUTH_SECRET="hey" FLATFILE_API_KEY='sk_...' FLATFILE_ENVIRONMENT_ID='us_env_...' -FLATFILE_NAMESPACE='space:plmproject' +FLATFILE_NAMESPACE='plmproject' +NEXT_PUBLIC_FLATFILE_NAMESPACE='plmproject' NEXT_PUBLIC_FLATFILE_PUBLISHABLE_KEY='pk_...' NEXT_PUBLIC_FLATFILE_ENVIRONMENT_ID='us_env_...' NEXT_PUBLIC_APP_ID='products-show' diff --git a/app/(authenticated)/embedded-portal/[spaceId]/page.tsx b/app/(authenticated)/embedded-portal/[spaceId]/page.tsx index 5957c36..3344246 100644 --- a/app/(authenticated)/embedded-portal/[spaceId]/page.tsx +++ b/app/(authenticated)/embedded-portal/[spaceId]/page.tsx @@ -1,4 +1,7 @@ -import VisitSpaceForm from "@/components/shared/visit-space-form"; +import EmbeddedPortal from "@/app/(authenticated)/embedded-portal/embedded-portal"; +import { FlatfileService } from "@/lib/services/flatfile"; +import { SpaceService } from "@/lib/services/space"; +import { redirect } from "next/navigation"; export default async function Page({ params, @@ -8,10 +11,20 @@ export default async function Page({ }; }) { const spaceId = params.spaceId; + const space = await SpaceService.getSpace({ + id: spaceId, + }); + if (!space) { + redirect("/embedded-portal"); + } + const flatfileSpace = await FlatfileService.getSpace({ + flatfileSpaceId: space.flatfileSpaceId, + }); return ( -
+ Your embedded Flatfile space is configured and ready for import. 🎉 +
+Launch Flatfile
+Launch Flatfile via the "Import" button below.
++ Use the Sidebar in the embedded application to guide you through + the import process! +
+To download the sample data again,{" "} diff --git a/lib/workflow-constants.ts b/lib/workflow-constants.ts index b1fac08..7171b81 100644 --- a/lib/workflow-constants.ts +++ b/lib/workflow-constants.ts @@ -14,6 +14,20 @@ export const PROJECT_ONBOARDING_INITIAL_STEPS: Step[] = [ }, ]; +export const EMBEDDED_PORTAL_INITIAL_STEPS: Step[] = [ + { + name: "Download Sample Data", + status: "current", + }, + { + name: "Setup Flatfile", + status: "upcoming", + }, +]; + +export const PROJECT_ONBOARDING_STORAGE_KEY = `${process.env.NEXT_PUBLIC_APP_ID}-project-onboarding-downloaded`; +export const EMBEDDED_PORTAL_STORAGE_KEY = `${process.env.NEXT_PUBLIC_APP_ID}-embedded-portal-downloaded`; + type NavItem = { name: string; href: string; @@ -25,6 +39,7 @@ export type WorkflowItem = NavItem & { color: string; highlightColor: string; description: string; + steps?: Step[]; }; export const HOME_ITEM: NavItem = { @@ -48,6 +63,7 @@ export const WORKFLOW_ITEMS: { highlightColor: "hover:border-project-onboarding", description: "Flatfile enables multiple team members to collaborate over the course of a project in real-time, validating, transforming, and loading data into HCM.Show while ensuring everyone is on the same page.", + steps: PROJECT_ONBOARDING_INITIAL_STEPS, }, [WorkflowType.Embed]: { slug: "embedded-portal", @@ -61,6 +77,7 @@ export const WORKFLOW_ITEMS: { highlightColor: "hover:border-embedded-portal", description: "Flatfile's deeply configurable import experience is available right inside HCM Show. See how Flatfile simplifies the data onboarding process, eliminating the need for manual data mapping and significantly reducing errors.", + steps: EMBEDDED_PORTAL_INITIAL_STEPS, }, [WorkflowType.FileFeed]: { slug: "file-feed", @@ -92,6 +109,8 @@ export const WORKFLOW_ITEMS: { export const PROJECT_ONBOARDING_ITEM = WORKFLOW_ITEMS[WorkflowType.ProjectOnboarding]; +export const EMBEDDED_PORTAL_ITEM = WORKFLOW_ITEMS[WorkflowType.Embed]; + export const RESOURCE_ITEMS: NavItem[] = [ { name: "Suppliers", diff --git a/preflight.js b/preflight.js index c6e4f13..a170423 100644 --- a/preflight.js +++ b/preflight.js @@ -8,6 +8,7 @@ VARS = [ "NEXT_PUBLIC_FLATFILE_ENVIRONMENT_ID", "NEXT_PUBLIC_APP_ID", "LISTENER_AUTH_TOKEN", + "NEXT_PUBLIC_FLATFILE_NAMESPACE", ]; function preflight() {