{"version":3,"file":"OfferSignupForm_1.CaFp2DHy.mjs","names":["useState","__esmMin","init_ssg_sandbox_shims","_e","init_jsx_runtime","c","p","init_npm_react_18_3_1","ce","window","init_framer_CN96F41L","addPropertyControls","ControlType","init_Constants","spacing","CodablePrimaryButton","PhoneInput","init_Checkbox_6HGi","init_PhoneInput_SnSe","Checkbox","isValidPhoneNumber","init_CodablePrimaryButton_hjJA","init_npm_libphonenumber_js_1_11_4","OfferSignupForm","isSelected","setIsSelected","phoneNumber","setPhoneNumber","phoneError","setPhoneError","countryCode","setCountryCode","fetchedUrlParameters","setFetchedUrlParameters","phoneNumberUrlParameter","getPhoneNumberFromUrl","styles","number","code","formattedPhoneNumber","parameters","key","framerParameters","props","val","init_OfferSignupForm_1"],"sources":["https:/framerusercontent.com/modules/bwRz021EYSrSuSdGgf6l/r5QUsy6v9n57ddgLmQdo/OfferSignupForm_1.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import Checkbox from\"https://framer.com/m/Checkbox-6HGi.js@ZCBZmszzxeXzmj9ehrzn\";import CodablePrimaryButton from\"https://framer.com/m/CodablePrimaryButton-hjJA.js@nUxTef7NT42msFVh6UpB\";import PhoneInput from\"https://framer.com/m/PhoneInput-SnSe.js@Ryluk3eKNy5rQbe6I7D0\";import{spacing}from\"https://framer.com/m/Constants-e8LZ.js@WWFLc94a635DVsxeJKyF\";import{useState,useEffect}from\"react\";import{isValidPhoneNumber}from\"libphonenumber-js\";export default function OfferSignupForm(props){const[isSelected,setIsSelected]=useState(false);const[phoneNumber,setPhoneNumber]=useState(\"\");const[phoneError,setPhoneError]=useState(undefined);const[countryCode,setCountryCode]=useState(1);const[fetchedUrlParameters,setFetchedUrlParameters]=useState(false);useEffect(()=>{if(fetchedUrlParameters){return;}const phoneNumberUrlParameter=getPhoneNumberFromUrl();if(phoneNumberUrlParameter?.length>10){if(phoneNumberUrlParameter.startsWith(\"1\")){setCountryCode(1);}else if(phoneNumberUrlParameter.startsWith(\"44\")){setCountryCode(44);}setPhoneNumber(phoneNumberUrlParameter.slice(-10));}},[setFetchedUrlParameters,fetchedUrlParameters,setPhoneNumber]);const handleCheckboxChange=()=>{setIsSelected(!isSelected);};const handlePhoneNumberChange=number=>{setPhoneNumber(number);setPhoneError(undefined);};const handleCountryCodeChange=code=>{setCountryCode(code);};const onSubmit=()=>{const formattedPhoneNumber=\"+\"+countryCode+phoneNumber.replaceAll(\"-\",\"\");if(formattedPhoneNumber.length<12||!isValidPhoneNumber(formattedPhoneNumber)){setPhoneError(\"Please enter a valid phone number\");return;}// Start with the originating parameters\nconst parameters=new URLSearchParams(window.location.search);for(let key of parameters.keys()){// These keys must be removed from the originating parameters\n// The Framer set values take precedence\nif([\"phoneNumber\",\"smsMarketingOptInStatus\",\"redirectDestination\"].includes(key)){parameters.delete(key);}}const framerParameters=new URLSearchParams({phoneNumber:formattedPhoneNumber,partnerName:props.partnerName,promoName:props.promoName,smsMarketingOptInStatus:isSelected?\"true\":\"false\",redirectDestination:props.redirectDestination,membershipType:props.membershipType,userAudience:props.userAudience,utm_content:props.utmContent,utm_medium:props.utmMedium,utm_source:props.utmSource,utm_campaign:props.utmCampaign,utm_term:props.utmTerm,registration_referrer:window.document.referrer,registration_source:props.partnerName,eligibility:props.eligibility,eligibleMessageTemplate:props.messageTemplateEligible,ineligibleMessageTemplate:props.messageTemplateIneligible});for(let[key,val]of framerParameters.entries()){if(val){parameters.append(key,val);}}window.open(\"http://gopuff.com/partner-onboarding-magic-link-confirmation?\"+parameters,\"_self\");};return /*#__PURE__*/_jsxs(\"div\",{style:styles.container,children:[/*#__PURE__*/_jsx(PhoneInput,{onChange:handlePhoneNumberChange,error:phoneError,value:phoneNumber,onCountryCodeChange:handleCountryCodeChange,countryCode:countryCode}),/*#__PURE__*/_jsx(CodablePrimaryButton,{onClick:onSubmit,text:props.buttonText}),props.checkboxText.length>0&&/*#__PURE__*/_jsx(Checkbox,{selected:isSelected,onChange:handleCheckboxChange,text:props.checkboxText})]});}const styles={container:{display:\"flex\",flexDirection:\"column\",gap:spacing.s16,overflow:\"visible\"}};// Props\nOfferSignupForm.defaultProps={checkboxText:\"By submitting, you agree to messaging from Gopuff. Msg & data rates may apply.\",buttonText:\"Get your special offer\",partnerName:undefined,promoName:undefined,membershipType:undefined,userAudience:undefined};addPropertyControls(OfferSignupForm,{buttonText:{title:\"Button Text\",type:ControlType.String},checkboxText:{title:\"Checkbox Text\",type:ControlType.String},partnerName:{title:\"Partner Name\",type:ControlType.Enum,options:[\"Gopuff\",\"Apple\",\"Cash App\",\"Bilt\",\"JetBlue\",\"Goodtime Hotel\",\"NIFT\",\"NYC Apartments\",\"Warehouse Wine and Spirits\",\"BevMo\"]},promoName:{title:\"Promo Name\",type:ControlType.String},membershipType:{title:\"Membership Type\",type:ControlType.Enum,defaultValue:\"none\",options:[\"None\",\"FAM\",\"Student FAM\"]},userAudience:{title:\"User Audience\",type:ControlType.String},redirectDestination:{title:\"Redirect Destination\",type:ControlType.Enum,defaultValue:\"app\",options:[\"app\",\"web\"]},utmContent:{title:\"utm_content\",type:ControlType.String},utmMedium:{title:\"utm_medium\",type:ControlType.String},utmSource:{title:\"utm_source\",type:ControlType.String},utmCampaign:{title:\"utm_campaign\",type:ControlType.String},utmTerm:{title:\"utm_term\",type:ControlType.String},eligibility:{title:\"Eligibility\",type:ControlType.Enum,defaultValue:\"NO_ACCOUNT\",options:[\"NO_ACCOUNT\",\"NEWBIE\",\"ANYONE\"]},messageTemplateEligible:{title:\"Eligibile Message Template\",type:ControlType.String},messageTemplateIneligible:{title:\"Ineligible Message Template\",type:ControlType.String}});function getPhoneNumberFromUrl(){return new URLSearchParams(window.location.search).get(\"phoneNumber\");}\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"OfferSignupForm\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n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