@apia/api 0.0.9-alpha.0 → 0.1.1
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/cleanDist.json +3 -0
- package/dist/index.d.ts +84 -68
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -43
- package/dist/index.js.map +1 -0
- package/package.json +22 -12
package/cleanDist.json
ADDED
package/dist/index.d.ts
CHANGED
|
@@ -1,68 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as theme_ui_jsx_runtime from 'theme-ui/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
2
3
|
import { AxiosResponse, AxiosRequestConfig } from 'axios';
|
|
4
|
+
import { TModify, TApiaLoad } from '@apia/util';
|
|
5
|
+
import { TNotificationMessage, notify } from '@apia/notifications';
|
|
3
6
|
import QueryString from 'qs';
|
|
4
|
-
import * as React from 'react';
|
|
5
|
-
import { notify } from '@apia/notifications';
|
|
6
|
-
|
|
7
|
-
type TApiaApiMethodHandler = {
|
|
8
|
-
alert: typeof notify;
|
|
9
|
-
close: () => void;
|
|
10
|
-
configuration?: THandleConfiguration;
|
|
11
|
-
formDefinition: TApiaLoad;
|
|
12
|
-
reset: () => void;
|
|
13
|
-
setError: typeof notify;
|
|
14
|
-
setMessage: (message: Record<string, unknown>) => unknown;
|
|
15
|
-
setState: React.Dispatch<React.SetStateAction<IApiaApiHandlerState>>;
|
|
16
|
-
state: IApiaApiHandlerState;
|
|
17
|
-
setValue: (name: string, value: string) => void;
|
|
18
|
-
};
|
|
19
|
-
interface IModalConfig {
|
|
20
|
-
modalTitle?: string;
|
|
21
|
-
onClose?: () => void;
|
|
22
|
-
onMessage?: (message: Record<string, unknown>) => unknown;
|
|
23
|
-
onMessageClose?: () => unknown;
|
|
24
|
-
onSubmitted?: (handler: TApiaApiMethodHandler, response: AxiosResponse<Record<string, unknown> | null> | null) => unknown;
|
|
25
|
-
}
|
|
26
|
-
type THandleConfiguration = Partial<Pick<IApiaApiRequestConfig<unknown>, 'modalConfiguration' | 'methodsPath'>>;
|
|
27
|
-
interface IApiaApiHandlerState {
|
|
28
|
-
disabled: boolean;
|
|
29
|
-
isLoading: boolean;
|
|
30
|
-
isMultipart: boolean;
|
|
31
|
-
progress: number;
|
|
32
|
-
errors: Record<string, string>;
|
|
33
|
-
windowIndex: number;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
interface TColors {
|
|
37
|
-
exception?: string;
|
|
38
|
-
alert?: string;
|
|
39
|
-
message?: string;
|
|
40
|
-
}
|
|
41
|
-
interface IApiaApiConsoleConfig {
|
|
42
|
-
colors?: TColors;
|
|
43
|
-
debug?: boolean;
|
|
44
|
-
}
|
|
45
|
-
interface IApiaApiRequestConfig<DataType> extends IApiaApiConsoleConfig {
|
|
46
|
-
axiosConfig?: AxiosRequestConfig;
|
|
47
|
-
modalConfiguration?: IModalConfig;
|
|
48
|
-
handleLoad?: boolean;
|
|
49
|
-
/**
|
|
50
|
-
* Algunas veces las funciones llamadas por una acción en el servidor
|
|
51
|
-
* tienen el mismo nombre siendo en realidad funciones distintas. Para
|
|
52
|
-
* corregir este problema es posible pasar un path relativo al directorio
|
|
53
|
-
* apiaApi/methods
|
|
54
|
-
*/
|
|
55
|
-
methodsPath?: string;
|
|
56
|
-
notificationsCategory?: string;
|
|
57
|
-
queryData?: string | Record<string, unknown>;
|
|
58
|
-
stringifyOptions?: QueryString.IStringifyOptions;
|
|
59
|
-
validateResponse?: (response: AxiosResponse<DataType | null>) => Promise<boolean | string> | boolean | string;
|
|
60
|
-
}
|
|
61
|
-
declare global {
|
|
62
|
-
interface Window {
|
|
63
|
-
[key: string]: string;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
7
|
|
|
67
8
|
declare function getConfig<LoadType>(outerBehaveConfig?: IApiaApiRequestConfig<LoadType>): IApiaApiRequestConfig<unknown> & IApiaApiRequestConfig<LoadType> & Partial<IApiaApiRequestConfig<unknown>>;
|
|
68
9
|
type TApiaApiAxiosResponse<LoadType> = AxiosResponse<LoadType | null> & {
|
|
@@ -123,11 +64,11 @@ declare function post<LoadType extends Record<string, unknown> = Record<string,
|
|
|
123
64
|
}>, config?: TModify<IApiaApiRequestConfig<LoadType>, {
|
|
124
65
|
postData?: DataType;
|
|
125
66
|
postDataTreatement?: 'stringify';
|
|
126
|
-
}>):
|
|
67
|
+
}>): TApiaApiResult<LoadType>;
|
|
127
68
|
declare function post<LoadType extends Record<string, unknown> = Record<string, unknown>, DataType = unknown>(config: TModify<IApiaApiRequestConfig<LoadType>, {
|
|
128
69
|
postData?: DataType;
|
|
129
70
|
postDataTreatement?: 'stringify';
|
|
130
|
-
}>):
|
|
71
|
+
}>): TApiaApiResult<LoadType>;
|
|
131
72
|
/**
|
|
132
73
|
* IMPORTANTE!! El ApiaApi está programado bajo la consigna de que
|
|
133
74
|
* **no debe tirar núnca una excepción**. **Los errores** provenientes
|
|
@@ -172,8 +113,8 @@ declare function post<LoadType extends Record<string, unknown> = Record<string,
|
|
|
172
113
|
}
|
|
173
114
|
* @returns El tipo del valor devuelto depende del tipo pasado al llamar a la función. Si hubo un error devuelve null
|
|
174
115
|
*/
|
|
175
|
-
declare function get<LoadType extends Record<string, unknown> = Record<string, unknown>>(url: string | IApiaApiRequestConfig<LoadType>, config?: IApiaApiRequestConfig<LoadType>):
|
|
176
|
-
declare function get<LoadType extends Record<string, unknown> = Record<string, unknown>>(config: IApiaApiRequestConfig<LoadType>):
|
|
116
|
+
declare function get<LoadType extends Record<string, unknown> = Record<string, unknown>>(url: string | IApiaApiRequestConfig<LoadType>, config?: IApiaApiRequestConfig<LoadType>): TApiaApiResult<LoadType>;
|
|
117
|
+
declare function get<LoadType extends Record<string, unknown> = Record<string, unknown>>(config: IApiaApiRequestConfig<LoadType>): TApiaApiResult<LoadType>;
|
|
177
118
|
declare const ApiaApi: {
|
|
178
119
|
get: typeof get;
|
|
179
120
|
getConfig: typeof getConfig;
|
|
@@ -206,4 +147,79 @@ declare function makeApiaUrl(props?: {
|
|
|
206
147
|
[key: string]: unknown;
|
|
207
148
|
}): string;
|
|
208
149
|
|
|
209
|
-
|
|
150
|
+
interface TColors {
|
|
151
|
+
exception?: string;
|
|
152
|
+
alert?: string;
|
|
153
|
+
message?: string;
|
|
154
|
+
}
|
|
155
|
+
type TApiaApiResult<LoadType> = Promise<TApiaApiAxiosResponse<(LoadType & TNotificationMessage) | null> | null>;
|
|
156
|
+
interface IApiaApiConsoleConfig {
|
|
157
|
+
colors?: TColors;
|
|
158
|
+
debug?: boolean;
|
|
159
|
+
}
|
|
160
|
+
interface IApiaApiRequestConfig<DataType> extends IApiaApiConsoleConfig {
|
|
161
|
+
axiosConfig?: AxiosRequestConfig;
|
|
162
|
+
modalConfiguration?: IModalConfig;
|
|
163
|
+
handleLoad?: boolean;
|
|
164
|
+
/**
|
|
165
|
+
* Algunas veces las funciones llamadas por una acción en el servidor
|
|
166
|
+
* tienen el mismo nombre siendo en realidad funciones distintas. Para
|
|
167
|
+
* corregir este problema es posible pasar un path relativo al directorio
|
|
168
|
+
* apiaApi/methods
|
|
169
|
+
*/
|
|
170
|
+
methodsPath?: string;
|
|
171
|
+
notificationsCategory?: string;
|
|
172
|
+
queryData?: string | Record<string, unknown>;
|
|
173
|
+
stringifyOptions?: QueryString.IStringifyOptions;
|
|
174
|
+
validateResponse?: (response: AxiosResponse<DataType | null>) => Promise<boolean | string> | boolean | string;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
type TMethod = {
|
|
178
|
+
name: string;
|
|
179
|
+
props: {
|
|
180
|
+
attributes?: Record<string, unknown>;
|
|
181
|
+
currentUrl?: string;
|
|
182
|
+
funCall?: string;
|
|
183
|
+
inlineArguments?: string[];
|
|
184
|
+
messages?: unknown;
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
type TApiaApiMethodHandler = {
|
|
188
|
+
alert: typeof notify;
|
|
189
|
+
close: () => void;
|
|
190
|
+
configuration?: THandleConfiguration;
|
|
191
|
+
formDefinition: TApiaLoad;
|
|
192
|
+
reset: () => void;
|
|
193
|
+
setError: typeof notify;
|
|
194
|
+
setMessage: (message: Record<string, unknown>) => unknown;
|
|
195
|
+
setState: React.Dispatch<React.SetStateAction<IApiaApiHandlerState>>;
|
|
196
|
+
state: IApiaApiHandlerState;
|
|
197
|
+
setValue: (name: string, value: string) => void;
|
|
198
|
+
};
|
|
199
|
+
type TApiaApiMethod = (handler: TApiaApiMethodHandler, props: TMethod['props']) => Promise<void> | void;
|
|
200
|
+
interface IModalConfig {
|
|
201
|
+
modalTitle?: string;
|
|
202
|
+
onClose?: () => void;
|
|
203
|
+
onMessage?: (message: Record<string, unknown>) => unknown;
|
|
204
|
+
onMessageClose?: () => unknown;
|
|
205
|
+
onSubmitted?: (handler: TApiaApiMethodHandler, response: AxiosResponse<Record<string, unknown> | null> | null) => unknown;
|
|
206
|
+
}
|
|
207
|
+
type THandleConfiguration = Partial<Pick<IApiaApiRequestConfig<unknown>, 'modalConfiguration' | 'methodsPath'>>;
|
|
208
|
+
interface IApiaApiHandlerState {
|
|
209
|
+
disabled: boolean;
|
|
210
|
+
isLoading: boolean;
|
|
211
|
+
isMultipart: boolean;
|
|
212
|
+
progress: number;
|
|
213
|
+
errors: Record<string, string>;
|
|
214
|
+
windowIndex: number;
|
|
215
|
+
}
|
|
216
|
+
declare const ApiaApiHandler: React.MemoExoticComponent<() => theme_ui_jsx_runtime.JSX.Element>;
|
|
217
|
+
|
|
218
|
+
declare global {
|
|
219
|
+
interface Window {
|
|
220
|
+
[key: string]: string;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export { ApiaApi, ApiaApiHandler, TApiaApiMethod, TApiaApiResult, makeApiaUrl };
|
|
225
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/index.js
CHANGED
|
@@ -1,43 +1,2 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var ce = require('axios');
|
|
4
|
-
var lodash = require('lodash');
|
|
5
|
-
var J = require('qs');
|
|
6
|
-
var session = require('@apia/session');
|
|
7
|
-
var util = require('@apia/util');
|
|
8
|
-
var notifications = require('@apia/notifications');
|
|
9
|
-
var p = require('react');
|
|
10
|
-
var themeUi = require('theme-ui');
|
|
11
|
-
var validations = require('@apia/validations');
|
|
12
|
-
var components = require('@apia/components');
|
|
13
|
-
var theme = require('@apia/theme');
|
|
14
|
-
var jsxRuntime = require('theme-ui/jsx-runtime');
|
|
15
|
-
|
|
16
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
-
|
|
18
|
-
function _interopNamespace(e) {
|
|
19
|
-
if (e && e.__esModule) return e;
|
|
20
|
-
var n = Object.create(null);
|
|
21
|
-
if (e) {
|
|
22
|
-
Object.keys(e).forEach(function (k) {
|
|
23
|
-
if (k !== 'default') {
|
|
24
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
25
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
get: function () { return e[k]; }
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
n.default = e;
|
|
33
|
-
return Object.freeze(n);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
var ce__default = /*#__PURE__*/_interopDefault(ce);
|
|
37
|
-
var J__default = /*#__PURE__*/_interopDefault(J);
|
|
38
|
-
var p__namespace = /*#__PURE__*/_interopNamespace(p);
|
|
39
|
-
|
|
40
|
-
var Ae=Object.defineProperty,ye=Object.defineProperties;var Te=Object.getOwnPropertyDescriptors;var P=Object.getOwnPropertySymbols;var G=Object.prototype.hasOwnProperty,Y=Object.prototype.propertyIsEnumerable;var j=(e,t,n)=>t in e?Ae(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,d=(e,t)=>{for(var n in t||(t={}))G.call(t,n)&&j(e,n,t[n]);if(P)for(var n of P(t))Y.call(t,n)&&j(e,n,t[n]);return e},T=(e,t)=>ye(e,Te(t));var q=(e,t)=>{var n={};for(var o in e)G.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&P)for(var o of P(e))t.indexOf(o)<0&&Y.call(e,o)&&(n[o]=e[o]);return n};var k=(e,t,n)=>new Promise((o,a)=>{var l=c=>{try{i(n.next(c));}catch(f){a(f);}},s=c=>{try{i(n.throw(c));}catch(f){a(f);}},i=c=>c.done?o(c.value):Promise.resolve(c.value).then(l,s);i((n=n.apply(e,t)).next());});var we=p.createContext("apiaApi"),xe=({children:e,id:t})=>(jsxRuntime.jsx(we.Provider,{value:t,children:e})),ee=p__namespace.memo(xe);var V=new class extends util.EventEmitter{},W=new class extends util.EventEmitter{},O="ApiaApiForm",ne={};function ie(e,t){return k(this,null,function*(){return new Promise(n=>{var o,a,l;try{let s=/^\/?([\w\d_-]+)\/?(?:\(([^)]*)\))?$/,i=e.match(s);if(i){let c=i[1],f=i[2],A=[...(l=(a=(o=t.configuration)==null?void 0:o.methodsPath)==null?void 0:a.split("/").filter(g=>!!g))!=null?l:[],c].join("/"),R=g=>{typeof g.default!="function"&&m();let h=g.default;ne[c]=w=>{var L;return h(t,T(d({},w),{inlineArguments:(L=f==null?void 0:f.split(",").map(r=>r.startsWith("'")||r.startsWith('"')?r.slice(1,r.length-1):r))!=null?L:[]}))},n(ne[c]);},m=()=>{throw new Error(`${c}.ts not found at ${A}.ts nor ./${c}.ts`)};import(`/api/methods/${A}.ts`).then(R).catch(()=>{var g;((g=t.configuration)==null?void 0:g.methodsPath)!==void 0?import(`/api/methods/${c}.ts`).then(R).catch(m):m();});}}catch(s){console.error(s),t.reset(),t.setError({type:"danger",message:"Error while loading current method."});}})})}function He(e){return typeof e.canClose=="boolean"&&typeof e.type=="string"&&!!e.form}function Pe(e){return typeof e.canClose=="boolean"&&typeof e.type=="string"&&!!e.function}function Ue(e){return !!(typeof e.canClose=="boolean"&&typeof e.type=="string"&&typeof e.text=="object"&&e.text&&typeof e.text.label=="string")}var z=new util.WithEventsValue;function Ne(){let[,e,t]=util.useStateRef(void 0),n=p__namespace.useCallback(o=>{e(o);},[e]);return util.useMount(()=>{z.on("update",n);}),util.useUnmount(()=>z.off("update",n)),t}var _=new class extends util.EventEmitter{emit(t,n){super.emit(t,n);}};function ae(e,t,n){return z.value=n,He(e)?(_.emit("form",e),!0):Pe(e)?(W.emit("method",{name:e.function.name,props:{messages:e.function.messages,attributes:e.function,currentUrl:t}}),!0):Ue(e)?(V.emit("message",{predicate:e.text.label,title:e.text.title}),!0):!1}var U={disabled:!1,isLoading:!1,isMultipart:!1,progress:0,errors:{}},Fe=()=>{var h,w,L;let e=Ne(),[t,n]=p__namespace.useState(T(d({},U),{windowIndex:-1})),[o,a]=p__namespace.useState(void 0);p__namespace.useEffect(()=>_.on("form",a),[]);let l=p__namespace.useCallback((r,u)=>validations.validationsStore.setFieldValue(O,r,u),[]);p__namespace.useEffect(()=>{var C,M,b;if(!o)return;let r=util.arrayOrArray((b=(M=(C=o==null?void 0:o.form)==null?void 0:C.elements)==null?void 0:M.element)!=null?b:[]),u=!1,x=Object.values(r),y=0;for(;y<x.length&&!u;)x[y++].type==="file"&&(u=!0);n(H=>T(d(d({},H),U),{isMultipart:u}));},[o]);let g=components.useModal(),{show:s,onClose:i}=g,c=q(g,["show","onClose"]),f=p__namespace.useCallback(()=>{var r,u;i(),_.emit("form",void 0),n(x=>d(d({},x),U)),(u=(r=e.current)==null?void 0:r.modalConfiguration)!=null&&u.onClose&&e.current.modalConfiguration.onClose();},[i,e]),A=p__namespace.useRef(null);p__namespace.useEffect(()=>{var u;let r=(u=A.current)==null?void 0:u.querySelectorAll("a,input,textarea,button");(r==null?void 0:r.length)===1&&components.focus.on([...r][0]);});let R=p__namespace.useCallback(r=>{notifications.notify(d({},r));},[]),m=p__namespace.useCallback(()=>({alert,close:f,configuration:e.current,formDefinition:o,reset:()=>n(u=>d(d({},u),U)),setError:R,setMessage:u=>{var x,y;(y=(x=e.current)==null?void 0:x.modalConfiguration)!=null&&y.onMessage&&e.current.modalConfiguration.onMessage(u);},setState:n,state:t,setValue:l}),[f,e,o,R,t,l]);return p__namespace.useEffect(()=>{let r=H=>k(void 0,[H],function*({name:y,props:{messages:C,attributes:M,currentUrl:b}}){let v=yield ie(`${y}`,m());v&&v({messages:C,attributes:M,currentUrl:b});}),u=y=>{var b,H,v,K;let C=m();notifications.notify({message:y.predicate,type:"warning",onClose:(H=(b=C.configuration)==null?void 0:b.modalConfiguration)==null?void 0:H.onMessageClose});let M=(K=(v=C.configuration)==null?void 0:v.modalConfiguration)==null?void 0:K.onMessage;M&&M(y);},x=y=>k(void 0,null,function*(){if(y.toDo==="ajaxHiddeAll"&&f(),y.toDo==="functionTimedCall"){let C=yield ie(util.arrayOrArray(y.param)[1],m());C&&setTimeout(()=>{var M;return C({currentUrl:(M=o==null?void 0:o.form.action)!=null?M:"noUrl"})},Number(y.param[0]));}});return V.on("message",u),W.on("method",r),N.on("action",x),()=>{V.off("message",u),W.off("method",r),N.off("action",x);}},[t.windowIndex,i,f]),p__namespace.useEffect(()=>{o&&s();},[o]),jsxRuntime.jsx(ee,{id:O,children:jsxRuntime.jsx(components.Modal,T(d({ref:A,onClose:f,id:O,title:(L=(w=(h=e.current)==null?void 0:h.modalConfiguration)==null?void 0:w.modalTitle)!=null?L:o==null?void 0:o.form.title,size:"md-fixed",shouldCloseOnEsc:!t.disabled,shouldCloseOnOverlayClick:!t.disabled,initialFocusGetter:p__namespace.useCallback(r=>r==null?void 0:r.querySelector(util.focusSelector),[])},c),{children:o&&jsxRuntime.jsxs(themeUi.Box,T(d({},theme.getVariant("layout.common.modals.apiaApi")),{children:["NO EST\xC1 IMPLEMENTADA LA PROPIEDAD handleLoad. Falta pasar:",jsxRuntime.jsxs("ul",{children:[jsxRuntime.jsx("li",{children:"todos los componentes de validaci\xF3n (input, check, etc)"}),jsxRuntime.jsxs("li",{children:["M\xE9todos y componentes del apiaApiHandler (./fields, ./buttons, etc)"," ",jsxRuntime.jsx("strong",{children:"Ver que quiz\xE1s no es necesario pasar todos los m\xE9todos en este momento"}),", sino solamente aquellos que sean necesarios al momento de realizar alguna acci\xF3n particular."," ",jsxRuntime.jsx("strong",{children:"De hecho es un buen momento para hacer limpieza y refactoreo"})]})]}),"En cambio ",jsxRuntime.jsx("strong",{children:"el validationsStore si est\xE1 pasado"}),". Solamente faltan los componentes."]}))}))})};p__namespace.memo(Fe);util.debugDispatcher.on("parseXml",t=>k(void 0,[t],function*([e]){let n=yield util.parseXmlAsync(e);console.info(n);}),"Acepta un par\xE1metro de tipo string y realiza un parseo como si fuera xml, convirti\xE9ndolo a objeto javascript.");var E={debug:!0,colors:{exception:"red",alert:"yellow",message:"lightgreen"},handleLoad:!1},Je="ApiaApiConfig",ue={},re=localStorage.getItem(Je);re&&(ue=JSON.parse(re));function D(e){return lodash.merge({},E,e,ue)}function pe(e,t,n){let o=e,a=o.indexOf("?");a===-1?o+="?":a!==o.length-1&&!o.endsWith("&")&&(o+="&");let l=`${o}${t?J__default.default.stringify(t,n):""}`;return (l.endsWith("&")||l.endsWith("?"))&&(l=l.slice(0,l.length-1)),l}var fe=e=>{var n;let t=(n=e.match(/action=(\w+)/))==null?void 0:n[1];return t!=null?t:"noAction"},N=new class extends util.EventEmitter{};function I(e,t=(n=>(n=E.colors)!=null?n:{exception:"red",alert:"yellow",message:"green"})()){return t[e]}var $=e=>{let t;typeof e!="string"?e.message?t=e.message:t=e.toString():t=e,notifications.notify({type:"danger",message:e.message}),console.log("%c ","font-size:10vh"),console.log("%cError in ApiaApi","color:red;font-size:2em;font-weight:bold"),console.log(`red/${t}`,{error:e}),console.log("%c ","font-size:10vh");};function Be(e){return e.headers["content-type"].match("application/json")}function Ke(e){return e.headers["content-type"].match(/(?:application|text)?\/xml/)}function je(e){return e.headers["content-type"].match(/(?:application|text)?\/html/)}function Ge(e){var t,n;e&&(D().debug&&console.log("%cHandled actions: ",`color: ${(n=(t=D().colors)==null?void 0:t.message)!=null?n:"green"}`,{actions:e}),util.arrayOrArray(e.action).forEach(a=>{N.emit("action",T(d({},a),{param:util.arrayOrArray(a.param)}));}));}function le({exceptions:e,onClose:t,sysExceptions:n,sysMessages:o}){try{import(`/api/onClose/${t}.ts`).then(a=>{if(e||n||o){let l=notifications.getNotificationMessageObj({exceptions:e,onClose:t,sysExceptions:n,sysMessages:o});l?l.forEach(s=>{notifications.notify(T(d({},s),{onClose:a.default}));}):a.default();}else a.default();},a=>{notifications.notify({message:`onClose action not found: ${String(a)}`,type:"danger"});});}catch(a){ge({exceptions:e,sysExceptions:n,sysMessages:o}),console.error("Error while handling onClose"),console.error(a);}}function ge(e){if(!e)return;let{exceptions:t,sysMessages:n,sysExceptions:o}=e;if(t||o||n)try{notifications.dispatchNotifications({exceptions:t,sysExceptions:o,sysMessages:n});}catch(a){$(new Error(a));}}var Ye=(o,a,...l)=>k(void 0,[o,a,...l],function*(e,t,n=E){var c;let s=D(n),i;if(Be(e))typeof e.data=="string"?i=JSON.parse(e.data.trim()):typeof e.data=="object"&&e.data&&(i=e.data);else if(Ke(e))i=yield util.parseXmlAsync(e.data).catch(A=>{$(new Error(A));});else if(je(e))return console.error("El contenido devuelto es Html, no se esperaba esa respuesta"),null;if(s.validateResponse){let A=yield s.validateResponse(T(d({},e),{data:(c=i==null?void 0:i.load)!=null?c:i}));if(typeof A=="string")throw new Error(`Validation error: ${A}`);if(!A)throw new Error("Error")}if(i){let f=i,{actions:A,onClose:R,exceptions:m,sysExceptions:g,sysMessages:h,load:w}=f,L=q(f,["actions","onClose","exceptions","sysExceptions","sysMessages","load"]);return L.code==="-1"&&m?(session.session.invalidate(),null):(m&&s.debug&&console.log(`${I("exception",s.colors)}/parseSuccessfulResponse`,{exceptions:m}),g&&s.debug&&console.log(`${I("exception",s.colors)}/parseSuccessfulResponse`,{sysExceptions:g}),h&&s.debug&&console.log(`${I("alert",s.colors)}/parseSuccessfulResponse`,{sysMessages:h}),Ge(A),s.handleLoad&&R?le({exceptions:m,onClose:R,sysExceptions:g,sysMessages:h}):ge({exceptions:m,sysExceptions:g,sysMessages:h}),w?(s.handleLoad&&(console.log(`${I("message",s.colors)}/handleLoad`,{load:w}),ae(w,t,{methodsPath:n.methodsPath,modalConfiguration:T(d({},s.modalConfiguration),{onClose:()=>{var r,u;R&&le({exceptions:m,onClose:R,sysExceptions:g,sysMessages:h}),(r=s.modalConfiguration)!=null&&r.onClose&&((u=s.modalConfiguration)==null||u.onClose());}})})||console.log(`${I("exception",s.colors)}/unhandledLoad -> There is no handler defined`,{load:w})),T(d({},w),{sysMessages:h,exceptions:m,sysExceptions:g})):T(d({},L),{sysMessages:h,exceptions:m,sysExceptions:g}))}return null});function me(o,a){return k(this,arguments,function*(e,t,n=E){var s;let l=D(n);try{if(!e||e.data===void 0)l.debug&&console.log(`${I("alert",l.colors)}/ApiaApi wrong response`);else {let i=yield Ye(e,t,l),c=fe(t);return l.debug&&console.log(`${I("message",l.colors)}/ <- ApiaApi.${(s=e.config.method)!=null?s:""} ${c} `,{data:i}),T(d({},e),{data:i,hasError:!!(i!=null&&i.exceptions)||!!(i!=null&&i.sysExceptions),hasMessages:!!(i!=null&&i.sysMessages)})}}catch(i){return $(new Error(i)),null}return null})}function Ze(e,t){return k(this,null,function*(){let n=typeof e!="string"?B():e,o=typeof e=="string"?t!=null?t:E:e,a=T(d({},D(o)),{postData:o.postDataTreatement==="stringify"?J__default.default.stringify(o.postData,o.stringifyOptions):o.postData}),l=pe(n,a.queryData,a.stringifyOptions);if(a.debug){let i=n.split("&"),c=fe(n);console.log(`${I("message",a.colors)}/ApiaApi.post ${c}`,{url:l,queryDataInURL:[...i],queryData:a.queryData,formData:a.postData,stringifyOptiopns:a.stringifyOptions});}let s=yield ce__default.default.post(l,a.postData,a.axiosConfig).catch(i=>{$(new Error(i));});return s?me(s,n,a):null})}function et(e,t){return k(this,null,function*(){let n=typeof e!="string"?B():e,o=D(typeof e=="string"?t!=null?t:E:e),a=pe(n,o.queryData,o.stringifyOptions);o.debug&&console.log(`${I("message",o.colors)}/ApiaApi.get`,{url:a});let l=yield ce__default.default.get(a,o.axiosConfig).catch(s=>{$(new Error(s));});return l?yield me(l,n,o):null})}var tt={get:et,getConfig:D,post:Ze};function B(e){var f,A;let t={};if(e){let c=e,r=q(c,["ajaxUrl","queryString","stringifyOptions","shouldAvoidTabId","preventAsXmlParameter","avoidTabId"]);t=d({},r);}let n=J__default.default.stringify(t,(f=e==null?void 0:e.stringifyOptions)!=null?f:{arrayFormat:"repeat",encodeValuesOnly:!1}),o=(A=e==null?void 0:e.ajaxUrl)!=null?A:window.URL_REQUEST_AJAX;o.indexOf("?")===o.length-1&&(o=o.slice(0,o.length-1)),o.startsWith("/")||(o=`/${o}`);let a=window.TAB_ID_REQUEST.match(/tokenId=(\w+)/),l=(a!=null?a:[])[1],s=(e!=null&&e.tabId?`&tabId=${e.tabId}&tokenId=${l}`:window.TAB_ID_REQUEST).slice(1);e!=null&&e.avoidTabId&&(s="");let{CONTEXT:i}=window;return i!=null&&i.endsWith("/")&&(i+=i.slice(0,i.length-1)),`${i}${o}?${e!=null&&e.preventAsXmlParameter?"":"asXml=true&"}${e!=null&&e.queryString?`${e.queryString}&`:""}${n?`${n}&`:""}${s}`}var ot=tt;
|
|
41
|
-
|
|
42
|
-
exports.ApiaApi = ot;
|
|
43
|
-
exports.makeApiaUrl = B;
|
|
1
|
+
import{jsx as p,jsxs as pe}from"react/jsx-runtime";import*as x from"react";import y,{createContext as et,useMemo as tt}from"react";import{Box as M}from"theme-ui";import{debugDispatcher as ot,EventEmitter as Q,parseXmlAsync as me,arrayOrArray as k,useMount as fe,encrypt as nt,WithEventsValue as rt,focus as at,focusSelector as lt,useStateRef as st,useUnmount as it}from"@apia/util";import{notify as U,getNotificationMessageObj as ct,dispatchNotifications as ut}from"@apia/notifications";import{classToValidate as V,Checkbox as dt,FileInput as pt,classToValidationFunction as mt,Input as ft,Radio as yt,Select as vt,useFormContext as gt,validationsStore as oe,hasSucceedFormValidation as ht,Form as bt}from"@apia/validations";import{SimpleButton as xt,useModal as wt,Modal as $t,ProgressBar as Ot}from"@apia/components";import{getVariant as ye}from"@apia/theme";import ve from"axios";import{merge as Ct,uniqueId as ne}from"lodash";import K from"qs";import{session as At}from"@apia/session";const Et=et("apiaApi"),_t=({children:t,id:e})=>p(Et.Provider,{value:e,children:t});var jt=x.memo(_t),Pt=Object.defineProperty,Mt=Object.defineProperties,St=Object.getOwnPropertyDescriptors,Z=Object.getOwnPropertySymbols,ge=Object.prototype.hasOwnProperty,he=Object.prototype.propertyIsEnumerable,be=(t,e,o)=>e in t?Pt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,I=(t,e)=>{for(var o in e||(e={}))ge.call(e,o)&&be(t,o,e[o]);if(Z)for(var o of Z(e))he.call(e,o)&&be(t,o,e[o]);return t},R=(t,e)=>Mt(t,St(e)),xe=(t,e)=>{var o={};for(var n in t)ge.call(t,n)&&e.indexOf(n)<0&&(o[n]=t[n]);if(t!=null&&Z)for(var n of Z(t))e.indexOf(n)<0&&he.call(t,n)&&(o[n]=t[n]);return o},H=(t,e,o)=>new Promise((n,s)=>{var c=r=>{try{l(o.next(r))}catch(i){s(i)}},a=r=>{try{l(o.throw(r))}catch(i){s(i)}},l=r=>r.done?n(r.value):Promise.resolve(r.value).then(c,a);l((o=o.apply(t,e)).next())});ot.on("parseXml",t=>H(void 0,[t],function*([e]){const o=yield me(e);console.info(o)}),"Acepta un par\xE1metro de tipo string y realiza un parseo como si fuera xml, convirti\xE9ndolo a objeto javascript.");const q={debug:!0,colors:{exception:"red",alert:"yellow",message:"lightgreen"},handleLoad:!1},It="ApiaApiConfig";let we={};const $e=localStorage.getItem(It);$e&&(we=JSON.parse($e));function D(t){return Ct({},q,t,we)}function Oe(t,e,o){let n=t;const s=n.indexOf("?");s===-1?n+="?":s!==n.length-1&&!n.endsWith("&")&&(n+="&");let c=`${n}${e?K.stringify(e,o):""}`;return(c.endsWith("&")||c.endsWith("?"))&&(c=c.slice(0,c.length-1)),c}const Ce=t=>{var e;const o=(e=t.match(/action=(\w+)/))==null?void 0:e[1];return o??"noAction"},re=new class extends Q{};function N(t,e=(o=>(o=q.colors)!=null?o:{exception:"red",alert:"yellow",message:"green"})()){return e[t]}const W=t=>{let e;typeof t!="string"?t.message?e=t.message:e=t.toString():e=t,U({type:"danger",message:t.message.replaceAll("AxiosError","Error")}),console.log("%c ","font-size:10vh"),console.log("%cError in ApiaApi","color:red;font-size:2em;font-weight:bold"),console.log(`red/${e}`,{error:t}),console.log("%c ","font-size:10vh")};function Nt(t){return t.headers["content-type"].match("application/json")}function Tt(t){return t.headers["content-type"].match(/(?:application|text)?\/xml/)}function kt(t){return t.headers["content-type"].match(/(?:application|text)?\/html/)}function Rt(t){var e,o;t&&(D().debug&&console.log("%cHandled actions: ",`color: ${(o=(e=D().colors)==null?void 0:e.message)!=null?o:"green"}`,{actions:t}),k(t.action).forEach(n=>{re.emit("action",R(I({},n),{param:k(n.param)}))}))}function Ae({exceptions:t,onClose:e,sysExceptions:o,sysMessages:n}){try{import(`/api/onClose/${e}.ts`).then(s=>{if(t||o||n){const c=ct({exceptions:t,onClose:e,sysExceptions:o,sysMessages:n});c?c.forEach(a=>{U(R(I({},a),{onClose:s.default}))}):s.default()}else s.default()},s=>{U({message:`onClose action not found: ${String(s)}`,type:"danger"})})}catch(s){Ee({exceptions:t,sysExceptions:o,sysMessages:n}),console.error("Error while handling onClose"),console.error(s)}}function Ee(t){if(!t)return;const{exceptions:e,sysMessages:o,sysExceptions:n}=t;if(e||n||o)try{ut({exceptions:e,sysExceptions:n,sysMessages:o})}catch(s){W(new Error(s))}}const Dt=(t,e,...o)=>H(void 0,[t,e,...o],function*(n,s,c=q){var a;const l=D(c);let r;if(Nt(n))typeof n.data=="string"?r=JSON.parse(n.data.trim()):typeof n.data=="object"&&n.data&&(r=n.data);else if(Tt(n))r=yield me(n.data).catch(i=>{W(new Error(i))});else if(kt(n))return console.error("El contenido devuelto es Html, no se esperaba esa respuesta"),null;if(l.validateResponse){const i=yield l.validateResponse(R(I({},n),{data:(a=r?.load)!=null?a:r}));if(typeof i=="string")throw new Error(`Validation error: ${i}`);if(!i)throw new Error("Error")}if(r){const i=r,{actions:d,onClose:u,exceptions:g,sysExceptions:m,sysMessages:w,load:_}=i,O=xe(i,["actions","onClose","exceptions","sysExceptions","sysMessages","load"]);return O.code==="-1"&&g?(At.invalidate(),null):(g&&l.debug&&console.log("%cparseSuccessfulResponse",`color: ${N("exception",l.colors)}`,{exceptions:g}),m&&l.debug&&console.log("%cparseSuccessfulResponse",`color: ${N("exception",l.colors)}`,{sysExceptions:m}),w&&l.debug&&console.log("%cparseSuccessfulResponse",`color: ${N("alert",l.colors)}`,{sysMessages:w}),Rt(d),l.handleLoad&&u?Ae({exceptions:g,onClose:u,sysExceptions:m,sysMessages:w}):Ee({exceptions:g,sysExceptions:m,sysMessages:w}),_?(l.handleLoad&&(console.log("%chandleLoad",`color: ${N("message",l.colors)}`,{load:_}),Io(_,s,{methodsPath:c.methodsPath,modalConfiguration:R(I({},l.modalConfiguration),{onClose:()=>{var A,T;u&&Ae({exceptions:g,onClose:u,sysExceptions:m,sysMessages:w}),(A=l.modalConfiguration)!=null&&A.onClose&&((T=l.modalConfiguration)==null||T.onClose())}})})||console.log("%cunhandledLoad -> There is no handler defined",`color: ${N("exception",l.colors)}`,{load:_})),R(I({},_),{sysMessages:w,exceptions:g,sysExceptions:m})):R(I({},O),{sysMessages:w,exceptions:g,sysExceptions:m}))}return null});function _e(t,e){return H(this,arguments,function*(o,n,s=q){var c;const a=D(s);try{if(!o||o.data===void 0)a.debug&&console.log("%cApiaApi wrong response",`color: ${N("alert",a.colors)}`);else{const l=yield Dt(o,n,a),r=Ce(n);return a.debug&&console.log(`%c <- ApiaApi.${(c=o.config.method)!=null?c:""} ${r} `,`color: ${N("message",a.colors)}`,{data:l}),R(I({},o),{data:l,hasError:!!(l!=null&&l.exceptions)||!!(l!=null&&l.sysExceptions),hasMessages:!!(l!=null&&l.sysMessages)})}}catch(l){return W(new Error(l)),null}return null})}function Ft(t,e){return H(this,null,function*(){const o=typeof t!="string"?ae():t,n=typeof t=="string"?e??q:t,s=R(I({},D(n)),{postData:n.postDataTreatement==="stringify"?K.stringify(n.postData,n.stringifyOptions):n.postData}),c=Oe(o,s.queryData,s.stringifyOptions);if(s.debug){const l=o.split("&"),r=Ce(o);console.log(`%cApiaApi.post ${r}`,`color: ${N("message",s.colors)}`,{url:c,queryDataInURL:[...l],queryData:s.queryData,formData:s.postData,stringifyOptiopns:s.stringifyOptions})}const a=yield ve.post(c,s.postData,s.axiosConfig).catch(l=>{W(new Error(l))});return a?_e(a,o,s):null})}function Lt(t,e){return H(this,null,function*(){const o=typeof t!="string"?ae():t,n=D(typeof t=="string"?e??q:t),s=Oe(o,n.queryData,n.stringifyOptions);n.debug&&console.log("%cApiaApi.get",`color: ${N("message",n.colors)}`,{url:s});const c=yield ve.get(s,n.axiosConfig).catch(a=>{W(new Error(a))});return c?yield _e(c,o,n):null})}const je={get:Lt,getConfig:D,post:Ft};function ae(t){var e,o;let n={};if(t){const d=t,u=xe(d,["ajaxUrl","queryString","stringifyOptions","shouldAvoidTabId","preventAsXmlParameter","avoidTabId"]);n=I({},u)}const s=K.stringify(n,(e=t?.stringifyOptions)!=null?e:{arrayFormat:"repeat",encodeValuesOnly:!1});let c=(o=t?.ajaxUrl)!=null?o:window.URL_REQUEST_AJAX;c.indexOf("?")===c.length-1&&(c=c.slice(0,c.length-1)),c.startsWith("/")||(c=`/${c}`);const a=window.TAB_ID_REQUEST.match(/tokenId=(\w+)/),l=(a??[])[1];let r=(t!=null&&t.tabId?`&tabId=${t.tabId}&tokenId=${l}`:window.TAB_ID_REQUEST).slice(1);t!=null&&t.avoidTabId&&(r="");let{CONTEXT:i}=window;return i!=null&&i.endsWith("/")&&(i+=i.slice(0,i.length-1)),`${i}${c}?${t!=null&&t.preventAsXmlParameter?"":"asXml=true&"}${t!=null&&t.queryString?`${t.queryString}&`:""}${s?`${s}&`:""}${r}`}var qt=Object.defineProperty,Pe=Object.getOwnPropertySymbols,Ut=Object.prototype.hasOwnProperty,Vt=Object.prototype.propertyIsEnumerable,Me=(t,e,o)=>e in t?qt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,Ht=(t,e)=>{for(var o in e||(e={}))Ut.call(e,o)&&Me(t,o,e[o]);if(Pe)for(var o of Pe(e))Vt.call(e,o)&&Me(t,o,e[o]);return t};const Wt=t=>{const e=y.useMemo(()=>t.element,[t.element]),o=y.useMemo(()=>e.class?`handler__checkbox ${e.class}`:"handler__checkbox",[e.class]),n=y.useMemo(()=>Ht({required:e.mandatory},V(e.class)),[e.class,e.mandatory]),s=y.useCallback(c=>c==="on"||c===!0,[]);return p(dt,{className:o,name:e.id||e.name,label:e.text,title:e.title||e.text,initialValue:String(e.selected)==="true",disabled:e.readonly||e.disabled,validationRules:n,onChange:e.onChange,submitValueParser:s})};var Xt=Object.defineProperty,Se=Object.getOwnPropertySymbols,Bt=Object.prototype.hasOwnProperty,zt=Object.prototype.propertyIsEnumerable,Ie=(t,e,o)=>e in t?Xt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,Jt=(t,e)=>{for(var o in e||(e={}))Bt.call(e,o)&&Ie(t,o,e[o]);if(Se)for(var o of Se(e))zt.call(e,o)&&Ie(t,o,e[o]);return t};const Ne=t=>{const e=y.useMemo(()=>t.element,[t.element]),o=y.useMemo(()=>e.class?`handler__file ${e.class}`:"handler__file",[e.class]),n=y.useMemo(()=>Jt({required:e.mandatory},V(e.class)),[e.class,e.mandatory]);return p(pt,{className:o,name:e.id||e.name,label:e.text,title:e.title||e.text,readOnly:e.readonly,disabled:e.disabled,validationRules:n})};Ne.displayName="ApiaApiFileInput";var Qt=Object.defineProperty,Kt=Object.defineProperties,Zt=Object.getOwnPropertyDescriptors,Te=Object.getOwnPropertySymbols,Yt=Object.prototype.hasOwnProperty,Gt=Object.prototype.propertyIsEnumerable,ke=(t,e,o)=>e in t?Qt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,Re=(t,e)=>{for(var o in e||(e={}))Yt.call(e,o)&&ke(t,o,e[o]);if(Te)for(var o of Te(e))Gt.call(e,o)&&ke(t,o,e[o]);return t},eo=(t,e)=>Kt(t,Zt(e));const De=t=>{const e=y.useMemo(()=>t.element,[t.element]),o=y.useCallback(i=>y.lazy(()=>new Promise(d=>{import(`/api/modals/${i}`).then(u=>{d(u)}).catch(u=>{d({default:()=>{throw console.error(u),new Error(`The above error ocurred at component ApiaApiHandler/${i}, does it exist?`)}})})})),[]),[n,s]=y.useState(null);fe(()=>{if(e.modalFunction){const i=e.modalFunction.match(/(?:fnc)?(\w+)\(?\)?$/);if(i){const d=i[i.length-1];s(o(d))}}});const c=y.useMemo(()=>e.class?`handler__${e.type} ${e.class}`:`handler__${e.type}`,[e.class,e.type]),a=y.useMemo(()=>Re({required:e.mandatory,maxLength:e.maxlength?Number(e.maxlength):void 0,pattern:e.regExp,patternMessage:e.regExpMessage},V(e.class)),[e.class,e.mandatory,e.maxlength,e.regExp,e.regExpMessage]),l=y.useMemo(()=>mt(e.class),[e.class]),r=y.useCallback(i=>e.type==="password"?nt(window.SALT,window.IV,window.PASSPHRASE,i,Number(window.KEY_SIZE),Number(window.ITERATION_COUNT)):i,[e.type]);return e.modalFunction?n?p(y.Suspense,{children:p(n,eo(Re({},t),{element:e}))}):null:p(ft,{type:e.type,className:c,name:e.id||e.name,label:e.text,title:e.title||e.text,value:e.value,readOnly:e.readonly,disabled:e.disabled,validationFunction:l,validationRules:a,submitValueParser:r,onChange:e.onChange,autoComplete:e.type==="password"?"new-password":void 0})};De.displayName="ApiaApiInput";var to=Object.defineProperty,Fe=Object.getOwnPropertySymbols,oo=Object.prototype.hasOwnProperty,no=Object.prototype.propertyIsEnumerable,Le=(t,e,o)=>e in t?to(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,ro=(t,e)=>{for(var o in e||(e={}))oo.call(e,o)&&Le(t,o,e[o]);if(Fe)for(var o of Fe(e))no.call(e,o)&&Le(t,o,e[o]);return t};const qe=t=>{var e;const o=y.useMemo(()=>t.element,[t.element]),n=y.useMemo(()=>o.class?`handler__radio ${o.class}`:"handler__radio",[o.class]),s=y.useMemo(()=>{var a;return k((a=o.options)==null?void 0:a.option).map(l=>({value:l.value,label:l.content}))},[(e=o.options)==null?void 0:e.option]),c=y.useMemo(()=>ro({required:o.mandatory},V(o.class)),[o.class,o.mandatory]);return p(yt,{className:n,name:o.id||o.name,label:o.text,title:o.title||o.text,value:o.value,disabled:o.readonly||o.disabled,validationRules:c,options:s,onChange:o.onChange})};qe.displayName="ApiaApiRadio";var ao=Object.defineProperty,Ue=Object.getOwnPropertySymbols,lo=Object.prototype.hasOwnProperty,so=Object.prototype.propertyIsEnumerable,Ve=(t,e,o)=>e in t?ao(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,io=(t,e)=>{for(var o in e||(e={}))lo.call(e,o)&&Ve(t,o,e[o]);if(Ue)for(var o of Ue(e))so.call(e,o)&&Ve(t,o,e[o]);return t};const He=t=>{var e;const o=y.useMemo(()=>t.element,[t.element]),n=y.useMemo(()=>o.class?`handler__select ${o.class}`:"handler__select",[o.class]),s=y.useMemo(()=>{var l;return k((l=o.options)==null?void 0:l.option).map(r=>({value:r.value,label:r.content}))},[(e=o.options)==null?void 0:e.option]),c=y.useMemo(()=>io({required:o.mandatory},V(o.class)),[o.class,o.mandatory]),a=tt(()=>{var l,r,i,d;return(d=(i=(l=s.find(u=>u.value===t.element.value))==null?void 0:l.value)!=null?i:(r=s[0])==null?void 0:r.value)!=null?d:""},[]);return p(vt,{className:n,name:o.id||o.name,label:o.text,title:o.title||o.text,value:o.value,disabled:o.readonly||o.disabled,validationRules:c,options:s,onChange:o.onChange,initialValue:a})};He.displayName="ApiaApiSelect";var co=Object.defineProperty,uo=Object.defineProperties,po=Object.getOwnPropertyDescriptors,We=Object.getOwnPropertySymbols,mo=Object.prototype.hasOwnProperty,fo=Object.prototype.propertyIsEnumerable,Xe=(t,e,o)=>e in t?co(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,F=(t,e)=>{for(var o in e||(e={}))mo.call(e,o)&&Xe(t,o,e[o]);if(We)for(var o of We(e))fo.call(e,o)&&Xe(t,o,e[o]);return t},L=(t,e)=>uo(t,po(e));const Be=t=>{var e,o;const n=y.useMemo(()=>{var a,l,r;return k((r=(l=(a=t?.definition)==null?void 0:a.form.elements)==null?void 0:l.element)!=null?r:[])},[(o=(e=t?.definition)==null?void 0:e.form.elements)==null?void 0:o.element]),s=y.useCallback(()=>{var a;const l=d=>{if(d.length>1)for(let u=d.length-1;u>=0;u--)if(d[u].type==="empty")d.pop();else return d;return d},r=[];((a=n[0])==null?void 0:a.type)!=="2columnTitle"&&r.push(-1),n.forEach((d,u)=>{d.type==="2columnTitle"&&r.push(u)});const i=[];return r.forEach((d,u)=>{const g=d+1<n.length?d+1:n.length-1,m=u+1<r.length?r[u+1]:void 0;i.push({sectionHeader:d!==-1?n[d]:void 0,sectionElements:l(n.slice(g,m))})}),i},[n])(),c=y.useCallback(a=>{const l=a.findIndex(r=>r.type!=="hidden")!==-1;return p(M,{className:l?"handler__form__elements__section__content":"handler__form__elements__section__content handler__hidden",children:a.map(r=>{const i=L(F({},r),{onChange(){z(r.onChange,t).then(u=>{u&&u()}).catch(console.error)}}),d=i.id||i.name||ne();switch(i.type){case"table":{const u=JSON.parse(i.text);return p(M,L(F({},ye("layout.common.tables.information")),{children:pe("table",{sx:{width:"100%"},children:[p("thead",{children:p("tr",{children:u.columns.map(g=>p("th",{children:g},g))})}),p("tbody",{children:u.rows.map(g=>p("tr",{children:g.cells.map((m,w)=>p("td",{children:m},`${m}_${u.columns[w]}`))},g.cells.join("-")))})]})}),d)}case"2columnSubTitle":return p(M,{className:i.class,as:"h6",children:i.value||i.text},d);case"2column":return p(M,{dangerouslySetInnerHTML:{__html:i.value||i.text},className:i.class},d);case"checkbox":return p(Wt,L(F({},t),{element:i}),d);case"file":return p(Ne,L(F({},t),{element:i}),d);case"hidden":case"password":case"text":return p(De,L(F({},t),{element:i}),d);case"select":return p(He,L(F({},t),{element:i}),d);case"radio":return p(qe,L(F({},t),{element:i}),d);case"empty":return p(M,{className:"spacer"},d);default:return console.warn(`Unhandled element type: ${i.type}`,i),null}})},ne())},[t]);return p(M,{className:"handler__form__elements",children:s.map(a=>(a.sectionHeader,c(a.sectionElements)))})};Be.displayName="ApiaApiFieldsContainer";var yo=Object.defineProperty,vo=Object.defineProperties,go=Object.getOwnPropertyDescriptors,ze=Object.getOwnPropertySymbols,ho=Object.prototype.hasOwnProperty,bo=Object.prototype.propertyIsEnumerable,Je=(t,e,o)=>e in t?yo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,le=(t,e)=>{for(var o in e||(e={}))ho.call(e,o)&&Je(t,o,e[o]);if(ze)for(var o of ze(e))bo.call(e,o)&&Je(t,o,e[o]);return t},xo=(t,e)=>vo(t,go(e)),Qe=(t,e,o)=>new Promise((n,s)=>{var c=r=>{try{l(o.next(r))}catch(i){s(i)}},a=r=>{try{l(o.throw(r))}catch(i){s(i)}},l=r=>r.done?n(r.value):Promise.resolve(r.value).then(c,a);l((o=o.apply(t,e)).next())}),wo=(t,e,o)=>(e=t[Symbol.asyncIterator],o=(n,s)=>(s=t[n])&&(e[n]=c=>new Promise((a,l,r)=>(c=s.call(t,c),r=c.done,Promise.resolve(c.value).then(i=>a({value:i,done:r}),l)))),e?e.call(t):(t=t[Symbol.iterator](),e={},o("next"),o("return"),e));const $o=t=>{var e,o,n,s,c;const a=k((n=(o=(e=t.definition)==null?void 0:e.form.buttons)==null?void 0:o.button)!=null?n:[]),l=(s=t.configuration)==null?void 0:s.modalConfiguration,r=(c=t.configuration)==null?void 0:c.methodsPath,{name:i}=gt(),d=y.useCallback(u=>{const g=ne(),m=["submitAjax","submit"].includes(u.type)&&!u.onclick?"submit":"button",w=`handler__${m}`,_=()=>{(function(){return Qe(this,null,function*(){const O=yield oe.validateForm(i);if(!ht(O))return;const{submitValues:A}=O;if(t!=null&&t.definition&&["submitAjax","submit"].includes(u.type)){const T=new FormData;Object.entries(A).forEach(([f,h])=>{T.append(f,h??"")});const v=`${t?.definition.form.action.match(new RegExp(`^${window.CONTEXT}/`))?"":window.CONTEXT}${t!=null&&t.definition.form.action.startsWith("/")?"":"/"}${t?.definition.form.action}`;t.setState(f=>xo(le({},f),{isLoading:!0})),je.post(v,{postData:t.state.isMultipart?T:K.stringify([...T.entries(),["isAjax",!0]].reduce((f,[h,$])=>{const b=le({},f);return b[h.toString()]=$.toString(),b},{})),handleLoad:!0,notificationsCategory:"apiaApiHandler",modalConfiguration:l,methodsPath:r}).finally(()=>{Qe(this,null,function*(){var f,h,$,b;if(u.onclick){const J=u.onclick.split(";");try{for(var C=wo(J),j,P,S;j=!(P=yield C.next()).done;j=!1){const te=P.value,de=yield z(te,le({},t));if(de)de({currentUrl:(h=(f=t.definition)==null?void 0:f.form.action)!=null?h:"noUrl"});else throw new Error(`The requested action is not defined: "${(b=($=t.definition)==null?void 0:$.form.action)!=null?b:""}"`)}}catch(te){S=[te]}finally{try{j&&(P=C.return)&&(yield P.call(C))}finally{if(S)throw S[0]}}}})})}})})()};return p(xt,{className:w,disabled:t.state.disabled,id:u.id||u.text,isLoading:t.state.isLoading,title:u.text,type:m,onClick:_,children:u.text},g)},[i,r,l,t]);return p(M,{className:"handler__form__buttons",children:a.map(u=>d(u))})},Oo=y.memo($o);var Co=Object.defineProperty,Ao=Object.defineProperties,Eo=Object.getOwnPropertyDescriptors,Y=Object.getOwnPropertySymbols,Ke=Object.prototype.hasOwnProperty,Ze=Object.prototype.propertyIsEnumerable,Ye=(t,e,o)=>e in t?Co(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,E=(t,e)=>{for(var o in e||(e={}))Ke.call(e,o)&&Ye(t,o,e[o]);if(Y)for(var o of Y(e))Ze.call(e,o)&&Ye(t,o,e[o]);return t},X=(t,e)=>Ao(t,Eo(e)),_o=(t,e)=>{var o={};for(var n in t)Ke.call(t,n)&&e.indexOf(n)<0&&(o[n]=t[n]);if(t!=null&&Y)for(var n of Y(t))e.indexOf(n)<0&&Ze.call(t,n)&&(o[n]=t[n]);return o},G=(t,e,o)=>new Promise((n,s)=>{var c=r=>{try{l(o.next(r))}catch(i){s(i)}},a=r=>{try{l(o.throw(r))}catch(i){s(i)}},l=r=>r.done?n(r.value):Promise.resolve(r.value).then(c,a);l((o=o.apply(t,e)).next())});const se=new class extends Q{},ie=new class extends Q{},B="ApiaApiForm",Ge={};function z(t,e){return G(this,null,function*(){return new Promise(o=>{var n,s,c;try{const a=/^\/?([\w\d_-]+)\/?(?:\(([^)]*)\))?$/,l=t.match(a);if(l){const r=l[1],i=l[2],d=[...(c=(s=(n=e.configuration)==null?void 0:n.methodsPath)==null?void 0:s.split("/").filter(m=>!!m))!=null?c:[],r].join("/"),u=m=>{typeof m.default!="function"&&g();const w=m.default;Ge[r]=_=>{var O;return w(e,X(E({},_),{inlineArguments:(O=i?.split(",").map(A=>A.startsWith("'")||A.startsWith('"')?A.slice(1,A.length-1):A))!=null?O:[]}))},o(Ge[r])},g=()=>{throw new Error(`${r}.ts not found at ${d}.ts nor ./${r}.ts`)};import(`/api/methods/${d}.ts`).then(u).catch(()=>{var m;((m=e.configuration)==null?void 0:m.methodsPath)!==void 0?import(`/api/methods/${r}.ts`).then(u).catch(g):g()})}}catch(a){console.error(a),e.reset(),e.setError({type:"danger",message:"Error while loading current method."})}})})}function jo(t){return typeof t.canClose=="boolean"&&typeof t.type=="string"&&!!t.form}function Po(t){return typeof t.canClose=="boolean"&&typeof t.type=="string"&&!!t.function}function Mo(t){return!!(typeof t.canClose=="boolean"&&typeof t.type=="string"&&typeof t.text=="object"&&t.text&&typeof t.text.label=="string")}const ce=new rt;function So(){const[,t,e]=st(void 0),o=x.useCallback(n=>{t(n)},[t]);return fe(()=>{ce.on("update",o)}),it(()=>ce.off("update",o)),e}const ue=new class extends Q{emit(t,e){super.emit(t,e)}};function Io(t,e,o){return ce.value=o,jo(t)?(ue.emit("form",t),!0):Po(t)?(ie.emit("method",{name:t.function.name,props:{messages:t.function.messages,attributes:t.function,currentUrl:e}}),!0):Mo(t)?(se.emit("message",{predicate:t.text.content,title:t.text.title}),!0):!1}const ee={disabled:!1,isLoading:!1,isMultipart:!1,progress:0,errors:{}},No=()=>{var t,e,o;const n=So(),[s,c]=x.useState(X(E({},ee),{windowIndex:-1})),[a,l]=x.useState(void 0);x.useEffect(()=>ue.on("form",l),[]);const r=x.useCallback((v,f)=>oe.setFieldValue(B,v,f),[]);x.useEffect(()=>{var v,f,h;if(!a)return;const $=k((h=(f=(v=a?.form)==null?void 0:v.elements)==null?void 0:f.element)!=null?h:[]);let b=!1;const C=Object.values($);let j=0;for(;j<C.length&&!b;)C[j++].type==="file"&&(b=!0);c(P=>X(E(E({},P),ee),{isMultipart:b}))},[a]);const i=wt(),{show:d,onClose:u}=i,g=_o(i,["show","onClose"]),m=x.useCallback(()=>{var v,f;u(),ue.emit("form",void 0),c(h=>E(E({},h),ee)),(f=(v=n.current)==null?void 0:v.modalConfiguration)!=null&&f.onClose&&n.current.modalConfiguration.onClose(),oe.unregisterForm(B)},[u,n]),w=x.useRef(null);x.useEffect(()=>{var v;const f=(v=w.current)==null?void 0:v.querySelectorAll("a,input,textarea,button");f?.length===1&&at.on([...f][0])});const _=x.useCallback(v=>{U(E({},v))},[]),O=x.useCallback(()=>({alert,close:m,configuration:n.current,formDefinition:a,reset:()=>c(v=>E(E({},v),ee)),setError:_,setMessage:v=>{var f,h;(h=(f=n.current)==null?void 0:f.modalConfiguration)!=null&&h.onMessage&&n.current.modalConfiguration.onMessage(v)},setState:c,state:s,setValue:r}),[m,n,a,_,s,r]);x.useEffect(()=>{const v=$=>G(void 0,[$],function*({name:b,props:{messages:C,attributes:j,currentUrl:P}}){const S=yield z(`${b}`,O());S&&S({messages:C,attributes:j,currentUrl:P})}),f=$=>{var b,C,j,P;const S=O();U({message:$.predicate,type:"warning",onClose:(C=(b=S.configuration)==null?void 0:b.modalConfiguration)==null?void 0:C.onMessageClose});const J=(P=(j=S.configuration)==null?void 0:j.modalConfiguration)==null?void 0:P.onMessage;J&&J($)},h=$=>G(void 0,null,function*(){if($.toDo==="ajaxHiddeAll"&&m(),$.toDo==="functionTimedCall"){const b=yield z(k($.param)[1],O());b&&setTimeout(()=>{var C;return b({currentUrl:(C=a?.form.action)!=null?C:"noUrl"})},Number($.param[0]))}});return se.on("message",f),ie.on("method",v),re.on("action",h),()=>{se.off("message",f),ie.off("method",v),re.off("action",h)}},[s.windowIndex,u,m]),x.useEffect(()=>{a&&d()},[a]);const A=O(),T=x.useCallback(v=>G(void 0,null,function*(){if(v&&a!=null&&a.form.onLoad){const f=yield z(`${a?.form.onLoad}`,O());f&&f()}}),[a?.form.onLoad,O]);return p(jt,{id:B,children:p($t,X(E({ref:w,onClose:m,id:B,title:(o=(e=(t=n.current)==null?void 0:t.modalConfiguration)==null?void 0:e.modalTitle)!=null?o:a?.form.title,size:"md-fixed",shouldCloseOnEsc:!s.disabled,shouldCloseOnOverlayClick:!s.disabled,initialFocusGetter:x.useCallback(v=>v?.querySelector(lt),[])},g),{children:a&&p(M,X(E({},ye("layout.common.modals.apiaApi")),{children:pe(bt,{name:B,avoidFieldsOverride:!0,className:"handler__form",children:[p(Be,E({definition:a},A)),s.isMultipart&&s.progress>0&&p(M,{className:"progressBox",children:p(Ot,{id:"ApiaApiHandler progress",progress:s.progress,loading:!0})}),p(M,{ref:T}),p(Oo,E({definition:a},A))]})}))}))})},To=x.memo(No);export{je as ApiaApi,To as ApiaApiHandler,ae as makeApiaUrl};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/ApiaApiContext.tsx","../src/apiaApi.ts","../src/fields/ApiaApiCheckbox.tsx","../src/fields/ApiaApiFileInput.tsx","../src/fields/ApiaApiInput.tsx","../src/fields/ApiaApiRadio.tsx","../src/fields/ApiaApiSelect.tsx","../src/fields/ApiaApiFieldsContainer.tsx","../src/buttons/ApiaApiButtonsContainer.tsx","../src/ApiaApiHandler.tsx"],"sourcesContent":["import { createContext } from 'react';\nimport * as React from 'react';\n\nlet apiaApiId: string | undefined;\n\nexport function getApiaApiId() {\n if (!apiaApiId) throw new Error('There is no apia api id');\n return apiaApiId;\n}\n\nconst ApiaApiId = createContext<string | undefined>('apiaApi');\n\nconst ApiaApiContext = ({\n children,\n id,\n}: {\n id: string;\n children: React.ReactNode;\n}) => {\n apiaApiId = id;\n return <ApiaApiId.Provider value={id}>{children}</ApiaApiId.Provider>;\n};\n\nexport default React.memo(ApiaApiContext);\n","/* eslint-disable @typescript-eslint/no-invalid-void-type */\nimport axios, { AxiosResponse } from 'axios';\nimport { merge } from 'lodash';\nimport QueryString from 'qs';\nimport { session } from '@apia/session';\nimport {\n arrayOrArray,\n parseXmlAsync,\n EventEmitter,\n TModify,\n TApiaAction,\n TApiaSystemMessageObj,\n debugDispatcher,\n TNotificationMessage,\n} from '@apia/util';\nimport {\n dispatchNotifications,\n getNotificationMessageObj,\n notify,\n} from '@apia/notifications';\nimport { handle } from './ApiaApiHandler';\nimport {\n IApiaApiRequestConfig,\n TApiaApiConfigurator,\n TApiaApiResult,\n TColors,\n} from './types';\n\ndebugDispatcher.on(\n 'parseXml',\n async ([text]) => {\n const result = await parseXmlAsync<unknown>(text as string);\n console.info(result);\n },\n 'Acepta un parámetro de tipo string y realiza un parseo como si fuera xml, convirtiéndolo a objeto javascript.',\n);\n\nconst defaultConfig: IApiaApiRequestConfig<unknown> = {\n debug: true,\n colors: {\n exception: 'red',\n alert: 'yellow',\n message: 'lightgreen',\n },\n handleLoad: false,\n};\n\nconst STORED_CONFIG = 'ApiaApiConfig';\n\nlet forcedConfig: Partial<IApiaApiRequestConfig<unknown>> = {};\nconst storedConfig = localStorage.getItem(STORED_CONFIG);\nif (storedConfig)\n forcedConfig = JSON.parse(storedConfig) as Partial<\n IApiaApiRequestConfig<unknown>\n >;\n\nexport function getApiaApiConfigurator(): TApiaApiConfigurator {\n return {\n reset() {\n forcedConfig = {};\n localStorage.removeItem(STORED_CONFIG);\n },\n config(newConfig) {\n if (\n newConfig.notificationsCategory ||\n newConfig.axiosConfig ||\n newConfig.modalConfiguration ||\n newConfig.handleLoad ||\n newConfig.queryData ||\n newConfig.stringifyOptions ||\n newConfig.validateResponse\n )\n throw new Error('Operación ilegal');\n\n const toStoreConfig = merge(forcedConfig, newConfig);\n localStorage.setItem(STORED_CONFIG, JSON.stringify(toStoreConfig));\n forcedConfig = toStoreConfig;\n console.log('Se guardó la configuración correctamente', {\n config: toStoreConfig,\n });\n },\n shout() {\n console.log({ config: getConfig({}) });\n },\n theme(theme) {\n if (theme.toLowerCase() === 'dark') {\n getApiaApiConfigurator().config({\n colors: {\n exception: 'red',\n alert: 'yellow',\n message: 'lightgreen',\n },\n });\n } else if (theme.toLowerCase() === 'light') {\n getApiaApiConfigurator().config({\n colors: {\n exception: 'red',\n alert: '#e0e006',\n message: 'darkgreen',\n },\n });\n } else {\n console.log(`Tema ${theme} desconocido, prueba 'light' o 'dark'.`);\n return;\n }\n\n console.log(`Tema ${theme} establecido correctamente.`);\n },\n };\n}\n\nfunction getConfig<LoadType>(\n outerBehaveConfig?: IApiaApiRequestConfig<LoadType>,\n) {\n return merge({}, defaultConfig, outerBehaveConfig, forcedConfig);\n}\n\nfunction makeUrl(\n url: string,\n queryData: IApiaApiRequestConfig<unknown>['queryData'],\n stringifyOptions: IApiaApiRequestConfig<unknown>['stringifyOptions'],\n) {\n let finalUrl = url;\n const questionMarkIndex = finalUrl.indexOf('?');\n\n if (questionMarkIndex === -1) finalUrl += '?';\n else if (questionMarkIndex !== finalUrl.length - 1 && !finalUrl.endsWith('&'))\n finalUrl += '&';\n let parsedUrl = `${finalUrl}${\n queryData ? QueryString.stringify(queryData, stringifyOptions) : ''\n }`;\n if (parsedUrl.endsWith('&') || parsedUrl.endsWith('?')) {\n parsedUrl = parsedUrl.slice(0, parsedUrl.length - 1);\n }\n return parsedUrl;\n}\n\nconst getURLActionName = (url: string): string => {\n const actionIdx = url.match(/action=(\\w+)/)?.[1];\n return actionIdx ?? 'noAction';\n};\n\nexport const ApiaActions = new (class ApiaActions extends EventEmitter<{\n action: TModify<TApiaAction, { param: string[] }>;\n}> {})();\n\nfunction getColor(\n color: keyof TColors,\n colors: TColors = defaultConfig.colors ?? {\n exception: 'red',\n alert: 'yellow',\n message: 'green',\n },\n) {\n return colors[color] as string;\n}\n\nconst handleWrongResponse = (error: Error) => {\n let errorMessage: string;\n if (typeof error !== 'string') {\n if (error.message) errorMessage = error.message;\n else errorMessage = error.toString();\n } else errorMessage = error;\n\n notify({\n type: 'danger',\n message: error.message.replaceAll('AxiosError', 'Error'),\n });\n console.log('%c ', 'font-size:10vh');\n console.log('%cError in ApiaApi', 'color:red;font-size:2em;font-weight:bold');\n console.log(`red/${errorMessage}`, { error });\n console.log('%c ', 'font-size:10vh');\n};\n\nexport function isJsonResponse(response: AxiosResponse<unknown>) {\n return (response.headers['content-type'] as string).match('application/json');\n}\nexport function isXmlResponse(response: AxiosResponse<unknown>) {\n return (response.headers['content-type'] as string).match(\n /(?:application|text)?\\/xml/,\n );\n}\nexport function isHtmlResponse(response: AxiosResponse<unknown>) {\n return (response.headers['content-type'] as string).match(\n /(?:application|text)?\\/html/,\n );\n}\n\nfunction handleActions(actions: TApiaSystemMessageObj['actions']) {\n if (actions) {\n if (getConfig().debug)\n console.log(\n '%cHandled actions: ',\n `color: ${getConfig().colors?.message ?? 'green'}`,\n { actions },\n );\n const actionsArray = arrayOrArray(actions.action);\n actionsArray.forEach((action) => {\n ApiaActions.emit('action', {\n ...action,\n param: arrayOrArray(action.param),\n });\n });\n }\n}\nfunction handleOnClose({\n exceptions,\n onClose,\n sysExceptions,\n sysMessages,\n}: TModify<TNotificationMessage, { onClose: string }>) {\n try {\n import(\n /* webpackChunkName: \"api-[request]\" */ `/api/onClose/${onClose}.ts`\n ).then(\n (func: { default: () => void }) => {\n if (exceptions || sysExceptions || sysMessages) {\n const notificationsObject = getNotificationMessageObj({\n exceptions,\n onClose,\n sysExceptions,\n sysMessages,\n });\n if (notificationsObject)\n notificationsObject.forEach((notification) => {\n notify({\n ...notification,\n onClose: func.default,\n });\n });\n else func.default();\n } else func.default();\n },\n (e) => {\n notify({\n message: `onClose action not found: ${String(e)}`,\n type: 'danger',\n });\n },\n );\n } catch (e) {\n parseMessages({ exceptions, sysExceptions, sysMessages });\n console.error('Error while handling onClose');\n console.error(e);\n }\n}\n\nexport function parseMessages(response: Record<string, unknown>) {\n if (!response) return;\n const { exceptions, sysMessages, sysExceptions } = response;\n if (exceptions || sysExceptions || sysMessages) {\n try {\n dispatchNotifications({\n exceptions,\n sysExceptions,\n sysMessages,\n } as TNotificationMessage);\n } catch (e: unknown) {\n handleWrongResponse(new Error(e as string));\n }\n }\n}\n\nexport const parseSuccessfulResponse = async <\n LoadType extends Record<string, unknown>,\n>(\n response: AxiosResponse<string>,\n currentUrl: string,\n outerBehaveConfig: IApiaApiRequestConfig<LoadType> = defaultConfig,\n) => {\n const behaveConfig = getConfig(outerBehaveConfig);\n\n let parsedObj: TApiaSystemMessageObj<LoadType> | void;\n if (isJsonResponse(response)) {\n if (typeof response.data === 'string')\n parsedObj = JSON.parse(\n response.data.trim(),\n ) as TApiaSystemMessageObj<LoadType> | void;\n else if (typeof response.data === 'object' && response.data)\n parsedObj = response.data;\n } else if (isXmlResponse(response)) {\n parsedObj = await parseXmlAsync<LoadType>(response.data).catch(\n (e: unknown) => {\n handleWrongResponse(new Error(e as string));\n },\n );\n } else if (isHtmlResponse(response)) {\n console.error(\n 'El contenido devuelto es Html, no se esperaba esa respuesta',\n );\n return null;\n }\n\n if (behaveConfig.validateResponse) {\n const validateResult = await behaveConfig.validateResponse({\n ...response,\n data: parsedObj?.load ?? parsedObj,\n });\n if (typeof validateResult === 'string')\n throw new Error(`Validation error: ${validateResult}`);\n else if (!validateResult) {\n throw new Error('Error');\n }\n }\n\n if (parsedObj) {\n const {\n actions,\n onClose,\n exceptions,\n sysExceptions,\n sysMessages,\n load,\n ...rest\n } = parsedObj; // Session handling\n if (rest.code === '-1' && exceptions) {\n session.invalidate();\n return null;\n }\n\n if (exceptions && behaveConfig.debug) {\n console.log(\n `%cparseSuccessfulResponse`,\n `color: ${getColor('exception', behaveConfig.colors)}`,\n {\n exceptions,\n },\n );\n }\n if (sysExceptions && behaveConfig.debug) {\n console.log(\n `%cparseSuccessfulResponse`,\n `color: ${getColor('exception', behaveConfig.colors)}`,\n {\n sysExceptions,\n },\n );\n }\n if (sysMessages && behaveConfig.debug) {\n console.log(\n `%cparseSuccessfulResponse`,\n `color: ${getColor('alert', behaveConfig.colors)}`,\n {\n sysMessages,\n },\n );\n }\n\n handleActions(actions);\n\n if (behaveConfig.handleLoad && onClose)\n handleOnClose({\n exceptions,\n onClose,\n sysExceptions,\n sysMessages,\n });\n else parseMessages({ exceptions, sysExceptions, sysMessages });\n\n if (load) {\n if (behaveConfig.handleLoad) {\n console.log(\n `%chandleLoad`,\n `color: ${getColor('message', behaveConfig.colors)}`,\n {\n load,\n },\n );\n if (\n !handle(load, currentUrl, {\n methodsPath: outerBehaveConfig.methodsPath,\n modalConfiguration: {\n ...behaveConfig.modalConfiguration,\n onClose: () => {\n if (onClose)\n handleOnClose({\n exceptions,\n onClose,\n sysExceptions,\n sysMessages,\n });\n if (behaveConfig.modalConfiguration?.onClose)\n behaveConfig.modalConfiguration?.onClose();\n },\n },\n })\n ) {\n console.log(\n `%cunhandledLoad -> There is no handler defined`,\n `color: ${getColor('exception', behaveConfig.colors)}`,\n {\n load,\n },\n );\n }\n }\n return { ...load, sysMessages, exceptions, sysExceptions };\n }\n return { ...(rest as LoadType), sysMessages, exceptions, sysExceptions };\n }\n\n return null;\n};\n\nexport type TApiaApiAxiosResponse<LoadType> = AxiosResponse<LoadType | null> & {\n hasError: boolean;\n hasMessages: boolean;\n};\n\nasync function handleResponse<LoadType extends Record<string, unknown>>(\n result: AxiosResponse<string> | void,\n currentUrl: string,\n outerBehaveConfig: IApiaApiRequestConfig<LoadType> = defaultConfig,\n): Promise<TApiaApiAxiosResponse<LoadType> | null> {\n const behaveConfig = getConfig(outerBehaveConfig);\n try {\n if (!result || result.data === undefined) {\n if (behaveConfig.debug)\n console.log(\n `%cApiaApi wrong response`,\n `color: ${getColor('alert', behaveConfig.colors)}`,\n );\n } else {\n const parsedResponse = await parseSuccessfulResponse<LoadType>(\n result,\n currentUrl,\n behaveConfig,\n );\n\n const action = getURLActionName(currentUrl);\n if (behaveConfig.debug)\n console.log(\n `%c <- ApiaApi.${result.config.method ?? ''} ${action} `,\n `color: ${getColor('message', behaveConfig.colors)}`,\n {\n data: parsedResponse,\n },\n );\n\n return {\n ...result,\n data: parsedResponse,\n hasError:\n !!parsedResponse?.exceptions || !!parsedResponse?.sysExceptions,\n hasMessages: !!parsedResponse?.sysMessages,\n };\n }\n } catch (e: unknown) {\n handleWrongResponse(new Error(e as string));\n return null;\n }\n\n return null;\n}\n\n/**\n* IMPORTANT!! The ApiaApi is programmed under the slogan that\n * **should never throw an exception**. **Errors** coming from\n * connectivity or exceptions on the server **will be handled\n * automatically** by ApiaApi, using the notification system\n * of the application. It is possible to determine in what context they should\n * be thrown those exceptions (global, main, modal) using the\n * alertsCategory configuration properties **(see errorsHandling.md)**.\n *\n * @param url String, the url you want to call\n * @param config interface IApiaApiRequestConfig<DataType>;\n *\n * @throws Nothing\n *\n * @example\n *\n * ApiaApi.post<ResponseType>('url...', {\n axiosConfig?: AxiosRequestConfig;\n\n // Configuración de postData\n postData? unknown;\n postDataTreatement?: 'stringify' | undefined;\n\n // Configuración de queryString\n queryData?: string | Record<string, unknown>;\n stringifyOptions?: QueryString.IStringifyOptions;\n\n // Response validator,\n // If it returns true, everything continues correctly\n // If it returns false, the ApiaApi throws a standard error.\n // If it returns string, ApiaApi throws the error returned in the string.\n validateResponse?: (\n response: AxiosResponse<DataType | null>,\n ) => boolean | string;\n\n // Configuración de alertas\n alertsImportance?: TAlertImportance;\n\n // Configuración de ApiaApiHandler, falta documentar\n handleLoad?: boolean;\n eventsHandler?: IEventsHandler;\n\n // other configuration\n colors?: TColors;\n debug?: boolean;\n }\n * @returns The type of the return value depends on the type passed when calling the function. If there was an error it returns null.\n */\nasync function post<\n LoadType extends Record<string, unknown> = Record<string, unknown>,\n DataType = unknown,\n>(\n url:\n | string\n | TModify<\n IApiaApiRequestConfig<LoadType>,\n { postData?: DataType; postDataTreatement?: 'stringify' }\n >,\n config?: TModify<\n IApiaApiRequestConfig<LoadType>,\n {\n postData?: DataType;\n postDataTreatement?: 'stringify';\n }\n >,\n): TApiaApiResult<LoadType>;\nasync function post<\n LoadType extends Record<string, unknown> = Record<string, unknown>,\n DataType = unknown,\n>(\n config: TModify<\n IApiaApiRequestConfig<LoadType>,\n {\n postData?: DataType;\n postDataTreatement?: 'stringify';\n }\n >,\n): TApiaApiResult<LoadType>;\nasync function post<\n LoadType extends Record<string, unknown> = Record<string, unknown>,\n DataType = unknown,\n T = unknown,\n>(\n par1:\n | string\n | TModify<\n IApiaApiRequestConfig<LoadType>,\n { postData?: DataType; postDataTreatement?: 'stringify' }\n >,\n par2?: TModify<\n IApiaApiRequestConfig<LoadType>,\n { postData?: DataType; postDataTreatement?: 'stringify' }\n >,\n): TApiaApiResult<LoadType> {\n const actualUrl = typeof par1 !== 'string' ? makeApiaUrl() : par1;\n\n const configParameter = (\n typeof par1 === 'string' ? par2 ?? defaultConfig : par1\n ) as TModify<\n IApiaApiRequestConfig<LoadType>,\n { postData?: DataType; postDataTreatement?: 'stringify' }\n >;\n\n const behaveConfig = {\n ...getConfig(configParameter),\n postData:\n configParameter.postDataTreatement === 'stringify'\n ? QueryString.stringify(\n configParameter.postData,\n configParameter.stringifyOptions,\n )\n : configParameter.postData,\n };\n\n const parsedUrl = makeUrl(\n actualUrl,\n behaveConfig.queryData,\n behaveConfig.stringifyOptions,\n );\n\n if (behaveConfig.debug) {\n const queryString = actualUrl.split('&');\n const action = getURLActionName(actualUrl);\n\n console.log(\n `%cApiaApi.post ${action}`,\n `color: ${getColor('message', behaveConfig.colors)}`,\n {\n url: parsedUrl,\n queryDataInURL: [...queryString],\n queryData: behaveConfig.queryData,\n formData: behaveConfig.postData,\n stringifyOptiopns: behaveConfig.stringifyOptions,\n },\n );\n }\n\n const response = await axios\n .post<T, AxiosResponse<string>, DataType | string>(\n parsedUrl,\n behaveConfig.postData,\n behaveConfig.axiosConfig,\n )\n .catch((e: unknown) => {\n handleWrongResponse(new Error(e as string));\n });\n\n if (response) {\n const result = handleResponse<LoadType>(response, actualUrl, behaveConfig);\n return result;\n }\n return null;\n}\n\n/**\n * IMPORTANTE!! El ApiaApi está programado bajo la consigna de que\n * **no debe tirar núnca una excepción**. **Los errores** provenientes\n * de la conectividad o de excepciones en el servidor **serán manejados\n * automáticamente** por el ApiaApi utilizando el sistema de notificaciones\n * de la aplicación. Es posible determinar en qué contexto deben\n * ser lanzadas esas excepciones (global, main, modal) utilizando las\n * propiedades de configuración alertsCategory **(ver errorsHandling.md)**.\n *\n * @param url String, el url al que se desea llamar\n * @param config interface IApiaApiRequestConfig<DataType>;\n *\n * @throws Nothing\n *\n * @example\n *\n * ApiaApi.get<TipoDeRespuesta>('url...', {\n axiosConfig?: AxiosRequestConfig;\n\n // Configuración de queryString\n queryData?: string | Record<string, unknown>;\n stringifyOptions?: QueryString.IStringifyOptions;\n\n // Validador de respuesta,\n // Si devuelve true, todo sigue correctamente\n // Si devuelve false, el ApiaApi tira un error estándar.\n // Si devuelve string, el ApiaApi tira el error devuelto en el string.\n validateResponse?: (\n response: AxiosResponse<DataType | null>,\n ) => boolean | string;\n\n // Configuración de alertas\n alertsImportance?: TAlertImportance;\n\n // Configuración de ApiaApiHandler, falta documentar\n handleLoad?: boolean;\n eventsHandler?: IEventsHandler;\n\n // Otra configuración\n colors?: TColors;\n debug?: boolean;\n }\n * @returns El tipo del valor devuelto depende del tipo pasado al llamar a la función. Si hubo un error devuelve null\n */\nasync function get<\n LoadType extends Record<string, unknown> = Record<string, unknown>,\n>(\n url: string | IApiaApiRequestConfig<LoadType>,\n config?: IApiaApiRequestConfig<LoadType>,\n): TApiaApiResult<LoadType>;\nasync function get<\n LoadType extends Record<string, unknown> = Record<string, unknown>,\n>(config: IApiaApiRequestConfig<LoadType>): TApiaApiResult<LoadType>;\nasync function get<\n LoadType extends Record<string, unknown> = Record<string, unknown>,\n T = unknown,\n D = unknown,\n>(\n par1: string | IApiaApiRequestConfig<LoadType>,\n par2?: IApiaApiRequestConfig<LoadType>,\n): TApiaApiResult<LoadType> {\n const actualUrl = typeof par1 !== 'string' ? makeApiaUrl() : par1;\n\n const behaveConfig = getConfig<LoadType>(\n typeof par1 === 'string' ? par2 ?? defaultConfig : par1,\n );\n\n const parsedUrl = makeUrl(\n actualUrl,\n behaveConfig.queryData,\n behaveConfig.stringifyOptions,\n );\n\n if (behaveConfig.debug)\n console.log(\n `%cApiaApi.get`,\n `color: ${getColor('message', behaveConfig.colors)}`,\n {\n url: parsedUrl,\n },\n );\n const response = await axios\n .get<T, AxiosResponse<string>, D>(parsedUrl, behaveConfig.axiosConfig)\n .catch((e: unknown) => {\n handleWrongResponse(new Error(e as string));\n });\n if (response) {\n const result = await handleResponse<LoadType>(\n response,\n actualUrl,\n behaveConfig,\n );\n return result;\n }\n return null;\n}\n\nconst ApiaApi = {\n get,\n getConfig,\n post,\n};\n/**\n * Creates an url based on the general requirements of Apia.\n * If the ajaxUrl property is not passed, it will use the\n * window.URL_REQUEST_AJAX. Its use is very simple, just pass the objects you\n * want to appear in the query string.\n *\n * @example makeApiaUrl({\n * ajaxUrl: 'the.endpoint.you.want',\n * queryString: 'an=existent&query=string',\n * action: 'theAction',\n * anotherProp: 15\n * })\n *\n * @returns the well formed url, in the example, the response url is:\n * /context/the.endpoint.you.want?an=existent&query=string&anotherProp=15&tabId=...&tokenId=...&action=theAction\n */\nexport function makeApiaUrl(props?: {\n action?: string;\n ajaxUrl?: string;\n queryString?: string;\n stringifyOptions?: QueryString.IStringifyOptions;\n tabId?: string | number;\n preventAsXmlParameter?: boolean;\n avoidTabId?: boolean;\n [key: string]: unknown;\n}) {\n let actualQueryData: Record<string, unknown> | unknown = {};\n\n if (props) {\n const {\n ajaxUrl,\n queryString,\n stringifyOptions,\n shouldAvoidTabId,\n preventAsXmlParameter,\n avoidTabId,\n ...rest\n } = props;\n actualQueryData = { ...rest };\n }\n\n const queryString = QueryString.stringify(\n actualQueryData,\n props?.stringifyOptions ?? {\n arrayFormat: 'repeat',\n encodeValuesOnly: false,\n },\n );\n\n let actualAjaxUrl = props?.ajaxUrl ?? window.URL_REQUEST_AJAX;\n if (actualAjaxUrl.indexOf('?') === actualAjaxUrl.length - 1)\n actualAjaxUrl = actualAjaxUrl.slice(0, actualAjaxUrl.length - 1);\n if (!actualAjaxUrl.startsWith('/')) actualAjaxUrl = `/${actualAjaxUrl}`;\n\n const match = window.TAB_ID_REQUEST.match(/tokenId=(\\w+)/);\n const currentTokenId = (match ?? [])[1];\n\n let tabId = (\n props?.tabId\n ? `&tabId=${props.tabId}&tokenId=${currentTokenId}`\n : window.TAB_ID_REQUEST\n ).slice(1);\n if (props?.avoidTabId) tabId = '';\n\n let { CONTEXT } = window;\n if (CONTEXT?.endsWith('/')) CONTEXT += CONTEXT.slice(0, CONTEXT.length - 1);\n\n return `${CONTEXT}${actualAjaxUrl}?${\n !props?.preventAsXmlParameter ? 'asXml=true&' : ''\n }${props?.queryString ? `${props.queryString}&` : ''}${\n queryString ? `${queryString}&` : ''\n }${tabId}`;\n}\n\nexport default ApiaApi;\n","import { classToValidate, Checkbox } from '@apia/validations';\nimport React from 'react';\nimport { TApiaApiField } from '../ApiaApiHandler';\n\nexport const ApiaApiCheckbox = (props: TApiaApiField) => {\n const element = React.useMemo(() => props.element, [props.element]);\n const className = React.useMemo(\n () =>\n element.class\n ? `handler__checkbox ${element.class}`\n : 'handler__checkbox',\n [element.class],\n );\n const validationRules = React.useMemo(\n () => ({\n required: element.mandatory,\n ...classToValidate(element.class),\n }),\n [element.class, element.mandatory],\n );\n const submitValueParser = React.useCallback(\n (value: boolean | string) => value === 'on' || value === true,\n [],\n );\n return (\n <Checkbox\n className={className}\n name={element.id || element.name}\n label={element.text}\n title={element.title || element.text}\n initialValue={String(element.selected) === 'true'}\n disabled={element.readonly || element.disabled}\n validationRules={validationRules}\n onChange={element.onChange}\n submitValueParser={submitValueParser}\n />\n );\n};\n","import { classToValidate, FileInput } from '@apia/validations';\nimport React from 'react';\nimport { TApiaApiField } from '../ApiaApiHandler';\n\nexport const ApiaApiFileInput = (props: TApiaApiField) => {\n const element = React.useMemo(() => props.element, [props.element]);\n const className = React.useMemo(\n () => (element.class ? `handler__file ${element.class}` : 'handler__file'),\n [element.class],\n );\n const validationRules = React.useMemo(\n () => ({\n required: element.mandatory,\n ...classToValidate(element.class),\n }),\n [element.class, element.mandatory],\n );\n\n return (\n <FileInput\n className={className}\n name={element.id || element.name}\n label={element.text}\n title={element.title || element.text}\n readOnly={element.readonly}\n disabled={element.disabled}\n validationRules={validationRules}\n />\n );\n};\n\nApiaApiFileInput.displayName = 'ApiaApiFileInput';\n","import { encrypt, useMount } from '@apia/util';\nimport {\n classToValidate,\n classToValidationFunction,\n Input,\n} from '@apia/validations';\nimport React from 'react';\nimport { TApiaApiField } from '../ApiaApiHandler';\n\nexport const ApiaApiInput = (props: TApiaApiField) => {\n const element = React.useMemo(() => props.element, [props.element]);\n\n const getModal = React.useCallback((path: string) => {\n return React.lazy<React.ComponentType<TApiaApiField>>(() => {\n return new Promise<{\n default: React.ComponentType<TApiaApiField>;\n }>((resolve) => {\n import(\n /* webpackChunkName: \"handlerModal\" */\n /* webpackInclude: /\\.tsx?$/ */\n `/api/modals/${path}`\n )\n .then((result: unknown) => {\n resolve(\n result as {\n default: React.ComponentType<TApiaApiField>;\n },\n );\n })\n .catch((error: unknown) => {\n resolve({\n default: () => {\n console.error(error);\n throw new Error(\n `The above error ocurred at component ApiaApiHandler/${path}, does it exist?`,\n );\n },\n });\n });\n });\n });\n }, []);\n\n const [Submodal, setSubmodal] = React.useState<React.LazyExoticComponent<\n React.ComponentType<TApiaApiField>\n > | null>(null);\n\n useMount(() => {\n if (element.modalFunction) {\n const found = element.modalFunction.match(/(?:fnc)?(\\w+)\\(?\\)?$/);\n if (found) {\n const modalName = found[found.length - 1];\n setSubmodal(getModal(modalName));\n }\n }\n });\n\n const className = React.useMemo(\n () =>\n element.class\n ? `handler__${element.type} ${element.class}`\n : `handler__${element.type}`,\n [element.class, element.type],\n );\n const validationRules = React.useMemo(\n () => ({\n required: element.mandatory,\n maxLength: element.maxlength ? Number(element.maxlength) : undefined,\n pattern: element.regExp,\n patternMessage: element.regExpMessage,\n ...classToValidate(element.class),\n }),\n [\n element.class,\n element.mandatory,\n element.maxlength,\n element.regExp,\n element.regExpMessage,\n ],\n );\n const validationFunction = React.useMemo(\n () => classToValidationFunction(element.class),\n [element.class],\n );\n const submitValueParser = React.useCallback(\n (value: string) => {\n if (element.type === 'password') {\n return encrypt(\n window.SALT,\n window.IV,\n window.PASSPHRASE,\n value,\n Number(window.KEY_SIZE),\n Number(window.ITERATION_COUNT),\n );\n }\n return value;\n },\n [element.type],\n );\n\n if (element.modalFunction) {\n if (Submodal) {\n return (\n <React.Suspense>\n <Submodal {...props} element={element} />\n </React.Suspense>\n );\n }\n return null;\n }\n\n return (\n <Input\n type={element.type}\n className={className}\n name={element.id || element.name}\n label={element.text}\n title={element.title || element.text}\n value={element.value}\n readOnly={element.readonly}\n disabled={element.disabled}\n validationFunction={validationFunction}\n validationRules={validationRules}\n submitValueParser={submitValueParser}\n onChange={element.onChange}\n autoComplete={element.type === 'password' ? 'new-password' : undefined}\n />\n );\n};\n\nApiaApiInput.displayName = 'ApiaApiInput';\n","import { arrayOrArray } from '@apia/util';\nimport { classToValidate, Radio } from '@apia/validations';\nimport React from 'react';\nimport { TApiaApiField } from '../ApiaApiHandler';\n\nexport const ApiaApiRadio = (props: TApiaApiField) => {\n const element = React.useMemo(() => props.element, [props.element]);\n const className = React.useMemo(\n () =>\n element.class ? `handler__radio ${element.class}` : 'handler__radio',\n [element.class],\n );\n const options = React.useMemo(\n () =>\n arrayOrArray(element.options?.option).map((currOption) => {\n return { value: currOption.value, label: currOption.content };\n }),\n [element.options?.option],\n );\n const validationRules = React.useMemo(\n () => ({\n required: element.mandatory,\n ...classToValidate(element.class),\n }),\n [element.class, element.mandatory],\n );\n return (\n <Radio\n className={className}\n name={element.id || element.name}\n label={element.text}\n title={element.title || element.text}\n value={element.value}\n disabled={element.readonly || element.disabled}\n validationRules={validationRules}\n options={options}\n onChange={element.onChange}\n />\n );\n};\n\nApiaApiRadio.displayName = 'ApiaApiRadio';\n","import { arrayOrArray } from '@apia/util';\nimport { classToValidate, Select } from '@apia/validations';\nimport React, { useMemo } from 'react';\nimport { TApiaApiField } from '../ApiaApiHandler';\n\nexport type TOption = {\n content: string;\n value: string;\n};\n\nexport const ApiaApiSelect = (props: TApiaApiField) => {\n const element = React.useMemo(() => props.element, [props.element]);\n const className = React.useMemo(\n () =>\n element.class ? `handler__select ${element.class}` : 'handler__select',\n [element.class],\n );\n const options = React.useMemo(\n () =>\n arrayOrArray(element.options?.option).map((currOption) => {\n return { value: currOption.value, label: currOption.content };\n }),\n [element.options?.option],\n );\n const validationRules = React.useMemo(\n () => ({\n required: element.mandatory,\n ...classToValidate(element.class),\n }),\n [element.class, element.mandatory],\n );\n const initialValue = useMemo(\n () =>\n options.find((current) => current.value === props.element.value)?.value ??\n options[0]?.value ??\n '',\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [],\n );\n\n return (\n <Select\n className={className}\n name={element.id || element.name}\n label={element.text}\n title={element.title || element.text}\n value={element.value}\n disabled={element.readonly || element.disabled}\n validationRules={validationRules}\n options={options}\n onChange={element.onChange}\n initialValue={initialValue}\n />\n );\n};\n\nApiaApiSelect.displayName = 'ApiaApiSelect';\n","\n\nimport { getVariant } from '@apia/theme';\nimport { arrayOrArray, TApiaFormElement, TApiaLoad } from '@apia/util';\nimport { uniqueId } from 'lodash';\nimport React from 'react';\nimport { Box } from 'theme-ui';\nimport { getFunction, TApiaApiMethodHandler } from '../ApiaApiHandler';\nimport { TModalTable } from '../types';\nimport { ApiaApiCheckbox } from './ApiaApiCheckbox';\nimport { ApiaApiFileInput } from './ApiaApiFileInput';\nimport { ApiaApiInput } from './ApiaApiInput';\nimport { ApiaApiRadio } from './ApiaApiRadio';\nimport { ApiaApiSelect } from './ApiaApiSelect';\n\ntype TApiaApiFieldsContainer = TApiaApiMethodHandler & {\n definition?: TApiaLoad | undefined;\n};\n\nexport const ApiaApiFieldsContainer = (props: TApiaApiFieldsContainer) => {\n const elements = React.useMemo(\n () => arrayOrArray(props?.definition?.form.elements?.element ?? []),\n [props?.definition?.form.elements?.element],\n );\n\n const getSections = React.useCallback(() => {\n const removeEndingSpacers = (\n sectionElements: TApiaFormElement[],\n ): TApiaFormElement[] => {\n if (sectionElements.length > 1) {\n for (let i = sectionElements.length - 1; i >= 0; i--) {\n if (sectionElements[i].type === 'empty') {\n sectionElements.pop();\n } else {\n return sectionElements;\n }\n }\n }\n return sectionElements;\n };\n const sectionIndexes: number[] = [];\n if (elements[0]?.type !== '2columnTitle') {\n sectionIndexes.push(-1);\n }\n elements.forEach((element, index) => {\n if (element.type === '2columnTitle') {\n sectionIndexes.push(index);\n }\n });\n const sections: {\n sectionHeader: TApiaFormElement | undefined;\n sectionElements: TApiaFormElement[];\n }[] = [];\n sectionIndexes.forEach((sectionIndex, arrayIndex) => {\n const start =\n sectionIndex + 1 < elements.length\n ? sectionIndex + 1\n : elements.length - 1;\n const end =\n arrayIndex + 1 < sectionIndexes.length\n ? sectionIndexes[arrayIndex + 1]\n : undefined;\n sections.push({\n sectionHeader: sectionIndex !== -1 ? elements[sectionIndex] : undefined,\n sectionElements: removeEndingSpacers(elements.slice(start, end)),\n });\n });\n return sections;\n }, [elements]);\n\n const sections = getSections();\n\n const renderSectionContent = React.useCallback(\n (sectionElements: TApiaFormElement[]) => {\n const isVisible =\n sectionElements.findIndex((element) => element.type !== 'hidden') !==\n -1;\n return (\n <Box\n className={\n isVisible\n ? 'handler__form__elements__section__content'\n : `handler__form__elements__section__content handler__hidden`\n }\n key={uniqueId()}\n >\n {sectionElements.map((current) => {\n const element = {\n ...current,\n onChange() {\n getFunction(current.onChange, props)\n .then((onChangeMethod) => {\n if (onChangeMethod) {\n onChangeMethod();\n }\n })\n .catch(console.error);\n },\n };\n const elementKey = element.id || element.name || uniqueId();\n switch (element.type) {\n case 'table': {\n const data = JSON.parse(element.text) as TModalTable;\n return (\n <Box\n key={elementKey}\n {...getVariant('layout.common.tables.information')}\n >\n <table sx={{ width: '100%' }}>\n <thead>\n <tr>\n {data.columns.map((column) => {\n return <th key={column}>{column}</th>;\n })}\n </tr>\n </thead>\n <tbody>\n {data.rows.map((row) => {\n return (\n <tr key={row.cells.join('-')}>\n {row.cells.map((cell, i) => {\n return (\n <td key={`${cell}_${data.columns[i]}`}>\n {cell}\n </td>\n );\n })}\n </tr>\n );\n })}\n </tbody>\n </table>\n </Box>\n );\n }\n case '2columnSubTitle':\n return (\n <Box key={elementKey} className={element.class} as=\"h6\">\n {element.value || element.text}\n </Box>\n );\n case '2column':\n return (\n <Box\n key={elementKey}\n dangerouslySetInnerHTML={{\n __html: element.value || element.text,\n }}\n className={element.class}\n />\n );\n case 'checkbox':\n return (\n <ApiaApiCheckbox\n key={elementKey}\n {...props}\n element={element}\n />\n );\n case 'file':\n return (\n <ApiaApiFileInput\n key={elementKey}\n {...props}\n element={element}\n />\n );\n case 'hidden':\n case 'password':\n case 'text':\n return (\n <ApiaApiInput key={elementKey} {...props} element={element} />\n );\n case 'select':\n return (\n <ApiaApiSelect\n key={elementKey}\n {...props}\n element={element}\n />\n );\n case 'radio':\n return (\n <ApiaApiRadio key={elementKey} {...props} element={element} />\n );\n case 'empty':\n return <Box key={elementKey} className=\"spacer\" />;\n default:\n console.warn(\n `Unhandled element type: ${element.type}`,\n element,\n );\n return null;\n }\n })}\n </Box>\n );\n },\n [props],\n );\n\n return (\n <Box className=\"handler__form__elements\">\n {sections.map((section) => {\n if (section.sectionHeader) {\n return renderSectionContent(section.sectionElements);\n }\n return renderSectionContent(section.sectionElements);\n })}\n </Box>\n );\n};\n\nApiaApiFieldsContainer.displayName = 'ApiaApiFieldsContainer';\n","import { arrayOrArray, TApiaFormButton, TApiaLoad } from '@apia/util';\nimport { uniqueId } from 'lodash';\nimport QueryString from 'qs';\nimport React from 'react';\nimport { Box } from 'theme-ui';\nimport {\n hasSucceedFormValidation,\n useFormContext,\n validationsStore,\n} from '@apia/validations';\nimport { SimpleButton } from '@apia/components';\nimport { getFunction, TApiaApiMethodHandler } from '../ApiaApiHandler';\nimport ApiaApi from '../apiaApi';\n\ntype TApiaApiButtonsContainer = TApiaApiMethodHandler & {\n definition?: TApiaLoad | undefined;\n};\n\nconst NonMemoizedApiaApiButtonsContainer = (\n props: TApiaApiButtonsContainer,\n) => {\n const buttons = arrayOrArray(props.definition?.form.buttons?.button ?? []);\n const modalConfiguration = props.configuration?.modalConfiguration;\n const methodsPath = props.configuration?.methodsPath;\n const { name: apiaApiForm } = useFormContext();\n\n const renderButton = React.useCallback(\n (button: TApiaFormButton) => {\n const key = uniqueId();\n const buttonType =\n ['submitAjax', 'submit'].includes(button.type) && !button.onclick\n ? 'submit'\n : 'button';\n const className = `handler__${buttonType}`;\n const onClick = () => {\n void (async function submitForm() {\n const validationResult = await validationsStore.validateForm(\n apiaApiForm,\n );\n if (!hasSucceedFormValidation(validationResult)) {\n return;\n }\n const { submitValues } = validationResult;\n\n if (\n props?.definition &&\n ['submitAjax', 'submit'].includes(button.type)\n ) {\n const formData = new FormData();\n Object.entries(submitValues).forEach(([name, value]) => {\n formData.append(name, (value as string | Blob) ?? '');\n });\n\n const hasContext = props?.definition.form.action.match(\n new RegExp(`^${window.CONTEXT}/`),\n );\n const url = `${hasContext ? '' : window.CONTEXT}${\n !props?.definition.form.action.startsWith('/') ? '/' : ''\n }${props?.definition.form.action}`;\n\n props.setState((current) => ({\n ...current,\n isLoading: true,\n }));\n\n void ApiaApi.post(url, {\n postData: props.state.isMultipart\n ? formData\n : QueryString.stringify(\n [...formData.entries(), ['isAjax', true]].reduce<\n Record<string, string>\n >((accumulated, [name, value]) => {\n const retValue = { ...accumulated };\n retValue[name.toString()] = value.toString();\n return retValue;\n }, {}),\n ),\n handleLoad: true,\n notificationsCategory: 'apiaApiHandler',\n modalConfiguration,\n methodsPath,\n }).finally(() => {\n void (async () => {\n if (button.onclick) {\n const actions = button.onclick.split(';');\n // eslint-disable-next-line no-restricted-syntax\n for await (const action of actions) {\n const method = await getFunction(action, {\n ...props,\n });\n\n if (method)\n method({\n currentUrl: props.definition?.form.action ?? 'noUrl',\n });\n else {\n throw new Error(\n `The requested action is not defined: \"${\n props.definition?.form.action ?? ''\n }\"`,\n );\n }\n }\n }\n })();\n });\n }\n })();\n };\n return (\n <SimpleButton\n className={className}\n disabled={props.state.disabled}\n id={button.id || button.text}\n isLoading={props.state.isLoading}\n key={key}\n title={button.text}\n type={buttonType}\n onClick={onClick}\n >\n {button.text}\n </SimpleButton>\n );\n },\n [apiaApiForm, methodsPath, modalConfiguration, props],\n );\n\n return (\n <Box className=\"handler__form__buttons\">\n {buttons.map((currentButton) => renderButton(currentButton))}\n </Box>\n );\n};\n\nexport const ApiaApiButtonsContainer = React.memo(\n NonMemoizedApiaApiButtonsContainer,\n);\n","/* eslint-disable max-classes-per-file */\n\nimport * as React from 'react';\nimport { Box } from 'theme-ui';\nimport { AxiosResponse } from 'axios';\nimport {\n arrayOrArray,\n EventEmitter,\n focus,\n focusSelector,\n TApiaAction,\n TApiaFormElement,\n TApiaFunction,\n TApiaLoad,\n TApiaLoadText,\n TModify,\n useMount,\n useStateRef,\n useUnmount,\n WithEventsValue,\n} from '@apia/util';\nimport { notify } from '@apia/notifications';\nimport { Form, validationsStore } from '@apia/validations';\nimport { Modal, ProgressBar, useModal } from '@apia/components';\nimport { getVariant } from '@apia/theme';\nimport ApiaApiContext from './ApiaApiContext';\nimport { IApiaApiRequestConfig } from './types';\nimport { ApiaActions } from './apiaApi';\nimport { ApiaApiFieldsContainer } from './fields/ApiaApiFieldsContainer';\nimport { ApiaApiButtonsContainer } from './buttons/ApiaApiButtonsContainer';\n\nexport type TMessage = {\n isHtml?: boolean;\n predicate: string;\n title?: string;\n};\ntype TMessageLocal = { title: string; predicate: string };\ntype TMethod = {\n name: string;\n props: {\n attributes?: Record<string, unknown>;\n currentUrl?: string;\n funCall?: string;\n inlineArguments?: string[];\n messages?: unknown;\n };\n};\nconst ApiaApiMessenger = new (class extends EventEmitter<{\n message: TMessageLocal;\n}> {})();\nconst FunctionsDispatcher = new (class extends EventEmitter<{\n method: TMethod;\n}> {})();\n\nexport type TApiaApiMethodHandler = {\n alert: typeof notify;\n close: () => void;\n configuration?: THandleConfiguration;\n formDefinition: TApiaLoad;\n reset: () => void;\n setError: typeof notify;\n setMessage: (message: Record<string, unknown>) => unknown;\n setState: React.Dispatch<React.SetStateAction<IApiaApiHandlerState>>;\n state: IApiaApiHandlerState;\n setValue: (name: string, value: string) => void;\n};\n\nexport type TApiaApiMethod = (\n handler: TApiaApiMethodHandler,\n props: TMethod['props'],\n) => Promise<void> | void;\n\nexport type TApiaApiField = TApiaApiMethodHandler & {\n element: TModify<TApiaFormElement, { onChange: React.ChangeEventHandler }>;\n};\n\nexport const apiaApiForm = 'ApiaApiForm';\n\ntype TStoredApiaApiMethod = (props?: TMethod['props']) => unknown;\n\nconst methods: Record<string, TStoredApiaApiMethod> = {};\n\nexport async function getFunction(\n name: string,\n handler: TApiaApiMethodHandler,\n): Promise<TStoredApiaApiMethod | undefined> {\n return new Promise((resolve) => {\n try {\n const separateNameFromParametersRegex =\n /^\\/?([\\w\\d_-]+)\\/?(?:\\(([^)]*)\\))?$/;\n const match = name.match(separateNameFromParametersRegex);\n if (match) {\n const functionName = match[1];\n const parameters = match[2];\n const path: string = [\n ...(handler.configuration?.methodsPath\n ?.split('/')\n .filter((current) => {\n return !!current;\n }) ?? []),\n functionName,\n ].join('/');\n\n const storeMethodAndResolve = (result: { default: TApiaApiMethod }) => {\n if (typeof result.default !== 'function') notFound();\n const method = result.default;\n methods[functionName] = (props?: TMethod['props']) => {\n return method(handler, {\n ...props,\n inlineArguments:\n parameters?.split(',').map((argument) => {\n if (argument.startsWith(\"'\") || argument.startsWith('\"'))\n return argument.slice(1, argument.length - 1);\n return argument;\n }) ?? [],\n });\n };\n resolve(methods[functionName]);\n };\n\n const notFound = () => {\n throw new Error(\n `${functionName}.ts not found at ${path}.ts nor ./${functionName}.ts`,\n );\n };\n\n import(\n /* webpackChunkName: \"api-methods-[request]\" */ `/api/methods/${path}.ts`\n )\n .then(storeMethodAndResolve)\n .catch(() => {\n if (handler.configuration?.methodsPath !== undefined)\n import(\n /* webpackChunkName: \"api-methods-[request]\" */ `/api/methods/${functionName}.ts`\n )\n\n .then(storeMethodAndResolve)\n .catch(notFound);\n else notFound();\n });\n }\n } catch (e) {\n console.error(e);\n handler.reset();\n handler.setError({\n type: 'danger',\n message: 'Error while loading current method.',\n });\n }\n });\n}\n\nexport function isForm(\n responseObject: Record<string, unknown>,\n): responseObject is TApiaLoad {\n return (\n typeof responseObject.canClose === 'boolean' &&\n typeof responseObject.type === 'string' &&\n !!responseObject.form\n );\n}\n\nexport function isFunction(\n responseObject: Record<string, unknown>,\n): responseObject is TApiaLoad<TApiaFunction> {\n return (\n typeof responseObject.canClose === 'boolean' &&\n typeof responseObject.type === 'string' &&\n !!responseObject.function\n );\n}\n\nfunction isMessage(\n responseObject: Record<string, unknown>,\n): responseObject is TApiaLoad<TApiaLoadText> {\n if (\n typeof responseObject.canClose === 'boolean' &&\n typeof responseObject.type === 'string' &&\n typeof responseObject.text === 'object' &&\n responseObject.text &&\n typeof (responseObject.text as Record<string, unknown>).label === 'string'\n ) {\n return true;\n }\n return false;\n}\n\nexport interface IModalConfig {\n modalTitle?: string;\n onClose?: () => void;\n onMessage?: (message: Record<string, unknown>) => unknown;\n onMessageClose?: () => unknown;\n onSubmitted?: (\n handler: TApiaApiMethodHandler,\n response: AxiosResponse<Record<string, unknown> | null> | null,\n ) => unknown;\n}\n\nconst modalConfigurationHandler = new WithEventsValue<THandleConfiguration>();\n\nfunction useModalConfiguration() {\n const [, setValue, value] = useStateRef<THandleConfiguration | undefined>(\n undefined,\n );\n\n const handleChange = React.useCallback(\n (newEventsHandler: THandleConfiguration | undefined) => {\n setValue(newEventsHandler);\n },\n [setValue],\n );\n\n useMount(() => {\n modalConfigurationHandler.on('update', handleChange);\n });\n\n useUnmount(() => {\n return modalConfigurationHandler.off('update', handleChange);\n });\n\n return value;\n}\n\ntype THandleConfiguration = Partial<\n Pick<IApiaApiRequestConfig<unknown>, 'modalConfiguration' | 'methodsPath'>\n>;\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nlet currentForm: TApiaLoad | undefined;\nconst currentFormDispatcher =\n new (class currentFormDispatcher extends EventEmitter<{\n form: TApiaLoad;\n }> {\n emit<K extends 'form'>(\n eventName: K,\n params?: { form: TApiaLoad }[K] | undefined,\n ): void {\n super.emit(eventName, params);\n currentForm = params;\n }\n })();\n\nexport function handle(\n responseObject: Record<string, unknown>,\n currentUrl: string,\n configuration: THandleConfiguration,\n) {\n modalConfigurationHandler.value = configuration;\n if (isForm(responseObject)) {\n currentFormDispatcher.emit('form', responseObject);\n return true;\n }\n if (isFunction(responseObject)) {\n FunctionsDispatcher.emit('method', {\n name: responseObject.function.name,\n props: {\n messages: responseObject.function.messages,\n attributes: responseObject.function,\n currentUrl,\n },\n });\n return true;\n }\n if (isMessage(responseObject)) {\n ApiaApiMessenger.emit('message', {\n predicate: responseObject.text.content,\n title: responseObject.text.title,\n });\n return true;\n }\n return false;\n}\n\nexport interface IApiaApiHandlerState {\n disabled: boolean;\n isLoading: boolean;\n isMultipart: boolean;\n progress: number;\n errors: Record<string, string>;\n windowIndex: number;\n}\n\nconst initialState: Omit<IApiaApiHandlerState, 'windowIndex'> = {\n disabled: false,\n isLoading: false,\n isMultipart: false,\n progress: 0,\n errors: {},\n};\n\nconst ApiaApiHandlerNonMemoized = () => {\n const configuration = useModalConfiguration();\n\n const [state, setState] = React.useState<IApiaApiHandlerState>({\n ...initialState,\n windowIndex: -1,\n });\n\n const [currentForm, setCurrentForm] = React.useState<TApiaLoad | undefined>(\n undefined,\n );\n React.useEffect(() => {\n return currentFormDispatcher.on('form', setCurrentForm);\n }, []);\n\n const setValue = React.useCallback((name: string, value: string) => {\n return validationsStore.setFieldValue(apiaApiForm, name, value);\n }, []);\n\n React.useEffect(() => {\n if (!currentForm) return;\n const elements = arrayOrArray(currentForm?.form?.elements?.element ?? []);\n\n let isMultipart = false;\n const elementsValues = Object.values(elements);\n let i = 0;\n while (i < elementsValues.length && !isMultipart) {\n if (elementsValues[i++].type === 'file') {\n isMultipart = true;\n }\n }\n\n setState((currentState) => {\n return {\n ...currentState,\n ...initialState,\n isMultipart,\n };\n });\n }, [currentForm]);\n\n const { show, onClose, ...modalProps } = useModal();\n\n const close = React.useCallback(() => {\n onClose();\n currentFormDispatcher.emit('form', undefined);\n setState((currentState) => {\n return { ...currentState, ...initialState };\n });\n if (configuration.current?.modalConfiguration?.onClose)\n configuration.current.modalConfiguration.onClose();\n\n validationsStore.unregisterForm(apiaApiForm);\n }, [onClose, configuration]);\n\n const modalRef = React.useRef<HTMLDivElement>(null);\n\n React.useEffect(() => {\n const elements = modalRef.current?.querySelectorAll(\n 'a,input,textarea,button',\n );\n if (elements?.length === 1)\n void focus.on(([...elements] as HTMLElement[])[0]);\n });\n\n const setError = React.useCallback(\n (notification: Parameters<typeof notify>[0]) => {\n notify({ ...notification });\n },\n [],\n );\n\n const getHandler = React.useCallback(() => {\n const newHandler: TApiaApiMethodHandler = {\n alert,\n close,\n configuration: configuration.current,\n formDefinition: currentForm as TApiaLoad,\n reset: () => {\n return setState((currentState) => {\n return {\n ...currentState,\n ...initialState,\n };\n });\n },\n setError,\n setMessage: (message) => {\n if (configuration.current?.modalConfiguration?.onMessage)\n configuration.current.modalConfiguration.onMessage(message);\n },\n setState,\n state,\n setValue,\n };\n return newHandler;\n }, [close, configuration, currentForm, setError, state, setValue]);\n\n React.useEffect(() => {\n const handleFunction = async ({\n name,\n props: { messages, attributes, currentUrl },\n }: TMethod) => {\n const method = await getFunction(`${name}`, getHandler());\n if (method) {\n method({ messages, attributes, currentUrl });\n }\n };\n\n const handleMessage = (ev: TMessage) => {\n const handler = getHandler();\n notify({\n message: ev.predicate,\n type: 'warning',\n onClose: handler.configuration?.modalConfiguration?.onMessageClose,\n });\n const onMessage = handler.configuration?.modalConfiguration?.onMessage;\n if (onMessage) onMessage(ev);\n };\n\n const handleAction = async (\n action: TModify<TApiaAction, { param: string[] }>,\n ) => {\n if (action.toDo === 'ajaxHiddeAll') {\n close();\n }\n if (action.toDo === 'functionTimedCall') {\n const method = await getFunction(\n arrayOrArray(action.param)[1],\n getHandler(),\n );\n\n if (method)\n /*\n * Aquí el timeout se utiliza debido a que Apia lo establece de esa\n * forma,\n * Existe un retorno de Apia llamado functionTimedCall que\n * espera que una función se ejecute luego de un timeout, y\n * yo solamente respeté dicho comportamiento. */\n setTimeout(() => {\n return method({\n currentUrl: currentForm?.form.action ?? 'noUrl',\n });\n }, Number(action.param[0]));\n }\n };\n\n ApiaApiMessenger.on('message', handleMessage);\n FunctionsDispatcher.on('method', handleFunction);\n ApiaActions.on('action', handleAction);\n\n return () => {\n ApiaApiMessenger.off('message', handleMessage);\n FunctionsDispatcher.off('method', handleFunction);\n ApiaActions.off('action', handleAction);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [state.windowIndex, onClose, close]);\n\n React.useEffect(() => {\n if (currentForm) {\n show();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [currentForm]);\n\n const handler = getHandler();\n\n const formRef = React.useCallback(\n async (el: HTMLElement) => {\n if (el && currentForm?.form.onLoad) {\n const method = await getFunction(\n `${currentForm?.form.onLoad}`,\n getHandler(),\n );\n if (method) {\n method();\n }\n }\n },\n [currentForm?.form.onLoad, getHandler],\n );\n\n return (\n <ApiaApiContext id={apiaApiForm}>\n <Modal\n ref={modalRef}\n onClose={close}\n id={apiaApiForm}\n title={\n configuration.current?.modalConfiguration?.modalTitle ??\n currentForm?.form.title\n }\n size=\"md-fixed\"\n shouldCloseOnEsc={!state.disabled}\n shouldCloseOnOverlayClick={!state.disabled}\n initialFocusGetter={React.useCallback((ref: HTMLElement) => {\n return ref?.querySelector(focusSelector) as HTMLElement;\n }, [])}\n {...modalProps}\n >\n {currentForm && (\n <Box {...getVariant('layout.common.modals.apiaApi')}>\n <Form\n name={apiaApiForm}\n avoidFieldsOverride\n className=\"handler__form\"\n >\n <ApiaApiFieldsContainer definition={currentForm} {...handler} />\n {state.isMultipart && state.progress > 0 && (\n <Box className=\"progressBox\">\n <ProgressBar\n id=\"ApiaApiHandler progress\"\n progress={state.progress}\n loading\n />\n </Box>\n )}\n <Box ref={formRef} />\n <ApiaApiButtonsContainer definition={currentForm} {...handler} />\n </Form>\n </Box>\n )}\n </Modal>\n </ApiaApiContext>\n );\n};\n\nexport const ApiaApiHandler = React.memo(ApiaApiHandlerNonMemoized);\n"],"names":["ApiaApiId","createContext","ApiaApiContext","children","id","jsx","React","J","z","H","C","v","O","E","e","o","n","g","u","I","t","R","a","r","l","i","d","s","debugDispatcher","_0","__async","text","result","parseXmlAsync","defaultConfig","STORED_CONFIG","forcedConfig","storedConfig","getConfig","outerBehaveConfig","merge","makeUrl","url","queryData","stringifyOptions","finalUrl","questionMarkIndex","parsedUrl","QueryString","getURLActionName","_a","actionIdx","ApiaActions","EventEmitter","getColor","color","colors","handleWrongResponse","error","errorMessage","notify","isJsonResponse","response","isXmlResponse","isHtmlResponse","handleActions","actions","_b","arrayOrArray","action","__spreadProps","__spreadValues","handleOnClose","exceptions","onClose","sysExceptions","sysMessages","func","notificationsObject","getNotificationMessageObj","notification","parseMessages","dispatchNotifications","parseSuccessfulResponse","_1","_2","currentUrl","behaveConfig","parsedObj","validateResult","load","rest","__objRest","session","handle","handleResponse","parsedResponse","post","par1","par2","actualUrl","makeApiaUrl","configParameter","queryString","axios","get","ApiaApi","props","_c","actualQueryData","actualAjaxUrl","match","currentTokenId","tabId","CONTEXT","ApiaApiCheckbox","element","className","validationRules","classToValidate","submitValueParser","value","Checkbox","ApiaApiFileInput","FileInput","T","f","b","h","x","m","ApiaApiInput","getModal","path","resolve","Submodal","setSubmodal","useMount","found","modalName","validationFunction","classToValidationFunction","encrypt","Input","c","A","ApiaApiRadio","options","currOption","Radio","y","M","p","ApiaApiSelect","initialValue","useMemo","_d","current","Select","S","N","k","ApiaApiFieldsContainer","elements","sections","removeEndingSpacers","sectionElements","sectionIndexes","index","sectionIndex","arrayIndex","start","end","renderSectionContent","isVisible","Box","getFunction","onChangeMethod","elementKey","uniqueId","data","getVariant","jsxs","column","row","cell","section","NonMemoizedApiaApiButtonsContainer","_e","buttons","modalConfiguration","methodsPath","apiaApiForm","useFormContext","renderButton","button","key","buttonType","onClick","validationResult","validationsStore","hasSucceedFormValidation","submitValues","formData","name","accumulated","retValue","iter","__forAwait","more","temp","method","SimpleButton","currentButton","ApiaApiButtonsContainer","Z","j","W","_","K","ApiaApiMessenger","FunctionsDispatcher","methods","handler","separateNameFromParametersRegex","functionName","parameters","storeMethodAndResolve","notFound","argument","isForm","responseObject","isFunction","isMessage","modalConfigurationHandler","WithEventsValue","useModalConfiguration","setValue","useStateRef","handleChange","newEventsHandler","useUnmount","currentFormDispatcher","eventName","params","configuration","initialState","ApiaApiHandlerNonMemoized","state","setState","currentForm","setCurrentForm","isMultipart","elementsValues","currentState","useModal","show","modalProps","close","modalRef","focus","setError","getHandler","message","handleFunction","messages","attributes","handleMessage","ev","onMessage","hand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AA,CAAAA,EAdL,CAgBE,SAAAP,GACCrP,EAAC0K,EAAAzG,EAAAC,EAAA,CAAA,EAAQ8G,GAAW,8BAA8B,CAAjD,EAAA,CACC,SAAAC,GAAC8F,GAAA,CACC,KAAMpF,EACN,oBAAmB,GACnB,UAAU,gBAEV,SAAA3L,CAAAA,EAAC6J,GAAA3F,EAAA,CAAuB,WAAYmL,GAAiB3B,CAAS,CAAA,EAC7DyB,EAAM,aAAeA,EAAM,SAAW,GACrCnP,EAAC0K,EAAA,CAAI,UAAU,cACb,SAAA1K,EAACgR,GAAA,CACC,GAAG,0BACH,SAAU7B,EAAM,SAChB,QAAO,EAAA,CACT,EACF,EAEFnP,EAAC0K,EAAA,CAAI,IAAKgG,CAAS,CAAA,EACnB1Q,EAACiN,GAAA/I,EAAA,CAAwB,WAAYmL,CAAAA,EAAiB3B,EAAS,CACjE,CAAA,CAAA,CAAA,CAAA,CACF,CAEJ,CAAA,CAAA,CAAA,CACF,CAEJ,EAEauD,GAAiBhR,EAAM,KAAKiP,EAAyB"}
|
package/package.json
CHANGED
|
@@ -6,20 +6,33 @@
|
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"main": "./dist/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.1.1",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "rollup -c rollup.config.esb.mjs",
|
|
12
|
+
"buildDev": "rollup -c rollup.config.esb.mjs --dev",
|
|
13
|
+
"watch": "rollup -c rollup.config.esb.mjs --dev --watch"
|
|
14
|
+
},
|
|
10
15
|
"dependencies": {
|
|
11
|
-
"@apia/components": "^0.
|
|
12
|
-
"@apia/notifications": "^0.
|
|
13
|
-
"@apia/theme": "^0.
|
|
14
|
-
"@apia/util": "^0.
|
|
15
|
-
"@apia/validations": "^0.
|
|
16
|
+
"@apia/components": "^0.1.1",
|
|
17
|
+
"@apia/notifications": "^0.1.0",
|
|
18
|
+
"@apia/theme": "^0.1.0",
|
|
19
|
+
"@apia/util": "^0.1.0",
|
|
20
|
+
"@apia/validations": "^0.1.1",
|
|
16
21
|
"axios": "^1.3.4",
|
|
17
22
|
"lodash": "^4.17.21"
|
|
18
23
|
},
|
|
19
24
|
"devDependencies": {
|
|
25
|
+
"@rollup/plugin-commonjs": "^24.0.1",
|
|
26
|
+
"@rollup/plugin-json": "^6.0.0",
|
|
27
|
+
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
28
|
+
"@rollup/plugin-terser": "^0.4.0",
|
|
29
|
+
"@rollup/plugin-typescript": "^11.0.0",
|
|
20
30
|
"@types/lodash": "^4.14.192",
|
|
21
|
-
"
|
|
22
|
-
"
|
|
31
|
+
"esbuild": "^0.17.14",
|
|
32
|
+
"rollup": "^3.20.2",
|
|
33
|
+
"rollup-plugin-bundle-analyzer": "^1.6.6",
|
|
34
|
+
"rollup-plugin-dts": "^5.3.0",
|
|
35
|
+
"rollup-plugin-esbuild": "^5.0.0",
|
|
23
36
|
"typescript": "^4.9.5"
|
|
24
37
|
},
|
|
25
38
|
"peerDependencies": {
|
|
@@ -37,8 +50,5 @@
|
|
|
37
50
|
"url": "http://corp-gitlab-01.domst.st.net/products/apia/ApiaNPMPackages.git",
|
|
38
51
|
"directory": "packages/api"
|
|
39
52
|
},
|
|
40
|
-
"
|
|
41
|
-
"build": "tsup"
|
|
42
|
-
},
|
|
43
|
-
"gitHead": "44a7f4d12bba024c862a7a811b79547c6a8030b1"
|
|
53
|
+
"gitHead": "343436abba216f66589148f813e0f1cb9c40441d"
|
|
44
54
|
}
|