datakeen-session-react 1.1.140-rc.76 → 1.1.140-rc.78

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.
Files changed (45) hide show
  1. package/dist/cjs/components/session/UserInputForm/LegalRepFields.js +45 -0
  2. package/dist/cjs/components/session/UserInputForm/LegalRepFields.js.map +1 -0
  3. package/dist/cjs/components/session/UserInputForm.js +2 -1
  4. package/dist/cjs/components/session/UserInputForm.js.map +1 -1
  5. package/dist/cjs/components/signature-electronic/SignatureElectronic.js +1 -0
  6. package/dist/cjs/components/signature-electronic/SignatureElectronic.js.map +1 -1
  7. package/dist/cjs/constants/userInputForm.js +2 -2
  8. package/dist/cjs/constants/userInputForm.js.map +1 -1
  9. package/dist/cjs/hooks/useUserInputForm.js +17 -1
  10. package/dist/cjs/hooks/useUserInputForm.js.map +1 -1
  11. package/dist/cjs/i18n/documents/documents.en.json.js +3 -0
  12. package/dist/cjs/i18n/documents/documents.en.json.js.map +1 -1
  13. package/dist/cjs/i18n/documents/documents.fr.json.js +3 -0
  14. package/dist/cjs/i18n/documents/documents.fr.json.js.map +1 -1
  15. package/dist/cjs/i18n/en.json.js +2 -1
  16. package/dist/cjs/i18n/en.json.js.map +1 -1
  17. package/dist/cjs/i18n/fr.json.js +2 -1
  18. package/dist/cjs/i18n/fr.json.js.map +1 -1
  19. package/dist/cjs/utils/conditionEvaluator.js +2 -1
  20. package/dist/cjs/utils/conditionEvaluator.js.map +1 -1
  21. package/dist/cjs/utils/userInputForm.js +1 -0
  22. package/dist/cjs/utils/userInputForm.js.map +1 -1
  23. package/dist/esm/components/session/UserInputForm/LegalRepFields.js +22 -0
  24. package/dist/esm/components/session/UserInputForm/LegalRepFields.js.map +1 -0
  25. package/dist/esm/components/session/UserInputForm.js +2 -1
  26. package/dist/esm/components/session/UserInputForm.js.map +1 -1
  27. package/dist/esm/components/signature-electronic/SignatureElectronic.js +1 -0
  28. package/dist/esm/components/signature-electronic/SignatureElectronic.js.map +1 -1
  29. package/dist/esm/constants/userInputForm.js +2 -2
  30. package/dist/esm/constants/userInputForm.js.map +1 -1
  31. package/dist/esm/hooks/useUserInputForm.js +17 -1
  32. package/dist/esm/hooks/useUserInputForm.js.map +1 -1
  33. package/dist/esm/i18n/documents/documents.en.json.js +3 -1
  34. package/dist/esm/i18n/documents/documents.en.json.js.map +1 -1
  35. package/dist/esm/i18n/documents/documents.fr.json.js +3 -1
  36. package/dist/esm/i18n/documents/documents.fr.json.js.map +1 -1
  37. package/dist/esm/i18n/en.json.js +2 -1
  38. package/dist/esm/i18n/en.json.js.map +1 -1
  39. package/dist/esm/i18n/fr.json.js +2 -1
  40. package/dist/esm/i18n/fr.json.js.map +1 -1
  41. package/dist/esm/utils/conditionEvaluator.js +2 -1
  42. package/dist/esm/utils/conditionEvaluator.js.map +1 -1
  43. package/dist/esm/utils/userInputForm.js +1 -0
  44. package/dist/esm/utils/userInputForm.js.map +1 -1
  45. package/package.json +1 -1
@@ -0,0 +1,45 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ var React = require('react');
7
+ var Label = require('@radix-ui/react-label');
8
+ var clsx = require('clsx');
9
+ var useI18n = require('../../../hooks/useI18n.js');
10
+
11
+ function _interopNamespaceDefault(e) {
12
+ var n = Object.create(null);
13
+ if (e) {
14
+ Object.keys(e).forEach(function (k) {
15
+ if (k !== 'default') {
16
+ var d = Object.getOwnPropertyDescriptor(e, k);
17
+ Object.defineProperty(n, k, d.get ? d : {
18
+ enumerable: true,
19
+ get: function () { return e[k]; }
20
+ });
21
+ }
22
+ });
23
+ }
24
+ n.default = e;
25
+ return Object.freeze(n);
26
+ }
27
+
28
+ var Label__namespace = /*#__PURE__*/_interopNamespaceDefault(Label);
29
+
30
+ var LegalRepFields = function (_a) {
31
+ var form = _a.form, errors = _a.errors, requestedFields = _a.requestedFields, onFieldChange = _a.onFieldChange;
32
+ var t = useI18n.useI18n().t;
33
+ return (jsxRuntime.jsxs(React.Fragment, { children: [requestedFields.has("legalRepresentativeNom") && (jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label__namespace.Root, { htmlFor: "legalRepresentativeLastName", className: "block text-sm md:text-base font-semibold text-gray-900", children: t("user_input_form.fields.legal_representative_last_name", "Nom du représentant légal") }), jsxRuntime.jsx("input", { id: "legalRepresentativeLastName", type: "text", value: form.legalRepresentativeLastName || "", onChange: function (event) {
34
+ return onFieldChange("legalRepresentativeLastName", event.target.value);
35
+ }, placeholder: t("user_input_form.placeholders.legal_representative_last_name", "Nom"), className: clsx("w-full px-3 py-3 md:py-4 border rounded-lg text-base transition-colors focus:outline-none focus:ring-2 focus:ring-[#11E5C5] focus:border-transparent", errors.legalRepresentativeLastName
36
+ ? "border-red-500 bg-red-50"
37
+ : "border-gray-300 hover-border-gray-400"), autoComplete: "off" }), errors.legalRepresentativeLastName && (jsxRuntime.jsxs("p", { className: "text-red-600 text-sm flex items-center gap-1", children: [jsxRuntime.jsx("span", { className: "text-red-500", children: "\u26A0" }), t("user_input_form.errors.legal_representative_last_name_required")] }))] })), requestedFields.has("legalRepresentativePrenom") && (jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsx(Label__namespace.Root, { htmlFor: "legalRepresentativeFirstName", className: "block text-sm md:text-base font-semibold text-gray-900", children: t("user_input_form.fields.legal_representative_first_name", "Prénom du représentant légal") }), jsxRuntime.jsx("input", { id: "legalRepresentativeFirstName", type: "text", value: form.legalRepresentativeFirstName || "", onChange: function (event) {
38
+ return onFieldChange("legalRepresentativeFirstName", event.target.value);
39
+ }, placeholder: t("user_input_form.placeholders.legal_representative_first_name", "Prénom"), className: clsx("w-full px-3 py-3 md:py-4 border rounded-lg text-base transition-colors focus:outline-none focus:ring-2 focus:ring-[#11E5C5] focus:border-transparent", errors.legalRepresentativeFirstName
40
+ ? "border-red-500 bg-red-50"
41
+ : "border-gray-300 hover-border-gray-400"), autoComplete: "off" }), errors.legalRepresentativeFirstName && (jsxRuntime.jsxs("p", { className: "text-red-600 text-sm flex items-center gap-1", children: [jsxRuntime.jsx("span", { className: "text-red-500", children: "\u26A0" }), t("user_input_form.errors.legal_representative_first_name_required")] }))] }))] }));
42
+ };
43
+
44
+ exports.default = LegalRepFields;
45
+ //# sourceMappingURL=LegalRepFields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LegalRepFields.js","sources":["../../../../../../src/components/session/UserInputForm/LegalRepFields.tsx"],"sourcesContent":["import { Fragment } from \"react\";\nimport * as Label from \"@radix-ui/react-label\";\nimport clsx from \"clsx\";\nimport type {\n RequestedFields,\n UserInputFormErrors,\n UserInputFormState,\n} from \"../../../types/userInputForm\";\nimport { useI18n } from \"../../../hooks/useI18n\";\n\ninterface LegalRepFieldsProps {\n form: UserInputFormState;\n errors: UserInputFormErrors;\n requestedFields: RequestedFields;\n onFieldChange: (key: keyof UserInputFormState, value: string) => void;\n}\n\nconst LegalRepFields = ({\n form,\n errors,\n requestedFields,\n onFieldChange,\n}: LegalRepFieldsProps) => {\n const { t } = useI18n();\n\n return (\n <Fragment>\n {requestedFields.has(\"legalRepresentativeNom\") && (\n <div className=\"space-y-2\">\n <Label.Root\n htmlFor=\"legalRepresentativeLastName\"\n className=\"block text-sm md:text-base font-semibold text-gray-900\"\n >\n {t(\n \"user_input_form.fields.legal_representative_last_name\",\n \"Nom du représentant légal\",\n )}\n </Label.Root>\n <input\n id=\"legalRepresentativeLastName\"\n type=\"text\"\n value={form.legalRepresentativeLastName || \"\"}\n onChange={(event) =>\n onFieldChange(\"legalRepresentativeLastName\", event.target.value)\n }\n placeholder={t(\n \"user_input_form.placeholders.legal_representative_last_name\",\n \"Nom\",\n )}\n className={clsx(\n \"w-full px-3 py-3 md:py-4 border rounded-lg text-base transition-colors focus:outline-none focus:ring-2 focus:ring-[#11E5C5] focus:border-transparent\",\n errors.legalRepresentativeLastName\n ? \"border-red-500 bg-red-50\"\n : \"border-gray-300 hover-border-gray-400\",\n )}\n autoComplete=\"off\"\n />\n {errors.legalRepresentativeLastName && (\n <p className=\"text-red-600 text-sm flex items-center gap-1\">\n <span className=\"text-red-500\">⚠</span>\n {t(\n \"user_input_form.errors.legal_representative_last_name_required\",\n )}\n </p>\n )}\n </div>\n )}\n\n {requestedFields.has(\"legalRepresentativePrenom\") && (\n <div className=\"space-y-2\">\n <Label.Root\n htmlFor=\"legalRepresentativeFirstName\"\n className=\"block text-sm md:text-base font-semibold text-gray-900\"\n >\n {t(\n \"user_input_form.fields.legal_representative_first_name\",\n \"Prénom du représentant légal\",\n )}\n </Label.Root>\n <input\n id=\"legalRepresentativeFirstName\"\n type=\"text\"\n value={form.legalRepresentativeFirstName || \"\"}\n onChange={(event) =>\n onFieldChange(\"legalRepresentativeFirstName\", event.target.value)\n }\n placeholder={t(\n \"user_input_form.placeholders.legal_representative_first_name\",\n \"Prénom\",\n )}\n className={clsx(\n \"w-full px-3 py-3 md:py-4 border rounded-lg text-base transition-colors focus:outline-none focus:ring-2 focus:ring-[#11E5C5] focus:border-transparent\",\n errors.legalRepresentativeFirstName\n ? \"border-red-500 bg-red-50\"\n : \"border-gray-300 hover-border-gray-400\",\n )}\n autoComplete=\"off\"\n />\n {errors.legalRepresentativeFirstName && (\n <p className=\"text-red-600 text-sm flex items-center gap-1\">\n <span className=\"text-red-500\">⚠</span>\n {t(\n \"user_input_form.errors.legal_representative_first_name_required\",\n )}\n </p>\n )}\n </div>\n )}\n </Fragment>\n );\n};\n\nexport default LegalRepFields;\n"],"names":["useI18n","_jsxs","Fragment","_jsx","Label"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,IAAM,cAAc,GAAG,UAAC,EAKF,EAAA;QAJpB,IAAI,GAAA,EAAA,CAAA,IAAA,EACJ,MAAM,GAAA,EAAA,CAAA,MAAA,EACN,eAAe,GAAA,EAAA,CAAA,eAAA,EACf,aAAa,GAAA,EAAA,CAAA,aAAA;AAEL,IA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AAA,EAEjE,CAAC,CACA,wDAAwD,EACxD,8BAA8B,CAC/B,EAAA,CACU,EACbD,cAAA,CAAA,OAAA,EAAA,EACE,EAAE,EAAC,8BAA8B,EACjC,IAAI,EAAC,MAAM,EACX,KAAK,EAAE,IAAI,CAAC,4BAA4B,IAAI,EAAE,EAC9C,QAAQ,EAAE,UAAC,KAAK,EAAA;4BACd,OAAA,aAAa,CAAC,8BAA8B,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;AAAjE,wBAAA,CAAiE,EAEnE,WAAW,EAAE,CAAC,CACZ,8DAA8D,EAC9D,QAAQ,CACT,EACD,SAAS,EAAE,IAAI,CACb,sJAAsJ,EACtJ,MAAM,CAAC;AACL,8BAAE;AACF,8BAAE,uCAAuC,CAC5C,EACD,YAAY,EAAC,KAAK,EAAA,CAClB,EACD,MAAM,CAAC,4BAA4B,KAClCF,uBAAG,SAAS,EAAC,8CAA8C,EAAA,QAAA,EAAA,CACzDE,yBAAM,SAAS,EAAC,cAAc,EAAA,QAAA,EAAA,QAAA,EAAA,CAAS,EACtC,CAAC,CACA,iEAAiE,CAClE,IACC,CACL,CAAA,EAAA,CACG,CACP,CAAA,EAAA,CACQ;AAEf;;;;"}
@@ -11,6 +11,7 @@ var useI18n = require('../../hooks/useI18n.js');
11
11
  var useUserInputForm = require('../../hooks/useUserInputForm.js');
