datakeen-session-react 1.1.140-rc.75 → 1.1.140-rc.77

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 (47) hide show
  1. package/dist/cjs/components/legal-consent/LegalConsentNode.js +6 -11
  2. package/dist/cjs/components/legal-consent/LegalConsentNode.js.map +1 -1
  3. package/dist/cjs/components/session/UserInputForm/LegalRepFields.js +45 -0
  4. package/dist/cjs/components/session/UserInputForm/LegalRepFields.js.map +1 -0
  5. package/dist/cjs/components/session/UserInputForm.js +2 -1
  6. package/dist/cjs/components/session/UserInputForm.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 +4 -1
  16. package/dist/cjs/i18n/en.json.js.map +1 -1
  17. package/dist/cjs/i18n/fr.json.js +4 -1
  18. package/dist/cjs/i18n/fr.json.js.map +1 -1
  19. package/dist/cjs/types/session.js.map +1 -1
  20. package/dist/cjs/utils/renderInlineMarkdown.js +75 -0
  21. package/dist/cjs/utils/renderInlineMarkdown.js.map +1 -0
  22. package/dist/cjs/utils/userInputForm.js +1 -0
  23. package/dist/cjs/utils/userInputForm.js.map +1 -1
  24. package/dist/esm/components/legal-consent/LegalConsentNode.js +6 -11
  25. package/dist/esm/components/legal-consent/LegalConsentNode.js.map +1 -1
  26. package/dist/esm/components/session/UserInputForm/LegalRepFields.js +22 -0
  27. package/dist/esm/components/session/UserInputForm/LegalRepFields.js.map +1 -0
  28. package/dist/esm/components/session/UserInputForm.js +2 -1
  29. package/dist/esm/components/session/UserInputForm.js.map +1 -1
  30. package/dist/esm/constants/userInputForm.js +2 -2
  31. package/dist/esm/constants/userInputForm.js.map +1 -1
  32. package/dist/esm/hooks/useUserInputForm.js +17 -1
  33. package/dist/esm/hooks/useUserInputForm.js.map +1 -1
  34. package/dist/esm/i18n/documents/documents.en.json.js +3 -1
  35. package/dist/esm/i18n/documents/documents.en.json.js.map +1 -1
  36. package/dist/esm/i18n/documents/documents.fr.json.js +3 -1
  37. package/dist/esm/i18n/documents/documents.fr.json.js.map +1 -1
  38. package/dist/esm/i18n/en.json.js +4 -1
  39. package/dist/esm/i18n/en.json.js.map +1 -1
  40. package/dist/esm/i18n/fr.json.js +4 -1
  41. package/dist/esm/i18n/fr.json.js.map +1 -1
  42. package/dist/esm/types/session.js.map +1 -1
  43. package/dist/esm/utils/renderInlineMarkdown.js +73 -0
  44. package/dist/esm/utils/renderInlineMarkdown.js.map +1 -0
  45. package/dist/esm/utils/userInputForm.js +1 -0
  46. package/dist/esm/utils/userInputForm.js.map +1 -1
  47. package/package.json +1 -1
@@ -15,6 +15,7 @@ var PageActions = require('../ui/PageActions.js');
15
15
  var MobilePageLayout = require('../ui/MobilePageLayout.js');
16
16
  var useI18n = require('../../hooks/useI18n.js');
17
17
  var sessionService = require('../../services/sessionService.js');
18
+ var renderInlineMarkdown = require('../../utils/renderInlineMarkdown.js');
18
19
 
19
20
  function _interopNamespaceDefault(e) {
20
21
  var n = Object.create(null);
@@ -87,25 +88,19 @@ var LegalConsentNode = function (_a) {
87
88
  });
88
89
  }); };
89
90
  var pageTitle = node.pageTitle || t("LEGAL_CONSENT.default_title");
91
+ // Description unique au format Markdown (liens [libellé](url), gras).
90
92
  var description = node.consentDescription;
