@accounter/client 0.0.7-alpha-20251020201456-275b6a9424e58d4d2c7e9099986230d087ccd6cd → 0.0.8-alpha-20251021150028-9eb73ba6576d67c75a60786d0e4ab0876fd7a95c

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/CHANGELOG.md +102 -105
  2. package/dist/assets/index-0eCf1BcD.css +1 -0
  3. package/dist/assets/index-DHTbHvtz.js +1188 -0
  4. package/dist/assets/{index.es-DldZjCMz.js → index.es-DHwHzag1.js} +1 -1
  5. package/dist/index.html +2 -2
  6. package/package.json +1 -2
  7. package/src/app.tsx +4 -8
  8. package/src/components/business-transactions/business-extended-info.tsx +13 -9
  9. package/src/components/charges/charge-extended-info-menu.tsx +21 -27
  10. package/src/components/charges/charges-row.tsx +10 -12
  11. package/src/components/charges/charges-table.tsx +9 -15
  12. package/src/components/common/documents/issue-document/recent-client-docs.tsx +3 -5
  13. package/src/components/common/forms/business-card.tsx +0 -1
  14. package/src/components/common/forms/modify-business-fields.tsx +19 -2
  15. package/src/components/common/inputs/combo-box.tsx +1 -1
  16. package/src/components/reports/trial-balance-report/trial-balance-report-group.tsx +6 -4
  17. package/src/components/reports/trial-balance-report/trial-balance-report-sort-code.tsx +11 -8
  18. package/src/gql/gql.ts +6 -72
  19. package/src/gql/graphql.ts +14 -193
  20. package/src/helpers/currency.ts +0 -5
  21. package/src/helpers/index.ts +0 -2
  22. package/dist/assets/index-BSNI6g4T.js +0 -1224
  23. package/dist/assets/index-CzRRUK04.css +0 -1
  24. package/src/components/business/business-header.tsx +0 -65
  25. package/src/components/business/charges-section.tsx +0 -82
  26. package/src/components/business/charts-section.tsx +0 -115
  27. package/src/components/business/configurations-section.tsx +0 -835
  28. package/src/components/business/contact-info-section.tsx +0 -544
  29. package/src/components/business/contracts-section.tsx +0 -195
  30. package/src/components/business/documents-section.tsx +0 -26
  31. package/src/components/business/index.tsx +0 -171
  32. package/src/components/business/integrations-section.tsx +0 -479
  33. package/src/components/business/transactions-section.tsx +0 -26
  34. package/src/components/clients/contracts/modify-contract-dialog.tsx +0 -426
  35. package/src/components/clients/modify-client-dialog.tsx +0 -276
  36. package/src/components/screens/businesses/business.tsx +0 -50
  37. package/src/components/ui/progress.tsx +0 -25
  38. package/src/components/ui/skeleton.tsx +0 -12
  39. package/src/helpers/contracts.ts +0 -22
  40. package/src/helpers/pcn874.ts +0 -17
  41. package/src/hooks/use-insert-client.ts +0 -80
  42. package/src/hooks/use-update-client.ts +0 -75
