Skip to content

Commit

Permalink
fix vitest issue / prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
IObert committed Nov 5, 2024
1 parent b266604 commit 2cc516c
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 26 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ pnpm dev

9. Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.


## How To Use

[Here's a diagram of what happens when the user sends a message to the application](resources/user-flow-diagram.png)
Expand All @@ -139,7 +138,6 @@ Here are a few helpful notes:
- The Kiosk interface is a self-service interface that you can make available to attendees via a table or phone. The page allows the manual entry of an order without the need to put a phone number down. This form can be accessed via `https://<mixologist.server>/<event-slug>/kiosk` and the credentials are defined in the environment variable `KIOSK_LOGIN`.
- Users can send the command "forget me" to remove all data stored about this user. It cancels pending orders, removes the user from the Sync data store and removes the Conversation resource. This can be used for debugging as well as to be GDPR-compliant.


### Segment Integration

This project includes an optional integration with Segment's Profiles API. If you provide the `SEGMENT_SPACE_ID` and `SEGMENT_PROFILE_KEY` environment variables, the application will fetch user traits from Segment using the provided email address once the verification step is completed. The `SEGMENT_TRAIT_CHECK` environment variable allows you to specify a specific trait to check for in the user's profile.
Expand All @@ -156,8 +154,6 @@ To set up Segment integration:
For more details on Segment and how to use the Profiles API, refer to the [Segment documentation](https://segment.com/docs/).
## Code of Conduct
Please be aware that this project has a [Code of Conduct](CODE_OF_CONDUCT.md). The tldr; is to just be excellent to each other ❤️
Expand Down
4 changes: 2 additions & 2 deletions next.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { NextConfig } from 'next';
import type { NextConfig } from "next";

const nextConfig: NextConfig = {
experimental: {},
Expand All @@ -10,4 +10,4 @@ const nextConfig: NextConfig = {
},
};

export default nextConfig;
export default nextConfig;
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { notFound } from "next/navigation";
import OrdersInterface from "../ordersInterface";

export default async function TerminalPage(
props: {
params: Promise<{ slug: string; terminal: string }>;
}
) {
export default async function TerminalPage(props: {
params: Promise<{ slug: string; terminal: string }>;
}) {
const params = await props.params;
const { slug, terminal } = params;

Expand Down
4 changes: 3 additions & 1 deletion src/app/(master-layout)/event/[slug]/orders/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import OrdersInterface from "./ordersInterface";

export default async function OrdersPage(props: { params: Promise<{ slug: string }> }) {
export default async function OrdersPage(props: {
params: Promise<{ slug: string }>;
}) {
const params = await props.params;
return (
<main className="p-4 md:p-6 lg:p-8 space-y-8">
Expand Down
5 changes: 4 additions & 1 deletion src/app/(master-layout)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ import { cookies } from "next/headers";
import { getSyncService } from "@/lib/twilio";

export default async function Home() {
const [cookieStore, syncService] = await Promise.all([cookies(), getSyncService()]);
const [cookieStore, syncService] = await Promise.all([
cookies(),
getSyncService(),
]);

const isAdmin = [Privilege.ADMIN].includes(
cookieStore.get("privilege")?.value as Privilege,
Expand Down
6 changes: 5 additions & 1 deletion src/app/api/event/[slug]/stats/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ export async function calcStatsForEvent(
.filter(
(stage: any) =>
event.enableLeadCollection ||
![Stages.VERIFYING, Stages.VERIFIED_USER, Stages.NAME_CONFIRMED].includes(stage),
![
Stages.VERIFYING,
Stages.VERIFIED_USER,
Stages.NAME_CONFIRMED,
].includes(stage),
)
.reverse()
.map((stage) => {
Expand Down
2 changes: 1 addition & 1 deletion src/config/menus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export default {
{
shortTitle: "Iced Americano",
title: "Iced Americano",
description: "Espresso shots with cold water and ice."
description: "Espresso shots with cold water and ice.",
},
{
shortTitle: "Matcha",
Expand Down
2 changes: 1 addition & 1 deletion src/lib/templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ export function getDataPolicy(mode: string) {
return `We only use your phone number to notify you about our ${mode} service and redact all the messages & phone numbers afterward.`;
}

export function getPromptForEmail(){
export function getPromptForEmail() {
return "Thanks. Please enter your business email address. We will then use Twilio Verify and SendGrid to send you an one-time password.";
}

Expand Down
17 changes: 8 additions & 9 deletions src/scripts/download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,14 @@ if (!eventName || eventName.startsWith("/") || eventName.includes("=")) {
.syncMaps("ActiveCustomers");
try {
const mapItems = await map.syncMapItems.list({ limit: 1000 }); //TODO should fetch all here
const attendees = mapItems
.map((item) => item.data)
// .filter(
// (a) =>
// (a.stage === Stages.VERIFIED_USER ||
// a.stage === Stages.FIRST_ORDER ||
// a.stage === Stages.REPEAT_CUSTOMER) &&
// a.event === eventName,
// );
const attendees = mapItems.map((item) => item.data);
// .filter(
// (a) =>
// (a.stage === Stages.VERIFIED_USER ||
// a.stage === Stages.FIRST_ORDER ||
// a.stage === Stages.REPEAT_CUSTOMER) &&
// a.event === eventName,
// );
const csv = attendees.map((attendee) => {
return `${attendee.fullName},${attendee.email},${attendee.country},${attendee.foundInSegment},${attendee[SEGMENT_TRAIT_CHECK]},${attendee.event},${attendee.stage}`;
});
Expand Down
7 changes: 6 additions & 1 deletion vitest.config.ts → vitest.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ import react from "@vitejs/plugin-react";
import tsconfigPaths from "vite-tsconfig-paths";

export default defineConfig({
plugins: [tsconfigPaths(), react()],
plugins: [
tsconfigPaths({
loose: true,
}),
react(),
],
test: {
environment: "jsdom",
setupFiles: ["dotenv/config"], //this line,
Expand Down

0 comments on commit 2cc516c

Please sign in to comment.