12
12
  var IdentityFields = require('./UserInputForm/IdentityFields.js');
13
13
  var LegalEntityFields = require('./UserInputForm/LegalEntityFields.js');
14
+ var LegalRepFields = require('./UserInputForm/LegalRepFields.js');
14
15
  var ContactFields = require('./UserInputForm/ContactFields.js');
15
16
  var AddressFields = require('./UserInputForm/AddressFields.js');
16
17
  var NationalityField = require('./UserInputForm/NationalityField.js');
@@ -32,7 +33,7 @@ var UserInputForm = function (props) {
32
33
  return (jsxRuntime.jsxs(MobilePageLayout.default, { contentClassName: "h-full", footer: jsxRuntime.jsx(PageActions.default, { primary: jsxRuntime.jsx(Button.default, { onClick: goOnNextStep, children: t("user_input_form.buttons.continue") }), secondary: jsxRuntime.jsx(Button.default, { variant: "secondary", onClick: goOnPreviousStep, children: t("user_input_form.buttons.back") }) }), children: [typeof process !== "undefined" &&
33
34
  ((_a = process.env) === null || _a === void 0 ? void 0 : _a.NODE_ENV) === "development" && (jsxRuntime.jsx("div", { className: "fixed right-0 top-0 z-50 bg-green-500 p-2 text-xs text-white", children: "UserInputForm Rendered \u2713" })), jsxRuntime.jsx("div", { className: "px-4 py-6 pt-11 md:px-8 md:py-8", children: jsxRuntime.jsxs("div", { className: "mx-auto w-full space-y-6 ".concat(hasListCustomField
34
35
  ? "max-w-[98vw] md:max-w-[1300px] lg:max-w-[1500px]"
35
- : "max-w-md"), children: [jsxRuntime.jsxs("div", { className: "space-y-4 text-center", children: [jsxRuntime.jsx(Title.default, { className: "text-xl md:text-2xl lg:text-3xl", children: pageTitle }), jsxRuntime.jsx(Subtitle.default, { className: "text-sm leading-relaxed text-gray-600 md:text-base whitespace-pre-line", children: pageDescription })] }), jsxRuntime.jsxs("div", { className: "space-y-6 z-30 h-full", children: [informationType === "identity" && (jsxRuntime.jsx(IdentityFields.default, { form: form, errors: errors, requestedFields: requestedFields, onFieldChange: handleFieldChange })), informationType === "identity-legal" && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(LegalEntityFields.default, { form: form, errors: errors, requestedFields: requestedFields, onFieldChange: handleFieldChange }), requestedFields.has("adresse") && (jsxRuntime.jsxs("div", { className: "space-y-4", children: [jsxRuntime.jsx("h3", { className: "text-lg md:text-xl font-semibold text-gray-900", children: t("user_input_form.registered_office_address", "Adresse du siège social") }), jsxRuntime.jsx(AddressFields.default, { form: form, errors: errors, requestedFields: requestedFields, onFieldChange: handleFieldChange, addressSuggestions: addressSuggestions, showSuggestions: showSuggestions, onAddressChange: handleAddressChange, onAddressFocus: handleAddressFocus, onAddressBlur: handleAddressBlur, onApplySuggestion: applyAddressSuggestion })] }))] })), informationType === "contact" && (jsxRuntime.jsx(ContactFields.default, { form: form, errors: errors, requestedFields: requestedFields, onFieldChange: handleFieldChange })), informationType === "address" && (jsxRuntime.jsx(AddressFields.default, { form: form, errors: errors, requestedFields: requestedFields, onFieldChange: handleFieldChange, addressSuggestions: addressSuggestions, showSuggestions: showSuggestions, onAddressChange: handleAddressChange, onAddressFocus: handleAddressFocus, onAddressBlur: handleAddressBlur, onApplySuggestion: applyAddressSuggestion })), informationType === "nationality" && (jsxRuntime.jsx(NationalityField.default, { form: form, errors: errors, requestedFields: requestedFields, onFieldChange: handleFieldChange })), informationType === "custom" && props.node.customFields && (jsxRuntime.jsx(CustomFormFields.default, { customFields: props.node.customFields, formData: customFormData, errors: customFormErrors, cellErrors: customFormCellErrors, onFieldChange: handleCustomFieldChange, addressSuggestions: addressSuggestions, showSuggestions: showSuggestions, onAddressChange: function (fieldId, val) { return handleAddressChange(val); }, onAddressFocus: function (fieldId) { return handleAddressFocus(); }, onAddressBlur: function (fieldId) { return handleAddressBlur(); }, onApplySuggestion: function (fieldId, suggestion) {
36
+ : "max-w-md"), children: [jsxRuntime.jsxs("div", { className: "space-y-4 text-center", children: [jsxRuntime.jsx(Title.default, { className: "text-xl md:text-2xl lg:text-3xl", children: pageTitle }), jsxRuntime.jsx(Subtitle.default, { className: "text-sm leading-relaxed text-gray-600 md:text-base whitespace-pre-line", children: pageDescription })] }), jsxRuntime.jsxs("div", { className: "space-y-6 z-30 h-full", children: [informationType === "identity" && (jsxRuntime.jsx(IdentityFields.default, { form: form, errors: errors, requestedFields: requestedFields, onFieldChange: handleFieldChange })), informationType === "identity-legal-rep" && (jsxRuntime.jsx(LegalRepFields.default, { form: form, errors: errors, requestedFields: requestedFields, onFieldChange: handleFieldChange })), informationType === "identity-legal" && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(LegalEntityFields.default, { form: form, errors: errors, requestedFields: requestedFields, onFieldChange: handleFieldChange }), requestedFields.has("adresse") && (jsxRuntime.jsxs("div", { className: "space-y-4", children: [jsxRuntime.jsx("h3", { className: "text-lg md:text-xl font-semibold text-gray-900", children: t("user_input_form.registered_office_address", "Adresse du siège social") }), jsxRuntime.jsx(AddressFields.default, { form: form, errors: errors, requestedFields: requestedFields, onFieldChange: handleFieldChange, addressSuggestions: addressSuggestions, showSuggestions: showSuggestions, onAddressChange: handleAddressChange, onAddressFocus: handleAddressFocus, onAddressBlur: handleAddressBlur, onApplySuggestion: applyAddressSuggestion })] }))] })), informationType === "contact" && (jsxRuntime.jsx(ContactFields.default, { form: form, errors: errors, requestedFields: requestedFields, onFieldChange: handleFieldChange })), informationType === "address" && (jsxRuntime.jsx(AddressFields.default, { form: form, errors: errors, requestedFields: requestedFields, onFieldChange: handleFieldChange, addressSuggestions: addressSuggestions, showSuggestions: showSuggestions, onAddressChange: handleAddressChange, onAddressFocus: handleAddressFocus, onAddressBlur: handleAddressBlur, onApplySuggestion: applyAddressSuggestion })), informationType === "nationality" && (jsxRuntime.jsx(NationalityField.default, { form: form, errors: errors, requestedFields: requestedFields, onFieldChange: handleFieldChange })), informationType === "custom" && props.node.customFields && (jsxRuntime.jsx(CustomFormFields.default, { customFields: props.node.customFields, formData: customFormData, errors: customFormErrors, cellErrors: customFormCellErrors, onFieldChange: handleCustomFieldChange, addressSuggestions: addressSuggestions, showSuggestions: showSuggestions, onAddressChange: function (fieldId, val) { return handleAddressChange(val); }, onAddressFocus: function (fieldId) { return handleAddressFocus(); }, onAddressBlur: function (fieldId) { return handleAddressBlur(); }, onApplySuggestion: function (fieldId, suggestion) {
36
37
  return applyAddressSuggestion(suggestion);
37
38
  } }))] })] }) })] }));
