@tealca/core-components 1.0.10 → 1.0.12

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.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { AnchorHTMLAttributes } from 'react';
2
+ import { AxiosInstance } from 'axios';
2
3
  import { ButtonHTMLAttributes } from 'react';
3
4
  import { Context } from 'react';
4
5
  import { default as default_2 } from 'react';
@@ -106,10 +107,30 @@ declare interface AnimatedCollapseProps {
106
107
  /**
107
108
  * React context for managing application-wide data.
108
109
  *
109
- * This context provides access to the current application's information.
110
- * Components that need access to this data can consume this context.
110
+ * This context provides access to the current application's information,
111
+ * API keys, and other configuration. Components that need access to this
112
+ * data can consume this context.
111
113
  */
112
- export declare const AppContext: Context<Application | null>;
114
+ export declare const AppContext: Context<AppContextProps>;
115
+
116
+ /**
117
+ * Defines the shape of the application context.
118
+ *
119
+ * @param application - The current application's information, or `null` if not
120
+ * available.
121
+ * @param googleMapsApiKey - The API key for Google Maps.
122
+ * @param apiUri - The base URI for the API.
123
+ * @param clientId - The client ID for API authentication.
124
+ * @param clientSecret - The client secret for API authentication.
125
+ */
126
+ export declare interface AppContextProps {
127
+ application: Application | null;
128
+ googleMapsApiKey: string;
129
+ clientId: string;
130
+ clientSecret: string;
131
+ api: AxiosInstance;
132
+ basicApi: AxiosInstance;
133
+ }
113
134
 
114
135
  export declare interface Application {
115
136
  applicationId: number;
@@ -300,13 +321,24 @@ declare interface ForgotPasswordProps {
300
321
  sent?: boolean;
301
322
  }
302
323
 
303
- export declare function getApplication(applicationId: number): Promise<Response_2<Application>>;
324
+ export declare function getApplication(api: AxiosInstance, applicationId: number): Promise<Response_2<Application>>;
325
+
326
+ export declare function getCategories(api: AxiosInstance, categoryTypeId: CategoryTypeID): Promise<Response_2<Category[]>>;
304
327
 
305
- export declare function getCategories(categoryTypeId: CategoryTypeID): Promise<Response_2<Category[]>>;
328
+ export declare function getCountries(api: AxiosInstance): Promise<Response_2<Country[]>>;
306
329
 
307
- export declare function getCountries(): Promise<Response_2<Country[]>>;
330
+ export declare function getTaxIdentificationTypes(api: AxiosInstance, countryId?: number, statusId?: number): Promise<Response_2<TaxIdentificationType[]>>;
308
331
 
309
- export declare function getTaxIdentificationTypes(countryId?: number, statusId?: number): Promise<Response_2<TaxIdentificationType[]>>;
332
+ export declare function getToken(api: AxiosInstance, clientId: string, clientSecret: string, username: string, password: string): Promise<Response_2<GetTokenResponse>>;
333
+
334
+ export declare interface GetTokenResponse {
335
+ accessToken: string;
336
+ expiresIn: number;
337
+ tokenType: string;
338
+ scope: string;
339
+ refreshToken: string;
340
+ user: User;
341
+ }
310
342
 
311
343
  /**
312
344
  * GoogleMap component to display a static map with markers and place names.
@@ -743,7 +775,7 @@ export declare const LoadingSpinner: FC<LoaderSpinnerProps>;
743
775
  * a link to the forgot password page.
744
776
  *
745
777
  * @param wrapperClassName - Additional CSS classes to apply to the main wrapper div.
746
- * @param onSubmit - A callback function that is called when the form is submitted.
778
+ * @param onSuccess - A callback function that is called when the login is successful.
747
779
  * @param onForgotPassword - A callback function that is called when the "Forgot Password"
748
780
  * link is clicked.
749
781
  *
@@ -753,8 +785,8 @@ export declare const Login: FC<LoginProps>;
753
785
 
754
786
  declare interface LoginProps {
755
787
  wrapperClassName?: string;
756
- onSubmit: (email: string, password: string) => void;
757
788
  onForgotPassword: () => void;
789
+ onSuccess?: () => void;
758
790
  }
759
791
 
760
792
  declare interface MenuItem {
@@ -1052,6 +1084,16 @@ declare interface PopoverProps {
1052
1084
  */
1053
1085
  export declare const PrimaryButton: FC<ButtonHTMLAttributes<HTMLButtonElement>>;
1054
1086
 
1087
+ export declare function refreshToken(api: AxiosInstance, refreshToken: string): Promise<Response_2<RefreshTokenResponse>>;
1088
+
1089
+ export declare interface RefreshTokenResponse {
1090
+ accessToken: string;
1091
+ expiresIn: number;
1092
+ tokenType: string;
1093
+ scope: string;
1094
+ refreshToken: string;
1095
+ }
1096
+
1055
1097
  declare interface Response_2<_TModelType> {
1056
1098
  code: string;
1057
1099
  error: boolean;