@bcrumbs.net/bc-api 0.0.31 → 0.0.33

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/package.json CHANGED
@@ -1,22 +1,17 @@
1
1
  {
2
2
  "name": "@bcrumbs.net/bc-api",
3
3
  "description": "The SDK that helps to work with Bread Crumbs APIs",
4
- "version": "0.0.31",
4
+ "version": "0.0.33",
5
5
  "keyword": [
6
6
  "bcrumbs",
7
- "bc-api"
7
+ "bc-api",
8
+ "Bread Crumbs"
8
9
  ],
9
10
  "peerDependencies": {
10
- "@apollo/client": "^3.5.10",
11
- "i18next": "^21.6.14",
12
- "react-i18next": "^11.15.6",
13
- "date-fns": "^2.28.0"
11
+ "@apollo/client": "^3.5.10"
14
12
  },
15
13
  "dependencies": {
16
14
  "apollo-link-rest": "^0.9.0-rc.1",
17
- "jwt-decode": "^3.1.2",
18
- "i18next-browser-languagedetector": "^6.1.3",
19
- "i18next-http-backend": "^1.3.2",
20
15
  "next-with-apollo": "^5.3.0",
21
16
  "apollo-cache-inmemory": "^1.6.6",
22
17
  "apollo-link-http": "^1.5.17"
package/src/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './lib/endpoints/rest/models';
2
+ export * from './lib/endpoints/graphql/config';
2
3
  export * from './lib/endpoints/graphql/showcase';
3
4
  export * from './lib/endpoints/graphql/companies';
4
5
  export * from './lib/endpoints/rest/auth';
@@ -10,6 +11,8 @@ export * from './lib/endpoints/rest/files';
10
11
  export * from './lib/clients/dconfigClient';
11
12
  export * from './lib/clients/dqueryClient';
12
13
  export * from './lib/clients/showcaseClient';
14
+ export * from './lib/clients/coreClient';
15
+ export * from './lib/clients/botClient';
13
16
  export * from './lib/models/contentInstance';
14
17
  export * from './lib/models/model';
15
18
  export * from './lib/models/file';
@@ -18,8 +21,4 @@ export * from './lib/models/content';
18
21
  export * from './lib/models/usage';
19
22
  export * from './lib/models/config';
20
23
  export * from './lib/models/form';
21
- export * from './lib/models/message';
22
- export * from './lib/utils';
23
- export * from './lib/services/i18n';
24
- export * from './lib/services/auth';
25
24
  export * from './lib/config';
@@ -0,0 +1,2 @@
1
+ import { ApolloClient } from '@apollo/client';
2
+ export declare const botClient: ApolloClient<import("@apollo/client").NormalizedCacheObject>;
@@ -0,0 +1,2 @@
1
+ import { ApolloClient } from '@apollo/client';
2
+ export declare const coreClient: ApolloClient<import("@apollo/client").NormalizedCacheObject>;
@@ -14,6 +14,12 @@ export declare const appConfig: {
14
14
  billing: {
15
15
  networkInterface: string;
16
16
  };
17
+ core: {
18
+ networkInterface: string;
19
+ };
20
+ bot: {
21
+ networkInterface: string;
22
+ };
17
23
  sw: {
18
24
  path: string;
19
25
  };
@@ -1,2 +1,2 @@
1
1
  export declare const VALIDATE_COMPANY_NAME: import("@apollo/client").DocumentNode;
2
- export declare const useValidateCompanyName: (name: string) => import("@apollo/client").QueryResult<any, import("@apollo/client").OperationVariables>;
2
+ export declare const useValidateCompanyName: (name: string) => import("@apollo/client").LazyQueryResultTuple<any, import("@apollo/client").OperationVariables>;
@@ -0,0 +1,2 @@
1
+ export declare const portalThemeConfig: import("@apollo/client").DocumentNode;
2
+ export declare const usePortalThemeConfig: (domain: string) => import("@apollo/client").QueryResult<any, import("@apollo/client").OperationVariables>;
@@ -3,15 +3,13 @@ export declare const useShowcaseContentsQuery: (rootId: number, deep: number, pa
3
3
  export declare const showcaseTemplatesQuery: import("@apollo/client").DocumentNode;
4
4
  export declare const showcaseTemplatesQueryOptions: any;
5
5
  export declare const showcasePagesQuery: import("@apollo/client").DocumentNode;
6
- export declare const showcasePagesQueryOptions: any;
7
- export declare const useShowcasePagesQuery: (parentId?: number) => import("@apollo/client").QueryResult<any, import("@apollo/client").OperationVariables>;
6
+ export declare const useShowcasePagesQuery: (companyId: number, parentId?: number) => import("@apollo/client").QueryResult<any, import("@apollo/client").OperationVariables>;
8
7
  export declare const showcaseSectionsQuery: import("@apollo/client").DocumentNode;
9
- export declare const showcaseSectionsQueryOptions: any;
8
+ export declare const useShowcaseSectionsQuery: (companyId: number, parentId?: number) => import("@apollo/client").QueryResult<any, import("@apollo/client").OperationVariables>;
10
9
  export declare const showcaseSectionQuery: import("@apollo/client").DocumentNode;
11
10
  export declare const useShowcaseSectionQuery: (companyId: number, id: number) => import("@apollo/client").QueryResult<any, import("@apollo/client").OperationVariables>;
12
11
  export declare const showcaseDomainsQuery: import("@apollo/client").DocumentNode;
13
- export declare const showcaseDomainsQueryOptions: any;
14
- export declare const useDomainsQuery: () => import("@apollo/client").QueryResult<any, import("@apollo/client").OperationVariables>;
12
+ export declare const useDomainsQuery: (companyId: number) => import("@apollo/client").QueryResult<any, import("@apollo/client").OperationVariables>;
15
13
  export declare const showcaseConfig: import("@apollo/client").DocumentNode;
16
14
  export declare const useShowcaseConfig: (domain: string) => import("@apollo/client").QueryResult<any, import("@apollo/client").OperationVariables>;
17
15
  export declare const showcaseConfigById: import("@apollo/client").DocumentNode;
@@ -5,6 +5,6 @@ export declare const companyUsersQuery: import("@apollo/client").DocumentNode;
5
5
  export declare const subscriptionConfigurationQuery: import("@apollo/client").DocumentNode;
6
6
  export declare const subscriptionConfigurationQueryOptions: any;
7
7
  export declare const createCompany: import("@apollo/client").DocumentNode;
8
- export declare const createCompanyOptions: any;
8
+ export declare const useCreateCompanyMutation: (OwnerId: number) => import("@apollo/client").MutationTuple<any, import("@apollo/client").OperationVariables, import("@apollo/client").DefaultContext, import("@apollo/client").ApolloCache<any>>;
9
9
  export declare const updateCompany: import("@apollo/client").DocumentNode;
10
10
  export declare const updateCompanyOptions: any;
@@ -1,9 +1,9 @@
1
1
  import { UsageRecordQueryResult } from '../../../models/usage';
2
2
  export declare const showcaseConfigurationQuery: import("@apollo/client").DocumentNode;
3
- export declare const useShowcaseConfigurationQuery: () => import("@apollo/client").QueryResult<any, import("@apollo/client").OperationVariables>;
3
+ export declare const useShowcaseConfigurationQuery: (ContextId: number) => import("@apollo/client").QueryResult<any, import("@apollo/client").OperationVariables>;
4
4
  export declare const showcaseConfigurationQueryOptions: any;
5
5
  export declare const menuConfigurationQuery: import("@apollo/client").DocumentNode;
6
- export declare const useMenuConfigurationQuery: () => import("@apollo/client").QueryResult<any, import("@apollo/client").OperationVariables>;
6
+ export declare const useMenuConfigurationQuery: (ContextId?: number) => import("@apollo/client").QueryResult<any, import("@apollo/client").OperationVariables>;
7
7
  export declare const addDomain: import("@apollo/client").DocumentNode;
8
8
  export declare const addDomainOptions: any;
9
9
  export declare const removeDomain: import("@apollo/client").DocumentNode;
@@ -11,7 +11,7 @@ export declare const removeDomainOptions: any;
11
11
  export declare const useShowcaseTemplate: import("@apollo/client").DocumentNode;
12
12
  export declare const useShowcaseTemplateOptions: any;
13
13
  export declare const useShowcaseTemplateProgress: import("@apollo/client").DocumentNode;
14
- export declare const useShowcaseTemplateProgressQuery: (templateId: number) => import("@apollo/client").LazyQueryResultTuple<any, import("@apollo/client").OperationVariables>;
14
+ export declare const useShowcaseTemplateProgressQuery: (companyId: number, templateId: number) => import("@apollo/client").LazyQueryResultTuple<any, import("@apollo/client").OperationVariables>;
15
15
  export declare const updateTemplateSectionThumb: import("@apollo/client").DocumentNode;
16
16
  export declare const registeUsage: import("@apollo/client").DocumentNode;
17
17
  export declare const useRegisterUsage: (body: {
@@ -29,5 +29,6 @@ export declare enum ModelFieldsTypes {
29
29
  Boolean = "Boolean",
30
30
  Number = "Number",
31
31
  Image = "Image",
32
- MultipleImages = "Multiple Images"
32
+ MultipleImages = "Multiple Images",
33
+ JSON = "JSON"
33
34
  }
@@ -1,20 +0,0 @@
1
- export declare const MessageTypePossibleValues: readonly ["text", "image", "audio", "document", "video", "location", "interactive", "template"];
2
- export declare const IntegrationTypePossibleValues: string[];
3
- export type MessageType = typeof MessageTypePossibleValues[number];
4
- export type IntegrationType = typeof IntegrationTypePossibleValues[number];
5
- export interface Message {
6
- workspaceId: number;
7
- integrationId: string;
8
- integrationType: IntegrationType;
9
- content: string;
10
- type: MessageType;
11
- messageId?: string;
12
- conversationId?: string;
13
- clientId?: string;
14
- externalMessageId?: string;
15
- externalConversationId?: string;
16
- externalClientId: string;
17
- traceId?: string;
18
- spanId?: string;
19
- debug?: boolean;
20
- }
@@ -1,123 +0,0 @@
1
- type STORES_TYPES = 'localStorage' | 'sessionStorage';
2
- type Storage = STORES_TYPES;
3
- type TokenKey = string;
4
- type ContextKey = string;
5
- type UserInfoKey = string;
6
- type User = {
7
- name?: string;
8
- surname?: string;
9
- username?: string;
10
- email?: string;
11
- id: string;
12
- };
13
- export declare const auth: {
14
- /**
15
- * get token from localstorage
16
- *
17
- * @param {'localStorage' | 'sessionStorage'} [fromStorage='localStorage'] specify storage
18
- * @param {any} [tokenKey=TOKEN_KEY] optionnal parameter to specify a token key
19
- * @returns {string} token value
20
- */
21
- getToken(fromStorage?: Storage, tokenKey?: TokenKey): string | null;
22
- /**
23
- * set the token value into localstorage (managed by localforage)
24
- *
25
- * @param {string} [value=''] token value
26
- * @param {'localStorage' | 'sessionStorage'} [toStorage='localStorage'] specify storage
27
- * @param {any} [tokenKey='token'] token key
28
- * @returns {boolean} success/failure flag
29
- */
30
- setToken(value?: string, toStorage?: Storage, tokenKey?: TokenKey): void;
31
- /**
32
- * check
33
- * - if token key contains a valid token value (defined and not an empty value)
34
- * - if the token expiration date is passed
35
- *
36
- *
37
- * Note: 'isAuthenticated' just checks 'tokenKey' on store (localStorage by default or sessionStorage)
38
- *
39
- * You may think: 'ok I just put an empty token key and I have access to protected routes?''
40
- * -> answer is: YES^^
41
- * BUT
42
- * -> : 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.
43
- *
44
- * => ON CONCLUSION: this aim of 'isAuthenticated'
45
- * -> is to help for a better "user experience" (= better than displaying a view with no data since server did not accept the user).
46
- * -> it is not a security purpose (security comes from backend, since frontend is easily hackable => user has access to all your frontend)
47
- *
48
- * @param {'localStorage' | 'sessionStorage'} [fromStorage='localStorage'] specify storage
49
- * @param {any} [tokenKey=TOKEN_KEY] token key
50
- * @returns {bool} is authenticed response
51
- */
52
- isAuthenticated(fromStorage?: Storage, tokenKey?: TokenKey): boolean;
53
- /**
54
- * delete token
55
- *
56
- * @param {any} [tokenKey='token'] token key
57
- * @returns {bool} success/failure flag
58
- */
59
- clearToken(storage?: Storage, tokenKey?: TokenKey): boolean;
60
- /**
61
- * return expiration date from token
62
- *
63
- * @param {string} encodedToken - base 64 token received from server and stored in local storage
64
- * @returns {date | null} returns expiration date or null id expired props not found in decoded token
65
- */
66
- getTokenExpirationDate(encodedToken: string): Date;
67
- /**
68
- *
69
- * tell is token is expired (compared to now)
70
- *
71
- * @param {string} encodedToken - base 64 token received from server and stored in local storage
72
- * @returns {bool} returns true if expired else false
73
- */
74
- isExpiredToken(encodedToken: string): boolean;
75
- /**
76
- * get user info from localstorage
77
- *
78
- * @param {'localStorage' | 'sessionStorage'} [fromStorage='localStorage'] specify storage
79
- * @param {any} [userInfoKey='userInfo'] optionnal parameter to specify a token key
80
- * @returns {string} token value
81
- */
82
- getUserInfo(fromStorage?: Storage, userInfoKey?: UserInfoKey): any;
83
- /**
84
- * set the userInfo value into localstorage
85
- *
86
- * @param {object} [value=''] token value
87
- * @param {'localStorage' | 'sessionStorage'} [toStorage='localStorage'] specify storage
88
- * @param {any} [userInfoKey='userInfo'] token key
89
- * @returns {boolean} success/failure flag
90
- */
91
- setUserInfo(value: User, toStorage?: Storage, userInfoKey?: UserInfoKey): void;
92
- updateUserInfo(value: User, toStorage?: Storage, userInfoKey?: UserInfoKey): any;
93
- /**
94
- * delete userInfo
95
- *
96
- * @param {string} [userInfoKey='userInfo'] token key
97
- * @returns {bool} success/failure flag
98
- */
99
- clearUserInfo(userInfoKey?: UserInfoKey): any;
100
- /**
101
- * forget me method: clear all
102
- * @returns {bool} success/failure flag
103
- */
104
- clearAllAppStorage(): void;
105
- /**
106
- * set the context value into localstorage (managed by localforage)
107
- *
108
- * @param {string} [value=''] context value
109
- * @param {'localStorage' | 'sessionStorage'} [toStorage='localStorage'] specify storage
110
- * @param {any} [tokenKey='token'] token key
111
- * @returns {boolean} success/failure flag
112
- */
113
- setContext(value?: string, toStorage?: Storage, contextKey?: ContextKey): void;
114
- /**
115
- * get context from localstorage
116
- *
117
- * @param {'localStorage' | 'sessionStorage'} [fromStorage='localStorage'] specify storage
118
- * @param {any} [tokenKey=TOKEN_KEY] optionnal parameter to specify a token key
119
- * @returns {number} token value
120
- */
121
- getContext(fromStorage?: Storage, contextKey?: ContextKey): number | null | undefined;
122
- };
123
- export default auth;
@@ -1,11 +0,0 @@
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
- }