38
39
  };
@@ -1 +1 @@
1
- {"version":3,"file":"UserInputForm.js","sources":["../../../../../src/components/session/UserInputForm.tsx"],"sourcesContent":["import type { UserInputFormProps } from \"../../types/userInput\";\nimport Button from \"../ui/Button\";\nimport PageActions from \"../ui/PageActions\";\nimport Title from \"../ui/Title\";\nimport Subtitle from \"../ui/Subtitle\";\nimport { useI18n } from \"../../hooks/useI18n\";\nimport { useUserInputForm } from \"../../hooks/useUserInputForm\";\nimport IdentityFields from \"./UserInputForm/IdentityFields\";\nimport LegalEntityFields from \"./UserInputForm/LegalEntityFields\";\nimport ContactFields from \"./UserInputForm/ContactFields\";\nimport AddressFields from \"./UserInputForm/AddressFields\";\nimport NationalityField from \"./UserInputForm/NationalityField\";\nimport CustomFormFields from \"./UserInputForm/CustomFormFields\";\nimport MobilePageLayout from \"../ui/MobilePageLayout\";\n\nconst UserInputForm = (props: UserInputFormProps) => {\n const { t } = useI18n();\n const hasListCustomField =\n props.node.informationType === \"custom\" &&\n (props.node.customFields || []).some((field) => field.valueType === \"list\");\n\n const {\n form,\n errors,\n informationType,\n requestedFields,\n pageTitle,\n pageDescription,\n addressSuggestions,\n showSuggestions,\n handleFieldChange,\n handleAddressChange,\n handleAddressFocus,\n handleAddressBlur,\n applyAddressSuggestion,\n goOnNextStep,\n goOnPreviousStep,\n customFormData,\n customFormErrors,\n customFormCellErrors,\n handleCustomFieldChange,\n } = useUserInputForm(props);\n\n // DEBUG LOGS\n console.log(\"🔍 [UserInputForm] informationType:\", informationType);\n console.log(\n \"🔍 [UserInputForm] node.informationType:\",\n props.node.informationType,\n );\n console.log(\"🔍 [UserInputForm] node.customFields:\", props.node.customFields);\n console.log(\"🔍 [UserInputForm] customFormData:\", customFormData);\n console.log(\n \"🔍 [UserInputForm] requestedFields:\",\n Array.from(requestedFields),\n );\n\n return (\n <MobilePageLayout\n contentClassName=\"h-full\"\n footer={\n <PageActions\n primary={\n <Button onClick={goOnNextStep}>\n {t(\"user_input_form.buttons.continue\")}\n </Button>\n }\n secondary={\n <Button variant=\"secondary\" onClick={goOnPreviousStep}>\n {t(\"user_input_form.buttons.back\")}\n </Button>\n }\n />\n }\n >\n {typeof process !== \"undefined\" &&\n process.env?.NODE_ENV === \"development\" && (\n <div className=\"fixed right-0 top-0 z-50 bg-green-500 p-2 text-xs text-white\">\n UserInputForm Rendered ✓\n </div>\n )}\n\n <div className=\"px-4 py-6 pt-11 md:px-8 md:py-8\">\n <div\n className={`mx-auto w-full space-y-6 ${\n hasListCustomField\n ? \"max-w-[98vw] md:max-w-[1300px] lg:max-w-[1500px]\"\n : \"max-w-md\"\n }`}\n >\n <div className=\"space-y-4 text-center\">\n <Title className=\"text-xl md:text-2xl lg:text-3xl\">\n {pageTitle}\n </Title>\n <Subtitle className=\"text-sm leading-relaxed text-gray-600 md:text-base whitespace-pre-line\">\n {pageDescription}\n </Subtitle>\n </div>\n\n <div className=\"space-y-6 z-30 h-full\">\n {informationType === \"identity\" && (\n <IdentityFields\n form={form}\n errors={errors}\n requestedFields={requestedFields}\n onFieldChange={handleFieldChange}\n />\n )}\n\n {informationType === \"identity-legal\" && (\n <>\n <LegalEntityFields\n form={form}\n errors={errors}\n requestedFields={requestedFields}\n onFieldChange={handleFieldChange}\n />\n {requestedFields.has(\"adresse\") && (\n <div className=\"space-y-4\">\n <h3 className=\"text-lg md:text-xl font-semibold text-gray-900\">\n {t(\n \"user_input_form.registered_office_address\",\n \"Adresse du siège social\",\n )}\n </h3>\n <AddressFields\n form={form}\n errors={errors}\n requestedFields={requestedFields}\n onFieldChange={handleFieldChange}\n addressSuggestions={addressSuggestions}\n showSuggestions={showSuggestions}\n onAddressChange={handleAddressChange}\n onAddressFocus={handleAddressFocus}\n onAddressBlur={handleAddressBlur}\n onApplySuggestion={applyAddressSuggestion}\n />\n </div>\n )}\n </>\n )}\n\n {informationType === \"contact\" && (\n <ContactFields\n form={form}\n errors={errors}\n requestedFields={requestedFields}\n onFieldChange={handleFieldChange}\n />\n )}\n\n {informationType === \"address\" && (\n <AddressFields\n form={form}\n errors={errors}\n requestedFields={requestedFields}\n onFieldChange={handleFieldChange}\n addressSuggestions={addressSuggestions}\n showSuggestions={showSuggestions}\n onAddressChange={handleAddressChange}\n onAddressFocus={handleAddressFocus}\n onAddressBlur={handleAddressBlur}\n onApplySuggestion={applyAddressSuggestion}\n />\n )}\n\n {informationType === \"nationality\" && (\n <NationalityField\n form={form}\n errors={errors}\n requestedFields={requestedFields}\n onFieldChange={handleFieldChange}\n />\n )}\n\n {informationType === \"custom\" && props.node.customFields && (\n <CustomFormFields\n customFields={props.node.customFields}\n formData={customFormData}\n errors={customFormErrors}\n cellErrors={customFormCellErrors}\n onFieldChange={handleCustomFieldChange}\n addressSuggestions={addressSuggestions}\n showSuggestions={showSuggestions}\n onAddressChange={(fieldId, val) => handleAddressChange(val)}\n onAddressFocus={(fieldId) => handleAddressFocus()}\n onAddressBlur={(fieldId) => handleAddressBlur()}\n onApplySuggestion={(fieldId, suggestion) =>\n applyAddressSuggestion(suggestion)\n }\n />\n )}\n </div>\n </div>\n </div>\n </MobilePageLayout>\n );\n};\n\nexport default UserInputForm;\n"],"names":["useI18n","useUserInputForm","_jsxs","MobilePageLayout","_jsx","PageActions","Button","Title","Subtitle","IdentityFields","LegalEntityFields","AddressFields","ContactFields","NationalityField","CustomFormFields"],"mappings":";;;;;;;;;;;;;;;;;;;AAeA,IAAM,aAAa,GAAG,UAAC,KAAyB,EAAA;;AACtC,IAAA,IAAA,CAAC,GAAKA,eAAO,EAAE,EAAd;IACT,IAAM,kBAAkB,GACtB,KAAK,CAAC,IAAI,CAAC,eAAe,KAAK,QAAQ;QACvC,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,IAAI,EAAE,EAAE,IAAI,CAAC,UAAC,KAAK,EAAA,EAAK,OAAA,KAAK,CAAC,SAAS,KAAK,MAAM,CAAA,CAA1B,CAA0B,CAAC;AAEvE,IAAA,IAAA,EAAA,GAoBFC,iCAAgB,CAAC,KAAK,CAAC,EAnBzB,IAAI,GAAA,EAAA,CAAA,IAAA,EACJ,MAAM,GAAA,EAAA,CAAA,MAAA,EACN,eAAe,GAAA,EAAA,CAAA,eAAA,EACf,eAAe,GAAA,EAAA,CAAA,eAAA,EACf,SAAS,GAAA,EAAA,CAAA,SAAA,EACT,eAAe,GAAA,EAAA,CAAA,eAAA,EACf,kBAAkB,GAAA,EAAA,C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,EAAE,cAAc,EACxB,MAAM,EAAE,gBAAgB,EACxB,UAAU,EAAE,oBAAoB,EAChC,aAAa,EAAE,uBAAuB,EACtC,kBAAkB,EAAE,kBAAkB,EACtC,eAAe,EAAE,eAAe,EAChC,eAAe,EAAE,UAAC,OAAO,EAAE,GAAG,EAAA,EAAK,OAAA,mBAAmB,CAAC,GAAG,CAAC,EAAxB,CAAwB,EAC3D,cAAc,EAAE,UAAC,OAAO,EAAA,EAAK,OAAA,kBAAkB,EAAE,EAApB,CAAoB,EACjD,aAAa,EAAE,UAAC,OAAO,EAAA,EAAK,OAAA,iBAAiB,EAAE,CAAA,CAAnB,CAAmB,EAC/C,iBAAiB,EAAE,UAAC,OAAO,EAAE,UAAU,EAAA;wCACrC,OAAA,sBAAsB,CAAC,UAAU,CAAC;AAAlC,oCAAA,CAAkC,GAEpC,CACH,CAAA,EAAA,CACG,IACF,EAAA,CACF,CAAA,EAAA,CACW;AAEvB;;;;"}
1
+ {"version":3,"file":"UserInputForm.js","sources":["../../../../../src/components/session/UserInputForm.tsx"],"sourcesContent":["import type { UserInputFormProps } from \"../../types/userInput\";\nimport Button from \"../ui/Button\";\nimport PageActions from \"../ui/PageActions\";\nimport Title from \"../ui/Title\";\nimport Subtitle from \"../ui/Subtitle\";\nimport { useI18n } from \"../../hooks/useI18n\";\nimport { useUserInputForm } from \"../../hooks/useUserInputForm\";\nimport IdentityFields from \"./UserInputForm/IdentityFields\";\nimport LegalEntityFields from \"./UserInputForm/LegalEntityFields\";\nimport LegalRepFields from \"./UserInputForm/LegalRepFields\";\nimport ContactFields from \"./UserInputForm/ContactFields\";\nimport AddressFields from \"./UserInputForm/AddressFields\";\nimport NationalityField from \"./UserInputForm/NationalityField\";\nimport CustomFormFields from \"./UserInputForm/CustomFormFields\";\nimport MobilePageLayout from \"../ui/MobilePageLayout\";\n\nconst UserInputForm = (props: UserInputFormProps) => {\n const { t } = useI18n();\n const hasListCustomField =\n props.node.informationType === \"custom\" &&\n (props.node.customFields || []).some((field) => field.valueType === \"list\");\n\n const {\n form,\n errors,\n informationType,\n requestedFields,\n pageTitle,\n pageDescription,\n addressSuggestions,\n showSuggestions,\n handleFieldChange,\n handleAddressChange,\n handleAddressFocus,\n handleAddressBlur,\n applyAddressSuggestion,\n goOnNextStep,\n goOnPreviousStep,\n customFormData,\n customFormErrors,\n customFormCellErrors,\n handleCustomFieldChange,\n } = useUserInputForm(props);\n\n // DEBUG LOGS\n console.log(\"🔍 [UserInputForm] informationType:\", informationType);\n console.log(\n \"🔍 [UserInputForm] node.informationType:\",\n props.node.informationType,\n );\n console.log(\"🔍 [UserInputForm] node.customFields:\", props.node.customFields);\n console.log(\"🔍 [UserInputForm] customFormData:\", customFormData);\n console.log(\n \"🔍 [UserInputForm] requestedFields:\",\n Array.from(requestedFields),\n );\n\n return (\n <MobilePageLayout\n contentClassName=\"h-full\"\n footer={\n <PageActions\n primary={\n <Button onClick={goOnNextStep}>\n {t(\"user_input_form.buttons.continue\")}\n </Button>\n }\n secondary={\n <Button variant=\"secondary\" onClick={goOnPreviousStep}>\n {t(\"user_input_form.buttons.back\")}\n </Button>\n }\n />\n }\n >\n {typeof process !== \"undefined\" &&\n process.env?.NODE_ENV === \"development\" && (\n <div className=\"fixed right-0 top-0 z-50 bg-green-500 p-2 text-xs text-white\">\n UserInputForm Rendered ✓\n </div>\n )}\n\n <div className=\"px-4 py-6 pt-11 md:px-8 md:py-8\">\n <div\n className={`mx-auto w-full space-y-6 ${\n hasListCustomField\n ? \"max-w-[98vw] md:max-w-[1300px] lg:max-w-[1500px]\"\n : \"max-w-md\"\n }`}\n >\n <div className=\"space-y-4 text-center\">\n <Title className=\"text-xl md:text-2xl lg:text-3xl\">\n {pageTitle}\n </Title>\n <Subtitle className=\"text-sm leading-relaxed text-gray-600 md:text-base whitespace-pre-line\">\n {pageDescription}\n </Subtitle>\n </div>\n\n <div className=\"space-y-6 z-30 h-full\">\n {informationType === \"identity\" && (\n <IdentityFields\n form={form}\n errors={errors}\n requestedFields={requestedFields}\n onFieldChange={handleFieldChange}\n />\n )}\n\n {informationType === \"identity-legal-rep\" && (\n <LegalRepFields\n form={form}\n errors={errors}\n requestedFields={requestedFields}\n onFieldChange={handleFieldChange}\n />\n )}\n\n {informationType === \"identity-legal\" && (\n <>\n <LegalEntityFields\n form={form}\n errors={errors}\n requestedFields={requestedFields}\n onFieldChange={handleFieldChange}\n />\n {requestedFields.has(\"adresse\") && (\n <div className=\"space-y-4\">\n <h3 className=\"text-lg md:text-xl font-semibold text-gray-900\">\n {t(\n \"user_input_form.registered_office_address\",\n \"Adresse du siège social\",\n )}\n </h3>\n <AddressFields\n form={form}\n errors={errors}\n requestedFields={requestedFields}\n onFieldChange={handleFieldChange}\n addressSuggestions={addressSuggestions}\n showSuggestions={showSuggestions}\n onAddressChange={handleAddressChange}\n onAddressFocus={handleAddressFocus}\n onAddressBlur={handleAddressBlur}\n onApplySuggestion={applyAddressSuggestion}\n />\n </div>\n )}\n </>\n )}\n\n {informationType === \"contact\" && (\n <ContactFields\n form={form}\n errors={errors}\n requestedFields={requestedFields}\n onFieldChange={handleFieldChange}\n />\n )}\n\n {informationType === \"address\" && (\n <AddressFields\n form={form}\n errors={errors}\n requestedFields={requestedFields}\n onFieldChange={handleFieldChange}\n addressSuggestions={addressSuggestions}\n showSuggestions={showSuggestions}\n onAddressChange={handleAddressChange}\n onAddressFocus={handleAddressFocus}\n onAddressBlur={handleAddressBlur}\n onApplySuggestion={applyAddressSuggestion}\n />\n )}\n\n {informationType === \"nationality\" && (\n <NationalityField\n form={form}\n errors={errors}\n requestedFields={requestedFields}\n onFieldChange={handleFieldChange}\n />\n )}\n\n {informationType === \"custom\" && props.node.customFields && (\n <CustomFormFields\n customFields={props.node.customFields}\n formData={customFormData}\n errors={customFormErrors}\n cellErrors={customFormCellErrors}\n onFieldChange={handleCustomFieldChange}\n addressSuggestions={addressSuggestions}\n showSuggestions={showSuggestions}\n onAddressChange={(fieldId, val) => handleAddressChange(val)}\n onAddressFocus={(fieldId) => handleAddressFocus()}\n onAddressBlur={(fieldId) => handleAddressBlur()}\n onApplySuggestion={(fieldId, suggestion) =>\n applyAddressSuggestion(suggestion)\n }\n />\n )}\n </div>\n </div>\n </div>\n </MobilePageLayout>\n );\n};\n\nexport default UserInputForm;\n"],"names":["useI18n","useUserInputForm","_jsxs","MobilePageLayout","_jsx","PageActions","Button","Title","Subtitle","IdentityFields","LegalRepFields","_Fragment","LegalEntityFields","AddressFields","ContactFields","NationalityField","CustomFormFields"],"mappings":";;;;;;;;;;;;;;;;;;;;AAgBA,IAAM,aAAa,GAAG,UAAC,KAAyB,EAAA;;AACtC,IAAA,IAAA,CAAC,GAAKA,eAAO,EAAE,EAAd;IACT,IAAM,kBAAkB,GACtB,KAAK,CAAC,IAAI,CAAC,eAAe,KAAK,QAAQ;QACvC,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,IAAI,EAAE,EAAE,IAAI,CAAC,UAAC,KAAK,EAAA,EAAK,OAAA,KAAK,CAAC,SAAS,KAAK,MAAM,CAAA,CAA1B,CAA0B,CAAC;AAEvE,IAAA,IAAA,EAAA,GAoBFC,iCAAgB,CAAC,KAAK,CAAC,EAnBzB,IAAI,GAAA,EAAA,CAAA,IAAA,EACJ,MAAM,GAAA,EAAA,CAAA,MAAA,EACN,eAAe,GAAA,EAAA,CAAA,eAAA,EACf,eAAe,GAAA,EAAA,CAAA,eAAA,EACf,SAAS,GAAA,EAAA,CAAA,SAAA,EACT,eAAe,GAAA,EAAA,CAAA,eAAA,EACf,kBAAkB,GAAA,EAAA,CAAA,kBAAA,EAClB,eAAe,qBAAA,EACf,iBAAiB,GAAA,EAAA,CAAA,iBAAA,EACjB,mBAAmB,GAAA,EAAA,CAAA,mBAAA,EACnB,kBAAkB,GAAA,EAAA,CAAA,kBAAA,EAClB,iBAAiB,GAAA,EAAA,CAAA,iBAAA,EACjB,sBAAsB,GAAA,EAAA,CAAA,sBAAA,EACtB,YAAY,GAAA,EAAA,CAAA,YAAA,E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,kBAAkB,EAAE,kBAAkB,EACtC,eAAe,EAAE,eAAe,EAChC,eAAe,EAAE,UAAC,OAAO,EAAE,GAAG,EAAA,EAAK,OAAA,mBAAmB,CAAC,GAAG,CAAC,CAAA,CAAxB,CAAwB,EAC3D,cAAc,EAAE,UAAC,OAAO,EAAA,EAAK,OAAA,kBAAkB,EAAE,EAApB,CAAoB,EACjD,aAAa,EAAE,UAAC,OAAO,EAAA,EAAK,OAAA,iBAAiB,EAAE,CAAA,CAAnB,CAAmB,EAC/C,iBAAiB,EAAE,UAAC,OAAO,EAAE,UAAU,EAAA;wCACrC,OAAA,sBAAsB,CAAC,UAAU,CAAC;AAAlC,oCAAA,CAAkC,GAEpC,CACH,CAAA,EAAA,CACG,IACF,EAAA,CACF,CAAA,EAAA,CACW;AAEvB;;;;"}
@@ -17,6 +17,7 @@ var sessionService = require('../../services/sessionService.js');
17
17
  */
