1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]="01a0d5ca-54f1-7300-be6e-aea97962882b")}catch(e){}}();!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[(new e.Error).stack]=function(e){for(var n=1;n<arguments.length;n++){var i=arguments[n];if(null!=i)for(var a in i)i.hasOwnProperty(a)&&(e[a]=i[a])}return e}({},e._sentryModuleMetadata[(new e.Error).stack],{"_sentryBundlerPluginAppKey:coastline-legacy":!0})}catch(e){}}(),(globalThis.webpackChunklegacy=globalThis.webpackChunklegacy||[]).push([[3932],{87664(e,n,i){i.d(n,{A:()=>d});i(72176);var a=i(89734),t=i(95826),r=i(80812);function d(){return(0,r.jsxs)("div",{style:{height:100,display:"flex",justifyContent:"center",flexDirection:"column",alignItems:"center",marginBottom:20},children:[(0,r.jsx)(a.A,{style:{position:"absolute",fontSize:64},color:"primary",className:"car-animation"}),(0,r.jsx)(t.A,{size:100,color:"secondary",style:{position:"absolute"}})]})}},29271(e,n,i){i.d(n,{A:()=>p});i(72176);var a=i(67081),t=i(16357),r=i(58380),d=i(885),s=i(7281),o=i(82607),l=i(37759),u=i(37476),c=i(64142),m=i(80812);const p=e=>{var n,i;let{shippingMethodId:p,onChange:h,isReOrder:y=!1,addedFee:v=0}=e;const k=(0,u.A)(),g=(null===(n=c.U[p])||void 0===n?void 0:n.amount)||0;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(a.A,{sx:{mb:2,pt:2},children:(0,m.jsxs)(t.A,{children:[!y&&(0,m.jsx)(r.A,{variant:"body2",color:"text.secondary",gutterBottom:!0,children:"Standard shipping is free with your Driver's-Ed course completion. Need it faster? Choose an upgrade below."}),(0,m.jsx)(d.A,{component:"fieldset",sx:{width:"100%"},children:(0,m.jsx)(s.A,{"aria-label":"Shipping method",value:p,children:Object.entries(c.U).map(e=>{let[n,i]=e;const a=p===n;return(0,m.jsxs)(o.A,{"data-cy":`shipping-method-${n}`,onClick:()=>h(n),sx:{display:"flex",alignItems:"flex-start",border:a?`2px solid ${k.palette.secondary.main}`:`1px solid ${k.palette.divider}`,borderRadius:2,p:2,mb:1,cursor:"pointer"},children:[(0,m.jsx)(l.A,{checked:a,value:n,slotProps:{input:{"aria-label":i.label}},sx:{mt:.5},onClick:()=>h(n)}),(0,m.jsxs)(o.A,{sx:{ml:1,flex:1},children:[(0,m.jsxs)(r.A,{variant:"subtitle1",sx:{fontWeight:600},children:[i.label.split(" - ")[0]," ",(0,m.jsx)("span",{style:{color:k.palette.primary.main},children:i.amount>0?`\u2013 $${i.amount}`:"\u2013 FREE"})]}),(0,m.jsxs)(r.A,{variant:"body2",color:"textSecondary",children:["Arrival: ",i.arrival,(0,m.jsx)("br",{}),"Processing: ",i.processing,(0,m.jsx)("br",{}),"Tracking: ",i.tracking]})]})]},n)})})})]})}),(0,m.jsx)(a.A,{sx:{mb:3},children:(0,m.jsxs)(t.A,{children:[(0,m.jsx)(r.A,{variant:"h6",gutterBottom:!0,children:"Order Summary"}),(0,m.jsxs)(o.A,{children:[y&&(0,m.jsxs)(o.A,{sx:{display:"flex",justifyContent:"space-between"},children:[(0,m.jsx)("span",{children:"Replacement Certificate:"}),(0,m.jsx)("span",{children:v>0?(0,c.up)(v):"Free"})]}),(0,m.jsxs)(o.A,{sx:{display:"flex",justifyContent:"space-between",mb:1},children:[(0,m.jsxs)("span",{children:["Shipping (",null===(i=c.U[p])||void 0===i?void 0:i.label,"):"]}),(0,m.jsx)("span",{children:g>0?(0,c.up)(g):"Free"})]})]}),(0,m.jsxs)(o.A,{sx:{display:"flex",justifyContent:"space-between",borderTop:"1px solid #ccc",pt:1,mt:1},children:[(0,m.jsx)(r.A,{variant:"h6",children:"Total:"}),(0,m.jsx)(r.A,{variant:"h6",children:(0,c.up)(g+v)})]})]})})]})}},23135(e,n,i){i.d(n,{A:()=>L});var a=i(72176),t=i(24415),r=i(22526),d=i(4881),s=i(30788),o=i(42647),l=i(37237),u=i.n(l),c=i(64142),m=i(82607),p=i(19750),h=i(58885),y=i(15107),v=i(21392),k=i(74090),g=i(80468),f=i(64421),b=i(99196),x=i(3661),I=i(5947),C=i(48456),N=i(63192),j=i(57388);const S={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CreateStripePaymentFormDirectCharge"}
1,variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"input"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"CreateDirectChargeInput"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"createDirectCharge"},arguments:[{kind:"Argument",name:{kind:"Name",value:"input"},value:{kind:"Variable",name:{kind:"Name",value:"input"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"amountCents"}},{kind:"Field",name:{kind:"Name",value:"customerId"}},{kind:"Field",name:{kind:"Name",value:"latestCharge"}},{kind:"Field",name:{kind:"Name",value:"paymentIntentId"}},{kind:"Field",name:{kind:"Name",value:"paymentMethodType"}},{kind:"Field",name:{kind:"Name",value:"status"}}]}}]}}]};var A=i(80812);r.J1` 2 mutation CreateStripePaymentFormDirectCharge( 3 $input: CreateDirectChargeInput! 4 ) { 5 createDirectCharge(input: $input) { 6 amountCents 7 customerId 8 latestCharge 9 paymentIntentId 10 paymentMethodType 11 status 12 } 13 } 14`;const w=e=>{let{paymentConfirmedCallback:n,chargeDescription:i,userId:t,userEmail:r,amount:d,state:s="CA",userName:l="",buttonLabel:u="Make Payment",isTaxable:c=!1,directChargeSource:m,onBeforeSubmit:h}=e;const[y,w]=(0,a.useState)(!1),D=a.useRef(!1),[O,F]=(0,a.useState)(""),T=a.useRef(!1),[P,M]=(0,a.useState)(!1),[$,E]=(0,a.useState)((0,C.gZ)()),R=e=>{const n=T.current?`\n There was a problem processing your payment: ${e} Please\n try again, or contact your bank if your charge was declined.\n They can usually help you quickly with this type of issue.`:`Your payment appears to have gone through, but there was a problem completing your purchase.\n DO NOT try your payment again.\n Please call our support team at ${j.Sv} and we'll complete your purchase.`;E((0,C.gZ)()),F(n),w(!1),D.current=!1,M(!0)},[V]=(0,o.n)(S,{onCompleted:async e=>{var i,a;let{createDirectCharge:t}=e;T.current=!1,await n({amount:t.amountCents,customer:null!==(i=t.customerId)&&void 0!==i?i:null,id:t.paymentIntentId,last_payment_error:null,latest_charge:t.latestCharge,payment_method_type:null!==(a=t.paymentMethodType)&&void 0!==a?a:void 0,status:t.status}).catch(()=>{R(j.c1)})},onError:e=>{T.current=!0,R(e.message)}}),_=()=>{M(!1)};return(0,A.jsxs)(I.A,{trackingId:$,userName:l,onSubmit:async e=>{var n;if(!D.current){var a;if(e.error||null===(n=e.paymentMethod)||void 0===n||!n.id)return T.current=!0,void R((null===(a=e.error)||void 0===a?void 0:a.message)||"There was an issue with stripe, please try again");if(D.current=!0,w(!0),F(""),h){const e=await h();if(!e.canProceed)return w(!1),D.current=!1,void(e.errorMessage&&F(e.errorMessage))}V({variables:{input:{paymentMethodId:e.paymentMethod.id,email:r,amountCents:Math.round(100*d),description:i,idempotencyKey:$,userId:t,state:s,...c?{isTaxable:!0}:{},...m?{source:m}:{}}}})}},showLoadingDialog:y,children:[(0,A.jsx)("div",{"data-cy":"make-payment-button",children:(0,A.jsx)(N.A,{style:{marginTop:20},isLoading:y,type:"submit",isDisabled:!T.current&&!!O,loadingText:"Processing...",children:!T.current&&O?"Disabled due to error":u})}),(0,A.jsx)("br",{}),O&&(0,A.jsx)(v.A,{severity:"error","data-cy":"alert-box",children:O}),(0,A.jsxs)(k.A,{open:P,onClose:(e,n)=>{"backdropClick"!==n&&"escapeKeyDown"!==n&&_()},"data-cy":"payment-error-dialog",children:[(0,A.jsx)(g.A,{children:"Payment Error"}),(0,A.jsx)(f.A,{children:(0,A.jsx)(x.A,{id:"alert-dialog-description",children:O})}),(0,A.jsx)(b.A,{children:(0,A.jsx)(p.A,{onClick:_,color:"primary",children:"Acknowledge"})})]})]})};var D=i(97900),O=i(11816);const F={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"CheckExistingOrder"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"studentId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"courseId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"shippingOrders"},arguments:[{kind:"Argument",name:{kind:"Name",value:"query"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"studentId"},value:{kind:"Variable",name:{kind:"Name",value:"studentId"}}},{kind:"ObjectField",name:{kind:"Name",value:"courseId"},value:{kind:"Variable",name:{kind:"Name",value:"courseId"}}}]}},{kind:"Argument",name:{kind:"Name",value:"pageQuery"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"first"},value:{kind:"IntValue",value:"1"}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"edges"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"node"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"isReOrder"}}]}}]}}]}},{kind:"Field",name:{kind:"Name",value:"courseOrder"},arguments:[{kind:"Argument",name:{kind:"Name",value:"studentId"},value:{kind:"Variable",name:{kind:"Name",value:"studentId"}}},{kind:"Argument",name:{kind:"Name",value:"courseId"},value:{kind:"Variable",name:{kind:"Name",value:"courseId"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"courseId"}},{kind:"Field",name:{kind:"Name",value:"shipping"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"isComplete"}}]}}]}}]}}]},T={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CreateShippingOrder"}
14,variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"input"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"CreateShippingOrderInput"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"createShippingOrder"},arguments:[{kind:"Argument",name:{kind:"Name",value:"input"},value:{kind:"Variable",name:{kind:"Name",value:"input"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}}]}}]}}]};var P=i(16672),M=i(2758),$=i(51800),E=i(21810);const R="New",V="Existing";const _=async e=>{let{userId:n,email:i,orderInfo:a,product:t,chargeId:r,state:d,isFirstPurchase:s,isKnownMinor:o=!1}=e;const l=function(){return arguments.length>0&&void 0!==arguments[0]&&!arguments[0]?V:R}(s);await(0,c.BP)({transactionId:r,value:a.amountDollars,customerType:l===R?"new":"returning",itemId:t.id,itemName:t.title,productType:(0,c.wA)(t.hasCourse,t.hasLessons),state:d,enhancedConversionEmail:i,isKnownMinor:o}),(0,E.u4)("Order Completed",{uid:n,userEmail:i,email:i,conversionValue:a.conversionValue||a.amountDollars,value:a.amountDollars,revenue:a.amountDollars,total:a.amountDollars,revenueType:a.revenueType||null,orderCategory:t.hasCourse?"course":"lesson",orderId:r,order_id:r,transaction_id:r,customerStatus:l,state:d,products:[{productId:t.id,name:t.title,category:a.category,price:a.amountDollars,revenue:a.amountDollars,quantity:1}]},{context:{traits:{status:l}}})};var Y=i(33718);const B="A certificate order for this course has already been placed. Please refresh the page or contact support if you need assistance.";r.J1` 15 query CheckExistingOrder($studentId: ID!, $courseId: ID!) { 16 shippingOrders( 17 query: { studentId: $studentId, courseId: $courseId } 18 pageQuery: { first: 1 } 19 ) { 20 edges { 21 node { 22 id 23 isReOrder 24 } 25 } 26 } 27 courseOrder(studentId: $studentId, courseId: $courseId) { 28 id 29 courseId 30 shipping { 31 isComplete 32 } 33 } 34 } 35 36 mutation CreateShippingOrder($input: CreateShippingOrderInput!) { 37 createShippingOrder(input: $input) { 38 id 39 } 40 } 41`;const L=e=>{var n,i,r,l,v;let{studentId:k,studentEmail:g,shippingMethod:f,courseId:b,courseCompletionDate:x,address:I,isReOrder:j=!1,addedFee:S=0,onPaymentComplete:E,onBack:R}=e;const V=(0,t.wA)(),L=(0,t.d4)(e=>e.firebase.auth),{userProfile:q}=(0,Y.s)(),{label:K,amount:U,productId:Z}=c.U[f],z="CA",Q=(0,O.f)(z,"production"),J=U+S,W=a.useRef(""),[G,H]=a.useState(!0),{data:X}=(0,d.IT)(F,{variables:{studentId:k||L.uid,courseId:b},skip:!b||j}),[ee]=(0,s._)(F,{fetchPolicy:"network-only"}),ne=(null===X||void 0===X||null===(n=X.shippingOrders)||void 0===n||null===(i=n.edges)||void 0===i?void 0:i.some(e=>!e.node.isReOrder))||(null===X||void 0===X||null===(r=X.courseOrder)||void 0===r||null===(l=r.shipping)||void 0===l?void 0:l.isComplete),[ie]=(0,o.n)(M.nu),[ae,{loading:te}]=(0,o.n)(T,{refetchQueries:[{query:P.PB,variables:{studentId:k||L.uid}}],onCompleted:async()=>{const e={amountDollars:J,category:"Course Shipping"},n={id:j?`certificate-replacement-${f}`:`course-shipping-${f}`,title:j?`Replacement - ${K}`:K,hasCourse:!1,hasLessons:!1};await _({userId:k||L.uid,email:g||(null===q||void 0===q?void 0:q.email)||L.email||"",orderInfo:e,product:n,chargeId:W.current||(0,C.gZ)(),state:z,isFirstPurchase:!1,isKnownMinor:Boolean(I.dob&&(0,c.Cb)(I.dob)<18)});const i=0===J?"Your certificate has been ordered.":"Payment complete. Your certificate has been ordered.";V((0,D.wB)(i,"success")),null===E||void 0===E||E()},onError:e=>{var n;let i="We couldn't process your order. Please contact support for assistance.";(null===(n=e.graphQLErrors)||void 0===n?void 0:n.some(e=>{var n;return"CONFLICT"===(null===(n=e.extensions)||void 0===n?void 0:n.code)}))?i=B:J>0&&(i="Payment was successful, but we couldn't process your order. Please contact support for assistance."),V((0,D.wB)(i,"error"))}});a.useEffect(()=>{H(!1)},[]);const re=async e=>{let n="";if(j&&(n="REPLACEMENT ORDER",x)){n+=` - Original completion date: ${u()(x).format("MM/DD/YYYY")}`}if(e&&J>0){const{customer:n,latest_charge:i}=e;if(!i)throw new Error("Missing Stripe charge ID for shipping payment.");W.current=i,await ie({variables:{input:{studentAddress:(0,C.FZ)(I),studentId:k||L.uid,amountDollars:J,description:j?`${K} [Replacement Certificate Fee]`:`${K} [Shipping Fee]`,stripeChargeId:i,stripeCustomerId:null!==n&&void 0!==n?n:"",categoryId:$.JP.Stripe,usStateId:z.toUpperCase(),items:[{itemId:(0,C.gZ)(),productId:Z,quantity:1,customPrice:J}]}}})}await ae({variables:{input:{studentId:k||L.uid,courseId:b,isReOrder:j,shippingDetails:{amount:J,label:K},firstName:I.firstName,middleName:I.middleName,lastName:I.lastName,address:I.address,city:I.city,state:I.state,email:g||(null===q||void 0===q?void 0:q.email)||L.email||"",zipcode:I.zipcode,phone:I.phone,dob:"number"===typeof I.dob?u()(I.dob).format("MM/DD/YYYY"):I.dob,note:n,dlNumber:I.dlNumber}}})},de=0===J,se=j?"Replacement Certificate Payment":"Certificate Shipping Payment";let oe="";return oe=de?j?"Your replacement certificate will be processed and shipped at no cost.":"Your certificate will be processed and shipped at no cost.":`Complete your payment of $${J} for ${K}. Your certificate will be processed and mailed on the next business day.`,G?null:!j&&ne?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("h2",{style:{marginTop:0},children:"Order Already Exists"}),(0,A.jsx)("p",{children:"A certificate order for this course has already been placed and may already be on the way. If you need assistance, please contact us."}),(0,A.jsx)(m.A,{display:"flex",gap:1,justifyContent:"flex-end",children:(0,A.jsx)(p.A,{color:"primary",variant:"contained",component:h.N_,to:"/contact",children:"Contact Support"})})]}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("h2",{style:{marginTop:0},children:se}),(0,A.jsx)("p",{children:oe}),!de&&(0,A.jsx)(y.A,{apiKey:Q,children:(0,A.jsx)(w,{amount:J,paymentConfirmedCallback:re,userEmail:L.email,chargeDescription:j?`Replacement Certificate - ${K}`:K,userName:null!==(v=null===q||void 0===q?void 0:q.userName)&&void 0!==v?v:"",buttonLabel:"Place Order",userId:L.uid,state:z,directChargeSource:$.Ps.CERTIFICATE_SHIPPING,onBeforeSubmit:async()=>{var e,n,i,a;if(j)return{canProceed:!0};const{data:t}=await ee({variables:{studentId:k||L.uid,courseId:b}});return(null===t||void 0===t||null===(e=t.shippingOrders)||void 0===e||null===(n=e.edges)||void 0===n?void 0:n.some(e=>!e.node.isReOrder))||(null===t||void 0===t||null===(i=t.courseOrder)||void 0===i||null===(a=i.shipping)||void 0===a?void 0:a.isComplete)?{canProceed:!1,errorMessage:B}:{canProceed:!0}}})}),(0,A.jsxs)(m.A,{display:"flex",gap:1,justifyContent:"flex-end",children:[(0,A.jsx)(N.A,{isLoading:te,color:"primary",variant:"outlined",clickedCallback:async()=>{null===R||void 0===R||R()},children:"Back"}),de&&(0,A.jsx)(N.A,{isLoading:te,variant:"contained",color:"primary",clickedCallback:()=>re(),children:"Complete Order"})]})]})}}}]); 42//# chunkId=01a0d5ca-54f1-7300-be6e-aea97962882b
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.