Skip to content

Latest commit

 

History

History
983 lines (752 loc) · 37.1 KB

CHANGELOG.md

File metadata and controls

983 lines (752 loc) · 37.1 KB

@subifinancial/subi-connect

6.0.0

Major Changes

  • #193 3864b98 Thanks @keeganpotgieter! - ### Breaking Changes

    Query Key Filters Structure Change

    • Changed queryKeyFilters type from array to object structure across all table components
    • Updated DataTableProviderProps interface to use Record<string, unknown> instead of QueryKey
    • This affects all components using GenericTable and DataTableProvider

    Payroll Integration Parameter Changes

    • Changed accountPayrollId to payrollSystemId throughout the codebase
    • This affects:
      • PayrollIntegrationManagementTable component
      • useOrganisations hook
      • listOrganisationsFromPayroll action
      • getOrganisationsFromPayrollURL path helper

    Migration Guide

    Query Key Filters

    Before:

    queryKeyFilters={[{ enabledColumns }]}

    After:

    queryKeyFilters={{ enabledColumns }}

    Payroll System ID

    Before:

    const App = () => {
      const { data: accountPayroll } = useAccountPayrollSystem(payroll);
      const { data: organisations } = useOrganisations(accountPayroll.id);
    
      return (
        <PayrollIntegrationManagementTable accountPayrollId={accountPayroll.id} />
      );
    };

    After:

    const App = () => {
      const { data: accountPayroll } = useAccountPayrollSystem(payroll);
      const { data: organisations } = useOrganisations(accountPayroll.payrollId);
    
      return (
        <PayrollIntegrationManagementTable
          payrollSystemId={accountPayroll.payrollId}
        />
      );
    };

Patch Changes

  • #194 653a415 Thanks @keeganpotgieter! - ### Bug Fixes

    • Fixed dependency array in SubiConnectProvider by removing duplicate initialised dependency
    • Updated DataTableProvider to use useSubiConnectQuery instead of raw useQuery
    • Removed unnecessary async wrapper in useAccountPayrollSystem query function
    • Improved code formatting and readability in hooks with consistent spacing

    Internal Changes

    • Refactored query implementation in table context to use useSubiConnectQuery
    • Added proper type handling for query options in useSubiConnectQuery
    • Enhanced query key organisation in company-related hooks
  • #192 319fe2a Thanks @keeganpotgieter! - Added connectionService context to dependency arrays in React hooks to ensure proper cache invalidation when the connection context changes. Updated hooks include:

    • useAccountPayrollSystem
    • useEmployees
    • useOrganisations
    • useAllOrganisations
    • useOrganisation
    • usePayrollSystems

5.0.5

Patch Changes

  • #190 4bc6776 Thanks @keeganpotgieter! - Improved initialisation and configuration handling:

    • Changed initialised state to use useRef instead of useState for better state management
    • Moved provider options handling into ConnectionService constructor
    • Simplified provider options handling by passing httpClient directly instead of ConnectionService
    • Fixed dependency array in SubiConnectProvider's useMemo
    • Removed redundant initialisation code and improved initialisation flow
    • Added providerOptions to ConnectionService constructor parameters

5.0.4

Patch Changes

  • #188 49f0fee Thanks @keeganpotgieter! - Optimise SubiConnect provider initialisation and cleanup:
    • Set initialised state immediately when loading starts
    • Remove redundant initialised check and set
    • Memoise cleanup function with useCallback to prevent unnecessary rerenders
    • Update dependency array in value memo to include cleanup function

5.0.3

Patch Changes

5.0.2

Patch Changes

  • #184 8cbf42b Thanks @keeganpotgieter! - - Changed query invalidation to query removal for better cache management
    • Added sandbox environment support with new SUBI_CONNECT_SANDBOX_PUBLIC_BASE_URL configuration
    • Enhanced environment handling with automatic base URL switching for sandbox mode
    • Improved TypeScript documentation for debug options

5.0.1

Patch Changes

  • fd499a2 Thanks @keeganpotgieter! - Enhance OAuth2 authentication flow and improve connection handling:

    1. Added connectionService to the OAuth2 authentication process:
      • Imported useSubiConnectContext in the Connect and Integrate component.
      • Passed connectionService to handleOAuth2OnSuccess function calls.
    2. Improved handleOnOpenChange function:
      • Simplified setting the open state.
      • Only reset isPending state when closing the dialogue.
    3. Enhanced waitForWindowClose function:
      • Added connectionService parameter.
      • Implemented checkIntegrationSuccess to check OAuth status before closing the window.
      • Improved cleanup process and error handling.
    4. Updated handleOAuth2OnSuccess function:
      • Added connectionService parameter and passed it to waitForWindowClose.
    5. General code improvements:
      • Added void keyword to asynchronous function calls in switch statement.
      • Improved error handling and logging in checkIntegrationSuccess.

    These changes enhance the OAuth2 authentication process, improve connection handling, and provide better integration with the Subi Connect service.