91
- var description2 = node.consentDescription2;
93
+ // Rétrocompat : on n'affiche consentDescription2 que pour les anciens nœuds
94
+ // qui n'ont pas de consentDescription (sinon doublon, le texte étant fusionné).
95
+ var description2 = description ? undefined : node.consentDescription2;
92
96
  var checkboxLabel = node.checkboxText || t("LEGAL_CONSENT.default_checkbox");
93
- // Use Datakeen default URLs when fields are left empty
94
- var cguUrl = node.cguUrl || t("LEGAL_CONSENT.default_cgu_url");
95
- var privacyUrl = node.privacyPolicyUrl || t("LEGAL_CONSENT.default_privacy_url");
96
- // Build description text with optional hyperlinks
97
- var renderDescription = function (text, url) {
98
- if (!url || !text)
99
- return jsxRuntime.jsx("p", { children: text });
100
- return (jsxRuntime.jsxs("p", { children: [text, " ", jsxRuntime.jsx("a", { href: url, target: "_blank", rel: "noopener noreferrer", className: "underline text-blue-600 hover:text-blue-800", children: url })] }));
101
- };
102
97
  return (jsxRuntime.jsx(MobilePageLayout.default, { session: session, footer: jsxRuntime.jsxs("div", { className: "w-full space-y-4", children: [(error || submitError) && (jsxRuntime.jsx("div", { className: "bg-red-50 border border-red-200 rounded-lg p-3", children: jsxRuntime.jsx(Body.default, { className: "text-red-600 text-sm text-center", children: submitError
103
98
  ? submitError
104
99
  : t("LEGAL_CONSENT.error.required") }) })), jsxRuntime.jsxs("div", { className: "flex items-start gap-3 p-3 bg-gray-50 rounded-lg", children: [jsxRuntime.jsx(CheckboxPrimitive__namespace.Root, { id: "legal-consent-checkbox-".concat(node.id), checked: checked, onCheckedChange: function (value) { return handleCheckboxChange(!!value); }, className: "mt-1 h-5 w-5 shrink-0 rounded border bg-white transition-colors\n data-[state=checked]:bg-[var(--dk-btn-bg)] data-[state=checked]:border-[var(--dk-btn-bg)]\n ".concat(error
105
100
  ? "border-red-500"
106
101
  : "border-gray-300 hover:border-gray-400", "\n "), children: jsxRuntime.jsx(CheckboxPrimitive__namespace.Indicator, { className: "flex items-center justify-center text-white", children: jsxRuntime.jsx(reactIcons.CheckIcon, { className: "h-4 w-4" }) }) }), jsxRuntime.jsx(Label__namespace.Root, { htmlFor: "legal-consent-checkbox-".concat(node.id), className: "cursor-pointer", children: jsxRuntime.jsx(Body.default, { className: "text-left text-sm leading-relaxed ".concat(error ? "text-red-600" : "text-gray-700"), children: checkboxLabel }) })] }), jsxRuntime.jsx(PageActions.default, { primary: jsxRuntime.jsx(Button.default, { onClick: handleContinue, disabled: (isRequired && !checked) || isSubmitting, children: isSubmitting
107
102
  ? t("LEGAL_CONSENT.button.loading")
108
- : t("LEGAL_CONSENT.button.continue") }) })] }), children: jsxRuntime.jsx("div", { className: "px-4 py-8 md:px-8 flex flex-col", children: jsxRuntime.jsxs("div", { className: "w-full max-w-2xl mx-auto space-y-6", children: [jsxRuntime.jsx("div", { className: "text-center", children: jsxRuntime.jsx(Title.default, { className: "text-xl md:text-2xl lg:text-3xl mb-6", children: pageTitle }) }), (description || description2) && (jsxRuntime.jsx("div", { className: "bg-gray-50 rounded-lg p-4 md:p-6", children: jsxRuntime.jsxs(Body.default, { className: "text-left text-sm md:text-base leading-relaxed space-y-4", children: [description && renderDescription(description, cguUrl), description2 && renderDescription(description2, privacyUrl)] }) }))] }) }) }));
103
+ : t("LEGAL_CONSENT.button.continue") }) })] }), children: jsxRuntime.jsx("div", { className: "px-4 py-8 md:px-8 flex flex-col", children: jsxRuntime.jsxs("div", { className: "w-full max-w-2xl mx-auto space-y-6", children: [jsxRuntime.jsx("div", { className: "text-center", children: jsxRuntime.jsx(Title.default, { className: "text-xl md:text-2xl lg:text-3xl mb-6", children: pageTitle }) }), (description || description2) && (jsxRuntime.jsx("div", { className: "bg-gray-50 rounded-lg p-4 md:p-6", children: jsxRuntime.jsxs(Body.default, { className: "text-left text-sm md:text-base leading-relaxed space-y-4", children: [description && renderInlineMarkdown.renderInlineMarkdown(description), description2 && renderInlineMarkdown.renderInlineMarkdown(description2)] }) }))] }) }) }));
109
104
  };
