@bcrumbs.net/bc-api 0.0.2
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/README.md +3 -0
- package/index.d.ts +20 -0
- package/index.esm.js +90684 -0
- package/index.umd.js +90445 -0
- package/lib/clients/dconfigClient.d.ts +4 -0
- package/lib/clients/dqueryClient.d.ts +13 -0
- package/lib/clients/showcaseClient.d.ts +10 -0
- package/lib/config/index.d.ts +17 -0
- package/lib/endpoints/graphql/showcase/index.d.ts +15 -0
- package/lib/endpoints/graphql/usage/index.d.ts +1 -0
- package/lib/endpoints/rest/auth/index.d.ts +22 -0
- package/lib/endpoints/rest/billing/index.d.ts +2 -0
- package/lib/endpoints/rest/companies/index.d.ts +10 -0
- package/lib/endpoints/rest/contents/index.d.ts +17 -0
- package/lib/endpoints/rest/files/index.d.ts +14 -0
- package/lib/endpoints/rest/models/index.d.ts +39 -0
- package/lib/endpoints/rest/showcase/index.d.ts +16 -0
- package/lib/models/content.d.ts +27 -0
- package/lib/models/contentInstance.d.ts +32 -0
- package/lib/models/file.d.ts +12 -0
- package/lib/models/folder.d.ts +11 -0
- package/lib/models/model.d.ts +33 -0
- package/lib/services/auth/index.d.ts +120 -0
- package/lib/services/i18n/index.d.ts +11 -0
- package/lib/services/validators/index.d.ts +20 -0
- package/lib/utils/httpStatusCode.d.ts +381 -0
- package/lib/utils/index.d.ts +2 -0
- package/lib/utils/strings.d.ts +5 -0
- package/package.json +31 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ApolloClient } from '@apollo/client';
|
|
3
|
+
declare const dqueryClient: ApolloClient<import("@apollo/client").NormalizedCacheObject>;
|
|
4
|
+
declare const withDQueryClient: (Page: typeof import("next/app").default | (import("react").ComponentClass<any, any> & {
|
|
5
|
+
getInitialProps?(context: import("next").NextPageContext): any;
|
|
6
|
+
}) | (import("react").FunctionComponent<any> & {
|
|
7
|
+
getInitialProps?(context: import("next").NextPageContext): any;
|
|
8
|
+
}), pageOptions?: import("next-with-apollo").WithApolloOptions | undefined) => {
|
|
9
|
+
({ apollo, apolloState, router, ...props }: Partial<import("next-with-apollo").WithApolloProps<any>>): any;
|
|
10
|
+
displayName: string;
|
|
11
|
+
getInitialProps(pageCtx: import("next-with-apollo").ApolloContext<any>): Promise<{}>;
|
|
12
|
+
};
|
|
13
|
+
export { dqueryClient, withDQueryClient };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const withShowcaseClient: (Page: typeof import("next/app").default | (import("react").ComponentClass<any, any> & {
|
|
3
|
+
getInitialProps?(context: import("next").NextPageContext): any;
|
|
4
|
+
}) | (import("react").FunctionComponent<any> & {
|
|
5
|
+
getInitialProps?(context: import("next").NextPageContext): any;
|
|
6
|
+
}), pageOptions?: import("next-with-apollo").WithApolloOptions | undefined) => {
|
|
7
|
+
({ apollo, apolloState, router, ...props }: Partial<import("next-with-apollo").WithApolloProps<any>>): any;
|
|
8
|
+
displayName: string;
|
|
9
|
+
getInitialProps(pageCtx: import("next-with-apollo").ApolloContext<any>): Promise<{}>;
|
|
10
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare let frontend: any;
|
|
2
|
+
export declare const appConfig: {
|
|
3
|
+
dconfig: {
|
|
4
|
+
networkInterface: undefined;
|
|
5
|
+
};
|
|
6
|
+
dquery: {
|
|
7
|
+
networkInterface: string;
|
|
8
|
+
};
|
|
9
|
+
billing: {
|
|
10
|
+
networkInterface: string;
|
|
11
|
+
};
|
|
12
|
+
sw: {
|
|
13
|
+
path: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export default appConfig;
|
|
17
|
+
export { frontend };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const showcaseContentsQuery: import("@apollo/client").DocumentNode;
|
|
2
|
+
export declare const showcaseTemplatesQuery: import("@apollo/client").DocumentNode;
|
|
3
|
+
export declare const showcaseTemplatesQueryOptions: any;
|
|
4
|
+
export declare const showcasePagesQuery: import("@apollo/client").DocumentNode;
|
|
5
|
+
export declare const showcasePagesQueryOptions: any;
|
|
6
|
+
export declare const showcaseSectionQuery: import("@apollo/client").DocumentNode;
|
|
7
|
+
export declare const showcaseSectionQueryOptions: any;
|
|
8
|
+
export declare const showcaseDomainsQuery: import("@apollo/client").DocumentNode;
|
|
9
|
+
export declare const showcaseDomainsQueryOptions: any;
|
|
10
|
+
export declare const useDomainsQuery: () => import("@apollo/client").QueryResult<any, {
|
|
11
|
+
companyId: string | null;
|
|
12
|
+
}>;
|
|
13
|
+
export declare const useShowcaseConfig: (domain: string) => import("@apollo/client").QueryResult<any, {
|
|
14
|
+
domain: string;
|
|
15
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const usageQuery: import("graphql").DocumentNode;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const login: import("graphql").DocumentNode;
|
|
2
|
+
export declare const loginOptions: any;
|
|
3
|
+
export declare const register: import("graphql").DocumentNode;
|
|
4
|
+
export declare const registerOptions: any;
|
|
5
|
+
export declare const forgetPassword: import("graphql").DocumentNode;
|
|
6
|
+
export declare const forgetPasswordOptions: any;
|
|
7
|
+
export declare const resetPassword: import("graphql").DocumentNode;
|
|
8
|
+
export declare const resetPasswordOptions: any;
|
|
9
|
+
export declare const userInfoQuery: import("graphql").DocumentNode;
|
|
10
|
+
export declare const userInfoQueryOptions: any;
|
|
11
|
+
export interface DefinedUserProperty {
|
|
12
|
+
Id: string;
|
|
13
|
+
Value: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const updateUserProfile: import("graphql").DocumentNode;
|
|
16
|
+
export declare const updateUserProfileOptions: any;
|
|
17
|
+
export declare const updateUserPassword: import("graphql").DocumentNode;
|
|
18
|
+
export declare const updateUserPasswordOptions: any;
|
|
19
|
+
export declare const inviteUser: import("graphql").DocumentNode;
|
|
20
|
+
export declare const inviteUserOptions: any;
|
|
21
|
+
export declare const removeUserFromCompany: import("graphql").DocumentNode;
|
|
22
|
+
export declare const removeUserFromCompanyOptions: any;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const userCompaniesQuery: import("@apollo/client").DocumentNode;
|
|
2
|
+
export declare const userCompaniesQueryOptions: any;
|
|
3
|
+
export declare const useUserCompaniesQuery: () => import("@apollo/client").QueryResult<any, import("@apollo/client").OperationVariables>;
|
|
4
|
+
export declare const companyUsersQuery: import("@apollo/client").DocumentNode;
|
|
5
|
+
export declare const subscriptionConfigurationQuery: import("@apollo/client").DocumentNode;
|
|
6
|
+
export declare const subscriptionConfigurationQueryOptions: any;
|
|
7
|
+
export declare const createCompany: import("@apollo/client").DocumentNode;
|
|
8
|
+
export declare const createCompanyOptions: any;
|
|
9
|
+
export declare const updateCompany: import("@apollo/client").DocumentNode;
|
|
10
|
+
export declare const updateCompanyOptions: any;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ContentInstancesQueryResult } from '../../../models/contentInstance';
|
|
2
|
+
export declare const contentInstancesQuery: import("@apollo/client").DocumentNode;
|
|
3
|
+
export declare const useContentInstancesQuery: (contentId: number) => import("@apollo/client").QueryResult<ContentInstancesQueryResult, import("@apollo/client").OperationVariables>;
|
|
4
|
+
export declare const updateContentInstanceFieldValuesMutation: import("@apollo/client").DocumentNode;
|
|
5
|
+
export declare const updateContentInstanceFieldValuesMutationOptions: any;
|
|
6
|
+
export declare const useUpdateContentInstanceFieldValuesMutation: () => import("@apollo/client").MutationTuple<any, import("@apollo/client").OperationVariables, import("@apollo/client").DefaultContext, import("@apollo/client").ApolloCache<any>>;
|
|
7
|
+
export declare const createContentMutation: import("@apollo/client").DocumentNode;
|
|
8
|
+
export declare const createContentMutationOptions: any;
|
|
9
|
+
export declare const useCreateContentMutation: () => import("@apollo/client").MutationTuple<any, import("@apollo/client").OperationVariables, import("@apollo/client").DefaultContext, import("@apollo/client").ApolloCache<any>>;
|
|
10
|
+
export declare const createContentInstanceMutation: import("@apollo/client").DocumentNode;
|
|
11
|
+
export declare const createContentInstanceMutationOptions: any;
|
|
12
|
+
export declare const useCreateContentInstanceMutation: () => import("@apollo/client").MutationTuple<any, import("@apollo/client").OperationVariables, import("@apollo/client").DefaultContext, import("@apollo/client").ApolloCache<any>>;
|
|
13
|
+
export declare const removeContentMutation: import("@apollo/client").DocumentNode;
|
|
14
|
+
export declare const useDeleteContentMutation: () => import("@apollo/client").MutationTuple<any, import("@apollo/client").OperationVariables, import("@apollo/client").DefaultContext, import("@apollo/client").ApolloCache<any>>;
|
|
15
|
+
export declare const updateContentsOrderingMutation: import("@apollo/client").DocumentNode;
|
|
16
|
+
export declare const updateContentsOrderingMutationOptions: any;
|
|
17
|
+
export declare const useUpdateContentsOrderingMutation: () => import("@apollo/client").MutationTuple<any, import("@apollo/client").OperationVariables, import("@apollo/client").DefaultContext, import("@apollo/client").ApolloCache<any>>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FoldersTreeQueryResult } from '../../../models/folder';
|
|
2
|
+
import { FilesQueryResult } from '../../../models/file';
|
|
3
|
+
export declare const foldersTreeQuery: import("@apollo/client").DocumentNode;
|
|
4
|
+
export declare const useFoldersTreeQuery: (rootPath: string) => import("@apollo/client").QueryResult<FoldersTreeQueryResult, import("@apollo/client").OperationVariables>;
|
|
5
|
+
export declare const filesQuery: import("@apollo/client").DocumentNode;
|
|
6
|
+
export declare const useFilesQuery: () => import("@apollo/client").LazyQueryResultTuple<FilesQueryResult, import("@apollo/client").OperationVariables>;
|
|
7
|
+
export declare const createFolderMutation: import("@apollo/client").DocumentNode;
|
|
8
|
+
export declare const useCreateFolderMutation: () => import("@apollo/client").MutationTuple<any, import("@apollo/client").OperationVariables, import("@apollo/client").DefaultContext, import("@apollo/client").ApolloCache<any>>;
|
|
9
|
+
export declare const deleteFolderMutation: import("@apollo/client").DocumentNode;
|
|
10
|
+
export declare const useDeleteFolderMutation: () => import("@apollo/client").MutationTuple<any, import("@apollo/client").OperationVariables, import("@apollo/client").DefaultContext, import("@apollo/client").ApolloCache<any>>;
|
|
11
|
+
export declare const createFileMutation: import("@apollo/client").DocumentNode;
|
|
12
|
+
export declare const useCreateFileMutation: () => import("@apollo/client").MutationTuple<any, import("@apollo/client").OperationVariables, import("@apollo/client").DefaultContext, import("@apollo/client").ApolloCache<any>>;
|
|
13
|
+
export declare const deleteFileMutation: import("@apollo/client").DocumentNode;
|
|
14
|
+
export declare const useDeleteFileMutation: () => import("@apollo/client").MutationTuple<any, import("@apollo/client").OperationVariables, import("@apollo/client").DefaultContext, import("@apollo/client").ApolloCache<any>>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ModelQueryResult } from '../../../models/model';
|
|
2
|
+
export declare const viewTypesQuery: import("@apollo/client").DocumentNode;
|
|
3
|
+
export declare const viewTypesQueryOptions: {
|
|
4
|
+
options: () => {
|
|
5
|
+
client: import("@apollo/client").ApolloClient<import("@apollo/client").NormalizedCacheObject>;
|
|
6
|
+
};
|
|
7
|
+
name: string;
|
|
8
|
+
props: ({ viewTypes: { loading, viewTypes, refetch }, }: {
|
|
9
|
+
viewTypes: {
|
|
10
|
+
loading: boolean;
|
|
11
|
+
viewTypes: any;
|
|
12
|
+
refetch: any;
|
|
13
|
+
};
|
|
14
|
+
}) => {
|
|
15
|
+
models: any;
|
|
16
|
+
refetchModels: any;
|
|
17
|
+
loadingModels: boolean;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export declare const useModelsQuery: (templateContextId?: number | undefined) => import("@apollo/client").QueryResult<ModelQueryResult, import("@apollo/client").OperationVariables>;
|
|
21
|
+
export declare const viewTypeChildrenQuery: import("@apollo/client").DocumentNode;
|
|
22
|
+
export declare const viewTypeChildrenQueryOptions: {
|
|
23
|
+
options: () => {
|
|
24
|
+
client: import("@apollo/client").ApolloClient<import("@apollo/client").NormalizedCacheObject>;
|
|
25
|
+
};
|
|
26
|
+
name: string;
|
|
27
|
+
props: ({ viewTypes: { loading, viewTypes, refetch }, }: {
|
|
28
|
+
viewTypes: {
|
|
29
|
+
loading: boolean;
|
|
30
|
+
viewTypes: any;
|
|
31
|
+
refetch: any;
|
|
32
|
+
};
|
|
33
|
+
}) => {
|
|
34
|
+
models: any;
|
|
35
|
+
refetchModels: any;
|
|
36
|
+
loadingModels: boolean;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export declare const useModelChildrenQuery: (parentId?: number | undefined, templateId?: number | undefined) => import("@apollo/client").QueryResult<ModelQueryResult, import("@apollo/client").OperationVariables>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const showcaseConfigurationQuery: import("@apollo/client").DocumentNode;
|
|
2
|
+
export declare const useShowcaseConfigurationQuery: () => import("@apollo/client").QueryResult<any, {
|
|
3
|
+
ContextId: string | null;
|
|
4
|
+
}>;
|
|
5
|
+
export declare const showcaseConfigurationQueryOptions: any;
|
|
6
|
+
export declare const addDomain: import("@apollo/client").DocumentNode;
|
|
7
|
+
export declare const addDomainOptions: any;
|
|
8
|
+
export declare const removeDomain: import("@apollo/client").DocumentNode;
|
|
9
|
+
export declare const removeDomainOptions: any;
|
|
10
|
+
export declare const useShowcaseTemplate: import("@apollo/client").DocumentNode;
|
|
11
|
+
export declare const useShowcaseTemplateOptions: any;
|
|
12
|
+
export declare const useShowcaseTemplateProgress: import("@apollo/client").DocumentNode;
|
|
13
|
+
export declare const useShowcaseTemplateProgressQuery: (templateId: number) => import("@apollo/client").LazyQueryResultTuple<any, {
|
|
14
|
+
templateId: number;
|
|
15
|
+
companyId: string | null;
|
|
16
|
+
}>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface Content {
|
|
2
|
+
Id: number;
|
|
3
|
+
Name: string;
|
|
4
|
+
DomainId?: number;
|
|
5
|
+
ViewTypeId?: number;
|
|
6
|
+
Online?: boolean;
|
|
7
|
+
PlentyChildren?: boolean;
|
|
8
|
+
ParentId?: number;
|
|
9
|
+
UrlName?: string;
|
|
10
|
+
Priority: number;
|
|
11
|
+
ContentType?: number;
|
|
12
|
+
UrlFullCode?: string;
|
|
13
|
+
CreatorId?: number;
|
|
14
|
+
StageId?: number;
|
|
15
|
+
CreateDate?: Date;
|
|
16
|
+
DueDate?: Date;
|
|
17
|
+
}
|
|
18
|
+
export interface GraphContent {
|
|
19
|
+
createDate?: Date;
|
|
20
|
+
id: number;
|
|
21
|
+
modelId?: number;
|
|
22
|
+
name: string;
|
|
23
|
+
online: boolean;
|
|
24
|
+
parentId?: number;
|
|
25
|
+
path?: string;
|
|
26
|
+
priority: number;
|
|
27
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface ContentInstance {
|
|
2
|
+
Id: number;
|
|
3
|
+
Name: string;
|
|
4
|
+
MetaDescription: string;
|
|
5
|
+
MetaKeywords: string;
|
|
6
|
+
Title: string;
|
|
7
|
+
ViewTemplateId: number;
|
|
8
|
+
Online: boolean;
|
|
9
|
+
ContentId: number;
|
|
10
|
+
Language: string;
|
|
11
|
+
Version: number;
|
|
12
|
+
CreateDate: Date;
|
|
13
|
+
FieldsValues: ContentInstanceField[];
|
|
14
|
+
RedirectUrl: string;
|
|
15
|
+
DownloadPath: string;
|
|
16
|
+
DownloadName: string;
|
|
17
|
+
CreatorId: number;
|
|
18
|
+
StageId: number;
|
|
19
|
+
Stage: any;
|
|
20
|
+
Comments: any;
|
|
21
|
+
ContextCompanyId: number;
|
|
22
|
+
Data: string;
|
|
23
|
+
DataDic: any;
|
|
24
|
+
}
|
|
25
|
+
export interface ContentInstanceField {
|
|
26
|
+
ContentId?: number;
|
|
27
|
+
FieldId: number;
|
|
28
|
+
Value: string;
|
|
29
|
+
}
|
|
30
|
+
export interface ContentInstancesQueryResult {
|
|
31
|
+
contentInstances: ContentInstance[];
|
|
32
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface Model {
|
|
2
|
+
Id: number;
|
|
3
|
+
Name: string;
|
|
4
|
+
ViewFields: ModelField[];
|
|
5
|
+
}
|
|
6
|
+
export interface ModelField {
|
|
7
|
+
Id: number;
|
|
8
|
+
Name: string;
|
|
9
|
+
Type: ModelFieldsTypes;
|
|
10
|
+
EnumId: number;
|
|
11
|
+
}
|
|
12
|
+
export interface ModelQueryResult {
|
|
13
|
+
viewTypes: Model[];
|
|
14
|
+
}
|
|
15
|
+
export declare class ModelUtilities {
|
|
16
|
+
static ConvertModelsListToFieldsMap(models: Model[]): Map<number, ModelField>;
|
|
17
|
+
}
|
|
18
|
+
export declare enum ModelFieldsTypes {
|
|
19
|
+
String = "String",
|
|
20
|
+
StringML = "String - Multiple Lines",
|
|
21
|
+
RichTextBox = "Rich Text Box",
|
|
22
|
+
Date = "Date",
|
|
23
|
+
PredefinedList = "Predefined List",
|
|
24
|
+
PredefinedListCheckboxes = "Predefined List - Checkboxes",
|
|
25
|
+
PredefinedListRadioButtons = "Predefined List - Radio Buttons",
|
|
26
|
+
PredefinedListFilterSelect = "Predefined List - Filter/Select",
|
|
27
|
+
AutoIncrementNumber = "Auto Increment Number",
|
|
28
|
+
ContentUrl = "Content Url",
|
|
29
|
+
Boolean = "Boolean",
|
|
30
|
+
Number = "Number",
|
|
31
|
+
Image = "Image",
|
|
32
|
+
MultipleImages = "Multiple Images"
|
|
33
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
declare type STORES_TYPES = 'localStorage' | 'sessionStorage';
|
|
2
|
+
declare type Storage = STORES_TYPES;
|
|
3
|
+
declare type TokenKey = string;
|
|
4
|
+
declare type ContextKey = string;
|
|
5
|
+
declare type UserInfoKey = string;
|
|
6
|
+
declare type User = {
|
|
7
|
+
name: string;
|
|
8
|
+
surname: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const auth: {
|
|
11
|
+
/**
|
|
12
|
+
* get token from localstorage
|
|
13
|
+
*
|
|
14
|
+
* @param {'localStorage' | 'sessionStorage'} [fromStorage='localStorage'] specify storage
|
|
15
|
+
* @param {any} [tokenKey=TOKEN_KEY] optionnal parameter to specify a token key
|
|
16
|
+
* @returns {string} token value
|
|
17
|
+
*/
|
|
18
|
+
getToken(fromStorage?: Storage, tokenKey?: TokenKey): string | null;
|
|
19
|
+
/**
|
|
20
|
+
* set the token value into localstorage (managed by localforage)
|
|
21
|
+
*
|
|
22
|
+
* @param {string} [value=''] token value
|
|
23
|
+
* @param {'localStorage' | 'sessionStorage'} [toStorage='localStorage'] specify storage
|
|
24
|
+
* @param {any} [tokenKey='token'] token key
|
|
25
|
+
* @returns {boolean} success/failure flag
|
|
26
|
+
*/
|
|
27
|
+
setToken(value?: string, toStorage?: Storage, tokenKey?: TokenKey): void;
|
|
28
|
+
/**
|
|
29
|
+
* check
|
|
30
|
+
* - if token key contains a valid token value (defined and not an empty value)
|
|
31
|
+
* - if the token expiration date is passed
|
|
32
|
+
*
|
|
33
|
+
*
|
|
34
|
+
* Note: 'isAuthenticated' just checks 'tokenKey' on store (localStorage by default or sessionStorage)
|
|
35
|
+
*
|
|
36
|
+
* You may think: 'ok I just put an empty token key and I have access to protected routes?''
|
|
37
|
+
* -> answer is: YES^^
|
|
38
|
+
* BUT
|
|
39
|
+
* -> : your backend will not recognize a wrong token so private data or safe and you protected view could be a bit ugly without any data.
|
|
40
|
+
*
|
|
41
|
+
* => ON CONCLUSION: this aim of 'isAuthenticated'
|
|
42
|
+
* -> is to help for a better "user experience" (= better than displaying a view with no data since server did not accept the user).
|
|
43
|
+
* -> it is not a security purpose (security comes from backend, since frontend is easily hackable => user has access to all your frontend)
|
|
44
|
+
*
|
|
45
|
+
* @param {'localStorage' | 'sessionStorage'} [fromStorage='localStorage'] specify storage
|
|
46
|
+
* @param {any} [tokenKey=TOKEN_KEY] token key
|
|
47
|
+
* @returns {bool} is authenticed response
|
|
48
|
+
*/
|
|
49
|
+
isAuthenticated(fromStorage?: Storage, tokenKey?: TokenKey): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* delete token
|
|
52
|
+
*
|
|
53
|
+
* @param {any} [tokenKey='token'] token key
|
|
54
|
+
* @returns {bool} success/failure flag
|
|
55
|
+
*/
|
|
56
|
+
clearToken(storage?: Storage, tokenKey?: TokenKey): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* return expiration date from token
|
|
59
|
+
*
|
|
60
|
+
* @param {string} encodedToken - base 64 token received from server and stored in local storage
|
|
61
|
+
* @returns {date | null} returns expiration date or null id expired props not found in decoded token
|
|
62
|
+
*/
|
|
63
|
+
getTokenExpirationDate(encodedToken: string): Date;
|
|
64
|
+
/**
|
|
65
|
+
*
|
|
66
|
+
* tell is token is expired (compared to now)
|
|
67
|
+
*
|
|
68
|
+
* @param {string} encodedToken - base 64 token received from server and stored in local storage
|
|
69
|
+
* @returns {bool} returns true if expired else false
|
|
70
|
+
*/
|
|
71
|
+
isExpiredToken(encodedToken: string): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* get user info from localstorage
|
|
74
|
+
*
|
|
75
|
+
* @param {'localStorage' | 'sessionStorage'} [fromStorage='localStorage'] specify storage
|
|
76
|
+
* @param {any} [userInfoKey='userInfo'] optionnal parameter to specify a token key
|
|
77
|
+
* @returns {string} token value
|
|
78
|
+
*/
|
|
79
|
+
getUserInfo(fromStorage?: Storage, userInfoKey?: UserInfoKey): any;
|
|
80
|
+
/**
|
|
81
|
+
* set the userInfo value into localstorage
|
|
82
|
+
*
|
|
83
|
+
* @param {object} [value=''] token value
|
|
84
|
+
* @param {'localStorage' | 'sessionStorage'} [toStorage='localStorage'] specify storage
|
|
85
|
+
* @param {any} [userInfoKey='userInfo'] token key
|
|
86
|
+
* @returns {boolean} success/failure flag
|
|
87
|
+
*/
|
|
88
|
+
setUserInfo(value: User, toStorage?: Storage, userInfoKey?: UserInfoKey): void;
|
|
89
|
+
updateUserInfo(value: User, toStorage?: Storage, userInfoKey?: UserInfoKey): any;
|
|
90
|
+
/**
|
|
91
|
+
* delete userInfo
|
|
92
|
+
*
|
|
93
|
+
* @param {string} [userInfoKey='userInfo'] token key
|
|
94
|
+
* @returns {bool} success/failure flag
|
|
95
|
+
*/
|
|
96
|
+
clearUserInfo(userInfoKey?: UserInfoKey): any;
|
|
97
|
+
/**
|
|
98
|
+
* forget me method: clear all
|
|
99
|
+
* @returns {bool} success/failure flag
|
|
100
|
+
*/
|
|
101
|
+
clearAllAppStorage(): any;
|
|
102
|
+
/**
|
|
103
|
+
* set the context value into localstorage (managed by localforage)
|
|
104
|
+
*
|
|
105
|
+
* @param {string} [value=''] context value
|
|
106
|
+
* @param {'localStorage' | 'sessionStorage'} [toStorage='localStorage'] specify storage
|
|
107
|
+
* @param {any} [tokenKey='token'] token key
|
|
108
|
+
* @returns {boolean} success/failure flag
|
|
109
|
+
*/
|
|
110
|
+
setContext(value?: string, toStorage?: Storage, contextKey?: ContextKey): void;
|
|
111
|
+
/**
|
|
112
|
+
* get context from localstorage
|
|
113
|
+
*
|
|
114
|
+
* @param {'localStorage' | 'sessionStorage'} [fromStorage='localStorage'] specify storage
|
|
115
|
+
* @param {any} [tokenKey=TOKEN_KEY] optionnal parameter to specify a token key
|
|
116
|
+
* @returns {string} token value
|
|
117
|
+
*/
|
|
118
|
+
getContext(fromStorage?: Storage, contextKey?: ContextKey): string | null;
|
|
119
|
+
};
|
|
120
|
+
export default auth;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const LOCAL_STORAGE_I18N_STRING = "I18N_SELECTION";
|
|
2
|
+
export declare const LangService: {
|
|
3
|
+
init: () => void;
|
|
4
|
+
changeLang: (lang: Languages) => void;
|
|
5
|
+
getLang: () => string;
|
|
6
|
+
};
|
|
7
|
+
export declare enum Languages {
|
|
8
|
+
EN = "en",
|
|
9
|
+
AR = "ar",
|
|
10
|
+
TR = "tr"
|
|
11
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
declare const Validators: {
|
|
2
|
+
/**
|
|
3
|
+
* validate image
|
|
4
|
+
*
|
|
5
|
+
* @param {any} [file=File] uploaded file
|
|
6
|
+
* @param {func} [callBack=()=>{ }] the callback function
|
|
7
|
+
*/
|
|
8
|
+
validateImage(file: any, callback: any): void;
|
|
9
|
+
};
|
|
10
|
+
export declare const ValidatorsConstants: {
|
|
11
|
+
MaxFileSize: number;
|
|
12
|
+
FileFormats: {
|
|
13
|
+
TEXT: never[];
|
|
14
|
+
IMAGE: string[];
|
|
15
|
+
VIDEO: string[];
|
|
16
|
+
AUDIO: string[];
|
|
17
|
+
FILE: never[];
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export default Validators;
|