5.0.0

Major Changes

  • #175 cd73808 Thanks @keeganpotgieter! - # Major refactor and enhancement of payroll integration functionality:

    • Refactored ConnectAndIntegrate component:
      • Improved error handling and user feedback
      • Enhanced OAuth2 authentication flow
      • Added support for manual payroll integrations
    • Added new ManualConnectAndIntegrate component for manual payroll systems
    • Introduced Portal component for consistent integration UI across different payroll types
    • Updated PayrollIntegrationListGrid to support both automatic and manual payroll systems
    • Refactored and improved hooks:
      • Added useConnectPayrollMutation
      • Added useIntegrateCustomPayrollMutation
      • Added useIntegrateManualPayrollMutation
    • Enhanced context providers:
      • Added ManualPayrollSystemProvider
      • Updated PayrollSystemProvider
      • Improved PayrollIntegrationProvider
    • Updated types and interfaces:
      • Added ManualIntegrationAccountPayrollSystemExtended
      • Enhanced AccountPayrollSystemExtended
      • Added new types for integration params and mutation props
    • Improved utility functions:
      • Enhanced removeUndefinedValues
      • Added tw function for tagged template literals with Tailwind classes
    • Updated API service layer:
      • Added support for manual payroll integration
      • Improved typing and error handling
    • Enhanced UI components:
      • Updated BaseCard for better flexibility
      • Improved Button component with new variants
    • Updated Tailwind configuration:
      • Added new utility classes
      • Improved type safety

    These changes significantly improve the flexibility, maintainability, and user experience of the payroll integration system, allowing for both automatic and manual integrations with enhanced error handling and UI consistency.

    Manual payroll integration

    • Added new ManualConnectAndIntegrate component for manual payroll systems
    • Added new ManualPayrollSystemProvider context provider for manual payroll systems
    • Added new ManualIntegrationAccountPayrollSystemExtended type for manual payroll systems

    Example usage

    const manualIntegrations: [
      {
        onConnect: ({ payrollSystem, onSuccessCallback, onCancelCallback }) => {
          setTimeout(() => {
            const result = window.confirm('Are you sure you want to connect?');
            if (result) {
              console.log('Connected', { payrollSystem });
              onSuccessCallback(); // Call this to complete the integration workflow
            } else {
              console.log('Cancelled', { payrollSystem });
              onCancelCallback(); // Call this to cancel the integration workflow
            }
          }, 200);
        },
        friendlyName: 'ADP',
        bannerImgUrl:
          'https://au.adp.com/-/media/adp/redesign2018/ui/logo-adp-fy19.svg?rev=0769ecbf84a9412a93e2cd52b7319a13&hash=C2451A542096BF16BC40698417D5A6FD',
        description:
          'Import from ADP to securely share your payroll data with Your Company.',
        actionButtonText: 'Upload',
      },
    ];
    
    const Component = () => {
      const onIntegrationSuccess = () => {
        console.log('Integration successful');
      };
    
      return (
        <PayrollIntegrationList
        manualIntegrations={manualIntegrations}
        onIntegrationSuccess={onIntegrationSuccess}
        />
      );
    };

