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.
- package/dist/cjs/components/legal-consent/LegalConsentNode.js +6 -11
- package/dist/cjs/components/legal-consent/LegalConsentNode.js.map +1 -1
- package/dist/cjs/components/session/UserInputForm/LegalRepFields.js +45 -0
- package/dist/cjs/components/session/UserInputForm/LegalRepFields.js.map +1 -0
- package/dist/cjs/components/session/UserInputForm.js +2 -1
- package/dist/cjs/components/session/UserInputForm.js.map +1 -1
- package/dist/cjs/constants/userInputForm.js +2 -2
- package/dist/cjs/constants/userInputForm.js.map +1 -1
- package/dist/cjs/hooks/useUserInputForm.js +17 -1
- package/dist/cjs/hooks/useUserInputForm.js.map +1 -1
- package/dist/cjs/i18n/documents/documents.en.json.js +3 -0
- package/dist/cjs/i18n/documents/documents.en.json.js.map +1 -1
- package/dist/cjs/i18n/documents/documents.fr.json.js +3 -0
- package/dist/cjs/i18n/documents/documents.fr.json.js.map +1 -1
- package/dist/cjs/i18n/en.json.js +4 -1
- package/dist/cjs/i18n/en.json.js.map +1 -1
- package/dist/cjs/i18n/fr.json.js +4 -1
- package/dist/cjs/i18n/fr.json.js.map +1 -1
- package/dist/cjs/types/session.js.map +1 -1
- package/dist/cjs/utils/renderInlineMarkdown.js +75 -0
- package/dist/cjs/utils/renderInlineMarkdown.js.map +1 -0
- package/dist/cjs/utils/userInputForm.js +1 -0
- package/dist/cjs/utils/userInputForm.js.map +1 -1
- package/dist/esm/components/legal-consent/LegalConsentNode.js +6 -11
- package/dist/esm/components/legal-consent/LegalConsentNode.js.map +1 -1
- package/dist/esm/components/session/UserInputForm/LegalRepFields.js +22 -0
- package/dist/esm/components/session/UserInputForm/LegalRepFields.js.map +1 -0
- package/dist/esm/components/session/UserInputForm.js +2 -1
- package/dist/esm/components/session/UserInputForm.js.map +1 -1
- package/dist/esm/constants/userInputForm.js +2 -2
- package/dist/esm/constants/userInputForm.js.map +1 -1
- package/dist/esm/hooks/useUserInputForm.js +17 -1
- package/dist/esm/hooks/useUserInputForm.js.map +1 -1
- package/dist/esm/i18n/documents/documents.en.json.js +3 -1
- package/dist/esm/i18n/documents/documents.en.json.js.map +1 -1
- package/dist/esm/i18n/documents/documents.fr.json.js +3 -1
- package/dist/esm/i18n/documents/documents.fr.json.js.map +1 -1
- package/dist/esm/i18n/en.json.js +4 -1
- package/dist/esm/i18n/en.json.js.map +1 -1
- package/dist/esm/i18n/fr.json.js +4 -1
- package/dist/esm/i18n/fr.json.js.map +1 -1
- package/dist/esm/types/session.js.map +1 -1
- package/dist/esm/utils/renderInlineMarkdown.js +73 -0
- package/dist/esm/utils/renderInlineMarkdown.js.map +1 -0
- package/dist/esm/utils/userInputForm.js +1 -0
- package/dist/esm/utils/userInputForm.js.map +1 -1
- package/package.json +1 -1
|
@@ -11,6 +11,7 @@ import PageActions from '../ui/PageActions.js';
|
|
|
11
11
|
import MobilePageLayout from '../ui/MobilePageLayout.js';
|
|
12
12
|
import { useI18n } from '../../hooks/useI18n.js';
|
|
13
13
|
import { updateSessionUserInput } from '../../services/sessionService.js';
|
|
14
|
+
import { renderInlineMarkdown } from '../../utils/renderInlineMarkdown.js';
|
|
14
15
|
|
|
15
16
|
var LegalConsentNode = function (_a) {
|
|
16
17
|
var node = _a.node, session = _a.session, sessionId = _a.sessionId, stepObject = _a.stepObject;
|
|
@@ -63,25 +64,19 @@ var LegalConsentNode = function (_a) {
|
|
|
63
64
|
});
|
|
64
65
|
}); };
|
|
65
66
|
var pageTitle = node.pageTitle || t("LEGAL_CONSENT.default_title");
|
|
67
|
+
// Description unique au format Markdown (liens [libellé](url), gras).
|
|
66
68
|
var description = node.consentDescription;
|
|
67
|
-
|
|
69
|
+
// Rétrocompat : on n'affiche consentDescription2 que pour les anciens nœuds
|
|
70
|
+
// qui n'ont pas de consentDescription (sinon doublon, le texte étant fusionné).
|
|
71
|
+
var description2 = description ? undefined : node.consentDescription2;
|
|
68
72
|
var checkboxLabel = node.checkboxText || t("LEGAL_CONSENT.default_checkbox");
|
|
69
|
-
// Use Datakeen default URLs when fields are left empty
|
|
70
|
-
var cguUrl = node.cguUrl || t("LEGAL_CONSENT.default_cgu_url");
|
|
71
|
-
var privacyUrl = node.privacyPolicyUrl || t("LEGAL_CONSENT.default_privacy_url");
|
|
72
|
-
// Build description text with optional hyperlinks
|
|
73
|
-
var renderDescription = function (text, url) {
|
|
74
|
-
if (!url || !text)
|
|
75
|
-
return jsx("p", { children: text });
|
|
76
|
-
return (jsxs("p", { children: [text, " ", jsx("a", { href: url, target: "_blank", rel: "noopener noreferrer", className: "underline text-blue-600 hover:text-blue-800", children: url })] }));
|
|
77
|
-
};
|
|
78
73
|
return (jsx(MobilePageLayout, { session: session, footer: jsxs("div", { className: "w-full space-y-4", children: [(error || submitError) && (jsx("div", { className: "bg-red-50 border border-red-200 rounded-lg p-3", children: jsx(Body, { className: "text-red-600 text-sm text-center", children: submitError
|
|
79
74
|
? submitError
|
|
80
75
|
: t("LEGAL_CONSENT.error.required") }) })), jsxs("div", { className: "flex items-start gap-3 p-3 bg-gray-50 rounded-lg", children: [jsx(CheckboxPrimitive.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
|
|
81
76
|
? "border-red-500"
|
|
82
77
|
: "border-gray-300 hover:border-gray-400", "\n "), children: jsx(CheckboxPrimitive.Indicator, { className: "flex items-center justify-center text-white", children: jsx(CheckIcon, { className: "h-4 w-4" }) }) }), jsx(Label.Root, { htmlFor: "legal-consent-checkbox-".concat(node.id), className: "cursor-pointer", children: jsx(Body, { className: "text-left text-sm leading-relaxed ".concat(error ? "text-red-600" : "text-gray-700"), children: checkboxLabel }) })] }), jsx(PageActions, { primary: jsx(Button, { onClick: handleContinue, disabled: (isRequired && !checked) || isSubmitting, children: isSubmitting
|
|
83
78
|
? t("LEGAL_CONSENT.button.loading")
|
|
84
|
-
: t("LEGAL_CONSENT.button.continue") }) })] }), children: jsx("div", { className: "px-4 py-8 md:px-8 flex flex-col", children: jsxs("div", { className: "w-full max-w-2xl mx-auto space-y-6", children: [jsx("div", { className: "text-center", children: jsx(Title, { className: "text-xl md:text-2xl lg:text-3xl mb-6", children: pageTitle }) }), (description || description2) && (jsx("div", { className: "bg-gray-50 rounded-lg p-4 md:p-6", children: jsxs(Body, { className: "text-left text-sm md:text-base leading-relaxed space-y-4", children: [description &&
|
|
79
|
+
: t("LEGAL_CONSENT.button.continue") }) })] }), children: jsx("div", { className: "px-4 py-8 md:px-8 flex flex-col", children: jsxs("div", { className: "w-full max-w-2xl mx-auto space-y-6", children: [jsx("div", { className: "text-center", children: jsx(Title, { className: "text-xl md:text-2xl lg:text-3xl mb-6", children: pageTitle }) }), (description || description2) && (jsx("div", { className: "bg-gray-50 rounded-lg p-4 md:p-6", children: jsxs(Body, { className: "text-left text-sm md:text-base leading-relaxed space-y-4", children: [description && renderInlineMarkdown(description), description2 && renderInlineMarkdown(description2)] }) }))] }) }) }));
|
|
85
80
|
};
|
|
86
81
|
|
|
87
82
|
export { LegalConsentNode as default };
|
|
@@ -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":["_jsx","_jsxs","LabelPrimitive"],"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,GAAK,OAAO,EAAE,EAAd;IACH,IAAA,EAAA,GAAwB,QAAQ,CAAC,KAAK,CAAC,EAAtC,OAAO,GAAA,EAAA,CAAA,CAAA,CAAA,EAAE,UAAU,GAAA,EAAA,CAAA,CAAA,CAAmB;IACvC,IAAA,EAAA,GAAoB,QAAQ,CAAC,KAAK,CAAC,EAAlC,KAAK,GAAA,EAAA,CAAA,CAAA,CAAA,EAAE,QAAQ,GAAA,EAAA,CAAA,CAAA,CAAmB;IACnC,IAAA,EAAA,GAAgC,QAAQ,CAAgB,IAAI,CAAC,EAA5D,WAAW,GAAA,EAAA,CAAA,CAAA,CAAA,EAAE,cAAc,GAAA,EAAA,CAAA,CAAA,CAAiC;IAC7D,IAAA,EAAA,GAAkC,QAAQ,CAAC,KAAK,CAAC,EAAhD,YAAY,GAAA,EAAA,CAAA,CAAA,CAAA,EAAE,eAAe,GAAA,EAAA,CAAA,CAAA,CAAmB;IAEvD,IAAM,UAAU,GAAG,IAAI,CAAC,UAAU,KAAK,KAAK,CAAC;IAE7C,IAAM,oBAAoB,GAAG,UAAC,KAAc,EAAA;QAC1C,UAAU,CAAC,KAAK,CAAC;QACjB,QAAQ,CAAC,KAAK,CAAC;QACf,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AC,KAAK,EAAA,EAAC,SAAS,EAAC,sCAAsC,YACpD,SAAS,EAAA,CACJ,GACJ,EAGL,CAAC,WAAW,IAAI,YAAY,MAC3BA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,kCAAkC,YAC/CC,IAAA,CAAC,IAAI,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":["_jsx","_jsxs","LabelPrimitive"],"mappings":";;;;;;;;;;;;;;;AAqBA,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,GAAK,OAAO,EAAE,EAAd;IACH,IAAA,EAAA,GAAwB,QAAQ,CAAC,KAAK,CAAC,EAAtC,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EAC1BA,IAAC,KAAK,EAAA,EAAC,SAAS,EAAC,sCAAsC,EAAA,QAAA,EACpD,SAAS,EAAA,CACJ,EAAA,CACJ,EAGL,CAAC,WAAW,IAAI,YAAY,MAC3BA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,kCAAkC,EAAA,QAAA,EAC/CC,IAAA,CAAC,IAAI,EAAA,EAAC,SAAS,EAAC,0DAA0D,aAEvE,WAAW,IAAI,oBAAoB,CAAC,WAAW,CAAC,EAChD,YAAY,IAAI,oBAAoB,CAAC,YAAY,CAAC,CAAA,EAAA,CAC9C,GACH,CACP,CAAA,EAAA,CACG,EAAA,CACF,EAAA,CACW;AAEvB;;;;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { Fragment } from 'react';
|
|
3
|
+
import * as Label from '@radix-ui/react-label';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import { useI18n } from '../../../hooks/useI18n.js';
|
|
6
|
+
|
|
7
|
+
var LegalRepFields = function (_a) {
|
|
8
|
+
var form = _a.form, errors = _a.errors, requestedFields = _a.requestedFields, onFieldChange = _a.onFieldChange;
|
|
9
|
+
var t = useI18n().t;
|
|
10
|
+
return (jsxs(Fragment, { children: [requestedFields.has("legalRepresentativeNom") && (jsxs("div", { className: "space-y-2", children: [jsx(Label.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") }), jsx("input", { id: "legalRepresentativeLastName", type: "text", value: form.legalRepresentativeLastName || "", onChange: function (event) {
|
|
11
|
+
return onFieldChange("legalRepresentativeLastName", event.target.value);
|
|
12
|
+
}, 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
|
|
13
|
+
? "border-red-500 bg-red-50"
|
|
14
|
+
: "border-gray-300 hover-border-gray-400"), autoComplete: "off" }), errors.legalRepresentativeLastName && (jsxs("p", { className: "text-red-600 text-sm flex items-center gap-1", children: [jsx("span", { className: "text-red-500", children: "\u26A0" }), t("user_input_form.errors.legal_representative_last_name_required")] }))] })), requestedFields.has("legalRepresentativePrenom") && (jsxs("div", { className: "space-y-2", children: [jsx(Label.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") }), jsx("input", { id: "legalRepresentativeFirstName", type: "text", value: form.legalRepresentativeFirstName || "", onChange: function (event) {
|
|
15
|
+
return onFieldChange("legalRepresentativeFirstName", event.target.value);
|
|
16
|
+
}, 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
|
|
17
|
+
? "border-red-500 bg-red-50"
|
|
18
|
+
: "border-gray-300 hover-border-gray-400"), autoComplete: "off" }), errors.legalRepresentativeFirstName && (jsxs("p", { className: "text-red-600 text-sm flex items-center gap-1", children: [jsx("span", { className: "text-red-500", children: "\u26A0" }), t("user_input_form.errors.legal_representative_first_name_required")] }))] }))] }));
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export { LegalRepFields as default };
|
|
22
|
+
//# 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":["_jsxs","_jsx"],"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,IAAA,IAAA,CAAC,GAAK,OAAO,EAAE,EAAd;IAET,QACEA,IAAA,CAAC,QAAQ,EAAA,EAAA,QAAA,EAAA,CACN,eAAe,CAAC,GAAG,CAAC,wBAAwB,CAAC,KAC5CA,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,WAAW,EAAA,QAAA,EAAA,CACxBC,GAAA,CAAC,KAAK,CAAC,IAAI,EAAA,EACT,OAAO,EAAC,6BAA6B,EACrC,SAAS,EAAC,wDAAwD,YAEjE,CAAC,CACA,uDAAuD,EACvD,2BAA2B,CAC5B,EAAA,CACU,EACbA,GAAA,CAAA,OAAA,EAAA,EACE,EAAE,EAAC,6BAA6B,EAChC,IAAI,EAAC,MAAM,EACX,KAAK,EAAE,IAAI,CAAC,2BAA2B,IAAI,EAAE,EAC7C,QAAQ,EAAE,UAAC,KAAK,EAAA;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AA4B,KAClCD,YAAG,SAAS,EAAC,8CAA8C,EAAA,QAAA,EAAA,CACzDC,cAAM,SAAS,EAAC,cAAc,EAAA,QAAA,EAAA,QAAA,EAAA,CAAS,EACtC,CAAC,CACA,iEAAiE,CAClE,IACC,CACL,CAAA,EAAA,CACG,CACP,CAAA,EAAA,CACQ;AAEf;;;;"}
|
|
@@ -7,6 +7,7 @@ import { useI18n } from '../../hooks/useI18n.js';
|
|
|
7
7
|
import { useUserInputForm } from '../../hooks/useUserInputForm.js';
|
|
8
8
|
import IdentityFields from './UserInputForm/IdentityFields.js';
|
|
9
9
|
import LegalEntityFields from './UserInputForm/LegalEntityFields.js';
|
|
10
|
+
import LegalRepFields from './UserInputForm/LegalRepFields.js';
|
|
10
11
|
import ContactFields from './UserInputForm/ContactFields.js';
|
|
11
12
|
import AddressFields from './UserInputForm/AddressFields.js';
|
|
12
13
|
import NationalityField from './UserInputForm/NationalityField.js';
|
|
@@ -28,7 +29,7 @@ var UserInputForm = function (props) {
|
|
|
28
29
|
return (jsxs(MobilePageLayout, { contentClassName: "h-full", footer: jsx(PageActions, { primary: jsx(Button, { onClick: goOnNextStep, children: t("user_input_form.buttons.continue") }), secondary: jsx(Button, { variant: "secondary", onClick: goOnPreviousStep, children: t("user_input_form.buttons.back") }) }), children: [typeof process !== "undefined" &&
|
|
29
30
|
((_a = process.env) === null || _a === void 0 ? void 0 : _a.NODE_ENV) === "development" && (jsx("div", { className: "fixed right-0 top-0 z-50 bg-green-500 p-2 text-xs text-white", children: "UserInputForm Rendered \u2713" })), jsx("div", { className: "px-4 py-6 pt-11 md:px-8 md:py-8", children: jsxs("div", { className: "mx-auto w-full space-y-6 ".concat(hasListCustomField
|
|
30
31
|
? "max-w-[98vw] md:max-w-[1300px] lg:max-w-[1500px]"
|
|
31
|
-
: "max-w-md"), children: [jsxs("div", { className: "space-y-4 text-center", children: [jsx(Title, { className: "text-xl md:text-2xl lg:text-3xl", children: pageTitle }), jsx(Subtitle, { className: "text-sm leading-relaxed text-gray-600 md:text-base whitespace-pre-line", children: pageDescription })] }), jsxs("div", { className: "space-y-6 z-30 h-full", children: [informationType === "identity" && (jsx(IdentityFields, { form: form, errors: errors, requestedFields: requestedFields, onFieldChange: handleFieldChange })), informationType === "identity-legal" && (jsxs(Fragment, { children: [jsx(LegalEntityFields, { form: form, errors: errors, requestedFields: requestedFields, onFieldChange: handleFieldChange }), requestedFields.has("adresse") && (jsxs("div", { className: "space-y-4", children: [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") }), jsx(AddressFields, { form: form, errors: errors, requestedFields: requestedFields, onFieldChange: handleFieldChange, addressSuggestions: addressSuggestions, showSuggestions: showSuggestions, onAddressChange: handleAddressChange, onAddressFocus: handleAddressFocus, onAddressBlur: handleAddressBlur, onApplySuggestion: applyAddressSuggestion })] }))] })), informationType === "contact" && (jsx(ContactFields, { form: form, errors: errors, requestedFields: requestedFields, onFieldChange: handleFieldChange })), informationType === "address" && (jsx(AddressFields, { form: form, errors: errors, requestedFields: requestedFields, onFieldChange: handleFieldChange, addressSuggestions: addressSuggestions, showSuggestions: showSuggestions, onAddressChange: handleAddressChange, onAddressFocus: handleAddressFocus, onAddressBlur: handleAddressBlur, onApplySuggestion: applyAddressSuggestion })), informationType === "nationality" && (jsx(NationalityField, { form: form, errors: errors, requestedFields: requestedFields, onFieldChange: handleFieldChange })), informationType === "custom" && props.node.customFields && (jsx(CustomFormFields, { 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) {
|
|
32
|
+
: "max-w-md"), children: [jsxs("div", { className: "space-y-4 text-center", children: [jsx(Title, { className: "text-xl md:text-2xl lg:text-3xl", children: pageTitle }), jsx(Subtitle, { className: "text-sm leading-relaxed text-gray-600 md:text-base whitespace-pre-line", children: pageDescription })] }), jsxs("div", { className: "space-y-6 z-30 h-full", children: [informationType === "identity" && (jsx(IdentityFields, { form: form, errors: errors, requestedFields: requestedFields, onFieldChange: handleFieldChange })), informationType === "identity-legal-rep" && (jsx(LegalRepFields, { form: form, errors: errors, requestedFields: requestedFields, onFieldChange: handleFieldChange })), informationType === "identity-legal" && (jsxs(Fragment, { children: [jsx(LegalEntityFields, { form: form, errors: errors, requestedFields: requestedFields, onFieldChange: handleFieldChange }), requestedFields.has("adresse") && (jsxs("div", { className: "space-y-4", children: [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") }), jsx(AddressFields, { form: form, errors: errors, requestedFields: requestedFields, onFieldChange: handleFieldChange, addressSuggestions: addressSuggestions, showSuggestions: showSuggestions, onAddressChange: handleAddressChange, onAddressFocus: handleAddressFocus, onAddressBlur: handleAddressBlur, onApplySuggestion: applyAddressSuggestion })] }))] })), informationType === "contact" && (jsx(ContactFields, { form: form, errors: errors, requestedFields: requestedFields, onFieldChange: handleFieldChange })), informationType === "address" && (jsx(AddressFields, { form: form, errors: errors, requestedFields: requestedFields, onFieldChange: handleFieldChange, addressSuggestions: addressSuggestions, showSuggestions: showSuggestions, onAddressChange: handleAddressChange, onAddressFocus: handleAddressFocus, onAddressBlur: handleAddressBlur, onApplySuggestion: applyAddressSuggestion })), informationType === "nationality" && (jsx(NationalityField, { form: form, errors: errors, requestedFields: requestedFields, onFieldChange: handleFieldChange })), informationType === "custom" && props.node.customFields && (jsx(CustomFormFields, { 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) {
|
|
32
33
|
return applyAddressSuggestion(suggestion);
|
|
33
34
|
} }))] })] }) })] }));
|
|
34
35
|
};
|
|
@@ -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":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;;;AAeA,IAAM,aAAa,GAAG,UAAC,KAAyB,EAAA;;AACtC,IAAA,IAAA,CAAC,GAAK,OAAO,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,EA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AA,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,KACtDA,GAAA,CAAC,gBAAgB,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":["_jsxs","_jsx","_Fragment"],"mappings":";;;;;;;;;;;;;;;;AAgBA,IAAM,aAAa,GAAG,UAAC,KAAyB,EAAA;;AACtC,IAAA,IAAA,CAAC,GAAK,OAAO,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,GAoBF,gBAAgB,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,mB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,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;;;;"}
|
|
@@ -39,6 +39,7 @@ var ADDRESS_SUGGESTIONS = [
|
|
|
39
39
|
var DEFAULT_FIELDS = {
|
|
40
40
|
identity: ["nom", "prenom", "date_naissance"],
|
|
41
41
|
"identity-legal": ["nom", "registrationNumber", "siret", "tva", "adresse"],
|
|
42
|
+
"identity-legal-rep": ["legalRepresentativeNom", "legalRepresentativePrenom"],
|
|
42
43
|
contact: ["email", "sms"],
|
|
43
44
|
address: ["adresse"],
|
|
44
45
|
nationality: ["nationalite"],
|
|
@@ -54,8 +55,7 @@ var FIELD_LABELS = {
|
|
|
54
55
|
company: "user_input_form.fields.company_name",
|
|
55
56
|
siret: "user_input_form.fields.siret",
|
|
56
57
|
tva: "user_input_form.fields.vat_number",
|
|
57
|
-
registrationNumber: "user_input_form.fields.registration_number"
|
|
58
|
-
};
|
|
58
|
+
registrationNumber: "user_input_form.fields.registration_number"};
|
|
59
59
|
// Backend endpoint pour l'autocomplétion d'adresses (sécurisé)
|
|
60
60
|
var GEOCODING_AUTOCOMPLETE_ENDPOINT = "/geocoding/autocomplete";
|
|
61
61
|
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,MAAM;IACN,S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,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
|
|
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,CA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=== null || initialUserInput === void 0 ? void 0 : initialUserInput.siret) || "",
|
|
58
58
|
tva: (initialUserInput === null || initialUserInput === void 0 ? void 0 : initialUserInput.tva) || "",
|
|
59
59
|
registrationNumber: (initialUserInput === null || initialUserInput === void 0 ? void 0 : initialUserInput.registrationNumber) || "",
|
|
60
|
+
legalRepresentativeLastName: (initialUserInput === null || initialUserInput === void 0 ? void 0 : initialUserInput.legalRepresentativeLastName) || "",
|
|
61
|
+
legalRepresentativeFirstName: (initialUserInput === null || initialUserInput === void 0 ? void 0 : initialUserInput.legalRepresentativeFirstName) || "",
|
|
60
62
|
}), form = _b[0], setForm = _b[1];
|
|
61
63
|
var _c = useState({}), errors = _c[0], setErrors = _c[1];
|
|
62
64
|
// Custom form state
|
|
@@ -365,6 +367,16 @@ var useUserInputForm = function (_a) {
|
|
|
365
367
|
markError("registrationNumber");
|
|
366
368
|
}
|
|
367
369
|
}
|
|
370
|
+
if (informationType === "identity-legal-rep") {
|
|
371
|
+
if (requestedFields.has("legalRepresentativeNom") &&
|
|
372
|
+
!form.legalRepresentativeLastName) {
|
|
373
|
+
markError("legalRepresentativeLastName");
|
|
374
|
+
}
|
|
375
|
+
if (requestedFields.has("legalRepresentativePrenom") &&
|
|
376
|
+
!form.legalRepresentativeFirstName) {
|
|
377
|
+
markError("legalRepresentativeFirstName");
|
|
378
|
+
}
|
|
379
|
+
}
|
|
368
380
|
if (informationType === "contact") {
|
|
369
381
|
if (requestedFields.has("email")) {
|
|
370
382
|
var emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
@@ -583,7 +595,7 @@ var useUserInputForm = function (_a) {
|
|
|
583
595
|
if (!validateForm()) {
|
|
584
596
|
return;
|
|
585
597
|
}
|
|
586
|
-
setUserInput(function (previous) { return (__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, previous), (requestedFields.has("nom") && __assign({}, (informationType === "identity-legal"
|
|
598
|
+
setUserInput(function (previous) { return (__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, previous), (requestedFields.has("nom") && __assign({}, (informationType === "identity-legal"
|
|
587
599
|
? { companyName: form.companyName }
|
|
588
600
|
: { lastName: form.lastName })))), (requestedFields.has("prenom") && { firstName: form.firstName })), (requestedFields.has("date_naissance") && {
|
|
589
601
|
birthDate: form.birthDate,
|
|
@@ -598,6 +610,10 @@ var useUserInputForm = function (_a) {
|
|
|
598
610
|
countryCode: form.countryCode,
|
|
599
611
|
})), (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") && {
|
|
600
612
|
nationality: form.nationality,
|
|
613
|
+
})), (requestedFields.has("legalRepresentativeNom") && {
|
|
614
|
+
legalRepresentativeLastName: form.legalRepresentativeLastName,
|
|
615
|
+
})), (requestedFields.has("legalRepresentativePrenom") && {
|
|
616
|
+
legalRepresentativeFirstName: form.legalRepresentativeFirstName,
|
|
601
617
|
}))); });
|
|
602
618
|
if (informationType === "contact" && setContactInfo) {
|
|
603
619
|
setContactInfo(function (previous) { return (__assign(__assign(__assign({}, previous), (requestedFields.has("email") && { email: form.email })), (requestedFields.has("sms") && { phoneNumber: form.phoneNumber }))); });
|