@@ -1,50 +0,0 @@
1
- import { useEffect, type ReactElement } from 'react';
2
- import { useMatch } from 'react-router-dom';
3
- import { useQuery } from 'urql';
4
- import Business from '@/components/business/index.js';
5
- import { BusinessScreenDocument } from '../../../gql/graphql.js';
6
- import { AccounterLoader } from '../../common/index.js';
7
-
8
- // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- used by codegen
9
- /* GraphQL */ `
10
- query BusinessScreen($businessId: UUID!) {
11
- business(id: $businessId) {
12
- id
13
- ...BusinessPage
14
- }
15
- }
16
- `;
17
-
18
- export function getBusinessHref(businessId: string): string {
19
- return `/businesses/${businessId}`;
20
- }
21
-
22
- export const BusinessScreen = (): ReactElement => {
23
- const match = useMatch('/businesses/:businessId');
24
-
25
- const businessId = match?.params.businessId;
26
-
27
- const [{ data, fetching }, fetchBusiness] = useQuery({
28
- query: BusinessScreenDocument,
29
- pause: !businessId,
30
- variables: {
31
- businessId: businessId ?? '',
32
- },
33
- });
34
-
35
- useEffect(() => {
36
- if (businessId) {
37
- fetchBusiness();
38
- }
39
- }, [businessId, fetchBusiness]);
40
-
41
- if (fetching && !data?.business) {
42
- return <AccounterLoader />;
43
- }
44
-
45
- if (!businessId || !data?.business) {
46
- return <div>Business not found</div>;
47
- }
48
-
49
- return <Business data={data.business} refetchBusiness={async () => fetchBusiness()} />;
50
- };
@@ -1,25 +0,0 @@
1
- import { forwardRef, type ComponentPropsWithoutRef, type ComponentRef } from 'react';
2
- import { cn } from '@/lib/utils.js';
3
- import * as ProgressPrimitive from '@radix-ui/react-progress';
4
-
5
- const Progress = forwardRef<
6
- ComponentRef<typeof ProgressPrimitive.Root>,
7
- ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>
8
- >(({ className, value, ...props }, ref) => (
9
- <ProgressPrimitive.Root
10
- ref={ref}
11
- className={cn(
12
- 'relative h-2 w-full overflow-hidden rounded-full bg-gray-900/20 dark:bg-gray-50/20',
13
- className,
14
- )}
15
- {...props}
16
- >
17
- <ProgressPrimitive.Indicator
18
- className="h-full w-full flex-1 bg-gray-900 transition-all dark:bg-gray-50"
19
- style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
20
- />
21
- </ProgressPrimitive.Root>
22
- ));
23
- Progress.displayName = ProgressPrimitive.Root.displayName;
24
-
25
- export { Progress };
@@ -1,12 +0,0 @@
1
- import { cn } from '@/lib/utils.js';
2
-
3
- function Skeleton({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {
4
- return (
5
- <div
6
- className={cn('animate-pulse rounded-md bg-gray-900/10 dark:bg-gray-50/10', className)}
7
- {...props}
8
- />
9
- );
10
- }
11
-
12
- export { Skeleton };
@@ -1,22 +0,0 @@
1
- import { BillingCycle, SubscriptionPlan } from '@/gql/graphql.js';
2
-
3
- export function standardBillingCycle(billingCycle: BillingCycle): string {
4
- switch (billingCycle) {
5
- case BillingCycle.Annual:
6
- return 'Annual';
7
- case BillingCycle.Monthly:
8
- return 'Monthly';
9
- default:
10
- throw new Error(`Unsupported Billing Cycle: ${billingCycle}`);
11
- }
12
- }
13
- export function standardPlan(plan: SubscriptionPlan): string {
14
- switch (plan) {
15
- case SubscriptionPlan.Enterprise:
16
- return 'Enterprise';
17
- case SubscriptionPlan.Pro:
18
- return 'Pro';
19
- default:
20
- throw new Error(`Unsupported Subscription plan: ${plan}`);
21
- }
22
- }
@@ -1,17 +0,0 @@
1
- import type { Pcn874RecordType } from '@/gql/graphql.js';
2
-
3
- export const pcn874RecordEnum: Record<Pcn874RecordType, string> = {
4
- C: 'INPUT_SELF_INVOICE',
5
- H: 'INPUT_SINGLE_DOC_BY_LAW',
6
- I: 'SALE_PALESTINIAN_CUSTOMER',
7
- K: 'INPUT_PETTY_CASH',
8
- L1: 'SALE_UNIDENTIFIED_CUSTOMER',
9
- L2: 'SALE_UNIDENTIFIED_ZERO_OR_EXEMPT',
10
- M: 'SALE_SELF_INVOICE',
11
- P: 'INPUT_PALESTINIAN_SUPPLIER',
12
- R: 'INPUT_IMPORT',
13
- S1: 'SALE_REGULAR',
14
- S2: 'SALE_ZERO_OR_EXEMPT',
15
- T: 'INPUT_REGULAR',
16
- Y: 'SALE_EXPORT',
17
- } as const;
@@ -1,80 +0,0 @@
1
- import { useCallback } from 'react';
2
- import { toast } from 'sonner';
3
- import { useMutation } from 'urql';
4
- import {
5
- InsertClientDocument,
6
- type InsertClientMutation,
7
- type InsertClientMutationVariables,
8
- } from '../gql/graphql.js';
9
- import { handleCommonErrors } from '../helpers/error-handling.js';
10
-
11
- // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- used by codegen
12
- /* GraphQL */ `
13
- mutation InsertClient($fields: ClientInsertInput!) {
14
- insertClient(fields: $fields) {
15
- __typename
16
- ... on Client {
17
- id
18
- }
19
- ... on CommonError {
20
- message
21
- }
22
- }
23
- }
24
- `;
25
-
26
- type InsertClientSuccessfulResult = Extract<
27
- InsertClientMutation['insertClient'],
28
- { __typename: 'Client' }
29
- >;
30
-
31
- type UseInsertClient = {
32
- fetching: boolean;
33
- insertClient: (
34
- variables: InsertClientMutationVariables,
35
- ) => Promise<InsertClientSuccessfulResult | void>;
36
- };
37
-
38
- const NOTIFICATION_ID = 'insertClient';
39
-
40
- export const useInsertClient = (): UseInsertClient => {
41
- // TODO: add authentication
42
- // TODO: add local data update method after insert
43
-
44
- const [{ fetching }, mutate] = useMutation(InsertClientDocument);
45
- const insertClient = useCallback(
46
- async (variables: InsertClientMutationVariables) => {
47
- const errorMessage = `Error creating client [${variables.fields.businessId}]`;
48
- const notificationId = `${NOTIFICATION_ID}-${variables.fields.businessId}`;
49
- toast.loading('Creating Client...', {
50
- id: notificationId,
51
- });
52
- try {
53
- const res = await mutate(variables);
54
- const data = handleCommonErrors(res, errorMessage, notificationId, 'insertClient');
55
- if (data) {
56
- toast.success('Success', {
57
- id: notificationId,
58
- description: `Client [${variables.fields.businessId}] was created`,
59
- });
60
- return data.insertClient;
61
- }
62
- } catch (e) {
63
- console.error(`${errorMessage}: ${e}`);
64
- toast.error('Error', {
65
- id: notificationId,
66
- description: errorMessage,
67
- duration: 100_000,
68
- closeButton: true,
69
- });
70
- }
71
- return void 0;
72
- },
73
- [mutate],
74
- );
75
-
76
- return {
77
- fetching,
78
- insertClient,
79
- };
80
- };
@@ -1,75 +0,0 @@
1
- import { useCallback } from 'react';
2
- import { toast } from 'sonner';
3
- import { useMutation } from 'urql';
4
- import {
5
- UpdateClientDocument,
6
- type UpdateClientMutation,
7
- type UpdateClientMutationVariables,
8
- } from '../gql/graphql.js';
9
- import { handleCommonErrors } from '../helpers/error-handling.js';
10
-
11
- // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- used by codegen
12
- /* GraphQL */ `
13
- mutation UpdateClient($businessId: UUID!, $fields: ClientUpdateInput!) {
14
- updateClient(businessId: $businessId, fields: $fields) {
15
- __typename
16
- ... on Client {
17
- id
18
- }
19
- ... on CommonError {
20
- message
21
- }
22
- }
23
- }
24
- `;
25
-
26
- type Client = Extract<UpdateClientMutation['updateClient'], { __typename: 'Client' }>;
27
-
28
- type UseUpdateClient = {
29
- fetching: boolean;
30
- updateClient: (variables: UpdateClientMutationVariables) => Promise<Client | void>;
31
- };
32
-
33
- const NOTIFICATION_ID = 'updateClient';
34
-
35
- export const useUpdateClient = (): UseUpdateClient => {
36
- // TODO: add authentication
37
- // TODO: add local data update method after change
38
-
39
- const [{ fetching }, mutate] = useMutation(UpdateClientDocument);
40
- const updateClient = useCallback(
41
- async (variables: UpdateClientMutationVariables) => {
42
- const message = `Error updating client ID [${variables.businessId}]`;
43
- const notificationId = `${NOTIFICATION_ID}-${variables.businessId}`;
44
- toast.loading('Updating client', {
45
- id: notificationId,
46
- });
47
- try {
48
- const res = await mutate(variables);
49
- const data = handleCommonErrors(res, message, notificationId, 'updateClient');
50
- if (data) {
51
- toast.success('Success', {
52
- id: notificationId,
53
- description: 'Client updated',
54
- });
55
- return data.updateClient;
56
- }
57
- } catch (e) {
58
- console.error(`${message}: ${e}`);
59
- toast.error('Error', {
60
- id: notificationId,
61
- description: message,
62
- duration: 100_000,
63
- closeButton: true,
64
- });
65
- }
66
- return void 0;
67
- },
68
- [mutate],
69
- );
70
-
71
- return {
72
- fetching,
73
- updateClient,
74
- };
75
- };