Skip to content

Commit

Permalink
Merge pull request #181 from Light-it-labs/develop
Browse files Browse the repository at this point in the history
🚀 Release 19/06/2024
  • Loading branch information
cgarcia-lightit authored Jun 19, 2024
2 parents f5312fc + 6affdfc commit 7c96639
Show file tree
Hide file tree
Showing 15 changed files with 510 additions and 465 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ jobs:

steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v2.2.4
uses: pnpm/action-setup@v4.0.0

- name: Setup Node 18
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18

Expand All @@ -36,7 +36,7 @@ jobs:
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
Expand All @@ -47,7 +47,7 @@ jobs:
run: pnpm install

- name: Training project cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ github.workspace }}apps/training/.next/cache
key: ${{ runner.os }}-${{ runner.node }}-${{ hashFiles('**/pnpm-lock.yaml') }}-training
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/review-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
remove_label:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions-ecosystem/action-remove-labels@v1
with:
labels: draft
Expand Down
1 change: 1 addition & 0 deletions apps/eo_web/dist/assets/main-17ed8018.css

Large diffs are not rendered by default.

121 changes: 0 additions & 121 deletions apps/eo_web/dist/assets/main-1935110a.js

This file was deleted.

120 changes: 120 additions & 0 deletions apps/eo_web/dist/assets/main-33e11077.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion apps/eo_web/dist/assets/main-a73a2c36.css

This file was deleted.