18
18
  var FIELD_KEY_TO_USER_INPUT = {
19
19
  nom: function (ui) { return ui.lastName; },
20
+ denomination_sociale: function (ui) { return ui.companyName; },
20
21
  prenom: function (ui) { return ui.firstName; },
21
22
  date_naissance: function (ui) { return ui.birthDate; },
22
23
  email: function (ui, ci) { return ui.email || (ci === null || ci === void 0 ? void 0 : ci.email); },
@@ -1 +1 @@
1
- {"version":3,"file":"SignatureElectronic.js","sources":["../../../../../src/components/signature-electronic/SignatureElectronic.tsx"],"sourcesContent":["import React, { useState, useMemo, useEffect } from \"react\";\nimport type { stepObject, SessionTemplateNode, SessionData } from \"../../types/session\";\nimport type { UserInput } from \"../../types/userInput\";\nimport type { ContactInfo } from \"../../types/contactInfo\";\nimport { useTranslation } from \"react-i18next\";\nimport sdkI18n from \"../../i18n\";\nimport SignatureElectronicIntroduction from \"./SignatureElectronicIntroduction\";\nimport DocusealSignature from \"./DocusealSignature\";\nimport { updateSessionStatus } from \"../../services/sessionService\";\n\n/**\n * Maps an InformationFieldKey (journey field) to the corresponding UserInput key.\n * This bridges the admin-defined field names to the actual data collected in the SDK.\n */\nconst FIELD_KEY_TO_USER_INPUT: Record<string, (ui: UserInput, ci?: ContactInfo) => string | undefined> = {\n nom: (ui) => ui.lastName,\n prenom: (ui) => ui.firstName,\n date_naissance: (ui) => ui.birthDate,\n email: (ui, ci) => ui.email || ci?.email,\n sms: (ui, ci) => ui.sms || ui.phoneNumber || ci?.phoneNumber,\n adresse: (ui) => [ui.addressLine1, ui.addressLine2, ui.postalCode, ui.city, ui.countryCode].filter(Boolean).join(', '),\n nationalite: (ui) => ui.nationality,\n siret: (ui) => ui.siret,\n tva: (ui) => ui.tva,\n};\n\ninterface SignatureElectronicProps {\n sessionId: string;\n stepObject: stepObject;\n node: SessionTemplateNode;\n session: SessionData;\n title?: string;\n description?: string;\n external_id?: string;\n fieldMappings?: SessionTemplateNode['fieldMappings'];\n userInput?: UserInput;\n contactInfo?: ContactInfo;\n}\n\nconst SignatureElectronic: React.FC<SignatureElectronicProps> = ({\n sessionId,\n stepObject,\n node,\n session,\n title,\n description,\n external_id,\n fieldMappings,\n userInput,\n contactInfo,\n}) => {\n const { t } = useTranslation(\"translation\", { i18n: sdkI18n });\n const signatureViewStorageKey = useMemo(() => `dk-signature-open:${sessionId}:${external_id ?? \"no-template\"}`, [sessionId, external_id]);\n const [showSignature, setShowSignature] = useState<boolean>(() => {\n if (typeof window === \"undefined\") return false;\n return window.sessionStorage.getItem(signatureViewStorageKey) === \"1\";\n });\n\n useEffect(() => {\n if (typeof window === \"undefined\") return;\n\n if (showSignature) {\n window.sessionStorage.setItem(signatureViewStorageKey, \"1\");\n } else {\n window.sessionStorage.removeItem(signatureViewStorageKey);\n }\n }, [showSignature, signatureViewStorageKey]);\n\n /**\n * Build the pre-fill values object from userInput + fieldMappings.\n * Maps each configured field to its value from userInput.\n * Used by DocusealForm's `values` prop for client-side pre-filling.\n */\n const prefillValues = useMemo<Record<string, string> | undefined>(() => {\n if (!fieldMappings || !userInput) return undefined;\n\n const values: Record<string, string> = {};\n\n fieldMappings.forEach(mapping => {\n const resolver = FIELD_KEY_TO_USER_INPUT[mapping.sourceFieldId];\n let value: string | undefined;\n\n if (resolver) {\n value = resolver(userInput, contactInfo);\n } else if (userInput.customFormData) {\n const raw = userInput.customFormData[mapping.sourceFieldId];\n value = raw != null ? String(raw) : undefined;\n }\n\n if (value !== undefined && value !== '') {\n values[mapping.sourceFieldId] = value;\n }\n });\n\n return Object.keys(values).length > 0 ? values : undefined;\n }, [fieldMappings, userInput, contactInfo]);\n\n /**\n * Build the list of field names that should be read-only in the signing form.\n * Only includes fields that are both mapped AND marked as readonly by the admin.\n */\n const readonlyFieldNames = useMemo<string[] | undefined>(() => {\n if (!fieldMappings) return undefined;\n\n const names = fieldMappings\n .filter(m => m.readonly)\n .map(m => m.sourceFieldId);\n\n return names.length > 0 ? names : undefined;\n }, [fieldMappings]);\n\n const handleContinue = () => {\n setShowSignature(true);\n };\n\n const handleComplete = async () => {\n if (typeof window !== \"undefined\") {\n window.sessionStorage.removeItem(signatureViewStorageKey);\n }\n try {\n await updateSessionStatus(sessionId, \"conform\");\n } catch (err) {\n console.error(\"[SignatureElectronic] Failed to update session status:\", err);\n // Non-bloquant : l'utilisateur avance quoi qu'il arrive\n }\n // Progress to the next step via graph edges (pas d'arithmétique — évite de sauter dans la mauvaise branche)\n stepObject.goToNextStep(node.id, session.template);\n };\n\n const handleBack = () => {\n if (showSignature) {\n setShowSignature(false);\n } else {\n if (typeof window !== \"undefined\") {\n window.sessionStorage.removeItem(signatureViewStorageKey);\n }\n stepObject.goBack();\n }\n };\n\n if (showSignature && external_id) {\n return (\n <DocusealSignature\n sessionId={sessionId}\n templateId={external_id}\n templateName={title}\n onComplete={handleComplete}\n onBack={handleBack}\n prefillValues={prefillValues}\n readonlyFieldNames={readonlyFieldNames}\n />\n );\n }\n\n if (showSignature && !external_id) {\n // No template configured — show error instead of silently falling back to intro\n return (\n <div className=\"flex flex-col items-center justify-center h-full p-4 text-center\">\n <div className=\"text-red-500 text-4xl mb-4\">⚠️</div>\n <h2 className=\"text-xl font-bold text-red-600 mb-2\">\n {t(\"signature.error_title\", \"Erreur\")}\n </h2>\n <p className=\"text-gray-600 mb-4\">\n {t(\"signature.no_template\", \"Le modèle de signature n'est pas configuré.\")}\n </p>\n <button\n className=\"px-4 py-2 bg-primary text-white rounded hover:bg-primary-dark transition-colors\"\n onClick={handleBack}\n >\n {t(\"buttons.back\", \"Retour\")}\n </button>\n </div>\n );\n }\n\n return (\n <SignatureElectronicIntroduction\n onContinue={handleContinue}\n onBack={handleBack}\n title={title}\n description={description}\n />\n );\n};\n\nexport default SignatureElectronic;\n"],"names":["useTranslation","sdkI18n","useMemo","useState","useEffect","__awaiter","updateSessionStatus","_jsx","DocusealSignature","_jsxs","SignatureElectronicIntroduction"],"mappings":";;;;;;;;;;;;;AAUA;;;AAGG;AACH,IAAM,uBAAuB,GAA4E;IACrG,GAAG,EAAE,UAAC,EAAE,EAAA,EAAK,OAAA,EAAE,CAAC,QAAQ,CAAA,CAAX,CAAW;IACxB,MAAM,EAAE,UAAC,EAAE,EAAA,EAAK,OAAA,EAAE,CAAC,SAAS,CAAA,CAAZ,CAAY;IAC5B,cAAc,EAAE,UAAC,EAAE,EAAA,EAAK,OAAA,EAAE,CAAC,SAAS,CAAA,CAAZ,CAAY;IACpC,KAAK,EAAE,UAAC,EAAE,EAAE,EAAE,EAAA,EAAK,OAAA,EAAE,CAAC,KAAK,KAAI,EAAE,KAAA,IAAA,IAAF,EAAE,KAAA,MAAA,GAAA,MAAA,GAAF,EAAE,CAAE,KAAK,CAAA,EAArB,CAAqB;IACxC,GAAG,EAAE,UAAC,EAAE,EAAE,EAAE,IAAK,OAAA,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,WAAW,KAAI,EAAE,KAAA,IAAA,IAAF,EAAE,KAAA,MAAA,GAAA,MAAA,GAAF,EAAE,CAAE,WAAW,CAAA,CAAA,CAA3C,CAA2C;AAC5D,IAAA,OAAO,EAAE,UAAC,EAAE,EAAA,EAAK,OAAA,CAAC,EAAE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ACvB,CAAA,EAAA,CACP;IAEd;IAEA,QACIA,eAACG,uCAA+B,EAAA,EAC5B,UAAU,EAAE,cAAc,EAC1B,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EAAA,CAC1B;AAEV;;;;"}
1
+ {"version":3,"file":"SignatureElectronic.js","sources":["../../../../../src/components/signature-electronic/SignatureElectronic.tsx"],"sourcesContent":["import React, { useState, useMemo, useEffect } from \"react\";\nimport type { stepObject, SessionTemplateNode, SessionData } from \"../../types/session\";\nimport type { UserInput } from \"../../types/userInput\";\nimport type { ContactInfo } from \"../../types/contactInfo\";\nimport { useTranslation } from \"react-i18next\";\nimport sdkI18n from \"../../i18n\";\nimport SignatureElectronicIntroduction from \"./SignatureElectronicIntroduction\";\nimport DocusealSignature from \"./DocusealSignature\";\nimport { updateSessionStatus } from \"../../services/sessionService\";\n\n/**\n * Maps an InformationFieldKey (journey field) to the corresponding UserInput key.\n * This bridges the admin-defined field names to the actual data collected in the SDK.\n */\nconst FIELD_KEY_TO_USER_INPUT: Record<string, (ui: UserInput, ci?: ContactInfo) => string | undefined> = {\n nom: (ui) => ui.lastName,\n denomination_sociale: (ui) => ui.companyName,\n prenom: (ui) => ui.firstName,\n date_naissance: (ui) => ui.birthDate,\n email: (ui, ci) => ui.email || ci?.email,\n sms: (ui, ci) => ui.sms || ui.phoneNumber || ci?.phoneNumber,\n adresse: (ui) => [ui.addressLine1, ui.addressLine2, ui.postalCode, ui.city, ui.countryCode].filter(Boolean).join(', '),\n nationalite: (ui) => ui.nationality,\n siret: (ui) => ui.siret,\n tva: (ui) => ui.tva,\n};\n\ninterface SignatureElectronicProps {\n sessionId: string;\n stepObject: stepObject;\n node: SessionTemplateNode;\n session: SessionData;\n title?: string;\n description?: string;\n external_id?: string;\n fieldMappings?: SessionTemplateNode['fieldMappings'];\n userInput?: UserInput;\n contactInfo?: ContactInfo;\n}\n\nconst SignatureElectronic: React.FC<SignatureElectronicProps> = ({\n sessionId,\n stepObject,\n node,\n session,\n title,\n description,\n external_id,\n fieldMappings,\n userInput,\n contactInfo,\n}) => {\n const { t } = useTranslation(\"translation\", { i18n: sdkI18n });\n const signatureViewStorageKey = useMemo(() => `dk-signature-open:${sessionId}:${external_id ?? \"no-template\"}`, [sessionId, external_id]);\n const [showSignature, setShowSignature] = useState<boolean>(() => {\n if (typeof window === \"undefined\") return false;\n return window.sessionStorage.getItem(signatureViewStorageKey) === \"1\";\n });\n\n useEffect(() => {\n if (typeof window === \"undefined\") return;\n\n if (showSignature) {\n window.sessionStorage.setItem(signatureViewStorageKey, \"1\");\n } else {\n window.sessionStorage.removeItem(signatureViewStorageKey);\n }\n }, [showSignature, signatureViewStorageKey]);\n\n /**\n * Build the pre-fill values object from userInput + fieldMappings.\n * Maps each configured field to its value from userInput.\n * Used by DocusealForm's `values` prop for client-side pre-filling.\n */\n const prefillValues = useMemo<Record<string, string> | undefined>(() => {\n if (!fieldMappings || !userInput) return undefined;\n\n const values: Record<string, string> = {};\n\n fieldMappings.forEach(mapping => {\n const resolver = FIELD_KEY_TO_USER_INPUT[mapping.sourceFieldId];\n let value: string | undefined;\n\n if (resolver) {\n value = resolver(userInput, contactInfo);\n } else if (userInput.customFormData) {\n const raw = userInput.customFormData[mapping.sourceFieldId];\n value = raw != null ? String(raw) : undefined;\n }\n\n if (value !== undefined && value !== '') {\n values[mapping.sourceFieldId] = value;\n }\n });\n\n return Object.keys(values).length > 0 ? values : undefined;\n }, [fieldMappings, userInput, contactInfo]);\n\n /**\n * Build the list of field names that should be read-only in the signing form.\n * Only includes fields that are both mapped AND marked as readonly by the admin.\n */\n const readonlyFieldNames = useMemo<string[] | undefined>(() => {\n if (!fieldMappings) return undefined;\n\n const names = fieldMappings\n .filter(m => m.readonly)\n .map(m => m.sourceFieldId);\n\n return names.length > 0 ? names : undefined;\n }, [fieldMappings]);\n\n const handleContinue = () => {\n setShowSignature(true);\n };\n\n const handleComplete = async () => {\n if (typeof window !== \"undefined\") {\n window.sessionStorage.removeItem(signatureViewStorageKey);\n }\n try {\n await updateSessionStatus(sessionId, \"conform\");\n } catch (err) {\n console.error(\"[SignatureElectronic] Failed to update session status:\", err);\n // Non-bloquant : l'utilisateur avance quoi qu'il arrive\n }\n // Progress to the next step via graph edges (pas d'arithmétique — évite de sauter dans la mauvaise branche)\n stepObject.goToNextStep(node.id, session.template);\n };\n\n const handleBack = () => {\n if (showSignature) {\n setShowSignature(false);\n } else {\n if (typeof window !== \"undefined\") {\n window.sessionStorage.removeItem(signatureViewStorageKey);\n }\n stepObject.goBack();\n }\n };\n\n if (showSignature && external_id) {\n return (\n <DocusealSignature\n sessionId={sessionId}\n templateId={external_id}\n templateName={title}\n onComplete={handleComplete}\n onBack={handleBack}\n prefillValues={prefillValues}\n readonlyFieldNames={readonlyFieldNames}\n />\n );\n }\n\n if (showSignature && !external_id) {\n // No template configured — show error instead of silently falling back to intro\n return (\n <div className=\"flex flex-col items-center justify-center h-full p-4 text-center\">\n <div className=\"text-red-500 text-4xl mb-4\">⚠️</div>\n <h2 className=\"text-xl font-bold text-red-600 mb-2\">\n {t(\"signature.error_title\", \"Erreur\")}\n </h2>\n <p className=\"text-gray-600 mb-4\">\n {t(\"signature.no_template\", \"Le modèle de signature n'est pas configuré.\")}\n </p>\n <button\n className=\"px-4 py-2 bg-primary text-white rounded hover:bg-primary-dark transition-colors\"\n onClick={handleBack}\n >\n {t(\"buttons.back\", \"Retour\")}\n </button>\n </div>\n );\n }\n\n return (\n <SignatureElectronicIntroduction\n onContinue={handleContinue}\n onBack={handleBack}\n title={title}\n description={description}\n />\n );\n};\n\nexport default SignatureElectronic;\n"],"names":["useTranslation","sdkI18n","useMemo","useState","useEffect","__awaiter","updateSessionStatus","_jsx","DocusealSignature","_jsxs","SignatureElectronicIntroduction"],"mappings":";;;;;;;;;;;;;AAUA;;;AAGG;AACH,IAAM,uBAAuB,GAA4E;IACrG,GAAG,EAAE,UAAC,EAAE,EAAA,EAAK,OAAA,EAAE,CA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UAAU,EAAE,cAAc,EAC1B,MAAM,EAAE,UAAU,EAClB,aAAa,EAAE,aAAa,EAC5B,kBAAkB,EAAE,kBAAkB,EAAA,CACxC;IAEV;AAEA,IAAA,IAAI,aAAa,IAAI,CAAC,WAAW,EAAE;;QAE/B,QACIC,eAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,kEAAkE,EAAA,QAAA,EAAA,CAC7EF,cAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,4BAA4B,EAAA,QAAA,EAAA,cAAA,EAAA,CAAS,EACpDA,cAAA,CAAA,IAAA,EAAA,EAAI,SAAS,EAAC,qCAAqC,EAAA,QAAA,EAC9C,CAAC,CAAC,uBAAuB,EAAE,QAAQ,CAAC,EAAA,CACpC,EACLA,cAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAC,oBAAoB,EAAA,QAAA,EAC5B,CAAC,CAAC,uBAAuB,EAAE,6CAA6C,CAAC,EAAA,CAC1E,EACJA,cAAA,CAAA,QAAA,EAAA,EACI,SAAS,EAAC,iFAAiF,EAC3F,OAAO,EAAE,UAAU,EAAA,QAAA,EAElB,CAAC,CAAC,cAAc,EAAE,QAAQ,CAAC,EAAA,CACvB,CAAA,EAAA,CACP;IAEd;IAEA,QACIA,eAACG,uCAA+B,EAAA,EAC5B,UAAU,EAAE,cAAc,EAC1B,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EAAA,CAC1B;AAEV;;;;"}
@@ -41,6 +41,7 @@ var ADDRESS_SUGGESTIONS = [
41
41
  var DEFAULT_FIELDS = {
42
42
  identity: ["nom", "prenom", "date_naissance"],
43
43
  "identity-legal": ["nom", "registrationNumber", "siret", "tva", "adresse"],
44
+ "identity-legal-rep": ["legalRepresentativeNom", "legalRepresentativePrenom"],
44
45
  contact: ["email", "sms"],
45
46
  address: ["adresse"],
46
47
  nationality: ["nationalite"],
@@ -56,8 +57,7 @@ var FIELD_LABELS = {
56
57
  company: "user_input_form.fields.company_name",
57
58
  siret: "user_input_form.fields.siret",
58
59
  tva: "user_input_form.fields.vat_number",
59
- registrationNumber: "user_input_form.fields.registration_number",
60
- };
60
+ registrationNumber: "user_input_form.fields.registration_number"};
61
61
  // Backend endpoint pour l'autocomplétion d'adresses (sécurisé)
62
62
  var GEOCODING_AUTOCOMPLETE_ENDPOINT = "/geocoding/autocomplete";
63
63
  var FALLBACK_ADDRESS_SUGGESTIONS = ADDRESS_SUGGESTIONS.map(function (label, index) { return ({
@@ -1 +1 @@
1
- {"version":3,"file":"userInputForm.js","sources":["../../../../src/constants/userInputForm.ts"],"sourcesContent":["import type {\n AddressSuggestion,\n InformationType,\n RequestedFieldKey,\n SelectOption,\n} from \"../types/userInputForm\";\n\nconst days = Array.from({ length: 31 }, (_, index) => index + 1);\nconst currentYear = new Date().getFullYear();\nconst years = Array.from({ length: 120 }, (_, index) => currentYear - index);\n\nconst monthLabels = [\n \"Janvier\",\n \"Février\",\n \"Mars\",\n \"Avril\",\n \"Mai\",\n \"Juin\",\n \"Juillet\",\n \"Août\",\n \"Septembre\",\n \"Octobre\",\n \"Novembre\",\n \"Décembre\",\n];\n\nexport const DAY_OPTIONS: SelectOption[] = days.map((value) => ({\n value: String(value).padStart(2, \"0\"),\n label: String(value).padStart(2, \"0\"),\n}));\n\nexport const MONTH_OPTIONS: SelectOption[] = monthLabels.map(\n (label, index) => ({\n value: String(index + 1).padStart(2, \"0\"),\n label,\n })\n);\n\nexport const YEAR_OPTIONS: SelectOption[] = years.map((value) => ({\n value: String(value),\n label: String(value),\n}));\n\n\nexport const ADDRESS_SUGGESTIONS: string[] = [\n \"10 Rue de Rivoli, 75001 Paris, France\",\n \"221B Baker Street, NW1 6XE Londres, Royaume-Uni\",\n \"1600 Amphitheatre Parkway, 94043 Mountain View, États-Unis\",\n \"55 Rue du Faubourg Saint-Honoré, 75008 Paris, France\",\n \"1 Place du Commerce, 44000 Nantes, France\",\n \"Piazza del Colosseo 1, 00184 Rome, Italie\",\n \"Av. Paulista 1578, 01310-200 São Paulo, Brésil\",\n];\n\nexport const DEFAULT_FIELDS: Record<InformationType, RequestedFieldKey[]> = {\n identity: [\"nom\", \"prenom\", \"date_naissance\"],\n \"identity-legal\": [\"nom\", \"registrationNumber\", \"siret\", \"tva\", \"adresse\"],\n contact: [\"email\", \"sms\"],\n address: [\"adresse\"],\n nationality: [\"nationalite\"],\n custom: [], // Custom forms use customFields instead\n};\n\nexport const FIELD_LABELS: Record<RequestedFieldKey, string> = {\n nom: \"user_input_form.fields.last_name\",\n prenom: \"user_input_form.fields.first_name\",\n date_naissance: \"user_input_form.fields.birth_date\",\n email: \"user_input_form.fields.email\",\n sms: \"user_input_form.fields.phone\",\n adresse: \"user_input_form.fields.address_line1\",\n nationalite: \"user_input_form.fields.nationality\",\n company: \"user_input_form.fields.company_name\",\n siret: \"user_input_form.fields.siret\",\n tva: \"user_input_form.fields.vat_number\",\n registrationNumber: \"user_input_form.fields.registration_number\",\n};\n\n// Backend endpoint pour l'autocomplétion d'adresses (sécurisé)\nexport const GEOCODING_AUTOCOMPLETE_ENDPOINT = \"/geocoding/autocomplete\";\n\nexport const FALLBACK_ADDRESS_SUGGESTIONS: AddressSuggestion[] =\n ADDRESS_SUGGESTIONS.map((label, index) => ({\n id: `fallback-${index}`,\n label,\n addressLine1: label,\n postalCode: \"\",\n city: \"\",\n country: \"\",\n }));\n"],"names":[],"mappings":";;AAOA,IAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,UAAC,CAAC,EAAE,KAAK,EAAA,EAAK,OAAA,KAAK,GAAG,CAAC,CAAA,CAAT,CAAS,CAAC;AAChE,IAAM,WAAW,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;AAC5C,IAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,UAAC,CAAC,EAAE,KAAK,EAAA,EAAK,OA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,EAAE,KAAK,EAAE,SAAS,CAAC;AAC1E,IAAA,OAAO,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC;IACzB,OAAO,EAAE,CAAC,SAAS,CAAC;IACpB,WAAW,EAAE,CAAC,aAAa,CAAC;IAC5B,MAAM,EAAE,EAAE;;AAGL,IAAM,YAAY,GAAsC;AAC7D,IAAA,GAAG,EAAE,kCAAkC;AACvC,IAAA,MAAM,EAAE,mCAAmC;AAC3C,IAAA,cAAc,EAAE,mCAAmC;AACnD,IAAA,KAAK,EAAE,8BAA8B;AACrC,IAAA,GAAG,EAAE,8BAA8B;AACnC,IACA,WAAW,EAAE,oCAAoC;AACjD,IAAA,OAAO,EAAE,qCAAqC;AAC9C,IAAA,KAAK,EAAE,8BAA8B;AACrC,IAAA,GAAG,EAAE,mCAAmC;AACxC,IAAA,kBAAkB,EAAE,4CAA4C;;AAGlE;AACO,IAAM,+BAA+B,GAAG;AAExC,IAAM,4BAA4B,GACvC,mBAAmB,CAAC,GAAG,CAAC,UAAC,KAAK,EAAE,KAAK,EAAA,EAAK,QAAC;IACzC,EAAE,EAAE,WAAA,CAAA,MAAA,CAAY,KAAK,CAAE;AACvB,IAAA,KAAK,EAAA,KAAA;AACL,IAAA,YAAY,EAAE,KAAK;AACnB,IAAA,UAAU,EAAE,EAAE;AACd,IAAA,IAAI,EAAE,EAAE;AACR,IAAA,OAAO,EAAE,EAAE;CACZ,EAAC,CAPwC,CAOxC;;;;;;;;;;;"}
1
+ {"version":3,"file":"userInputForm.js","sources":["../../../../src/constants/userInputForm.ts"],"sourcesContent":["import type {\n AddressSuggestion,\n InformationType,\n RequestedFieldKey,\n SelectOption,\n} from \"../types/userInputForm\";\n\nconst days = Array.from({ length: 31 }, (_, index) => index + 1);\nconst currentYear = new Date().getFullYear();\nconst years = Array.from({ length: 120 }, (_, index) => currentYear - index);\n\nconst monthLabels = [\n \"Janvier\",\n \"Février\",\n \"Mars\",\n \"Avril\",\n \"Mai\",\n \"Juin\",\n \"Juillet\",\n \"Août\",\n \"Septembre\",\n \"Octobre\",\n \"Novembre\",\n \"Décembre\",\n];\n\nexport const DAY_OPTIONS: SelectOption[] = days.map((value) => ({\n value: String(value).padStart(2, \"0\"),\n label: String(value).padStart(2, \"0\"),\n}));\n\nexport const MONTH_OPTIONS: SelectOption[] = monthLabels.map(\n (label, index) => ({\n value: String(index + 1).padStart(2, \"0\"),\n label,\n })\n);\n\nexport const YEAR_OPTIONS: SelectOption[] = years.map((value) => ({\n value: String(value),\n label: String(value),\n}));\n\n\nexport const ADDRESS_SUGGESTIONS: string[] = [\n \"10 Rue de Rivoli, 75001 Paris, France\",\n \"221B Baker Street, NW1 6XE Londres, Royaume-Uni\",\n \"1600 Amphitheatre Parkway, 94043 Mountain View, États-Unis\",\n \"55 Rue du Faubourg Saint-Honoré, 75008 Paris, France\",\n \"1 Place du Commerce, 44000 Nantes, France\",\n \"Piazza del Colosseo 1, 00184 Rome, Italie\",\n \"Av. Paulista 1578, 01310-200 São Paulo, Brésil\",\n];\n\nexport const DEFAULT_FIELDS: Record<InformationType, RequestedFieldKey[]> = {\n identity: [\"nom\", \"prenom\", \"date_naissance\"],\n \"identity-legal\": [\"nom\", \"registrationNumber\", \"siret\", \"tva\", \"adresse\"],\n \"identity-legal-rep\": [\"legalRepresentativeNom\", \"legalRepresentativePrenom\"],\n contact: [\"email\", \"sms\"],\n address: [\"adresse\"],\n nationality: [\"nationalite\"],\n custom: [], // Custom forms use customFields instead\n};\n\nexport const FIELD_LABELS: Record<RequestedFieldKey, string> = {\n nom: \"user_input_form.fields.last_name\",\n prenom: \"user_input_form.fields.first_name\",\n date_naissance: \"user_input_form.fields.birth_date\",\n email: \"user_input_form.fields.email\",\n sms: \"user_input_form.fields.phone\",\n adresse: \"user_input_form.fields.address_line1\",\n nationalite: \"user_input_form.fields.nationality\",\n company: \"user_input_form.fields.company_name\",\n siret: \"user_input_form.fields.siret\",\n tva: \"user_input_form.fields.vat_number\",\n registrationNumber: \"user_input_form.fields.registration_number\",\n legalRepresentativeNom:\n \"user_input_form.fields.legal_representative_last_name\",\n legalRepresentativePrenom:\n \"user_input_form.fields.legal_representative_first_name\",\n};\n\n// Backend endpoint pour l'autocomplétion d'adresses (sécurisé)\nexport const GEOCODING_AUTOCOMPLETE_ENDPOINT = \"/geocoding/autocomplete\";\n\nexport const FALLBACK_ADDRESS_SUGGESTIONS: AddressSuggestion[] =\n ADDRESS_SUGGESTIONS.map((label, index) => ({\n id: `fallback-${index}`,\n label,\n addressLine1: label,\n postalCode: \"\",\n city: \"\",\n country: \"\",\n }));\n"],"names":[],"mappings":";;AAOA,IAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,UAAC,CAAC,EAAE,KAAK,EAAA,EAAK,OAAA,KAAK,GAAG,CAAC,CAAA,CAAT,CAAS,CAAC;AAChE,IAAM,WAAW,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;AAC5C,IAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,UAAC,CAAC,EAAE,KAAK,EAAA,EAAK,OAAA,WAAW,GAAG,KAAK,CAAA,CAAnB,CAAmB,CAAC;AAE5E,IAAM,WAAW,GAAG;IAClB,SAAS;IACT,SAAS;IACT,MAAM;IACN,OAAO;IACP,KAAK;IACL,MAAM;IACN,SAAS;IACT,MAAM;IACN,WAAW;IACX,SAAS;IACT,UAAU;IACV,UAAU;CACX;AAEM,IAAM,WAAW,GAAmB,IAAI,CAAC,GAAG,CAAC,UAAC,KAAK,EAAA,EAAK,QAAC;IAC9D,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;IACrC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;CACtC,EAAC,CAH6D,CAG7D;AAEK,IAAM,aAAa,G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C,IAAA,KAAK,EAAE,8BAA8B;AACrC,IAAA,GAAG,EAAE,mCAAmC;AACxC,IAAA,kBAAkB,EAAE;AAOtB;AACO,IAAM,+BAA+B,GAAG;AAExC,IAAM,4BAA4B,GACvC,mBAAmB,CAAC,GAAG,CAAC,UAAC,KAAK,EAAE,KAAK,EAAA,EAAK,QAAC;IACzC,EAAE,EAAE,WAAA,CAAA,MAAA,CAAY,KAAK,CAAE;AACvB,IAAA,KAAK,EAAA,KAAA;AACL,IAAA,YAAY,EAAE,KAAK;AACnB,IAAA,UAAU,EAAE,EAAE;AACd,IAAA,IAAI,EAAE,EAAE;AACR,IAAA,OAAO,EAAE,EAAE;CACZ,EAAC,CAPwC,CAOxC;;;;;;;;;;;"}
@@ -59,6 +59,8 @@ var useUserInputForm = function (_a) {
59
59
  siret: (initialUserInput === null || initialUserInput === void 0 ? void 0 : initialUserInput.siret) || "",
60
60
  tva: (initialUserInput === null || initialUserInput === void 0 ? void 0 : initialUserInput.tva) || "",
61
61
  registrationNumber: (initialUserInput === null || initialUserInput === void 0 ? void 0 : initialUserInput.registrationNumber) || "",
62
+ legalRepresentativeLastName: (initialUserInput === null || initialUserInput === void 0 ? void 0 : initialUserInput.legalRepresentativeLastName) || "",
63
+ legalRepresentativeFirstName: (initialUserInput === null || initialUserInput === void 0 ? void 0 : initialUserInput.legalRepresentativeFirstName) || "",
62
64
  }), form = _b[0], setForm = _b[1];
63
65
  var _c = React.useState({}), errors = _c[0], setErrors = _c[1];
64
66
  // Custom form state
@@ -367,6 +369,16 @@ var useUserInputForm = function (_a) {
367
369
  markError("registrationNumber");
368
370
  }
369
371
  }
372
+ if (informationType === "identity-legal-rep") {
373
+ if (requestedFields.has("legalRepresentativeNom") &&
374
+ !form.legalRepresentativeLastName) {
375
+ markError("legalRepresentativeLastName");
376
+ }
377
+ if (requestedFields.has("legalRepresentativePrenom") &&
378
+ !form.legalRepresentativeFirstName) {
379
+ markError("legalRepresentativeFirstName");
380
+ }
381
+ }
370
382
  if (informationType === "contact") {
371
383
  if (requestedFields.has("email")) {
372
384
  var emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
@@ -585,7 +597,7 @@ var useUserInputForm = function (_a) {
585
597
  if (!validateForm()) {
586
598
  return;
587
599
  }
588
- setUserInput(function (previous) { return (tslib_es6.__assign(tslib_es6.__assign(tslib_es6.__assign(tslib_es6.__assign(tslib_es6.__assign(tslib_es6.__assign(tslib_es6.__assign(tslib_es6.__assign(tslib_es6.__assign(tslib_es6.__assign(tslib_es6.__assign(tslib_es6.__assign({}, previous), (requestedFields.has("nom") && tslib_es6.__assign({}, (informationType === "identity-legal"
600
+ setUserInput(function (previous) { return (tslib_es6.__assign(tslib_es6.__assign(tslib_es6.__assign(tslib_es6.__assign(tslib_es6.__assign(tslib_es6.__assign(tslib_es6.__assign(tslib_es6.__assign(tslib_es6.__assign(tslib_es6.__assign(tslib_es6.__assign(tslib_es6.__assign(tslib_es6.__assign(tslib_es6.__assign({}, previous), (requestedFields.has("nom") && tslib_es6.__assign({}, (informationType === "identity-legal"
589
601
  ? { companyName: form.companyName }
590
602
  : { lastName: form.lastName })))), (requestedFields.has("prenom") && { firstName: form.firstName })), (requestedFields.has("date_naissance") && {
591
603
  birthDate: form.birthDate,
@@ -600,6 +612,10 @@ var useUserInputForm = function (_a) {
600
612
  countryCode: form.countryCode,
601
613
  })), (requestedFields.has("siret") && { siret: form.siret })), (requestedFields.has("tva") && { tva: form.tva })), (requestedFields.has("registrationNumber") && { registrationNumber: form.registrationNumber })), (requestedFields.has("siret") && !requestedFields.has("registrationNumber") && { registrationNumber: form.siret })), (requestedFields.has("nationalite") && {
602
614
  nationality: form.nationality,
615
+ })), (requestedFields.has("legalRepresentativeNom") && {
616
+ legalRepresentativeLastName: form.legalRepresentativeLastName,
617
+ })), (requestedFields.has("legalRepresentativePrenom") && {
618
+ legalRepresentativeFirstName: form.legalRepresentativeFirstName,
603
619
  }))); });
604
620
  if (informationType === "contact" && setContactInfo) {
605
621
  setContactInfo(function (previous) { return (tslib_es6.__assign(tslib_es6.__assign(tslib_es6.__assign({}, previous), (requestedFields.has("email") && { email: form.email })), (requestedFields.has("sms") && { phoneNumber: form.phoneNumber }))); });