@airporting/integrations-app 0.4.9 → 0.4.11
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/api/connectors/connectorConfigQuery.d.ts +2 -1
- package/dist/mf/@mf-types/compiled-types/api/connectors/connectorSaveQuery.d.ts +1 -1
- package/dist/mf/@mf-types/compiled-types/gen/IntegrationsApi.d.ts +20 -6
- package/dist/mf/@mf-types/compiled-types/hooks/useAppConfigConnectorSingle.d.ts +1 -0
- package/dist/mf/@mf-types.zip +0 -0
- package/dist/mf/__federation_expose_connectors.js +1 -1
- package/dist/mf/__federation_expose_single_connector.js +1 -1
- package/dist/mf/index.js +2 -2
- package/dist/mf/integrations_app.js +2 -2
- package/dist/mf/mf-manifest.json +1 -1
- package/dist/mf/mf-stats.json +13 -13
- package/package.json +1 -1
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { ConnectorConfigResponse } from '@/src/gen/IntegrationsApi.ts';
|
|
2
|
+
export declare function useConnectorConfigQuery(): import("@tanstack/react-query").UseQueryResult<ConnectorConfigResponse, Error>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function useConnectorSaveQuery(): import("@tanstack/react-query").UseQueryResult<import("../../gen/IntegrationsApi").
|
|
1
|
+
export declare function useConnectorSaveQuery(): import("@tanstack/react-query").UseQueryResult<import("../../gen/IntegrationsApi").ConnectorConfigResponse, Error>;
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
export interface ConnectorConfigResponse {
|
|
2
|
+
initialData: object;
|
|
3
|
+
sections: FormSectionConfig[];
|
|
4
|
+
status: object;
|
|
5
|
+
}
|
|
1
6
|
export interface ConnectorItem {
|
|
2
7
|
id: number;
|
|
3
8
|
main_connectorlist: {
|
|
@@ -18,6 +23,9 @@ export interface ConnectorsStatsResponse {
|
|
|
18
23
|
maintenance: number;
|
|
19
24
|
ok: number;
|
|
20
25
|
}
|
|
26
|
+
export interface FormSectionConfig {
|
|
27
|
+
fields: object[];
|
|
28
|
+
}
|
|
21
29
|
export interface GetConnectorConfigV1Params {
|
|
22
30
|
cid: string;
|
|
23
31
|
connector: number;
|
|
@@ -37,6 +45,7 @@ export declare namespace Connectors {
|
|
|
37
45
|
* @tags Connectors
|
|
38
46
|
* @name GetStatsConnectorsV1
|
|
39
47
|
* @request GET:/v1/connectors/{cid}/stats
|
|
48
|
+
* @secure
|
|
40
49
|
* @response `200` `ConnectorsStatsResponse`
|
|
41
50
|
*/
|
|
42
51
|
namespace GetStatsConnectorsV1 {
|
|
@@ -53,6 +62,7 @@ export declare namespace Connectors {
|
|
|
53
62
|
* @tags Connectors
|
|
54
63
|
* @name GetConnectorsV1
|
|
55
64
|
* @request GET:/v1/connectors/{cid}/ok
|
|
65
|
+
* @secure
|
|
56
66
|
* @response `200` `ConnectorsListResponse`
|
|
57
67
|
*/
|
|
58
68
|
namespace GetConnectorsV1 {
|
|
@@ -69,6 +79,7 @@ export declare namespace Connectors {
|
|
|
69
79
|
* @tags Connectors
|
|
70
80
|
* @name GetIllConnectorsV1
|
|
71
81
|
* @request GET:/v1/connectors/{cid}/ill
|
|
82
|
+
* @secure
|
|
72
83
|
* @response `200` `ConnectorsListResponse`
|
|
73
84
|
*/
|
|
74
85
|
namespace GetIllConnectorsV1 {
|
|
@@ -85,7 +96,7 @@ export declare namespace Connectors {
|
|
|
85
96
|
* @tags Connectors
|
|
86
97
|
* @name GetConnectorConfigV1
|
|
87
98
|
* @request GET:/v1/connectors/{cid}/config/{connector}
|
|
88
|
-
* @response `200` `
|
|
99
|
+
* @response `200` `ConnectorConfigResponse`
|
|
89
100
|
*/
|
|
90
101
|
namespace GetConnectorConfigV1 {
|
|
91
102
|
type RequestParams = {
|
|
@@ -95,7 +106,7 @@ export declare namespace Connectors {
|
|
|
95
106
|
type RequestQuery = {};
|
|
96
107
|
type RequestBody = never;
|
|
97
108
|
type RequestHeaders = {};
|
|
98
|
-
type ResponseBody =
|
|
109
|
+
type ResponseBody = ConnectorConfigResponse;
|
|
99
110
|
}
|
|
100
111
|
}
|
|
101
112
|
export type QueryParamsType = Record<string | number, any>;
|
|
@@ -158,11 +169,11 @@ export declare class HttpClient<SecurityDataType = unknown> {
|
|
|
158
169
|
request: <T = any, E = any>({ body, secure, path, type, query, format, baseUrl, cancelToken, ...params }: FullRequestParams) => Promise<HttpResponse<T, E>>;
|
|
159
170
|
}
|
|
160
171
|
/**
|
|
161
|
-
* @title
|
|
172
|
+
* @title Integrations API
|
|
162
173
|
* @version 1.0
|
|
163
174
|
* @contact
|
|
164
175
|
*
|
|
165
|
-
*
|
|
176
|
+
* Handling connectors
|
|
166
177
|
*/
|
|
167
178
|
export declare class IntegrationsApi<SecurityDataType extends unknown> {
|
|
168
179
|
http: HttpClient<SecurityDataType>;
|
|
@@ -183,6 +194,7 @@ export declare class IntegrationsApi<SecurityDataType extends unknown> {
|
|
|
183
194
|
* @tags Connectors
|
|
184
195
|
* @name GetStatsConnectorsV1
|
|
185
196
|
* @request GET:/v1/connectors/{cid}/stats
|
|
197
|
+
* @secure
|
|
186
198
|
* @response `200` `ConnectorsStatsResponse`
|
|
187
199
|
*/
|
|
188
200
|
getStatsConnectorsV1: ({ cid, ...query }: GetStatsConnectorsV1Params, params?: RequestParams) => Promise<HttpResponse<ConnectorsStatsResponse, any>>;
|
|
@@ -192,6 +204,7 @@ export declare class IntegrationsApi<SecurityDataType extends unknown> {
|
|
|
192
204
|
* @tags Connectors
|
|
193
205
|
* @name GetConnectorsV1
|
|
194
206
|
* @request GET:/v1/connectors/{cid}/ok
|
|
207
|
+
* @secure
|
|
195
208
|
* @response `200` `ConnectorsListResponse`
|
|
196
209
|
*/
|
|
197
210
|
getConnectorsV1: ({ cid, ...query }: GetConnectorsV1Params, params?: RequestParams) => Promise<HttpResponse<ConnectorsListResponse, any>>;
|
|
@@ -201,6 +214,7 @@ export declare class IntegrationsApi<SecurityDataType extends unknown> {
|
|
|
201
214
|
* @tags Connectors
|
|
202
215
|
* @name GetIllConnectorsV1
|
|
203
216
|
* @request GET:/v1/connectors/{cid}/ill
|
|
217
|
+
* @secure
|
|
204
218
|
* @response `200` `ConnectorsListResponse`
|
|
205
219
|
*/
|
|
206
220
|
getIllConnectorsV1: ({ cid, ...query }: GetIllConnectorsV1Params, params?: RequestParams) => Promise<HttpResponse<ConnectorsListResponse, any>>;
|
|
@@ -210,9 +224,9 @@ export declare class IntegrationsApi<SecurityDataType extends unknown> {
|
|
|
210
224
|
* @tags Connectors
|
|
211
225
|
* @name GetConnectorConfigV1
|
|
212
226
|
* @request GET:/v1/connectors/{cid}/config/{connector}
|
|
213
|
-
* @response `200` `
|
|
227
|
+
* @response `200` `ConnectorConfigResponse`
|
|
214
228
|
*/
|
|
215
|
-
getConnectorConfigV1: ({ connector, cid, ...query }: GetConnectorConfigV1Params, params?: RequestParams) => Promise<HttpResponse<
|
|
229
|
+
getConnectorConfigV1: ({ connector, cid, ...query }: GetConnectorConfigV1Params, params?: RequestParams) => Promise<HttpResponse<ConnectorConfigResponse, any>>;
|
|
216
230
|
};
|
|
217
231
|
}
|
|
218
232
|
export {};
|
|
@@ -5,6 +5,7 @@ export type AppConfigConnectorSingle = {
|
|
|
5
5
|
token: string;
|
|
6
6
|
api: string;
|
|
7
7
|
colorScheme: string;
|
|
8
|
+
connectorCategory?: string;
|
|
8
9
|
};
|
|
9
10
|
export declare const AppConfigConnectorSingleProvider: import("react").Provider<AppConfigConnectorSingle | null>;
|
|
10
11
|
export declare function useAppConfigConnectorSingle(): AppConfigConnectorSingle;
|
package/dist/mf/@mf-types.zip
CHANGED
|
Binary file
|
|
@@ -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},4848:function(module,__unused_webpack_exports,__webpack_require__){module.exports=__webpack_require__(9698)},314: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__(4848);var index_js_=__webpack_require__(3620);var index_mjs_=__webpack_require__(9389);var modern_index_js_=__webpack_require__(6022);var IntegrationsApi=__webpack_require__(6699);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 IntegrationsApi.Qq({baseUrl:config.api.replace(/\/$/,""),baseApiParams:{headers:{Authorization:config.token?`Bearer ${config.token}`:"",From:config.owner}}});return new IntegrationsApi.qx(client)}function useStatsQuery(){const api=useApi();const config=useAppConfig();const query=(0,modern_index_js_.useQuery)({queryKey:["connectors","stats",config.company],queryFn:async()=>await api.connectors.getStatsConnectorsV1({cid:config.company}).then(x=>x.data),refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true});return query}function useConnectorsListQuery(){const api=useApi();const config=useAppConfig();const query=(0,modern_index_js_.useQuery)({queryKey:["connectors","list",config.company],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 config=useAppConfig();const listResultRes=useConnectorsListQuery();const listResult=listResultRes.data;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/${config.company}/integrations/${connector.id}/connector`,children:/*#__PURE__*/(0,jsx_runtime.jsx)(ConnectorBubble,{connector:connector})})},idx):/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Skeleton,{radius:"md",animate:true},idx))})]})}function useConnectorsIllListQuery(){const api=useApi();const config=useAppConfig();const query=(0,modern_index_js_.useQuery)({queryKey:["connectors","list","ill",config.company],queryFn:async()=>await api.connectors.getIllConnectorsV1({cid:config.company}).then(x=>x.data),refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true});return query}function ListIllComponent(){const config=useAppConfig();const listResultRes=useConnectorsIllListQuery();const listResult=listResultRes.data;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 \xe0 configurer"}),/*#__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/${config.company}/integrations/${connector.id}/connector`,children:/*#__PURE__*/(0,jsx_runtime.jsx)(ConnectorBubble,{connector:connector})})},idx):/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Skeleton,{radius:"md",animate:true},idx))})]})}var dist_index_js_=__webpack_require__(3515);function ConnectorsApp(){const tab=(0,dist_index_js_.useRxState)(new URL(location.href).searchParams.get("tab")??"active");const statsResultRes=useStatsQuery();const statsResult=statsResultRes.data;const[tabValue,setTabValue]=(0,index_js_.useState)(tab.value??"active");(0,index_js_.useEffect)(()=>{tab.dispatch(tabValue)},[tabValue]);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:tabValue,onChange:setTabValue,radius:"md",size:"xl",data:[{label:`Connecteurs actifs(${statsResult?.ok?statsResult.ok:0})`,value:"active"},{label:`Connecteurs \xe0 configurer (${statsResult?.ill?statsResult.ill:0})`,value:"ill"},{label:`Connecteurs en maintenance (${statsResult?.maintenance?statsResult.maintenance:0})`,value:"maintenance"},{label:"Tous les connecteurs",value:"all"}]})}),"active"===tabValue&&/*#__PURE__*/(0,jsx_runtime.jsx)(ListOkComponent,{}),"ill"===tabValue&&/*#__PURE__*/(0,jsx_runtime.jsx)(ListIllComponent,{}),"maintenance"===tabValue&&/*#__PURE__*/(0,jsx_runtime.jsx)("p",{children:"page under progress"}),"all"===tabValue&&/*#__PURE__*/(0,jsx_runtime.jsx)("p",{children:"page under progress"})]})}var esm_index_mjs_=__webpack_require__(6815);var notifications_esm_index_mjs_=__webpack_require__(5311);var dist_esm_index_mjs_=__webpack_require__(2425);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,{})})})}},6699:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{Qq:()=>HttpClient,qx:()=>IntegrationsApi});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}),getConnectorConfigV1:({connector,cid,...query},params={})=>this.http.request({path:`/v1/connectors/${cid}/config/${connector}`,method:"GET",format:"json",...params})}}}}]);
|
|
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},4848:function(module,__unused_webpack_exports,__webpack_require__){module.exports=__webpack_require__(9698)},314: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__(4848);var index_js_=__webpack_require__(3620);var index_mjs_=__webpack_require__(9389);var modern_index_js_=__webpack_require__(6022);var IntegrationsApi=__webpack_require__(6699);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 IntegrationsApi.Qq({baseUrl:config.api.replace(/\/$/,""),baseApiParams:{headers:{Authorization:config.token?`Bearer ${config.token}`:"",From:config.owner}}});return new IntegrationsApi.qx(client)}function useStatsQuery(){const api=useApi();const config=useAppConfig();const query=(0,modern_index_js_.useQuery)({queryKey:["connectors","stats",config.company],queryFn:async()=>await api.connectors.getStatsConnectorsV1({cid:config.company}).then(x=>x.data),refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true});return query}function useConnectorsListQuery(){const api=useApi();const config=useAppConfig();const query=(0,modern_index_js_.useQuery)({queryKey:["connectors","list",config.company],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 config=useAppConfig();const listResultRes=useConnectorsListQuery();const listResult=listResultRes.data;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/${config.company}/integrations/${connector.id}/connector`,children:/*#__PURE__*/(0,jsx_runtime.jsx)(ConnectorBubble,{connector:connector})})},idx):/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Skeleton,{radius:"md",animate:true},idx))})]})}function useConnectorsIllListQuery(){const api=useApi();const config=useAppConfig();const query=(0,modern_index_js_.useQuery)({queryKey:["connectors","list","ill",config.company],queryFn:async()=>await api.connectors.getIllConnectorsV1({cid:config.company}).then(x=>x.data),refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true});return query}function ListIllComponent(){const config=useAppConfig();const listResultRes=useConnectorsIllListQuery();const listResult=listResultRes.data;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 \xe0 configurer"}),/*#__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/${config.company}/integrations/${connector.id}/connector`,children:/*#__PURE__*/(0,jsx_runtime.jsx)(ConnectorBubble,{connector:connector})})},idx):/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Skeleton,{radius:"md",animate:true},idx))})]})}var dist_index_js_=__webpack_require__(3515);function ConnectorsApp(){const tab=(0,dist_index_js_.useRxState)(new URL(location.href).searchParams.get("tab")??"active");const statsResultRes=useStatsQuery();const statsResult=statsResultRes.data;const[tabValue,setTabValue]=(0,index_js_.useState)(tab.value??"active");(0,index_js_.useEffect)(()=>{tab.dispatch(tabValue)},[tabValue]);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:tabValue,onChange:setTabValue,radius:"md",size:"xl",data:[{label:`Connecteurs actifs(${statsResult?.ok?statsResult.ok:0})`,value:"active"},{label:`Connecteurs \xe0 configurer (${statsResult?.ill?statsResult.ill:0})`,value:"ill"},{label:`Connecteurs en maintenance (${statsResult?.maintenance?statsResult.maintenance:0})`,value:"maintenance"},{label:"Tous les connecteurs",value:"all"}]})}),"active"===tabValue&&/*#__PURE__*/(0,jsx_runtime.jsx)(ListOkComponent,{}),"ill"===tabValue&&/*#__PURE__*/(0,jsx_runtime.jsx)(ListIllComponent,{}),"maintenance"===tabValue&&/*#__PURE__*/(0,jsx_runtime.jsx)("p",{children:"page under progress"}),"all"===tabValue&&/*#__PURE__*/(0,jsx_runtime.jsx)("p",{children:"page under progress"})]})}var esm_index_mjs_=__webpack_require__(6815);var notifications_esm_index_mjs_=__webpack_require__(5311);var dist_esm_index_mjs_=__webpack_require__(2425);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,{})})})}},6699:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{Qq:()=>HttpClient,qx:()=>IntegrationsApi});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 responseToParse=responseFormat?response.clone():response;const data=responseFormat?await responseToParse[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",secure:true,format:"json",...params}),getConnectorsV1:({cid,...query},params={})=>this.http.request({path:`/v1/connectors/${cid}/ok`,method:"GET",secure:true,format:"json",...params}),getIllConnectorsV1:({cid,...query},params={})=>this.http.request({path:`/v1/connectors/${cid}/ill`,method:"GET",secure:true,format:"json",...params}),getConnectorConfigV1:({connector,cid,...query},params={})=>this.http.request({path:`/v1/connectors/${cid}/config/${connector}`,method:"GET",format:"json",...params})}}}}]);
|
|
@@ -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},4848:function(module,__unused_webpack_exports,__webpack_require__){module.exports=__webpack_require__(9698)},2079:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>SingleConnector});var jsx_runtime=__webpack_require__(4848);var index_js_=__webpack_require__(3620);var index_mjs_=__webpack_require__(9389);var dist_index_js_=__webpack_require__(3515);var modern_index_js_=__webpack_require__(6022);const AppConfigCtx=/*#__PURE__*/(0,index_js_.createContext)(null);const AppConfigConnectorSingleProvider=AppConfigCtx.Provider;function useAppConfigConnectorSingle(){const config=(0,index_js_.useContext)(AppConfigCtx);if(!config)throw new Error("Called `useAppConfig` outside a `<AppConfigConnectorSingleProvider />`");return config}var IntegrationsApi=__webpack_require__(6699);function useApiConnectorSingle(){const config=useAppConfigConnectorSingle();const client=new IntegrationsApi.Qq({baseUrl:config.api.replace(/\/$/,""),baseApiParams:{headers:{Authorization:config.token?`Bearer ${config.token}`:"",From:config.owner}}});return new IntegrationsApi.qx(client)}function useConnectorConfigQuery(){const api=useApiConnectorSingle();const config=useAppConfigConnectorSingle();const query=(0,modern_index_js_.useQuery)({queryKey:["connector","config","form",config.company,config.connector],queryFn:async()=>await api.connectors.getConnectorConfigV1({cid:config.company,connector:+config.connector}).then(x=>x.data),refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true});return query}function useConnectorSaveQuery(){const api=useApiConnectorSingle();const config=useAppConfigConnectorSingle();const query=(0,modern_index_js_.useQuery)({queryKey:["connector","save","form",config.company,config.connector],queryFn:async()=>await api.connectors.getConnectorConfigV1({cid:config.company,connector:+config.connector}).then(x=>x.data),refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true});return query}function SingleConnectorApp(){const config=useAppConfigConnectorSingle();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_.Anchor,{underline:"never",href:`/company/${config.company}/integrations/connectors`,children:/*#__PURE__*/(0,jsx_runtime.jsxs)(dist_index_js_.Circle,{bg:"dark.4",size:24,ml:"auto",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.IconArrowUp,{rotate:270})," Liste des connecteurs"]})})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{py:16,children:/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.DynamicForm,{config:useConnectorConfigQuery,save:useConnectorSaveQuery})})]})}var esm_index_mjs_=__webpack_require__(6815);var notifications_esm_index_mjs_=__webpack_require__(5311);var dist_esm_index_mjs_=__webpack_require__(2425);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 ProvidersSingleConnector(props){const{children,config,mantine,tanstack}=props;return/*#__PURE__*/(0,jsx_runtime.jsx)(AppConfigConnectorSingleProvider,{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 SingleConnector(props){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_js_.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(ProvidersSingleConnector,{...props,children:/*#__PURE__*/(0,jsx_runtime.jsx)(SingleConnectorApp,{})})})}},6699:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{Qq:()=>HttpClient,qx:()=>IntegrationsApi});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}),getConnectorConfigV1:({connector,cid,...query},params={})=>this.http.request({path:`/v1/connectors/${cid}/config/${connector}`,method:"GET",format:"json",...params})}}}}]);
|
|
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},4848:function(module,__unused_webpack_exports,__webpack_require__){module.exports=__webpack_require__(9698)},2079:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>SingleConnector});var jsx_runtime=__webpack_require__(4848);var index_js_=__webpack_require__(3620);var index_mjs_=__webpack_require__(9389);var dist_index_js_=__webpack_require__(3515);var modern_index_js_=__webpack_require__(6022);const AppConfigCtx=/*#__PURE__*/(0,index_js_.createContext)(null);const AppConfigConnectorSingleProvider=AppConfigCtx.Provider;function useAppConfigConnectorSingle(){const config=(0,index_js_.useContext)(AppConfigCtx);if(!config)throw new Error("Called `useAppConfig` outside a `<AppConfigConnectorSingleProvider />`");return config}var IntegrationsApi=__webpack_require__(6699);function useApiConnectorSingle(){const config=useAppConfigConnectorSingle();const client=new IntegrationsApi.Qq({baseUrl:config.api.replace(/\/$/,""),baseApiParams:{headers:{Authorization:config.token?`Bearer ${config.token}`:"",From:config.owner}}});return new IntegrationsApi.qx(client)}function useConnectorConfigQuery(){const api=useApiConnectorSingle();const config=useAppConfigConnectorSingle();const query=(0,modern_index_js_.useQuery)({queryKey:["connector","config","form",config.company,config.connector],queryFn:async()=>await api.connectors.getConnectorConfigV1({cid:config.company,connector:+config.connector}).then(x=>x.data),refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true});console.log("query.data",query.data);if(query.data?.status){console.log("query.data?.status",query.data?.status);config.connectorCategory=query.data?.status}return query}function useConnectorSaveQuery(){const api=useApiConnectorSingle();const config=useAppConfigConnectorSingle();const query=(0,modern_index_js_.useQuery)({queryKey:["connector","save","form",config.company,config.connector],queryFn:async()=>await api.connectors.getConnectorConfigV1({cid:config.company,connector:+config.connector}).then(x=>x.data),refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true});return query}function SingleConnectorApp(){const config=useAppConfigConnectorSingle();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:10,children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Anchor,{underline:"never",href:`/company/${config.company}/integrations/connectors`,children:/*#__PURE__*/(0,jsx_runtime.jsxs)(dist_index_js_.Circle,{bg:"dark.4",size:24,ml:"auto",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.IconArrowUp,{rotate:270})," Liste des connecteurs"]})})})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{py:16,children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Grid,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:12,lg:3},children:"logo"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Grid.Col,{span:{base:12,lg:9},children:["-",config.connectorCategory,"-",/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.DynamicForm,{config:useConnectorConfigQuery,save:useConnectorSaveQuery})]})]})})]})}var esm_index_mjs_=__webpack_require__(6815);var notifications_esm_index_mjs_=__webpack_require__(5311);var dist_esm_index_mjs_=__webpack_require__(2425);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 ProvidersSingleConnector(props){const{children,config,mantine,tanstack}=props;return/*#__PURE__*/(0,jsx_runtime.jsx)(AppConfigConnectorSingleProvider,{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 SingleConnector(props){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_js_.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(ProvidersSingleConnector,{...props,children:/*#__PURE__*/(0,jsx_runtime.jsx)(SingleConnectorApp,{})})})}},6699:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{Qq:()=>HttpClient,qx:()=>IntegrationsApi});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 responseToParse=responseFormat?response.clone():response;const data=responseFormat?await responseToParse[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",secure:true,format:"json",...params}),getConnectorsV1:({cid,...query},params={})=>this.http.request({path:`/v1/connectors/${cid}/ok`,method:"GET",secure:true,format:"json",...params}),getIllConnectorsV1:({cid,...query},params={})=>this.http.request({path:`/v1/connectors/${cid}/ill`,method:"GET",secure:true,format:"json",...params}),getConnectorConfigV1:({connector,cid,...query},params={})=>this.http.request({path:`/v1/connectors/${cid}/config/${connector}`,method:"GET",format:"json",...params})}}}}]);
|