6 changes: 3 additions & 3 deletions apps/eo_web/dist/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
"src": "../../packages/ui/src/assets/avatar.svg"
},
"src/main.css": {
"file": "assets/main-a73a2c36.css",
"file": "assets/main-17ed8018.css",
"src": "src/main.css"
},
"src/main.tsx": {
"assets": [
"assets/UploadFile-694e44b5.svg"
],
"css": [
"assets/main-a73a2c36.css"
"assets/main-17ed8018.css"
],
"file": "assets/main-1935110a.js",
"file": "assets/main-33e11077.js",
"isEntry": true,
"src": "src/main.tsx"
}
Expand Down
10 changes: 5 additions & 5 deletions apps/eo_web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
"@eo/shared": "*",
"@eo/ui": "*",
"@headlessui/react": "^1.7.13",
"@hookform/resolvers": "^3.1.0",
"@hookform/resolvers": "^3.6.0",
"@react-oauth/google": "^0.9.0",
"@tanstack/react-query": "^4.29.3",
"@tanstack/react-query-devtools": "^4.29.3",
"@tanstack/react-query-devtools": "^5.45.1",
"autoprefixer": "^10.4.14",
"axios": "^1.3.5",
"date-fns": "^2.29.3",
"date-fns": "^3.6.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-multi-date-picker": "^3.3.4",
Expand All @@ -32,15 +32,15 @@
"swiper": "^11.0.5",
"uuid": "^9.0.0",
"zod": "^3.21.4",
"zustand": "^4.3.7"
"zustand": "^4.5.2"
},
"devDependencies": {
"@eo/eslint-config": "*",
"@eo/tailwind-config": "*",
"@types/react": "^18.0.37",
"@types/react-dom": "^18.0.11",
"@types/react-router-dom": "5.3.3",
"@vitejs/plugin-react": "^3.1.0",
"@vitejs/plugin-react": "^4.3.1",
"dotenv-cli": "^7.2.1",
"eslint": "^8.38.0",
"postcss": "^8.4.22",
Expand Down
13 changes: 12 additions & 1 deletion apps/eo_web/src/api/useApi.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { apiElixir, apiLaravel } from "~/api/axios";
import {
type AvoidPresentation,
type Maladies,
Expand All @@ -6,7 +7,6 @@ import {
type ThcProductPreferences,
type WorseSymptomsMoment,
} from "~/api/PrePlanTypes";
import { apiElixir, apiLaravel } from "~/api/axios";
import { useProfileStore, type Profile } from "~/stores/useProfileStore";
import { type FlowType } from "~/stores/useProfilingStore";

Expand Down Expand Up @@ -74,6 +74,13 @@ export interface ProfileOne {
};
}

interface CreatePreProfileParams {
first_name: string;
last_name: string;
email: string;
phone_number: string;
}

export const useApi = () => {
const token = useProfileStore((state) => state.session?.token);

Expand Down Expand Up @@ -171,6 +178,9 @@ export const useApi = () => {
const checkoutComplete = async (data: object) =>
await apiLaravel.patch("/api/profiles/checkout-complete", data);

const createPreProfile = (data: CreatePreProfileParams) =>
apiLaravel.post<LaravelSuccessBase<void>>("api/pre-profiling", data);

return {
validateZipCode,
combineProfileOne,
Expand All @@ -188,5 +198,6 @@ export const useApi = () => {
surveyStatus,
getProfilingFlow,
checkoutComplete,
createPreProfile,
};
};
16 changes: 16 additions & 0 deletions apps/eo_web/src/api/usePreProfile.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { useMutation } from "@tanstack/react-query";

import { useApi } from "~/api/useApi";

export const usePreProfile = () => {
const { createPreProfile } = useApi();

const preProfileMutation = useMutation({
mutationFn: createPreProfile,
mutationKey: ["createPreProfile"],
});

return {
preProfileMutation,
};
};
46 changes: 27 additions & 19 deletions apps/eo_web/src/screens/AccountCreation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ import { toast } from "react-toastify";
import { z } from "zod";

import { tw } from "@eo/shared/src";
import { Button, Input, Typography, icons } from "@eo/ui";
import { Button, icons, Input, Typography } from "@eo/ui";
import { CheckBox } from "@eo/ui/src/form/CheckBox";

import { useApi } from "~/api/useApi";
import { usePreProfile } from "~/api/usePreProfile";
import { useMount } from "~/hooks/useMount";
import { LayoutDefault } from "~/layouts";
import { ROUTES } from "~/router";
Expand All @@ -24,17 +25,16 @@ export const signUpSchema = z.object({
.string()
.min(1, { message: "Email is required" })
.email({ message: "Enter a valid email." }),
phoneNumber: z
.string().superRefine((phoneNumber, ctx) => {
const phoneWithOnlyNumbers = phoneNumber.replace(/\D/g, "");
const numberOfDigits = phoneWithOnlyNumbers.length;
if (numberOfDigits !== 10) {
ctx.addIssue({
code: "custom",
message: "Contact number must be 10 digits"
});
}
}),
phoneNumber: z.string().superRefine((phoneNumber, ctx) => {
const phoneWithOnlyNumbers = phoneNumber.replace(/\D/g, "");
const numberOfDigits = phoneWithOnlyNumbers.length;
if (numberOfDigits !== 10) {
ctx.addIssue({
code: "custom",
message: "Contact number must be 10 digits",
});
}
}),
password: z
.string()
.regex(
Expand Down Expand Up @@ -72,11 +72,10 @@ export const AccountCreation = () => {
setState,
setExperience,
} = useProfilingStore((state) => state);
// const navigate = useNavigate();
const { eligibleEmail } = useApi();

const [validatingForm, setValidatingForm] = useState(false);

const { mutate: createPreProfile } = usePreProfile().preProfileMutation;
const {
formState: { errors },
handleSubmit,
Expand All @@ -98,8 +97,16 @@ export const AccountCreation = () => {
setValidatingForm(false);
return;
} else {
setAccountData({ ...data, phoneNumber: data.phoneNumber.replace(/\D/g, "") });

setAccountData({
...data,
phoneNumber: data.phoneNumber.replace(/\D/g, ""),
});
createPreProfile({
first_name: data.firstName,
last_name: data.lastName,
email: data.email,
phone_number: data.phoneNumber.replace(/\D/g, ""),
});
switch (channel) {
case "cancer":
navigate(ROUTES.cancerForm);
Expand Down Expand Up @@ -211,10 +218,11 @@ export const AccountCreation = () => {
className={tw(
"font-nunito text-[11px] font-light ",
errors.agreeReceiveNotifications?.message &&
"text-red-500",
"text-red-500",
)}
>
I agree to receive emails and text messages related to my care.
I agree to receive emails and text messages related to my
care.
</Typography>
}
/>
Expand All @@ -232,7 +240,7 @@ export const AccountCreation = () => {
className={tw(
"font-nunito text-[11px] font-light !leading-4",
errors.agreeTermsAndConditions?.message &&
"text-red-500",
"text-red-500",
)}
>
I have read and agree to the{" "}
Expand Down
64 changes: 32 additions & 32 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
{
"name": "create-t3-turbo",
"private": true,
"engines": {
"node": ">=18.0.0"
},
"packageManager": "[email protected]",
"scripts": {
"build": "turbo build",
"clean:all": "turbo clean",
"clean:root-only": "git clean -xdf node_modules",
"dev": "turbo dev --parallel",
"format": "prettier --write \"**/*.{js,cjs,mjs,ts,tsx,md,json}\" --ignore-path .gitignore",
"lint": "turbo lint && manypkg check",
"lint:fix": "turbo lint:fix && manypkg fix",
"prepare": "chmod +x ./node_modules/husky/lib/bin.js && husky install",
"spell-checker": "cspell . --no-progress",
"spell-checker:staged": "git diff --cached --name-only | npx cspell --no-summary --no-progress --no-must-find-files --file-list stdin",
"type-check": "turbo type-check"
},
"dependencies": {
"@eo/eslint-config": "*",
"@ianvs/prettier-plugin-sort-imports": "^3.7.2",
"@manypkg/cli": "^0.20.0",
"@types/prettier": "^2.7.2",
"cspell": "^6.31.1",
"eslint": "^8.38.0",
"husky": "^8.0.3",
"prettier": "^2.8.7",
"prettier-plugin-tailwindcss": "^0.2.7",
"turbo": "^1.9.3",
"typescript": "^5.0.4"
}
"name": "create-t3-turbo",
"private": true,
"engines": {
"node": ">=18.0.0"
},
"packageManager": "[email protected]",
"scripts": {
"build": "turbo build",
"clean:all": "turbo clean",
"clean:root-only": "git clean -xdf node_modules",
"dev": "turbo dev --parallel",
"format": "prettier --write \"**/*.{js,cjs,mjs,ts,tsx,md,json}\" --ignore-path .gitignore",
"lint": "turbo lint && manypkg check",
"lint:fix": "turbo lint:fix && manypkg fix",
"prepare": "chmod +x ./node_modules/husky/husky && husky install",
"spell-checker": "cspell . --no-progress",
"spell-checker:staged": "git diff --cached --name-only | npx cspell --no-summary --no-progress --no-must-find-files --file-list stdin",
"type-check": "turbo type-check"
},
"dependencies": {
"@eo/eslint-config": "*",
"@ianvs/prettier-plugin-sort-imports": "^4.2.1",
"@manypkg/cli": "^0.20.0",
"@types/prettier": "^2.7.2",
"cspell": "^6.31.1",
"eslint": "^8.38.0",
"husky": "^9.0.11",
"prettier": "^2.8.7",
"prettier-plugin-tailwindcss": "^0.2.7",
"turbo": "^1.9.3",
"typescript": "^5.0.4"
}
}
2 changes: 1 addition & 1 deletion packages/config/eslint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"@typescript-eslint/eslint-plugin": "^5.59.0",
"@typescript-eslint/parser": "^5.59.0",
"eslint-config-next": "^13.3.0",
"eslint-config-prettier": "^8.8.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-turbo": "^1.9.3",
"eslint-plugin-react": "7.32.2"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@eo/tailwind-config": "*",
"@headlessui/react": "^1.7.13",
"@heroicons/react": "^2.0.12",
"date-fns": "^2.29.3",
"date-fns": "^3.6.0",
"lodash": "^4.17.21",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand All @@ -26,7 +26,7 @@
"@eo/eslint-config": "*",
"@tailwindcss/forms": "^0.5.3",
"@tailwindcss/typography": "^0.5.9",
"@types/lodash": "^4.14.194",
"@types/lodash": "^4.17.5",
"@types/node": "^18.15.11",
"@types/react": "^18.0.37",
"@types/react-dom": "^18.0.11",
Expand Down
Loading

0 comments on commit 7c96639

Please sign in to comment.