Commit Graph

511 Commits

Author SHA1 Message Date
giancarlo
d3a4fbdeb1 Refactor env file generation and validation
This commit replaces the previous use of execSync to generate .env.local files with the use of writeFileSync. It also updates the corresponding path and default value in the validation process. This change provides a more efficient and safer way to create these files and correctly update the related prompts.
2024-06-05 15:45:47 +07:00
giancarlo
83a4f29be4 Add environment variables generators and validators
Added a new generator for creating environment variables and a validator to check the validity of the created variables. Also updated the config file to include these new generators in the list of registered generators.
2024-06-05 14:59:10 +07:00
giancarlo
4b4feeec99 Added tests for storage 2024-06-05 13:12:35 +07:00
mk3ext
521cba7dd3 fix(web): update schema.sql for supabase, fixes file upload (#31)
The RLS policy restricted non-uuid file names from being uploaded to ANY bucket.
This was caused by the "or" condition in the policy. This fixes that by wrapping both "or" conditions in a single set of parentheses.
2024-06-05 12:43:04 +07:00
giancarlo
8808e37558 Refactor sign out and auth change listener hooks
In the use-sign-out.ts file, the use of query client has been removed and error handling has been improved during sign-out operations. Meanwhile, in the use-auth-change-listener.ts file, an unnecessary usage of query client and router has been removed. Event handling logic has also been simplified by using window.location.reload() instead of router.refresh() on user sign-out.
2024-06-04 19:38:51 +07:00
giancarlo
d203c9782d Remove redundant loaders and update styling
Deleted the previously redundant loaders from blog and docs sections. Updated the loading.tsx files in home to utilize the GlobalLoader component with improved styling. Additionally, styling in global-loader.tsx from the ui package has been modified to ensure better visibility.
2024-06-04 17:46:40 +07:00
giancarlo
5f872f26cd Remove unused tooling/license from pnpm-lock.yaml
In the pnpm-lock.yaml file, the tooling/license dependency was unused and has been removed.
2024-06-04 17:20:14 +07:00
giancarlo
e2112eefee Update UI styling and Spinner component
Several updates have been made to UI components across various packages. Styling changes have been made in 'global-loader.tsx', 'docs-card.tsx', and 'pricing-table.tsx'. The Spinner component in 'spinner.tsx' has been updated to adjust size and animation properties. Addition of a new prop 'spinnerClassName' in 'loading-overlay.tsx' allows dynamic class assignment. The 'loading.tsx' now exports GlobalLoader directly instead of wrapping it in a function. 'pnpm-lock.yaml' has been updated with a new specifier.
2024-06-04 17:17:12 +07:00
giancarlo
ab1e09cbc1 Update packages and refactored code for improved performance
Updated versions of various packages including "@tanstack/react-query", "@typescript-eslint/eslint-plugin", "@typescript-eslint/parser", and "@marsidev/react-turnstile".

 Additionally, refactored the code in several files including package.json, members-page.loader.ts, page.tsx to ensure proper import statements and optimal function execution order.
2024-06-04 16:03:31 +07:00
giancarlo
2696c08d7d Refactor BillingEventHandlerService and update SQL permissions
Changed BillingEventHandlerService from a class to a method. Also, the SQL permissions for service_role on public.order_items table have been updated to include insert, update and delete operations. Additionally, made adjustment to configuration values in the billing.sample.config.ts file.
2024-06-04 13:32:02 +07:00
giancarlo
cc4453ae4c Update loading bar and spinner animations
The loading bar's completion property on unmounting has been removed to make its behavior more consistent. The css classes have been updated for spinner animation: The 'zoom-in-80' class was changed to 'zoom-in-50' and 'slide-in-from-bottom-4' was added. Also, the react-top-loading-bar's continuous start time has been increased to 300.
2024-06-04 12:33:19 +07:00
giancarlo
3261f2b582 Add more efficient authentication check function to server components.
Added request logging to Next.js config.

This commit introduces a new function 'requireUserInServerComponent' which checks for user authentication and is used in multiple server components. The aim is to enhance efficiency by caching the function so that data is only fetched once per request, preventing unnecessary database hits. Existing components were modified accordingly to incorporate this new method.
2024-06-04 11:54:04 +07:00
giancarlo
16c0f07e59 Update collection type for content retrieval
Changed the collection type from 'pages' to 'documentation' when getting content by slug in the marketing docs page. This change is intended to target the correct content segment in the CMS client function.
2024-06-04 02:12:39 +07:00
giancarlo
86e4bdcc7a Update loading indicators with animation and unmount completion option
Updated the global loading and top loading bar indicators. For the global loading indicator, added zoom-in and fade-in animations. As for the top loading bar indicator, introduced an option to control whether to complete its progress once it's unmounted.
2024-06-04 02:00:23 +07:00
giancarlo
bf7e3185de Refactor cache functions to use explicit loaders
The commit refactors the previous implementation of using cache functions across several modules. They are now explicitly defined as loaders to improve readability and maintain a consistent style. This prevents the cache function calls from getting too nested and difficult to understand, especially in asynchronous cases. Additionally, the user session related hooks are deleted which were not used anymore.
2024-06-04 01:03:57 +07:00
giancarlo
b1c3f12721 Fixed React Query provider. Removed getSession and replaced with getUser to make Supabase happy. Fixed Stepper's responsiveness. 2024-06-03 16:13:55 +07:00
giancarlo
88cebc2126 Improved cache invalidation, and minor design fixes 2024-06-03 15:10:40 +07:00
giancarlo
d0c6981e78 New Tailwind CSS formatter run 2024-06-03 00:35:09 +07:00
giancarlo
08de59a43a Update dependencies and improve type safety in webhook handling
This commit updates various dependencies across the project, including a version bump for 'lucide-react' and 'prettier'. Additionally, it improves type safety in the 'database-webhook-handler.service.ts' by making the 'DatabaseChangePayload' and 'handleEvent' function more type-safe.
2024-06-03 00:33:49 +07:00
giancarlo
26b2eed60d Update pricing table to exclude flat line items
The pricing table component now filters out flat line items as they do not require further explanation. Consequently, changes have been made to the billing sample configuration file, turning a previously metered item into a flat one for clearer demonstration of usage.
2024-06-02 12:22:52 +07:00
giancarlo
ced1b4f7e3 Add refinement to ensure metered line items have zero cost
The billing schema has been updated to include a refinement that ensures metered line items have a cost of zero. To clarify, a different line item type should be added for a flat fee in Stripe. Additionally, unnecessary verifications and logic regarding item costs have been removed from the PlanPicker and LineItemDetails components.
2024-06-01 17:03:20 +07:00
giancarlo
2c52a06536 Update pricing table and billing configuration
Updated the pricing table component to display all line items for a plan, removed condition to exclude primary plan. Adjusted the type of a billing package in the sample configuration to be "metered" instead of "flat". Made related changes in line-item-details component to handle the changes in billing type and to fix the layout.
2024-06-01 15:59:39 +07:00
giancarlo
88ff32479a Update dependencies and refactor SentryProvider component
This update includes version bumps for several dependencies across multiple packages and applications including "@sentry/nextjs", "lucide-react", "@types/node", "pnpm", and others. It also includes a change to the SentryProvider component where the SentryMonitoringService is now instantiated outside the MonitoringProvider function instead of using useRef inside the function.
2024-05-31 19:38:56 +07:00
giancarlo
4be66cb3da Update logic for enabling monitoring instrumentation
The logic to enable the monitoring instrumentation was updated in both the Sentry and Baselime packages. This change ensures that the instrumentation is only enabled when the ENV variable 'ENABLE_MONITORING_INSTRUMENTATION' is specifically set to 'true' instead of simply checking for its existence.
2024-05-29 13:57:36 +07:00
giancarlo
789b06cc1b Update route handler to include route parameters
The changes include updating the route handler function to receive an additional argument containing the route parameters. The body type in the request parameters was also updated to define it as undefined instead of never when
2024-05-29 13:28:16 +07:00
Giancarlo Buomprisco
7f4bfb15e5 Replace createServerClient with createClient in multiple files (#30)
The `createServerClient` function has been replaced with the `createClient` function in the `server-actions.client.ts`, `route-handler.client.ts`, and `server-component.client.ts` files. This includes adding necessary import statements for `createClient` and adjusting the options passed to it, including `persistSession`, `detectSessionInUrl`, and `autoRefreshToken`.
2024-05-29 09:33:43 +07:00
giancarlo
cbf116c688 Add user id parameter to multi-factor authentication functions
The multi-factor authentication functions have been modified to accept a user id as a parameter. This provides more flexibility as it allows a more specific targeting of users. The `useFetchAuthFactors` function has been updated to export the function rather than default, and the `useFactorsMutationKey` function has been updated to take a user id.
2024-05-28 21:13:36 +07:00
giancarlo
ae162f7471 Merge branch 'main' of github.com:makerkit/next-supabase-saas-kit-turbo 2024-05-28 15:18:24 +07:00
Giancarlo Buomprisco
c495335fd5 Sentry + Turbopack fixes (#28)
* Updated packages

Updated all packages to the latest versions

* Refactor Sentry monitoring configuration and services

The Sentry monitoring configuration and services have been refactored to simplify the setup process. In addition, unnecessary files or exports have been removed from the Sentry package. These changes should make the process of initializing and using the Sentry monitoring services in both the client and server more straightforward and efficient.

* Refactor server-side Sentry instrumentation code

The conditional logic responsible for checking the runtime environment and the enabled status of the monitoring instrumentation has been adjusted. This refactoring simplifies the code, making it more readable, by clearly separating the conditions and nesting the environment-specific operations. A typo in the environment variable name "ENABLE_MONITORING_INSTRMENTATION" was also corrected to "ENABLE_MONITORING_INSTRUMENTATION".

* Rename environment variable for monitoring instrumentation

The environment variable controlling monitoring instrumentation has been renamed from 'MONITORING_INSTRUMENTATION_ENABLED' to 'ENABLE_MONITORING_INSTRUMENTATION'. It affects both the README and .env.production files within the monitoring/api and apps/web directories respectively.
2024-05-28 15:17:56 +07:00
giancarlo
d7d05ddbc7 Updated packages 2024-05-28 13:25:15 +07:00
giancarlo
1e047463c8 Upgrade dependencies and enhance UI components
This commit primarily focuses on updating various dependencies, including "@types/react", "@tanstack/react-query", "lucide-react", and others. In addition, several adjustments have been made to UI components, such as adding more properties
2024-05-27 16:12:29 +07:00
Giancarlo Buomprisco
127ad5a315 Force no cache in Supabase clients with Next.js (#27)
* Update navigation menu text color and disable caching in Supabase clients

Updated the active and hover text colors for the navigation menu in the UI package. Also, added prevention of any sort of caching in the Supabase clients (server-actions.client.ts, route-handler.client.ts, server-component.client.ts) to be eventually removed in Next v15. Automatic token refresh is also turned off in the server-component client.

* Increase content items limit in docs loader

The content items limit in the documentation loader has been increased to the maximum safe integer. This ensures that all documentation entries are retrieved from the CMS, avoiding any potential omissions due to arbitrary limits.
2024-05-26 14:44:43 +07:00
giancarlo
f164b24786 Updated packages 2024-05-25 11:31:42 +07:00
giancarlo
428805f791 Update logic for setting active subscription status
Broaden the conditions for active subscriptions in the lemon-squeezy-webhook-handler.service. Now, subscriptions that are cancelled but still within their valid period (cancelAtPeriodEnd) are considered active. This helps prevent users from losing access to services until their current subscription period strictly ends.
2024-05-22 00:49:26 +07:00
giancarlo
a115e37535 Update error handling and function calls in billing services
Minor modifications made to the billing service handlers to improve data interpretation and error processing. The 'getLineItemTypeById' function now uses 'item.variant' for more accurate line item type identification. Unnecessary 'Crypto' object instantiation has been removed in 'createHmac', while improved formatting applied to the error logging within the billing webhook.
2024-05-21 20:41:41 +07:00
giancarlo
70f5ff42df Update dependencies in pnpm-lock.yaml
This commit contains updates to several dependencies, including changes in versions and specifier details. Modifications were also made to the lockfile version. Furthermore, all updated dependencies had adjustments in their association with react, for example removing some dependencies from react and react-dom.
2024-05-21 20:18:02 +07:00
giancarlo
9107e31921 Rename 'subscription' path to 'return' in pricing components
The path referred to by "subscription" in the pricing table and pages has been updated to "return". This will redirect users back to the home page instead of the previously configured personalAccountBilling page after signing up or selecting a plan.
2024-05-21 13:50:30 +07:00
giancarlo
e4d4069aa8 Add check for document in useCsrfToken hook
This commit introduces a check for the existence of 'document' in 'useCsrfToken' hook. This is to protect against errors when using this hook in a non-browser environment where 'document' is not defined.
2024-05-20 12:12:07 +07:00
giancarlo
912995730b Update UI layout and update request handler types
The UI layout has been updated to fix full screen display issues and enable class names in Sidebar. Separately, request handler function types have been improved in next route handlers for better flexibility and type safety.
2024-05-20 12:11:28 +07:00
giancarlo
951356bfa6 Remove query parameters from the URL in auth-callback.service
The update on auth-callback.service now includes the deletion of 'token_hash', 'type', 'next', and 'callback' query parameters from the URL. This ensures a cleaner URL after the authentication callback process.
2024-05-20 02:03:16 +07:00
Giancarlo Buomprisco
048ab96cbc Add AuthCallbackService to handle auth callbacks in Supabase (#25)
* Add AuthCallbackService to handle auth callbacks in Supabase

Created a new service, AuthCallbackService, in the Supabase package to centralize the handling of authentication callbacks. This service handles two main tasks: verifying the token hash for user email verification and exchanging the authentication code for a session. Code in the web app routes were updated to utilize this new service, improving code organization and reusability.

* Remove CSRF Token Meta component and add Jaeger exporter

The CSRF Token Meta component was removed from the application. Instead, CSRF tokens are now included in the root metadata of the application. Additionally, the "@opentelemetry/exporter-jaeger" package was added as a dependency to the Sentry monitoring package. This enables the tracing of application requests via Jaeger.

* Refactor README.md and remove redundant content

Removed the excessive content and detailed instruction from the README.md file. The documentation has been moved to a more suitable and detailed location elsewhere.

* Update package dependencies in sentry/package.json

An ordering change has been made in the dependencies within the sentry/package.json file. The "@opentelemetry/exporter-jaeger" dependency was moved to its correct alphabetical order. No version changes were made.
2024-05-19 23:45:12 +07:00
giancarlo
3cf3c263bc Fixed issue with one-time payments; Updated packages 2024-05-18 22:56:57 +07:00
giancarlo
5c1e1d5cd0 Update package versions in pnpm-lock.yaml
Several package versions including '@types/node', '@supabase/supabase-js', '@tanstack/react-query' and others were updated in the pnpm-lock.yaml file. This commit ensures all references to these versions are properly updated across the project, contributing to the maintenance of dependency consistency.
2024-05-17 23:13:13 +07:00
giancarlo
e88ae7268a Update UI styles and behavior across various components
This commit updates a variety of user interface styles and interactivity across multiple components. Changes include altering color schemes and border styles, modifying button interactivity and behaviors, and updating font weights. An emphasis has been placed on enhancing visual appearance, improving user experience, and maintaining a more consistent look-and-feel across the application.
2024-05-16 15:56:25 +07:00
giancarlo
09c24346a6 Update logging and return statements in billing services
The commit modifies the logging level in the billing services from 'error' to 'info'. Moreover, the error statement has been modified to clarify that the subscription cancellation has possibly been done by the user. Also, it reduces redundant imports and beefs up the return structure in stripe-billing-strategy.service.
2024-05-15 11:28:37 +07:00
giancarlo
6fb315cc85 Merge remote-tracking branch 'origin/main' 2024-05-15 11:08:59 +07:00
Giancarlo Buomprisco
4e50094808 Fix upsert billing (#24)
This commit updates the product_id and variant_id in both the subscription_items and order_items in the billing tests. Updates also include adding new checks to verify these changes. Changes are reflected in corresponding SQL files for personal and team billing subscriptions/orders tests.
2024-05-15 11:08:19 +07:00
giancarlo
71d7675031 Set search path in schema migration file 2024-05-14 16:43:27 +07:00
giancarlo
fe86b04d95 Update database schema and tests for subscription and order management
This commit includes a significant change in the way subscriptions and orders are handled. It introduces the ability to update existing orders and subscriptions, including adding and deleting items. The diff also adds checks to ensure that only valid items can be read, and adds corresponding test cases to verify these changes.
2024-05-14 15:38:53 +07:00
giancarlo
f07610ad8e Remove 'taint' from experimental features in next.config
This commit removes the 'taint' feature from the experimental features list in the Next.js configuration file. This change has been made after reviewing that this feature was not required or being used in the current project.
2024-05-13 22:49:11 +07:00