Commit Graph

592 Commits

Author SHA1 Message Date
gbuomprisco
fb04be4d26 Updated dependencies, fixed turbo gen command deps 2024-07-15 20:20:33 +08:00
gbuomprisco
837a0bb02e Update subscription cancellation logic
The previous implementation attempted to cancel a subscription without checking its status. This commit adds a check to see if the subscription is already cancelled before attempting to cancel it, avoiding unnecessary cancellation requests. This improves the efficiency and reliability of the subscription management process.
2024-07-14 11:05:18 +08:00
gbuomprisco
f48c6993dd Update interval count in lemon-squeezy-webhook-handler
The interval count value for yearly subscriptions in the lemon-squeezy-webhook-handler service has been corrected. It was previously set to 12, which inaccurately represented a monthly subscription, so it has been updated to reflect the correct annual figure of 1.
2024-07-12 14:32:10 +08:00
Giancarlo Buomprisco
a75f7c576d Add terms and conditions checkbox to sign-up methods (#45)
A checkbox has been added for user acceptance of terms and conditions during sign-up. This change includes adding a new adjustable flag in the configuration to control the display of the checkbox. A new file "terms-and-conditions-form-field.tsx" is added to handle the checkbox UI part. Also, localization support has been added for the feature.
2024-07-12 14:32:02 +08:00
Giancarlo Buomprisco
3393863dd2 Add status property to content item structure (#44)
* Add status property to content item structure

This commit introduces a new `status` property to the content item structure, allowing content items to maintain a status such as 'draft', 'published', 'review', 'pending'. This status is mapped to the corresponding status in Wordpress and Keystatic clients to ensure consistent usage across platforms. Content retrieval methods now also include a status filter.

* Refactor code for style and readability improvements

This commit includes changes in various files across different packages to improve code readability, including adjusting spacing and breaking down complex lines into simpler parts. In addition, the switch statement in `wp-client.ts` has been refactored and status values are now held in variables, and the CSS classes in `global-loader.tsx` have been reorganized.
2024-07-11 15:06:15 +08:00
Giancarlo Buomprisco
21f42f14ce Invite prefill email (#43)
* Add prepopulation of email field in sign-up form
* Updated packages
2024-07-11 13:59:14 +08:00
gbuomprisco
4f0e6b9bbb Update 'next' and 'lucide-react' across all packages
This commit upgrades 'next' from version 14.2.4 to 14.2.5 and 'lucide-react' from version 0.403.0 to 0.407.0 across all packages. Also, minor version increments for '@keystatic/core' and '@sentry/nextjs' to enhance the overall functionality. The pnpm-lock.yaml file has also been updated accordingly.
2024-07-10 23:39:35 +08:00
gbuomprisco
1e2f3023bc Add onSubmit callback to multi-step form
The multi-step form has been updated to include an onSubmit callback, enhancing its functionality. This is achieved via a hook `useMutation` from `@tanstack/react-query` that handles submission operations. This change enables the application to perform specific operations upon submission.
2024-07-10 15:04:10 +08:00
gbuomprisco
27533c94e6 Refactor user authorization in AdminSidebar
The commit simplifies user authorization in 'AdminSidebar' component by removing unnecessary imports and functions and passing user directly as a prop instead. This change optimizes code readability and makes user authorization more efficient.
2024-07-10 09:26:25 +08:00
gbuomprisco
94199fa775 Add multi-step form and dot variant for stepper component
This update includes the addition of a new multi-step form component for handling complex, multi-part forms. Alongside this, a dot variant for the stepper component has been introduced to provide increased UI/UX flexibility. The new multi-step form component includes validation, navigation between steps and conditional rendering for steps. The modification improves overall user experience in completing multistep forms and enhances the versatility of the stepper component.
2024-07-09 22:09:22 +08:00
gbuomprisco
03594d4e33 Update package dependencies across multiple modules
The commit updates package dependencies throughout various modules, including the bumping of "lucide-react" from "^0.402.0" to "^0.403.0", as well as "@types/node" from "^20.14.6" to "^20.14.10". The package "@typescript-eslint/eslint-plugin" and "@typescript-eslint/parser" have also been upgraded from "^7.15.0" to "^7.16.0". This ensures that the latest functionalities and bug fixes from these packages are utilized across the project.
2024-07-09 14:43:09 +08:00
gbuomprisco
e8b605968e Update subscription query in team-accounts API
The data selection in the getSubscription API for team-accounts has been updated. The query now retrieves all items related to the subscription by implementing an inner join within the 'subscription_items' table.
2024-07-08 19:40:07 +08:00
gbuomprisco
4c392e02fe Replace Accounts API with Team Accounts API in billing page loader
The commit modifies the teamAccountBillingPageLoader by swapping out the previously used Accounts API for the Team Accounts API. This change includes adjustments in the import statement and the creation of the api variable, aligning better with the team account related functionalities.
2024-07-08 19:36:35 +08:00
gbuomprisco
37104d749d Update multiple dependencies across packages
These package updates include version upgrades for the "@supabase/supabase-js" from "^2.44.2" to "^2.44.3", and "@hookform/resolvers" from "^3.7.0" to "^3.9.0" in multiple packages. Other changes involve version updates for minor dependencies, like the "lucide-react" from "^0.400.0" to "^0.402.0" and "stripe" from "^16.1.0" to "^16.2.0".
2024-07-08 16:52:47 +08:00
gbuomprisco
57f9d4364c Update URL pattern in middleware
This change updates the URL patterns for 'admin', 'auth', and 'home' in the middleware file. The updated patterns now include a trailing wildcard and a questioning mark to match any potential following routes, which makes routing more flexible and accurate.
2024-07-06 16:01:47 +08:00
gbuomprisco
bda79d41c0 Rename useAccountWorkspace to useTeamAccountWorkspace
The function useAccountWorkspace has been renamed to useTeamAccountWorkspace to better reflect its usage and context. The corresponding references and related error message were also updated to ensure consistency.
2024-07-05 12:50:41 +08:00
gbuomprisco
49fa8e966c Updated dependencies 2024-07-05 12:32:13 +08:00
gbuomprisco
c93fea9658 Add logging to admin actions and dashboard service
The new logging will enhance the visibility of important actions by the admin, including banning and unbanning users, deleting users and accounts. The features/admin logging dependency has been added. In the admin dashboard service, specific logging has been implemented to track errors in fetching data.
2024-07-05 12:31:43 +08:00
Giancarlo Buomprisco
8f097a4016 Add workspace context and custom hooks for user and team accounts (#41)
* Add workspace context and custom hooks for user and team accounts

The commit introduces a new workspace context for both user and team accounts. New custom hooks, useUserWorkspace and useAccountWorkspace, were created to access this context data. These changes allow for more streamlined data access and manipulation, enabling features that depend on account context information to function more efficiently.

* Upgrade pnpm action-setup to version 4

The commit updates the version of pnpm action-setup used in GitHub workflows from v2 to v4. This upgrade can provide enhancements and improved features offered by the newer version.

* Update pnpm/action-setup version in workflow

The commit removes the explicit "version: 8" specifier in the Github Action workflow for "pnpm/action-setup". The updated workflow now points to "pnpm/action-setup@v4" instead of "pnpm/action-setup@v2", aligning it with usage elsewhere in the workflow.

* Refactor magic link auth container for URL handling

The magic link auth container has been updated to use a standard URL interface for managing URL and query parameters. This improves readability and error handling in the code.URL-related operations are now conducted via the URL object.
2024-07-05 00:28:06 +08:00
gbuomprisco
c5a50fa6c7 Update package dependencies
Updated several package dependencies to their latest versions, improving the general robustness and bringing in the latest features and fixes. This includes the '@typescript-eslint' related packages, '@keystatic/core', and '@sentry/nextjs'.
2024-07-04 21:04:43 +08:00
gbuomprisco
fe8dfd0bea Add condition to account creation trigger
The trigger "add_current_user_to_new_account" has been updated to execute only when a new account is not personal. This adjustment to the trigger condition will ensure the function kit.add_current_user_to_new_account() only fires in these circumstances.
2024-07-04 21:04:00 +08:00
gbuomprisco
fa73cf103a Update multiple package versions across the project
This commit performs an update of the version numbers for several packages used across the project. Overall, this is part of a maintenance task to ensure the latest version of each package is used to gain performance improvements, bug fixes and new features where applicable.
2024-07-03 10:52:32 +08:00
gbuomprisco
d155940df2 Update interval values in lemon-squeezy-webhook-handler
Changed the 'monthly' interval value to 'month' and the 'yearly' interval to 'year'. This change improves code consistency and alignment with the expected format for interval values.
2024-07-03 10:49:05 +08:00
gbuomprisco
6cdb46ea44 Remove redundant 'next' parameter check in auth callback
Refactored the condition handling for the next path in auth-callback.service.ts to only rely on the callbackUrl instead of an additional 'next' parameter. This not only simplifies the code but also reduces potential errors linked to multiple sources of truth for the next path direction.
2024-07-02 11:46:19 +08:00
gbuomprisco
bb846f461e Enhance handling of 'next' path in auth callback
This update improves the logic for handling the 'next' path in the auth callback service. Now, it first checks the query parameters for the 'next' path. If it's not found there, it looks into the callback URL
2024-07-01 16:25:34 +08:00
Giancarlo Buomprisco
9583aeec9f Update webhook handler and tailwind paths, add first subscription ite… (#40)
* Update webhook handler and tailwind paths, add first subscription item to types

In the lemon-squeezy-webhook-handler, changed logger from error to warning and refactored the generation of lineItems to use firstSubscriptionItem details and obtain the priceAmount. In tailwind's index file, adjusted the path to include src directories in packages. Also, the first_subscription_item has been added to the subscription-webhook type for better data representation.

* Refactor subscription interval calculation

The subscription interval calculation was refactored to use the new 'getSubscriptionIntervalType' function. This new function provides a more accurate calculation, where it determines the interval type ('monthly' or 'yearly') by comparing the renewal date with the current date.

* Update dependencies across multiple packages

This commit includes updates to the version of "supabase-js", "lucide-react", "react-query", "react-table", "postcss", "stripe" among other dependencies in multiple package.json files. The "pnpm-lock.yaml" file is also updated to reflect these changes. This ensures the project dependencies stay up-to-date to include new features, improvements and bug fixes.
2024-06-30 23:29:06 +08:00
gbuomprisco
90c1e23821 Update dependency versions
Updated several dependency versions across multiple packages. This includes updating "@supabase/supabase-js" from "^2.43.5" to "^2.44.1", "lucide-react" from "^0.396.0" to "^0.397.0", and "@stripe/react-stripe-js" from "^2.7.1" to "^2.7.2". Also, some dependencies in the lock file were updated.
2024-06-28 00:23:56 +08:00
gbuomprisco
82dbf0128f Refactor Keystatic configuration and update turbo.json
The keystatic.config.ts has been again refactor with new field validations and a new dedicated function to get collections. The "turbo.json" file is also updated with a new "ui" field. The refactor aims to streamline the collection generation, and the "ui" field in "turbo.json" enhances its configuration capabilities.
2024-06-28 00:20:35 +08:00
gbuomprisco
221f59b668 Update '@tanstack/react-query' version and refactor 'database.types.ts'
The '@tanstack/react-query' dependency version has been upgraded across several packages. Alongside, syntax and unnecessary semicolons in 'database.types.ts' have been cleaned up to adhere with the formatting standards.
2024-06-25 23:37:41 +08:00
gbuomprisco
6e218dc47b Update multiple packages and fix warning logs indentation
This commit includes the upgrade of multiple packages to their latest versions, including "@supabase/ssr", "stripe", "@playwright/test", "@typescript-eslint/eslint-plugin" and "@typescript-eslint/parser". It also ensures consistent warning logs indentation in route.ts.
2024-06-25 09:43:17 +08:00
gbuomprisco
5e26e1256e Fix testing value 2024-06-24 13:03:44 +08:00
gbuomprisco
6ea75bf10a Update Keystatic version and refactor version updater
This commit updates the Keystatic version to 0.5.23 and changes the interval for version refetching. The environment variable used for the refetch interval has been modified to NEXT_PUBLIC_VERSION_UPDATER_REFETCH_INTERVAL_SECONDS. Additionally, the code for checking for new version has been refactored and a visual change has been implemented to include a RocketIcon in the dialog header.
2024-06-24 12:38:21 +08:00
gbuomprisco
a3e5f928c4 Add guard clauses in getHashFromProcess
Additional logic has been introduced to the getHashFromProcess function. It will now exit early if the runtime is not Node.js or if the environment is not a development environment to prevent calling a Node.js command. This is done to avoid potential issues in the edge runtime and non-development environments.
2024-06-23 21:09:00 +08:00
gbuomprisco
6b48778753 Add version updater feature
Added a version updater component that frequently checks for updates to the app and alerts the user if necessary. This requires a new route, config changes, and additional UI resources. A new feature flag 'enableVersionUpdater' has been added in the feature-flags.config.ts file to toggle this feature.
2024-06-22 20:21:08 +08:00
gbuomprisco
a6ff3af677 Update package versions in multiple json files
Updated the package versions of "typescript", "lucide-react", "@radix-ui/react-dialog" and several other dependencies across multiple json files. The pnpm-lock.yaml file was also updated to reflect these changes in dependencies. This ensures that we use the most up-to-date versions of these packages in our project.
2024-06-22 15:41:41 +08:00
gbuomprisco
9294e1c823 Refactor code for readability and order
Made several changes across different files primarily focusing on readability. Arranged CSS classes in a standardized order for easier reading and maintenance. Arranged and formatted import lines, function declarations, and component return statements for legibility. Removed unnecessary React imports in some files.
2024-06-21 17:58:20 +08:00
gbuomprisco
8c929e6685 Add new email components: Content and Header
Two new functionalities for email templates have been introduced. A 'content' component which provides a container complete with border and padding specifications, and a 'header' component which simply encapsulates its child items. Both use the '@react-email/components' container for layout.
2024-06-21 17:00:38 +08:00
gbuomprisco
e96651d19b Update CSS in email templates
Enhanced the design of the 'invite-user' and 'confirm-email' templates by adding new CSS code. This CSS code professionaly styles the email, improving readability and user experience.
2024-06-21 16:59:02 +08:00
gbuomprisco
ccf3b38b06 Refactor stripe subscription retrieval process
The process of retrieving stripe subscriptions has been updated in the 'stripe-webhook-handler.service.ts' file. Instead of expanding to 'line_items', the process now retrieves just the subscription and proceeds to build the payload. The refactor aims to improve the performance and simplicity of the subscription retrieval process.
2024-06-21 13:04:23 +08:00
gbuomprisco
b3d938144f Replace app name with title in root metadata
The root metadata in the application config now uses the title instead of the name both in the metadata base and openGraph sections. Adding title into OpenGraph can significantly improve SEO and make the app more discoverable on the internet.
2024-06-21 01:22:25 +08:00
gbuomprisco
b288bca6b8 Update documentation loader limit and optimize sitemap generation
The documentation loader has been updated to limit the number of items to 500 from the previous limit of 'Number.MAX_SAFE_INTEGER'. Additionally, the handling of URL generation and item retrieval in 'server-sitemap.xml/route.ts' has been refactored for more effective sitemap generation. A new 'robots.ts' file was created to set up default rules for web robots accessing the site.
2024-06-20 19:28:47 +08:00
gbuomprisco
b9acbffcae Remove yarn package from dependencies
The yarn package, previously a dependency, has been removed from both pnpm-lock.yaml and package.json files. The removal is consistent across the application and the lockfile, ensuring that yarn will not be installed or used in any part of the project.
2024-06-20 12:43:33 +08:00
gbuomprisco
a8322789de Updated packages 2024-06-20 12:42:09 +08:00
gbuomprisco
95fa8fb7c6 Add handling for paid invoices in billing services
In response to paid invoices, a new callback method has been introduced in the billing services. This feature includes changes in billing-webhook-handler.service.ts, lemon-squeezy-webhook-handler.service.ts, and other related files. The new method fetches and handles paid invoice information from Stripe and LemonSqueezy subscriptions.
2024-06-20 00:02:25 +08:00
gbuomprisco
73c721557f Merge remote-tracking branch 'origin/main' 2024-06-19 23:05:27 +08:00
Giancarlo Buomprisco
6a339a4b02 Billing get subscription enhancement (#36)
* Filter out metered line items from billing schema

This update refines the process of creating a billing schema by filtering out metered line items. The change is necessary as metered line items can be shared across different plans, potentially causing conflicts or duplicates in the schema.

* Update packages to newer versions

This update upgrades several packages across multiple project files to their latest version. These packages include "supabase-js", "react-query", "react-hook-form", and "pnpm". The commit ensures the project is up-to-date with recent package versions, potentially benefiting from bug fixes, new features, and performance improvements.

* Add subscription retrieval in billing services

Added a function to retrieve subscription info in both Stripe and LemonSqueezy billing services. To accomplish this, new methods were added to related services and types. This allows querying specific subscription data based on its id, and throws an error if it fails. Furthermore, PayloadBuilder classes were created to systematically build the subscription payload.

* Remove account ID retrieval from Lemon Squeezy billing service

The code that was querying the database to fetch the accountId has been removed from lemon-squeezy-billing-strategy.service.ts. It was unnecessary as the Lemon Squeezy API does not provide account ID and therefore it is always left empty. Also, adjustments have been made in billing-strategy-provider.service.ts to reflect that the target account ID can be optional.

* Extract 'next' parameter from callback URL

The update allows for the extraction of the 'next' parameter from the callback URL. If such a parameter is available, it is subsequently added to the search parameters. The enhancement improves URL parameter handling in the authentication callback service.

* Refactor URL redirection in auth-callback service

The update simplifies the redirection logic in the authentication callback service. This is achieved by setting the url pathname directly to the redirect path, instead of first setting it to the callback parameter. Moreover, the code handling the 'next' path has also been streamlined, setting the url pathname to the next path when available.
2024-06-19 23:00:00 +08:00
gbuomprisco
abd4b1d095 Update packages to newer versions
This update upgrades several packages across multiple project files to their latest version. These packages include "supabase-js", "react-query", "react-hook-form", and "pnpm". The commit ensures the project is up-to-date with recent package versions, potentially benefiting from bug fixes, new features, and performance improvements.
2024-06-18 01:07:22 +08:00
gbuomprisco
b48380eb69 Filter out metered line items from billing schema
This update refines the process of creating a billing schema by filtering out metered line items. The change is necessary as metered line items can be shared across different plans, potentially causing conflicts or duplicates in the schema.
2024-06-18 01:06:08 +08:00
Giancarlo Buomprisco
fbe7ca4c9e Refactor password validation and enhance localization (#35)
* Refactor password validation and enhance localization

A new PasswordSchema is introduced to handle the password validation in a centralized way and is used across all authentication schemas. The password requirements are also altered with additional special character, number, and uppercase letter checks. Error messages now utilize localization to provide dynamic error notifications.

* Sign out before impersonating a user

This update adds a call to sign out before impersonating a user. This is an additional measure to ensure the security of the system, accentuating the isolation of user sessions.

* Refactor password validation and refine password schemas

The password validation process has been restructured. The 'PasswordSchema' is now split into two separate schemas - 'PasswordSchema' and 'RefinedPasswordSchema'. The logic for validating repeating passwords has been moved into a separate function named 'refineRepeatPassword'. This streamlines the password validation process and ensures consistency across password checks.
2024-06-17 14:37:18 +08:00
gbuomprisco
298e70b738 Refactor multi-factor challenge verification logic
This update modifies the multi-factor challenge execution in the auth component. By moving the onSuccess callback directly into the useVerifyMFAChallenge useMutation hook, it simplifies the code and removes unnecessary useCallback use. Also, it reduces the dependency on useEffect to handle the success scenario which enhances readability and maintainability.
2024-06-17 13:12:40 +08:00