{"version":3,"file":"UdpQuestionPublicForm.mjs","names":["React","useMemo","UdpQuestionFormRenderer","useHistory","useSnackbar","useUdpFormParameters","UdpQuestionPublicForm","t0","$","_c","onSubmitted","props","history","enqueueSnackbar","closeSnackbar","formId","formVersion","submissionId","tenantId","urlContext","t1","generic1","t2","generic2","t3","generic3","t4","mergedContext","t5"],"sources":["../../../../src/udp/pages/UdpQuestionFormPublicForm/UdpQuestionPublicForm.jsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { UdpQuestionFormRenderer } from '../UdpQuestionFormPrivateForm/UdpQuestionFormRenderer';\nimport { useHistory } from 'react-router-dom';\nimport { useSnackbar } from 'notistack';\nimport { useUdpFormParameters } from '../UdpFormsUtils/Utils';\n\n/**\n * Public (anonymous) fill-out page for the NEW question-form renderer.\n *\n * The legacy public page (`UdpFormsPublicForm/UdpPublicForm`) stays on the\n * legacy `UdpFormRenderer` — existing apps routing public fills through the\n * legacy page id keep the renderer they shipped with. This page is the new\n * counterpart. It has no dedicated route; it's registered as a udp page widget\n * (`UdpQuestionPublicForm` in UdpPagesLoaders) and must be reached through a\n * whitelisted public page to allow anonymous access.\n *\n * Public mode is single-shot: no draft load, no autosave, submit POSTs to\n * `/UdpFormSubmission/public?tenantId=...`. `tenantId` comes from the URL\n * (`?udpf_tenantId=`) since there is no authenticated session to resolve it.\n */\nexport const UdpQuestionPublicForm = ({ onSubmitted, ...props }) => {\n  const history = useHistory();\n  const { enqueueSnackbar, closeSnackbar } = useSnackbar();\n  const { formId, formVersion, submissionId, tenantId, urlContext } = useUdpFormParameters();\n\n  const mergedContext = useMemo(() => ({\n    ...urlContext,\n    generic1: props.generic1 || urlContext.generic1,\n    generic2: props.generic2 || urlContext.generic2,\n    generic3: props.generic3 || urlContext.generic3,\n  }), [urlContext, props.generic1, props.generic2, props.generic3]);\n\n  // `onSubmitted` (the explicit \"user clicked Submit\" hook) is passed\n  // through so the consumer can wire a thank-you page, workflow callback,\n  // etc. — without one, the renderer shows its built-in centered\n  // \"Thanks for submitting\" panel.\n\n  return (\n    <UdpQuestionFormRenderer\n      isPublicMode={true}\n      formId={formId}\n      formVersion={formVersion}\n      submissionId={submissionId}\n      tenantId={tenantId}\n      urlContext={mergedContext}\n      history={history}\n      enqueueSnackbar={enqueueSnackbar}\n      closeSnackbar={closeSnackbar}\n      onSubmitted={onSubmitted}\n    />\n  );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoBA,MAAaM,yBAAwBC,OAAA;CAAA,MAAAC,IAAAC,EAAA,GAAA;CAAA,IAAAC;CAAA,IAAAC;AAAA,KAAAH,EAAA,OAAAD,IAAA;AAAC,GAAA,CAAAG,gBAAAC,SAAAJ;AAAyBC,IAAA,KAAAD;AAAAC,IAAA,KAAAE;AAAAF,IAAA,KAAAG;QAAA;AAAAD,gBAAAF,EAAA;AAAAG,UAAAH,EAAA;;CAC7D,MAAAI,UAAgBT,YAAY;CAC5B,MAAA,EAAAU,iBAAAC,kBAA2CV,aAAa;CACxD,MAAA,EAAAW,QAAAC,aAAAC,cAAAC,UAAAC,eAAoEd,sBAAsB;CAI9E,MAAAe,KAAAT,MAAKU,YAAaF,WAAUE;CAC5B,MAAAC,KAAAX,MAAKY,YAAaJ,WAAUI;CAC5B,MAAAC,KAAAb,MAAKc,YAAaN,WAAUM;CAAS,IAAAC;AAAA,KAAAlB,EAAA,OAAAY,MAAAZ,EAAA,OAAAc,MAAAd,EAAA,OAAAgB,MAAAhB,EAAA,OAAAW,YAAA;AAJZO,OAAA;GAAA,GAChCP;GAAUE,UACHD;GAAqCG,UACrCD;GAAqCG,UACrCD;GACX;AAAAhB,IAAA,KAAAY;AAAAZ,IAAA,KAAAc;AAAAd,IAAA,KAAAgB;AAAAhB,IAAA,KAAAW;AAAAX,IAAA,KAAAkB;OAAAA,MAAAlB,EAAA;CALD,MAAAmB,gBAAqCD;CAK6B,IAAAE;AAAA,KAAApB,EAAA,OAAAM,iBAAAN,EAAA,OAAAK,mBAAAL,EAAA,QAAAO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