Minor Changes

  • #173 e6fc1dd Thanks @keeganpotgieter! - Expose connect and integrate mutations.

  • #176 eca5919 Thanks @keeganpotgieter! - # Changeset: Minor Update for Payroll Integration

    Overview

    This changeset introduces improvements to the handling of manual payroll connections and enhances the display of payroll integration options. The main goal is to provide flexibility in how connection types are presented to users, ensuring consistency across the application.

    Key Changes

    1. Enum Update: The payroll connection type for manual systems has been changed from MANUAL to MANUALLY. This change improves clarity by aligning the naming convention with the action (connecting manually).
    2. New Prop for Visibility Control:
      • Added a new optional prop, showManualConnectionTypes, to the PayrollIntegrationListGrid component. This prop allows developers to control the visibility of manual payroll connection types based on the application's context.
    3. Conditional Rendering of Manual Connections:
      • In the PayrollIntegrationListGrid component, added logic to conditionally render payroll systems based on the new showManualConnectionTypes prop. If set to false, manual payroll systems will not be displayed, enhancing user experience by reducing clutter in the UI.
    4. Refactoring of Manual Connect Card:
      • Updated the ManualConnectCard component to use the new Payroll enum for the name display, ensuring consistent references throughout the application.

    Detailed Changes

    1. Update to PayrollConnectionTypeEnum

    File: src/services/api/payroll/types.ts

     export enum PayrollConnectionTypeEnum {
    -  MANUAL = 'MANUAL',
    +  MANUALLY = 'MANUALLY',
       CUSTOM = 'CUSTOM',
       OAUTH2 = 'OAUTH2',
       OAUTH2_AND_COMPANY_MANUALLY = 'OAUTH2_AND_COMPANY_MANUALLY',

4.0.3

Patch Changes

  • #170 57b9156 Thanks @keeganpotgieter! - This change updates the SubiConnectProvider and useSubiConnectQuery components to improve dependency management and query execution control. The changes address potential issues with stale closures and ensure that queries are only executed when the SubiConnect context is properly initialised.

    • Query Execution Control: The useSubiConnectQuery hook now checks the initialised state of the SubiConnect context before executing a query. This ensures that queries are not executed prematurely.
  • #171 a322ebb Thanks @keeganpotgieter! - Added a updateAccessToken method in connection-service.ts to update the access token in storage, and set the Authorization header with the new token—the error interceptor now uses this method to update the token.

4.0.2

Patch Changes

  • #168 d9496b6 Thanks @keeganpotgieter! - This update refactors the logger implementation and improves dependency injection throughout the codebase. It introduces a new Logger class that can be instantiated and passed to other services, enhancing testability and flexibility.

    The changes address potential issues with global state and improve the overall architecture by:

    1. Replacing the global logger instance with a class-based approach
    2. Implementing dependency injection for the logger in various services
    3. Enhancing error handling in the connection service
    4. Improving the structure of interceptors by passing necessary dependencies

4.0.1

Patch Changes

  • #165 d77786f Thanks @keeganpotgieter! - ## Changes

    • Modified the EmployeesTable component to return undefined when the contexts array is empty, instead of returning an empty array. This ensures that when no columns are added, an empty context array isn't provided, so rows show correctly.

4.0.0

Major Changes

  • #163 40d8daf Thanks @keeganpotgieter! - # Major Changes

    1. Employee Table Columns Update:
      • Updated the employee table columns to support multiple calendars, salaries, and emails.
      • Modified components to use new context providers for handling calendar and salary data.
    2. Components Updated:
      • next-payment-date.tsx:
        • Added useCalendar hook to manage selected calendar ID.
        • Updated rendering logic to handle multiple calendars.
      • paycycle.tsx:
        • Added useCalendar hook to manage selected calendar ID.
        • Updated rendering logic to handle multiple calendars.
      • start-employment-date.tsx:
        • Added useCalendar hook to manage selected calendar ID.
        • Updated rendering logic to handle multiple calendars.
      • hourly-rate.tsx:
        • Added useSalary hook to manage selected salary ID.
        • Updated rendering logic to handle multiple salaries.
      • salary.tsx:
        • Added useSalary hook to manage selected salary ID.
        • Updated rendering logic to handle multiple salaries.
      • core.tsx:
        • Updated email column to handle multiple email addresses.
      • consts.ts:
        • Fixed typo in startEmploymentDateColumn export.
      • index.tsx:
        • Added CalendarProvider and SalaryProvider to manage context for calendar and salary data.
        • Updated EmployeesTable component to use new context providers.
    3. New Context Providers:
      • calendar-context.tsx:
        • Created CalendarProvider and useCalendar hook to manage calendar-related state.
      • salary-context.tsx:
        • Created SalaryProvider and useSalary hook to manage salary-related state.
    4. Storybook Updates:
      • live.stories.tsx:
        • Added new stories for PayCycle, NextPaymentDate, StartEmploymentDate, AllCalendars, and AllSalaries.
    5. Type Definitions Updated:
      • types.ts:
        • Updated Employee type to support multiple emails, salaries, and calendars.
        • Fixed typo in SelectableEmployeeColumns.
    6. API Types Updated:
      • types.ts:
        • Updated EmployeeFilterFields to include email as a required field.
    7. Data Table Component Updated:
      • data-table.tsx:
        • Added support for rowContexts to wrap table rows with context providers.
    8. Employee Info Structure:
    • salary field changed to salaries (array of EmployeeSalary).
    • calendar field changed to calendars (array of EmployeeCalendar).
    • email field changed to emails (array of strings).

    These changes introduce significant improvements to the handling of employee data, allowing for more flexible and robust management of multiple calendars, salaries, and emails.

3.1.1

Patch Changes

  • #160 11ec1a5 Thanks @keeganpotgieter! - ## Purpose

    This PR refactors the OAuth2 authentication flow and improves the handling of authentication windows. It introduces a new utility function for generating auth window options and updates the connect and integrate component to use this new approach.

    Problem Solved

    The changes aim to enhance the reliability and consistency of the OAuth2 authentication process, particularly in handling authentication windows across different scenarios. It also improves code reusability by extracting common logic into a separate utility function.

3.1.0

Minor Changes

  • #155 427f161 Thanks @keeganpotgieter! - - Removed all global instances of axios and connection service for better performance on multi-tenant workflows.
    • Updated the authentication window process.
    • Introduced a new cleanupAll function to clear all access tokens and optionally invalidate the SubiConnect query cache.
    • Removed Singleton Pattern: Removed the singleton instance and static getInstance method, allowing for instantiation via the constructor.
    • Constructor Changes:
      • Introduced constructor to initialise connectionFn and context.
      • Initialised httpClient using the httpClient function from the index module.
    • Updated Storage Key Method: Simplified getStorageKey() by removing base URL dependency.
    • HTTP Client Creation: Replaced direct Axios client creation with a new httpClient function that accepts a ConnectionService instance.
    • Interceptors Setup: Moved the request and response interceptor setup to the new httpClient function.
    • Auth Window Handling: Improved handling of the auth window, including better error handling and cleanup.
    • Connection Service: Simplified the ConnectionService class, removing unnecessary methods and properties.

3.0.2

Patch Changes

3.0.1

Patch Changes

3.0.0

Major Changes

  • #147 8587d57 Thanks @keeganpotgieter! - # Breaking Changes

    • The SubiConnectProvider now requires a companyContext prop, which is a string that uniquely identifies the organization (e.g., company ID or name).
    • Removed the context option from SubiConnectOptions.

    New Features

    • Added type safety for the companyContext prop in SubiConnectProvider.

    Improvements

    • Updated the ACCESS_TOKEN_NAME constant to use a shorter name: 'sc-cat'.
    • Enhanced the ConnectionService to handle context changes and update stored access tokens accordingly.
    • Improved type definitions for the connection function and related types.

    Internal Changes

    • Updated demos, stories, and examples to use the new companyContext prop.
    • Refactored ConnectionService to use the new companyContext approach.
    • Updated getAccessToken function to use the new SubiConnectConnectionFn type.

    Documentation

    • Added comments to SubiConnectContext and SubiConnectProviderProps for better documentation.

    This major version change requires users to update their SubiConnectProvider usage by adding the companyContext prop and removing any context option from SubiConnectOptions.

Patch Changes

2.0.1

Patch Changes

2.0.0

Major Changes

  • #136 c889971 Thanks @keeganpotgieter! - Migrate build system from rollup to tsup

    We've transitioned our build process from rollup to tsup for the following reasons:

    1. Reduced bundle size: tsup produces smaller output files, optimizing our package for faster downloads and reduced storage requirements.
    2. Improved build performance: tsup significantly speeds up our build times, enhancing developer productivity and CI/CD efficiency.
    3. Simplified configuration: tsup offers a more streamlined setup with sensible defaults, reducing the complexity of our build configuration.
    4. Better TypeScript support: As a TypeScript-first bundler, tsup provides improved handling of TypeScript projects without additional plugins.
    5. Tree-shaking and code splitting: tsup includes built-in optimizations for tree-shaking and code splitting, further reducing bundle sizes and improving performance.

    This change should be transparent to end-users but will greatly benefit our development process and package distribution.

    Other Changes

    • Updated SubiConnectOptions to expose a context variable to differentiate contexts. See Example 1.
    • Updated SubiConnectContext to expose a cleanup function that can be used cleanup the Subi Connect Context when changing contexts, for example, logging out. See Example 2.
    • Moves styles import to @subifinancial/subi-connect/styles.css. See Example 3.

    Examples

    Example 1

    ...
    
    const Component = () => {
        const { data: myCompany } = useMyCompany();
    
        ...
    
        const options = {
            context: myCompany.name
        } satisfies SubiConnectOptions;
    
        return (
            <SubiConnectProvider connectionFn={connectionFn} options={options}>
                ...
            </SubiConnectProvider>
        );
    }
    
    export default Component;

    Example 2

    ...
    
    const Component = () => {
        const { logout } = auth();
        const { cleanup } = useSubiConnectContext();
    
        ...
    
        const logoutOnClick = () => {
            logout();
            cleanup();
        }
    
        return (
            <div>
                ...
                <button onClick={logoutOnClick}>Logout</button>
                ...
            </div>
        );
    }
    
    export default Component;

    Example 3

    ...
    import "@subifinancial/subi-connect/styles.css"
    ...

1.5.6

Patch Changes

  • #133 ffc65f0 Thanks @keeganpotgieter! - Introduced a new getPayrollFriendlyName function to display user-friendly payroll system names throughout the application.

    • Added a getPayrollFriendlyName utility function in src/lib/utils.ts
    • Updated various components to use the new function for displaying payroll system names
    • Added a friendlyName property to the AccountPayrollSystemExtended type
    • Replaced direct references to payrollSystem.name with getPayrollFriendlyName(payrollSystem)

1.5.5

Patch Changes

  • #130 2c0064b Thanks @keeganpotgieter! - Remove 'subi-connect' class from components inside provider div container.
    • The 'subi-connect' class is now only applied to the
      • provider div container [@src/context/subi-connect.tsx]
      • dialogue component [@src/ui/dialogue.tsx]

1.5.4

Patch Changes

1.5.3

Patch Changes

  • #125 662a561 Thanks @keeganpotgieter! - ### TL;DR

    • Added a CustomLink component and updated the components map and CSS styles.
    • Improved domain input component styling.

    What changed?

    • Created a new CustomLink component in custom-link.tsx
      • Added CustomLink to the otherComponentsMap in components-map.tsx
    • Modified the CSS in index.css to apply the font-family directly to the .subi-connect class instead of all its children
    • Modified the styling of the domain input component:
      • Changed the overflow property from clip to visible for the main container
      • Updated the styling for the subdomain display, improving responsiveness and scroll behaviour

1.5.2

Patch Changes

  • #118 18055da Thanks @keeganpotgieter! - Update the input components to not auto-complete.
    • Update ApiKeyInput
    • Update DomainInput
    • Update the stories to correctly test the inputs in a form context

1.5.1

Patch Changes

  • 7df4d4f Thanks @gustavosubi! - set the input content as the value and apply the mask using the input type

1.5.0

Minor Changes

  • #115 7d4dd66 Thanks @keeganpotgieter! - Updated MDX form components UI/UX. Updated internal typing.

    • Enhanced the API Key Input component with masking functionality
    • Improved the Domain Input component with subdomain extraction and visual feedback
    • Added accessibility improvements to the Connect and Integrate dialogue
    • Updated type definitions for better type safety
    • Added Storybook stories for API Key Input and Domain Input components
    • Added 'subi-connect' class directly for better scoping
  • #114 cee661f Thanks @keeganpotgieter! - Add a new company hook (useCompanyPayrollIntegrations) that is used to get all the integrations the company has connected with.

1.4.5

Patch Changes

1.4.4

Patch Changes

1.4.3

Patch Changes

  • #108 ed1c772 Thanks @gustavosubi! - Add the authorization header for GET /company getting the token from local storage

1.4.2

Patch Changes

1.4.1

Patch Changes

1.4.0

Minor Changes

1.3.0

Minor Changes

1.2.0

Minor Changes

  • #95 6f93d5f Thanks @gustavosubi! - New selectable fields in the employees list: Pay Cycle, Next Pay Day and Start Date

1.1.6

Patch Changes

  • #93 3b991b1 Thanks @keeganpotgieter! - Add a disableBack flag to the PayrollIntegrationManagementPage header component. This is used to remove the ability to 'go back' when using the component outside of the PayrollIntegrationsPage component.

1.1.5

Patch Changes

1.1.4

Patch Changes

1.1.3

Patch Changes

1.1.2

Patch Changes

1.1.1

Patch Changes

  • #81 e9f30b9 Thanks @keeganpotgieter! - Added hasConnection field to the useCompany to determine if the company has integrated with a payroll yet.

1.1.0

Minor Changes

1.0.3

Patch Changes

  • #73 5d17675 Thanks @keeganpotgieter! - Added a tooltip to the sync status column headers to better understand what each status means

1.0.2

Patch Changes

1.0.1

Patch Changes

1.0.0

Major Changes