@popmenu/common-ui 0.152.0 → 0.154.0
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/build/cjs/components/FollowerAuthenticationDialog/FollowerAuthenticationDialogProps.d.ts +17 -2
- package/build/cjs/components/FollowerAuthenticationDialog/FollowerAuthenticationPrivacyPolicy.d.ts +2 -0
- package/build/cjs/components/FollowerAuthenticationDialog/FollowerAuthenticationUserForm.d.ts +2 -0
- package/build/cjs/components/FollowerAuthenticationDialog/phoneValidation.d.ts +2 -0
- package/build/cjs/index.js +275 -52
- package/build/cjs/index.js.map +1 -1
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationDialogProps.d.ts +17 -2
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationForm.js +28 -47
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationForm.js.map +1 -1
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationGraphic.js +1 -1
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationGraphic.js.map +1 -1
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationInfo.js +1 -1
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationInfo.js.map +1 -1
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationPrivacyPolicy.d.ts +2 -0
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationPrivacyPolicy.js +29 -0
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationPrivacyPolicy.js.map +1 -0
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationUserForm.d.ts +2 -0
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationUserForm.js +201 -0
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationUserForm.js.map +1 -0
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationVipBenefitRows.js +1 -1
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationVipBenefitRows.js.map +1 -1
- package/build/esm/components/FollowerAuthenticationDialog/phoneValidation.d.ts +2 -0
- package/build/esm/components/FollowerAuthenticationDialog/phoneValidation.js +32 -0
- package/build/esm/components/FollowerAuthenticationDialog/phoneValidation.js.map +1 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FollowerAuthenticationForm.js","sources":["../../../../src/components/FollowerAuthenticationDialog/FollowerAuthenticationForm.tsx"],"sourcesContent":["import React, { ChangeEventHandler, ReactNode, useEffect, useRef, useState } from 'react'\nimport { useFollowerAuthenticationDialogContext } from './context'\nimport { Box, Button, Checkbox, FormControlLabel, makeStyles, MenuItem, TextField, Typography } from '@material-ui/core'\nimport { MessageKey } from './FollowerAuthenticationDialogProps'\n\nconst useStyles = makeStyles((theme) => ({\n checkboxLabel: {\n '& > a': {\n textDecoration: 'underline',\n },\n fontSize: '0.75rem',\n },\n form: {\n alignItems: 'center',\n display: 'flex',\n flexDirection: 'column',\n gridGap: 16,\n width: '100%',\n },\n label: {\n alignSelf: 'start',\n fontSize: '0.85rem',\n },\n privacyPolicyButton: {\n fontSize: '0.75rem',\n margin: theme.spacing(0, 0.5),\n padding: 0,\n textDecoration: 'underline',\n width: 'auto',\n },\n privacyPolicyText: {\n fontSize: '0.75rem',\n textAlign: 'center',\n },\n}))\n\ntype LocationAndBirthdayProps = {\n checkFieldValidity: ChangeEventHandler<HTMLInputElement>\n classes: { label: string }\n loading: boolean\n locationOptions: { label: string; value: string }[]\n messages: Record<MessageKey, ReactNode>\n showLocationErrorText: boolean | undefined\n showV2: boolean | undefined\n}\n\nfunction LocationAndBirthday({\n checkFieldValidity,\n classes,\n loading,\n locationOptions,\n messages,\n showLocationErrorText,\n showV2,\n}: LocationAndBirthdayProps) {\n const locationSelect = (\n <TextField\n disabled={loading}\n select\n onChange={checkFieldValidity}\n label={messages.signUpLocationInputLabel}\n error={showLocationErrorText}\n helperText={showLocationErrorText && messages.signUpLocationErrorText}\n id=\"location-input\"\n inputProps={{ required: true }}\n name=\"location\"\n >\n {locationOptions.map((locationOption) => (\n <MenuItem data-cy={'option'} key={locationOption.value} value={locationOption.value}>\n {locationOption.label}\n </MenuItem>\n ))}\n </TextField>\n )\n\n if (showV2) {\n return (\n <>\n <Box display=\"flex\" flexDirection=\"column\" gridGap={4} style={{ width: '100%' }}>\n <Typography className={classes.label}>{messages.signUpBirthdaySectionLabel}</Typography>\n <Box display=\"flex\" gridGap={16}>\n <TextField\n disabled={loading}\n label={messages.signUpMonthInputLabel}\n id=\"birthday-month-input\"\n name=\"birthdayMonth\"\n style={{ flex: 1 }}\n />\n <TextField\n disabled={loading}\n label={messages.signUpDayInputLabel}\n id=\"birthday-date-input\"\n name=\"birthdayDate\"\n style={{ flex: 1 }}\n />\n </Box>\n </Box>\n {locationSelect}\n </>\n )\n }\n\n return (\n <>\n {locationSelect}\n <Typography style={{ alignSelf: 'start' }}>{messages.signUpBirthdaySectionLabel}</Typography>\n <TextField\n disabled={loading}\n label={messages.signUpMonthInputLabel}\n id=\"birthday-month-input\"\n name=\"birthdayMonth\"\n />\n <TextField disabled={loading} label={messages.signUpDayInputLabel} id=\"birthday-date-input\" name=\"birthdayDate\" />\n </>\n )\n}\n\nconst northAmericanPhoneRegex = /^(\\()?[2-9]{1}\\d{2}(\\))?[-\\s.]?[2-9]{1}\\d{2}[-\\s.]?\\d{4}$/\nconst ukPhoneRegex = /^((\\+?44\\s?|0044\\s?)(\\s?\\d{3,5}|\\(\\d{3,5}\\))(\\s?\\d{3,4})(\\s?\\d{3,4})$|^07\\d{9}$)/\n\nconst validatePhoneNumber = (phone: string): boolean => {\n if (!phone) return false\n return northAmericanPhoneRegex.test(phone) || ukPhoneRegex.test(phone)\n}\n\nexport const FollowerAuthenticationForm = () => {\n const {\n state,\n messages,\n locationOptions,\n onActionButtonClick,\n loading,\n showV2,\n showSubscribeEmail,\n showSubscribeSms,\n } = useFollowerAuthenticationDialogContext()\n const classes = useStyles()\n\n // sign-up form state\n const formRef = useRef<HTMLFormElement>(null)\n const [formValidity, setFormValidity] = useState(false)\n const [showNameErrorText, setShowNameErrorText] = useState<boolean | undefined>()\n const [showPhoneErrorText, setShowPhoneErrorText] = useState<boolean | undefined>()\n const [showEmailErrorText, setShowEmailErrorText] = useState<boolean | undefined>()\n const [showLocationErrorText, setShowLocationErrorText] = useState<boolean | undefined>()\n const [signUpNameValue, setSignUpNameValue] = useState(state.context.name || '')\n const [signUpPhoneValue, setSignUpPhoneValue] = useState(state.context.phone || '')\n const [signUpEmailValue, setSignUpEmailValue] = useState(state.context.email || '')\n\n const checkFieldValidity: ChangeEventHandler<HTMLInputElement> = (e) => {\n const fieldName = e.target.name\n const fieldValue = e.target.value\n\n switch (fieldName) {\n case 'name':\n const isNameValid = fieldValue.length > 0\n setSignUpNameValue(fieldValue)\n setShowNameErrorText(!isNameValid)\n break\n case 'phone':\n const isPhoneValid = validatePhoneNumber(fieldValue)\n setSignUpPhoneValue(fieldValue)\n setShowPhoneErrorText(!isPhoneValid && fieldValue.length > 0)\n break\n case 'email':\n const emailField = formRef.current?.elements.namedItem(fieldName) as HTMLInputElement\n const isEmailValid = emailField?.validity.valid ?? false\n setSignUpEmailValue(fieldValue)\n setShowEmailErrorText(!isEmailValid && fieldValue.length > 0)\n break\n case 'location':\n setShowLocationErrorText(!fieldValue)\n break\n default:\n break\n }\n }\n\n useEffect(() => {\n setSignUpNameValue(state.context.name || '')\n setSignUpPhoneValue(state.context.phone || '')\n setSignUpEmailValue(state.context.email || '')\n }, [state.context.name, state.context.phone, state.context.email])\n\n useEffect(() => {\n // Validate pre-filled values (only in signUp state)\n if (state.value === 'signUp') {\n if (signUpPhoneValue) {\n const isPhoneValid = validatePhoneNumber(signUpPhoneValue)\n setShowPhoneErrorText(!isPhoneValid)\n }\n if (signUpEmailValue) {\n const emailField = formRef.current?.elements.namedItem('email') as HTMLInputElement\n const isEmailValid = emailField?.validity.valid ?? false\n setShowEmailErrorText(!isEmailValid)\n }\n }\n\n const hasValidName = Boolean(signUpNameValue) && !showNameErrorText\n const hasValidPhone = Boolean(signUpPhoneValue) && !showPhoneErrorText\n const hasValidEmail = Boolean(signUpEmailValue) && !showEmailErrorText\n\n const locationField = formRef.current?.elements.namedItem('location') as HTMLInputElement\n const hasValidLocation = locationField ? Boolean(locationField.value) : true\n\n const hasValidContact = showV2 ? hasValidName && hasValidPhone && hasValidEmail : hasValidPhone || hasValidEmail\n setFormValidity(hasValidContact && hasValidLocation)\n }, [\n showV2,\n state.value,\n signUpPhoneValue,\n signUpEmailValue,\n showPhoneErrorText,\n showEmailErrorText,\n showLocationErrorText,\n signUpNameValue,\n showNameErrorText,\n ])\n\n const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {\n e.preventDefault()\n const form = e.target as HTMLFormElement\n const formData = new FormData(form)\n const values = Object.fromEntries(formData.entries()) as Record<string, string>\n if (state.value === 'signUp') {\n values.subscribeEmail = String(formData.has('subscribeEmail'))\n values.subscribeSms = String(formData.has('subscribeSms'))\n }\n onActionButtonClick('submit-form', values)\n }\n const formProps = {\n id: 'follower-authentication-form',\n className: classes.form,\n onSubmit: handleSubmit,\n }\n switch (state.value) {\n case 'initial':\n return (\n <form {...formProps}>\n <TextField\n disabled={loading}\n label={messages.initialInputLabel}\n key=\"identifier-input\"\n id=\"identifier-input\"\n name=\"identifier\"\n />\n <Button disabled={loading} type=\"submit\">\n {messages.initialCtaButtonLabel}\n </Button>\n </form>\n )\n case 'signUp':\n return (\n <form\n ref={formRef}\n {...formProps}\n onInvalid={(e) => {\n e.preventDefault()\n }}\n >\n <TextField\n disabled={loading}\n label={messages.signUpPhoneInputLabel}\n key=\"phone-input\"\n id=\"phone-input\"\n name=\"phone\"\n onChange={checkFieldValidity}\n error={showPhoneErrorText}\n helperText={showPhoneErrorText && messages.signUpPhoneErrorText}\n inputProps={{\n required: showV2 || !signUpEmailValue,\n }}\n defaultValue={state.context.phone}\n />\n <TextField\n disabled={loading}\n label={messages.signUpNameInputLabel}\n key=\"name-input\"\n id=\"name-input\"\n name=\"name\"\n onChange={checkFieldValidity}\n error={showNameErrorText}\n inputProps={{ required: true }}\n defaultValue={state.context.name}\n />\n <TextField\n disabled={loading}\n label={messages.signUpEmailInputLabel}\n key=\"email-input\"\n id=\"email-input\"\n name=\"email\"\n error={showEmailErrorText}\n helperText={showEmailErrorText && messages.signUpEmailErrorText}\n onChange={checkFieldValidity}\n inputProps={{\n required: showV2 || !signUpPhoneValue,\n type: 'email',\n }}\n defaultValue={state.context.email}\n />\n <LocationAndBirthday\n checkFieldValidity={checkFieldValidity}\n classes={classes}\n loading={loading}\n locationOptions={locationOptions}\n messages={messages}\n showLocationErrorText={showLocationErrorText}\n showV2={showV2}\n />\n <Box display=\"flex\" flexDirection=\"column\" alignItems=\"flex-start\" gridGap={2} width=\"100%\">\n {showSubscribeEmail && (\n <FormControlLabel\n style={{ alignItems: 'flex-start' }}\n control={<Checkbox id=\"subscribe-email\" name=\"subscribeEmail\" disabled={loading} color=\"primary\" />}\n label={\n <Typography className={classes.checkboxLabel}>{messages.subscribeEmailCheckboxLabel}</Typography>\n }\n />\n )}\n {showSubscribeSms && (\n <FormControlLabel\n style={{ alignItems: 'flex-start' }}\n control={<Checkbox id=\"subscribe-sms\" name=\"subscribeSms\" disabled={loading} color=\"primary\" />}\n label={<Typography className={classes.checkboxLabel}>{messages.subscribeSmsCheckboxLabel}</Typography>}\n />\n )}\n </Box>\n {showV2 && messages.privacyPolicyText && (\n <Typography className={classes.privacyPolicyText}>\n {messages.privacyPolicyText}\n <Button\n className={classes.privacyPolicyButton}\n onClick={() => onActionButtonClick('open-privacy-policy')}\n variant=\"text\"\n >\n {messages.privacyPolicyButtonLabel}\n </Button>\n </Typography>\n )}\n <Button disabled={loading || !formValidity} type=\"submit\">\n {messages.signUp}\n </Button>\n </form>\n )\n case 'emailFound':\n return (\n <form {...formProps}>\n <TextField\n disabled={loading}\n label={messages.emailFoundInputLabel}\n key=\"email-input\"\n id=\"email-input\"\n name=\"email\"\n value={state.context.email}\n />\n <Button disabled={loading} type=\"submit\">\n {messages.emailFoundCtaButtonLabel}\n </Button>\n </form>\n )\n case 'emailAuthCode':\n return (\n <form {...formProps}>\n <TextField\n disabled={loading}\n label={messages.emailAuthCodeInputLabel}\n key=\"code-input\"\n id=\"code-input\"\n name=\"code\"\n />\n <Button disabled={loading} type=\"submit\">\n {messages.signIn}\n </Button>\n </form>\n )\n case 'emailMagicLinkSent':\n return (\n <Button\n disabled={loading}\n onClick={() => {\n onActionButtonClick('close')\n }}\n >\n {messages.emailMagicLinkSentCtaButtonLabel}\n </Button>\n )\n case 'indirectUserFound': {\n if (state.context.email) {\n return (\n <form {...formProps}>\n <TextField\n disabled={loading}\n label={messages.emailFoundInputLabel}\n key=\"email-input\"\n id=\"email-input\"\n name=\"email\"\n value={state.context.email}\n />\n <Button disabled={loading} type=\"submit\">\n {messages.indirectUserFoundCtaButtonLabel}\n </Button>\n </form>\n )\n } else if (state.context.phone) {\n return (\n <form {...formProps}>\n <TextField\n disabled={loading}\n label={messages.phoneFoundInputLabel}\n key=\"phone-input\"\n id=\"phone-input\"\n name=\"phone\"\n value={state.context.phone}\n />\n <Button disabled={loading} type=\"submit\">\n {messages.indirectUserFoundCtaButtonLabel}\n </Button>\n </form>\n )\n } else return null\n }\n case 'emailPasswordSignIn':\n return (\n <form {...formProps}>\n <TextField\n disabled={loading}\n label={messages.emailFoundInputLabel}\n key=\"email-input\"\n id=\"email-input\"\n name=\"email\"\n value={state.context.email}\n InputLabelProps={{ shrink: true }}\n />\n <TextField\n disabled={loading}\n label={messages.passwordInputLabel}\n key=\"password-input\"\n id=\"password-input\"\n name=\"password\"\n inputProps={{ type: 'password' }}\n />\n <Button disabled={loading} type=\"submit\">\n {messages.signIn}\n </Button>\n </form>\n )\n case 'phoneFound':\n return (\n <form {...formProps}>\n <TextField\n disabled={loading}\n label={messages.phoneFoundInputLabel}\n key=\"phone-input\"\n id=\"phone-input\"\n name=\"phone\"\n value={state.context.phone}\n />\n <Button disabled={loading} type=\"submit\">\n {messages.phoneFoundCtaButtonLabel}\n </Button>\n </form>\n )\n case 'phoneAuthCode':\n return (\n <form {...formProps}>\n <TextField\n disabled={loading}\n label={messages.phoneAuthCodeInputLabel}\n key=\"code-input\"\n id=\"code-input\"\n name=\"code\"\n autoComplete=\"one-time-code\"\n />\n <Button disabled={loading} type=\"submit\">\n {messages.signIn}\n </Button>\n </form>\n )\n case 'phonePasswordSignIn':\n return (\n <form {...formProps}>\n <TextField\n disabled={loading}\n label={messages.phoneFoundInputLabel}\n key=\"phone-input\"\n id=\"phone-input\"\n name=\"phone\"\n value={state.context.phone}\n InputLabelProps={{ shrink: true }}\n />\n <TextField\n disabled={loading}\n label={messages.passwordInputLabel}\n key=\"password-input\"\n id=\"password-input\"\n name=\"password\"\n inputProps={{ type: 'password' }}\n />\n <Button disabled={loading} type=\"submit\">\n {messages.signIn}\n </Button>\n </form>\n )\n case 'requirePhone':\n return (\n <form {...formProps}>\n <TextField\n disabled={loading}\n label={messages.requirePhoneInputLabel}\n key=\"phone-input\"\n id=\"phone-input\"\n name=\"phone\"\n value={state.context.phone}\n />\n <Button disabled={loading} type=\"submit\">\n {messages.requirePhoneCtaButtonLabel}\n </Button>\n </form>\n )\n case 'welcome':\n return null\n default:\n return null\n }\n}\n"],"names":[],"mappings":";;;;AAKA,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,KAAK,MAAM;AACvC,IAAA,aAAa,EAAE;AACb,QAAA,OAAO,EAAE;AACP,YAAA,cAAc,EAAE,WAAW;AAC5B,SAAA;AACD,QAAA,QAAQ,EAAE,SAAS;AACpB,KAAA;AACD,IAAA,IAAI,EAAE;AACJ,QAAA,UAAU,EAAE,QAAQ;AACpB,QAAA,OAAO,EAAE,MAAM;AACf,QAAA,aAAa,EAAE,QAAQ;AACvB,QAAA,OAAO,EAAE,EAAE;AACX,QAAA,KAAK,EAAE,MAAM;AACd,KAAA;AACD,IAAA,KAAK,EA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B,KAAK,EAAE,QAAQ,CAAC,kBAAkB,EAClC,GAAG,EAAC,gBAAgB,EACpB,EAAE,EAAC,gBAAgB,EACnB,IAAI,EAAC,UAAU,EACf,UAAU,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,EAChC,CAAA;AACF,gBAAA,KAAA,CAAA,aAAA,CAAC,MAAM,EAAC,EAAA,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAC,QAAQ,EAAA,EACrC,QAAQ,CAAC,MAAM,CACT,CACJ;AAEX,QAAA,KAAK,cAAc;YACjB,QACE,iCAAU,SAAS,EAAA;AACjB,gBAAA,KAAA,CAAA,aAAA,CAAC,SAAS,EAAA,EACR,QAAQ,EAAE,OAAO,EACjB,KAAK,EAAE,QAAQ,CAAC,sBAAsB,EACtC,GAAG,EAAC,aAAa,EACjB,EAAE,EAAC,aAAa,EAChB,IAAI,EAAC,OAAO,EACZ,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,EAC1B,CAAA;AACF,gBAAA,KAAA,CAAA,aAAA,CAAC,MAAM,EAAC,EAAA,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAC,QAAQ,EAAA,EACrC,QAAQ,CAAC,0BAA0B,CAC7B,CACJ;AAEX,QAAA,KAAK,SAAS;AACZ,YAAA,OAAO,IAAI;AACb,QAAA;AACE,YAAA,OAAO,IAAI;;AAEjB;;;;"}
|
|
1
|
+
{"version":3,"file":"FollowerAuthenticationForm.js","sources":["../../../../src/components/FollowerAuthenticationDialog/FollowerAuthenticationForm.tsx"],"sourcesContent":["import React, { ChangeEventHandler, ReactNode, useEffect, useRef, useState } from 'react'\nimport { useFollowerAuthenticationDialogContext } from './context'\nimport { Box, Button, Checkbox, FormControlLabel, makeStyles, MenuItem, TextField, Typography } from '@material-ui/core'\nimport { MessageKey } from './FollowerAuthenticationDialogProps'\nimport { FollowerAuthenticationUserForm } from './FollowerAuthenticationUserForm'\nimport { FollowerAuthenticationPrivacyPolicy } from './FollowerAuthenticationPrivacyPolicy'\nimport { validatePhoneNumber } from './phoneValidation'\n\nconst useStyles = makeStyles({\n checkboxLabel: {\n '& > a': {\n textDecoration: 'underline',\n },\n fontSize: '0.75rem',\n },\n form: {\n alignItems: 'center',\n display: 'flex',\n flexDirection: 'column',\n gridGap: 16,\n width: '100%',\n },\n label: {\n alignSelf: 'start',\n fontSize: '0.85rem',\n },\n})\n\ntype LocationAndBirthdayProps = {\n checkFieldValidity: ChangeEventHandler<HTMLInputElement>\n classes: { label: string }\n loading: boolean\n locationOptions: { label: string; value: string }[]\n messages: Record<MessageKey, ReactNode>\n showLocationErrorText: boolean | undefined\n showV2: boolean | undefined\n}\n\nfunction LocationAndBirthday({\n checkFieldValidity,\n classes,\n loading,\n locationOptions,\n messages,\n showLocationErrorText,\n showV2,\n}: LocationAndBirthdayProps) {\n const locationSelect = (\n <TextField\n disabled={loading}\n select\n onChange={checkFieldValidity}\n label={messages.signUpLocationInputLabel}\n error={showLocationErrorText}\n helperText={showLocationErrorText && messages.signUpLocationErrorText}\n id=\"location-input\"\n inputProps={{ required: true }}\n name=\"location\"\n >\n {locationOptions.map((locationOption) => (\n <MenuItem data-cy={'option'} key={locationOption.value} value={locationOption.value}>\n {locationOption.label}\n </MenuItem>\n ))}\n </TextField>\n )\n\n if (showV2) {\n return (\n <>\n <Box display=\"flex\" flexDirection=\"column\" gridGap={4} style={{ width: '100%' }}>\n <Typography className={classes.label}>{messages.signUpBirthdaySectionLabel}</Typography>\n <Box display=\"flex\" gridGap={16}>\n <TextField\n disabled={loading}\n label={messages.signUpMonthInputLabel}\n id=\"birthday-month-input\"\n name=\"birthdayMonth\"\n style={{ flex: 1 }}\n />\n <TextField\n disabled={loading}\n label={messages.signUpDayInputLabel}\n id=\"birthday-date-input\"\n name=\"birthdayDate\"\n style={{ flex: 1 }}\n />\n </Box>\n </Box>\n {locationSelect}\n </>\n )\n }\n\n return (\n <>\n {locationSelect}\n <Typography style={{ alignSelf: 'start' }}>{messages.signUpBirthdaySectionLabel}</Typography>\n <TextField\n disabled={loading}\n label={messages.signUpMonthInputLabel}\n id=\"birthday-month-input\"\n name=\"birthdayMonth\"\n />\n <TextField disabled={loading} label={messages.signUpDayInputLabel} id=\"birthday-date-input\" name=\"birthdayDate\" />\n </>\n )\n}\n\nexport const FollowerAuthenticationForm = () => {\n const {\n state,\n messages,\n locationOptions,\n onActionButtonClick,\n loading,\n showV2,\n showSubscribeEmail,\n showSubscribeSms,\n } = useFollowerAuthenticationDialogContext()\n const classes = useStyles()\n\n // sign-up form state\n const formRef = useRef<HTMLFormElement>(null)\n const [formValidity, setFormValidity] = useState(false)\n const [showNameErrorText, setShowNameErrorText] = useState<boolean | undefined>()\n const [showPhoneErrorText, setShowPhoneErrorText] = useState<boolean | undefined>()\n const [showEmailErrorText, setShowEmailErrorText] = useState<boolean | undefined>()\n const [showLocationErrorText, setShowLocationErrorText] = useState<boolean | undefined>()\n const [signUpNameValue, setSignUpNameValue] = useState(state.context.name || '')\n const [signUpPhoneValue, setSignUpPhoneValue] = useState(state.context.phone || '')\n const [signUpEmailValue, setSignUpEmailValue] = useState(state.context.email || '')\n\n const checkFieldValidity: ChangeEventHandler<HTMLInputElement> = (e) => {\n const fieldName = e.target.name\n const fieldValue = e.target.value\n\n switch (fieldName) {\n case 'name':\n const isNameValid = fieldValue.length > 0\n setSignUpNameValue(fieldValue)\n setShowNameErrorText(!isNameValid)\n break\n case 'phone':\n const isPhoneValid = validatePhoneNumber(fieldValue)\n setSignUpPhoneValue(fieldValue)\n setShowPhoneErrorText(!isPhoneValid && fieldValue.length > 0)\n break\n case 'email':\n const emailField = formRef.current?.elements.namedItem(fieldName) as HTMLInputElement\n const isEmailValid = emailField?.validity.valid ?? false\n setSignUpEmailValue(fieldValue)\n setShowEmailErrorText(!isEmailValid && fieldValue.length > 0)\n break\n case 'location':\n setShowLocationErrorText(!fieldValue)\n break\n default:\n break\n }\n }\n\n useEffect(() => {\n setSignUpNameValue(state.context.name || '')\n setSignUpPhoneValue(state.context.phone || '')\n setSignUpEmailValue(state.context.email || '')\n }, [state.context.name, state.context.phone, state.context.email])\n\n useEffect(() => {\n // Validate pre-filled values (only in signUp state)\n if (state.value === 'signUp') {\n if (signUpPhoneValue) {\n const isPhoneValid = validatePhoneNumber(signUpPhoneValue)\n setShowPhoneErrorText(!isPhoneValid)\n }\n if (signUpEmailValue) {\n const emailField = formRef.current?.elements.namedItem('email') as HTMLInputElement\n const isEmailValid = emailField?.validity.valid ?? false\n setShowEmailErrorText(!isEmailValid)\n }\n }\n\n const hasValidName = Boolean(signUpNameValue) && !showNameErrorText\n const hasValidPhone = Boolean(signUpPhoneValue) && !showPhoneErrorText\n const hasValidEmail = Boolean(signUpEmailValue) && !showEmailErrorText\n\n const locationField = formRef.current?.elements.namedItem('location') as HTMLInputElement\n const hasValidLocation = locationField ? Boolean(locationField.value) : true\n\n const hasValidContact = showV2 ? hasValidName && hasValidPhone && hasValidEmail : hasValidPhone || hasValidEmail\n setFormValidity(hasValidContact && hasValidLocation)\n }, [\n showV2,\n state.value,\n signUpPhoneValue,\n signUpEmailValue,\n showPhoneErrorText,\n showEmailErrorText,\n showLocationErrorText,\n signUpNameValue,\n showNameErrorText,\n ])\n\n const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {\n e.preventDefault()\n const form = e.target as HTMLFormElement\n const formData = new FormData(form)\n const values = Object.fromEntries(formData.entries()) as Record<string, string>\n if (state.value === 'signUp') {\n values.subscribeEmail = String(formData.has('subscribeEmail'))\n values.subscribeSms = String(formData.has('subscribeSms'))\n }\n onActionButtonClick('submit-form', values)\n }\n const formProps = {\n key: state.value,\n id: 'follower-authentication-form',\n className: classes.form,\n onSubmit: handleSubmit,\n }\n switch (state.value) {\n case 'initial':\n return (\n <form {...formProps}>\n <TextField disabled={loading} label={messages.initialInputLabel} id=\"identifier-input\" name=\"identifier\" />\n <Button disabled={loading} type=\"submit\">\n {messages.initialCtaButtonLabel}\n </Button>\n </form>\n )\n case 'signUp':\n return (\n <form\n ref={formRef}\n {...formProps}\n onInvalid={(e) => {\n e.preventDefault()\n }}\n >\n <TextField\n disabled={loading}\n label={messages.signUpPhoneInputLabel}\n id=\"phone-input\"\n name=\"phone\"\n onChange={checkFieldValidity}\n error={showPhoneErrorText}\n helperText={showPhoneErrorText && messages.signUpPhoneErrorText}\n inputProps={{\n required: showV2 || !signUpEmailValue,\n }}\n defaultValue={state.context.phone}\n />\n <TextField\n disabled={loading}\n label={messages.signUpNameInputLabel}\n id=\"name-input\"\n name=\"name\"\n onChange={checkFieldValidity}\n error={showNameErrorText}\n inputProps={{ required: true }}\n defaultValue={state.context.name}\n />\n <TextField\n disabled={loading}\n label={messages.signUpEmailInputLabel}\n id=\"email-input\"\n name=\"email\"\n error={showEmailErrorText}\n helperText={showEmailErrorText && messages.signUpEmailErrorText}\n onChange={checkFieldValidity}\n inputProps={{\n required: showV2 || !signUpPhoneValue,\n type: 'email',\n }}\n defaultValue={state.context.email}\n />\n <LocationAndBirthday\n checkFieldValidity={checkFieldValidity}\n classes={classes}\n loading={loading}\n locationOptions={locationOptions}\n messages={messages}\n showLocationErrorText={showLocationErrorText}\n showV2={showV2}\n />\n <Box display=\"flex\" flexDirection=\"column\" alignItems=\"flex-start\" gridGap={2} width=\"100%\">\n {showSubscribeEmail && (\n <FormControlLabel\n style={{ alignItems: 'flex-start' }}\n control={<Checkbox id=\"subscribe-email\" name=\"subscribeEmail\" disabled={loading} color=\"primary\" />}\n label={\n <Typography className={classes.checkboxLabel}>{messages.subscribeEmailCheckboxLabel}</Typography>\n }\n />\n )}\n {showSubscribeSms && (\n <FormControlLabel\n style={{ alignItems: 'flex-start' }}\n control={<Checkbox id=\"subscribe-sms\" name=\"subscribeSms\" disabled={loading} color=\"primary\" />}\n label={<Typography className={classes.checkboxLabel}>{messages.subscribeSmsCheckboxLabel}</Typography>}\n />\n )}\n </Box>\n <FollowerAuthenticationPrivacyPolicy />\n <Button disabled={loading || !formValidity} type=\"submit\">\n {messages.signUp}\n </Button>\n </form>\n )\n case 'emailFound':\n return (\n <form {...formProps}>\n <TextField\n disabled={loading}\n label={messages.emailFoundInputLabel}\n id=\"email-input\"\n name=\"email\"\n value={state.context.email}\n />\n <Button disabled={loading} type=\"submit\">\n {messages.emailFoundCtaButtonLabel}\n </Button>\n </form>\n )\n case 'emailAuthCode':\n return (\n <form {...formProps}>\n <TextField disabled={loading} label={messages.emailAuthCodeInputLabel} id=\"code-input\" name=\"code\" />\n <Button disabled={loading} type=\"submit\">\n {messages.signIn}\n </Button>\n </form>\n )\n case 'emailMagicLinkSent':\n return (\n <Button\n disabled={loading}\n onClick={() => {\n onActionButtonClick('close')\n }}\n >\n {messages.emailMagicLinkSentCtaButtonLabel}\n </Button>\n )\n case 'indirectUserFound': {\n const isEmail = Boolean(state.context.email)\n const isPhone = Boolean(state.context.phone)\n if (!isEmail && !isPhone) return null\n return (\n <form {...formProps}>\n <TextField\n disabled={loading}\n label={isEmail ? messages.emailFoundInputLabel : messages.phoneFoundInputLabel}\n id={isEmail ? 'email-input' : 'phone-input'}\n name={isEmail ? 'email' : 'phone'}\n value={isEmail ? state.context.email : state.context.phone}\n />\n <Button disabled={loading} type=\"submit\">\n {messages.indirectUserFoundCtaButtonLabel}\n </Button>\n </form>\n )\n }\n case 'emailPasswordSignIn':\n return (\n <form {...formProps}>\n <TextField\n disabled={loading}\n label={messages.emailFoundInputLabel}\n id=\"email-input\"\n name=\"email\"\n value={state.context.email}\n InputLabelProps={{ shrink: true }}\n />\n <TextField\n disabled={loading}\n label={messages.passwordInputLabel}\n id=\"password-input\"\n name=\"password\"\n inputProps={{ type: 'password' }}\n />\n <Button disabled={loading} type=\"submit\">\n {messages.signIn}\n </Button>\n </form>\n )\n case 'phoneFound':\n return (\n <form {...formProps}>\n <TextField\n disabled={loading}\n label={messages.phoneFoundInputLabel}\n id=\"phone-input\"\n name=\"phone\"\n value={state.context.phone}\n />\n <Button disabled={loading} type=\"submit\">\n {messages.phoneFoundCtaButtonLabel}\n </Button>\n </form>\n )\n case 'phoneAuthCode':\n return (\n <form {...formProps}>\n <TextField\n disabled={loading}\n label={messages.phoneAuthCodeInputLabel}\n id=\"code-input\"\n name=\"code\"\n autoComplete=\"one-time-code\"\n />\n <Button disabled={loading} type=\"submit\">\n {messages.signIn}\n </Button>\n </form>\n )\n case 'phonePasswordSignIn':\n return (\n <form {...formProps}>\n <TextField\n disabled={loading}\n label={messages.phoneFoundInputLabel}\n id=\"phone-input\"\n name=\"phone\"\n value={state.context.phone}\n InputLabelProps={{ shrink: true }}\n />\n <TextField\n disabled={loading}\n label={messages.passwordInputLabel}\n id=\"password-input\"\n name=\"password\"\n inputProps={{ type: 'password' }}\n />\n <Button disabled={loading} type=\"submit\">\n {messages.signIn}\n </Button>\n </form>\n )\n case 'requirePhone':\n return (\n <form {...formProps}>\n <TextField\n disabled={loading}\n label={messages.requirePhoneInputLabel}\n id=\"phone-input\"\n name=\"phone\"\n value={state.context.phone}\n />\n <Button disabled={loading} type=\"submit\">\n {messages.requirePhoneCtaButtonLabel}\n </Button>\n </form>\n )\n case 'completeProfile':\n return <FollowerAuthenticationUserForm />\n case 'welcome':\n return null\n default:\n return null\n }\n}\n"],"names":[],"mappings":";;;;;;;AAQA,MAAM,SAAS,GAAG,UAAU,CAAC;AAC3B,IAAA,aAAa,EAAE;AACb,QAAA,OAAO,EAAE;AACP,YAAA,cAAc,EAAE,WAAW;AAC5B,SAAA;AACD,QAAA,QAAQ,EAAE,SAAS;AACpB,KAAA;AACD,IAAA,IAAI,EAAE;AACJ,QAAA,UAAU,EAAE,QAAQ;AACpB,QAAA,OAAO,EAAE,MAAM;AACf,QAAA,aAAa,EAAE,QAAQ;AACvB,QAAA,OAAO,EAAE,EAAE;AACX,QAAA,KAAK,EAAE,MAAM;AACd,KAAA;AACD,IAAA,KAAK,EAAE;AACL,QAAA,SAAS,EAAE,OAAO;AAClB,QAAA,QAAQ,EAAE,SAAS;AACpB,KAAA;AACF,CAAA,CAAC;AAYF,SAAS,mBAAmB,CAAC,EAC3B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,MAAM,CACT,CACJ;AAEX,QAAA,KAAK,cAAc;YACjB,QACE,iCAAU,SAAS,EAAA;gBACjB,KAAC,CAAA,aAAA,CAAA,SAAS,EACR,EAAA,QAAQ,EAAE,OAAO,EACjB,KAAK,EAAE,QAAQ,CAAC,sBAAsB,EACtC,EAAE,EAAC,aAAa,EAChB,IAAI,EAAC,OAAO,EACZ,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,EAC1B,CAAA;AACF,gBAAA,KAAA,CAAA,aAAA,CAAC,MAAM,EAAC,EAAA,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAC,QAAQ,EAAA,EACrC,QAAQ,CAAC,0BAA0B,CAC7B,CACJ;AAEX,QAAA,KAAK,iBAAiB;YACpB,OAAO,KAAA,CAAA,aAAA,CAAC,8BAA8B,EAAA,IAAA,CAAG;AAC3C,QAAA,KAAK,SAAS;AACZ,YAAA,OAAO,IAAI;AACb,QAAA;AACE,YAAA,OAAO,IAAI;;AAEjB;;;;"}
|
|
@@ -4,7 +4,7 @@ import { Box } from '@material-ui/core';
|
|
|
4
4
|
|
|
5
5
|
const FollowerAuthenticationGraphic = () => {
|
|
6
6
|
const { state, graphics, showV2 } = useFollowerAuthenticationDialogContext();
|
|
7
|
-
if (showV2 && state.value === 'signUp')
|
|
7
|
+
if (showV2 && (state.value === 'signUp' || state.value === 'completeProfile'))
|
|
8
8
|
return null;
|
|
9
9
|
const graphic = graphics[state.value];
|
|
10
10
|
if (!graphic)
|
package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationGraphic.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FollowerAuthenticationGraphic.js","sources":["../../../../src/components/FollowerAuthenticationDialog/FollowerAuthenticationGraphic.tsx"],"sourcesContent":["import React from 'react'\nimport { useFollowerAuthenticationDialogContext } from './context'\nimport { Box } from '@material-ui/core'\n\nexport const FollowerAuthenticationGraphic = () => {\n const { state, graphics, showV2 } = useFollowerAuthenticationDialogContext()\n if (showV2 && state.value === 'signUp') return null\n\n const graphic = graphics[state.value]\n if (!graphic) return null\n return (\n <Box>\n <img src={graphic} alt=\"\" style={showV2 ? { width: 95, height: 95 } : undefined} />\n </Box>\n )\n}\n"],"names":[],"mappings":";;;;AAIO,MAAM,6BAA6B,GAAG,MAAK;IAChD,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,sCAAsC,EAAE;AAC5E,IAAA,IAAI,MAAM,IAAI,KAAK,CAAC,KAAK,KAAK,
|
|
1
|
+
{"version":3,"file":"FollowerAuthenticationGraphic.js","sources":["../../../../src/components/FollowerAuthenticationDialog/FollowerAuthenticationGraphic.tsx"],"sourcesContent":["import React from 'react'\nimport { useFollowerAuthenticationDialogContext } from './context'\nimport { Box } from '@material-ui/core'\n\nexport const FollowerAuthenticationGraphic = () => {\n const { state, graphics, showV2 } = useFollowerAuthenticationDialogContext()\n if (showV2 && (state.value === 'signUp' || state.value === 'completeProfile')) return null\n\n const graphic = graphics[state.value]\n if (!graphic) return null\n return (\n <Box>\n <img src={graphic} alt=\"\" style={showV2 ? { width: 95, height: 95 } : undefined} />\n </Box>\n )\n}\n"],"names":[],"mappings":";;;;AAIO,MAAM,6BAA6B,GAAG,MAAK;IAChD,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,sCAAsC,EAAE;AAC5E,IAAA,IAAI,MAAM,KAAK,KAAK,CAAC,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,KAAK,KAAK,iBAAiB,CAAC;AAAE,QAAA,OAAO,IAAI;IAE1F,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC;AACrC,IAAA,IAAI,CAAC,OAAO;AAAE,QAAA,OAAO,IAAI;IACzB,QACE,oBAAC,GAAG,EAAA,IAAA;AACF,QAAA,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,GAAG,EAAE,OAAO,EAAE,GAAG,EAAC,EAAE,EAAC,KAAK,EAAE,MAAM,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,SAAS,EAAI,CAAA,CAC/E;AAEV;;;;"}
|
|
@@ -4,7 +4,7 @@ import { Box, Typography } from '@material-ui/core';
|
|
|
4
4
|
|
|
5
5
|
const FollowerAuthenticationInfo = () => {
|
|
6
6
|
const { state, messages, showV2 } = useFollowerAuthenticationDialogContext();
|
|
7
|
-
if (showV2 && state.value === 'signUp')
|
|
7
|
+
if (showV2 && (state.value === 'signUp' || state.value === 'completeProfile'))
|
|
8
8
|
return null;
|
|
9
9
|
const info = messages[`${state.value}Info`];
|
|
10
10
|
const last4Digits = state.context.phone?.slice(-4);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FollowerAuthenticationInfo.js","sources":["../../../../src/components/FollowerAuthenticationDialog/FollowerAuthenticationInfo.tsx"],"sourcesContent":["import React from 'react'\nimport { useFollowerAuthenticationDialogContext } from './context'\nimport { Box, Typography } from '@material-ui/core'\nimport { MessageKey } from './FollowerAuthenticationDialogProps'\n\nexport const FollowerAuthenticationInfo = () => {\n const { state, messages, showV2 } = useFollowerAuthenticationDialogContext()\n if (showV2 && state.value === 'signUp') return null\n\n const info = messages[`${state.value}Info` as MessageKey]\n const last4Digits = state.context.phone?.slice(-4)\n\n if (!info) return null\n return (\n <Box>\n <Typography align=\"center\">{info}</Typography>\n {showV2 && state.value === 'phoneAuthCode' && (\n <Typography align=\"center\" variant=\"h5\" style={{ marginTop: 16 }}>\n ***-***-{last4Digits}\n </Typography>\n )}\n </Box>\n )\n}\n"],"names":[],"mappings":";;;;AAKO,MAAM,0BAA0B,GAAG,MAAK;IAC7C,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,sCAAsC,EAAE;AAC5E,IAAA,IAAI,MAAM,IAAI,KAAK,CAAC,KAAK,KAAK,
|
|
1
|
+
{"version":3,"file":"FollowerAuthenticationInfo.js","sources":["../../../../src/components/FollowerAuthenticationDialog/FollowerAuthenticationInfo.tsx"],"sourcesContent":["import React from 'react'\nimport { useFollowerAuthenticationDialogContext } from './context'\nimport { Box, Typography } from '@material-ui/core'\nimport { MessageKey } from './FollowerAuthenticationDialogProps'\n\nexport const FollowerAuthenticationInfo = () => {\n const { state, messages, showV2 } = useFollowerAuthenticationDialogContext()\n if (showV2 && (state.value === 'signUp' || state.value === 'completeProfile')) return null\n\n const info = messages[`${state.value}Info` as MessageKey]\n const last4Digits = state.context.phone?.slice(-4)\n\n if (!info) return null\n return (\n <Box>\n <Typography align=\"center\">{info}</Typography>\n {showV2 && state.value === 'phoneAuthCode' && (\n <Typography align=\"center\" variant=\"h5\" style={{ marginTop: 16 }}>\n ***-***-{last4Digits}\n </Typography>\n )}\n </Box>\n )\n}\n"],"names":[],"mappings":";;;;AAKO,MAAM,0BAA0B,GAAG,MAAK;IAC7C,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,sCAAsC,EAAE;AAC5E,IAAA,IAAI,MAAM,KAAK,KAAK,CAAC,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,KAAK,KAAK,iBAAiB,CAAC;AAAE,QAAA,OAAO,IAAI;IAE1F,MAAM,IAAI,GAAG,QAAQ,CAAC,CAAA,EAAG,KAAK,CAAC,KAAK,CAAoB,IAAA,CAAA,CAAC;AACzD,IAAA,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC;AAElD,IAAA,IAAI,CAAC,IAAI;AAAE,QAAA,OAAO,IAAI;IACtB,QACE,oBAAC,GAAG,EAAA,IAAA;AACF,QAAA,KAAA,CAAA,aAAA,CAAC,UAAU,EAAC,EAAA,KAAK,EAAC,QAAQ,EAAA,EAAE,IAAI,CAAc;QAC7C,MAAM,IAAI,KAAK,CAAC,KAAK,KAAK,eAAe,KACxC,KAAC,CAAA,aAAA,CAAA,UAAU,EAAC,EAAA,KAAK,EAAC,QAAQ,EAAC,OAAO,EAAC,IAAI,EAAC,KAAK,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,EAAA;;AACrD,YAAA,WAAW,CACT,CACd,CACG;AAEV;;;;"}
|
package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationPrivacyPolicy.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useFollowerAuthenticationDialogContext } from './context.js';
|
|
3
|
+
import { makeStyles, Typography, Button } from '@material-ui/core';
|
|
4
|
+
|
|
5
|
+
const useStyles = makeStyles((theme) => ({
|
|
6
|
+
button: {
|
|
7
|
+
fontSize: '0.75rem',
|
|
8
|
+
margin: theme.spacing(0, 0.5),
|
|
9
|
+
padding: 0,
|
|
10
|
+
textDecoration: 'underline',
|
|
11
|
+
width: 'auto',
|
|
12
|
+
},
|
|
13
|
+
text: {
|
|
14
|
+
fontSize: '0.75rem',
|
|
15
|
+
textAlign: 'center',
|
|
16
|
+
},
|
|
17
|
+
}));
|
|
18
|
+
const FollowerAuthenticationPrivacyPolicy = () => {
|
|
19
|
+
const classes = useStyles();
|
|
20
|
+
const { messages, onActionButtonClick, showV2 } = useFollowerAuthenticationDialogContext();
|
|
21
|
+
if (!showV2 || !messages.privacyPolicyText)
|
|
22
|
+
return null;
|
|
23
|
+
return (React.createElement(Typography, { className: classes.text },
|
|
24
|
+
messages.privacyPolicyText,
|
|
25
|
+
React.createElement(Button, { className: classes.button, onClick: () => onActionButtonClick('open-privacy-policy'), variant: "text" }, messages.privacyPolicyButtonLabel)));
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export { FollowerAuthenticationPrivacyPolicy };
|
|
29
|
+
//# sourceMappingURL=FollowerAuthenticationPrivacyPolicy.js.map
|
package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationPrivacyPolicy.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FollowerAuthenticationPrivacyPolicy.js","sources":["../../../../src/components/FollowerAuthenticationDialog/FollowerAuthenticationPrivacyPolicy.tsx"],"sourcesContent":["import React from 'react'\nimport { useFollowerAuthenticationDialogContext } from './context'\nimport { Button, makeStyles, Typography } from '@material-ui/core'\n\nconst useStyles = makeStyles((theme) => ({\n button: {\n fontSize: '0.75rem',\n margin: theme.spacing(0, 0.5),\n padding: 0,\n textDecoration: 'underline',\n width: 'auto',\n },\n text: {\n fontSize: '0.75rem',\n textAlign: 'center',\n },\n}))\n\nexport const FollowerAuthenticationPrivacyPolicy = () => {\n const classes = useStyles()\n const { messages, onActionButtonClick, showV2 } = useFollowerAuthenticationDialogContext()\n if (!showV2 || !messages.privacyPolicyText) return null\n return (\n <Typography className={classes.text}>\n {messages.privacyPolicyText}\n <Button className={classes.button} onClick={() => onActionButtonClick('open-privacy-policy')} variant=\"text\">\n {messages.privacyPolicyButtonLabel}\n </Button>\n </Typography>\n )\n}\n"],"names":[],"mappings":";;;;AAIA,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,KAAK,MAAM;AACvC,IAAA,MAAM,EAAE;AACN,QAAA,QAAQ,EAAE,SAAS;QACnB,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,GAAG,CAAC;AAC7B,QAAA,OAAO,EAAE,CAAC;AACV,QAAA,cAAc,EAAE,WAAW;AAC3B,QAAA,KAAK,EAAE,MAAM;AACd,KAAA;AACD,IAAA,IAAI,EAAE;AACJ,QAAA,QAAQ,EAAE,SAAS;AACnB,QAAA,SAAS,EAAE,QAAQ;AACpB,KAAA;AACF,CAAA,CAAC,CAAC;AAEI,MAAM,mCAAmC,GAAG,MAAK;AACtD,IAAA,MAAM,OAAO,GAAG,SAAS,EAAE;IAC3B,MAAM,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,EAAE,GAAG,sCAAsC,EAAE;AAC1F,IAAA,IAAI,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,iBAAiB;AAAE,QAAA,OAAO,IAAI;IACvD,QACE,oBAAC,UAAU,EAAA,EAAC,SAAS,EAAE,OAAO,CAAC,IAAI,EAAA;AAChC,QAAA,QAAQ,CAAC,iBAAiB;AAC3B,QAAA,KAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EAAC,SAAS,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC,qBAAqB,CAAC,EAAE,OAAO,EAAC,MAAM,EAAA,EACzG,QAAQ,CAAC,wBAAwB,CAC3B,CACE;AAEjB;;;;"}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import React, { useRef, useState, useMemo } from 'react';
|
|
2
|
+
import { useFollowerAuthenticationDialogContext } from './context.js';
|
|
3
|
+
import { makeStyles, TextField, MenuItem, Button, Box, Typography } from '@material-ui/core';
|
|
4
|
+
import { Divider } from '../Divider/Divider.js';
|
|
5
|
+
import { formatPhoneNumber, validatePhoneNumber } from './phoneValidation.js';
|
|
6
|
+
import { FollowerAuthenticationPrivacyPolicy } from './FollowerAuthenticationPrivacyPolicy.js';
|
|
7
|
+
|
|
8
|
+
const getDaysInMonth = (month) => {
|
|
9
|
+
const m = parseInt(month, 10);
|
|
10
|
+
if (!m)
|
|
11
|
+
return 31;
|
|
12
|
+
// Allow 29 for Feb to support leap year birthdays/anniversaries
|
|
13
|
+
const days = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
14
|
+
return days[m - 1];
|
|
15
|
+
};
|
|
16
|
+
const useStyles = makeStyles((theme) => ({
|
|
17
|
+
form: {
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
display: 'flex',
|
|
20
|
+
flexDirection: 'column',
|
|
21
|
+
gridGap: 16,
|
|
22
|
+
width: '100%',
|
|
23
|
+
},
|
|
24
|
+
sectionLabel: {
|
|
25
|
+
alignSelf: 'start',
|
|
26
|
+
fontSize: '0.75rem',
|
|
27
|
+
},
|
|
28
|
+
divider: {
|
|
29
|
+
width: '100%',
|
|
30
|
+
},
|
|
31
|
+
pickerContainer: {
|
|
32
|
+
display: 'flex',
|
|
33
|
+
flexDirection: 'column',
|
|
34
|
+
gridGap: theme.spacing(1),
|
|
35
|
+
width: '100%',
|
|
36
|
+
},
|
|
37
|
+
pickerFieldsRow: {
|
|
38
|
+
display: 'flex',
|
|
39
|
+
gridGap: theme.spacing(2),
|
|
40
|
+
width: '100%',
|
|
41
|
+
},
|
|
42
|
+
pickerField: {
|
|
43
|
+
flex: 1,
|
|
44
|
+
},
|
|
45
|
+
}));
|
|
46
|
+
const MonthDayPicker = ({ sectionLabel, monthLabel, dayLabel, monthId, dayId, monthName, dayName, monthValue, dayValue, onMonthChange, onDayChange, required, disabled, monthOptions, }) => {
|
|
47
|
+
const classes = useStyles();
|
|
48
|
+
const dayOptions = useMemo(() => Array.from({ length: getDaysInMonth(monthValue) }, (_, i) => ({ label: String(i + 1), value: String(i + 1) })), [monthValue]);
|
|
49
|
+
return (React.createElement(Box, { className: classes.pickerContainer },
|
|
50
|
+
React.createElement(Typography, { className: classes.sectionLabel }, sectionLabel),
|
|
51
|
+
React.createElement(Box, { className: classes.pickerFieldsRow },
|
|
52
|
+
React.createElement(TextField, { disabled: disabled, select: true, label: monthLabel, id: monthId, name: monthName, value: monthValue, onChange: (e) => {
|
|
53
|
+
const newMonth = e.target.value;
|
|
54
|
+
onMonthChange(newMonth);
|
|
55
|
+
if (dayValue && parseInt(dayValue, 10) > getDaysInMonth(newMonth)) {
|
|
56
|
+
onDayChange('');
|
|
57
|
+
}
|
|
58
|
+
}, required: required || Boolean(dayValue), className: classes.pickerField }, monthOptions.map((option) => (React.createElement(MenuItem, { key: option.value, value: option.value }, option.label)))),
|
|
59
|
+
React.createElement(TextField, { disabled: disabled, select: true, label: dayLabel, id: dayId, name: dayName, value: dayValue, onChange: (e) => onDayChange(e.target.value), required: required || Boolean(monthValue), className: classes.pickerField }, dayOptions.map((option) => (React.createElement(MenuItem, { key: option.value, value: option.value }, option.label)))))));
|
|
60
|
+
};
|
|
61
|
+
const FollowerAuthenticationUserForm = () => {
|
|
62
|
+
const { state, messages, locationOptions, onActionButtonClick, loading, signUpSetting } = useFollowerAuthenticationDialogContext();
|
|
63
|
+
const showPhone = signUpSetting?.phone?.enabled !== false;
|
|
64
|
+
const phoneRequired = signUpSetting?.phone?.required ?? false;
|
|
65
|
+
const showBirthday = signUpSetting?.birthday?.enabled !== false;
|
|
66
|
+
const birthdayRequired = signUpSetting?.birthday?.required ?? false;
|
|
67
|
+
const showWeddingAnniversary = signUpSetting?.weddingAnniversary?.enabled !== false;
|
|
68
|
+
const weddingAnniversaryRequired = signUpSetting?.weddingAnniversary?.required ?? false;
|
|
69
|
+
const classes = useStyles();
|
|
70
|
+
const formRef = useRef(null);
|
|
71
|
+
const [showNameErrorText, setShowNameErrorText] = useState(false);
|
|
72
|
+
const [showEmailErrorText, setShowEmailErrorText] = useState(false);
|
|
73
|
+
const [showPhoneErrorText, setShowPhoneErrorText] = useState(false);
|
|
74
|
+
const [showLocationErrorText, setShowLocationErrorText] = useState(false);
|
|
75
|
+
const [nameValue, setNameValue] = useState(state.context.name || '');
|
|
76
|
+
const [emailValue, setEmailValue] = useState(state.context.email || '');
|
|
77
|
+
const [phoneValue, setPhoneValue] = useState(formatPhoneNumber(state.context.phone || ''));
|
|
78
|
+
const [locationValue, setLocationValue] = useState(state.context.favoriteLocationId ? String(state.context.favoriteLocationId) : '');
|
|
79
|
+
const [selectedBirthMonth, setSelectedBirthMonth] = useState(state.context.birthMonth ? String(state.context.birthMonth) : '');
|
|
80
|
+
const [selectedBirthDay, setSelectedBirthDay] = useState(state.context.birthDay ? String(state.context.birthDay) : '');
|
|
81
|
+
const [selectedWeddingMonth, setSelectedWeddingMonth] = useState(state.context.weddingMonth ? String(state.context.weddingMonth) : '');
|
|
82
|
+
const [selectedWeddingDay, setSelectedWeddingDay] = useState(state.context.weddingDay ? String(state.context.weddingDay) : '');
|
|
83
|
+
const checkFieldValidity = (e) => {
|
|
84
|
+
const fieldName = e.target.name;
|
|
85
|
+
const fieldValue = e.target.value;
|
|
86
|
+
switch (fieldName) {
|
|
87
|
+
case 'name': {
|
|
88
|
+
setNameValue(fieldValue);
|
|
89
|
+
setShowNameErrorText(fieldValue.length === 0);
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
case 'email': {
|
|
93
|
+
const emailField = formRef.current?.elements.namedItem(fieldName);
|
|
94
|
+
const isEmailValid = emailField?.validity.valid ?? false;
|
|
95
|
+
setEmailValue(fieldValue);
|
|
96
|
+
setShowEmailErrorText(!isEmailValid && fieldValue.length > 0);
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
case 'phone': {
|
|
100
|
+
const formatted = formatPhoneNumber(fieldValue);
|
|
101
|
+
setPhoneValue(formatted);
|
|
102
|
+
setShowPhoneErrorText(formatted.length > 0 && !validatePhoneNumber(formatted));
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
case 'location': {
|
|
106
|
+
setLocationValue(fieldValue);
|
|
107
|
+
setShowLocationErrorText(!fieldValue);
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
const isFormValid = useMemo(() => {
|
|
113
|
+
const hasValidName = Boolean(nameValue) && !showNameErrorText;
|
|
114
|
+
const hasValidEmail = Boolean(emailValue) && !showEmailErrorText;
|
|
115
|
+
const hasValidPhone = showPhone
|
|
116
|
+
? state.context.phone
|
|
117
|
+
? true
|
|
118
|
+
: phoneRequired
|
|
119
|
+
? validatePhoneNumber(phoneValue)
|
|
120
|
+
: !phoneValue || validatePhoneNumber(phoneValue)
|
|
121
|
+
: true;
|
|
122
|
+
const hasValidLocation = locationOptions.length > 0 ? Boolean(locationValue) : true;
|
|
123
|
+
// A partial date (only month or only day) requires completing the pair
|
|
124
|
+
const hasValidBirthday = !showBirthday ||
|
|
125
|
+
(birthdayRequired || selectedBirthMonth || selectedBirthDay
|
|
126
|
+
? Boolean(selectedBirthMonth) && Boolean(selectedBirthDay)
|
|
127
|
+
: true);
|
|
128
|
+
const hasValidWeddingAnniversary = !showWeddingAnniversary ||
|
|
129
|
+
(weddingAnniversaryRequired || selectedWeddingMonth || selectedWeddingDay
|
|
130
|
+
? Boolean(selectedWeddingMonth) && Boolean(selectedWeddingDay)
|
|
131
|
+
: true);
|
|
132
|
+
return (hasValidName &&
|
|
133
|
+
hasValidEmail &&
|
|
134
|
+
hasValidPhone &&
|
|
135
|
+
hasValidLocation &&
|
|
136
|
+
hasValidBirthday &&
|
|
137
|
+
hasValidWeddingAnniversary);
|
|
138
|
+
}, [
|
|
139
|
+
nameValue,
|
|
140
|
+
emailValue,
|
|
141
|
+
phoneValue,
|
|
142
|
+
state.context.phone,
|
|
143
|
+
locationValue,
|
|
144
|
+
locationOptions.length,
|
|
145
|
+
showNameErrorText,
|
|
146
|
+
showEmailErrorText,
|
|
147
|
+
showPhone,
|
|
148
|
+
phoneRequired,
|
|
149
|
+
showBirthday,
|
|
150
|
+
birthdayRequired,
|
|
151
|
+
selectedBirthMonth,
|
|
152
|
+
selectedBirthDay,
|
|
153
|
+
showWeddingAnniversary,
|
|
154
|
+
weddingAnniversaryRequired,
|
|
155
|
+
selectedWeddingMonth,
|
|
156
|
+
selectedWeddingDay,
|
|
157
|
+
]);
|
|
158
|
+
const monthOptions = useMemo(() => [
|
|
159
|
+
{ label: messages.signUpMonthJanuary, value: '1' },
|
|
160
|
+
{ label: messages.signUpMonthFebruary, value: '2' },
|
|
161
|
+
{ label: messages.signUpMonthMarch, value: '3' },
|
|
162
|
+
{ label: messages.signUpMonthApril, value: '4' },
|
|
163
|
+
{ label: messages.signUpMonthMay, value: '5' },
|
|
164
|
+
{ label: messages.signUpMonthJune, value: '6' },
|
|
165
|
+
{ label: messages.signUpMonthJuly, value: '7' },
|
|
166
|
+
{ label: messages.signUpMonthAugust, value: '8' },
|
|
167
|
+
{ label: messages.signUpMonthSeptember, value: '9' },
|
|
168
|
+
{ label: messages.signUpMonthOctober, value: '10' },
|
|
169
|
+
{ label: messages.signUpMonthNovember, value: '11' },
|
|
170
|
+
{ label: messages.signUpMonthDecember, value: '12' },
|
|
171
|
+
], [messages]);
|
|
172
|
+
const handleSubmit = (e) => {
|
|
173
|
+
e.preventDefault();
|
|
174
|
+
const formData = new FormData(e.target);
|
|
175
|
+
const values = Object.fromEntries(formData.entries());
|
|
176
|
+
// Disabled fields are excluded from FormData — restore pre-filled values from context
|
|
177
|
+
if (state.context.email && !values.email)
|
|
178
|
+
values.email = state.context.email;
|
|
179
|
+
if (state.context.phone && !values.phone)
|
|
180
|
+
values.phone = state.context.phone;
|
|
181
|
+
// Strip display formatting so the submitted value is consistent with the disabled-field path
|
|
182
|
+
if (values.phone) {
|
|
183
|
+
values.phone = values.phone.replace(/[^\d+]/g, '');
|
|
184
|
+
}
|
|
185
|
+
onActionButtonClick('submit-form', values);
|
|
186
|
+
};
|
|
187
|
+
return (React.createElement("form", { ref: formRef, id: "follower-authentication-user-form", className: classes.form, onSubmit: handleSubmit, onInvalid: (e) => e.preventDefault() },
|
|
188
|
+
React.createElement(TextField, { disabled: loading || Boolean(state.context.email), label: messages.signUpEmailInputLabel, id: "email-input", name: "email", onChange: checkFieldValidity, error: showEmailErrorText, helperText: showEmailErrorText && messages.signUpEmailErrorText, inputProps: { type: 'email', required: true }, value: emailValue, fullWidth: true }),
|
|
189
|
+
React.createElement(Divider, { className: classes.divider }),
|
|
190
|
+
React.createElement(TextField, { disabled: loading, label: messages.signUpNameInputLabel, id: "name-input", name: "name", onChange: checkFieldValidity, error: showNameErrorText, helperText: showNameErrorText && messages.signUpNameErrorText, inputProps: { required: true }, value: nameValue, fullWidth: true }),
|
|
191
|
+
showPhone && (React.createElement(TextField, { disabled: loading || Boolean(state.context.phone), label: messages.signUpPhoneInputLabel, id: "phone-input", name: "phone", onChange: checkFieldValidity, error: showPhoneErrorText, helperText: showPhoneErrorText && messages.signUpPhoneErrorText, inputProps: { required: phoneRequired }, value: phoneValue, fullWidth: true })),
|
|
192
|
+
locationOptions.length > 0 && (React.createElement(TextField, { disabled: loading, select: true, onChange: checkFieldValidity, label: messages.signUpLocationInputLabel, error: showLocationErrorText, helperText: showLocationErrorText && messages.signUpLocationErrorText, id: "location-input", name: "location", value: locationValue, fullWidth: true }, locationOptions.map((option) => (React.createElement(MenuItem, { "data-cy": "option", key: option.value, value: option.value }, option.label))))),
|
|
193
|
+
(showBirthday || showWeddingAnniversary) && React.createElement(Divider, { className: classes.divider }),
|
|
194
|
+
showBirthday && (React.createElement(MonthDayPicker, { sectionLabel: messages.signUpBirthdaySectionLabel, monthLabel: messages.signUpMonthInputLabel, dayLabel: messages.signUpDayInputLabel, monthId: "birthday-month-input", dayId: "birthday-date-input", monthName: "birthMonth", dayName: "birthDay", monthValue: selectedBirthMonth, dayValue: selectedBirthDay, onMonthChange: setSelectedBirthMonth, onDayChange: setSelectedBirthDay, required: birthdayRequired, disabled: loading, monthOptions: monthOptions })),
|
|
195
|
+
showWeddingAnniversary && (React.createElement(MonthDayPicker, { sectionLabel: messages.signUpWeddingAnniversarySectionLabel, monthLabel: messages.signUpMonthInputLabel, dayLabel: messages.signUpDayInputLabel, monthId: "wedding-month-input", dayId: "wedding-date-input", monthName: "weddingMonth", dayName: "weddingDay", monthValue: selectedWeddingMonth, dayValue: selectedWeddingDay, onMonthChange: setSelectedWeddingMonth, onDayChange: setSelectedWeddingDay, required: weddingAnniversaryRequired, disabled: loading, monthOptions: monthOptions })),
|
|
196
|
+
React.createElement(FollowerAuthenticationPrivacyPolicy, null),
|
|
197
|
+
React.createElement(Button, { disabled: loading || !isFormValid, type: "submit" }, messages.completeProfileCtaButtonLabel)));
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
export { FollowerAuthenticationUserForm };
|
|
201
|
+
//# sourceMappingURL=FollowerAuthenticationUserForm.js.map
|
package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationUserForm.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FollowerAuthenticationUserForm.js","sources":["../../../../src/components/FollowerAuthenticationDialog/FollowerAuthenticationUserForm.tsx"],"sourcesContent":["import React, { ChangeEventHandler, ReactNode, useMemo, useRef, useState } from 'react'\nimport { useFollowerAuthenticationDialogContext } from './context'\nimport { Box, Button, makeStyles, MenuItem, TextField, Typography } from '@material-ui/core'\nimport { Divider } from '../Divider'\nimport { validatePhoneNumber, formatPhoneNumber } from './phoneValidation'\nimport { FollowerAuthenticationPrivacyPolicy } from './FollowerAuthenticationPrivacyPolicy'\n\nconst getDaysInMonth = (month: string): number => {\n const m = parseInt(month, 10)\n if (!m) return 31\n // Allow 29 for Feb to support leap year birthdays/anniversaries\n const days = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n return days[m - 1]\n}\n\nconst useStyles = makeStyles((theme) => ({\n form: {\n alignItems: 'center',\n display: 'flex',\n flexDirection: 'column',\n gridGap: 16,\n width: '100%',\n },\n sectionLabel: {\n alignSelf: 'start',\n fontSize: '0.75rem',\n },\n divider: {\n width: '100%',\n },\n pickerContainer: {\n display: 'flex',\n flexDirection: 'column',\n gridGap: theme.spacing(1),\n width: '100%',\n },\n pickerFieldsRow: {\n display: 'flex',\n gridGap: theme.spacing(2),\n width: '100%',\n },\n pickerField: {\n flex: 1,\n },\n}))\n\ntype MonthDayPickerProps = {\n sectionLabel: ReactNode\n monthLabel: ReactNode\n dayLabel: ReactNode\n monthId: string\n dayId: string\n monthName: string\n dayName: string\n monthValue: string\n dayValue: string\n onMonthChange: (value: string) => void\n onDayChange: (value: string) => void\n required: boolean\n disabled: boolean\n monthOptions: { label: ReactNode; value: string }[]\n}\n\nconst MonthDayPicker = ({\n sectionLabel,\n monthLabel,\n dayLabel,\n monthId,\n dayId,\n monthName,\n dayName,\n monthValue,\n dayValue,\n onMonthChange,\n onDayChange,\n required,\n disabled,\n monthOptions,\n}: MonthDayPickerProps) => {\n const classes = useStyles()\n const dayOptions = useMemo(\n () =>\n Array.from({ length: getDaysInMonth(monthValue) }, (_, i) => ({ label: String(i + 1), value: String(i + 1) })),\n [monthValue],\n )\n\n return (\n <Box className={classes.pickerContainer}>\n <Typography className={classes.sectionLabel}>{sectionLabel}</Typography>\n <Box className={classes.pickerFieldsRow}>\n <TextField\n disabled={disabled}\n select\n label={monthLabel}\n id={monthId}\n name={monthName}\n value={monthValue}\n onChange={(e) => {\n const newMonth = e.target.value\n onMonthChange(newMonth)\n if (dayValue && parseInt(dayValue, 10) > getDaysInMonth(newMonth)) {\n onDayChange('')\n }\n }}\n required={required || Boolean(dayValue)}\n className={classes.pickerField}\n >\n {monthOptions.map((option) => (\n <MenuItem key={option.value} value={option.value}>\n {option.label}\n </MenuItem>\n ))}\n </TextField>\n <TextField\n disabled={disabled}\n select\n label={dayLabel}\n id={dayId}\n name={dayName}\n value={dayValue}\n onChange={(e) => onDayChange(e.target.value)}\n required={required || Boolean(monthValue)}\n className={classes.pickerField}\n >\n {dayOptions.map((option) => (\n <MenuItem key={option.value} value={option.value}>\n {option.label}\n </MenuItem>\n ))}\n </TextField>\n </Box>\n </Box>\n )\n}\n\nexport const FollowerAuthenticationUserForm = () => {\n const { state, messages, locationOptions, onActionButtonClick, loading, signUpSetting } =\n useFollowerAuthenticationDialogContext()\n\n const showPhone = signUpSetting?.phone?.enabled !== false\n const phoneRequired = signUpSetting?.phone?.required ?? false\n const showBirthday = signUpSetting?.birthday?.enabled !== false\n const birthdayRequired = signUpSetting?.birthday?.required ?? false\n const showWeddingAnniversary = signUpSetting?.weddingAnniversary?.enabled !== false\n const weddingAnniversaryRequired = signUpSetting?.weddingAnniversary?.required ?? false\n\n const classes = useStyles()\n const formRef = useRef<HTMLFormElement>(null)\n\n const [showNameErrorText, setShowNameErrorText] = useState(false)\n const [showEmailErrorText, setShowEmailErrorText] = useState(false)\n const [showPhoneErrorText, setShowPhoneErrorText] = useState(false)\n const [showLocationErrorText, setShowLocationErrorText] = useState(false)\n\n const [nameValue, setNameValue] = useState(state.context.name || '')\n const [emailValue, setEmailValue] = useState(state.context.email || '')\n const [phoneValue, setPhoneValue] = useState(formatPhoneNumber(state.context.phone || ''))\n const [locationValue, setLocationValue] = useState(\n state.context.favoriteLocationId ? String(state.context.favoriteLocationId) : '',\n )\n const [selectedBirthMonth, setSelectedBirthMonth] = useState(\n state.context.birthMonth ? String(state.context.birthMonth) : '',\n )\n const [selectedBirthDay, setSelectedBirthDay] = useState(state.context.birthDay ? String(state.context.birthDay) : '')\n const [selectedWeddingMonth, setSelectedWeddingMonth] = useState(\n state.context.weddingMonth ? String(state.context.weddingMonth) : '',\n )\n const [selectedWeddingDay, setSelectedWeddingDay] = useState(\n state.context.weddingDay ? String(state.context.weddingDay) : '',\n )\n\n const checkFieldValidity: ChangeEventHandler<HTMLInputElement> = (e) => {\n const fieldName = e.target.name\n const fieldValue = e.target.value\n\n switch (fieldName) {\n case 'name': {\n setNameValue(fieldValue)\n setShowNameErrorText(fieldValue.length === 0)\n break\n }\n case 'email': {\n const emailField = formRef.current?.elements.namedItem(fieldName) as HTMLInputElement\n const isEmailValid = emailField?.validity.valid ?? false\n setEmailValue(fieldValue)\n setShowEmailErrorText(!isEmailValid && fieldValue.length > 0)\n break\n }\n case 'phone': {\n const formatted = formatPhoneNumber(fieldValue)\n setPhoneValue(formatted)\n setShowPhoneErrorText(formatted.length > 0 && !validatePhoneNumber(formatted))\n break\n }\n case 'location': {\n setLocationValue(fieldValue)\n setShowLocationErrorText(!fieldValue)\n break\n }\n default:\n break\n }\n }\n\n const isFormValid = useMemo(() => {\n const hasValidName = Boolean(nameValue) && !showNameErrorText\n const hasValidEmail = Boolean(emailValue) && !showEmailErrorText\n const hasValidPhone = showPhone\n ? state.context.phone\n ? true\n : phoneRequired\n ? validatePhoneNumber(phoneValue)\n : !phoneValue || validatePhoneNumber(phoneValue)\n : true\n const hasValidLocation = locationOptions.length > 0 ? Boolean(locationValue) : true\n // A partial date (only month or only day) requires completing the pair\n const hasValidBirthday =\n !showBirthday ||\n (birthdayRequired || selectedBirthMonth || selectedBirthDay\n ? Boolean(selectedBirthMonth) && Boolean(selectedBirthDay)\n : true)\n const hasValidWeddingAnniversary =\n !showWeddingAnniversary ||\n (weddingAnniversaryRequired || selectedWeddingMonth || selectedWeddingDay\n ? Boolean(selectedWeddingMonth) && Boolean(selectedWeddingDay)\n : true)\n return (\n hasValidName &&\n hasValidEmail &&\n hasValidPhone &&\n hasValidLocation &&\n hasValidBirthday &&\n hasValidWeddingAnniversary\n )\n }, [\n nameValue,\n emailValue,\n phoneValue,\n state.context.phone,\n locationValue,\n locationOptions.length,\n showNameErrorText,\n showEmailErrorText,\n showPhone,\n phoneRequired,\n showBirthday,\n birthdayRequired,\n selectedBirthMonth,\n selectedBirthDay,\n showWeddingAnniversary,\n weddingAnniversaryRequired,\n selectedWeddingMonth,\n selectedWeddingDay,\n ])\n\n const monthOptions = useMemo(\n () => [\n { label: messages.signUpMonthJanuary, value: '1' },\n { label: messages.signUpMonthFebruary, value: '2' },\n { label: messages.signUpMonthMarch, value: '3' },\n { label: messages.signUpMonthApril, value: '4' },\n { label: messages.signUpMonthMay, value: '5' },\n { label: messages.signUpMonthJune, value: '6' },\n { label: messages.signUpMonthJuly, value: '7' },\n { label: messages.signUpMonthAugust, value: '8' },\n { label: messages.signUpMonthSeptember, value: '9' },\n { label: messages.signUpMonthOctober, value: '10' },\n { label: messages.signUpMonthNovember, value: '11' },\n { label: messages.signUpMonthDecember, value: '12' },\n ],\n [messages],\n )\n\n const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {\n e.preventDefault()\n const formData = new FormData(e.target as HTMLFormElement)\n const values = Object.fromEntries(formData.entries()) as Record<string, string>\n // Disabled fields are excluded from FormData — restore pre-filled values from context\n if (state.context.email && !values.email) values.email = state.context.email\n if (state.context.phone && !values.phone) values.phone = state.context.phone\n // Strip display formatting so the submitted value is consistent with the disabled-field path\n if (values.phone) {\n values.phone = values.phone.replace(/[^\\d+]/g, '')\n }\n onActionButtonClick('submit-form', values)\n }\n\n return (\n <form\n ref={formRef}\n id=\"follower-authentication-user-form\"\n className={classes.form}\n onSubmit={handleSubmit}\n onInvalid={(e) => e.preventDefault()}\n >\n <TextField\n disabled={loading || Boolean(state.context.email)}\n label={messages.signUpEmailInputLabel}\n id=\"email-input\"\n name=\"email\"\n onChange={checkFieldValidity}\n error={showEmailErrorText}\n helperText={showEmailErrorText && messages.signUpEmailErrorText}\n inputProps={{ type: 'email', required: true }}\n value={emailValue}\n fullWidth\n />\n <Divider className={classes.divider} />\n <TextField\n disabled={loading}\n label={messages.signUpNameInputLabel}\n id=\"name-input\"\n name=\"name\"\n onChange={checkFieldValidity}\n error={showNameErrorText}\n helperText={showNameErrorText && messages.signUpNameErrorText}\n inputProps={{ required: true }}\n value={nameValue}\n fullWidth\n />\n {showPhone && (\n <TextField\n disabled={loading || Boolean(state.context.phone)}\n label={messages.signUpPhoneInputLabel}\n id=\"phone-input\"\n name=\"phone\"\n onChange={checkFieldValidity}\n error={showPhoneErrorText}\n helperText={showPhoneErrorText && messages.signUpPhoneErrorText}\n inputProps={{ required: phoneRequired }}\n value={phoneValue}\n fullWidth\n />\n )}\n {locationOptions.length > 0 && (\n <TextField\n disabled={loading}\n select\n onChange={checkFieldValidity}\n label={messages.signUpLocationInputLabel}\n error={showLocationErrorText}\n helperText={showLocationErrorText && messages.signUpLocationErrorText}\n id=\"location-input\"\n name=\"location\"\n value={locationValue}\n fullWidth\n >\n {locationOptions.map((option) => (\n <MenuItem data-cy=\"option\" key={option.value} value={option.value}>\n {option.label}\n </MenuItem>\n ))}\n </TextField>\n )}\n {(showBirthday || showWeddingAnniversary) && <Divider className={classes.divider} />}\n {showBirthday && (\n <MonthDayPicker\n sectionLabel={messages.signUpBirthdaySectionLabel}\n monthLabel={messages.signUpMonthInputLabel}\n dayLabel={messages.signUpDayInputLabel}\n monthId=\"birthday-month-input\"\n dayId=\"birthday-date-input\"\n monthName=\"birthMonth\"\n dayName=\"birthDay\"\n monthValue={selectedBirthMonth}\n dayValue={selectedBirthDay}\n onMonthChange={setSelectedBirthMonth}\n onDayChange={setSelectedBirthDay}\n required={birthdayRequired}\n disabled={loading}\n monthOptions={monthOptions}\n />\n )}\n {showWeddingAnniversary && (\n <MonthDayPicker\n sectionLabel={messages.signUpWeddingAnniversarySectionLabel}\n monthLabel={messages.signUpMonthInputLabel}\n dayLabel={messages.signUpDayInputLabel}\n monthId=\"wedding-month-input\"\n dayId=\"wedding-date-input\"\n monthName=\"weddingMonth\"\n dayName=\"weddingDay\"\n monthValue={selectedWeddingMonth}\n dayValue={selectedWeddingDay}\n onMonthChange={setSelectedWeddingMonth}\n onDayChange={setSelectedWeddingDay}\n required={weddingAnniversaryRequired}\n disabled={loading}\n monthOptions={monthOptions}\n />\n )}\n <FollowerAuthenticationPrivacyPolicy />\n <Button disabled={loading || !isFormValid} type=\"submit\">\n {messages.completeProfileCtaButtonLabel}\n </Button>\n </form>\n )\n}\n"],"names":[],"mappings":";;;;;;;AAOA,MAAM,cAAc,GAAG,CAAC,KAAa,KAAY;IAC/C,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC;AAC7B,IAAA,IAAI,CAAC,CAAC;AAAE,QAAA,OAAO,EAAE;;IAEjB,MAAM,IAAI,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;AAC7D,IAAA,OAAO,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;AACpB,CAAC;AAED,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,KAAK,MAAM;AACvC,IAAA,IAAI,EAAE;AACJ,QAAA,UAAU,EAAE,QAAQ;AACpB,QAAA,OAAO,EAAE,MAAM;AACf,QAAA,aAAa,EAAE,QAAQ;AACvB,QAAA,OAAO,EAAE,EAAE;AACX,QAAA,KAAK,EAAE,MAAM;AACd,KAAA;A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/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationVipBenefitRows.js
CHANGED
|
@@ -21,7 +21,7 @@ const useStyles = makeStyles((theme) => ({
|
|
|
21
21
|
const FollowerAuthenticationVipBenefitRows = () => {
|
|
22
22
|
const classes = useStyles();
|
|
23
23
|
const { vipBenefitRows, showV2, state } = useFollowerAuthenticationDialogContext();
|
|
24
|
-
const isInitialOrSignUpState = state.value === 'initial' || state.value === 'signUp';
|
|
24
|
+
const isInitialOrSignUpState = state.value === 'initial' || state.value === 'signUp' || state.value === 'completeProfile';
|
|
25
25
|
if (!showV2 || !vipBenefitRows || !isInitialOrSignUpState)
|
|
26
26
|
return null;
|
|
27
27
|
return (React.createElement(Box, { className: classes.main }, vipBenefitRows.map((row, index) => (React.createElement(Box, { key: index, className: classes.vipBenefitRows },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FollowerAuthenticationVipBenefitRows.js","sources":["../../../../src/components/FollowerAuthenticationDialog/FollowerAuthenticationVipBenefitRows.tsx"],"sourcesContent":["import React from 'react'\nimport { useFollowerAuthenticationDialogContext } from './context'\nimport { Box, makeStyles } from '@material-ui/core'\nimport { Icon } from '../Icon'\nimport { Typography } from '../Typography'\n\nconst useStyles = makeStyles((theme) => ({\n main: {\n display: 'flex',\n flexDirection: 'column',\n gridGap: theme.spacing(1.5),\n width: '100%',\n },\n vipBenefitRows: {\n display: 'flex',\n alignItems: 'center',\n flexDirection: 'row',\n gridGap: theme.spacing(2),\n },\n}))\n\nexport const FollowerAuthenticationVipBenefitRows = () => {\n const classes = useStyles()\n const { vipBenefitRows, showV2, state } = useFollowerAuthenticationDialogContext()\n const isInitialOrSignUpState
|
|
1
|
+
{"version":3,"file":"FollowerAuthenticationVipBenefitRows.js","sources":["../../../../src/components/FollowerAuthenticationDialog/FollowerAuthenticationVipBenefitRows.tsx"],"sourcesContent":["import React from 'react'\nimport { useFollowerAuthenticationDialogContext } from './context'\nimport { Box, makeStyles } from '@material-ui/core'\nimport { Icon } from '../Icon'\nimport { Typography } from '../Typography'\n\nconst useStyles = makeStyles((theme) => ({\n main: {\n display: 'flex',\n flexDirection: 'column',\n gridGap: theme.spacing(1.5),\n width: '100%',\n },\n vipBenefitRows: {\n display: 'flex',\n alignItems: 'center',\n flexDirection: 'row',\n gridGap: theme.spacing(2),\n },\n}))\n\nexport const FollowerAuthenticationVipBenefitRows = () => {\n const classes = useStyles()\n const { vipBenefitRows, showV2, state } = useFollowerAuthenticationDialogContext()\n const isInitialOrSignUpState =\n state.value === 'initial' || state.value === 'signUp' || state.value === 'completeProfile'\n\n if (!showV2 || !vipBenefitRows || !isInitialOrSignUpState) return null\n\n return (\n <Box className={classes.main}>\n {vipBenefitRows.map((row, index) => (\n <Box key={index} className={classes.vipBenefitRows}>\n <Icon icon={row.icon} size=\"large\" aria-hidden=\"true\" />\n <Typography>{row.text}</Typography>\n </Box>\n ))}\n </Box>\n )\n}\n"],"names":[],"mappings":";;;;;;AAMA,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,KAAK,MAAM;AACvC,IAAA,IAAI,EAAE;AACJ,QAAA,OAAO,EAAE,MAAM;AACf,QAAA,aAAa,EAAE,QAAQ;AACvB,QAAA,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;AAC3B,QAAA,KAAK,EAAE,MAAM;AACd,KAAA;AACD,IAAA,cAAc,EAAE;AACd,QAAA,OAAO,EAAE,MAAM;AACf,QAAA,UAAU,EAAE,QAAQ;AACpB,QAAA,aAAa,EAAE,KAAK;AACpB,QAAA,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;AAC1B,KAAA;AACF,CAAA,CAAC,CAAC;AAEI,MAAM,oCAAoC,GAAG,MAAK;AACvD,IAAA,MAAM,OAAO,GAAG,SAAS,EAAE;IAC3B,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,sCAAsC,EAAE;AAClF,IAAA,MAAM,sBAAsB,GAC1B,KAAK,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,KAAK,KAAK,iBAAiB;AAE5F,IAAA,IAAI,CAAC,MAAM,IAAI,CAAC,cAAc,IAAI,CAAC,sBAAsB;AAAE,QAAA,OAAO,IAAI;AAEtE,IAAA,QACE,KAAA,CAAA,aAAA,CAAC,GAAG,EAAA,EAAC,SAAS,EAAE,OAAO,CAAC,IAAI,EACzB,EAAA,cAAc,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,MAC7B,oBAAC,GAAG,EAAA,EAAC,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,cAAc,EAAA;AAChD,QAAA,KAAA,CAAA,aAAA,CAAC,IAAI,EAAA,EAAC,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,IAAI,EAAC,OAAO,EAAA,aAAA,EAAa,MAAM,EAAG,CAAA;QACxD,KAAC,CAAA,aAAA,CAAA,UAAU,EAAE,IAAA,EAAA,GAAG,CAAC,IAAI,CAAc,CAC/B,CACP,CAAC,CACE;AAEV;;;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const northAmericanPhoneRegex = /^(\+?1[\s.-]?)?(\([2-9]\d{2}\)|[2-9]\d{2})[-\s.]?[2-9]\d{2}[-\s.]?\d{4}$/;
|
|
2
|
+
const ukPhoneRegex = /^((\+?44\s?|0044\s?)(\s?\d{3,5}|\(\d{3,5}\))(\s?\d{3,4})(\s?\d{3,4})$|^07\d{3}\s?\d{6}$)/;
|
|
3
|
+
const validatePhoneNumber = (phone) => {
|
|
4
|
+
if (!phone)
|
|
5
|
+
return false;
|
|
6
|
+
return northAmericanPhoneRegex.test(phone) || ukPhoneRegex.test(phone);
|
|
7
|
+
};
|
|
8
|
+
const formatPatterns = [
|
|
9
|
+
{ pattern: /^(1)([2-9]\d{2})(\d{3})(\d{4})$/, format: '+{1} ({2}) {3}-{4}', international: true },
|
|
10
|
+
{ pattern: /^([2-9]\d{2})(\d{3})(\d{4})$/, format: '({1}) {2}-{3}', international: false },
|
|
11
|
+
{ pattern: /^(44)(\d{4})(\d{6})$/, format: '+{1} {2} {3}', international: true },
|
|
12
|
+
{ pattern: /^(07\d{3})(\d{6})$/, format: '{1} {2}', international: false },
|
|
13
|
+
];
|
|
14
|
+
const formatPhoneNumber = (value) => {
|
|
15
|
+
if (!value)
|
|
16
|
+
return '';
|
|
17
|
+
const isInternational = value.startsWith('+');
|
|
18
|
+
const digits = value.replace(/\D/g, '');
|
|
19
|
+
if (!digits)
|
|
20
|
+
return isInternational ? '+' : '';
|
|
21
|
+
for (const { pattern, format, international } of formatPatterns) {
|
|
22
|
+
if (isInternational && !international)
|
|
23
|
+
continue;
|
|
24
|
+
const m = digits.match(pattern);
|
|
25
|
+
if (m)
|
|
26
|
+
return m.slice(1).reduce((result, match, i) => result.replace(`{${i + 1}}`, match), format);
|
|
27
|
+
}
|
|
28
|
+
return isInternational ? `+${digits}` : digits;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export { formatPhoneNumber, validatePhoneNumber };
|
|
32
|
+
//# sourceMappingURL=phoneValidation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phoneValidation.js","sources":["../../../../src/components/FollowerAuthenticationDialog/phoneValidation.ts"],"sourcesContent":["const northAmericanPhoneRegex = /^(\\+?1[\\s.-]?)?(\\([2-9]\\d{2}\\)|[2-9]\\d{2})[-\\s.]?[2-9]\\d{2}[-\\s.]?\\d{4}$/\nconst ukPhoneRegex = /^((\\+?44\\s?|0044\\s?)(\\s?\\d{3,5}|\\(\\d{3,5}\\))(\\s?\\d{3,4})(\\s?\\d{3,4})$|^07\\d{3}\\s?\\d{6}$)/\n\nexport const validatePhoneNumber = (phone: string): boolean => {\n if (!phone) return false\n return northAmericanPhoneRegex.test(phone) || ukPhoneRegex.test(phone)\n}\n\nconst formatPatterns = [\n { pattern: /^(1)([2-9]\\d{2})(\\d{3})(\\d{4})$/, format: '+{1} ({2}) {3}-{4}', international: true },\n { pattern: /^([2-9]\\d{2})(\\d{3})(\\d{4})$/, format: '({1}) {2}-{3}', international: false },\n { pattern: /^(44)(\\d{4})(\\d{6})$/, format: '+{1} {2} {3}', international: true },\n { pattern: /^(07\\d{3})(\\d{6})$/, format: '{1} {2}', international: false },\n]\n\nexport const formatPhoneNumber = (value: string): string => {\n if (!value) return ''\n const isInternational = value.startsWith('+')\n const digits = value.replace(/\\D/g, '')\n if (!digits) return isInternational ? '+' : ''\n for (const { pattern, format, international } of formatPatterns) {\n if (isInternational && !international) continue\n const m = digits.match(pattern)\n if (m) return m.slice(1).reduce((result, match, i) => result.replace(`{${i + 1}}`, match), format)\n }\n return isInternational ? `+${digits}` : digits\n}\n"],"names":[],"mappings":"AAAA,MAAM,uBAAuB,GAAG,0EAA0E;AAC1G,MAAM,YAAY,GAAG,0FAA0F;AAElG,MAAA,mBAAmB,GAAG,CAAC,KAAa,KAAa;AAC5D,IAAA,IAAI,CAAC,KAAK;AAAE,QAAA,OAAO,KAAK;AACxB,IAAA,OAAO,uBAAuB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC;AACxE;AAEA,MAAM,cAAc,GAAG;IACrB,EAAE,OAAO,EAAE,iCAAiC,EAAE,MAAM,EAAE,oBAAoB,EAAE,aAAa,EAAE,IAAI,EAAE;IACjG,EAAE,OAAO,EAAE,8BAA8B,EAAE,MAAM,EAAE,eAAe,EAAE,aAAa,EAAE,KAAK,EAAE;IAC1F,EAAE,OAAO,EAAE,sBAAsB,EAAE,MAAM,EAAE,cAAc,EAAE,aAAa,EAAE,IAAI,EAAE;IAChF,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,KAAK,EAAE;CAC3E;AAEY,MAAA,iBAAiB,GAAG,CAAC,KAAa,KAAY;AACzD,IAAA,IAAI,CAAC,KAAK;AAAE,QAAA,OAAO,EAAE;IACrB,MAAM,eAAe,GAAG,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC;IAC7C,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;AACvC,IAAA,IAAI,CAAC,MAAM;QAAE,OAAO,eAAe,GAAG,GAAG,GAAG,EAAE;IAC9C,KAAK,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,cAAc,EAAE;QAC/D,IAAI,eAAe,IAAI,CAAC,aAAa;YAAE;QACvC,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC;AAC/B,QAAA,IAAI,CAAC;AAAE,YAAA,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,KAAK,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA,CAAA,CAAG,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC;;IAEpG,OAAO,eAAe,GAAG,CAAA,CAAA,EAAI,MAAM,CAAA,CAAE,GAAG,MAAM;AAChD;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@popmenu/common-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.154.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Popmenu Design System Team",
|
|
6
6
|
"description": "React components for all Popmenu apps on the web.",
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"react": "18.x || 19.x"
|
|
32
32
|
},
|
|
33
33
|
"sideEffects": false,
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "5a7633f43ac0b6a3af67866a1d2467143fb7a946"
|
|
35
35
|
}
|