Sandrine Guétin
Version propre de DeepVest
2106f78
raw
history blame
42.4 kB
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ 540:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
if (true) {
/* unused reexport */ __webpack_require__(869);
} else {}
/***/ }),
/***/ 698:
/***/ ((__unused_webpack_module, exports) => {
var __webpack_unused_export__;
/**
* @license React
* react-jsx-runtime.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
function jsxProd(type, config, maybeKey) {
var key = null;
void 0 !== maybeKey && (key = "" + maybeKey);
void 0 !== config.key && (key = "" + config.key);
if ("key" in config) {
maybeKey = {};
for (var propName in config)
"key" !== propName && (maybeKey[propName] = config[propName]);
} else maybeKey = config;
config = maybeKey.ref;
return {
$$typeof: REACT_ELEMENT_TYPE,
type: type,
key: key,
ref: void 0 !== config ? config : null,
props: maybeKey
};
}
__webpack_unused_export__ = REACT_FRAGMENT_TYPE;
__webpack_unused_export__ = jsxProd;
__webpack_unused_export__ = jsxProd;
/***/ }),
/***/ 848:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
if (true) {
/* unused reexport */ __webpack_require__(698);
} else {}
/***/ }),
/***/ 869:
/***/ ((__unused_webpack_module, exports) => {
var __webpack_unused_export__;
/**
* @license React
* react.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
REACT_PORTAL_TYPE = Symbol.for("react.portal"),
REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
REACT_CONTEXT_TYPE = Symbol.for("react.context"),
REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
REACT_MEMO_TYPE = Symbol.for("react.memo"),
REACT_LAZY_TYPE = Symbol.for("react.lazy"),
MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
function getIteratorFn(maybeIterable) {
if (null === maybeIterable || "object" !== typeof maybeIterable) return null;
maybeIterable =
(MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) ||
maybeIterable["@@iterator"];
return "function" === typeof maybeIterable ? maybeIterable : null;
}
var ReactNoopUpdateQueue = {
isMounted: function () {
return !1;
},
enqueueForceUpdate: function () {},
enqueueReplaceState: function () {},
enqueueSetState: function () {}
},
assign = Object.assign,
emptyObject = {};
function Component(props, context, updater) {
this.props = props;
this.context = context;
this.refs = emptyObject;
this.updater = updater || ReactNoopUpdateQueue;
}
Component.prototype.isReactComponent = {};
Component.prototype.setState = function (partialState, callback) {
if (
"object" !== typeof partialState &&
"function" !== typeof partialState &&
null != partialState
)
throw Error(
"takes an object of state variables to update or a function which returns an object of state variables."
);
this.updater.enqueueSetState(this, partialState, callback, "setState");
};
Component.prototype.forceUpdate = function (callback) {
this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
};
function ComponentDummy() {}
ComponentDummy.prototype = Component.prototype;
function PureComponent(props, context, updater) {
this.props = props;
this.context = context;
this.refs = emptyObject;
this.updater = updater || ReactNoopUpdateQueue;
}
var pureComponentPrototype = (PureComponent.prototype = new ComponentDummy());
pureComponentPrototype.constructor = PureComponent;
assign(pureComponentPrototype, Component.prototype);
pureComponentPrototype.isPureReactComponent = !0;
var isArrayImpl = Array.isArray,
ReactSharedInternals = { H: null, A: null, T: null, S: null },
hasOwnProperty = Object.prototype.hasOwnProperty;
function ReactElement(type, key, self, source, owner, props) {
self = props.ref;
return {
$$typeof: REACT_ELEMENT_TYPE,
type: type,
key: key,
ref: void 0 !== self ? self : null,
props: props
};
}
function cloneAndReplaceKey(oldElement, newKey) {
return ReactElement(
oldElement.type,
newKey,
void 0,
void 0,
void 0,
oldElement.props
);
}
function isValidElement(object) {
return (
"object" === typeof object &&
null !== object &&
object.$$typeof === REACT_ELEMENT_TYPE
);
}
function escape(key) {
var escaperLookup = { "=": "=0", ":": "=2" };
return (
"$" +
key.replace(/[=:]/g, function (match) {
return escaperLookup[match];
})
);
}
var userProvidedKeyEscapeRegex = /\/+/g;
function getElementKey(element, index) {
return "object" === typeof element && null !== element && null != element.key
? escape("" + element.key)
: index.toString(36);
}
function noop$1() {}
function resolveThenable(thenable) {
switch (thenable.status) {
case "fulfilled":
return thenable.value;
case "rejected":
throw thenable.reason;
default:
switch (
("string" === typeof thenable.status
? thenable.then(noop$1, noop$1)
: ((thenable.status = "pending"),
thenable.then(
function (fulfilledValue) {
"pending" === thenable.status &&
((thenable.status = "fulfilled"),
(thenable.value = fulfilledValue));
},
function (error) {
"pending" === thenable.status &&
((thenable.status = "rejected"), (thenable.reason = error));
}
)),
thenable.status)
) {
case "fulfilled":
return thenable.value;
case "rejected":
throw thenable.reason;
}
}
throw thenable;
}
function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
var type = typeof children;
if ("undefined" === type || "boolean" === type) children = null;
var invokeCallback = !1;
if (null === children) invokeCallback = !0;
else
switch (type) {
case "bigint":
case "string":
case "number":
invokeCallback = !0;
break;
case "object":
switch (children.$$typeof) {
case REACT_ELEMENT_TYPE:
case REACT_PORTAL_TYPE:
invokeCallback = !0;
break;
case REACT_LAZY_TYPE:
return (
(invokeCallback = children._init),
mapIntoArray(
invokeCallback(children._payload),
array,
escapedPrefix,
nameSoFar,
callback
)
);
}
}
if (invokeCallback)
return (
(callback = callback(children)),
(invokeCallback =
"" === nameSoFar ? "." + getElementKey(children, 0) : nameSoFar),
isArrayImpl(callback)
? ((escapedPrefix = ""),
null != invokeCallback &&
(escapedPrefix =
invokeCallback.replace(userProvidedKeyEscapeRegex, "$&/") + "/"),
mapIntoArray(callback, array, escapedPrefix, "", function (c) {
return c;
}))
: null != callback &&
(isValidElement(callback) &&
(callback = cloneAndReplaceKey(
callback,
escapedPrefix +
(null == callback.key ||
(children && children.key === callback.key)
? ""
: ("" + callback.key).replace(
userProvidedKeyEscapeRegex,
"$&/"
) + "/") +
invokeCallback
)),
array.push(callback)),
1
);
invokeCallback = 0;
var nextNamePrefix = "" === nameSoFar ? "." : nameSoFar + ":";
if (isArrayImpl(children))
for (var i = 0; i < children.length; i++)
(nameSoFar = children[i]),
(type = nextNamePrefix + getElementKey(nameSoFar, i)),
(invokeCallback += mapIntoArray(
nameSoFar,
array,
escapedPrefix,
type,
callback
));
else if (((i = getIteratorFn(children)), "function" === typeof i))
for (
children = i.call(children), i = 0;
!(nameSoFar = children.next()).done;
)
(nameSoFar = nameSoFar.value),
(type = nextNamePrefix + getElementKey(nameSoFar, i++)),
(invokeCallback += mapIntoArray(
nameSoFar,
array,
escapedPrefix,
type,
callback
));
else if ("object" === type) {
if ("function" === typeof children.then)
return mapIntoArray(
resolveThenable(children),
array,
escapedPrefix,
nameSoFar,
callback
);
array = String(children);
throw Error(
"Objects are not valid as a React child (found: " +
("[object Object]" === array
? "object with keys {" + Object.keys(children).join(", ") + "}"
: array) +
"). If you meant to render a collection of children, use an array instead."
);
}
return invokeCallback;
}
function mapChildren(children, func, context) {
if (null == children) return children;
var result = [],
count = 0;
mapIntoArray(children, result, "", "", function (child) {
return func.call(context, child, count++);
});
return result;
}
function lazyInitializer(payload) {
if (-1 === payload._status) {
var ctor = payload._result;
ctor = ctor();
ctor.then(
function (moduleObject) {
if (0 === payload._status || -1 === payload._status)
(payload._status = 1), (payload._result = moduleObject);
},
function (error) {
if (0 === payload._status || -1 === payload._status)
(payload._status = 2), (payload._result = error);
}
);
-1 === payload._status && ((payload._status = 0), (payload._result = ctor));
}
if (1 === payload._status) return payload._result.default;
throw payload._result;
}
var reportGlobalError =
"function" === typeof reportError
? reportError
: function (error) {
if (
"object" === typeof window &&
"function" === typeof window.ErrorEvent
) {
var event = new window.ErrorEvent("error", {
bubbles: !0,
cancelable: !0,
message:
"object" === typeof error &&
null !== error &&
"string" === typeof error.message
? String(error.message)
: String(error),
error: error
});
if (!window.dispatchEvent(event)) return;
} else if (
"object" === typeof process &&
"function" === typeof process.emit
) {
process.emit("uncaughtException", error);
return;
}
console.error(error);
};
function noop() {}
__webpack_unused_export__ = {
map: mapChildren,
forEach: function (children, forEachFunc, forEachContext) {
mapChildren(
children,
function () {
forEachFunc.apply(this, arguments);
},
forEachContext
);
},
count: function (children) {
var n = 0;
mapChildren(children, function () {
n++;
});
return n;
},
toArray: function (children) {
return (
mapChildren(children, function (child) {
return child;
}) || []
);
},
only: function (children) {
if (!isValidElement(children))
throw Error(
"React.Children.only expected to receive a single React element child."
);
return children;
}
};
__webpack_unused_export__ = Component;
__webpack_unused_export__ = REACT_FRAGMENT_TYPE;
__webpack_unused_export__ = REACT_PROFILER_TYPE;
__webpack_unused_export__ = PureComponent;
__webpack_unused_export__ = REACT_STRICT_MODE_TYPE;
__webpack_unused_export__ = REACT_SUSPENSE_TYPE;
__webpack_unused_export__ =
ReactSharedInternals;
__webpack_unused_export__ = function () {
throw Error("act(...) is not supported in production builds of React.");
};
__webpack_unused_export__ = function (fn) {
return function () {
return fn.apply(null, arguments);
};
};
__webpack_unused_export__ = function (element, config, children) {
if (null === element || void 0 === element)
throw Error(
"The argument must be a React element, but you passed " + element + "."
);
var props = assign({}, element.props),
key = element.key,
owner = void 0;
if (null != config)
for (propName in (void 0 !== config.ref && (owner = void 0),
void 0 !== config.key && (key = "" + config.key),
config))
!hasOwnProperty.call(config, propName) ||
"key" === propName ||
"__self" === propName ||
"__source" === propName ||
("ref" === propName && void 0 === config.ref) ||
(props[propName] = config[propName]);
var propName = arguments.length - 2;
if (1 === propName) props.children = children;
else if (1 < propName) {
for (var childArray = Array(propName), i = 0; i < propName; i++)
childArray[i] = arguments[i + 2];
props.children = childArray;
}
return ReactElement(element.type, key, void 0, void 0, owner, props);
};
__webpack_unused_export__ = function (defaultValue) {
defaultValue = {
$$typeof: REACT_CONTEXT_TYPE,
_currentValue: defaultValue,
_currentValue2: defaultValue,
_threadCount: 0,
Provider: null,
Consumer: null
};
defaultValue.Provider = defaultValue;
defaultValue.Consumer = {
$$typeof: REACT_CONSUMER_TYPE,
_context: defaultValue
};
return defaultValue;
};
__webpack_unused_export__ = function (type, config, children) {
var propName,
props = {},
key = null;
if (null != config)
for (propName in (void 0 !== config.key && (key = "" + config.key), config))
hasOwnProperty.call(config, propName) &&
"key" !== propName &&
"__self" !== propName &&
"__source" !== propName &&
(props[propName] = config[propName]);
var childrenLength = arguments.length - 2;
if (1 === childrenLength) props.children = children;
else if (1 < childrenLength) {
for (var childArray = Array(childrenLength), i = 0; i < childrenLength; i++)
childArray[i] = arguments[i + 2];
props.children = childArray;
}
if (type && type.defaultProps)
for (propName in ((childrenLength = type.defaultProps), childrenLength))
void 0 === props[propName] &&
(props[propName] = childrenLength[propName]);
return ReactElement(type, key, void 0, void 0, null, props);
};
__webpack_unused_export__ = function () {
return { current: null };
};
__webpack_unused_export__ = function (render) {
return { $$typeof: REACT_FORWARD_REF_TYPE, render: render };
};
__webpack_unused_export__ = isValidElement;
__webpack_unused_export__ = function (ctor) {
return {
$$typeof: REACT_LAZY_TYPE,
_payload: { _status: -1, _result: ctor },
_init: lazyInitializer
};
};
__webpack_unused_export__ = function (type, compare) {
return {
$$typeof: REACT_MEMO_TYPE,
type: type,
compare: void 0 === compare ? null : compare
};
};
__webpack_unused_export__ = function (scope) {
var prevTransition = ReactSharedInternals.T,
currentTransition = {};
ReactSharedInternals.T = currentTransition;
try {
var returnValue = scope(),
onStartTransitionFinish = ReactSharedInternals.S;
null !== onStartTransitionFinish &&
onStartTransitionFinish(currentTransition, returnValue);
"object" === typeof returnValue &&
null !== returnValue &&
"function" === typeof returnValue.then &&
returnValue.then(noop, reportGlobalError);
} catch (error) {
reportGlobalError(error);
} finally {
ReactSharedInternals.T = prevTransition;
}
};
__webpack_unused_export__ = function () {
return ReactSharedInternals.H.useCacheRefresh();
};
__webpack_unused_export__ = function (usable) {
return ReactSharedInternals.H.use(usable);
};
__webpack_unused_export__ = function (action, initialState, permalink) {
return ReactSharedInternals.H.useActionState(action, initialState, permalink);
};
__webpack_unused_export__ = function (callback, deps) {
return ReactSharedInternals.H.useCallback(callback, deps);
};
__webpack_unused_export__ = function (Context) {
return ReactSharedInternals.H.useContext(Context);
};
__webpack_unused_export__ = function () {};
__webpack_unused_export__ = function (value, initialValue) {
return ReactSharedInternals.H.useDeferredValue(value, initialValue);
};
__webpack_unused_export__ = function (create, deps) {
return ReactSharedInternals.H.useEffect(create, deps);
};
__webpack_unused_export__ = function () {
return ReactSharedInternals.H.useId();
};
__webpack_unused_export__ = function (ref, create, deps) {
return ReactSharedInternals.H.useImperativeHandle(ref, create, deps);
};
__webpack_unused_export__ = function (create, deps) {
return ReactSharedInternals.H.useInsertionEffect(create, deps);
};
__webpack_unused_export__ = function (create, deps) {
return ReactSharedInternals.H.useLayoutEffect(create, deps);
};
__webpack_unused_export__ = function (create, deps) {
return ReactSharedInternals.H.useMemo(create, deps);
};
__webpack_unused_export__ = function (passthrough, reducer) {
return ReactSharedInternals.H.useOptimistic(passthrough, reducer);
};
__webpack_unused_export__ = function (reducer, initialArg, init) {
return ReactSharedInternals.H.useReducer(reducer, initialArg, init);
};
__webpack_unused_export__ = function (initialValue) {
return ReactSharedInternals.H.useRef(initialValue);
};
__webpack_unused_export__ = function (initialState) {
return ReactSharedInternals.H.useState(initialState);
};
__webpack_unused_export__ = function (
subscribe,
getSnapshot,
getServerSnapshot
) {
return ReactSharedInternals.H.useSyncExternalStore(
subscribe,
getSnapshot,
getServerSnapshot
);
};
__webpack_unused_export__ = function () {
return ReactSharedInternals.H.useTransition();
};
__webpack_unused_export__ = "19.0.0";
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
var __webpack_exports__ = {};
// UNUSED EXPORTS: default
// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js
var jsx_runtime = __webpack_require__(848);
// EXTERNAL MODULE: ./node_modules/react/index.js
var react = __webpack_require__(540);
;// ./src/interface/components/UserProfileForm.tsx
var __assign = (undefined && undefined.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (undefined && undefined.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var __spreadArray = (undefined && undefined.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
var UserProfileForm_UserProfileForm = function (_a) {
var onSubmit = _a.onSubmit;
var _b = useState({
age: '',
annual_income: '',
monthly_savings: '',
family_status: 'single',
dependents: 0,
risk_tolerance: 3,
investment_horizon: 5,
financial_knowledge: 3,
income_stability: 3,
investment_goals: [],
life_events: [],
investment_preferences: {
esg: false,
crypto: false,
real_estate: false,
alternative: false
},
total_assets: '',
total_debt: ''
}), formData = _b[0], setFormData = _b[1];
var _c = useState(''), error = _c[0], setError = _c[1];
var _d = useState(false), success = _d[0], setSuccess = _d[1];
// Options pour les sélections
var investmentGoals = [
'Retraite',
'Achat immobilier',
'Études enfants',
'Création entreprise',
'Épargne générale',
'Revenus passifs',
'Croissance patrimoine'
];
var lifeEvents = [
'Mariage prévu',
'Naissance attendue',
'Changement emploi',
'Déménagement',
'Héritage attendu',
'Projet entrepreneurial'
];
var handleChange = function (e) {
var _a = e.target, name = _a.name, value = _a.value, type = _a.type;
var checked = type === 'checkbox' ? e.target.checked : undefined;
if (name.startsWith('investment_preferences.')) {
var preference_1 = name.split('.')[1];
setFormData(function (prev) {
var _a;
return (__assign(__assign({}, prev), { investment_preferences: __assign(__assign({}, prev.investment_preferences), (_a = {}, _a[preference_1] = checked, _a)) }));
});
return;
}
if (type === 'checkbox') {
var array_1 = name === 'investment_goals' ? 'investment_goals' : 'life_events';
setFormData(function (prev) {
var _a;
return (__assign(__assign({}, prev), (_a = {}, _a[array_1] = checked
? __spreadArray(__spreadArray([], prev[array_1], true), [value], false) : prev[array_1].filter(function (item) { return item !== value; }), _a)));
});
return;
}
setFormData(function (prev) {
var _a;
return (__assign(__assign({}, prev), (_a = {}, _a[name] = value, _a)));
});
};
var handleSubmit = function (e) { return __awaiter(void 0, void 0, void 0, function () {
var err_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
e.preventDefault();
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
setError('');
setSuccess(false);
if (parseInt(formData.age) < 18) {
setError('Vous devez avoir au moins 18 ans');
return [2 /*return*/];
}
return [4 /*yield*/, onSubmit(formData)];
case 2:
_a.sent();
setSuccess(true);
return [3 /*break*/, 4];
case 3:
err_1 = _a.sent();
setError(err_1 instanceof Error ? err_1.message : 'Une erreur est survenue');
return [3 /*break*/, 4];
case 4: return [2 /*return*/];
}
});
}); };
return (_jsx("div", { className: "max-w-4xl mx-auto bg-white shadow-lg rounded-lg", children: _jsxs("div", { className: "p-6", children: [_jsx("h2", { className: "text-2xl font-semibold mb-6", children: "Votre Profil Investisseur" }), _jsxs("form", { onSubmit: handleSubmit, className: "space-y-8", children: [_jsxs("div", { children: [_jsx("h3", { className: "text-lg font-medium mb-4", children: "Informations personnelles" }), _jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [_jsx("div", { children: _jsxs("label", { className: "block text-sm font-medium mb-1", children: ["\u00C2ge", _jsx("input", { type: "number", name: "age", value: formData.age, onChange: handleChange, className: "mt-1 block w-full rounded", required: true })] }) }), _jsx("div", { children: _jsxs("label", { className: "block text-sm font-medium mb-1", children: ["Revenu annuel (\u20AC)", _jsx("input", { type: "number", name: "annual_income", value: formData.annual_income, onChange: handleChange, className: "mt-1 block w-full rounded", required: true })] }) }), _jsx("div", { children: _jsxs("label", { className: "block text-sm font-medium mb-1", children: ["Situation familiale", _jsxs("select", { name: "family_status", value: formData.family_status, onChange: handleChange, className: "mt-1 block w-full rounded", children: [_jsx("option", { value: "single", children: "C\u00E9libataire" }), _jsx("option", { value: "married", children: "Mari\u00E9(e)" }), _jsx("option", { value: "divorced", children: "Divorc\u00E9(e)" }), _jsx("option", { value: "widowed", children: "Veuf/Veuve" })] })] }) }), _jsx("div", { children: _jsxs("label", { className: "block text-sm font-medium mb-1", children: ["Personnes \u00E0 charge", _jsx("input", { type: "number", name: "dependents", value: formData.dependents, onChange: handleChange, min: "0", className: "mt-1 block w-full rounded" })] }) })] })] }), _jsxs("div", { children: [_jsx("h3", { className: "text-lg font-medium mb-4", children: "Profil d'investissement" }), _jsxs("div", { className: "space-y-4", children: [_jsx("div", { children: _jsxs("label", { className: "block text-sm font-medium mb-1", children: ["Tol\u00E9rance au risque (1-5)", _jsx("input", { type: "range", name: "risk_tolerance", min: "1", max: "5", value: formData.risk_tolerance, onChange: handleChange, className: "w-full" }), _jsxs("div", { className: "flex justify-between text-xs", children: [_jsx("span", { children: "Tr\u00E8s prudent" }), _jsx("span", { children: "\u00C9quilibr\u00E9" }), _jsx("span", { children: "Dynamique" })] })] }) }), _jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [_jsx("div", { children: _jsxs("label", { className: "block text-sm font-medium mb-1", children: ["Horizon d'investissement (ann\u00E9es)", _jsx("input", { type: "number", name: "investment_horizon", value: formData.investment_horizon, onChange: handleChange, className: "mt-1 block w-full rounded", min: "1" })] }) }), _jsx("div", { children: _jsxs("label", { className: "block text-sm font-medium mb-1", children: ["Niveau de connaissance financi\u00E8re (1-5)", _jsx("input", { type: "range", name: "financial_knowledge", min: "1", max: "5", value: formData.financial_knowledge, onChange: handleChange, className: "w-full" })] }) })] })] })] }), _jsxs("div", { children: [_jsx("h3", { className: "text-lg font-medium mb-4", children: "Objectifs et \u00E9v\u00E9nements de vie" }), _jsxs("div", { className: "mb-4", children: [_jsx("label", { className: "block text-sm font-medium mb-2", children: "Objectifs d'investissement" }), _jsx("div", { className: "grid grid-cols-2 gap-2", children: investmentGoals.map(function (goal) { return (_jsxs("label", { className: "flex items-center space-x-2", children: [_jsx("input", { type: "checkbox", name: "investment_goals", value: goal, checked: formData.investment_goals.includes(goal), onChange: handleChange, className: "rounded" }), _jsx("span", { className: "text-sm", children: goal })] }, goal)); }) })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium mb-2", children: "\u00C9v\u00E9nements de vie pr\u00E9vus" }), _jsx("div", { className: "grid grid-cols-2 gap-2", children: lifeEvents.map(function (event) { return (_jsxs("label", { className: "flex items-center space-x-2", children: [_jsx("input", { type: "checkbox", name: "life_events", value: event, checked: formData.life_events.includes(event), onChange: handleChange, className: "rounded" }), _jsx("span", { className: "text-sm", children: event })] }, event)); }) })] })] }), _jsxs("div", { children: [_jsx("h3", { className: "text-lg font-medium mb-4", children: "Pr\u00E9f\u00E9rences d'investissement" }), _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("label", { className: "flex items-center space-x-2", children: [_jsx("input", { type: "checkbox", name: "investment_preferences.esg", checked: formData.investment_preferences.esg, onChange: handleChange, className: "rounded" }), _jsx("span", { className: "text-sm", children: "Investissement responsable (ESG)" })] }), _jsxs("label", { className: "flex items-center space-x-2", children: [_jsx("input", { type: "checkbox", name: "investment_preferences.crypto", checked: formData.investment_preferences.crypto, onChange: handleChange, className: "rounded" }), _jsx("span", { className: "text-sm", children: "Cryptomonnaies" })] }), _jsxs("label", { className: "flex items-center space-x-2", children: [_jsx("input", { type: "checkbox", name: "investment_preferences.real_estate", checked: formData.investment_preferences.real_estate, onChange: handleChange, className: "rounded" }), _jsx("span", { className: "text-sm", children: "Immobilier" })] }), _jsxs("label", { className: "flex items-center space-x-2", children: [_jsx("input", { type: "checkbox", name: "investment_preferences.alternative", checked: formData.investment_preferences.alternative, onChange: handleChange, className: "rounded" }), _jsx("span", { className: "text-sm", children: "Investissements alternatifs" })] })] })] }), error && (_jsx("div", { className: "bg-red-50 text-red-800 p-4 rounded-md", children: error })), success && (_jsx("div", { className: "bg-green-50 text-green-800 p-4 rounded-md", children: "Profil cr\u00E9\u00E9 avec succ\u00E8s!" })), _jsx("button", { type: "submit", className: "w-full bg-blue-600 text-white p-3 rounded-lg hover:bg-blue-700 transition-colors", children: "Cr\u00E9er mon profil" })] })] }) }));
};
/* harmony default export */ const components_UserProfileForm = ((/* unused pure expression or super */ null && (UserProfileForm_UserProfileForm)));
;// ./src/interface/components/AppContainer.tsx
var AppContainer_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var AppContainer_generator = (undefined && undefined.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var AppContainer = function () {
// État pour stocker le profil courant
var _a = useState(null), currentProfile = _a[0], setCurrentProfile = _a[1];
// État pour gérer le chargement
var _b = useState(false), isLoading = _b[0], setIsLoading = _b[1];
// État pour gérer les erreurs
var _c = useState(null), error = _c[0], setError = _c[1];
// Initialisation et écoute des événements Streamlit
useEffect(function () {
if (window.Streamlit) {
// Écouter les mises à jour de Streamlit
window.Streamlit.on('change', function (event) {
if (event.type === 'PROFILE_DATA') {
setCurrentProfile(event.data);
}
});
}
}, []);
// Gestionnaire de soumission du profil
var handleProfileSubmit = function (profileData) { return AppContainer_awaiter(void 0, void 0, void 0, function () {
return AppContainer_generator(this, function (_a) {
try {
setIsLoading(true);
setError(null);
// Validation supplémentaire des données
if (!validateProfileData(profileData)) {
throw new Error("Données de profil invalides");
}
// Mise à jour de l'état local
setCurrentProfile(profileData);
// Envoi des données à Streamlit
if (window.Streamlit) {
window.Streamlit.setComponentValue({
type: 'PROFILE_UPDATE',
data: profileData,
timestamp: new Date().toISOString()
});
}
setIsLoading(false);
}
catch (err) {
setError(err instanceof Error ? err.message : "Une erreur est survenue");
setIsLoading(false);
console.error('Error handling profile submission:', err);
}
return [2 /*return*/];
});
}); };
// Fonction de validation des données
var validateProfileData = function (data) {
if (parseInt(data.age) < 18)
return false;
if (parseInt(data.annual_income) < 0)
return false;
if (data.investment_goals.length === 0)
return false;
if (data.risk_tolerance < 1 || data.risk_tolerance > 5)
return false;
return true;
};
return (_jsx("div", { className: "min-h-screen bg-gray-50", children: _jsxs("div", { className: "max-w-7xl mx-auto px-4 py-8", children: [_jsxs("header", { className: "mb-8", children: [_jsx("h1", { className: "text-3xl font-bold text-gray-900", children: "DeepVest - Votre Assistant d'Investissement Personnalis\u00E9" }), currentProfile && (_jsxs("p", { className: "mt-2 text-gray-600", children: ["Profil cr\u00E9\u00E9 le ", new Date().toLocaleDateString()] }))] }), error && (_jsx("div", { className: "mb-6 bg-red-50 border-l-4 border-red-500 p-4", children: _jsxs("div", { className: "flex", children: [_jsx("div", { className: "flex-shrink-0", children: _jsx("svg", { className: "h-5 w-5 text-red-400", viewBox: "0 0 20 20", fill: "currentColor", children: _jsx("path", { fillRule: "evenodd", d: "M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z", clipRule: "evenodd" }) }) }), _jsx("div", { className: "ml-3", children: _jsx("p", { className: "text-sm text-red-700", children: error }) })] }) })), isLoading && (_jsx("div", { className: "flex justify-center items-center my-4", children: _jsx("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600" }) })), _jsx("div", { className: "bg-white shadow rounded-lg", children: _jsx(UserProfileForm, { onSubmit: handleProfileSubmit }) }), currentProfile && (_jsxs("div", { className: "mt-8 bg-white shadow rounded-lg p-6", children: [_jsx("h2", { className: "text-xl font-semibold mb-4", children: "Profil actuel" }), _jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [_jsxs("div", { children: [_jsx("h3", { className: "font-medium text-gray-900", children: "Informations personnelles" }), _jsxs("dl", { className: "mt-2 text-sm text-gray-600", children: [_jsxs("div", { className: "mt-1", children: [_jsx("dt", { className: "inline", children: "\u00C2ge:" }), _jsxs("dd", { className: "inline ml-1", children: [currentProfile.age, " ans"] })] }), _jsxs("div", { className: "mt-1", children: [_jsx("dt", { className: "inline", children: "Revenu annuel:" }), _jsxs("dd", { className: "inline ml-1", children: [parseInt(currentProfile.annual_income).toLocaleString(), "\u20AC"] })] }), _jsxs("div", { className: "mt-1", children: [_jsx("dt", { className: "inline", children: "Situation familiale:" }), _jsx("dd", { className: "inline ml-1", children: currentProfile.family_status })] })] })] }), _jsxs("div", { children: [_jsx("h3", { className: "font-medium text-gray-900", children: "Profil d'investissement" }), _jsxs("dl", { className: "mt-2 text-sm text-gray-600", children: [_jsxs("div", { className: "mt-1", children: [_jsx("dt", { className: "inline", children: "Tol\u00E9rance au risque:" }), _jsxs("dd", { className: "inline ml-1", children: [currentProfile.risk_tolerance, "/5"] })] }), _jsxs("div", { className: "mt-1", children: [_jsx("dt", { className: "inline", children: "Horizon:" }), _jsxs("dd", { className: "inline ml-1", children: [currentProfile.investment_horizon, " ans"] })] }), _jsxs("div", { className: "mt-1", children: [_jsx("dt", { className: "inline", children: "Objectifs:" }), _jsx("dd", { className: "inline ml-1", children: currentProfile.investment_goals.join(", ") })] })] })] })] })] }))] }) }));
};
/* harmony default export */ const components_AppContainer = ((/* unused pure expression or super */ null && (AppContainer)));
/******/ })()
;