110
105
 
111
106
  exports.default = LegalConsentNode;
@@ -1 +1 @@
1
- {"version":3,"file":"LegalConsentNode.js","sources":["../../../../../src/components/legal-consent/LegalConsentNode.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport * as CheckboxPrimitive from \"@radix-ui/react-checkbox\";\nimport * as LabelPrimitive from \"@radix-ui/react-label\";\nimport { CheckIcon } from \"@radix-ui/react-icons\";\nimport Body from \"../ui/Body\";\nimport Title from \"../ui/Title\";\nimport Button from \"../ui/Button\";\nimport PageActions from \"../ui/PageActions\";\nimport MobilePageLayout from \"../ui/MobilePageLayout\";\nimport { useI18n } from \"../../hooks/useI18n\";\nimport { updateSessionUserInput } from \"../../services/sessionService\";\nimport type { SessionData, SessionTemplateNode, stepObject } from \"../../types/session\";\n\ninterface LegalConsentNodeProps {\n node: SessionTemplateNode;\n session: SessionData;\n sessionId: string;\n stepObject: stepObject;\n}\n\nconst LegalConsentNode = ({\n node,\n session,\n sessionId,\n stepObject,\n}: LegalConsentNodeProps) => {\n const { t } = useI18n();\n const [checked, setChecked] = useState(false);\n const [error, setError] = useState(false);\n const [submitError, setSubmitError] = useState<string | null>(null);\n const [isSubmitting, setIsSubmitting] = useState(false);\n\n const isRequired = node.isRequired !== false; // true by default\n\n const handleCheckboxChange = (value: boolean) => {\n setChecked(value);\n setError(false);\n setSubmitError(null);\n };\n\n const handleContinue = async () => {\n if (isRequired && !checked) {\n setError(true);\n return;\n }\n\n setIsSubmitting(true);\n try {\n // Merge consent data with existing userInput (backend does full replacement)\n const existingUserInput = (session.userInput as Record<string, unknown>) ?? {};\n const merged = {\n ...existingUserInput,\n [node.id]: {\n accepted: checked,\n timestamp: new Date().toISOString(),\n },\n };\n await updateSessionUserInput(sessionId, merged);\n stepObject.goToNextStep(node.id, session.template);\n } catch (err) {\n console.error(t(\"LEGAL_CONSENT.error.console_update\"), err);\n setSubmitError(t(\"LEGAL_CONSENT.error.general\"));\n } finally {\n setIsSubmitting(false);\n }\n };\n\n const pageTitle = node.pageTitle || t(\"LEGAL_CONSENT.default_title\");\n const description = node.consentDescription;\n const description2 = node.consentDescription2;\n const checkboxLabel = node.checkboxText || t(\"LEGAL_CONSENT.default_checkbox\");\n\n // Use Datakeen default URLs when fields are left empty\n const cguUrl = node.cguUrl || t(\"LEGAL_CONSENT.default_cgu_url\");\n const privacyUrl = node.privacyPolicyUrl || t(\"LEGAL_CONSENT.default_privacy_url\");\n\n // Build description text with optional hyperlinks\n const renderDescription = (text: string, url?: string) => {\n if (!url || !text) return <p>{text}</p>;\n return (\n <p>\n {text}{\" \"}\n <a\n href={url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"underline text-blue-600 hover:text-blue-800\"\n >\n {url}\n </a>\n </p>\n );\n };\n\n return (\n <MobilePageLayout\n session={session}\n footer={\n <div className=\"w-full space-y-4\">\n {/* Error message */}\n {(error || submitError) && (\n <div className=\"bg-red-50 border border-red-200 rounded-lg p-3\">\n <Body className=\"text-red-600 text-sm text-center\">\n {submitError\n ? submitError\n : t(\"LEGAL_CONSENT.error.required\")}\n </Body>\n </div>\n )}\n\n {/* Consent checkbox */}\n <div className=\"flex items-start gap-3 p-3 bg-gray-50 rounded-lg\">\n <CheckboxPrimitive.Root\n id={`legal-consent-checkbox-${node.id}`}\n checked={checked}\n onCheckedChange={(value) => handleCheckboxChange(!!value)}\n className={`mt-1 h-5 w-5 shrink-0 rounded border bg-white transition-colors\n data-[state=checked]:bg-[var(--dk-btn-bg)] data-[state=checked]:border-[var(--dk-btn-bg)]\n ${error\n ? \"border-red-500\"\n : \"border-gray-300 hover:border-gray-400\"\n }\n `}\n >\n <CheckboxPrimitive.Indicator className=\"flex items-center justify-center text-white\">\n <CheckIcon className=\"h-4 w-4\" />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n\n <LabelPrimitive.Root\n htmlFor={`legal-consent-checkbox-${node.id}`}\n className=\"cursor-pointer\"\n >\n <Body\n className={`text-left text-sm leading-relaxed ${\n error ? \"text-red-600\" : \"text-gray-700\"\n }`}\n >\n {checkboxLabel}\n </Body>\n </LabelPrimitive.Root>\n </div>\n\n {/* Continue button */}\n <PageActions\n primary={\n <Button\n onClick={handleContinue}\n disabled={(isRequired && !checked) || isSubmitting}\n >\n {isSubmitting\n ? t(\"LEGAL_CONSENT.button.loading\")\n : t(\"LEGAL_CONSENT.button.continue\")}\n </Button>\n }\n />\n </div>\n }\n >\n <div className=\"px-4 py-8 md:px-8 flex flex-col\">\n <div className=\"w-full max-w-2xl mx-auto space-y-6\">\n <div className=\"text-center\">\n <Title className=\"text-xl md:text-2xl lg:text-3xl mb-6\">\n {pageTitle}\n </Title>\n </div>\n\n {/* Consent content */}\n {(description || description2) && (\n <div className=\"bg-gray-50 rounded-lg p-4 md:p-6\">\n <Body className=\"text-left text-sm md:text-base leading-relaxed space-y-4\">\n {description && renderDescription(description, cguUrl)}\n {description2 && renderDescription(description2, privacyUrl)}\n </Body>\n </div>\n )}\n </div>\n </div>\n </MobilePageLayout>\n );\n};\n\nexport default LegalConsentNode;\n"],"names":["useI18n","useState","__awaiter","updateSessionUserInput","_jsx","_jsxs","MobilePageLayout","Body","CheckboxPrimitive","CheckIcon","LabelPrimitive","PageActions","Button","Title"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,IAAM,gBAAgB,GAAG,UAAC,EAKF,EAAA;QAJtB,IAAI,GAAA,EAAA,CAAA,IAAA,EACJ,OAAO,GAAA,EAAA,CAAA,OAAA,EACP,SAAS,GAAA,EAAA,CAAA,SAAA,EACT,UAAU,GAAA,EAAA,CAAA,UAAA;AAEF,IAAA,IAAA,CAAC,GAAKA,eAAO,EAAE,EAAd;IACH,IAAA,EAAA,GAAwBC,cAAQ,CAAC,KAAK,CAAC,EAAtC,OAAO,GAAA,EAAA,CAAA,CAAA,CAAA,EAAE,UAAU,GAAA,EAAA,CAAA,CAAA,CAAmB;IACvC,IAAA,EAAA,GAAoBA,cAAQ,CAAC,KAAK,CAAC,EAAlC,KAAK,GAAA,EAAA,CAAA,CAAA,CAAA,EAAE,QAAQ,GAAA,EAAA,CAAA,CAAA,CAAmB;IACnC,IAAA,EAAA,GAAgCA,cAAQ,CAAgB,IAAI,CAAC,EAA5D,WAAW,GAAA,EAAA,CAAA,CAAA,CAAA,EAAE,cAAc,GAAA,EAAA,CAAA,CAAA,C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AC,8BAA8B;AAClC,8BAAE,CAAC,CAAC,+BAA+B,CAAC,GAC/B,EAAA,CAEX,CAAA,EAAA,CACE,EAAA,QAAA,EAGRR,cAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,iCAAiC,EAAA,QAAA,EAC9CC,eAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,oCAAoC,EAAA,QAAA,EAAA,CACjDD,cAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,aAAa,EAAA,QAAA,EAC1BA,cAAA,CAACS,aAAK,EAAA,EAAC,SAAS,EAAC,sCAAsC,YACpD,SAAS,EAAA,CACJ,GACJ,EAGL,CAAC,WAAW,IAAI,YAAY,MAC3BT,cAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,kCAAkC,YAC/CC,eAAA,CAACE,YAAI,EAAA,EAAC,SAAS,EAAC,0DAA0D,EAAA,QAAA,EAAA,CACvE,WAAW,IAAI,iBAAiB,CAAC,WAAW,EAAE,MAAM,CAAC,EACrD,YAAY,IAAI,iBAAiB,CAAC,YAAY,EAAE,UAAU,CAAC,IACvD,EAAA,CACH,CACP,IACG,EAAA,CACF,EAAA,CACW;AAEvB;;;;"}
1
+ {"version":3,"file":"LegalConsentNode.js","sources":["../../../../../src/components/legal-consent/LegalConsentNode.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport * as CheckboxPrimitive from \"@radix-ui/react-checkbox\";\nimport * as LabelPrimitive from \"@radix-ui/react-label\";\nimport { CheckIcon } from \"@radix-ui/react-icons\";\nimport Body from \"../ui/Body\";\nimport Title from \"../ui/Title\";\nimport Button from \"../ui/Button\";\nimport PageActions from \"../ui/PageActions\";\nimport MobilePageLayout from \"../ui/MobilePageLayout\";\nimport { useI18n } from \"../../hooks/useI18n\";\nimport { updateSessionUserInput } from \"../../services/sessionService\";\nimport { renderInlineMarkdown } from \"../../utils/renderInlineMarkdown\";\nimport type { SessionData, SessionTemplateNode, stepObject } from \"../../types/session\";\n\ninterface LegalConsentNodeProps {\n node: SessionTemplateNode;\n session: SessionData;\n sessionId: string;\n stepObject: stepObject;\n}\n\nconst LegalConsentNode = ({\n node,\n session,\n sessionId,\n stepObject,\n}: LegalConsentNodeProps) => {\n const { t } = useI18n();\n const [checked, setChecked] = useState(false);\n const [error, setError] = useState(false);\n const [submitError, setSubmitError] = useState<string | null>(null);\n const [isSubmitting, setIsSubmitting] = useState(false);\n\n const isRequired = node.isRequired !== false; // true by default\n\n const handleCheckboxChange = (value: boolean) => {\n setChecked(value);\n setError(false);\n setSubmitError(null);\n };\n\n const handleContinue = async () => {\n if (isRequired && !checked) {\n setError(true);\n return;\n }\n\n setIsSubmitting(true);\n try {\n // Merge consent data with existing userInput (backend does full replacement)\n const existingUserInput = (session.userInput as Record<string, unknown>) ?? {};\n const merged = {\n ...existingUserInput,\n [node.id]: {\n accepted: checked,\n timestamp: new Date().toISOString(),\n },\n };\n await updateSessionUserInput(sessionId, merged);\n stepObject.goToNextStep(node.id, session.template);\n } catch (err) {\n console.error(t(\"LEGAL_CONSENT.error.console_update\"), err);\n setSubmitError(t(\"LEGAL_CONSENT.error.general\"));\n } finally {\n setIsSubmitting(false);\n }\n };\n\n const pageTitle = node.pageTitle || t(\"LEGAL_CONSENT.default_title\");\n // Description unique au format Markdown (liens [libellé](url), gras).\n const description = node.consentDescription;\n // Rétrocompat : on n'affiche consentDescription2 que pour les anciens nœuds\n // qui n'ont pas de consentDescription (sinon doublon, le texte étant fusionné).\n const description2 = description ? undefined : node.consentDescription2;\n const checkboxLabel = node.checkboxText || t(\"LEGAL_CONSENT.default_checkbox\");\n\n return (\n <MobilePageLayout\n session={session}\n footer={\n <div className=\"w-full space-y-4\">\n {/* Error message */}\n {(error || submitError) && (\n <div className=\"bg-red-50 border border-red-200 rounded-lg p-3\">\n <Body className=\"text-red-600 text-sm text-center\">\n {submitError\n ? submitError\n : t(\"LEGAL_CONSENT.error.required\")}\n </Body>\n </div>\n )}\n\n {/* Consent checkbox */}\n <div className=\"flex items-start gap-3 p-3 bg-gray-50 rounded-lg\">\n <CheckboxPrimitive.Root\n id={`legal-consent-checkbox-${node.id}`}\n checked={checked}\n onCheckedChange={(value) => handleCheckboxChange(!!value)}\n className={`mt-1 h-5 w-5 shrink-0 rounded border bg-white transition-colors\n data-[state=checked]:bg-[var(--dk-btn-bg)] data-[state=checked]:border-[var(--dk-btn-bg)]\n ${error\n ? \"border-red-500\"\n : \"border-gray-300 hover:border-gray-400\"\n }\n `}\n >\n <CheckboxPrimitive.Indicator className=\"flex items-center justify-center text-white\">\n <CheckIcon className=\"h-4 w-4\" />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n\n <LabelPrimitive.Root\n htmlFor={`legal-consent-checkbox-${node.id}`}\n className=\"cursor-pointer\"\n >\n <Body\n className={`text-left text-sm leading-relaxed ${\n error ? \"text-red-600\" : \"text-gray-700\"\n }`}\n >\n {checkboxLabel}\n </Body>\n </LabelPrimitive.Root>\n </div>\n\n {/* Continue button */}\n <PageActions\n primary={\n <Button\n onClick={handleContinue}\n disabled={(isRequired && !checked) || isSubmitting}\n >\n {isSubmitting\n ? t(\"LEGAL_CONSENT.button.loading\")\n : t(\"LEGAL_CONSENT.button.continue\")}\n </Button>\n }\n />\n </div>\n }\n >\n <div className=\"px-4 py-8 md:px-8 flex flex-col\">\n <div className=\"w-full max-w-2xl mx-auto space-y-6\">\n <div className=\"text-center\">\n <Title className=\"text-xl md:text-2xl lg:text-3xl mb-6\">\n {pageTitle}\n </Title>\n </div>\n\n {/* Consent content */}\n {(description || description2) && (\n <div className=\"bg-gray-50 rounded-lg p-4 md:p-6\">\n <Body className=\"text-left text-sm md:text-base leading-relaxed space-y-4\">\n {/* Descriptions au format Markdown : liens cliquables dans le texte. */}\n {description && renderInlineMarkdown(description)}\n {description2 && renderInlineMarkdown(description2)}\n </Body>\n </div>\n )}\n </div>\n </div>\n </MobilePageLayout>\n );\n};\n\nexport default LegalConsentNode;\n"],"names":["useI18n","useState","__awaiter","update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ACT,EAAA,CACa,CAAA,EAAA,CAClB,EAGNH,cAAA,CAACO,mBAAW,EAAA,EACV,OAAO,EACLP,cAAA,CAACQ,cAAM,IACL,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,CAAC,UAAU,IAAI,CAAC,OAAO,KAAK,YAAY,YAEjD;AACC,8BAAE,CAAC,CAAC,8BAA8B;AAClC,8BAAE,CAAC,CAAC,+BAA+B,CAAC,EAAA,CAC/B,EAAA,CAEX,CAAA,EAAA,CACE,EAAA,QAAA,EAGRR,wBAAK,SAAS,EAAC,iCAAiC,EAAA,QAAA,EAC9CE,yBAAK,SAAS,EAAC,oCAAoC,EAAA,QAAA,EAAA,CACjDF,wBAAK,SAAS,EAAC,aAAa,EAAA,QAAA,EAC1BA,eAACS,aAAK,EAAA,EAAC,SAAS,EAAC,sCAAsC,EAAA,QAAA,EACpD,SAAS,EAAA,CACJ,EAAA,CACJ,EAGL,CAAC,WAAW,IAAI,YAAY,MAC3BT,cAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,kCAAkC,EAAA,QAAA,EAC/CE,eAAA,CAACC,YAAI,EAAA,EAAC,SAAS,EAAC,0DAA0D,aAEvE,WAAW,IAAIO,yCAAoB,CAAC,WAAW,CAAC,EAChD,YAAY,IAAIA,yCAAoB,CAAC,YAAY,CAAC,CAAA,EAAA,CAC9C,GACH,CACP,CAAA,EAAA,CACG,EAAA,CACF,EAAA,CACW;AAEvB;;;;"}
@@ -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};\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SAAS,EAAC,cAAc,uBAAS,EACtC,CAAC,CACA,gEAAgE,CACjE,IACC,CACL,CAAA,EAAA,CACG,CACP,EAEA,eAAe,CAAC,GAAG,CAAC,2BAA2B,CAAC,KAC/CF,eAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,WAAW,aACxBE,cAAA,CAACC,gBAAK,CAAC,IAAI,EAAA,EACT,OAAO,EAAC,8BAA8B,EACtC,SAAS,EAAC,wDAAwD,EAAA,QAAA,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,I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,cAAA,CAACS,wBAAgB,EAAA,EACf,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,eAAe,EAChC,aAAa,EAAE,iBAAiB,EAAA,CAChC,CACH,EAEA,eAAe,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,CAAC,YAAY,KACtDT,cAAA,CAACU,wBAAgB,EAAA,EACf,YAAY,EAAE,KAAK,CAAC,IAAI,CAAC,YAAY,EACrC,QAAQ,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,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Ae,EAChC,aAAa,EAAE,iBAAiB,GAChC,CACH,EAEA,eAAe,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,CAAC,YAAY,KACtDX,cAAA,CAACY,wBAAgB,EAAA,EACf,YAAY,EAAE,KAAK,CAAC,IAAI,CAAC,YAAY,EACrC,QAAQ,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,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;;;;"}
@@ -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,OAAA,WAAW,GAAG,KAAK,CAAA,CAAnB,CAAmB,CAAC;AAE5E,IAAM,WAAW,GAAG;IAClB,SAAS;IACT,SAAS;IACT,MAAM;IACN,OAAO;IACP,KAAK;IACL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W,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,GAAmB,WAAW,CAAC,GAAG,CAC1D,UAAC,KAAK,EAAE,KAAK,EAAA,EAAK,QAAC;AACjB,IAAA,KAAK,EAAE,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC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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 }))); });