{"version":3,"sources":["webpack:///./app/javascript/utils/useCSRFToken.hooks.ts","webpack:///./app/javascript/components/Flash.tsx","webpack:///./node_modules/@instacart/ipp-auth-service-tools/dist/auth-service-tools210.js","webpack:///./node_modules/@instacart/ipp-auth-service-tools/dist/auth-service-tools9.js","webpack:///./app/javascript/components/CollectEmail.tsx"],"names":["useCSRFToken","useMemo","document","querySelector","getAttribute","alertLevels","warning","alert","danger","error","info","notice","Flash","flash","map","key","alertLevel","text","variant","emailValidationPattern","RegExp","LoginPreflight","_ref","disabled","children","onSubmit","errorMessage","initialFormState","action","method","extraFields","testidPrefix","register","handleSubmit","formState","setFocus","mode","defaultValues","errors","isValid","renderedExtraFields","errorMessages","email","default","pattern","messages","headline","description","emailLabel","emailPlaceholder","continue","onSubmitCallback","evt","preventDefault","Title","Subtitle","css","display","noMargin","htmlFor","id","required","placeholder","autoComplete","marginBottom","X24","flexDirection","gap","type","margin","CollectEmail","authenticity_token"],"mappings":"2FAAA,6CAEaA,EAAe,kBAC1BC,mBACE,kCACEC,SACGC,cAAc,kCAFnB,aACE,EAEIC,aAAa,aACnB,M,uiCCJJ,IAAMC,EAAc,CAClBC,QAAS,UACTC,MAAO,UACPC,OAAQ,SACRC,MAAO,SACPC,KAAM,OACNC,OAAQ,QAKGC,EAER,SAAC,GAAD,IAAGC,EAAH,EAAGA,MAAH,OACH,YAAC,WAAD,UACGA,EAAMC,KAAI,WAAqBC,GAArB,aAAEC,EAAF,KAAcC,EAAd,YACT,YAAC,IAAD,CAAiBC,QAASb,EAAYW,IAAeX,EAAYC,QAAjE,SACGW,GADSF,U,iCCpBlB,wCAAMI,EAAyB,IAAIC,OAAO,yD,iNCe1C,MAAMC,EAAkBC,IACtB,IAAI,SACFC,EAAQ,SACRC,EAAQ,SACRC,EAAQ,aACRC,EAAY,iBACZC,EAAgB,OAChBC,EAAM,OACNC,EAAM,YACNC,EAAW,aACXC,EAAe,kBACbT,EACJ,MAAM,SACJU,EAAQ,aACRC,EAAY,UACZC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,QAAS,OACTS,cAAe,MACfC,IAAK,IAAQF,KAEfzC,SAAyB,YAAI,IAAQ,CACnC4C,KAAM,SACN,cAAe,GAAGrC,gBAClByB,IAAK,CACHa,OAAQ,GAEV9C,SAAUA,IAAagB,EACvBf,SAAUqB,EAASK,sB,sBChHlBoB,EAGR,SAAC,GAAuB,IAArB1C,EAAoB,EAApBA,OAAQf,EAAY,EAAZA,MACR0D,EAAqBvE,cAE3B,OACE,YAACqB,EAAD,CACEO,OAAQA,EACRC,OAAO,OACPC,YAAa,CAAEyC,sBAHjB,SAKE,YAAC3D,EAAA,EAAD,CAAOC,MAAOA,OAKLyD","file":"js/10-b0ffe99e7f4d562bec28.chunk.js","sourcesContent":["import { useMemo } from \"react\";\n\nexport const useCSRFToken = () =>\n useMemo(\n () =>\n document\n .querySelector('meta[name=\"csrf-token\"]')\n ?.getAttribute(\"content\"),\n [],\n );\n","import { Alert } from \"@instacart/ipp-auth-service-tools\"\nimport * as React from \"react\"\n\n// Map rails flash levels to ours\nconst alertLevels = {\n warning: \"warning\",\n alert: \"warning\",\n danger: \"danger\",\n error: \"danger\",\n info: \"info\",\n notice: \"info\",\n}\n\nexport type FlashMessages = [string, string][]\n\nexport const Flash: React.FunctionComponent<{\n flash: FlashMessages\n}> = ({ flash }) => (\n \n {flash.map(([alertLevel, text], key) => (\n \n {text}\n \n ))}\n \n)\n","const emailValidationPattern = new RegExp(/^\\s*[a-zA-Z0-9.'_%+-]+@[a-zA-Z0-9.-]+\\.[A-z]{2,}\\s*$/);\nexport { emailValidationPattern };","import { jsx, jsxs } from \"@emotion/react/jsx-runtime\";\nimport { useCallback, useEffect } from \"react\";\nimport { InputBase } from \"./auth-service-tools41.js\";\nimport { useForm } from \"./auth-service-tools209.js\";\nimport { useFormErrorMessages } from \"./auth-service-tools46.js\";\nimport { Alert } from \"./auth-service-tools11.js\";\nimport { Button } from \"./auth-service-tools51.js\";\nimport { FormField, FormFieldLabel, FormFieldError } from \"./auth-service-tools108.js\";\nimport { PublicLayout } from \"./auth-service-tools111.js\";\nimport { emailValidationPattern } from \"./auth-service-tools210.js\";\nimport { useExtraFields } from \"./auth-service-tools211.js\";\nimport { useMessages } from \"./auth-service-tools47.js\";\nimport { PublicCard } from \"./auth-service-tools212.js\";\nimport { spacing } from \"./auth-service-tools42.js\";\n\nconst LoginPreflight = (_ref) => {\n let {\n disabled,\n children,\n onSubmit,\n errorMessage,\n initialFormState,\n action,\n method,\n extraFields,\n testidPrefix = \"LoginPreflight\"\n } = _ref;\n const {\n register,\n handleSubmit,\n formState,\n setFocus\n } = useForm({\n mode: \"onChange\",\n defaultValues: initialFormState\n });\n const {\n errors,\n isValid\n } = formState;\n const renderedExtraFields = useExtraFields(extraFields, register);\n const errorMessages = useFormErrorMessages(errors, {\n email: {\n default: \"sharedComponents.publicPages.logInForm.errors.email.default\",\n pattern: \"sharedComponents.publicPages.logInForm.errors.email.pattern\"\n }\n });\n const messages = useMessages({\n headline: \"sharedComponents.publicPages.logInForm.preflight.headline\",\n description: \"sharedComponents.publicPages.logInForm.preflight.description\",\n emailLabel: \"sharedComponents.publicPages.loginForm.email.label\",\n emailPlaceholder: \"sharedComponents.publicPages.loginForm.email.placeholder\",\n continue: \"sharedComponents.publicPages.loginForm.continue\"\n });\n const onSubmitCallback = useCallback(evt => {\n if (onSubmit) return handleSubmit(onSubmit)(evt);\n if (!isValid) evt.preventDefault();\n }, [onSubmit, handleSubmit, isValid]);\n useEffect(() => {\n setFocus(\"email\");\n }, [setFocus]);\n return /* @__PURE__ */jsx(PublicLayout, {\n children: /* @__PURE__ */jsxs(PublicCard, {\n children: [/* @__PURE__ */jsxs(\"div\", {\n children: [/* @__PURE__ */jsx(PublicCard.Title, {\n children: messages.headline\n }), /* @__PURE__ */jsx(PublicCard.Subtitle, {\n children: messages.description\n })]\n }), children, /* @__PURE__ */jsxs(\"form\", {\n \"data-testid\": `${testidPrefix}-form`,\n action,\n method,\n onSubmit: onSubmitCallback,\n css: {\n display: \"contents\"\n },\n children: [/* @__PURE__ */jsxs(FormField, {\n noMargin: true,\n children: [/* @__PURE__ */jsx(FormFieldLabel, {\n htmlFor: \"email\",\n children: messages.emailLabel\n }), /* @__PURE__ */jsx(InputBase, {\n id: \"email\",\n ...register(\"email\", {\n required: true,\n pattern: emailValidationPattern\n }),\n placeholder: messages.emailPlaceholder,\n \"data-testid\": `${testidPrefix}-field-email`,\n autoComplete: \"email\",\n disabled\n }), errorMessages.email && /* @__PURE__ */jsx(FormFieldError, {\n \"data-testid\": `${testidPrefix}-field-error-email`,\n children: errorMessages.email\n })]\n }), errorMessage && /* @__PURE__ */jsx(Alert, {\n \"data-testid\": `${testidPrefix}-form-error`,\n variant: \"danger\",\n css: {\n marginBottom: spacing.X24\n },\n children: errorMessage\n }), renderedExtraFields, /* @__PURE__ */jsx(\"div\", {\n css: {\n display: \"flex\",\n flexDirection: \"row\",\n gap: spacing.X24\n },\n children: /* @__PURE__ */jsx(Button, {\n type: \"submit\",\n \"data-testid\": `${testidPrefix}-form-submit`,\n css: {\n margin: 0\n },\n disabled: disabled || !isValid,\n children: messages.continue\n })\n })]\n })]\n })\n });\n};\n\nexport { LoginPreflight };","import { LoginPreflight, Alert } from \"@instacart/ipp-auth-service-tools\"\nimport { useCSRFToken } from \"../utils/useCSRFToken.hooks\"\nimport { Flash, FlashMessages } from \"./Flash\"\n\nexport const CollectEmail: React.FunctionComponent<{\n action: string\n flash: FlashMessages\n}> = ({ action, flash }) => {\n const authenticity_token = useCSRFToken()\n\n return (\n \n \n \n )\n}\n\nexport default CollectEmail\n"],"sourceRoot":""}