@airporting/integrations-app 0.2.2 → 0.2.4
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/mf/@mf-types/compiled-types/components/connectors/connector.bubble.d.ts +1 -1
- package/dist/mf/@mf-types/compiled-types/gen/IntegrationsApi.d.ts +27 -12
- package/dist/mf/__federation_expose_connectors.js +1 -1
- package/dist/mf/index.js +3 -3
- package/dist/mf/integrations_app.js +2 -2
- package/dist/mf/mf-manifest.json +1 -1
- package/dist/mf/mf-stats.json +1 -1
- package/package.json +1 -1
- package/dist/mf/@mf-types/connectors.d.ts +0 -2
- package/dist/mf/@mf-types.d.ts +0 -3
- package/dist/mf/@mf-types.zip +0 -0
|
@@ -18,16 +18,27 @@ export interface ConnectorsStatsResponse {
|
|
|
18
18
|
maintenance: number;
|
|
19
19
|
ok: number;
|
|
20
20
|
}
|
|
21
|
+
export interface GetConnectorsV1Params {
|
|
22
|
+
cid: string;
|
|
23
|
+
}
|
|
24
|
+
export interface GetIllConnectorsV1Params {
|
|
25
|
+
cid: string;
|
|
26
|
+
}
|
|
27
|
+
export interface GetStatsConnectorsV1Params {
|
|
28
|
+
cid: string;
|
|
29
|
+
}
|
|
21
30
|
export declare namespace Connectors {
|
|
22
31
|
/**
|
|
23
32
|
* No description
|
|
24
33
|
* @tags Connectors
|
|
25
34
|
* @name GetStatsConnectorsV1
|
|
26
|
-
* @request GET:/v1/connectors/stats
|
|
35
|
+
* @request GET:/v1/connectors/{cid}/stats
|
|
27
36
|
* @response `200` `ConnectorsStatsResponse`
|
|
28
37
|
*/
|
|
29
38
|
namespace GetStatsConnectorsV1 {
|
|
30
|
-
type RequestParams = {
|
|
39
|
+
type RequestParams = {
|
|
40
|
+
cid: string;
|
|
41
|
+
};
|
|
31
42
|
type RequestQuery = {};
|
|
32
43
|
type RequestBody = never;
|
|
33
44
|
type RequestHeaders = {};
|
|
@@ -37,11 +48,13 @@ export declare namespace Connectors {
|
|
|
37
48
|
* No description
|
|
38
49
|
* @tags Connectors
|
|
39
50
|
* @name GetConnectorsV1
|
|
40
|
-
* @request GET:/v1/connectors
|
|
51
|
+
* @request GET:/v1/connectors/{cid}/ok
|
|
41
52
|
* @response `200` `ConnectorsListResponse`
|
|
42
53
|
*/
|
|
43
54
|
namespace GetConnectorsV1 {
|
|
44
|
-
type RequestParams = {
|
|
55
|
+
type RequestParams = {
|
|
56
|
+
cid: string;
|
|
57
|
+
};
|
|
45
58
|
type RequestQuery = {};
|
|
46
59
|
type RequestBody = never;
|
|
47
60
|
type RequestHeaders = {};
|
|
@@ -51,11 +64,13 @@ export declare namespace Connectors {
|
|
|
51
64
|
* No description
|
|
52
65
|
* @tags Connectors
|
|
53
66
|
* @name GetIllConnectorsV1
|
|
54
|
-
* @request GET:/v1/connectors/ill
|
|
67
|
+
* @request GET:/v1/connectors/{cid}/ill
|
|
55
68
|
* @response `200` `ConnectorsListResponse`
|
|
56
69
|
*/
|
|
57
70
|
namespace GetIllConnectorsV1 {
|
|
58
|
-
type RequestParams = {
|
|
71
|
+
type RequestParams = {
|
|
72
|
+
cid: string;
|
|
73
|
+
};
|
|
59
74
|
type RequestQuery = {};
|
|
60
75
|
type RequestBody = never;
|
|
61
76
|
type RequestHeaders = {};
|
|
@@ -146,28 +161,28 @@ export declare class IntegrationsApi<SecurityDataType extends unknown> {
|
|
|
146
161
|
*
|
|
147
162
|
* @tags Connectors
|
|
148
163
|
* @name GetStatsConnectorsV1
|
|
149
|
-
* @request GET:/v1/connectors/stats
|
|
164
|
+
* @request GET:/v1/connectors/{cid}/stats
|
|
150
165
|
* @response `200` `ConnectorsStatsResponse`
|
|
151
166
|
*/
|
|
152
|
-
getStatsConnectorsV1: (params?: RequestParams) => Promise<HttpResponse<ConnectorsStatsResponse, any>>;
|
|
167
|
+
getStatsConnectorsV1: ({ cid, ...query }: GetStatsConnectorsV1Params, params?: RequestParams) => Promise<HttpResponse<ConnectorsStatsResponse, any>>;
|
|
153
168
|
/**
|
|
154
169
|
* No description
|
|
155
170
|
*
|
|
156
171
|
* @tags Connectors
|
|
157
172
|
* @name GetConnectorsV1
|
|
158
|
-
* @request GET:/v1/connectors
|
|
173
|
+
* @request GET:/v1/connectors/{cid}/ok
|
|
159
174
|
* @response `200` `ConnectorsListResponse`
|
|
160
175
|
*/
|
|
161
|
-
getConnectorsV1: (params?: RequestParams) => Promise<HttpResponse<ConnectorsListResponse, any>>;
|
|
176
|
+
getConnectorsV1: ({ cid, ...query }: GetConnectorsV1Params, params?: RequestParams) => Promise<HttpResponse<ConnectorsListResponse, any>>;
|
|
162
177
|
/**
|
|
163
178
|
* No description
|
|
164
179
|
*
|
|
165
180
|
* @tags Connectors
|
|
166
181
|
* @name GetIllConnectorsV1
|
|
167
|
-
* @request GET:/v1/connectors/ill
|
|
182
|
+
* @request GET:/v1/connectors/{cid}/ill
|
|
168
183
|
* @response `200` `ConnectorsListResponse`
|
|
169
184
|
*/
|
|
170
|
-
getIllConnectorsV1: (params?: RequestParams) => Promise<HttpResponse<ConnectorsListResponse, any>>;
|
|
185
|
+
getIllConnectorsV1: ({ cid, ...query }: GetIllConnectorsV1Params, params?: RequestParams) => Promise<HttpResponse<ConnectorsListResponse, any>>;
|
|
171
186
|
};
|
|
172
187
|
}
|
|
173
188
|
export {};
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
*
|
|
8
8
|
* This source code is licensed under the MIT license found in the
|
|
9
9
|
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*/var REACT_ELEMENT_TYPE=Symbol.for("react.transitional.element"),REACT_FRAGMENT_TYPE=Symbol.for("react.fragment");function jsxProd(type,config,maybeKey){var key=null;void 0!==maybeKey&&(key=""+maybeKey);void 0!==config.key&&(key=""+config.key);if("key"in config){maybeKey={};for(var propName in config)"key"!==propName&&(maybeKey[propName]=config[propName])}else maybeKey=config;config=maybeKey.ref;return{$$typeof:REACT_ELEMENT_TYPE,type:type,key:key,ref:void 0!==config?config:null,props:maybeKey}}exports.Fragment=REACT_FRAGMENT_TYPE;exports.jsx=jsxProd;exports.jsxs=jsxProd},5893:function(module,__unused_webpack_exports,__webpack_require__){module.exports=__webpack_require__(631)},5371:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>Connectors});var jsx_runtime=__webpack_require__(5893);var index_js_=__webpack_require__(9063);var index_mjs_=__webpack_require__(3215);var modern_index_js_=__webpack_require__(2760);class HttpClient{baseUrl="";securityData=null;securityWorker;abortControllers=new Map;customFetch=(...fetchParams)=>fetch(...fetchParams);baseApiParams={credentials:"same-origin",headers:{},redirect:"follow",referrerPolicy:"no-referrer"};constructor(apiConfig={}){Object.assign(this,apiConfig)}setSecurityData=data=>{this.securityData=data};encodeQueryParam(key,value){const encodedKey=encodeURIComponent(key);return`${encodedKey}=${encodeURIComponent("number"==typeof value?value:`${value}`)}`}addQueryParam(query,key){return this.encodeQueryParam(key,query[key])}addArrayQueryParam(query,key){const value=query[key];return value.map(v=>this.encodeQueryParam(key,v)).join("&")}toQueryString(rawQuery){const query=rawQuery||{};const keys=Object.keys(query).filter(key=>void 0!==query[key]);return keys.map(key=>Array.isArray(query[key])?this.addArrayQueryParam(query,key):this.addQueryParam(query,key)).join("&")}addQueryParams(rawQuery){const queryString=this.toQueryString(rawQuery);return queryString?`?${queryString}`:""}contentFormatters={["application/json"]:input=>null!==input&&("object"==typeof input||"string"==typeof input)?JSON.stringify(input):input,["application/vnd.api+json"]:input=>null!==input&&("object"==typeof input||"string"==typeof input)?JSON.stringify(input):input,["text/plain"]:input=>null!==input&&"string"!=typeof input?JSON.stringify(input):input,["multipart/form-data"]:input=>{if(input instanceof FormData)return input;return Object.keys(input||{}).reduce((formData,key)=>{const property=input[key];formData.append(key,property instanceof Blob?property:"object"==typeof property&&null!==property?JSON.stringify(property):`${property}`);return formData},new FormData)},["application/x-www-form-urlencoded"]:input=>this.toQueryString(input)};mergeRequestParams(params1,params2){return{...this.baseApiParams,...params1,...params2||{},headers:{...this.baseApiParams.headers||{},...params1.headers||{},...params2&¶ms2.headers||{}}}}createAbortSignal=cancelToken=>{if(this.abortControllers.has(cancelToken)){const abortController=this.abortControllers.get(cancelToken);if(abortController)return abortController.signal;return}const abortController=new AbortController;this.abortControllers.set(cancelToken,abortController);return abortController.signal};abortRequest=cancelToken=>{const abortController=this.abortControllers.get(cancelToken);if(abortController){abortController.abort();this.abortControllers.delete(cancelToken)}};request=async({body,secure,path,type,query,format,baseUrl,cancelToken,...params})=>{const secureParams=("boolean"==typeof secure?secure:this.baseApiParams.secure)&&this.securityWorker&&await this.securityWorker(this.securityData)||{};const requestParams=this.mergeRequestParams(params,secureParams);const queryString=query&&this.toQueryString(query);const payloadFormatter=this.contentFormatters[type||"application/json"];const responseFormat=format||requestParams.format;return this.customFetch(`${baseUrl||this.baseUrl||""}${path}${queryString?`?${queryString}`:""}`,{...requestParams,headers:{...requestParams.headers||{},...type&&"multipart/form-data"!==type?{"Content-Type":type}:{}},signal:(cancelToken?this.createAbortSignal(cancelToken):requestParams.signal)||null,body:null==body?null:payloadFormatter(body)}).then(async response=>{const r=response;r.data=null;r.error=null;const data=responseFormat?await response[responseFormat]().then(data=>{if(r.ok)r.data=data;else r.error=data;return r}).catch(e=>{r.error=e;return r}):r;if(cancelToken)this.abortControllers.delete(cancelToken);if(!response.ok)throw data;return data})}}class IntegrationsApi{http;constructor(http){this.http=http}status=(params={})=>this.http.request({path:"/status",method:"GET",...params});connectors={getStatsConnectorsV1:(params={})=>this.http.request({path:"/v1/connectors/stats",method:"GET",format:"json",...params}),getConnectorsV1:(params={})=>this.http.request({path:"/v1/connectors",method:"GET",format:"json",...params}),getIllConnectorsV1:(params={})=>this.http.request({path:"/v1/connectors/ill",method:"GET",format:"json",...params})}}const AppConfigCtx=/*#__PURE__*/(0,index_js_.createContext)(null);const AppConfigProvider=AppConfigCtx.Provider;function useAppConfig(){const config=(0,index_js_.useContext)(AppConfigCtx);if(!config)throw new Error("Called `useAppConfig` outside a `<AppConfigProvider />`");return config}function useApi(){const config=useAppConfig();const client=new HttpClient({baseUrl:config.api.replace(/\/$/,""),baseApiParams:{headers:{Authorization:config.token?`Bearer ${config.token}`:"",From:config.owner}}});return new IntegrationsApi(client)}function useStatsQuery(){const api=useApi();const query=(0,modern_index_js_.useQuery)({queryKey:["connectors","stats"],queryFn:async()=>await api.connectors.getStatsConnectorsV1().then(x=>x.data),refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true});return query}function useConnectorsListQuery(){const api=useApi();const query=(0,modern_index_js_.useQuery)({queryKey:["connectors","list"],queryFn:async()=>await api.connectors.getConnectorsV1().then(x=>x.data),refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true});return query}function ConnectorBubble({connector}){const logoUrl=connector.main_connectorlist.logo_key?`https://img.logo.dev/${connector.main_connectorlist.logo_key}?token=pk_QvyqAb6uTRGJE2_sDsEb9g&retina=true`:`https://s3.eu-west-3.amazonaws.com/media.airporting/connectors/${connector.main_connectorlist.codename}.png`;return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Card,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Avatar,{src:logoUrl,size:64,radius:"md"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{w:"fit-content",order:3,children:connector.name}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",lineClamp:3,children:connector.main_connectorlist.description_fr})]})})}function ListOkComponent(){const listResultRes=useConnectorsListQuery();const listResult=listResultRes.data;console.log(listResult);return/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{w:"fit-content",mb:0,order:2,children:"Tous vos connecteurs en marche"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid,{children:listResult?.list?.map((connector,idx)=>connector?.main_connectorlist?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:6,md:3},children:/*#__PURE__*/(0,jsx_runtime.jsx)("a",{href:`https://app.airporting.com/connector/company/1/co/${connector.id}/view`,children:/*#__PURE__*/(0,jsx_runtime.jsx)(ConnectorBubble,{connector:connector})})},idx):/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Skeleton,{radius:"md",animate:true},idx))})]})}function ConnectorsApp(){const statsResultRes=useStatsQuery();const statsResult=statsResultRes.data;const[value,setValue]=(0,index_js_.useState)("active");return/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{py:16,children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:0,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{w:"fit-content",mb:0,order:1,children:"Nos connecteurs"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{w:"fit-content",mb:0,c:"dimmed",fz:"h5",children:"Synchronisez vos comptes bancaires et outils comptables facilement."})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{py:16,children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SegmentedControl,{value:value,onChange:setValue,radius:"md",size:"xl",data:[{label:`Connecteurs actifs${statsResult?.ok?` (${statsResult.ok})`:""}`,value:"active"},`Connecteurs \xe0 configurer${statsResult?.ill?` (${statsResult.ill})`:""}`,`Connecteurs en maintenance${statsResult?.maintenance?` (${statsResult.maintenance})`:""}`,"Tous les connecteurs"]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(ListOkComponent,{})]})}var dist_index_js_=__webpack_require__(7483);var esm_index_mjs_=__webpack_require__(3519);var notifications_esm_index_mjs_=__webpack_require__(225);var dist_esm_index_mjs_=__webpack_require__(3040);const theme=(0,index_mjs_.createTheme)((0,dist_esm_index_mjs_.assign)(dist_index_js_.theme,{components:{}}));const cssVarResolver=x=>(0,dist_esm_index_mjs_.assign)(dist_index_js_.cssVarResolver(x),{dark:{},light:{},variables:{}});function Providers(props){const{children,config,mantine,tanstack}=props;return/*#__PURE__*/(0,jsx_runtime.jsx)(AppConfigProvider,{value:config,children:/*#__PURE__*/(0,jsx_runtime.jsx)(modern_index_js_.QueryClientProvider,{client:tanstack?.queryClient??new modern_index_js_.QueryClient,children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.MantineProvider,{theme:theme,cssVariablesResolver:cssVarResolver,defaultColorScheme:mantine?.defaultColorScheme,forceColorScheme:mantine?.forceColorScheme,children:/*#__PURE__*/(0,jsx_runtime.jsxs)(esm_index_mjs_.ModalsProvider,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(notifications_esm_index_mjs_.Notifications,{}),children]})})})})}function Connectors(props){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_js_.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(Providers,{...props,children:/*#__PURE__*/(0,jsx_runtime.jsx)(ConnectorsApp,{})})})}}}]);
|
|
10
|
+
*/var REACT_ELEMENT_TYPE=Symbol.for("react.transitional.element"),REACT_FRAGMENT_TYPE=Symbol.for("react.fragment");function jsxProd(type,config,maybeKey){var key=null;void 0!==maybeKey&&(key=""+maybeKey);void 0!==config.key&&(key=""+config.key);if("key"in config){maybeKey={};for(var propName in config)"key"!==propName&&(maybeKey[propName]=config[propName])}else maybeKey=config;config=maybeKey.ref;return{$$typeof:REACT_ELEMENT_TYPE,type:type,key:key,ref:void 0!==config?config:null,props:maybeKey}}exports.Fragment=REACT_FRAGMENT_TYPE;exports.jsx=jsxProd;exports.jsxs=jsxProd},5893:function(module,__unused_webpack_exports,__webpack_require__){module.exports=__webpack_require__(631)},5371:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>Connectors});var jsx_runtime=__webpack_require__(5893);var index_js_=__webpack_require__(9063);var index_mjs_=__webpack_require__(3215);var modern_index_js_=__webpack_require__(2760);class HttpClient{baseUrl="";securityData=null;securityWorker;abortControllers=new Map;customFetch=(...fetchParams)=>fetch(...fetchParams);baseApiParams={credentials:"same-origin",headers:{},redirect:"follow",referrerPolicy:"no-referrer"};constructor(apiConfig={}){Object.assign(this,apiConfig)}setSecurityData=data=>{this.securityData=data};encodeQueryParam(key,value){const encodedKey=encodeURIComponent(key);return`${encodedKey}=${encodeURIComponent("number"==typeof value?value:`${value}`)}`}addQueryParam(query,key){return this.encodeQueryParam(key,query[key])}addArrayQueryParam(query,key){const value=query[key];return value.map(v=>this.encodeQueryParam(key,v)).join("&")}toQueryString(rawQuery){const query=rawQuery||{};const keys=Object.keys(query).filter(key=>void 0!==query[key]);return keys.map(key=>Array.isArray(query[key])?this.addArrayQueryParam(query,key):this.addQueryParam(query,key)).join("&")}addQueryParams(rawQuery){const queryString=this.toQueryString(rawQuery);return queryString?`?${queryString}`:""}contentFormatters={["application/json"]:input=>null!==input&&("object"==typeof input||"string"==typeof input)?JSON.stringify(input):input,["application/vnd.api+json"]:input=>null!==input&&("object"==typeof input||"string"==typeof input)?JSON.stringify(input):input,["text/plain"]:input=>null!==input&&"string"!=typeof input?JSON.stringify(input):input,["multipart/form-data"]:input=>{if(input instanceof FormData)return input;return Object.keys(input||{}).reduce((formData,key)=>{const property=input[key];formData.append(key,property instanceof Blob?property:"object"==typeof property&&null!==property?JSON.stringify(property):`${property}`);return formData},new FormData)},["application/x-www-form-urlencoded"]:input=>this.toQueryString(input)};mergeRequestParams(params1,params2){return{...this.baseApiParams,...params1,...params2||{},headers:{...this.baseApiParams.headers||{},...params1.headers||{},...params2&¶ms2.headers||{}}}}createAbortSignal=cancelToken=>{if(this.abortControllers.has(cancelToken)){const abortController=this.abortControllers.get(cancelToken);if(abortController)return abortController.signal;return}const abortController=new AbortController;this.abortControllers.set(cancelToken,abortController);return abortController.signal};abortRequest=cancelToken=>{const abortController=this.abortControllers.get(cancelToken);if(abortController){abortController.abort();this.abortControllers.delete(cancelToken)}};request=async({body,secure,path,type,query,format,baseUrl,cancelToken,...params})=>{const secureParams=("boolean"==typeof secure?secure:this.baseApiParams.secure)&&this.securityWorker&&await this.securityWorker(this.securityData)||{};const requestParams=this.mergeRequestParams(params,secureParams);const queryString=query&&this.toQueryString(query);const payloadFormatter=this.contentFormatters[type||"application/json"];const responseFormat=format||requestParams.format;return this.customFetch(`${baseUrl||this.baseUrl||""}${path}${queryString?`?${queryString}`:""}`,{...requestParams,headers:{...requestParams.headers||{},...type&&"multipart/form-data"!==type?{"Content-Type":type}:{}},signal:(cancelToken?this.createAbortSignal(cancelToken):requestParams.signal)||null,body:null==body?null:payloadFormatter(body)}).then(async response=>{const r=response;r.data=null;r.error=null;const data=responseFormat?await response[responseFormat]().then(data=>{if(r.ok)r.data=data;else r.error=data;return r}).catch(e=>{r.error=e;return r}):r;if(cancelToken)this.abortControllers.delete(cancelToken);if(!response.ok)throw data;return data})}}class IntegrationsApi{http;constructor(http){this.http=http}status=(params={})=>this.http.request({path:"/status",method:"GET",...params});connectors={getStatsConnectorsV1:({cid,...query},params={})=>this.http.request({path:`/v1/connectors/${cid}/stats`,method:"GET",format:"json",...params}),getConnectorsV1:({cid,...query},params={})=>this.http.request({path:`/v1/connectors/${cid}/ok`,method:"GET",format:"json",...params}),getIllConnectorsV1:({cid,...query},params={})=>this.http.request({path:`/v1/connectors/${cid}/ill`,method:"GET",format:"json",...params})}}const AppConfigCtx=/*#__PURE__*/(0,index_js_.createContext)(null);const AppConfigProvider=AppConfigCtx.Provider;function useAppConfig(){const config=(0,index_js_.useContext)(AppConfigCtx);if(!config)throw new Error("Called `useAppConfig` outside a `<AppConfigProvider />`");return config}function useApi(){const config=useAppConfig();const client=new HttpClient({baseUrl:config.api.replace(/\/$/,""),baseApiParams:{headers:{Authorization:config.token?`Bearer ${config.token}`:"",From:config.owner}}});return new IntegrationsApi(client)}function useStatsQuery(){const api=useApi();const query=(0,modern_index_js_.useQuery)({queryKey:["connectors","stats"],queryFn:async()=>await api.connectors.getStatsConnectorsV1().then(x=>x.data),refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true});return query}function useConnectorsListQuery(){const api=useApi();const config=useAppConfig();console.log(config);const query=(0,modern_index_js_.useQuery)({queryKey:["connectors","list"],queryFn:async()=>await api.connectors.getConnectorsV1({cid:config.company}).then(x=>x.data),refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true});return query}function ConnectorBubble({connector}){const{colorScheme}=(0,index_mjs_.useMantineColorScheme)();const bg="dark"===colorScheme?"white":"dark";const logoUrl=connector.main_connectorlist.logo_key?`https://img.logo.dev/${connector.main_connectorlist.logo_key}?token=pk_QvyqAb6uTRGJE2_sDsEb9g&retina=true`:`https://s3.eu-west-3.amazonaws.com/media.airporting/connectors/${connector.main_connectorlist.codename}.png`;return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Card,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Avatar,{src:logoUrl,size:64,radius:"md",bg:bg,color:"dark"===colorScheme?"black":"white",p:18}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{w:"fit-content",order:3,children:connector.name}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",size:"lg",lineClamp:3,children:connector.main_connectorlist.description_fr})]})})}function ListOkComponent(){const listResultRes=useConnectorsListQuery();const listResult=listResultRes.data;console.log(listResult);return/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{w:"fit-content",mb:0,order:2,children:"Tous vos connecteurs en marche"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SimpleGrid,{cols:{md:4,sm:2,xs:1},spacing:"md",style:{alignItems:"stretch"},children:listResult?.list?.map((connector,idx)=>connector?.main_connectorlist?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Card,{style:{height:"100%",display:"flex",flexDirection:"column",justifyContent:"space-between"},children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Anchor,{underline:"never",href:`/company/1/integrations/connectors/${connector.id}`,children:/*#__PURE__*/(0,jsx_runtime.jsx)(ConnectorBubble,{connector:connector})})},idx):/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Skeleton,{radius:"md",animate:true},idx))})]})}function ConnectorsApp(){const statsResultRes=useStatsQuery();const statsResult=statsResultRes.data;const[value,setValue]=(0,index_js_.useState)("active");return/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{py:16,children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:0,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{w:"fit-content",mb:0,order:1,children:"Nos connecteurs"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{w:"fit-content",mb:0,c:"dimmed",fz:"h5",children:"Synchronisez vos comptes bancaires et outils comptables facilement."})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{py:16,children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SegmentedControl,{value:value,onChange:setValue,radius:"md",size:"xl",data:[{label:`Connecteurs actifs${statsResult?.ok?` (${statsResult.ok})`:""}`,value:"active"},`Connecteurs \xe0 configurer${statsResult?.ill?` (${statsResult.ill})`:""}`,`Connecteurs en maintenance${statsResult?.maintenance?` (${statsResult.maintenance})`:""}`,"Tous les connecteurs"]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(ListOkComponent,{})]})}var dist_index_js_=__webpack_require__(7483);var esm_index_mjs_=__webpack_require__(3519);var notifications_esm_index_mjs_=__webpack_require__(225);var dist_esm_index_mjs_=__webpack_require__(3040);const theme=(0,index_mjs_.createTheme)((0,dist_esm_index_mjs_.assign)(dist_index_js_.theme,{components:{}}));const cssVarResolver=x=>(0,dist_esm_index_mjs_.assign)(dist_index_js_.cssVarResolver(x),{dark:{},light:{},variables:{}});function Providers(props){const{children,config,mantine,tanstack}=props;return/*#__PURE__*/(0,jsx_runtime.jsx)(AppConfigProvider,{value:config,children:/*#__PURE__*/(0,jsx_runtime.jsx)(modern_index_js_.QueryClientProvider,{client:tanstack?.queryClient??new modern_index_js_.QueryClient,children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.MantineProvider,{theme:theme,cssVariablesResolver:cssVarResolver,defaultColorScheme:mantine?.defaultColorScheme,forceColorScheme:mantine?.forceColorScheme,children:/*#__PURE__*/(0,jsx_runtime.jsxs)(esm_index_mjs_.ModalsProvider,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(notifications_esm_index_mjs_.Notifications,{}),children]})})})})}function Connectors(props){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_js_.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(Providers,{...props,children:/*#__PURE__*/(0,jsx_runtime.jsx)(ConnectorsApp,{})})})}}}]);
|