Skip to content

Commit

Permalink
Merge branch 'dev' into IN-857-user-management
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] committed May 7, 2024
2 parents cac3afb + a904ab5 commit d676d9b
Show file tree
Hide file tree
Showing 19 changed files with 866 additions and 949 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.12.2
20.13.0
28 changes: 14 additions & 14 deletions apps/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@
"@next/bundle-analyzer": "14.2.3",
"@next/third-parties": "14.2.3",
"@opentelemetry/api": "1.8.0",
"@opentelemetry/core": "1.24.0",
"@opentelemetry/exporter-trace-otlp-http": "0.51.0",
"@opentelemetry/resources": "1.24.0",
"@opentelemetry/sdk-node": "0.51.0",
"@opentelemetry/sdk-trace-base": "1.24.0",
"@opentelemetry/sdk-trace-node": "1.24.0",
"@opentelemetry/semantic-conventions": "1.24.0",
"@opentelemetry/core": "1.24.1",
"@opentelemetry/exporter-trace-otlp-http": "0.51.1",
"@opentelemetry/resources": "1.24.1",
"@opentelemetry/sdk-node": "0.51.1",
"@opentelemetry/sdk-trace-base": "1.24.1",
"@opentelemetry/sdk-trace-node": "1.24.1",
"@opentelemetry/semantic-conventions": "1.24.1",
"@prisma/instrumentation": "5.13.0",
"@sentry/browser": "7.113.0",
"@sentry/integrations": "7.113.0",
Expand Down Expand Up @@ -100,14 +100,14 @@
"react-dom": "18.3.1",
"react-error-boundary": "4.0.13",
"react-hook-consent": "3.5.3",
"react-hook-form": "7.51.3",
"react-hook-form": "7.51.4",
"react-hook-form-mantine": "2.0.0",
"react-i18next": "14.1.1",
"zod": "3.23.5"
"zod": "3.23.7"
},
"devDependencies": {
"@hookform/devtools": "4.3.1",
"@playwright/test": "1.43.1",
"@playwright/test": "1.44.0",
"@prisma/nextjs-monorepo-workaround-plugin": "5.13.0",
"@relative-ci/agent": "4.2.7",
"@tanstack/react-query-devtools": "4.36.1",
Expand All @@ -116,11 +116,11 @@
"@types/eslint": "8.56.10",
"@types/gtag.js": "0.0.19",
"@types/luxon": "3.4.2",
"@types/node": "20.12.8",
"@types/node": "20.12.10",
"@types/react": "18.3.1",
"@types/react-dom": "18.3.0",
"@typescript-eslint/eslint-plugin": "7.7.1",
"@typescript-eslint/parser": "7.7.1",
"@typescript-eslint/eslint-plugin": "7.8.0",
"@typescript-eslint/parser": "7.8.0",
"@weareinreach/config": "workspace:*",
"@weareinreach/eslint-config": "workspace:*",
"@welldone-software/why-did-you-render": "8.0.1",
Expand All @@ -133,7 +133,7 @@
"prettier": "3.2.5",
"trpc-panel": "1.3.4",
"trpc-playground": "1.0.4",
"type-fest": "4.18.1",
"type-fest": "4.18.2",
"typescript": "5.4.5",
"webpack-bundle-analyzer": "4.10.2"
},
Expand Down
2 changes: 1 addition & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"devDependencies": {
"@next/bundle-analyzer": "14.2.3",
"@types/eslint": "8.56.10",
"@types/node": "20.12.8",
"@types/node": "20.12.10",
"@types/react": "18.3.1",
"@types/react-dom": "18.3.0",
"@weareinreach/config": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion lambdas/cognito-messaging/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"devDependencies": {
"@types/aws-lambda": "8.10.137",
"@types/eslint": "8.56.10",
"@types/node": "20.12.8",
"@types/node": "20.12.10",
"@vercel/ncc": "0.38.1",
"@weareinreach/config": "workspace:*",
"@weareinreach/eslint-config": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion lambdas/cognito-user-migrate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"devDependencies": {
"@types/aws-lambda": "8.10.137",
"@types/eslint": "8.56.10",
"@types/node": "20.12.8",
"@types/node": "20.12.10",
"@vercel/ncc": "0.38.1",
"@weareinreach/config": "workspace:*",
"@weareinreach/eslint-config": "workspace:*",
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"@changesets/cli": "2.27.1",
"@turbo/gen": "1.13.3",
"@types/lint-staged": "13.3.0",
"@types/node": "20.12.8",
"@types/node": "20.12.10",
"@types/yargs": "17.0.32",
"@weareinreach/config": "workspace:*",
"@weareinreach/eslint-config": "workspace:*",
Expand All @@ -50,14 +50,14 @@
"dotenv": "16.4.5",
"dotenv-expand": "11.0.6",
"husky": "9.0.11",
"knip": "5.12.0",
"knip": "5.13.0",
"lint-staged": "15.2.2",
"prettier": "3.2.5",
"prettier-plugin-jsdoc": "1.3.0",
"prettier-plugin-packagejson": "2.5.0",
"prettier-plugin-prisma": "5.0.0",
"sherif": "0.8.4",
"tsx": "4.8.2",
"tsx": "4.9.3",
"turbo": "1.13.3",
"typescript": "5.4.5",
"typesync": "0.12.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/analytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@weareinreach/eslint-config": "workspace:*",
"next": "14.2.3",
"nextjs-google-analytics": "2.3.3",
"type-fest": "4.18.1"
"type-fest": "4.18.2"
},
"peerDependencies": {
"next": "14.2.3",
Expand Down
10 changes: 5 additions & 5 deletions packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,33 +43,33 @@
"just-map-values": "3.2.0",
"just-omit": "2.2.0",
"just-pick": "4.2.0",
"libphonenumber-js": "1.10.61",
"libphonenumber-js": "1.11.1",
"luxon": "3.4.4",
"nanoid": "5.0.7",
"remeda": "1.61.0",
"slugify": "1.6.6",
"social-links": "1.14.0",
"tiny-invariant": "1.3.3",
"zod": "3.23.5"
"zod": "3.23.7"
},
"devDependencies": {
"@turbo/gen": "1.13.3",
"@types/eslint": "8.56.10",
"@types/google.maps": "3.55.8",
"@types/luxon": "3.4.2",
"@types/node": "20.12.8",
"@types/node": "20.12.10",
"@types/terraformer__wkt": "2.0.3",
"@weareinreach/config": "workspace:*",
"@weareinreach/eslint-config": "workspace:*",
"dotenv-cli": "7.4.1",
"dotenv-cli": "7.4.2",
"eslint": "8.57.0",
"i18next": "23.11.3",
"inquirer-search-list": "1.2.6",
"just-pascal-case": "3.2.0",
"next": "14.2.3",
"prettier": "3.2.5",
"trpc-panel": "1.3.4",
"type-fest": "4.18.1",
"type-fest": "4.18.2",
"typescript": "5.4.5"
},
"peerDependencies": {
Expand Down
5 changes: 3 additions & 2 deletions packages/api/router/orgPhone/query.forEditDrawer.handler.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import parsePhoneNumber, { isSupportedCountry } from 'libphonenumber-js'
import parsePhoneNumber, { type Extension, isSupportedCountry } from 'libphonenumber-js'

import { prisma } from '@weareinreach/db'
import { handleError } from '~api/lib/errorHandler'
import { type TRPCHandlerParams } from '~api/types/handler'

import { type TForEditDrawerSchema } from './query.forEditDrawer.schema'

const isExtension = (ext: string | null): ext is Extension => typeof ext === 'string' && ext.length > 0
const getOrgId = async (phoneId: string) => {
const org = await prisma.organization.findFirstOrThrow({
where: {
Expand Down Expand Up @@ -48,7 +49,7 @@ const forEditDrawer = async ({ input }: TRPCHandlerParams<TForEditDrawerSchema>)
const parsedPhone = parsePhoneNumber(number, isSupportedCountry(country.cca2) ? country.cca2 : undefined)

if (typeof parsedPhone !== 'undefined') {
if (ext) {
if (isExtension(ext)) {
parsedPhone.setExt(ext)
}

Expand Down
5 changes: 3 additions & 2 deletions packages/api/router/orgPhone/query.getLinkOptions.handler.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import parsePhoneNumber, { isSupportedCountry } from 'libphonenumber-js'
import parsePhoneNumber, { type Extension, isSupportedCountry } from 'libphonenumber-js'

import { prisma } from '@weareinreach/db'
import { handleError } from '~api/lib/errorHandler'
import { type TRPCHandlerParams } from '~api/types/handler'

import { type TGetLinkOptionsSchema } from './query.getLinkOptions.schema'

const isExtension = (ext: string | null): ext is Extension => typeof ext === 'string' && ext.length > 0
const getLinkOptions = async ({ input }: TRPCHandlerParams<TGetLinkOptionsSchema>) => {
try {
const { slug, locationId } = input
Expand Down Expand Up @@ -39,7 +40,7 @@ const getLinkOptions = async ({ input }: TRPCHandlerParams<TGetLinkOptionsSchema
...status,
}
}
if (ext) {
if (isExtension(ext)) {
parsedPhone.setExt(ext)
}
const phoneNumber = parsedPhone.formatNational()
Expand Down
6 changes: 3 additions & 3 deletions packages/auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,19 @@
"with-env": "dotenv -e ../../.env --"
},
"dependencies": {
"@aws-sdk/client-cognito-identity-provider": "3.568.0",
"@aws-sdk/client-cognito-identity-provider": "3.569.0",
"@next-auth/prisma-adapter": "1.0.7",
"@weareinreach/db": "workspace:*",
"@weareinreach/env": "workspace:*",
"@weareinreach/util": "workspace:*",
"aws-jwt-verify": "4.0.1",
"tiny-invariant": "1.3.3",
"tslog": "4.9.2",
"zod": "3.23.5"
"zod": "3.23.7"
},
"devDependencies": {
"@types/eslint": "8.56.10",
"@types/node": "20.12.8",
"@types/node": "20.12.10",
"@types/react": "18.3.1",
"@types/react-dom": "18.3.0",
"@weareinreach/config": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"preinstall": "npx only-allow pnpm"
},
"devDependencies": {
"@types/node": "20.12.8",
"@types/node": "20.12.10",
"@weareinreach/eslint-config": "workspace:*",
"alex": "11.0.1",
"next-i18next": "15.3.0",
Expand Down
30 changes: 15 additions & 15 deletions packages/db/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@
"with-env": "dotenv -e ../../.env --"
},
"dependencies": {
"@opentelemetry/exporter-trace-otlp-http": "0.51.0",
"@opentelemetry/instrumentation": "0.51.0",
"@opentelemetry/resources": "1.24.0",
"@opentelemetry/sdk-trace-base": "1.24.0",
"@opentelemetry/sdk-trace-node": "1.24.0",
"@opentelemetry/semantic-conventions": "1.24.0",
"@opentelemetry/exporter-trace-otlp-http": "0.51.1",
"@opentelemetry/instrumentation": "0.51.1",
"@opentelemetry/resources": "1.24.1",
"@opentelemetry/sdk-trace-base": "1.24.1",
"@opentelemetry/sdk-trace-node": "1.24.1",
"@opentelemetry/semantic-conventions": "1.24.1",
"@prisma/client": "5.13.0",
"@prisma/instrumentation": "5.13.0",
"@vercel/kv": "1.0.1",
Expand All @@ -60,28 +60,28 @@
"prisma-kysely": "1.8.0",
"sql-bricks": "3.0.1",
"superjson": "2.2.1",
"zod": "3.23.5"
"zod": "3.23.7"
},
"devDependencies": {
"@octokit/core": "5.2.0",
"@snaplet/copycat": "5.0.0",
"@snaplet/seed": "0.97.6",
"@snaplet/seed": "0.97.11",
"@terraformer/wkt": "2.2.0",
"@turbo/gen": "1.13.3",
"@turf/helpers": "7.0.0-alpha.115",
"@turf/helpers": "7.0.0-alpha.116",
"@types/eslint": "8.56.10",
"@types/inquirer": "9.0.7",
"@types/inquirer-autocomplete-prompt": "3.0.3",
"@types/luxon": "3.4.2",
"@types/ms": "0.7.34",
"@types/node": "20.12.8",
"@types/node": "20.12.10",
"@types/papaparse": "5.3.14",
"@types/pg": "8.11.5",
"@types/pg": "8.11.6",
"@types/terraformer__wkt": "2.0.3",
"@weareinreach/config": "workspace:*",
"@weareinreach/eslint-config": "workspace:*",
"dotenv": "16.4.5",
"dotenv-cli": "7.4.1",
"dotenv-cli": "7.4.2",
"eslint": "8.57.0",
"flat": "6.0.1",
"google-auth-library": "9.9.0",
Expand All @@ -91,7 +91,7 @@
"inquirer-autocomplete-prompt": "3.0.1",
"just-compact": "3.2.0",
"kysely-codegen": "0.15.0",
"libphonenumber-js": "1.10.61",
"libphonenumber-js": "1.11.1",
"listr2": "8.2.1",
"luxon": "3.4.4",
"p-queue": "8.0.1",
Expand All @@ -110,8 +110,8 @@
"sql-bricks-postgres": "0.6.0",
"string-byte-length": "3.0.0",
"tiny-invariant": "1.3.3",
"tsx": "4.8.2",
"type-fest": "4.18.1",
"tsx": "4.9.3",
"type-fest": "4.18.2",
"typescript": "5.4.5",
"zod-prisma-types": "3.1.6",
"zod-to-json-schema": "3.23.0"
Expand Down
4 changes: 2 additions & 2 deletions packages/env/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"dependencies": {
"@t3-oss/env-nextjs": "0.9.2",
"@weareinreach/util": "workspace:*",
"chromatic": "11.3.0",
"zod": "3.23.5"
"chromatic": "11.3.1",
"zod": "3.23.7"
},
"devDependencies": {
"@weareinreach/config": "workspace:*",
Expand Down
6 changes: 3 additions & 3 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
"@tanstack/eslint-plugin-query": "4.38.0",
"@types/eslint": "8.56.10",
"@types/eslint-config-prettier": "6.11.3",
"@types/node": "20.12.8",
"@typescript-eslint/eslint-plugin": "7.7.1",
"@typescript-eslint/parser": "7.7.1",
"@types/node": "20.12.10",
"@typescript-eslint/eslint-plugin": "7.8.0",
"@typescript-eslint/parser": "7.8.0",
"eslint": "8.57.0",
"eslint-config-next": "14.2.3",
"eslint-config-prettier": "9.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { isIdFor } from '@weareinreach/db/lib/idGen'
import { isExternal, Link } from '~ui/components/core/Link'
import { PhoneDrawer } from '~ui/components/data-portal/PhoneDrawer'
import { useCustomVariant } from '~ui/hooks/useCustomVariant'
import { parsePhoneNumber } from '~ui/hooks/usePhoneNumber'
import { isExtension, parsePhoneNumber } from '~ui/hooks/usePhoneNumber'
import { useSlug } from '~ui/hooks/useSlug'
import { Icon } from '~ui/icon'
import { nsFormatter } from '~ui/lib/nsFormatter'
Expand Down Expand Up @@ -52,7 +52,7 @@ const PhoneNumbersDisplay = ({ parentId = '', passedData, direct, locationOnly }
if (!parsedPhone || (locationOnly && !showLocationOnly)) {
continue
}
if (ext) {
if (isExtension(ext)) {
parsedPhone.setExt(ext)
}
const dialURL = parsedPhone.getURI()
Expand Down Expand Up @@ -144,7 +144,7 @@ const PhoneNumbersEdit = ({ parentId = '' }: PhoneNumbersProps) => {
if (!parsedPhone) {
return null
}
if (ext) {
if (isExtension(ext)) {
parsedPhone.setExt(ext)
}

Expand Down
12 changes: 10 additions & 2 deletions packages/ui/hooks/usePhoneNumber.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import parsePhone, { type CountryCode, getCountries, isSupportedCountry } from 'libphonenumber-js'
import parsePhone, {
type CountryCode,
type Extension,
getCountries,
isSupportedCountry,
} from 'libphonenumber-js'

/**
* Type guard function checks if a given string is a supported country code and returns a boolean value. All
Expand All @@ -11,13 +16,16 @@ export const isCountryCode = (countryCode: string): countryCode is CountryCode =

export const parsePhoneNumber = (phoneNumber: string, countryCode = 'US') => {
const country = countryCode.toUpperCase()
if (!isCountryCode(country))
if (!isCountryCode(country)) {
throw new Error('Invalid country', {
cause: { passed: countryCode, parsed: country, acceptableOptions: getCountries() },
})
}

return parsePhone(phoneNumber, country)
}

export const usePhoneNumber = (phoneNumber: string, countryCode = 'US') =>
parsePhoneNumber(phoneNumber, countryCode)

export const isExtension = (ext: string | null): ext is Extension => typeof ext === 'string' && ext.length > 0

0 comments on commit d676d9b

Please sign in to comment.